コード例 #1
0
        public bool Update(RecordsHealthQuestionModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update ARCHIVE_HEALTHQUESTION set ");
            builder.Append("PhysicalID=@PhysicalID,");
            builder.Append("IDCardNo=@IDCardNo,");
            builder.Append("BrainDis=@BrainDis,");
            builder.Append("RenalDis=@RenalDis,");
            builder.Append("HeartDis=@HeartDis,");
            builder.Append("VesselDis=@VesselDis,");
            builder.Append("EyeDis=@EyeDis,");
            builder.Append("NerveDis=@NerveDis,");
            builder.Append("ElseDis=@ElseDis,");
            builder.Append("BrainOther=@BrainOther,");
            builder.Append("RenalOther=@RenalOther,");
            builder.Append("HeartOther=@HeartOther,");
            builder.Append("VesselOther=@VesselOther,");
            builder.Append("EyeOther=@EyeOther,");
            builder.Append("NerveOther=@NerveOther,");
            builder.Append("ElseOther=@ElseOther ");
            builder.Append(" where OutKey=@OutKey");
            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@PhysicalID", MySqlDbType.String, 8),
                new MySqlParameter("@IDCardNo", MySqlDbType.String, 21),
                new MySqlParameter("@BrainDis", MySqlDbType.String, 30),
                new MySqlParameter("@RenalDis", MySqlDbType.String, 30),
                new MySqlParameter("@HeartDis", MySqlDbType.String, 30),
                new MySqlParameter("@VesselDis", MySqlDbType.String, 20),
                new MySqlParameter("@EyeDis", MySqlDbType.String, 20),
                new MySqlParameter("@NerveDis", MySqlDbType.String, 100),
                new MySqlParameter("@ElseDis", MySqlDbType.String, 100),
                new MySqlParameter("@BrainOther", MySqlDbType.String, 500),
                new MySqlParameter("@RenalOther", MySqlDbType.String, 500),
                new MySqlParameter("@HeartOther", MySqlDbType.String, 500),
                new MySqlParameter("@VesselOther", MySqlDbType.String, 500),
                new MySqlParameter("@EyeOther", MySqlDbType.String, 500),
                new MySqlParameter("@NerveOther", MySqlDbType.String, 500),
                new MySqlParameter("@ElseOther", MySqlDbType.String, 500),
                new MySqlParameter("@OutKey", MySqlDbType.Int32, 8)
            };
            cmdParms[0].Value  = model.PhysicalID;
            cmdParms[1].Value  = model.IDCardNo;
            cmdParms[2].Value  = model.BrainDis;
            cmdParms[3].Value  = model.RenalDis;
            cmdParms[4].Value  = model.HeartDis;
            cmdParms[5].Value  = model.VesselDis;
            cmdParms[6].Value  = model.EyeDis;
            cmdParms[7].Value  = model.NerveDis;
            cmdParms[8].Value  = model.ElseDis;
            cmdParms[9].Value  = model.BrainOther;
            cmdParms[10].Value = model.RenalOther;
            cmdParms[11].Value = model.HeartOther;
            cmdParms[12].Value = model.VesselOther;
            cmdParms[13].Value = model.EyeOther;
            cmdParms[14].Value = model.NerveOther;
            cmdParms[15].Value = model.ElseOther;
            cmdParms[16].Value = model.OutKey;
            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
コード例 #2
0
        public int Add(RecordsHealthQuestionModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("INSERT INTO ARCHIVE_HEALTHQUESTION(");
            builder.Append("PhysicalID,IDCardNo,BrainDis,RenalDis,HeartDis,VesselDis,EyeDis,NerveDis,ElseDis,BrainOther,RenalOther,HeartOther,VesselOther,EyeOther,NerveOther,ElseOther,OutKey )");
            builder.Append(" VALUES (");
            builder.Append("@PhysicalID,@IDCardNo,@BrainDis,@RenalDis,@HeartDis,@VesselDis,@EyeDis,@NerveDis,@ElseDis,@BrainOther,@RenalOther,@HeartOther,@VesselOther,@EyeOther,@NerveOther,@ElseOther,@OutKey )");
            builder.Append(";SELECT @@IDENTITY");

            MySqlParameter[] cmdParms = new MySqlParameter[]
            {
                new MySqlParameter("@PhysicalID", MySqlDbType.String, 8),
                new MySqlParameter("@IDCardNo", MySqlDbType.String, 21),
                new MySqlParameter("@BrainDis", MySqlDbType.String, 30),
                new MySqlParameter("@RenalDis", MySqlDbType.String, 30),
                new MySqlParameter("@HeartDis", MySqlDbType.String, 30),
                new MySqlParameter("@VesselDis", MySqlDbType.String, 20),
                new MySqlParameter("@EyeDis", MySqlDbType.String, 20),
                new MySqlParameter("@NerveDis", MySqlDbType.String, 100),
                new MySqlParameter("@ElseDis", MySqlDbType.String, 100),
                new MySqlParameter("@BrainOther", MySqlDbType.String, 500),
                new MySqlParameter("@RenalOther", MySqlDbType.String, 500),
                new MySqlParameter("@HeartOther", MySqlDbType.String, 500),
                new MySqlParameter("@VesselOther", MySqlDbType.String, 500),
                new MySqlParameter("@EyeOther", MySqlDbType.String, 500),
                new MySqlParameter("@NerveOther", MySqlDbType.String, 500),
                new MySqlParameter("@ElseOther", MySqlDbType.String, 500),
                new MySqlParameter("@OutKey", MySqlDbType.Int32, 4)
            };
            cmdParms[0].Value  = model.PhysicalID;
            cmdParms[1].Value  = model.IDCardNo;
            cmdParms[2].Value  = model.BrainDis;
            cmdParms[3].Value  = model.RenalDis;
            cmdParms[4].Value  = model.HeartDis;
            cmdParms[5].Value  = model.VesselDis;
            cmdParms[6].Value  = model.EyeDis;
            cmdParms[7].Value  = model.NerveDis;
            cmdParms[8].Value  = model.ElseDis;
            cmdParms[9].Value  = model.BrainOther;
            cmdParms[10].Value = model.RenalOther;
            cmdParms[11].Value = model.HeartOther;
            cmdParms[12].Value = model.VesselOther;
            cmdParms[13].Value = model.EyeOther;
            cmdParms[14].Value = model.NerveOther;
            cmdParms[15].Value = model.ElseOther;
            cmdParms[16].Value = model.OutKey;
            object single = MySQLHelper.GetSingle(builder.ToString(), cmdParms);

            if (single == null)
            {
                return(0);
            }
            return(Convert.ToInt32(single));
        }
コード例 #3
0
        public bool UpdateByTJMiniPad(RecordsHealthQuestionModel model, string checkDate) //Ìå¼ìÎÊѯͬ²½
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(@"UPDATE 
                                    ARCHIVE_HEALTHQUESTION  D
                             SET 
                                 BrainDis=@BrainDis,RenalDis=@RenalDis,HeartDis=@HeartDis,
                                 VesselDis=@VesselDis,EyeDis=@EyeDis,NerveDis=@NerveDis,
                                 ElseDis=@ElseDis,BrainOther=@BrainOther,RenalOther=@RenalOther,
                                 HeartOther=@HeartOther,VesselOther=@VesselOther,EyeOther=@EyeOther,
                                 NerveOther=@NerveOther,ElseOther=@ElseOther 
                             WHERE
                                    EXISTS
                                    (
                                        SELECT 
                                            ID 
                                        FROM
                                        ARCHIVE_CUSTOMERBASEINFO M
                                        WHERE M.ID = D.OutKey
                                        AND M.IDCardNo = @IDCardNo
                                        AND M.CheckDate = @CheckDate
                                    )
                            ");

            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@IDCardNo", model.IDCardNo),
                new MySqlParameter("@CheckDate", checkDate),
                new MySqlParameter("@BrainDis", model.BrainDis),
                new MySqlParameter("@RenalDis", model.RenalDis),
                new MySqlParameter("@HeartDis", model.HeartDis),
                new MySqlParameter("@VesselDis", model.VesselDis),
                new MySqlParameter("@EyeDis", model.EyeDis),
                new MySqlParameter("@NerveDis", model.NerveDis),
                new MySqlParameter("@ElseDis", model.ElseDis),
                new MySqlParameter("@BrainOther", model.BrainOther),
                new MySqlParameter("@RenalOther", model.RenalOther),
                new MySqlParameter("@HeartOther", model.HeartOther),
                new MySqlParameter("@VesselOther", model.VesselOther),
                new MySqlParameter("@EyeOther", model.EyeOther),
                new MySqlParameter("@NerveOther", model.NerveOther),
                new MySqlParameter("@ElseOther", model.ElseOther)
            };

            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
コード例 #4
0
        public List <RecordsHealthQuestionModel> DataTableToList(DataTable dt)
        {
            List <RecordsHealthQuestionModel> list = new List <RecordsHealthQuestionModel>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    RecordsHealthQuestionModel item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
コード例 #5
0
        /// <summary>
        /// 其他系统疾病的更新
        /// </summary>
        /// <param name="model"></param>
        /// <param name="outKey"></param>
        /// <returns></returns>
        public bool UpdateOtherDis(RecordsHealthQuestionModel model, string outKey)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(@"UPDATE 
                                    ARCHIVE_HEALTHQUESTION
                             SET 
                                    ElseDis=@ElseDis
                                    ,ElseOther=@ElseOther
                             WHERE
                                    OutKey = @OutKey");

            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@IDCardNo", model.IDCardNo),
                new MySqlParameter("@OutKey", outKey),
                new MySqlParameter("@ElseDis", model.ElseDis),
                new MySqlParameter("@ElseOther", model.ElseOther),
            };

            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
コード例 #6
0
 /// <summary>
 /// 其他系统疾病
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdateQT(RecordsHealthQuestionModel model)
 {
     return(this.dal.UpdateQT(model));
 }
コード例 #7
0
        public RecordsHealthQuestionModel DataRowToModel(DataRow row)
        {
            RecordsHealthQuestionModel recordsHealthQuestionModel = new RecordsHealthQuestionModel();

            if (row != null)
            {
                if (((row["ID"] != null) && (row["ID"] != DBNull.Value)) && (row["ID"].ToString() != ""))
                {
                    recordsHealthQuestionModel.ID = int.Parse(row["ID"].ToString());
                }
                if ((row["PhysicalID"] != null) && (row["PhysicalID"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.PhysicalID = row["PhysicalID"].ToString();
                }
                if ((row["IDCardNo"] != null) && (row["IDCardNo"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.IDCardNo = row["IDCardNo"].ToString();
                }
                if ((row["BrainDis"] != null) && (row["BrainDis"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.BrainDis = row["BrainDis"].ToString();
                }
                if ((row["RenalDis"] != null) && (row["RenalDis"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.RenalDis = row["RenalDis"].ToString();
                }
                if ((row["HeartDis"] != null) && (row["HeartDis"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.HeartDis = row["HeartDis"].ToString();
                }
                if ((row["VesselDis"] != null) && (row["VesselDis"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.VesselDis = row["VesselDis"].ToString();
                }
                if ((row["EyeDis"] != null) && (row["EyeDis"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.EyeDis = row["EyeDis"].ToString();
                }
                if ((row["NerveDis"] != null) && (row["NerveDis"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.NerveDis = row["NerveDis"].ToString();
                }
                if ((row["ElseDis"] != null) && (row["ElseDis"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.ElseDis = row["ElseDis"].ToString();
                }
                if ((row["BrainOther"] != null) && (row["BrainOther"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.BrainOther = row["BrainOther"].ToString();
                }
                if ((row["RenalOther"] != null) && (row["RenalOther"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.RenalOther = row["RenalOther"].ToString();
                }
                if ((row["HeartOther"] != null) && (row["HeartOther"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.HeartOther = row["HeartOther"].ToString();
                }
                if ((row["VesselOther"] != null) && (row["VesselOther"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.VesselOther = row["VesselOther"].ToString();
                }
                if ((row["EyeOther"] != null) && (row["EyeOther"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.EyeOther = row["EyeOther"].ToString();
                }
                if ((row["NerveOther"] != null) && (row["NerveOther"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.NerveOther = row["NerveOther"].ToString();
                }
                if ((row["ElseOther"] != null) && (row["ElseOther"] != DBNull.Value))
                {
                    recordsHealthQuestionModel.ElseOther = row["ElseOther"].ToString();
                }
            }

            return(recordsHealthQuestionModel);
        }
コード例 #8
0
 public int AddServer(RecordsHealthQuestionModel model)
 {
     return(this.dal.AddServer(model));
 }
コード例 #9
0
 public bool UpdateByTJMiniPad(RecordsHealthQuestionModel model, string checkDate) //Ìå¼ìÎÊѯͬ²½
 {
     return(this.dal.UpdateByTJMiniPad(model, checkDate));
 }
コード例 #10
0
 public bool UpdateOtherDis(RecordsHealthQuestionModel model, string outKey)
 {
     return(this.dal.UpdateOtherDis(model, outKey));
 }
コード例 #11
0
        public void SavePhysical(string IDCardNo, DateTime CheckDate, string VersionNo, string barCode = "")
        {
            try
            {
                DataTable dsRequire = new RequireBLL().GetList("TabName = '健康体检' ").Tables[0];
                DataView  dv        = dsRequire.DefaultView;

                // 获取最后一次体检数据
                RecordsCustomerBaseInfoModel customerOldModel = CustomerBaseInfoBLL.GetMaxModel(IDCardNo);
                if (customerOldModel == null)
                {
                    customerOldModel = new RecordsCustomerBaseInfoModel();
                }
                RecordsCustomerBaseInfoModel customerNewModel = new RecordsCustomerBaseInfoModel();

                customerNewModel.IDCardNo       = IDCardNo;
                customerNewModel.CheckDate      = CheckDate;
                customerNewModel.CustomerID     = barCode;
                customerNewModel.Doctor         = ConfigHelper.GetNode("doctorName");
                customerNewModel.CreateBy       = ConfigHelper.GetNodeDec("doctor");
                customerNewModel.CreateDate     = DateTime.Now;
                customerNewModel.LastUpdateBy   = ConfigHelper.GetNodeDec("doctor");
                customerNewModel.LastUpdateDate = DateTime.Now;

                #region 一般状况

                dv.RowFilter = "Comment='一般状况' AND (IsSetValue='是' OR IsSetValue='预设上次体检') AND OptionName='Symptom' ";
                DataTable dt = dv.ToTable();

                // 栏位名遍历默认项配置
                foreach (DataRow item in dt.Rows)
                {
                    if (item["IsSetValue"].ToString() == "是")
                    {
                        customerNewModel.Symptom = item["ItemValue"].ToString();
                    }
                    else
                    {
                        customerNewModel.Symptom = customerOldModel.Symptom;
                        customerNewModel.Other   = customerOldModel.Other;
                    }
                }

                dv.RowFilter = null;
                dv.RowFilter = "Comment='一般状况' AND (IsSetValue='是' OR IsSetValue='预设上次体检') AND OptionName<>'Symptom' ";
                dt           = dv.ToTable();
                RecordsGeneralConditionModel gerneralOldModel = GeneralConditionBLL.GetModelByOutKey(customerOldModel.ID);
                RecordsGeneralConditionModel gerneralNewModel = new RecordsGeneralConditionModel();

                gerneralNewModel = EntityAssignment <RecordsGeneralConditionModel>(gerneralOldModel, gerneralNewModel, dt);

                #endregion

                #region 生活方式

                dv.RowFilter = null;
                dv.RowFilter = "Comment='生活方式' AND (IsSetValue='是' OR IsSetValue='预设上次体检') ";
                dt           = dv.ToTable();
                RecordsLifeStyleModel lifeStyleOldModel = LifeStyleBLL.GetModelByOutKey(customerOldModel.ID);
                RecordsLifeStyleModel lifeStyleNewModel = new RecordsLifeStyleModel();
                if (lifeStyleOldModel == null)
                {
                    lifeStyleOldModel = new RecordsLifeStyleModel();
                }

                lifeStyleNewModel = EntityAssignment <RecordsLifeStyleModel>(lifeStyleOldModel, lifeStyleNewModel, dt);

                #endregion

                #region 查体信息

                dv.RowFilter = null;
                dv.RowFilter = "Comment='查体信息' AND (IsSetValue='是' OR IsSetValue='预设上次体检') ";
                dt           = dv.ToTable();
                RecordsPhysicalExamModel physicalExamOldModel = PhysicalExamBLL.GetModelByOutKey(customerOldModel.ID);
                RecordsPhysicalExamModel physicalExamNewModel = new RecordsPhysicalExamModel();
                if (physicalExamOldModel == null)
                {
                    physicalExamOldModel = new RecordsPhysicalExamModel();
                }

                physicalExamNewModel = EntityAssignment <RecordsPhysicalExamModel>(physicalExamOldModel, physicalExamNewModel, dt);

                #endregion

                #region 辅助检查

                dv.RowFilter = null;
                dv.RowFilter = "Comment='辅助检查' AND (IsSetValue='是' OR IsSetValue='预设上次体检') ";
                dt           = dv.ToTable();
                RecordsAssistCheckModel assistCheckOldModel = AssistCheckBLL.GetModelByOutKey(customerOldModel.ID);
                RecordsAssistCheckModel assistCheckNewModel = new RecordsAssistCheckModel();
                if (assistCheckOldModel == null)
                {
                    assistCheckOldModel = new RecordsAssistCheckModel();
                }

                assistCheckNewModel = EntityAssignment <RecordsAssistCheckModel>(assistCheckOldModel, assistCheckNewModel, dt);

                #endregion

                #region 脏器功能

                dv.RowFilter = null;
                dv.RowFilter = "Comment='脏器功能' AND (IsSetValue='是' OR IsSetValue='预设上次体检') ";
                dt           = dv.ToTable();
                RecordsVisceraFunctionModel visceraOldModel = VisceraFunctionBLL.GetModelByOutKey(customerOldModel.ID);
                RecordsVisceraFunctionModel visceraNewModel = new RecordsVisceraFunctionModel();
                if (visceraOldModel == null)
                {
                    visceraOldModel = new RecordsVisceraFunctionModel();
                }

                visceraNewModel = EntityAssignment <RecordsVisceraFunctionModel>(visceraOldModel, visceraNewModel, dt);

                #endregion

                #region 中医体质

                RecordsMediPhysDistModel mediPhysDistModel = new RecordsMediPhysDistModel();

                #endregion

                #region 健康评价

                RecordsAssessmentGuideModel assessmentGuideModel = new RecordsAssessmentGuideModel();

                #endregion

                #region 健康问题

                dv.RowFilter = null;
                dv.RowFilter = "Comment='健康问题' AND (IsSetValue='是' OR IsSetValue='预设上次体检') ";
                dt           = dv.ToTable();
                RecordsHealthQuestionModel questionOldModel = HealthQuestionBLL.GetModelByOutKey(customerOldModel.ID);
                RecordsHealthQuestionModel questionNewModel = new RecordsHealthQuestionModel();
                if (questionOldModel == null)
                {
                    questionOldModel = new RecordsHealthQuestionModel();
                }

                questionNewModel = EntityAssignment <RecordsHealthQuestionModel>(questionOldModel, questionNewModel, dt);

                #endregion

                #region 住院史、用药情况

                dv.RowFilter = null;
                dv.RowFilter = "Comment='治疗情况' AND (IsSetValue='是' OR IsSetValue='预设上次体检' OR IsSetValue='预设随访用药') ";
                dt           = dv.ToTable();

                // 获取list model对象,用来获取最后一次体检数据的值
                List <RecordsHospitalHistoryModel> hospitalHistoryOld = HospitalHistoryBLL.GetModelList(
                    string.Format("IDCardNo='{0}' AND OutKey={1}", IDCardNo, customerOldModel.ID));
                List <RecordsFamilyBedHistoryModel> familyBedHistoryInfoOld = FamilyBedHistoryBLL.GetModelList(
                    string.Format("IDCardNo='{0}' AND OutKey={1}", IDCardNo, customerOldModel.ID));
                List <RecordsMedicationModel> medicationOld = MedicationBLL.GetModelList(
                    string.Format("IDCardNo='{0}' AND OutKey={1}", IDCardNo, customerOldModel.ID));

                if (hospitalHistoryOld == null)
                {
                    hospitalHistoryOld = new List <RecordsHospitalHistoryModel>();
                }
                if (familyBedHistoryInfoOld == null)
                {
                    familyBedHistoryInfoOld = new List <RecordsFamilyBedHistoryModel>();
                }
                if (medicationOld == null)
                {
                    medicationOld = new List <RecordsMedicationModel>();
                }

                #region 随访用药

                List <RecordsMedicationModel> medicationFollowUp = new List <RecordsMedicationModel>();

                // 高血压随访
                ChronicHypertensionVisitModel HyperModel = new ChronicHypertensionVisitBLL().GetMaxModel(IDCardNo, VersionNo);

                if (HyperModel != null)
                {
                    List <ChronicDrugConditionModel> DrugConditions = new ChronicDrugConditionBLL().GetModelList(
                        string.Format(" IDCardNo='{0}' AND Type='{1}' AND OutKey='{2}' ", IDCardNo, "1", HyperModel.ID));

                    foreach (ChronicDrugConditionModel drugModel in DrugConditions)
                    {
                        RecordsMedicationModel newModel = new RecordsMedicationModel
                        {
                            MedicinalName = drugModel.Name,
                            UseNum        = drugModel.DosAge,
                            IDCardNo      = IDCardNo
                        };

                        medicationFollowUp.Add(newModel);
                    }
                }

                // 糖尿病随访
                ChronicDiadetesVisitModel DiaModel = new ChronicDiadetesVisitBLL().GetMaxModel(IDCardNo);

                if (DiaModel != null)
                {
                    List <ChronicDrugConditionModel> DiaDrugConditions = new ChronicDrugConditionBLL().GetModelList(
                        string.Format(" IDCardNo='{0}' AND Type='{1}' AND OutKey='{2}' ", IDCardNo, "2", DiaModel.ID));

                    foreach (ChronicDrugConditionModel drugModel in DiaDrugConditions)
                    {
                        RecordsMedicationModel newModel = new RecordsMedicationModel
                        {
                            MedicinalName = drugModel.Name,
                            UseNum        = drugModel.DosAge,
                            IDCardNo      = IDCardNo
                        };

                        medicationFollowUp.Add(newModel);
                    }
                }

                #endregion

                // 用于存储需存档的体检数据
                List <RecordsHospitalHistoryModel>  hospitalHistoryNew      = new List <RecordsHospitalHistoryModel>();
                List <RecordsFamilyBedHistoryModel> familyBedHistoryInfoNew = new List <RecordsFamilyBedHistoryModel>();
                List <RecordsMedicationModel>       medicationNew           = new List <RecordsMedicationModel>();

                // 临时存储住院史的默认值
                RecordsHospitalHistoryModel hModel = new RecordsHospitalHistoryModel();

                //通过栏位名,遍历默认项配置
                foreach (DataRow item in dt.Rows)
                {
                    switch (item["ChinName"].ToString())
                    {
                    case "住院史":
                        if (item["IsSetValue"].ToString() == "是")
                        {
                            if (!string.IsNullOrEmpty(item["ItemValue"].ToString()))
                            {
                                string[] resList = item["ItemValue"].ToString().Split(';');

                                if (resList.Length > 4)
                                {
                                    hModel.InHospitalDate  = Convert.ToDateTime(resList[0].ToString());
                                    hModel.OutHospitalDate = Convert.ToDateTime(resList[1].ToString());
                                    hModel.Reason          = resList[2].ToString();
                                    hModel.HospitalName    = resList[3].ToString();
                                    hModel.IllcaseNum      = resList[4].ToString();
                                }
                                else if (resList.Length == 1)
                                {
                                    hModel.Reason = resList[0].ToString();
                                }

                                hospitalHistoryNew.Add(hModel);
                            }
                        }
                        else
                        {
                            hospitalHistoryNew = hospitalHistoryOld;
                        }
                        break;

                    case "家庭病床史":
                        if (item["IsSetValue"].ToString() == "预设上次体检")
                        {
                            familyBedHistoryInfoNew = familyBedHistoryInfoOld;
                        }
                        break;

                    case "用药情况":
                        if (item["IsSetValue"].ToString() == "预设上次体检")
                        {
                            medicationNew = medicationOld;
                        }
                        else if (item["IsSetValue"].ToString() == "预设随访用药")
                        {
                            medicationNew = medicationFollowUp;
                        }
                        break;

                    default:
                        break;
                    }
                }

                #endregion

                #region 预防接种史

                dv.RowFilter = null;
                dv.RowFilter = "Comment='健康评价' AND (IsSetValue='是' OR IsSetValue='预设上次体检') ";
                dt           = dv.ToTable();
                List <RecordsInoculationHistoryModel> inoculationHistoryOld = InoculationHistoryBLL.GetModelList(
                    string.Format("IDCardNo='{0}' AND OutKey={1}", IDCardNo, customerOldModel.ID));
                if (inoculationHistoryOld == null)
                {
                    inoculationHistoryOld = new List <RecordsInoculationHistoryModel>();
                }

                List <RecordsInoculationHistoryModel> inoculationHistoryNew = new List <RecordsInoculationHistoryModel>();

                foreach (DataRow item in dt.Rows)
                {
                    switch (item["ChinName"].ToString())
                    {
                    case "非免疫预防接种史":
                        if (item["IsSetValue"].ToString() == "预设上次体检")
                        {
                            inoculationHistoryNew = inoculationHistoryOld;
                        }
                        break;
                    }
                }

                #endregion

                #region 保存默认值

                // 体检主档保存
                int id = CustomerBaseInfoBLL.Add(customerNewModel);

                if (id > 0)
                {
                    // 一般状况
                    gerneralNewModel.IDCardNo = IDCardNo;
                    gerneralNewModel.OutKey   = id;
                    GeneralConditionBLL.Add(gerneralNewModel, VersionNo);

                    // 生活方式
                    lifeStyleNewModel.IDCardNo = IDCardNo;
                    lifeStyleNewModel.OutKey   = id;
                    LifeStyleBLL.Add(lifeStyleNewModel);

                    // 查体信息
                    physicalExamNewModel.IDCardNo = IDCardNo;
                    physicalExamNewModel.OutKey   = id;
                    PhysicalExamBLL.Add(physicalExamNewModel);

                    // 辅助检查
                    assistCheckNewModel.IDCardNo = IDCardNo;
                    assistCheckNewModel.OutKey   = id;
                    AssistCheckBLL.Add(assistCheckNewModel);

                    // 脏器功能
                    visceraNewModel.IDCardNo = IDCardNo;
                    visceraNewModel.OutKey   = id;
                    VisceraFunctionBLL.Add(visceraNewModel);

                    // 中医体质
                    mediPhysDistModel.IDCardNo = IDCardNo;
                    mediPhysDistModel.OutKey   = id;
                    MediPhysDistBLL.Add(mediPhysDistModel);

                    // 健康问题
                    questionNewModel.IDCardNo = IDCardNo;
                    questionNewModel.OutKey   = id;
                    HealthQuestionBLL.Add(questionNewModel);

                    // 健康评价
                    assessmentGuideModel.IDCardNo = IDCardNo;
                    assessmentGuideModel.OutKey   = id;
                    AssessmentGuideBLL.Add(assessmentGuideModel);

                    // 住院史
                    if (hospitalHistoryNew.Count > 0)
                    {
                        foreach (RecordsHospitalHistoryModel recordsInoculationHistoryModel in hospitalHistoryNew)
                        {
                            recordsInoculationHistoryModel.OutKey   = id;
                            recordsInoculationHistoryModel.IDCardNo = IDCardNo;
                        }

                        HospitalHistoryBLL.AddList(hospitalHistoryNew);
                    }

                    // 家庭住院史
                    if (familyBedHistoryInfoNew.Count > 0)
                    {
                        foreach (RecordsFamilyBedHistoryModel model in familyBedHistoryInfoNew)
                        {
                            model.OutKey   = id;
                            model.IDCardNo = IDCardNo;
                        }

                        FamilyBedHistoryBLL.AddList(familyBedHistoryInfoNew);
                    }

                    // 用药
                    if (medicationNew.Count > 0)
                    {
                        foreach (RecordsMedicationModel model in medicationNew)
                        {
                            model.OutKey   = id;
                            model.IDCardNo = IDCardNo;
                        }

                        MedicationBLL.AddList(medicationNew);
                    }

                    // 接种史
                    if (inoculationHistoryNew.Count > 0)
                    {
                        foreach (RecordsInoculationHistoryModel model in inoculationHistoryNew)
                        {
                            model.OutKey   = id;
                            model.IDCardNo = IDCardNo;
                        }

                        InoculationHistoryBLL.AddList(inoculationHistoryNew);
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex.ToString());
                throw ex;
            }
        }