public int Add(RecordsAssessmentGuideModel model) { StringBuilder builder = new StringBuilder(); builder.Append("INSERT INTO ARCHIVE_ASSESSMENTGUIDE(IDCardNo,OutKey)"); builder.Append(" VALUES (@IDCardNo,@OutKey)"); builder.Append(";SELECT @@IDENTITY"); MySqlParameter[] cmdParms = new MySqlParameter[] { new MySqlParameter("@IDCardNo", MySqlDbType.String, 21), new MySqlParameter("@OutKey", MySqlDbType.Int32, 11) }; cmdParms[0].Value = model.IDCardNo; cmdParms[1].Value = model.OutKey; object single = MySQLHelper.GetSingle(builder.ToString(), cmdParms); if (single == null) { return(0); } return(Convert.ToInt32(single)); }
public bool Update(RecordsAssessmentGuideModel model) { StringBuilder builder = new StringBuilder(); builder.Append("update ARCHIVE_ASSESSMENTGUIDE set "); builder.Append("PhysicalID=@PhysicalID,"); builder.Append("IDCardNo=@IDCardNo,"); builder.Append("IsNormal=@IsNormal,"); builder.Append("HealthGuide=@HealthGuide,"); builder.Append("DangerControl=@DangerControl,"); builder.Append("Exception1=@Exception1,"); builder.Append("Exception2=@Exception2,"); builder.Append("Exception3=@Exception3,"); builder.Append("Arm=@Arm,"); builder.Append("VaccineAdvice=@VaccineAdvice,"); builder.Append("Other=@Other,"); builder.Append("Exception4=@Exception4,"); builder.Append("WaistlineArm=@WaistlineArm, "); builder.Append("Exception5=@Exception5,"); builder.Append("Exception6=@Exception6 "); builder.Append(" where OutKey=@OutKey"); MySqlParameter[] cmdParms = new MySqlParameter[] { new MySqlParameter("@PhysicalID", MySqlDbType.String, 8), new MySqlParameter("@IDCardNo", MySqlDbType.String, 21), new MySqlParameter("@IsNormal", MySqlDbType.String, 1), new MySqlParameter("@HealthGuide", MySqlDbType.String, 20), new MySqlParameter("@DangerControl", MySqlDbType.String, 30), new MySqlParameter("@Exception1", MySqlDbType.String, 500), new MySqlParameter("@Exception2", MySqlDbType.String, 500), new MySqlParameter("@Exception3", MySqlDbType.String, 500), new MySqlParameter("@Arm", MySqlDbType.String, 500), new MySqlParameter("@VaccineAdvice", MySqlDbType.String, 500), new MySqlParameter("@Other", MySqlDbType.String, 500), new MySqlParameter("@Exception4", MySqlDbType.String, 500), new MySqlParameter("@WaistlineArm", MySqlDbType.String, 100), new MySqlParameter("@Exception5", MySqlDbType.String, 500), new MySqlParameter("@Exception6", MySqlDbType.String, 500), new MySqlParameter("@OutKey", MySqlDbType.Int32, 8) }; cmdParms[0].Value = model.PhysicalID; cmdParms[1].Value = model.IDCardNo; cmdParms[2].Value = model.IsNormal; cmdParms[3].Value = model.HealthGuide; cmdParms[4].Value = model.DangerControl; cmdParms[5].Value = model.Exception1; cmdParms[6].Value = model.Exception2; cmdParms[7].Value = model.Exception3; cmdParms[8].Value = model.Arm; cmdParms[9].Value = model.VaccineAdvice; cmdParms[10].Value = model.Other; cmdParms[11].Value = model.Exception4; cmdParms[12].Value = model.WaistlineArm; cmdParms[13].Value = model.Exception5; cmdParms[14].Value = model.Exception6; cmdParms[15].Value = model.OutKey; return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public int Add(RecordsAssessmentGuideModel model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into ARCHIVE_ASSESSMENTGUIDE("); builder.Append("PhysicalID,IDCardNo,IsNormal,HealthGuide,DangerControl,Exception1,Exception2,Exception3,Arm,VaccineAdvice,Other,Exception4,OutKey,WaistlineArm,Exception5,Exception6)"); builder.Append(" values ("); builder.Append("@PhysicalID,@IDCardNo,@IsNormal,@HealthGuide,@DangerControl,@Exception1,@Exception2,@Exception3,@Arm,@VaccineAdvice,@Other,@Exception4,@OutKey,@WaistlineArm,@Exception5,@Exception6)"); builder.Append(";select @@IDENTITY"); MySqlParameter[] cmdParms = new MySqlParameter[] { new MySqlParameter("@PhysicalID", MySqlDbType.String, 8), new MySqlParameter("@IDCardNo", MySqlDbType.String, 21), new MySqlParameter("@IsNormal", MySqlDbType.String, 1), new MySqlParameter("@HealthGuide", MySqlDbType.String, 20), new MySqlParameter("@DangerControl", MySqlDbType.String, 30), new MySqlParameter("@Exception1", MySqlDbType.String, 500), new MySqlParameter("@Exception2", MySqlDbType.String, 500), new MySqlParameter("@Exception3", MySqlDbType.String, 500), new MySqlParameter("@Arm", MySqlDbType.String, 500), new MySqlParameter("@VaccineAdvice", MySqlDbType.String, 500), new MySqlParameter("@Other", MySqlDbType.String, 500), new MySqlParameter("@Exception4", MySqlDbType.String, 500), new MySqlParameter("@OutKey", MySqlDbType.Int32, 4), new MySqlParameter("@WaistlineArm", MySqlDbType.String, 100), new MySqlParameter("@Exception5", MySqlDbType.String, 500), new MySqlParameter("@Exception6", MySqlDbType.String, 500) }; cmdParms[0].Value = model.PhysicalID; cmdParms[1].Value = model.IDCardNo; cmdParms[2].Value = model.IsNormal; cmdParms[3].Value = model.HealthGuide; cmdParms[4].Value = model.DangerControl; cmdParms[5].Value = model.Exception1; cmdParms[6].Value = model.Exception2; cmdParms[7].Value = model.Exception3; cmdParms[8].Value = model.Arm; cmdParms[9].Value = model.VaccineAdvice; cmdParms[10].Value = model.Other; cmdParms[11].Value = model.Exception4; cmdParms[12].Value = model.OutKey; cmdParms[13].Value = model.WaistlineArm; cmdParms[14].Value = model.Exception5; cmdParms[15].Value = model.Exception6; object single = MySQLHelper.GetSingle(builder.ToString(), cmdParms); if (single == null) { return(0); } return(Convert.ToInt32(single)); }
public List <RecordsAssessmentGuideModel> DataTableToList(DataTable dt) { List <RecordsAssessmentGuideModel> list = new List <RecordsAssessmentGuideModel>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { RecordsAssessmentGuideModel item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return(list); }
public RecordsAssessmentGuideModel DataRowToModel(DataRow row) { RecordsAssessmentGuideModel recordsAssessmentGuideModel = new RecordsAssessmentGuideModel(); if (row != null) { if (((row["ID"] != null) && (row["ID"] != DBNull.Value)) && (row["ID"].ToString() != "")) { recordsAssessmentGuideModel.ID = int.Parse(row["ID"].ToString()); } if ((row["PhysicalID"] != null) && (row["PhysicalID"] != DBNull.Value)) { recordsAssessmentGuideModel.PhysicalID = row["PhysicalID"].ToString(); } if ((row["IDCardNo"] != null) && (row["IDCardNo"] != DBNull.Value)) { recordsAssessmentGuideModel.IDCardNo = row["IDCardNo"].ToString(); } if ((row["IsNormal"] != null) && (row["IsNormal"] != DBNull.Value)) { recordsAssessmentGuideModel.IsNormal = row["IsNormal"].ToString(); } if ((row["HealthGuide"] != null) && (row["HealthGuide"] != DBNull.Value)) { recordsAssessmentGuideModel.HealthGuide = row["HealthGuide"].ToString(); } if ((row["DangerControl"] != null) && (row["DangerControl"] != DBNull.Value)) { recordsAssessmentGuideModel.DangerControl = row["DangerControl"].ToString(); } if ((row["Exception1"] != null) && (row["Exception1"] != DBNull.Value)) { recordsAssessmentGuideModel.Exception1 = row["Exception1"].ToString(); } if ((row["Exception2"] != null) && (row["Exception2"] != DBNull.Value)) { recordsAssessmentGuideModel.Exception2 = row["Exception2"].ToString(); } if ((row["Exception3"] != null) && (row["Exception3"] != DBNull.Value)) { recordsAssessmentGuideModel.Exception3 = row["Exception3"].ToString(); } if ((row["Arm"] != null) && (row["Arm"] != DBNull.Value)) { recordsAssessmentGuideModel.Arm = row["Arm"].ToString(); } if ((row["VaccineAdvice"] != null) && (row["VaccineAdvice"] != DBNull.Value)) { recordsAssessmentGuideModel.VaccineAdvice = row["VaccineAdvice"].ToString(); } if ((row["Other"] != null) && (row["Other"] != DBNull.Value)) { recordsAssessmentGuideModel.Other = row["Other"].ToString(); } if ((row["Exception4"] != null) && (row["Exception4"] != DBNull.Value)) { recordsAssessmentGuideModel.Exception4 = row["Exception4"].ToString(); } if ((row["WaistlineArm"] != null) && (row["WaistlineArm"] != DBNull.Value)) { recordsAssessmentGuideModel.WaistlineArm = row["WaistlineArm"].ToString(); } if ((row["Exception5"] != null) && (row["Exception5"] != DBNull.Value)) { recordsAssessmentGuideModel.Exception5 = row["Exception5"].ToString(); } if ((row["Exception6"] != null) && (row["Exception6"] != DBNull.Value)) { recordsAssessmentGuideModel.Exception6 = row["Exception6"].ToString(); } } return(recordsAssessmentGuideModel); }
public int Add(RecordsAssessmentGuideModel model) { return(dal.Add(model)); }
public int AddServer(RecordsAssessmentGuideModel model) { return(this.dal.AddServer(model)); }
public bool UpdateServer(RecordsAssessmentGuideModel model) { return(this.dal.UpdateServer(model)); }
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; } }