public List <ChronicMentalDiseaseVisitModel> DataTableToList(DataTable dt)
        {
            List <ChronicMentalDiseaseVisitModel> list = new List <ChronicMentalDiseaseVisitModel>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    ChronicMentalDiseaseVisitModel item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
 public ChronicMentalDiseaseVisitModel GetModelFollowUpDate(ChronicMentalDiseaseVisitModel model)
 {
     return(this.dal.GetModelFollowUpDate(model));
 }
 public ChronicMentalDiseaseVisitModel ExistsCheckDate(ChronicMentalDiseaseVisitModel model)
 {
     return(this.dal.ExistsCheckDate(model));
 }
 public int AddServer(ChronicMentalDiseaseVisitModel model)
 {
     return(this.dal.AddServer(model));
 }
 public bool UpdateServer(ChronicMentalDiseaseVisitModel model)
 {
     return(this.dal.UpdateServer(model));
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 精神疾病
        /// </summary>
        /// <param name="IDCardNo"></param>
        /// <param name="CheckDate"></param>
        /// <param name="VersionNo"></param>
        /// <param name="Model"></param>
        public void SaveMental(string IDCardNo, DateTime CheckDate, string VersionNo, RecordsBaseInfoModel Model)
        {
            try
            {
                // 获取最后一次随访数据
                ChronicMentalDiseaseVisitModel mentalOldModel = MentalDiseaseVisitBLL.GetMaxModel(IDCardNo, VersionNo);
                if (mentalOldModel == null)
                {
                    mentalOldModel = new ChronicMentalDiseaseVisitModel();
                }
                ChronicMentalDiseaseVisitModel mentalNewModel = new ChronicMentalDiseaseVisitModel();

                #region 精神疾病基本信息

                // 是否有基本信息
                int count = MentalDiseaseBaseBLL.GetDataCount(IDCardNo);

                if (count < 1)
                {
                    // 新增精神疾病基本信息
                    ChronicMentalDiseaseBaseInfoModel baseModel = new ChronicMentalDiseaseBaseInfoModel()
                    {
                        IDCardNo       = IDCardNo,
                        RecordID       = Model.RecordID,
                        CreatedBy      = ConfigHelper.GetNodeDec("doctor"),
                        CreatedDate    = DateTime.Now,
                        LastUpdateBy   = ConfigHelper.GetNodeDec("doctor"),
                        LastUpDateDate = DateTime.Now
                    };

                    MentalDiseaseBaseBLL.Add(baseModel);
                }

                #endregion

                #region 随访信息

                mentalNewModel = EntityAssignment <ChronicMentalDiseaseVisitModel>(mentalOldModel, mentalNewModel);

                mentalNewModel.IDCardNo         = IDCardNo;
                mentalNewModel.RecordID         = Model.RecordID;
                mentalNewModel.FollowUpDate     = CheckDate;
                mentalNewModel.NextFollowUpDate = CheckDate.AddMonths(3);
                mentalNewModel.FollowUpDoctor   = ConfigHelper.GetNode("doctorName");
                mentalNewModel.CreatedBy        = ConfigHelper.GetNodeDec("doctor");
                mentalNewModel.CreatedDate      = DateTime.Now;
                mentalNewModel.LastUpdateBy     = ConfigHelper.GetNodeDec("doctor");
                mentalNewModel.LastUpdateDate   = DateTime.Now;

                #endregion

                #region 保存默认值

                if (VersionNo.Contains("3.0"))
                {
                    mentalNewModel.FollowUpType = mentalNewModel.VisitType;
                }

                // 随访信息存档
                int id = MentalDiseaseVisitBLL.Add(mentalNewModel, VersionNo);

                #endregion
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex.ToString());
                throw ex;
            }
        }
Ejemplo n.º 7
0
 public int Add(ChronicMentalDiseaseVisitModel model, string Version = "V2.0")
 {
     return(this.dal.Add(model, Version));
 }
        public int Add(ChronicMentalDiseaseVisitModel model, string VersionNo)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("INSERT INTO CD_MENTALDISEASE_FOLLOWUP(");
            builder.Append("CustomerID,RecordID,IDCardNo,Fatalness,PresentSymptom,PresentSymptoOther,");

            if (VersionNo.Contains("3.0"))
            {
                builder.Append(" VisitDate,VisitDoctor,NextVisitDate,VisitType, ");
            }
            else
            {
                builder.Append(" FollowUpDate,FollowUpDoctor,NextFollowUpDate,FollowUpType, ");
            }

            builder.Append("Insight,SleepQuality,Diet,PersonalCare,Housework,ProductLaborWork,LearningAbility,");
            builder.Append("SocialInterIntera,MildTroubleFrequen,CreateDistuFrequen,CauseAccidFrequen,AutolesionFrequen,");
            builder.Append("AttemptSuicFrequen,AttemptSuicideNone,LockCondition,HospitalizatiStatus,LastLeaveHospTime,");
            builder.Append("LaborExaminati,LaborExaminatiHave,MedicatioCompliance,AdnerDruReact,AdverDruReactHave,");
            builder.Append("TreatmentEffect,WhetherReferral,ReferralReason,ReferralAgencDepar,RehabiliMeasu,");
            builder.Append("RehabiliMeasuOther,FollowupClassificat,CreatedBy,CreatedDate,LastUpdateBy,LastUpdateDate,");
            builder.Append("IsDel,NoVisitReason,DeathDate,IllReason,DeathReason,OtherDangerFrequen)");
            builder.Append(" VALUES (");
            builder.Append("@CustomerID,@RecordID,@IDCardNo,@Fatalness,@PresentSymptom,@PresentSymptoOther,@FollowUpDate,@FollowUpDoctor,");
            builder.Append("@NextFollowUpDate,@FollowUpType,@Insight,@SleepQuality,@Diet,@PersonalCare,@Housework,@ProductLaborWork,@LearningAbility,");
            builder.Append("@SocialInterIntera,@MildTroubleFrequen,@CreateDistuFrequen,@CauseAccidFrequen,@AutolesionFrequen,@AttemptSuicFrequen,");
            builder.Append("@AttemptSuicideNone,@LockCondition,@HospitalizatiStatus,@LastLeaveHospTime,@LaborExaminati,@LaborExaminatiHave,");
            builder.Append("@MedicatioCompliance,@AdnerDruReact,@AdverDruReactHave,@TreatmentEffect,@WhetherReferral,@ReferralReason,");
            builder.Append("@ReferralAgencDepar,@RehabiliMeasu,@RehabiliMeasuOther,@FollowupClassificat,@CreatedBy,@CreatedDate,");
            builder.Append("@LastUpdateBy,@LastUpdateDate,@IsDel,@NoVisitReason,@DeathDate,@IllReason,@DeathReason,@OtherDangerFrequen)");
            builder.Append(";SELECT @@IDENTITY");

            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@CustomerID", MySqlDbType.String, 32),
                new MySqlParameter("@RecordID", MySqlDbType.String, 17),
                new MySqlParameter("@IDCardNo", MySqlDbType.String, 21),
                new MySqlParameter("@FollowUpDate", MySqlDbType.Date),
                new MySqlParameter("@Fatalness", MySqlDbType.String, 1),
                new MySqlParameter("@PresentSymptom", MySqlDbType.String, 50),
                new MySqlParameter("@PresentSymptoOther", MySqlDbType.String, 200),
                new MySqlParameter("@Insight", MySqlDbType.String, 1),
                new MySqlParameter("@SleepQuality", MySqlDbType.String, 1),
                new MySqlParameter("@Diet", MySqlDbType.String, 1),
                new MySqlParameter("@PersonalCare", MySqlDbType.String, 1),
                new MySqlParameter("@Housework", MySqlDbType.String, 1),
                new MySqlParameter("@ProductLaborWork", MySqlDbType.String, 1),
                new MySqlParameter("@LearningAbility", MySqlDbType.String, 1),
                new MySqlParameter("@SocialInterIntera", MySqlDbType.String, 1),
                new MySqlParameter("@MildTroubleFrequen", MySqlDbType.Int32),
                new MySqlParameter("@CreateDistuFrequen", MySqlDbType.Int32),
                new MySqlParameter("@CauseAccidFrequen", MySqlDbType.Int32),
                new MySqlParameter("@AutolesionFrequen", MySqlDbType.Int32),
                new MySqlParameter("@AttemptSuicFrequen", MySqlDbType.Int32),
                new MySqlParameter("@AttemptSuicideNone", MySqlDbType.String, 1),
                new MySqlParameter("@LockCondition", MySqlDbType.String, 1),
                new MySqlParameter("@HospitalizatiStatus", MySqlDbType.String, 1),
                new MySqlParameter("@LastLeaveHospTime", MySqlDbType.Date),
                new MySqlParameter("@LaborExaminati", MySqlDbType.String, 1),
                new MySqlParameter("@LaborExaminatiHave", MySqlDbType.String, 100),
                new MySqlParameter("@MedicatioCompliance", MySqlDbType.String, 1),
                new MySqlParameter("@AdnerDruReact", MySqlDbType.String, 1),
                new MySqlParameter("@AdverDruReactHave", MySqlDbType.String, 100),
                new MySqlParameter("@TreatmentEffect", MySqlDbType.String, 1),
                new MySqlParameter("@WhetherReferral", MySqlDbType.String, 1),
                new MySqlParameter("@ReferralReason", MySqlDbType.String, 200),
                new MySqlParameter("@ReferralAgencDepar", MySqlDbType.String, 80),
                new MySqlParameter("@RehabiliMeasu", MySqlDbType.String, 20),
                new MySqlParameter("@RehabiliMeasuOther", MySqlDbType.String, 10),
                new MySqlParameter("@FollowupClassificat", MySqlDbType.String, 1),
                new MySqlParameter("@NextFollowUpDate", MySqlDbType.Date),
                new MySqlParameter("@FollowUpDoctor", MySqlDbType.String, 30),
                new MySqlParameter("@CreatedBy", MySqlDbType.Decimal),
                new MySqlParameter("@CreatedDate", MySqlDbType.Date),
                new MySqlParameter("@LastUpdateBy", MySqlDbType.Decimal),
                new MySqlParameter("@LastUpdateDate", MySqlDbType.Date),
                new MySqlParameter("@IsDel", MySqlDbType.String, 1),
                new MySqlParameter("@NoVisitReason", MySqlDbType.String, 1),
                new MySqlParameter("@DeathDate", MySqlDbType.Date),
                new MySqlParameter("@IllReason", MySqlDbType.String, 1),
                new MySqlParameter("@DeathReason", MySqlDbType.String, 1),
                new MySqlParameter("@OtherDangerFrequen", MySqlDbType.Decimal),
                new MySqlParameter("@FollowUpType", MySqlDbType.String, 1)
            };

            cmdParms[0].Value  = model.CustomerID;
            cmdParms[1].Value  = model.RecordID;
            cmdParms[2].Value  = model.IDCardNo;
            cmdParms[3].Value  = model.FollowUpDate;
            cmdParms[4].Value  = model.Fatalness;
            cmdParms[5].Value  = model.PresentSymptom;
            cmdParms[6].Value  = model.PresentSymptoOther;
            cmdParms[7].Value  = model.Insight;
            cmdParms[8].Value  = model.SleepQuality;
            cmdParms[9].Value  = model.Diet;
            cmdParms[10].Value = model.PersonalCare;
            cmdParms[11].Value = model.Housework;
            cmdParms[12].Value = model.ProductLaborWork;
            cmdParms[13].Value = model.LearningAbility;
            cmdParms[14].Value = model.SocialInterIntera;
            cmdParms[15].Value = model.MildTroubleFrequen;
            cmdParms[16].Value = model.CreateDistuFrequen;
            cmdParms[17].Value = model.CauseAccidFrequen;
            cmdParms[18].Value = model.AutolesionFrequen;
            cmdParms[19].Value = model.AttemptSuicFrequen;
            cmdParms[20].Value = model.AttemptSuicideNone;
            cmdParms[21].Value = model.LockCondition;
            cmdParms[22].Value = model.HospitalizatiStatus;
            cmdParms[23].Value = model.LastLeaveHospTime;
            cmdParms[24].Value = model.LaborExaminati;
            cmdParms[25].Value = model.LaborExaminatiHave;
            cmdParms[26].Value = model.MedicatioCompliance;
            cmdParms[27].Value = model.AdnerDruReact;
            cmdParms[28].Value = model.AdverDruReactHave;
            cmdParms[29].Value = model.TreatmentEffect;
            cmdParms[30].Value = model.WhetherReferral;
            cmdParms[31].Value = model.ReferralReason;
            cmdParms[32].Value = model.ReferralAgencDepar;
            cmdParms[33].Value = model.RehabiliMeasu;
            cmdParms[34].Value = model.RehabiliMeasuOther;
            cmdParms[35].Value = model.FollowupClassificat;
            cmdParms[36].Value = model.NextFollowUpDate;
            cmdParms[37].Value = model.FollowUpDoctor;
            cmdParms[38].Value = model.CreatedBy;
            cmdParms[39].Value = model.CreatedDate;
            cmdParms[40].Value = model.LastUpdateBy;
            cmdParms[41].Value = model.LastUpdateDate;
            cmdParms[42].Value = model.IsDel;
            cmdParms[43].Value = model.NoVisitReason;
            cmdParms[44].Value = model.DeathDate;
            cmdParms[45].Value = model.IllReason;
            cmdParms[46].Value = model.DeathReason;
            cmdParms[47].Value = model.OtherDangerFrequen;
            cmdParms[48].Value = model.FollowUpType;

            object single = MySQLHelper.GetSingle(builder.ToString(), cmdParms);

            if (single == null)
            {
                return(0);
            }

            return(Convert.ToInt32(single));
        }