//新增 更新 public ActionResult AddAndUpdate() { string id = CommonFunc.SafeGetStringFromObj(Request["id"]); string fill_community_code = CommonFunc.SafeGetStringFromObj(Request["community_code"]); string worker = CommonFunc.SafeGetStringFromObj(Request["worker"]); Chronic_disease_Comm_Testing_CSF entity = new Chronic_disease_Comm_Testing_CSF(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } entity.names = Request["name"]; entity.sex = Request["sex"]; entity.age = Request["age"]; entity.id_card_number = Request["id_card_number"]; string s = Request["id_card_number"]; string s1 = "", s2 = "", s3 = ""; if (s.Length == 15) { s1 = s.Substring(6, 2); s2 = s.Substring(8, 2); s3 = s.Substring(10, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj("19" + s1 + "-" + s2 + "-" + s3)); } else if (s.Length == 18) { s1 = s.Substring(6, 4); s2 = s.Substring(10, 2); s3 = s.Substring(12, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(s1 + "-" + s2 + "-" + s3)); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } entity.address = Request["perment_community_address"]; entity.phone = Request["phone"]; entity.numb = Request["numb"]; entity.inspect_doctor = Request["sjdoctor"]; entity.check_doctor = Request["jcdoctor"]; entity.report_doctor = Request["bgdoctor"]; if (string.IsNullOrEmpty(Request["sjtime"])) { entity.inspect_time = null; } else { entity.inspect_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["sjtime"])); } if (string.IsNullOrEmpty(Request["bgtime"])) { entity.report_time = null; } else { entity.report_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["bgtime"])); } entity.check_company = Request["CheckCompany"]; entity.type = "Therioma"; entity.doctor = worker; entity.community_code = Request["ddlCommunity"]; entity.name1 = Request["project1"]; entity.name2 = Request["project2"]; entity.name3 = Request["project3"]; entity.name4 = Request["project4"]; entity.name5 = Request["project5"]; if (Request["project1"].Equals("颜色") || Request["project1"].Equals("透明度") || Request["project1"].Equals("凝固物")) { entity.result1 = Request.Form["Select1"]; } else { entity.result1 = Request["res1"]; } if (Request["project2"].Equals("颜色") || Request["project2"].Equals("透明度") || Request["project2"].Equals("凝固物")) { entity.result2 = Request.Form["Select2"]; } else { entity.result2 = Request["res2"]; } if (Request["project3"].Equals("颜色") || Request["project3"].Equals("透明度") || Request["project3"].Equals("凝固物")) { entity.result3 = Request.Form["Select3"]; } else { entity.result3 = Request["res3"]; } if (Request["project4"].Equals("颜色") || Request["project4"].Equals("透明度") || Request["project4"].Equals("凝固物")) { entity.result4 = Request.Form["Select4"]; } else { entity.result4 = Request["res4"]; } if (Request["project5"].Equals("颜色") || Request["project5"].Equals("透明度") || Request["project5"].Equals("凝固物")) { entity.result5 = Request.Form["Select5"]; } else { entity.result5 = Request["res5"]; } entity.unit1 = Request["Text1"]; entity.unit2 = Request["Text6"]; entity.unit3 = Request["Text10"]; entity.unit4 = Request["Text14"]; entity.unit5 = Request["Text18"]; entity.qujian1 = Request["Text2"]; entity.qujian2 = Request["Text7"]; entity.qujian3 = Request["Text11"]; entity.qujian4 = Request["Text15"]; entity.qujian5 = Request["Text19"]; entity.tishi1 = Request["Text3"]; entity.tishi2 = Request["Text8"]; entity.tishi3 = Request["Text12"]; entity.tishi4 = Request["Text16"]; entity.tishi5 = Request["Text20"]; entity.beizhu1 = Request["Text4"]; entity.beizhu2 = Request["Text9"]; entity.beizhu3 = Request["Text13"]; entity.beizhu4 = Request["Text17"]; entity.beizhu5 = Request["Text21"]; System.Collections.Generic.List <Chronic_disease_Comm_Testing_CSFAdd> subjectiveList = new System.Collections.Generic.List <Chronic_disease_Comm_Testing_CSFAdd>(); for (int i = 1; i < 29; i++) { if (!string.IsNullOrEmpty(Request["project_" + i])) { Chronic_disease_Comm_Testing_CSFAdd entity1 = new Chronic_disease_Comm_Testing_CSFAdd(); entity1.id = Guid.NewGuid().ToString(); entity1.add_id = entity.id; entity1.name = Request["project_" + i]; if (entity1.name != null) { if (Request["project_" + i].Equals("颜色") || Request["project_" + i].Equals("透明度") || Request["project_" + i].Equals("凝固物")) { entity1.result = Request["select_" + i]; } else { entity1.result = Request["res_" + i]; } } entity1.unit = Request["unit_" + i]; entity1.qujian = Request["qujian_" + i]; entity1.tishi = Request["tishi_" + i]; entity1.beizhu = Request["beizhu_" + i]; if (entity1.name != null) { subjectiveList.Add(entity1); } } } //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (disease_Comm_Testing_CSFService.AddEntity(entity) && disease_Comm_Testing_CSFAddService.UpdateSubjective(subjectiveList, entity.id)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.CSF.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } else { if (disease_Comm_Testing_CSFService.UpdateEntity(entity) && disease_Comm_Testing_CSFAddService.UpdateSubjective(subjectiveList, entity.id)) { msg = "修改成功"; } } return(Content(msg + ',' + entity.id)); }
//新增更新操作 public ActionResult AddAndUpdate() { string id = Request["id"]; string fill_community_code = Request["community_code"]; string worker = Request["worker"]; Chronic_disease_Comm_Diagnostic entity = new Chronic_disease_Comm_Diagnostic(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } entity.names = Request["name"]; entity.sex = Request["sex"]; entity.age = Request["age"]; entity.id_card_number = Request["id_card_number"]; entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); entity.address = Request["perment_community_address"]; entity.phone = Request["phone"]; if (string.IsNullOrEmpty(Request["time1"])) { entity.data1 = null; } else { entity.data1 = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["time1"])); } if (string.IsNullOrEmpty(Request["time2"])) { entity.data2 = null; } else { entity.data2 = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["time2"])); } if (string.IsNullOrEmpty(Request["time3"])) { entity.data3 = null; } else { entity.data3 = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["time3"])); } if (string.IsNullOrEmpty(Request["time4"])) { entity.data4 = null; } else { entity.data4 = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["time4"])); } if (string.IsNullOrEmpty(Request["time5"])) { entity.data5 = null; } else { entity.data5 = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["time5"])); } entity.name1 = Request["name1"]; entity.name2 = Request["name2"]; entity.name3 = Request["name3"]; entity.name4 = Request["name4"]; entity.name5 = Request["name5"]; entity.numb1 = Request["numb1"]; entity.numb2 = Request["numb2"]; entity.numb3 = Request["numb3"]; entity.numb4 = Request["numb4"]; entity.numb5 = Request["numb5"]; entity.hospital1 = Request["hospital1"]; entity.hospital2 = Request["hospital2"]; entity.hospital3 = Request["hospital3"]; entity.hospital4 = Request["hospital4"]; entity.hospital5 = Request["hospital5"]; entity.doctor1 = Request["doctor1"]; entity.doctor2 = Request["doctor2"]; entity.doctor3 = Request["doctor3"]; entity.doctor4 = Request["doctor4"]; entity.doctor5 = Request["doctor5"]; entity.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); entity.worker = worker; entity.community_code = Request["ddlCommunity"]; List <Chronic_disease_Comm_DiagnosticAdd> subjectiveList = new List <Chronic_disease_Comm_DiagnosticAdd>(); for (int i = 1; i < 100; i++) { if (!string.IsNullOrEmpty(Request["name_" + i])) { Chronic_disease_Comm_DiagnosticAdd entity1 = new Chronic_disease_Comm_DiagnosticAdd(); entity1.id = Guid.NewGuid().ToString(); entity1.diag_id = entity.id; if (string.IsNullOrEmpty(Request["time_" + i])) { entity1.data = null; } else { entity1.data = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["time_" + i])); } entity1.name = Request["name_" + i]; entity1.numb = Request["numb_" + i]; entity1.hospital = Request["hospital_" + i]; entity1.doctor = Request["doctor_" + i]; if (entity1.name != null) { subjectiveList.Add(entity1); } } } //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (disease_Comm_DiagnosticService.AddEntity(entity) && disease_Comm_DiagnosticAddService.UpdateSubjective(subjectiveList, entity.id)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.DiaInfo.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } else { if (disease_Comm_DiagnosticService.UpdateEntity(entity) && disease_Comm_DiagnosticAddService.UpdateSubjective(subjectiveList, entity.id)) { msg = "修改成功"; } } return(Content(msg + ',' + entity.id)); }
//新增 更新 public ActionResult AddAndUpdate() { string id = CommonFunc.SafeGetStringFromObj(Request["id"]); string fill_community_code = CommonFunc.SafeGetStringFromObj(Request["community_code"]); string worker = CommonFunc.SafeGetStringFromObj(Request["worker"]); Chronic_disease_BloodGlucose entity = new Chronic_disease_BloodGlucose(); string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); var result = disease_BloodGlucoseService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).FirstOrDefault(); string bpId = string.Empty; if (result == null) { bpId = ""; } else { bpId = MalignantTumorSystem.Common.CommonFunc.SafeGetStringFromObj(result.id); } string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(bpId)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); if (!string.IsNullOrEmpty(residentId)) { entity.resident_id = residentId; } else { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } } else { entity.id = bpId; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); entity.resident_id = CommonFunc.SafeGetStringFromObj(result.resident_id); } entity.name = Request["name"]; entity.sex = Request["sex"]; entity.id_card_number = Request["id_card_number"]; entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); entity.permanent_address = Request["perment_community_address"]; entity.phone = Request["txtIndividualPhone"]; entity.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); entity.worker_user_name = worker; entity.community_code = Request["ddlCommunity"]; //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } // ================================================================ System.Collections.Generic.List <Chronic_disease_BloodGlucose_Add> subjectiveList = new System.Collections.Generic.List <Chronic_disease_BloodGlucose_Add>(); for (int i = 0; i < 24; i++) { if (!string.IsNullOrEmpty(Request["date" + i])) { Chronic_disease_BloodGlucose_Add entitys = new Chronic_disease_BloodGlucose_Add(); entitys.id = Guid.NewGuid().ToString(); entitys.add_id = entity.id; entitys.data = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["date" + i] + " " + Request["ttime" + i])); entitys.time = Request["ttime" + i]; entitys.types = Request["type" + i]; entitys.bloodsugar = Request["bloodsugar" + i]; entitys.place = Request["place" + i]; entitys.state = Request["state" + i]; subjectiveList.Add(entitys); } } string msg = ""; if (string.IsNullOrEmpty(bpId)) { if (disease_BloodGlucoseService.AddEntity(entity) && disease_BloodGlucose_AddService.AddRangeEntity(subjectiveList)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.BloodGlucose.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "保存成功"; } else { msg = "保存失败"; } } } else { if (disease_BloodGlucoseService.UpdateEntity(entity) && disease_BloodGlucose_AddService.AddRangeEntity(subjectiveList)) { msg = "保存成功"; } } return(Content(msg + ',' + entity.id)); }
//提交 更新方法 public ActionResult AddAndUpdate() { string id = Request["id"]; string fill_community_code = Request["community_code"]; string worker = Request.QueryString["worker"]; Chronic_disease_Diabetes_family entity = new Chronic_disease_Diabetes_family(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); } else { entity.id = id; } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string resident_id = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(resident_id)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = resident_id; } entity.host_name = Request["host_name"]; entity.sex = Request["sex"]; entity.id_card_number = Request["id_card_number"]; entity.perment_community_code = Request["ddlCommunity"]; entity.address = Request["perment_community_address"]; string s = Request["id_card_number"]; string s1 = "", s2 = "", s3 = ""; if (s.Length == 15) { s1 = s.Substring(6, 2); s2 = s.Substring(8, 2); s3 = s.Substring(10, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj("19" + s1 + "-" + s2 + "-" + s3)); } else if (s.Length == 18) { s1 = s.Substring(6, 4); s2 = s.Substring(10, 2); s3 = s.Substring(12, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(s1 + "-" + s2 + "-" + s3)); } else { entity.birth_date = null; } entity.phone = Request["phone"]; entity.post_code = Request["post_code"]; entity.spouse_name = Request["spouse_name"]; entity.spouse_id_card_number = Request["spouse_idCard"]; entity.spouse_phone = Request["spouse_phone"]; if (string.IsNullOrEmpty(Request["spouse_birth_date"])) { entity.spouse_birth_date = null; } else { entity.spouse_birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["spouse_birth_date"])); } entity.hostFather_name = Request["hostFather_name"]; entity.hostFather_id_card_number = Request["hostFather_idCard"]; entity.hostFather_phone = Request["hostFather_phone"]; if (string.IsNullOrEmpty(Request["hostFather_birth_date"])) { entity.hostFather_birth_date = null; } else { entity.hostFather_birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["hostFather_birth_date"])); } entity.hostMother_name = Request["hostMother_name"]; entity.hostMother_id_card_number = Request["hostMother_idCard"]; entity.hostMother_phone = Request["hostMother_phone"]; if (string.IsNullOrEmpty(Request["hostMother_birth_date"])) { entity.hostMother_birth_date = null; } else { entity.hostMother_birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["hostMother_birth_date"])); } entity.relation = Request["relation0"]; entity.relation_name = Request["relation_names0"]; entity.relation_id_card = Request["relation_id_card0"]; entity.relation_phone = Request["relation_phone0"]; if (string.IsNullOrEmpty(Request["relation_birth_date0"])) { entity.relation_birth_date = null; } else { entity.relation_birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["relation_birth_date0"])); } entity.community_code = Request["ddlCommunity"]; entity.chronic_disease_type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); entity.worker_user_name = Request["input_person"];; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["createTime"])); List <Chronic_disease_Diabetes_family_relation> subjectiveList = new List <Chronic_disease_Diabetes_family_relation>(); for (int i = 1; i < 10; i++) { if (!string.IsNullOrEmpty(Request["relation" + i])) { Chronic_disease_Diabetes_family_relation entity1 = new Chronic_disease_Diabetes_family_relation(); entity1.id = Guid.NewGuid().ToString(); entity1.relation_id = entity.id; entity1.relation = Request["relation" + i]; entity1.name = Request["relation_names" + i]; entity1.id_card_number = Request["relation_id_card" + i]; entity1.phone = Request["relation_phone" + i]; entity1.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["relation_birth_date" + i])); if (entity1.name != null) { subjectiveList.Add(entity1); } } } //------------------------------------------------------------------------------------------------------- //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["host_name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (diseaseDiabetesfamilyService.AddEntity(entity) && diseaseDiabetesfamilyrelationService.UpdateSubjective(subjectiveList, entity.id)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.Family.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } else { if (diseaseDiabetesfamilyService.UpdateEntity(entity) && diseaseDiabetesfamilyrelationService.UpdateSubjective(subjectiveList, entity.id)) { msg = "修改成功"; } } return(Content(msg + ',' + entity.id)); }
//新增或修改 public ActionResult AddAndUpdate() { string id = CommonFunc.SafeGetStringFromObj(Request["id"]); string fill_community_code = CommonFunc.SafeGetStringFromObj(Request["community_code"]); string worker = CommonFunc.SafeGetStringFromObj(Request["worker"]); string real_name = CommonFunc.SafeGetStringFromObj(Request["real_name"]); MT_BC_QOL entity = new MT_BC_QOL(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } entity.name = Request["name"]; entity.sex = Request["sex"]; entity.age = Request["age"]; entity.id_card_number = Request["id_card_number"]; string s = Request["id_card_number"]; string s1 = "", s2 = "", s3 = ""; if (s.Length == 15) { s1 = s.Substring(6, 2); s2 = s.Substring(8, 2); s3 = s.Substring(10, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj("19" + s1 + "-" + s2 + "-" + s3)); } else if (s.Length == 18) { s1 = s.Substring(6, 4); s2 = s.Substring(10, 2); s3 = s.Substring(12, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(s1 + "-" + s2 + "-" + s3)); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } if (string.IsNullOrEmpty(Request["birth_date"])) { entity.birth_date = null; } else { entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); } entity.community_code = Request["ddlCommunity"]; entity.address = Request["perment_community_address"]; entity.phone = Request["txtIndividualPhone"]; entity.worker_user_name = worker; entity.worker_user_realname = real_name; //------------------------------------特有字段赋值------------------------------------------------------- entity.q1 = Request["radio1"]; entity.q2 = Request["radio2"]; entity.q3 = Request["radio3"]; entity.q4 = Request["radio4"]; entity.q5 = Request["radio5"]; entity.q6 = Request["radio6"]; entity.q7 = Request["radio7"]; entity.q8 = Request["radio8"]; entity.q9 = Request["radio9"]; entity.q10 = Request["radio10"]; entity.q11 = Request["radio11"]; entity.q12 = Request["radio12"]; entity.q13 = Request["radio13"]; entity.q14 = Request["radio14"]; entity.q15 = Request["radio15"]; entity.q16 = Request["radio16"]; entity.q17 = Request["radio17"]; entity.q18 = Request["radio18"]; entity.q19 = Request["radio19"]; entity.q20 = Request["radio20"]; entity.q21 = Request["radio21"]; entity.q22 = Request["radio22"]; entity.q23 = Request["radio23"]; entity.q24 = Request["radio24"]; entity.q25 = Request["radio25"]; entity.q26 = Request["radio26"]; entity.q27 = Request["radio27"]; entity.q28 = Request["radio28"]; entity.q29 = Request["radio29"]; entity.q30 = Request["radio30"]; entity.rs1 = Request["rs1"]; entity.rs2 = Request["rs2"]; entity.rs3 = Request["rs3"]; entity.rs4 = Request["rs4"]; entity.rs5 = Request["rs5"]; entity.rs6 = Request["rs6"]; entity.rs7 = Request["rs7"]; entity.rs8 = Request["rs8"]; entity.rs9 = Request["rs9"]; entity.rs10 = Request["rs10"]; entity.rs11 = Request["rs11"]; entity.rs12 = Request["rs12"]; entity.rs13 = Request["rs13"]; entity.rs14 = Request["rs14"]; entity.rs15 = Request["rs15"]; entity.s1 = Request["s1"]; entity.s2 = Request["s2"]; entity.s3 = Request["s3"]; entity.s4 = Request["s4"]; entity.s5 = Request["s5"]; entity.s6 = Request["s6"]; entity.s7 = Request["s7"]; entity.s8 = Request["s8"]; entity.s9 = Request["s9"]; entity.s10 = Request["s10"]; entity.s11 = Request["s11"]; entity.s12 = Request["s12"]; entity.s13 = Request["s13"]; entity.s14 = Request["s14"]; entity.s15 = Request["s15"]; entity.advice = Request["advice"]; entity.doctor = Request["doctor"]; entity.checkdate = CommonFunc.SafeGetDateTimeFromObj(Request["checkdate"]); //判断个人信息表中是否存在此人信息 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["txtIndividualPhone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { //根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "birth_date", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (mT_BC_QOLService.AddEntity(entity)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.QOL.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } else { if (mT_BC_QOLService.UpdateEntity(entity)) { msg = "修改成功"; } else { msg = "修改失败"; } } return(Content(msg + "," + entity.id)); }
//表单提交 public ActionResult AddAndUpdate() { string id = CommonFunc.SafeGetStringFromObj(Request.QueryString["id"]); string worker = CommonFunc.SafeGetStringFromObj(Request.QueryString["worker"]); string community_code = CommonFunc.SafeGetStringFromObj(Request.QueryString["community_code"]); string txtCardNumber = CommonFunc.SafeGetStringFromObj(Request["txtCardNumber"]); string re_id = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == txtCardNumber).Select(t => t.id).FirstOrDefault()); Comm_ResidentFile entity = new Comm_ResidentFile(); if (string.IsNullOrEmpty(re_id)) { entity.id = Guid.NewGuid().ToString(); entity.password = "******"; entity.worker_user_name = worker; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["txtCreateTime"])); } else { entity.id = re_id; entity.password = "******"; entity.worker_user_name = worker; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["txtCreateTime"])); //entity.community_code =CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(u => u.resident_id == CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == txtCardNumber).Select(t=>t.resident_id).FirstOrDefault())).Select(t=>t.community_code).FirstOrDefault()); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == txtCardNumber).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(Request["ddlCommunity"]); } else { entity.resident_id = residentId; } entity.resident_name = Request["txtResidentName"]; entity.sex = Request["rdlSex"]; entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["txtBirthDate"])); entity.id_card_number = Request["txtCardNumber"]; entity.nationality_name = "中国"; entity.nation = Request["ddlNation"]; entity.marital_status = Request["ddlMarrigeState"]; entity.education_qualification = Request["ddlEducationQualification"]; entity.abo_blood_group = Request["ddlABOBloodType"]; entity.post_code = Request["zipCode"]; if (string.IsNullOrEmpty(Request["txtFamilyPhone1"]) || string.IsNullOrEmpty(Request["txtFamilyPhone2"])) { entity.family_phone = Request["txtFamilyPhone1"] + "-" + Request["txtFamilyPhone2"]; } entity.individual_phone = Request["txtIndividualPhone"]; entity.email = Request["txtEmail"]; entity.contact_name = Request["txtcontact_name"]; entity.contact_phone = Request["txtcontact_phone"]; entity.contact_my_relationship = Request["ddlcontact_my_relationship"]; entity.work_unit = Request["txtWorkUnit"]; entity.work_type = Request["ddlcraft"]; entity.worker_time_everyweek = Request["work_time"]; entity.cost_method_payment = Request["ddlCostPayment"]; entity.chronic_disease_type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); //出生地址 if (!Request["ddlCounty1"].Equals("")) { entity.birth_commitcode = Request["ddlCounty1"]; } else { if (!Request["ddlCity1"].Equals("")) { entity.birth_commitcode = Request["ddlCity1"]; } else { if (!Request["ddlProvince1"].Equals("")) { entity.birth_commitcode = Request["ddlProvince1"]; } } } entity.birth_address = Request["birth_address"]; //常住地址 entity.community_code = Request["ddlCommunity"]; entity.permanent_home_address = Request["home_address"]; //现住地址 if (!Request["ddlCommunity2"].Equals("")) { entity.residence_commitcode = Request["ddlCommunity2"]; } else { if (!Request["ddlStreet2"].Equals("")) { entity.residence_commitcode = Request["ddlStreet2"]; } else { if (!Request["ddlCounty2"].Equals("")) { entity.residence_commitcode = Request["ddlCounty2"]; } else { if (!Request["ddlCity2"].Equals("")) { entity.residence_commitcode = Request["ddlCity2"]; } else { if (!Request["ddlProvince2"].Equals("")) { entity.residence_commitcode = Request["ddlProvince2"]; } } } } } entity.residence_address = Request["huji_address"]; entity.father_name = Request["fatherName"]; entity.father_id_card_numb = Request["fatherIdCard"]; entity.father_phone = Request["fatherPhone"]; entity.father_email = Request["father_email"]; entity.mother_name = Request["motherName"]; entity.mother_id_card_numb = Request["motherIdCard"]; entity.mother_phone = Request["motherPhone"]; entity.mother_email = Request["mother_email"]; entity.tumour_flag = "TRUE"; entity.fill_community_code = community_code; //-----------------------------------------病史信息-------------------------------------------- //1.药物过敏史 if (!string.IsNullOrEmpty(Request["chGuoMin"]) || !string.IsNullOrEmpty(Request["GuoMin_Other"])) { entity.drug_allergy_type = Request["chGuoMin"].Replace(",", "$"); entity.drug_allergy_other = Request["GuoMin_Other"]; } else { entity.drug_allergy_type = "无"; } //2.疾病史 Comm_ResidentFile_Followup_Disease entity1 = new Comm_ResidentFile_Followup_Disease(); //获取id string id1 = CommonFunc.SafeGetStringFromObj(residentFileFollowupDiseaseService.LoadEntityAsNoTracking(t => t.resident_id == entity1.resident_id).Select(t => t.id).FirstOrDefault()); if (!string.IsNullOrEmpty(Request["chdisease"]) || !string.IsNullOrEmpty(Request["Disease_Other"])) { entity.disease = ""; if (string.IsNullOrEmpty(id1)) { entity1.id = Guid.NewGuid().ToString(); } else { entity1.id = id1; } entity1.resident_id = entity.resident_id; entity1.community_code = entity.community_code; entity1.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); entity1.worker_user_name = worker; entity1.disease_type = Request["chdisease"]; entity1.disease_other = Request["Disease_Other"]; entity1.tumor_type = Request["zl"]; if (string.IsNullOrEmpty(id1)) { residentFileFollowupDiseaseService.AddEntity(entity1); } else { residentFileFollowupDiseaseService.UpdateEntity(entity1); } } else { entity.disease = "无"; } //5.手术史 List <Comm_ResidentFile_Followup_Surgery> subjectiveList = new List <Comm_ResidentFile_Followup_Surgery>(); if (!string.IsNullOrEmpty(Request["option_time0"]) || !string.IsNullOrEmpty(Request["option_name0"])) { entity.surgery = ""; for (int i = 0; i < 50; i++) { if (!string.IsNullOrEmpty(Request["option_name" + i])) { Comm_ResidentFile_Followup_Surgery entity4 = new Comm_ResidentFile_Followup_Surgery(); entity4.id = Guid.NewGuid().ToString(); entity4.resident_id = entity.resident_id; entity4.community_code = entity.community_code; entity4.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); entity4.worker_user_name = worker; if (string.IsNullOrEmpty(Request["option_time" + i])) { entity4.find_date = null; } else { entity4.find_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["option_time" + i])); } entity4.surgery_name = Request["option_name" + i]; entity4.surgery_hospital = Request["option_hospital" + i]; entity4.surgery_result = Request["option_result" + i]; subjectiveList.Add(entity4); } } } else { entity.surgery = "无"; } //6.外伤史 List <Comm_ResidentFile_Followup_Trauma> subjectiveList1 = new List <Comm_ResidentFile_Followup_Trauma>(); if (!string.IsNullOrEmpty(Request["trauma_time0"]) || !string.IsNullOrEmpty(Request["trauma_name0"])) { entity.trauma = ""; for (int i = 0; i < 50; i++) { if (!string.IsNullOrEmpty(Request["trauma_name" + i])) { Comm_ResidentFile_Followup_Trauma entity5 = new Comm_ResidentFile_Followup_Trauma(); entity5.id = Guid.NewGuid().ToString(); entity5.resident_id = entity.resident_id; entity5.community_code = entity.community_code; entity5.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); entity5.worker_user_name = worker; //entity5.find_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["trauma_time" + i])); if (string.IsNullOrEmpty(Request["trauma_time" + i])) { entity5.find_date = null; } else { entity5.find_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["trauma_time" + i])); } entity5.trauma_name = Request["trauma_name" + i]; entity5.trauma_hospital = Request["deal_hospital" + i]; entity5.trauma_result = Request["deal_result" + i]; subjectiveList1.Add(entity5); } } } else { entity.trauma = "无"; } //7.输血史 List <Comm_ResidentFile_Followup_Blood_Transfusion> subjectiveList2 = new List <Comm_ResidentFile_Followup_Blood_Transfusion>(); if (!string.IsNullOrEmpty(Request["blood_transfusion_time0"]) || !string.IsNullOrEmpty(Request["blood_transfusion_name0"])) { entity.blood_transfusion = ""; for (int i = 0; i < 50; i++) { if (!string.IsNullOrEmpty(Request["blood_transfusion_name" + i])) { Comm_ResidentFile_Followup_Blood_Transfusion entity6 = new Comm_ResidentFile_Followup_Blood_Transfusion(); entity6.id = Guid.NewGuid().ToString(); entity6.resident_id = entity.resident_id; entity6.community_code = entity.community_code; entity6.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); entity6.worker_user_name = worker; //entity6.find_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["blood_transfusion_time" + i])); if (string.IsNullOrEmpty(Request["blood_transfusion_time" + i])) { entity6.find_date = null; } else { entity6.find_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["blood_transfusion_time" + i])); } entity6.blood_transfusion_reason = Request["blood_transfusion_name" + i]; entity6.blood_amount = Request["blood_transfusion_amount" + i]; entity6.blood_result = Request["blood_transfusion_result" + i]; subjectiveList2.Add(entity6); } } } else { entity.blood_transfusion = "无"; } //8.家族遗传史 List <Comm_ResidentFile_Followup_Family_Disease> subjectiveList3 = new List <Comm_ResidentFile_Followup_Family_Disease>(); if (!string.IsNullOrEmpty(Request["relationship0"]) || !string.IsNullOrEmpty(Request["chfamilydisease0"]) || !string.IsNullOrEmpty(Request["family_other_disease0"])) { entity.family_disease = ""; for (int i = 0; i < 4; i++) { if (!string.IsNullOrEmpty(Request["relationship" + i])) { Comm_ResidentFile_Followup_Family_Disease entity7 = new Comm_ResidentFile_Followup_Family_Disease(); entity7.id = Guid.NewGuid().ToString(); entity7.resident_id = entity.resident_id; entity7.community_code = entity.community_code; entity7.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); entity7.worker_user_name = worker; entity7.relationship_host = Request["relationship" + i]; entity7.family_disease_type = Request["chfamilydisease" + i]; entity7.family_disease_other = Request["family_other_disease" + i]; subjectiveList3.Add(entity7); } } } else { entity.family_disease = "无"; } //10.残疾情况 if (!string.IsNullOrEmpty(Request["chdisability"]) || !string.IsNullOrEmpty(Request["disability_other"])) { entity.disability_type = Request["chdisability"].Replace(",", "$"); entity.disability_other = Request["disability_other"]; //entity.Disability_certificate_number = Request["disability_numb"]; } else { entity.disability_type = "无"; } //--------------------吸烟与饮酒------------------------ Chronic_disease_SmokeAndDrink entity2 = new Chronic_disease_SmokeAndDrink(); //获取id string id2 = CommonFunc.SafeGetStringFromObj(smokeAndDrinkService.LoadEntityAsNoTracking(t => t.resident_id == entity.resident_id).Select(t => t.id).FirstOrDefault()); if (string.IsNullOrEmpty(id2)) { entity2.id = Guid.NewGuid().ToString(); entity2.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["txtCreateTime"])); } else { entity2.id = id2; entity2.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["txtCreateTime"])); } entity2.name = entity.resident_name; entity2.sex = entity.sex; entity2.id_card_number = entity.id_card_number; entity2.birth_date = entity.birth_date; // entity2.permanent_home_commitcode = entity.permanent_home_commitcode; entity2.resident_id = entity.resident_id; entity2.permanent_address = entity.permanent_home_address; entity2.post_code = entity.post_code; entity2.community_code = entity.community_code; //-----吸烟---- entity2.smoking = Request["smoking"]; if (!string.IsNullOrEmpty(Request["times1"])) { entity2.smoking_begin_year = Request["times1"]; } else { entity2.smoking_begin_year = ""; } entity2.smoking_daily_amount = Request["day_smoke"]; if (!string.IsNullOrEmpty(Request["smoke_age"])) { entity2.smoking_age = Request["smoke_age"].Split('年')[0]; } else { entity2.smoking_age = ""; } if (!string.IsNullOrEmpty(Request["smoked"])) { entity2.smoked = Request["smoked"]; } else { entity2.smoked = ""; } if (!string.IsNullOrEmpty(Request["times2"])) { entity2.smoked_begin_year = Request["times2"]; } else { entity2.smoked_begin_year = ""; } if (!string.IsNullOrEmpty(Request["times3"])) { entity2.smoked_smoking_again = Request["times3"]; } else { entity2.smoked_smoking_again = ""; } if (!string.IsNullOrEmpty(Request["smoked_long"])) { entity2.smoked_long_time = Request["smoked_long"].Split('年')[0]; } else { entity2.smoked_long_time = ""; } entity2.smoked_intent = Request["smoked_idea"]; entity2.smoked_second_hand = Request["smoke_twice"]; entity2.smoke_never = Request["smoke"]; //-----饮酒----- entity2.drinking = Request["drinking"]; if (!string.IsNullOrEmpty(Request["times4"])) { entity2.drinking_begin_year = Request["times4"]; } else { entity2.drinking_begin_year = ""; } if (!string.IsNullOrEmpty(Request["drink_age"])) { entity2.drinking_age = Request["drink_age"].Split('年')[0]; } else { entity2.drinking_age = ""; } if (!string.IsNullOrEmpty(Request["times5"])) { entity2.drunk_begin_year = Request["times5"]; } else { entity2.drunk_begin_year = ""; } if (!string.IsNullOrEmpty(Request["times6"])) { entity2.drunk_drinking_again = Request["times6"]; } else { entity2.drunk_drinking_again = ""; } if (!string.IsNullOrEmpty(Request["drunk_long"])) { entity2.drunk_long_time = Request["drunk_long"].Split('年')[0]; } else { entity2.drunk_long_time = ""; } entity2.drink_never = Request["drink"]; //-----饮酒频率----- entity2.drinking_spirit_frequency = Request["frequency1"]; entity2.drinking_beer_frequency = Request["frequency2"]; entity2.drinking_red_frequency = Request["frequency3"]; entity2.drinking_yellow_frequency = Request["frequency4"]; entity2.drinking_other_wine1 = Request["other"]; entity2.drinking_other_degree1 = Request["other_du"]; entity2.drinking_other_frequency = Request["frequency5"]; entity2.drinking_spirit_amount = Request["count1"]; entity2.drinking_beer_amount = Request["count2"]; entity2.drinking_red_amount = Request["count3"]; entity2.drinking_yellow_amount = Request["count4"]; entity2.drinking_other_wine2 = Request["other_wine"]; entity2.drinking_other_degree2 = Request["wine_degree"]; entity2.drinking_other_amount = Request["count5"]; entity2.drinking_spirit_equivalent = Request["count1_dl"]; entity2.drinking_beer_equivalent = Request["count2_dl"]; entity2.drinking_red_equivalent = Request["count3_dl"]; entity2.drinking_yellow_equivalent = Request["count4_dl"]; entity2.drinking_other_equivalent = Request["count5_dl"]; entity2.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); entity2.worker_user_name = worker; entity2.create_time = entity.create_time; if (string.IsNullOrEmpty(id2)) { smokeAndDrinkService.AddEntity(entity2); } else { smokeAndDrinkService.UpdateEntity(entity2); } //进入恶性肿瘤信息表中 Comm_Tumour tm = new Comm_Tumour(); /* * 首先根据id,查找个人信息的resident_id, * 根据此resident_id到高血压信息表中找此人的id, * 如果没有,则新增,否则修改 */ if (string.IsNullOrEmpty(id)) { tm.id = Guid.NewGuid().ToString(); tm.responsible_physician = worker; tm.worker_user_name = worker; tm.community_code = entity.community_code; tm.resident_id = entity.resident_id; tm.tumour_type = Request["zl"]; tm.last_followup_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["txtCreateTime"])); tm.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["txtCreateTime"])); } else { tm.id = id; tm.responsible_physician = worker; tm.worker_user_name = worker; tm.community_code = entity.community_code; tm.resident_id = entity.resident_id; tm.tumour_type = Request["zl"]; tm.last_followup_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["txtCreateTime"])); tm.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["txtCreateTime"])); } tm.id_card_number = Request["txtCardNumber"]; tm.resident_name = Request["txtResidentName"]; tm.permanent_home_address = Request["home_address"]; tm.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["txtBirthDate"])); if (string.IsNullOrEmpty(id)) { tumourService.AddEntity(tm); } else { tumourService.UpdateEntity(tm); } #region /* * 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == txtCardNumber).Select(t => t.community_code).FirstOrDefault()); if (!Request["ddlCommunity"].Equals(code)) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == txtCardNumber).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); changeAddressService.AddEntity(address); } #endregion string msg = ""; if (string.IsNullOrEmpty(re_id)) { if (residentFileService.AddEntity(entity) && residentFileFollowupSurgeryService.UpdateSubjective(subjectiveList, entity.resident_id) && residentFileFollowupTraumaService.UpdateSubjective(subjectiveList1, entity.resident_id) && residentFileFollowupBloodTransfusionService.UpdateSubjective(subjectiveList2, entity.resident_id) && residentFileFollowupFamilyDiseaseService.UpdateSubjective(subjectiveList3, entity.resident_id)) { #region 添加摘要 Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); if (string.IsNullOrEmpty(re_id))//添加数据 { eHRAbstractService.AddEntity(ehr); } else { eHRAbstractService.UpdateEntity(ehr); } #endregion msg = "提交成功"; } else { msg = "提交失败"; } } else { Boolean b = false; b = eHRAbstractService.IsExitsOneByResidentIdAndItemType(entity.resident_id, "ResidentInfo"); if (!b) { #region 添加摘要 Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now); ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr); #endregion } if (residentFileService.UpdateEntity(entity) && residentFileFollowupSurgeryService.UpdateSubjective(subjectiveList, entity.resident_id) && residentFileFollowupTraumaService.UpdateSubjective(subjectiveList1, entity.resident_id) && residentFileFollowupBloodTransfusionService.UpdateSubjective(subjectiveList2, entity.resident_id) && residentFileFollowupFamilyDiseaseService.UpdateSubjective(subjectiveList3, entity.resident_id)) { msg = "修改成功"; } } return(Content(msg + "," + entity.resident_id)); }
//保存 public ActionResult AddAndUpdate() { string id = Request["id"]; string fill_community_code = Request["community_code"]; string worker = Request["worker"]; Chronic_disease_Hospitalization entity = new Chronic_disease_Hospitalization(); //将诊断信息放到诊断信息表中 Chronic_disease_Comm_Diagnostic dia = new Chronic_disease_Comm_Diagnostic(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } entity.name = Request["name"]; entity.sex = Request["sex"]; entity.id_card_number = Request["id_card_number"]; if (string.IsNullOrEmpty(Request["birth_date"])) { entity.birth_date = null; } else { entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); } entity.permanent_address = Request["perment_community_address"]; entity.post_code = Request["zipCode"]; entity.community_code = Request["ddlCommunity"]; entity.nationality = Request["nationality"]; entity.nation = Request["ddlNation"]; entity.marriage = Request["ddlMarrigeState"]; entity.blood_group = Request["ddlABOBloodType"]; entity.culture = Request["ddlEducationQualification"]; entity.phone = Request["txtIndividualPhone"]; entity.contact_person = Request["txtcontact_name"]; entity.email = Request["txtEmail"]; entity.contact_phone = Request["txtcontact_phone"]; entity.relationship = Request["ddlcontact_my_relationship"]; if (string.IsNullOrEmpty(Request["data"])) { entity.hospitalization_date = null; } else { entity.hospitalization_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["data"])); } entity.hospitalization_number = Request["number"]; entity.bed_number = Request["bed_number"]; entity.hospital = Request["hospital"]; entity.department = Request["department"]; entity.zs = Request["zs"]; entity.xbs = Request["xbs"]; entity.jws = Request["jws"]; entity.t = Request["t"]; entity.p = Request["p"]; entity.r = Request["r"]; entity.ssy1 = Request["ssy"]; entity.szy1 = Request["szy"]; entity.ssy2 = Request["ssy1"]; entity.szy2 = Request["szy1"]; entity.other = Request["other"]; entity.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); entity.worker_user_name = worker; entity.sign = "0"; //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (disease_HospitalizationService.AddEntity(entity)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.Hospitalization.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "保存成功"; } else { msg = "保存失败"; } } } else { if (disease_HospitalizationService.UpdateEntity(entity)) { msg = "保存成功"; } } return(Content(msg + ',' + entity.id)); }
//新增 public ActionResult AddAndUpdate() { string id = CommonFunc.SafeGetStringFromObj(Request.QueryString["id"]); string community_code = CommonFunc.SafeGetStringFromObj(Request.QueryString["community_code"]); string worker = CommonFunc.SafeGetStringFromObj(Request.QueryString["worker"]); string real_name = CommonFunc.SafeGetStringFromObj(Request.QueryString["real_name"]); MT_BC_Followup entity = new MT_BC_Followup(); MT_BC_Followup_Dose medentity = new MT_BC_Followup_Dose(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } entity.name = Request["name"]; entity.sex = Request["sex"]; entity.age = Request["age"]; entity.id_card_number = Request["id_card_number"]; string s = Request["id_card_number"]; string s1 = "", s2 = "", s3 = ""; if (s.Length == 15) { s1 = s.Substring(6, 2); s2 = s.Substring(8, 2); s3 = s.Substring(10, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj("19" + s1 + "-" + s2 + "-" + s3)); } else if (s.Length == 18) { s1 = s.Substring(6, 4); s2 = s.Substring(10, 2); s3 = s.Substring(12, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(s1 + "-" + s2 + "-" + s3)); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); entity.zipcode = Request["zipCode"]; string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } entity.community_code = Request["ddlCommunity"]; entity.address = Request["perment_community_address"]; entity.followup_physician = real_name; entity.followup_type = Request["way"]; if (string.IsNullOrEmpty(Request["time"])) { entity.followup_date = null; } else { entity.followup_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["time"])); } entity.followup_result = Request["sffl"]; entity.height = Request["height"]; entity.weight = Request["weight1"]; entity.height_weight_index = Request["bmi"]; entity.systolic_pressure = Request["ssy"]; entity.diastolic_pressure = Request["szy"]; entity.abidance_result = Request["zyxw"]; entity.worker_user_name = worker; entity.worker_user_realname = real_name; entity.heart_rate = Request["heart1"]; entity.next_heart_rate = Request["heart2"]; entity.next_weight = Request["weight2"]; entity.xltz = Request["xltz"]; entity.bloodsugar = Request["bs"]; entity.bloodsugar_other = Request["other4"]; entity.org = Request["org"]; entity.reason = Request["reason"]; if (string.IsNullOrEmpty(Request["nexttime"])) { entity.next_time = null; } else { entity.next_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["nexttime"])); } entity.ssy1 = Request["ssy1"]; entity.szy1 = Request["szy1"]; if (string.IsNullOrEmpty(Request["firstsymptomdate"])) { entity.firstsymptomdate = null; } else { entity.firstsymptomdate = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["firstsymptomdate"])); } if (string.IsNullOrEmpty(Request["firstvisitdate"])) { entity.firstvisitdate = null; } else { entity.firstvisitdate = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["firstvisitdate"])); } if (string.IsNullOrEmpty(Request["firstdiagnosisdate"])) { entity.firstdiagnosisdate = null; } else { entity.firstdiagnosisdate = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["firstdiagnosisdate"])); } entity.diagnosishospital = Request["diagnosishospital"]; entity.diseasename = Request["diseasename"]; entity.diagnosisbasis = Request["diagnosisbasis"]; entity.pathologictype = Request["pathologictype"]; entity.treatmentsituation = Request["treatmentsituation"]; entity.complication = Request["complication"]; entity.treatmenthospital = Request["treatmenthospital"]; entity.treatment = Request["treatment"]; entity.treatmentother = Request["treatmentother"]; entity.firstoperationhospital = Request["firstoperationhospital"]; if (string.IsNullOrEmpty(Request["firstoperationdate"])) { entity.firstoperationdate = null; } else { entity.firstoperationdate = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["firstoperationdate"])); } entity.firstoperationnature = Request["firstoperationnature"]; entity.transfer = Request["transfer"]; entity.transferposition = Request["transferposition"]; entity.recrudescence = Request["recrudescence"]; if (string.IsNullOrEmpty(Request["recrudescencedate"])) { entity.recrudescencedate = null; } else { entity.recrudescencedate = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["recrudescencedate"])); } entity.tumorhistory = Request["tumorhistory"]; entity.tumorhistoryrelation = Request["tumorhistoryrelation"]; entity.tumorhistorytype = Request["tumorhistorytype"]; entity.tumorhistorytypeother = Request["tumorhistorytypeother"]; entity.correctdiagnosis = Request["correctdiagnosis"]; entity.correctdiagnosissite = Request["correctdiagnosissite"]; if (string.IsNullOrEmpty(Request["correctdiagnosisdate"])) { entity.correctdiagnosisdate = null; } else { entity.correctdiagnosisdate = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["correctdiagnosisdate"])); } entity.presentsituation = Request["presentsituation"]; entity.guidecontent = Request["guidecontent"]; entity.cardscore = Request["cardscore"]; if (string.IsNullOrEmpty(Request["revokemanagedate"])) { entity.revokemanagedate = null; } else { entity.revokemanagedate = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["revokemanagedate"])); } entity.revokereason = Request["revokereason"]; entity.isdeath = Request["isdeath"]; if (string.IsNullOrEmpty(Request["deathdate"])) { entity.deathdate = null; } else { entity.deathdate = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["deathdate"])); } entity.deathreason = Request["deathreason"]; entity.deathsite = Request["deathsite"]; entity.surviveyear = Request["surviveyear"]; entity.survivemonth = Request["survivemonth"]; string med_id = CommonFunc.SafeGetStringFromObj(bc_Followup_DoseService.LoadEntityAsNoTracking(t => t.bc_followup_id == id).Select(t => t.id).FirstOrDefault()); if (string.IsNullOrEmpty(med_id)) { medentity.id = Guid.NewGuid().ToString(); medentity.bc_followup_id = entity.id; medentity.community_code = Request["ddlCommunity"]; medentity.resident_id = entity.resident_id; medentity.worker_user_name = entity.followup_physician; medentity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { medentity.id = med_id; medentity.bc_followup_id = entity.id; medentity.community_code = Request["ddlCommunity"]; medentity.resident_id = entity.resident_id; medentity.worker_user_name = entity.followup_physician; medentity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } medentity.dose_dependence = Request["fyycx"]; medentity.drug_name = Request["name1"]; medentity.drug_frequence = Request["few1"]; medentity.dosage_per_time = Request["few2"]; medentity.drug_name1 = Request["name2"]; medentity.drug_frequence1 = Request["few3"]; medentity.dosage_per_time1 = Request["few4"]; medentity.drug_name2 = Request["name3"]; medentity.drug_frequence2 = Request["few5"]; medentity.dosage_per_time2 = Request["few6"]; medentity.drug_name3 = Request["other_medicals"]; medentity.drug_frequence3 = Request["few7"]; medentity.dosage_per_time3 = Request["few8"]; medentity.has_side_effect = Request["blfy"]; medentity.side_effect_description = Request["discript"]; if (string.IsNullOrEmpty(med_id)) { bc_Followup_DoseService.AddEntity(medentity); } else { bc_Followup_DoseService.UpdateEntity(medentity); } //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } //添加吸烟、饮酒、饮食习惯、体育锻炼信息 Chronic_disease_SmokeAndDrink sd = new Chronic_disease_SmokeAndDrink(); Chronic_disease_DailyLife eh = new Chronic_disease_DailyLife(); Chronic_disease_PhysicalExercise pe = new Chronic_disease_PhysicalExercise(); //------------------------------------------------吸烟与饮酒----------------------------------------------- //获取id string id2 = CommonFunc.SafeGetStringFromObj(disease_SmokeAndDrinkService.LoadEntityAsNoTracking(t => t.resident_id == entity.resident_id).Select(t => t.id).FirstOrDefault()); if (string.IsNullOrEmpty(id2)) { sd.id = Guid.NewGuid().ToString(); } else { sd.id = id2; } sd.name = Request["name"]; sd.sex = Request["sex"]; sd.id_card_number = Request["id_card_number"]; if (string.IsNullOrEmpty(Request["birth_date"])) { sd.birth_date = null; } else { sd.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); } //常住地址 sd.resident_id = entity.resident_id; sd.permanent_address = Request["perment_community_address"]; sd.post_code = Request["zipCode"]; sd.community_code = Request["ddlCommunity"]; //-----吸烟---- if (Request["day_smoke"] != "") { sd.smoking_daily_amount = Request["day_smoke"]; sd.smoking = "吸烟"; } //-----饮酒----- //-----饮酒频率----- if (Request["count1"] != "" || Request["count2"] != "" || Request["count3"] != "" || Request["count4"] != "" || Request["count5"] != "") { sd.drinking = "饮酒"; sd.drinking_spirit_amount = Request["count1"]; sd.drinking_beer_amount = Request["count2"]; sd.drinking_red_amount = Request["count3"]; sd.drinking_yellow_amount = Request["count4"]; sd.drinking_other_wine2 = Request["other_wine"]; sd.drinking_other_degree2 = Request["wine_degree"]; sd.drinking_other_amount = Request["count5"]; sd.drinking_spirit_equivalent = Request["count1_dl"]; sd.drinking_beer_equivalent = Request["count2_dl"]; sd.drinking_red_equivalent = Request["count3_dl"]; sd.drinking_yellow_equivalent = Request["count4_dl"]; sd.drinking_other_equivalent = Request["count5_dl"]; } sd.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); sd.worker_user_name = worker; sd.create_time = entity.followup_date; if (string.IsNullOrEmpty(id2)) { disease_SmokeAndDrinkService.AddEntity(sd); } else { disease_SmokeAndDrinkService.UpdateEntity(sd); } //=================体育锻炼======================== string id3 = CommonFunc.SafeGetStringFromObj(disease_PhysicalExerciseService.LoadEntityAsNoTracking(t => t.resident_id == entity.resident_id).Select(t => t.id).FirstOrDefault()); if (string.IsNullOrEmpty(id3)) { pe.id = Guid.NewGuid().ToString(); } else { pe.id = id3; } pe.name = Request["name"]; pe.sex = Request["sex"]; pe.id_card_number = Request["id_card_number"]; if (string.IsNullOrEmpty(Request["birth_date"])) { pe.birth_date = null; } else { pe.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); } //常住地址 pe.resident_id = entity.resident_id; pe.permanent_address = Request["perment_community_address"]; pe.post_code = Request["zipCode"]; pe.community_code = Request["ddlCommunity"]; pe.physical_1 = Request["run"]; pe.physical_1_time = Request["every_time1"]; pe.physical_1_week = Request["week1"]; pe.physical_2 = Request["cut_it"]; pe.physical_2_week = Request["week2"]; pe.physical_2_time = Request["every_time2"]; pe.physical_2_speed = Request["speed2"]; pe.physical_3 = Request["by_bike"]; pe.physical_3_week = Request["week3"]; pe.physical_3_time = Request["every_time3"]; pe.physical_3_speed = Request["speed3"]; pe.physical_4 = Request["swim"]; pe.physical_4_week = Request["week4"]; pe.physical_4_time = Request["every_time4"]; pe.physical_5 = Request["circuit"]; pe.physical_5_week = Request["week5"]; pe.physical_5_time = Request["every_time5"]; pe.physical_6 = Request["ping_pong"]; pe.physical_6_week = Request["week6"]; pe.physical_6_time = Request["every_time6"]; pe.physical_7 = Request["badminton"]; pe.physical_7_week = Request["week7"]; pe.physical_7_time = Request["every_time7"]; pe.physical_8 = Request["football"]; pe.physical_8_week = Request["week8"]; pe.physical_8_time = Request["every_time8"]; pe.physical_9 = Request["basketball"]; pe.physical_9_week = Request["week9"]; pe.physical_9_time = Request["every_time9"]; pe.physical_10 = Request["tennis"]; pe.physical_10_week = Request["week10"]; pe.physical_10_time = Request["every_time10"]; pe.physical_11 = Request["baseball"]; pe.physical_11_week = Request["week11"]; pe.physical_11_time = Request["every_time11"]; pe.physical_12 = Request["golf"]; pe.physical_12_week = Request["week12"]; pe.physical_12_time = Request["every_time12"]; pe.physical_13 = Request["bowling"]; pe.physical_13_week = Request["week13"]; pe.physical_13_time = Request["every_time13"]; pe.physical_14 = Request["shadowboxing"]; pe.physical_14_week = Request["week14"]; pe.physical_14_time = Request["every_time14"]; pe.physical_15 = Request["taekwondo"]; pe.physical_15_week = Request["week15"]; pe.physical_15_time = Request["every_time15"]; pe.physical_16 = Request["mountaineering"]; pe.physical_16_week = Request["week16"]; pe.physical_16_time = Request["every_time16"]; pe.physical_17 = Request["skip"]; pe.physical_17_week = Request["week17"]; pe.physical_17_time = Request["every_time17"]; pe.physical_other = Request["other0"]; pe.physical_other_frequency = Request["frequency0"]; pe.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); pe.worker_user_name = worker; pe.create_time = entity.followup_date; if (string.IsNullOrEmpty(id3)) { disease_PhysicalExerciseService.AddEntity(pe); } else { disease_PhysicalExerciseService.UpdateEntity(pe); } //-------------饮食习惯------------ //获取id string id4 = CommonFunc.SafeGetStringFromObj(disease_DailyLifeService.LoadEntityAsNoTracking(t => t.resident_id == entity.resident_id).Select(t => t.id).FirstOrDefault()); if (string.IsNullOrEmpty(id4)) { eh.id = Guid.NewGuid().ToString(); } else { eh.id = id4; } eh.name = Request["name"]; eh.sex = Request["sex"]; eh.id_card_number = Request["id_card_number"]; if (string.IsNullOrEmpty(Request["birth_date"])) { eh.birth_date = null; } else { eh.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); } //常住地址 eh.resident_id = entity.resident_id; eh.permanent_address = Request["perment_community_address"]; eh.post_code = Request["zipCode"]; eh.community_code = Request["ddlCommunity"]; eh.living_getup = Request["morning"]; eh.living_noonbreak = Request["noon"]; eh.living_sleep = Request["night"]; eh.diet_three_meals = Request["law"]; eh.diet_staple_food = Request["food"]; eh.diet_eating = Request["taste"]; eh.diet_eating_other = Request["taste_other"]; eh.diet_oil_salt = Request["oil_salt"]; eh.diet_oil_salt_other = Request["oil_salt_other"]; eh.diet_salt_amount = Request["salt_eat"]; eh.diet_oil_amount = Request["oil_eat"]; eh.diet_sugar_amount = Request["sugar_eat"]; eh.diet_drinkwater_morning = Request["water"]; eh.diet_drink_amount = Request["amount"]; eh.diet_drink_interval = Request["time"]; eh.diet_drinks = Request["drink"]; eh.diet_drinks_other = Request["other"]; eh.diet_fruits = Request["melon_fruit"]; eh.diet_vegetables = Request["vegetables"]; eh.diet_grain = Request["grain"]; eh.diet_grain_other = Request["other_grain"]; eh.diet_aquatic_products = Request["aquatic"]; eh.diet_aquatic_products_other = Request["other_aquatic"]; eh.diet_livestock_poultry_eggs = Request["meat"]; eh.diet_livestock_poultry_eggs_other = Request["other_meat"]; eh.diet_health_products = Request["health_products"]; eh.diet_health_products_other = Request["other_health_products"]; eh.diet_hobby = Request["other_diet"]; eh.diet_hobby_other = Request["other_diet_other"]; eh.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); eh.worker_user_name = worker; eh.create_time = entity.followup_date; if (string.IsNullOrEmpty(id4)) { disease_DailyLifeService.AddEntity(eh); } else { disease_DailyLifeService.UpdateEntity(eh); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (bc_FollowupService.AddEntity(entity)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.Followup.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } else { msg = "提交失败"; } } else { if (bc_FollowupService.UpdateEntity(entity)) { msg = "提交成功"; } else { msg = "提交失败"; } } return(Content(msg)); }
//新增 更新 public ActionResult AddAndUpdate() { string id = CommonFunc.SafeGetStringFromObj(Request["id"]); string fill_community_code = CommonFunc.SafeGetStringFromObj(Request["community_code"]); string worker = CommonFunc.SafeGetStringFromObj(Request["worker"]); Chronic_disease_Constitution entity = new Chronic_disease_Constitution(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } entity.worker_user_name = worker; //阳虚质 entity.yangxz_1 = Request["test1"]; entity.yangxz_2 = Request["test2"]; entity.yangxz_3 = Request["test3"]; entity.yangxz_4 = Request["test4"]; entity.yangxz_5 = Request["test5"]; entity.yangxz_6 = Request["test6"]; entity.yangxz_7 = Request["test7"]; //阴虚质 entity.yinxz_1 = Request["test8"]; entity.yinxz_2 = Request["test9"]; entity.yinxz_3 = Request["test10"]; entity.yinxz_4 = Request["test11"]; entity.yinxz_5 = Request["test12"]; entity.yinxz_6 = Request["test13"]; entity.yinxz_7 = Request["test14"]; entity.yinxz_8 = Request["test15"]; //气虚质 entity.qixz_1 = Request["test16"]; entity.qixz_2 = Request["test17"]; entity.qixz_3 = Request["test18"]; entity.qixz_4 = Request["test19"]; entity.qixz_5 = Request["test20"]; entity.qixz_6 = Request["test21"]; entity.qixz_7 = Request["test22"]; entity.qixz_8 = Request["test23"]; //痰湿质 entity.tansz_1 = Request["test24"]; entity.tansz_2 = Request["test25"]; entity.tansz_3 = Request["test26"]; entity.tansz_4 = Request["test27"]; entity.tansz_5 = Request["test28"]; entity.tansz_6 = Request["test29"]; entity.tansz_7 = Request["test30"]; entity.tansz_8 = Request["test31"]; //湿热质 entity.shirz_1 = Request["test32"]; entity.shirz_2 = Request["test33"]; entity.shirz_3 = Request["test34"]; entity.shirz_4 = Request["test35"]; entity.shirz_5 = Request["test36"]; entity.shirz_6 = Request["test37"]; entity.shirz_7 = Request["test38"]; //血瘀质 entity.xueyz_1 = Request["test39"]; entity.xueyz_2 = Request["test40"]; entity.xueyz_3 = Request["test41"]; entity.xueyz_4 = Request["test42"]; entity.xueyz_5 = Request["test43"]; entity.xueyz_6 = Request["test44"]; entity.xueyz_7 = Request["test45"]; //特禀质 entity.tebz_1 = Request["test46"]; entity.tebz_2 = Request["test47"]; entity.tebz_3 = Request["test48"]; entity.tebz_4 = Request["test49"]; entity.tebz_5 = Request["test50"]; entity.tebz_6 = Request["test51"]; entity.tebz_7 = Request["test52"]; //气郁质 entity.qiyz_1 = Request["test53"]; entity.qiyz_2 = Request["test54"]; entity.qiyz_3 = Request["test55"]; entity.qiyz_4 = Request["test56"]; entity.qiyz_5 = Request["test57"]; entity.qiyz_6 = Request["test58"]; entity.qiyz_7 = Request["test59"]; //平和质 entity.pinghz_1 = Request["test60"]; entity.pinghz_2 = Request["test61"]; entity.pinghz_3 = Request["test62"]; entity.pinghz_4 = Request["test63"]; entity.pinghz_5 = Request["test64"]; entity.pinghz_6 = Request["test65"]; entity.pinghz_7 = Request["test66"]; entity.pinghz_8 = Request["test67"]; entity.scores_yangxz = (Convert.ToInt16(entity.yangxz_1) + Convert.ToInt16(entity.yangxz_2) + Convert.ToInt16(entity.yangxz_3) + Convert.ToInt16(entity.yangxz_4) + Convert.ToInt16(entity.yangxz_5) + Convert.ToInt16(entity.yangxz_6) + Convert.ToInt16(entity.yangxz_7)).ToString(); entity.scores_yinxz = (Convert.ToInt16(entity.yinxz_1) + Convert.ToInt16(entity.yinxz_2) + Convert.ToInt16(entity.yinxz_3) + Convert.ToInt16(entity.yinxz_4) + Convert.ToInt16(entity.yinxz_5) + Convert.ToInt16(entity.yinxz_6) + Convert.ToInt16(entity.yinxz_7) + Convert.ToInt16(entity.yinxz_8)).ToString(); entity.scores_qixz = (Convert.ToInt16(entity.qixz_1) + Convert.ToInt16(entity.qixz_2) + Convert.ToInt16(entity.qixz_3) + Convert.ToInt16(entity.qixz_4) + Convert.ToInt16(entity.qixz_5) + Convert.ToInt16(entity.qixz_6) + Convert.ToInt16(entity.qixz_7) + Convert.ToInt16(entity.qixz_8)).ToString(); entity.scores_tansz = (Convert.ToInt16(entity.tansz_1) + Convert.ToInt16(entity.tansz_2) + Convert.ToInt16(entity.tansz_3) + Convert.ToInt16(entity.tansz_4) + Convert.ToInt16(entity.tansz_5) + Convert.ToInt16(entity.tansz_6) + Convert.ToInt16(entity.tansz_7) + Convert.ToInt16(entity.tansz_8)).ToString(); entity.scores_shirz = (Convert.ToInt16(entity.shirz_1) + Convert.ToInt16(entity.shirz_2) + Convert.ToInt16(entity.shirz_3) + Convert.ToInt16(entity.shirz_4) + Convert.ToInt16(entity.shirz_5) + Convert.ToInt16(entity.shirz_6) + Convert.ToInt16(entity.shirz_7)).ToString(); entity.scores_xueyz = (Convert.ToInt16(entity.xueyz_1) + Convert.ToInt16(entity.xueyz_2) + Convert.ToInt16(entity.xueyz_3) + Convert.ToInt16(entity.xueyz_4) + Convert.ToInt16(entity.xueyz_5) + Convert.ToInt16(entity.xueyz_6) + Convert.ToInt16(entity.xueyz_7)).ToString(); entity.scores_tebz = (Convert.ToInt16(entity.tebz_1) + Convert.ToInt16(entity.tebz_2) + Convert.ToInt16(entity.tebz_3) + Convert.ToInt16(entity.tebz_4) + Convert.ToInt16(entity.tebz_5) + Convert.ToInt16(entity.tebz_6) + Convert.ToInt16(entity.tebz_7)).ToString(); entity.scores_qiyz = (Convert.ToInt16(entity.qiyz_1) + Convert.ToInt16(entity.qiyz_2) + Convert.ToInt16(entity.qiyz_3) + Convert.ToInt16(entity.qiyz_4) + Convert.ToInt16(entity.qiyz_5) + Convert.ToInt16(entity.qiyz_6) + Convert.ToInt16(entity.qiyz_7)).ToString(); entity.scores_pinghz = (Convert.ToInt16(entity.pinghz_1) + Convert.ToInt16(entity.pinghz_2) + Convert.ToInt16(entity.pinghz_3) + Convert.ToInt16(entity.pinghz_4) + Convert.ToInt16(entity.pinghz_5) + Convert.ToInt16(entity.pinghz_6) + Convert.ToInt16(entity.pinghz_7) + Convert.ToInt16(entity.pinghz_8)).ToString(); int a = (int)(((float)(Int32.Parse(entity.scores_yangxz) - 7)) / 28 * 100); int b = (int)(((float)(Int32.Parse(entity.scores_yinxz) - 8)) / 32 * 100); int c = (int)(((float)(Int32.Parse(entity.scores_qixz) - 8)) / 32 * 100); int d = (int)(((float)(Int32.Parse(entity.scores_tansz) - 8)) / 32 * 100); int e = 0; if (Request["test1"].Equals("01")) { e = (int)(((float)(Int32.Parse(entity.scores_shirz) - 6)) / 24 * 100); } else { e = (int)(((float)(Int32.Parse(entity.scores_shirz) - 7)) / 28 * 100); } int f = (int)(((float)(Int32.Parse(entity.scores_xueyz) - 7)) / 28 * 100); int g = (int)(((float)(Int32.Parse(entity.scores_tebz) - 7)) / 28 * 100); int h = (int)(((float)(Int32.Parse(entity.scores_qiyz) - 7)) / 28 * 100); int i = (int)(((float)(Int32.Parse(entity.scores_pinghz) - 8)) / 32 * 100); int[] array = new int[] { a, b, c, d, e, f, g, h }; int temp = 0; int index = 0; for (int x = 0; x < array.Length; x++) { if (temp < array[x]) //如果用<= 则找到的是最大值(多个中的最后一个) <则是多个中的第一个 { temp = array[x]; index = x; } } if (i >= 60) { switch (index) { case 0: if (temp >= 40) { entity.result = "阳虚质"; } else if (temp >= 30 && temp < 40) { entity.result = "基本是平和质,有阳虚质倾向"; } else { entity.result = "平和质"; } break; case 1: if (temp >= 40) { entity.result = "阴虚质"; } else if (temp >= 30 && temp < 40) { entity.result = "基本是平和质,有阴虚质倾向"; } else { entity.result = "平和质"; } break; case 2: if (temp >= 40) { entity.result = "气虚质"; } else if (temp >= 30 && temp < 40) { entity.result = "基本是平和质,有气虚质倾向"; } else { entity.result = "平和质"; } break; case 3: if (temp >= 40) { entity.result = "痰湿质"; } else if (temp >= 30 && temp < 40) { entity.result = "基本是平和质,有痰湿质倾向"; } else { entity.result = "平和质"; } break; case 4: if (temp >= 40) { entity.result = "湿热质"; } else if (temp >= 30 && temp < 40) { entity.result = "基本是平和质,有湿热质倾向"; } else { entity.result = "平和质"; } break; case 5: if (temp >= 40) { entity.result = "血瘀质"; } else if (temp >= 30 && temp < 40) { entity.result = "基本是平和质,有血瘀质倾向"; } else { entity.result = "平和质"; } break; case 6: if (temp >= 40) { entity.result = "特禀质"; } else if (temp >= 30 && temp < 40) { entity.result = "基本是平和质,有特禀质倾向"; } else { entity.result = "平和质"; } break; case 7: if (temp >= 40) { entity.result = "气郁质"; } else if (temp >= 30 && temp < 40) { entity.result = "基本是平和质,有气郁质倾向"; } else { entity.result = "平和质"; } break; default: break; } } else { switch (index) { case 0: if (temp >= 40) { entity.result = "阳虚质"; } else if (temp >= 30 && temp < 40) { entity.result = "有阳虚质倾向"; } else { entity.result = ""; } break; case 1: if (temp >= 40) { entity.result = "阴虚质"; } else if (temp >= 30 && temp < 40) { entity.result = "有阴虚质倾向"; } else { entity.result = ""; } break; case 2: if (temp >= 40) { entity.result = "气虚质"; } else if (temp >= 30 && temp < 40) { entity.result = "有气虚质倾向"; } else { entity.result = ""; } break; case 3: if (temp >= 40) { entity.result = "痰湿质"; } else if (temp >= 30 && temp < 40) { entity.result = "有痰湿质倾向"; } else { entity.result = ""; } break; case 4: if (temp >= 40) { entity.result = "湿热质"; } else if (temp >= 30 && temp < 40) { entity.result = "有湿热质倾向"; } else { entity.result = ""; } break; case 5: if (temp >= 40) { entity.result = "血瘀质"; } else if (temp >= 30 && temp < 40) { entity.result = "有血瘀质倾向"; } else { entity.result = ""; } break; case 6: if (temp >= 40) { entity.result = "特禀质"; } else if (temp >= 30 && temp < 40) { entity.result = "有特禀质倾向"; } else { entity.result = ""; } break; case 7: if (temp >= 40) { entity.result = "气郁质"; } else if (temp >= 30 && temp < 40) { entity.result = "有气郁质倾向"; } else { entity.result = ""; } break; default: break; } } //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; string s = Request["id_card_number"]; string s1 = "", s2 = "", s3 = ""; if (s.Length == 15) { s1 = s.Substring(6, 2); s2 = s.Substring(8, 2); s3 = s.Substring(10, 2); resident.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj("19" + s1 + "-" + s2 + "-" + s3)); } else if (s.Length == 18) { s1 = s.Substring(6, 4); s2 = s.Substring(10, 2); s3 = s.Substring(12, 2); resident.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(s1 + "-" + s2 + "-" + s3)); } resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = Request["ddlCommunity"]; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (disease_ConstitutionService.AddEntity(entity)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = Request["ddlCommunity"]; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.Constitution.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } return(Content(msg + ',' + entity.id + "," + entity.result)); }
//提交 更新页面 public ActionResult AddAndUpdate() { string id = Request["id"]; string fill_community_code = Request["community_code"]; string worker = Request["worker"]; Chronic_disease_PhysicalExercise entity = new Chronic_disease_PhysicalExercise(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } entity.name = Request["name"]; entity.sex = Request["sex"]; entity.id_card_number = Request["id_card_number"]; entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); entity.permanent_address = Request["perment_community_address"]; entity.post_code = Request["zipCode"]; entity.community_code = Request["ddlCommunity"]; entity.physical_1 = Request["run"]; entity.physical_1_time = Request["every_time1"]; entity.physical_1_week = Request["week1"]; entity.physical_2 = Request["cut_it"]; entity.physical_2_week = Request["week2"]; entity.physical_2_time = Request["every_time2"]; entity.physical_2_speed = Request["speed2"]; entity.physical_3 = Request["by_bike"]; entity.physical_3_week = Request["week3"]; entity.physical_3_time = Request["every_time3"]; entity.physical_3_speed = Request["speed3"]; entity.physical_4 = Request["swim"]; entity.physical_4_week = Request["week4"]; entity.physical_4_time = Request["every_time4"]; entity.physical_5 = Request["circuit"]; entity.physical_5_week = Request["week5"]; entity.physical_5_time = Request["every_time5"]; entity.physical_6 = Request["ping_pong"]; entity.physical_6_week = Request["week6"]; entity.physical_6_time = Request["every_time6"]; entity.physical_7 = Request["badminton"]; entity.physical_7_week = Request["week7"]; entity.physical_7_time = Request["every_time7"]; entity.physical_8 = Request["football"]; entity.physical_8_week = Request["week8"]; entity.physical_8_time = Request["every_time8"]; entity.physical_9 = Request["basketball"]; entity.physical_9_week = Request["week9"]; entity.physical_9_time = Request["every_time9"]; entity.physical_10 = Request["tennis"]; entity.physical_10_week = Request["week10"]; entity.physical_10_time = Request["every_time10"]; entity.physical_11 = Request["baseball"]; entity.physical_11_week = Request["week11"]; entity.physical_11_time = Request["every_time11"]; entity.physical_12 = Request["golf"]; entity.physical_12_week = Request["week12"]; entity.physical_12_time = Request["every_time12"]; entity.physical_13 = Request["bowling"]; entity.physical_13_week = Request["week13"]; entity.physical_13_time = Request["every_time13"]; entity.physical_14 = Request["shadowboxing"]; entity.physical_14_week = Request["week14"]; entity.physical_14_time = Request["every_time14"]; entity.physical_15 = Request["taekwondo"]; entity.physical_15_week = Request["week15"]; entity.physical_15_time = Request["every_time15"]; entity.physical_16 = Request["mountaineering"]; entity.physical_16_week = Request["week16"]; entity.physical_16_time = Request["every_time16"]; entity.physical_17 = Request["skip"]; entity.physical_17_week = Request["week17"]; entity.physical_17_time = Request["every_time17"]; entity.physical_other = Request["other0"]; entity.physical_other_frequency = Request["frequency0"]; entity.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); entity.worker_user_name = worker; List <Chronic_disease_PhysicalExercise_Add> subjectiveList = new List <Chronic_disease_PhysicalExercise_Add>(); for (int i = 1; i < 7; i++) { if (!string.IsNullOrEmpty(Request["other" + i])) { Chronic_disease_PhysicalExercise_Add entity1 = new Chronic_disease_PhysicalExercise_Add(); entity1.id = Guid.NewGuid().ToString(); entity1.add_id = entity.id; entity1.physical = Request["other" + i]; entity1.frequency = Request["frequency" + i]; if (entity1.physical != null) { subjectiveList.Add(entity1); } } } //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (diseasePhysicalExerciseService.AddEntity(entity) && diseasePhysicalExerciseAddService.UpdateSubjective(subjectiveList, entity.id)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.Physical.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } else { if (diseasePhysicalExerciseService.UpdateEntity(entity) && diseasePhysicalExerciseAddService.UpdateSubjective(subjectiveList, entity.id)) { msg = "修改成功"; } } return(Content(msg + ',' + entity.id)); }
//新增或修改 public ActionResult AddAndUpdate() { string id = CommonFunc.SafeGetStringFromObj(Request.QueryString["id"]); string community_code = CommonFunc.SafeGetStringFromObj(Request.QueryString["community_code"]); string worker = CommonFunc.SafeGetStringFromObj(Request.QueryString["worker"]); string real_name = CommonFunc.SafeGetStringFromObj(Request.QueryString["real_name"]); MT_Comm_Adults_Health_Examination_New entity = new MT_Comm_Adults_Health_Examination_New(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } entity.name = Request["name"]; entity.sex = Request["sex"]; entity.age = Request["age"]; entity.id_card_number = Request["id_card_number"]; string s = Request["id_card_number"]; string s1 = "", s2 = "", s3 = ""; if (s.Length == 15) { s1 = s.Substring(6, 2); s2 = s.Substring(8, 2); s3 = s.Substring(10, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj("19" + s1 + "-" + s2 + "-" + s3)); } else if (s.Length == 18) { s1 = s.Substring(6, 4); s2 = s.Substring(10, 2); s3 = s.Substring(12, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(s1 + "-" + s2 + "-" + s3)); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); entity.zipcode = Request["zipCode"]; string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } entity.community_code = Request["ddlCommunity"]; entity.address = Request["perment_community_address"]; entity.worker_user_name = worker; entity.worker_user_realname = real_name; entity.tijianriqi = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["time"])); entity.company = Request["company"]; entity.ybzk_tiwen = Request["t"]; entity.ybzk_mailv = Request["p"]; entity.ybzk_huxipinglv = Request["r"]; entity.ybzk_xueya_h = Request["ssy"]; entity.ybzk_xueya_l = Request["szy"]; entity.ybzk_shenggao = Request["height"]; entity.ybzk_tizhong = Request["weight"]; entity.ybzk_tizhizhishu = Request["bmi"]; entity.ybzk_yaowei = Request["w"]; entity.ybzk_tunwei = Request["h"]; entity.ybzk_yaotunweibi = Request["w_h"]; //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; //1.药物过敏史 if (!string.IsNullOrEmpty(Request["chGuoMin"]) || !string.IsNullOrEmpty(Request["GuoMin_Other"])) { resident.drug_allergy_type = Request["chGuoMin"]; resident.drug_allergy_other = Request["GuoMin_Other"]; } else { resident.drug_allergy_type = "无"; } resident.work_unit = Request["txtWorkUnit"]; resident.work_type = Request["ddlcraft"]; resident.worker_time_everyweek = Request["work_time"]; //10.残疾情况 if (!string.IsNullOrEmpty(Request["chdisability"]) || !string.IsNullOrEmpty(Request["disability_other"])) { resident.disability_type = Request["chdisability"]; resident.disability_other = Request["disability_other"]; } if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } //======================病史信息===================== Comm_ResidentFile_Followup_Disease entity1 = new Comm_ResidentFile_Followup_Disease(); //获取id string id1 = CommonFunc.SafeGetStringFromObj(comm_ResidentFile_Followup_DiseaseService.LoadEntityAsNoTracking(t => t.resident_id == entity.resident_id).Select(t => t.id).FirstOrDefault()); if (!string.IsNullOrEmpty(Request["chdisease"]) || !string.IsNullOrEmpty(Request["Disease_Other"])) { if (string.IsNullOrEmpty(id1)) { entity1.id = Guid.NewGuid().ToString(); } else { entity1.id = id1; } entity1.resident_id = entity.resident_id; entity1.community_code = entity.community_code; entity1.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); entity1.worker_user_name = worker; entity1.disease_type = Request["chdisease"]; entity1.disease_other = Request["Disease_Other"]; entity1.tumor_type = Request["zl"]; if (string.IsNullOrEmpty(id1)) { comm_ResidentFile_Followup_DiseaseService.AddEntity(entity1); } else { comm_ResidentFile_Followup_DiseaseService.UpdateEntity(entity1); } } //------------------------------------------------吸烟与饮酒----------------------------------------------- Chronic_disease_SmokeAndDrink entity2 = new Chronic_disease_SmokeAndDrink(); //获取id string id2 = CommonFunc.SafeGetStringFromObj(chronic_disease_SmokeAndDrinkService.LoadEntityAsNoTracking(t => t.resident_id == entity.resident_id).Select(t => t.id).FirstOrDefault()); if (string.IsNullOrEmpty(id2)) { entity2.id = Guid.NewGuid().ToString(); } else { entity2.id = id2; } entity2.name = Request["name"]; entity2.sex = Request["sex"]; entity2.id_card_number = Request["id_card_number"]; if (string.IsNullOrEmpty(Request["birth_date"])) { entity2.birth_date = null; } else { entity2.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); } //常住地址 entity2.resident_id = entity.resident_id; entity2.permanent_address = Request["perment_community_address"]; entity2.post_code = Request["zipCode"]; entity2.community_code = Request["ddlCommunity"]; //-----吸烟---- entity2.smoking = Request["smoking"]; if (!string.IsNullOrEmpty(Request["times1"])) { entity2.smoking_begin_year = Request["times1"]; } else { entity2.smoking_begin_year = ""; } entity2.smoking_daily_amount = Request["day_smoke"]; if (!string.IsNullOrEmpty(Request["smoke_age"])) { entity2.smoking_age = Request["smoke_age"].Split('年')[0]; } else { entity2.smoking_age = ""; } if (!string.IsNullOrEmpty(Request["smoked"])) { entity2.smoked = Request["smoked"]; } else { entity2.smoked = ""; } if (!string.IsNullOrEmpty(Request["times2"])) { entity2.smoked_begin_year = Request["times2"]; } else { entity2.smoked_begin_year = ""; } if (!string.IsNullOrEmpty(Request["times3"])) { entity2.smoked_smoking_again = Request["times3"]; } else { entity2.smoked_smoking_again = ""; } if (!string.IsNullOrEmpty(Request["smoked_long"])) { entity2.smoked_long_time = Request["smoked_long"].Split('年')[0]; } else { entity2.smoked_long_time = ""; } entity2.smoked_intent = Request["smoked_idea"]; entity2.smoked_second_hand = Request["smoke_twice"]; entity2.smoke_never = Request["smoke"]; //-----饮酒----- entity2.drinking = Request["drinking"]; if (!string.IsNullOrEmpty(Request["times4"])) { entity2.drinking_begin_year = Request["times4"]; } else { entity2.drinking_begin_year = ""; } if (!string.IsNullOrEmpty(Request["drink_age"])) { entity2.drinking_age = Request["drink_age"].Split('年')[0]; } else { entity2.drinking_age = ""; } if (!string.IsNullOrEmpty(Request["times5"])) { entity2.drunk_begin_year = Request["times5"]; } else { entity2.drunk_begin_year = ""; } if (!string.IsNullOrEmpty(Request["times6"])) { entity2.drunk_drinking_again = Request["times6"]; } else { entity2.drunk_drinking_again = ""; } if (!string.IsNullOrEmpty(Request["drunk_long"])) { entity2.drunk_long_time = Request["drunk_long"].Split('年')[0]; } else { entity2.drunk_long_time = ""; } entity2.drink_never = Request["drink"]; //-----饮酒频率----- entity2.drinking_spirit_frequency = Request["frequency1"]; entity2.drinking_beer_frequency = Request["frequency2"]; entity2.drinking_red_frequency = Request["frequency3"]; entity2.drinking_yellow_frequency = Request["frequency4"]; entity2.drinking_other_wine1 = Request["other"]; entity2.drinking_other_degree1 = Request["other_du"]; entity2.drinking_other_frequency = Request["frequency5"]; entity2.drinking_spirit_amount = Request["count1"]; entity2.drinking_beer_amount = Request["count2"]; entity2.drinking_red_amount = Request["count3"]; entity2.drinking_yellow_amount = Request["count4"]; entity2.drinking_other_wine2 = Request["other_wine"]; entity2.drinking_other_degree2 = Request["wine_degree"]; entity2.drinking_other_amount = Request["count5"]; entity2.drinking_spirit_equivalent = Request["count1_dl"]; entity2.drinking_beer_equivalent = Request["count2_dl"]; entity2.drinking_red_equivalent = Request["count3_dl"]; entity2.drinking_yellow_equivalent = Request["count4_dl"]; entity2.drinking_other_equivalent = Request["count5_dl"]; entity2.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); entity2.worker_user_name = worker; entity2.create_time = entity.create_time; if (string.IsNullOrEmpty(id2)) { chronic_disease_SmokeAndDrinkService.AddEntity(entity2); } else { chronic_disease_SmokeAndDrinkService.UpdateEntity(entity2); } Chronic_disease_DailyLife eh = new Chronic_disease_DailyLife(); Chronic_disease_PhysicalExercise pe = new Chronic_disease_PhysicalExercise(); //=================体育锻炼======================== string id3 = CommonFunc.SafeGetStringFromObj(chronic_disease_PhysicalExerciseService.LoadEntityAsNoTracking(t => t.resident_id == entity.resident_id).Select(t => t.id).FirstOrDefault()); if (string.IsNullOrEmpty(id3)) { pe.id = Guid.NewGuid().ToString(); } else { pe.id = id3; } pe.name = Request["name"]; pe.sex = Request["sex"]; pe.id_card_number = Request["id_card_number"]; if (string.IsNullOrEmpty(Request["birth_date"])) { pe.birth_date = null; } else { pe.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); } //常住地址 pe.resident_id = entity.resident_id; pe.permanent_address = Request["perment_community_address"]; pe.post_code = Request["zipCode"]; pe.community_code = Request["ddlCommunity"]; pe.physical_1 = Request["run"]; pe.physical_1_time = Request["every_time1"]; pe.physical_1_week = Request["week1"]; pe.physical_2 = Request["cut_it"]; pe.physical_2_week = Request["week2"]; pe.physical_2_time = Request["every_time2"]; pe.physical_2_speed = Request["speed2"]; pe.physical_3 = Request["by_bike"]; pe.physical_3_week = Request["week3"]; pe.physical_3_time = Request["every_time3"]; pe.physical_3_speed = Request["speed3"]; pe.physical_4 = Request["swim"]; pe.physical_4_week = Request["week4"]; pe.physical_4_time = Request["every_time4"]; pe.physical_5 = Request["circuit"]; pe.physical_5_week = Request["week5"]; pe.physical_5_time = Request["every_time5"]; pe.physical_6 = Request["ping_pong"]; pe.physical_6_week = Request["week6"]; pe.physical_6_time = Request["every_time6"]; pe.physical_7 = Request["badminton"]; pe.physical_7_week = Request["week7"]; pe.physical_7_time = Request["every_time7"]; pe.physical_8 = Request["football"]; pe.physical_8_week = Request["week8"]; pe.physical_8_time = Request["every_time8"]; pe.physical_9 = Request["basketball"]; pe.physical_9_week = Request["week9"]; pe.physical_9_time = Request["every_time9"]; pe.physical_10 = Request["tennis"]; pe.physical_10_week = Request["week10"]; pe.physical_10_time = Request["every_time10"]; pe.physical_11 = Request["baseball"]; pe.physical_11_week = Request["week11"]; pe.physical_11_time = Request["every_time11"]; pe.physical_12 = Request["golf"]; pe.physical_12_week = Request["week12"]; pe.physical_12_time = Request["every_time12"]; pe.physical_13 = Request["bowling"]; pe.physical_13_week = Request["week13"]; pe.physical_13_time = Request["every_time13"]; pe.physical_14 = Request["shadowboxing"]; pe.physical_14_week = Request["week14"]; pe.physical_14_time = Request["every_time14"]; pe.physical_15 = Request["taekwondo"]; pe.physical_15_week = Request["week15"]; pe.physical_15_time = Request["every_time15"]; pe.physical_16 = Request["mountaineering"]; pe.physical_16_week = Request["week16"]; pe.physical_16_time = Request["every_time16"]; pe.physical_17 = Request["skip"]; pe.physical_17_week = Request["week17"]; pe.physical_17_time = Request["every_time17"]; pe.physical_other = Request["other0"]; pe.physical_other_frequency = Request["frequency0"]; pe.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); pe.worker_user_name = worker; pe.create_time = entity.create_time; if (string.IsNullOrEmpty(id3)) { chronic_disease_PhysicalExerciseService.AddEntity(pe); } else { chronic_disease_PhysicalExerciseService.UpdateEntity(pe); } //-------------饮食习惯------------ //获取id string id4 = CommonFunc.SafeGetStringFromObj(chronic_disease_DailyLifeService.LoadEntityAsNoTracking(t => t.resident_id == entity.resident_id).Select(t => t.id).FirstOrDefault()); if (string.IsNullOrEmpty(id4)) { eh.id = Guid.NewGuid().ToString(); } else { eh.id = id4; } eh.name = Request["name"]; eh.sex = Request["sex"]; eh.id_card_number = Request["id_card_number"]; if (string.IsNullOrEmpty(Request["birth_date"])) { eh.birth_date = null; } else { eh.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); } //常住地址 eh.resident_id = entity.resident_id; eh.permanent_address = Request["perment_community_address"]; eh.post_code = Request["zipCode"]; eh.community_code = Request["ddlCommunity"]; eh.living_getup = Request["morning"]; eh.living_noonbreak = Request["noon"]; eh.living_sleep = Request["night"]; eh.diet_three_meals = Request["law"]; eh.diet_staple_food = Request["food"]; eh.diet_eating = Request["taste"]; eh.diet_eating_other = Request["taste_other"]; eh.diet_oil_salt = Request["oil_salt"]; eh.diet_oil_salt_other = Request["oil_salt_other"]; eh.diet_salt_amount = Request["salt_eat"]; eh.diet_oil_amount = Request["oil_eat"]; eh.diet_sugar_amount = Request["sugar_eat"]; eh.diet_drinkwater_morning = Request["water"]; eh.diet_drink_amount = Request["amount"]; eh.diet_drink_interval = Request["time"]; eh.diet_drinks = Request["drink"]; eh.diet_drinks_other = Request["other"]; eh.diet_fruits = Request["melon_fruit"]; eh.diet_vegetables = Request["vegetables"]; eh.diet_grain = Request["grain"]; eh.diet_grain_other = Request["other_grain"]; eh.diet_aquatic_products = Request["aquatic"]; eh.diet_aquatic_products_other = Request["other_aquatic"]; eh.diet_livestock_poultry_eggs = Request["meat"]; eh.diet_livestock_poultry_eggs_other = Request["other_meat"]; eh.diet_health_products = Request["health_products"]; eh.diet_health_products_other = Request["other_health_products"]; eh.diet_hobby = Request["other_diet"]; eh.diet_hobby_other = Request["other_diet_other"]; eh.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); eh.worker_user_name = worker; eh.create_time = entity.create_time; if (string.IsNullOrEmpty(id4)) { chronic_disease_DailyLifeService.AddEntity(eh); } else { chronic_disease_DailyLifeService.UpdateEntity(eh); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (comm_Adults_Health_Examination_NewService.AddEntity(entity)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.AdultsHealthExamination.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } else { msg = "提交失败"; } } else { if (comm_Adults_Health_Examination_NewService.UpdateEntity(entity)) { msg = "提交成功"; } else { msg = "提交失败"; } } return(Content(msg)); }
//提交 更新页面 public ActionResult AddAndUpdate() { string id = Request["id"]; string fill_community_code = Request["community_code"]; string worker = Request["worker"]; Chronic_disease_SmokeAndDrink entity = new Chronic_disease_SmokeAndDrink(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } entity.name = Request["name"]; entity.sex = Request["sex"]; entity.id_card_number = Request["id_card_number"]; entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); entity.permanent_address = Request["perment_community_address"]; entity.post_code = Request["zipCode"]; entity.community_code = Request["ddlCommunity"]; //-----吸烟---- entity.smoking = Request["smoking"]; if (!string.IsNullOrEmpty(Request["times1"])) { entity.smoking_begin_year = Request["times1"]; } else { entity.smoking_begin_year = ""; } entity.smoking_daily_amount = Request["day_smoke"]; if (!string.IsNullOrEmpty(Request["smoke_age"])) { entity.smoking_age = Request["smoke_age"].Split('年')[0]; } else { entity.smoking_age = ""; } if (!string.IsNullOrEmpty(Request["smoked"])) { entity.smoked = Request["smoked"]; } else { entity.smoked = ""; } if (!string.IsNullOrEmpty(Request["times2"])) { entity.smoked_begin_year = Request["times2"]; } else { entity.smoked_begin_year = ""; } if (!string.IsNullOrEmpty(Request["times3"])) { entity.smoked_smoking_again = Request["times3"]; } else { entity.smoked_smoking_again = ""; } if (!string.IsNullOrEmpty(Request["smoked_long"])) { entity.smoked_long_time = Request["smoked_long"].Split('年')[0]; } else { entity.smoked_long_time = ""; } entity.smoked_intent = Request["smoked_idea"]; entity.smoked_second_hand = Request["smoke_twice"]; entity.smoke_never = Request["smoke"]; //-----饮酒----- entity.drinking = Request["drinking"]; if (!string.IsNullOrEmpty(Request["times4"])) { entity.drinking_begin_year = Request["times4"]; } else { entity.drinking_begin_year = ""; } if (!string.IsNullOrEmpty(Request["drink_age"])) { entity.drinking_age = Request["drink_age"].Split('年')[0]; } else { entity.drinking_age = ""; } if (!string.IsNullOrEmpty(Request["times5"])) { entity.drunk_begin_year = Request["times5"]; } else { entity.drunk_begin_year = ""; } if (!string.IsNullOrEmpty(Request["times6"])) { entity.drunk_drinking_again = Request["times6"]; } else { entity.drunk_drinking_again = ""; } if (!string.IsNullOrEmpty(Request["drunk_long"])) { entity.drunk_long_time = Request["drunk_long"].Split('年')[0]; } else { entity.drunk_long_time = ""; } entity.drink_never = Request["drink"]; //-----饮酒频率----- entity.drinking_spirit_frequency = Request["frequency1"]; entity.drinking_beer_frequency = Request["frequency2"]; entity.drinking_red_frequency = Request["frequency3"]; entity.drinking_yellow_frequency = Request["frequency4"]; entity.drinking_other_wine1 = Request["other"]; entity.drinking_other_degree1 = Request["other_du"]; entity.drinking_other_frequency = Request["frequency5"]; entity.drinking_spirit_amount = Request["count1"]; entity.drinking_beer_amount = Request["count2"]; entity.drinking_red_amount = Request["count3"]; entity.drinking_yellow_amount = Request["count4"]; entity.drinking_other_wine2 = Request["other_wine"]; entity.drinking_other_degree2 = Request["wine_degree"]; entity.drinking_other_amount = Request["count5"]; entity.drinking_spirit_equivalent = Request["count1_dl"]; entity.drinking_beer_equivalent = Request["count2_dl"]; entity.drinking_red_equivalent = Request["count3_dl"]; entity.drinking_yellow_equivalent = Request["count4_dl"]; entity.drinking_other_equivalent = Request["count5_dl"]; entity.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); //entity.worker_user_name = Request["fillIdentity"]; entity.worker_user_name = worker; //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (diseaseSmokeAndDrinkService.AddEntity(entity)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.SmokeAndDrink.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } else { if (diseaseSmokeAndDrinkService.UpdateEntity(entity)) { msg = "修改成功"; } } return(Content(msg + ',' + entity.id)); }
//新增 更新 public ActionResult AddAndUpdate() { string id = CommonFunc.SafeGetStringFromObj(Request["id"]); string fill_community_code = CommonFunc.SafeGetStringFromObj(Request["community_code"]); string worker = CommonFunc.SafeGetStringFromObj(Request["worker"]); Chronic_disease_Comm_Lung entity = new Chronic_disease_Comm_Lung(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } entity.names = Request["name"]; entity.sex = Request["sex"]; entity.age = Request["age"]; entity.id_card_number = Request["id_card_number"]; string s = Request["id_card_number"]; string s1 = "", s2 = "", s3 = ""; if (s.Length == 15) { s1 = s.Substring(6, 2); s2 = s.Substring(8, 2); s3 = s.Substring(10, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj("19" + s1 + "-" + s2 + "-" + s3)); } else if (s.Length == 18) { s1 = s.Substring(6, 4); s2 = s.Substring(10, 2); s3 = s.Substring(12, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(s1 + "-" + s2 + "-" + s3)); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } entity.address = Request["perment_community_address"]; entity.phone = Request["phone"]; entity.inspect_doctor = Request["sjdoctor"]; entity.check_doctor = Request["jcdoctor"]; entity.report_doctor = Request["bgdoctor"]; entity.check_project = Request["s"]; if (string.IsNullOrEmpty(Request["sjtime"])) { entity.inspect_time = null; } else { entity.inspect_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["sjtime"])); } if (string.IsNullOrEmpty(Request["bgtime"])) { entity.report_time = null; } else { entity.report_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["bgtime"])); } System.Collections.Generic.List <Chronic_disease_Comm_LungAdd> subjectiveList = new System.Collections.Generic.List <Chronic_disease_Comm_LungAdd>(); entity.community_code = Request["ddlCommunity"]; entity.type = entity.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); entity.doctor = worker; if (Request["s"].Equals("通气功能检查")) { entity.name1 = Request["ts1"]; entity.name2 = Request["ts2"]; entity.name3 = Request["ts3"]; entity.name4 = Request["ts4"]; entity.name5 = Request["ts5"]; entity.result1 = Request["tresult1"]; entity.result2 = Request["tresult2"]; entity.result3 = Request["tresult3"]; entity.result4 = Request["tresult4"]; entity.result5 = Request["tresult5"]; entity.unit1 = Request["tunit1"]; entity.unit2 = Request["tunit2"]; entity.unit3 = Request["tunit3"]; entity.unit4 = Request["tunit4"]; entity.unit5 = Request["tunit5"]; entity.qujian1 = Request["tqujian1"]; entity.qujian2 = Request["tqujian2"]; entity.qujian3 = Request["tqujian3"]; entity.qujian4 = Request["tqujian4"]; entity.qujian5 = Request["tqujian5"]; entity.tishi1 = Request["ttishi1"]; entity.tishi2 = Request["ttishi2"]; entity.tishi3 = Request["ttishi3"]; entity.tishi4 = Request["ttishi4"]; entity.tishi5 = Request["ttishi5"]; entity.beizhu1 = Request["tbeizhu1"]; entity.beizhu2 = Request["tbeizhu2"]; entity.beizhu3 = Request["tbeizhu3"]; entity.beizhu4 = Request["tbeizhu4"]; entity.beizhu5 = Request["tbeizhu5"]; for (int i = 1; i < 9; i++) { if (Request.Form["ts_" + i] != "") { Chronic_disease_Comm_LungAdd entity1 = new Chronic_disease_Comm_LungAdd(); entity1.id = Guid.NewGuid().ToString(); entity1.add_id = entity.id; entity1.name = Request.Form["ts_" + i]; entity1.result = Request.Form["tresult_" + i]; entity1.unit = Request.Form["tunit_" + i]; entity1.qujian = Request.Form["tqujian_" + i]; entity1.tishi = Request.Form["ttishi_" + i]; entity1.beizhu = Request.Form["tbeizhu_" + i]; if (entity1.name != null) { subjectiveList.Add(entity1); } } } } else if (Request["s"].Equals("换气功能检查")) { entity.name1 = Request["hs1"]; entity.name2 = Request["hs2"]; entity.name3 = Request["hs3"]; entity.name4 = Request["hs4"]; entity.name5 = Request["hs5"]; entity.result1 = Request["hresult1"]; entity.result2 = Request["hresult2"]; entity.result3 = Request["hresult3"]; entity.result4 = Request["hresult4"]; entity.result5 = Request["hresult5"]; entity.unit1 = Request["hunit1"]; entity.unit2 = Request["hunit2"]; entity.unit3 = Request["hunit3"]; entity.unit4 = Request["hunit4"]; entity.unit5 = Request["hunit5"]; entity.qujian1 = Request["hqujian1"]; entity.qujian2 = Request["hqujian2"]; entity.qujian3 = Request["hqujian3"]; entity.qujian4 = Request["hqujian4"]; entity.qujian5 = Request["hqujian5"]; entity.tishi1 = Request["htishi1"]; entity.tishi2 = Request["htishi2"]; entity.tishi3 = Request["htishi3"]; entity.tishi4 = Request["htishi4"]; entity.tishi5 = Request["htishi5"]; entity.beizhu1 = Request["hbeizhu1"]; entity.beizhu2 = Request["hbeizhu2"]; entity.beizhu3 = Request["hbeizhu3"]; entity.beizhu4 = Request["hbeizhu4"]; entity.beizhu5 = Request["hbeizhu5"]; } else if (Request["s"].Equals("小气道功能检查")) { entity.name1 = Request["xq1"]; entity.name2 = Request["xq2"]; entity.name3 = Request["xq3"]; if (Request["xq1"].Equals("闭合容积(氮气法)") || Request["xq1"].Equals("最大呼气流量-容积曲线")) { //获取file HttpPostedFileBase file = Request.Files["jctx1"]; if (file != null) { string fileNames = Path.GetFileName(file.FileName); if (!string.IsNullOrEmpty(fileNames)) { string mapPath = Server.MapPath("~"); string path = "/UploadFiles/Lung/" + DateTime.Now.ToString("yyyyMM") + "/" + DateTime.Now.ToString("dd") + "/"; string savePath = mapPath + path; if (!System.IO.Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } file.SaveAs(savePath + fileNames); entity.image1 = path + fileNames + "," + Path.GetFullPath(file.FileName); } } } else if (Request["xq1"].Equals("频率依赖性肺顺应性")) { entity.result1 = Request["xqresult1"]; entity.result11 = Request["xqresult11"]; entity.unit1 = Request["xqunit1"]; entity.qujian1 = Request["xqqujian1"]; entity.tishi1 = Request["xqtishi1"]; entity.beizhu1 = Request["xqbeizhu1"]; } if (Request["xq2"].Equals("闭合容积(氮气法)") || Request["xq2"].Equals("最大呼气流量-容积曲线")) { //获取file HttpPostedFileBase file1 = Request.Files["jctx2"]; if (file1 != null) { string fileName1 = Path.GetFileName(file1.FileName); if (!string.IsNullOrEmpty(fileName1)) { string mapPath = Server.MapPath("~"); string path = "/UploadFiles/Lung/" + DateTime.Now.ToString("yyyyMM") + "/" + DateTime.Now.ToString("dd") + "/"; string savePath = mapPath + path; if (!System.IO.Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } file1.SaveAs(savePath + fileName1); entity.image2 = path + fileName1 + "," + Path.GetFullPath(file1.FileName); } } } else if (Request["xq2"].Equals("频率依赖性肺顺应性")) { entity.result2 = Request["xqresult2"]; entity.result22 = Request["xqresult22"]; entity.unit2 = Request["xqunit2"]; entity.qujian2 = Request["xqqujian2"]; entity.tishi2 = Request["xqtishi2"]; entity.beizhu2 = Request["xqbeizhu2"]; } if (Request["xq3"].Equals("闭合容积(氮气法)") || Request["xq3"].Equals("最大呼气流量-容积曲线")) { //获取file HttpPostedFileBase file2 = Request.Files["jctx3"]; if (file2 != null) { string fileName2 = Path.GetFileName(file2.FileName); if (!string.IsNullOrEmpty(fileName2)) { string mapPath = Server.MapPath("~"); string path = "/UploadFiles/Lung/" + DateTime.Now.ToString("yyyyMM") + "/" + DateTime.Now.ToString("dd") + "/"; string savePath = mapPath + path; if (!System.IO.Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } file2.SaveAs(savePath + fileName2); entity.image3 = path + fileName2 + "," + Path.GetFullPath(file2.FileName); } } } else if (Request["xq3"].Equals("频率依赖性肺顺应性")) { entity.result3 = Request["xqresult3"]; entity.result33 = Request["xqresult33"]; entity.unit3 = Request["xqunit3"]; entity.qujian3 = Request["xqqujian3"]; entity.tishi3 = Request["xqtishi3"]; entity.beizhu3 = Request["xqbeizhu3"]; } } else if (Request["s"].Equals("血气分析和酸碱测定")) { entity.name1 = Request["xs1"]; entity.name2 = Request["xs2"]; entity.name3 = Request["xs3"]; entity.name4 = Request["xs4"]; entity.name5 = Request["xs5"]; entity.result1 = Request["xresult1"]; entity.result2 = Request["xresult2"]; entity.result3 = Request["xresult3"]; entity.result4 = Request["xresult4"]; entity.result5 = Request["xresult5"]; entity.unit1 = Request["xunit1"]; entity.unit2 = Request["xunit2"]; entity.unit3 = Request["xunit3"]; entity.unit4 = Request["xunit4"]; entity.unit5 = Request["xunit5"]; entity.qujian1 = Request["xqujian1"]; entity.qujian2 = Request["xqujian2"]; entity.qujian3 = Request["xqujian3"]; entity.qujian4 = Request["xqujian4"]; entity.qujian5 = Request["xqujian5"]; entity.tishi1 = Request["xtishi1"]; entity.tishi2 = Request["xtishi2"]; entity.tishi3 = Request["xtishi3"]; entity.tishi4 = Request["xtishi4"]; entity.tishi5 = Request["xtishi5"]; entity.beizhu1 = Request["xbeizhu1"]; entity.beizhu2 = Request["xbeizhu2"]; entity.beizhu3 = Request["xbeizhu3"]; entity.beizhu4 = Request["xbeizhu4"]; entity.beizhu5 = Request["xbeizhu5"]; for (int i = 1; i < 10; i++) { if (Request["xs_" + i] != "") { Chronic_disease_Comm_LungAdd entity1 = new Chronic_disease_Comm_LungAdd(); entity1.id = Guid.NewGuid().ToString(); entity1.add_id = entity.id; entity1.name = Request["xs_" + i]; entity1.result = Request["xresult_" + i]; entity1.unit = Request["xunit_" + i]; entity1.qujian = Request["xqujian_" + i]; entity1.tishi = Request["xtishi_" + i]; entity1.beizhu = Request["xbeizhu_" + i]; if (entity1.name != null) { subjectiveList.Add(entity1); } } } } //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (disease_Comm_LungService.AddEntity(entity) && disease_Comm_LungAddService.UpdateSubjective(subjectiveList, entity.id)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.Lung.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } else { if (disease_Comm_LungService.UpdateEntity(entity) && disease_Comm_LungAddService.UpdateSubjective(subjectiveList, entity.id)) { msg = "修改成功"; } } return(Content(msg + ',' + entity.id)); }
//提交 更新页面 public ActionResult AddAndUpdate() { string id = Request["id"]; string fill_community_code = Request["community_code"]; string worker = Request["worker"]; Chronic_disease_DailyLife entity = new Chronic_disease_DailyLife(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } entity.name = Request["name"]; entity.sex = Request["sex"]; entity.id_card_number = Request["id_card_number"]; entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); entity.permanent_address = Request["perment_community_address"]; entity.post_code = Request["zipCode"]; entity.community_code = Request["ddlCommunity"]; entity.living_getup = Request["morning"]; entity.living_noonbreak = Request["noon"]; entity.living_sleep = Request["night"]; entity.diet_three_meals = Request["law"]; entity.diet_staple_food = Request["food"]; entity.diet_eating = Request["taste"]; entity.diet_eating_other = Request["taste_other"]; entity.diet_oil_salt = Request["oil_salt"]; entity.diet_oil_salt_other = Request["oil_salt_other"]; entity.diet_salt_amount = Request["salt_eat"]; entity.diet_oil_amount = Request["oil_eat"]; entity.diet_sugar_amount = Request["sugar_eat"]; entity.diet_drinkwater_morning = Request["water"]; entity.diet_drink_amount = Request["amount"]; entity.diet_drink_interval = Request["time"]; entity.diet_drinks = Request["drink"]; entity.diet_drinks_other = Request["other"]; entity.diet_fruits = Request["melon_fruit"]; entity.diet_vegetables = Request["vegetables"]; entity.diet_grain = Request["grain"]; entity.diet_grain_other = Request["other_grain"]; entity.diet_aquatic_products = Request["aquatic"]; entity.diet_aquatic_products_other = Request["other_aquatic"]; entity.diet_livestock_poultry_eggs = Request["meat"]; entity.diet_livestock_poultry_eggs_other = Request["other_meat"]; entity.diet_health_products = Request["health_products"]; entity.diet_health_products_other = Request["other_health_products"]; entity.diet_hobby = Request["other_diet"]; entity.diet_hobby_other = Request["other_diet_other"]; entity.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); entity.worker_user_name = worker; //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (diseaseDailyLifeService.AddEntity(entity)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.EHabits.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } else { if (diseaseDailyLifeService.UpdateEntity(entity)) { msg = "修改成功"; } } return(Content(msg + ',' + entity.id)); }
//提交 public ActionResult Sure() { string id = Request["id"]; string fill_community_code = Request["community_code"]; string worker = Request["worker"]; Chronic_disease_Hospitalization_ConsultationRecord entity = new Chronic_disease_Hospitalization_ConsultationRecord(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); entity.sign = "1"; } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); entity.sign = "1"; } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } entity.name = Request["name"]; entity.sex = Request["sex"]; entity.id_card_number = Request["id_card_number"]; entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); entity.hospitalization_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["data"])); entity.hospitalization_number = Request["number"]; entity.hospital = Request["hospital"]; entity.department = Request["department"]; entity.bed_number = Request["bed_number"]; entity.time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["rq"])); entity.context = Request["context"]; entity.community_code = Request["ddlCommunity"]; entity.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); entity.worker_user_name = worker; entity.sign = "1"; //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (disease_Hospitalization_ConsultationRecordService.AddEntity(entity)) { msg = "提交成功"; } else { msg = "提交失败"; } } else { if (disease_Hospitalization_ConsultationRecordService.UpdateEntity(entity)) { msg = "提交成功"; } } return(Content(msg + ',' + entity.id)); }
//新增或修改 public ActionResult AddAndUpdate() { string id = CommonFunc.SafeGetStringFromObj(Request["id"]); string fill_community_code = CommonFunc.SafeGetStringFromObj(Request["community_code"]); string worker = CommonFunc.SafeGetStringFromObj(Request["worker"]); string real_name = CommonFunc.SafeGetStringFromObj(Request["real_name"]); MT_BC_21Genes entity = new MT_BC_21Genes(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } entity.name = Request["name"]; entity.sex = Request["sex"]; entity.age = Request["age"]; entity.id_card_number = Request["id_card_number"]; string s = Request["id_card_number"]; string s1 = "", s2 = "", s3 = ""; if (s.Length == 15) { s1 = s.Substring(6, 2); s2 = s.Substring(8, 2); s3 = s.Substring(10, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj("19" + s1 + "-" + s2 + "-" + s3)); } else if (s.Length == 18) { s1 = s.Substring(6, 4); s2 = s.Substring(10, 2); s3 = s.Substring(12, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(s1 + "-" + s2 + "-" + s3)); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } if (string.IsNullOrEmpty(Request["birth_date"])) { entity.birth_date = null; } else { entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); } entity.community_code = Request["ddlCommunity"]; entity.address = Request["perment_community_address"]; entity.phone = Request["txtIndividualPhone"]; entity.worker_user_name = worker; entity.worker_user_realname = real_name; //------------------------------------特有字段赋值------------------------------------------------------- entity.Ki67 = Request["Ki67"]; entity.STK15 = Request["STK15"]; entity.Survivin = Request["Survivin"]; entity.CyclinB1 = Request["CyclinB1"]; entity.MYBL2 = Request["MYBL2"]; entity.Stromolysin = Request["Stromolysin"]; entity.Cathepsin = Request["Cathepsin"]; entity.GBR7 = Request["GBR7"]; entity.HER2 = Request["HER2"]; entity.ER = Request["ER"]; entity.PR = Request["PR"]; entity.BCL = Request["BCL"]; entity.SCUBE = Request["SCUBE"]; entity.GSTM1 = Request["GSTM1"]; entity.CD68 = Request["CD68"]; entity.BAG1 = Request["BAG1"]; entity.actin = Request["actin"]; entity.RPLPO = Request["RPLPO"]; entity.GUS = Request["GUS"]; entity.TFRC = Request["TFRC"]; entity.GAPDH = Request["GAPDH"]; entity.RS = Request["RS"]; entity.advice = Request["advice"]; entity.doctor = Request["doctor"]; entity.checkdate = CommonFunc.SafeGetDateTimeFromObj(Request["checkdate"]); //判断个人信息表中是否存在此人信息 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["txtIndividualPhone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { //根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "birth_date", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (mT_BC_21GenesService.AddEntity(entity)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.Genes.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } else { if (mT_BC_21GenesService.UpdateEntity(entity)) { msg = "修改成功"; } else { msg = "修改失败"; } } return(Content(msg + "," + entity.id)); }
//新增 更新 public ActionResult AddAndUpdate() { string id = CommonFunc.SafeGetStringFromObj(Request["id"]); string fill_community_code = CommonFunc.SafeGetStringFromObj(Request["community_code"]); string worker = CommonFunc.SafeGetStringFromObj(Request["worker"]); Chronic_disease_Supplementary_Examination_Heart entity = new Chronic_disease_Supplementary_Examination_Heart(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } entity.name = Request["name"]; entity.sex = Request["sex"]; entity.age = Request["age"]; entity.id_card_number = Request["id_card_number"]; string s = Request["id_card_number"]; string s1 = "", s2 = "", s3 = ""; if (s.Length == 15) { s1 = s.Substring(6, 2); s2 = s.Substring(8, 2); s3 = s.Substring(10, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj("19" + s1 + "-" + s2 + "-" + s3)); } else if (s.Length == 18) { s1 = s.Substring(6, 4); s2 = s.Substring(10, 2); s3 = s.Substring(12, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(s1 + "-" + s2 + "-" + s3)); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } entity.address = Request["perment_community_address"]; entity.phone = Request["phone"]; entity.inspect_doctor = Request["inspect_doctor"]; entity.check_doctor = Request["check_doctor"]; entity.report_doctor = Request["report_doctor"]; entity.record = Request["lead"]; entity.check_position = Request["position"]; entity.xinjie_rhythm = Request["cardiac"]; entity.xinfang_rhythm = Request["atrial"]; entity.xinshi_rhythm = Request["ventricular"]; entity.xindianzhou = Request["axis"]; entity.p_r = Request["pr_interval"]; entity.qrs_limit = Request["qrs_time_limit"]; entity.q_t = Request["qt_interval"]; entity.limit = Request["limit"]; entity.p = Request["p"]; entity.qrs = Request["qrs"]; entity.st = Request["st"]; entity.t = Request["t"]; entity.suggest = Request["suggest"]; if (string.IsNullOrEmpty(Request["sjtime"])) { entity.inspect_time = null; } else { entity.inspect_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["sjtime"])); } if (string.IsNullOrEmpty(Request["bgtime"])) { entity.report_time = null; } else { entity.report_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["bgtime"])); } entity.check_position = Request["position"]; entity.doctor = worker; entity.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); entity.community_code = Request["ddlCommunity"]; //获取file HttpPostedFileBase file1 = Request.Files["jctx1"]; if (file1 != null) { string fileName1 = Path.GetFileName(file1.FileName); if (!string.IsNullOrEmpty(fileName1)) { string mapPath = Server.MapPath("~"); string path = "/UploadFiles/Heart/" + DateTime.Now.ToString("yyyyMM") + "/" + DateTime.Now.ToString("dd") + "/"; string savePath = mapPath + path; if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } file1.SaveAs(savePath + fileName1); entity.check_img1 = path + fileName1 + "," + Path.GetFullPath(file1.FileName); } else { entity.check_img1 = ""; } } else { entity.check_img1 = ""; } HttpPostedFileBase file2 = Request.Files["jctx2"]; if (file2 != null) { string fileName2 = Path.GetFileName(file2.FileName); if (!string.IsNullOrEmpty(fileName2)) { string mapPath = Server.MapPath("~"); string path = "/UploadFiles/Heart/" + DateTime.Now.ToString("yyyyMM") + "/" + DateTime.Now.ToString("dd") + "/"; string savePath = mapPath + path; if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } file2.SaveAs(savePath + fileName2); entity.check_img2 = path + fileName2 + "," + Path.GetFullPath(file2.FileName); } else { entity.check_img2 = ""; } } else { entity.check_img2 = ""; } HttpPostedFileBase file3 = Request.Files["jctx3"]; if (file3 != null) { string fileName3 = Path.GetFileName(file3.FileName); if (!string.IsNullOrEmpty(fileName3)) { string mapPath = Server.MapPath("~"); string path = "/UploadFiles/Heart/" + DateTime.Now.ToString("yyyyMM") + "/" + DateTime.Now.ToString("dd") + "/"; string savePath = mapPath + path; if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } file3.SaveAs(savePath + fileName3); entity.check_img3 = path + fileName3 + "," + Path.GetFullPath(file3.FileName); } else { entity.check_img3 = ""; } } else { entity.check_img3 = ""; } HttpPostedFileBase file4 = Request.Files["jctx4"]; if (file4 != null) { string fileName4 = Path.GetFileName(file4.FileName); if (!string.IsNullOrEmpty(fileName4)) { string mapPath = Server.MapPath("~"); string path = "/UploadFiles/Heart/" + DateTime.Now.ToString("yyyyMM") + "/" + DateTime.Now.ToString("dd") + "/"; string savePath = mapPath + path; if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } file4.SaveAs(savePath + fileName4); entity.check_img4 = path + fileName4 + "," + Path.GetFullPath(file4.FileName); } else { entity.check_img4 = ""; } } else { entity.check_img4 = ""; } //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (disease_Supplementary_Examination_HeartService.AddEntity(entity)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.Heart.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } else { if (disease_Supplementary_Examination_HeartService.UpdateEntity(entity)) { msg = "修改成功"; } } return(Content(msg + ',' + entity.id)); }
//新增或修改 public ActionResult AddAndUpdate() { string id = CommonFunc.SafeGetStringFromObj(Request["id"]); string fill_community_code = CommonFunc.SafeGetStringFromObj(Request["community_code"]); string worker = CommonFunc.SafeGetStringFromObj(Request["worker"]); string real_name = CommonFunc.SafeGetStringFromObj(Request["real_name"]); MT_BC_PathologicalDiagnosis entity = new MT_BC_PathologicalDiagnosis(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } entity.name = Request["name"]; entity.sex = Request["sex"]; entity.age = Request["age"]; entity.id_card_number = Request["id_card_number"]; string s = Request["id_card_number"]; string s1 = "", s2 = "", s3 = ""; if (s.Length == 15) { s1 = s.Substring(6, 2); s2 = s.Substring(8, 2); s3 = s.Substring(10, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj("19" + s1 + "-" + s2 + "-" + s3)); } else if (s.Length == 18) { s1 = s.Substring(6, 4); s2 = s.Substring(10, 2); s3 = s.Substring(12, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(s1 + "-" + s2 + "-" + s3)); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } if (string.IsNullOrEmpty(Request["birth_date"])) { entity.birth_date = null; } else { entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); } entity.community_code = Request["ddlCommunity"]; entity.address = Request["perment_community_address"]; entity.phone = Request["txtIndividualPhone"]; entity.worker_user_name = worker; entity.worker_user_realname = real_name; //------------------------------------特有字段赋值------------------------------------------------------- if (string.IsNullOrEmpty(Request["sjrq"])) { entity.sjrq = null; } else { entity.sjrq = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["sjrq"])); } entity.sjys = Request["sjys"]; entity.sjcl = Request["sjcl"]; entity.lczd = Request["lczd"]; entity.rysj = Request["rysj"]; entity.blzd = Request["blzd"]; entity.jl = Request["jl"]; entity.bgys = Request["bgys"]; entity.shys = Request["shys"]; entity.bgri = CommonFunc.SafeGetDateTimeFromObj(Request["bgri"]); //保存图像 //HttpPostedFileBase pics = Request.Files["gjsj"]; HttpFileCollection pics = System.Web.HttpContext.Current.Request.Files; if (pics.Count > 0) { string savePath = Server.MapPath("~/UploadFiles/PathologicalDiagnosis/" + DateTime.Now.ToString("yyyyMM") + "/" + DateTime.Now.ToString("dd") + "/"); if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } //StringBuilder picsPath=new StringBuilder(); string picsPath = ""; for (int i = 0; i < pics.Count; i++) { string picPath = Path.Combine(savePath, Path.GetFileName(pics[i].FileName)); pics[i].SaveAs(picPath); picsPath += picPath + ","; } entity.pic_path = picsPath; } else { entity.pic_path = Request["pic_path"]; } //判断个人信息表中是否存在此人信息 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["txtIndividualPhone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { //根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "birth_date", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (mT_BC_PathologicalDiagnosisService.AddEntity(entity)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.Ultrasonography.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } else { if (mT_BC_PathologicalDiagnosisService.UpdateEntity(entity)) { msg = "修改成功"; } else { msg = "修改失败"; } } return(Content(msg + "," + entity.id)); }
public ActionResult AddAndUpdate() { string id = CommonFunc.SafeGetStringFromObj(Request["id"]); string fill_community_code = CommonFunc.SafeGetStringFromObj(Request["community_code"]); string worker = CommonFunc.SafeGetStringFromObj(Request["worker"]); string real_name = CommonFunc.SafeGetStringFromObj(Request["real_name"]); MT_BC_ClinicalExamination entity = new MT_BC_ClinicalExamination(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } entity.name = Request["name"]; entity.sex = Request["sex"]; entity.age = Request["age"]; entity.id_card_number = Request["id_card_number"]; string s = Request["id_card_number"]; string s1 = "", s2 = "", s3 = ""; if (s.Length == 15) { s1 = s.Substring(6, 2); s2 = s.Substring(8, 2); s3 = s.Substring(10, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj("19" + s1 + "-" + s2 + "-" + s3)); } else if (s.Length == 18) { s1 = s.Substring(6, 4); s2 = s.Substring(10, 2); s3 = s.Substring(12, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(s1 + "-" + s2 + "-" + s3)); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } if (string.IsNullOrEmpty(Request["birth_date"])) { entity.birth_date = null; } else { entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"])); } entity.community_code = Request["ddlCommunity"]; entity.address = Request["perment_community_address"]; entity.phone = Request["txtIndividualPhone"]; entity.worker_user_name = worker; entity.worker_user_realname = real_name; //------------------------------------特有字段赋值------------------------------------------------------- entity.tumorsizeleft = Request["tumorsizeleft"]; entity.tumorsizeright = Request["tumorsizeright"]; entity.tumorpositionleft = Request["tumorpositionleft"]; entity.tumorpositionright = Request["tumorpositionright"]; entity.tumorshapeleft = Request["tumorshapeleft"]; entity.tumorshaperight = Request["tumorshaperight"]; entity.tumorqualityleft = Request["tumorqualityleft"]; entity.tumorqualityright = Request["tumorqualityright"]; entity.tumorborderleft = Request["tumorborderleft"]; entity.tumorborderright = Request["tumorborderright"]; entity.tumoractivityleft = Request["tumoractivityleft"]; entity.tumoractivityright = Request["tumoractivityright"]; entity.dischargeleft = Request["dischargeleft"]; entity.dischargeright = Request["dischargeright"]; entity.papillaleft = Request["papillaleft"]; entity.papillaright = Request["papillaright"]; entity.skinleft = Request["skinleft"]; entity.skinright = Request["skinright"]; entity.ylymphleft = Request["ylymphleft"]; entity.ylymphright = Request["ylymphright"]; entity.sglymphleft = Request["sglymphleft"]; entity.sglymphright = Request["sglymphright"]; entity.isre_examine = Request["isre_examine"]; entity.firstresult = Request["firstresult"]; entity.comment = Request["comment"]; entity.doctor = Request["doctor"]; entity.checkdate = CommonFunc.SafeGetDateTimeFromObj(Request["checkdate"]); //判断个人信息表中是否存在此人信息 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["txtIndividualPhone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { //根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "birth_date", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (mT_BC_ClinicalExaminationService.AddEntity(entity)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.ClinicalExamination.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } else { if (mT_BC_ClinicalExaminationService.UpdateEntity(entity)) { msg = "修改成功"; } else { msg = "修改失败"; } } return(Content(msg + "," + entity.id)); }
//新增 更新 public ActionResult AddAndUpdate() { string id = CommonFunc.SafeGetStringFromObj(Request["id"]); string fill_community_code = CommonFunc.SafeGetStringFromObj(Request["community_code"]); string worker = CommonFunc.SafeGetStringFromObj(Request["worker"]); Chronic_disease_Comm_Testing_Faeces entity = new Chronic_disease_Comm_Testing_Faeces(); if (string.IsNullOrEmpty(id)) { entity.id = Guid.NewGuid().ToString(); entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } else { entity.id = id; entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); } entity.names = Request["name"]; entity.sex = Request["sex"]; entity.age = Request["age"]; entity.id_card_number = Request["id_card_number"]; string s = Request["id_card_number"]; string s1 = "", s2 = "", s3 = ""; if (s.Length == 15) { s1 = s.Substring(6, 2); s2 = s.Substring(8, 2); s3 = s.Substring(10, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj("19" + s1 + "-" + s2 + "-" + s3)); } else if (s.Length == 18) { s1 = s.Substring(6, 4); s2 = s.Substring(10, 2); s3 = s.Substring(12, 2); entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(s1 + "-" + s2 + "-" + s3)); } //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号 string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]); string ddlCommunity = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); string residentId = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault()); if (string.IsNullOrEmpty(residentId)) { entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity); } else { entity.resident_id = residentId; } entity.address = Request["perment_community_address"]; entity.phone = Request["phone"]; entity.samplenumber = Request["numb"]; entity.community_code = Request["ddlCommunity"]; entity.inspect_doctor = Request["sjdoctor"]; entity.check_doctor = Request["jcdoctor"]; entity.report_doctor = Request["bgdoctor"]; if (string.IsNullOrEmpty(Request["sjtime"])) { entity.inspect_time = null; } else { entity.inspect_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["sjtime"])); } if (string.IsNullOrEmpty(Request["bgtime"])) { entity.report_time = null; } else { entity.report_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["bgtime"])); } entity.name1 = Request["project1"]; entity.name2 = Request["project2"]; entity.name3 = Request["project3"]; entity.name4 = Request["project4"]; entity.name5 = Request["project5"]; entity.name6 = Request["project6"]; entity.name7 = Request["project7"]; entity.name8 = Request["project8"]; entity.name9 = Request["project9"]; entity.result1 = Request["Select1"]; entity.result2 = Request["Select2"]; entity.result3 = Request["Select3"]; entity.result4 = Request["Select4"]; entity.result5 = Request["Select5"]; entity.result6 = Request["Select6"]; entity.result7 = Request["Select7"]; entity.result8 = Request["Select8"]; entity.result9 = Request["Select9"]; entity.unit1 = Request["Text1"]; entity.unit2 = Request["Text5"]; entity.unit3 = Request["Text9"]; entity.unit4 = Request["Text13"]; entity.unit5 = Request["Text17"]; entity.unit6 = Request["Text21"]; entity.unit7 = Request["Text25"]; entity.unit8 = Request["Text29"]; entity.unit9 = Request["Text33"]; entity.qujian1 = Request["Text2"]; entity.qujian2 = Request["Text6"]; entity.qujian3 = Request["Text10"]; entity.qujian4 = Request["Text14"]; entity.qujian5 = Request["Text18"]; entity.qujian6 = Request["Text22"]; entity.qujian7 = Request["Text26"]; entity.qujian8 = Request["Text30"]; entity.qujian9 = Request["Text34"]; entity.tishi1 = Request["Text3"]; entity.tishi2 = Request["Text7"]; entity.tishi3 = Request["Text11"]; entity.tishi4 = Request["Text15"]; entity.tishi5 = Request["Text19"]; entity.tishi6 = Request["Text23"]; entity.tishi7 = Request["Text27"]; entity.tishi8 = Request["Text31"]; entity.tishi9 = Request["Text35"]; entity.beizhu1 = Request["Text4"]; entity.beizhu2 = Request["Text8"]; entity.beizhu3 = Request["Text12"]; entity.beizhu4 = Request["Text16"]; entity.beizhu5 = Request["Text20"]; entity.beizhu6 = Request["Text24"]; entity.beizhu7 = Request["Text28"]; entity.beizhu8 = Request["Text32"]; entity.beizhu9 = Request["Text36"]; entity.doctor = worker; entity.type = Enum.GetName(typeof(Model.Enum.EntityTypeEnum), 1); //判断个人信息表中是否存在此人信息 2015-06-18 娄帅 var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number); Comm_ResidentFile resident = new Comm_ResidentFile(); resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault()); resident.resident_id = entity.resident_id; resident.resident_name = Request["name"]; resident.sex = Request["sex"]; resident.id_card_number = Request["id_card_number"]; resident.birth_date = entity.birth_date; resident.community_code = Request["ddlCommunity"]; resident.individual_phone = Request["phone"]; resident.permanent_home_address = Request["perment_community_address"]; resident.nationality_name = "中国"; resident.nationality_code = "156"; if (dt.Count() < 1) { resident.id = Guid.NewGuid().ToString(); resident.community_code = Request["ddlCommunity"]; if (entity.create_time == null) { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd")); } else { resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time); } resident.worker_user_name = worker; residentFileService.AddEntity(resident); // 添加摘要 Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract(); ehr1.id = Guid.NewGuid().ToString(); ehr1.resident_id = entity.resident_id; ehr1.community_code = entity.community_code; ehr1.create_time = DateTime.Now; ehr1.item_id = resident.id; ehr1.item_type = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString(); eHRAbstractService.AddEntity(ehr1); } else { /** 根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中 */ string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault()); if (Request["ddlCommunity"] != code) { Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address(); address.id = Guid.NewGuid().ToString(); address.contact_id = entity.id; address.resident_id = entity.resident_id; address.community_code = code; address.fill_community_code = fill_community_code; address.fill_person = worker; address.permanent_address = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault()); address.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd"))); residentFileChangeAddressService.AddEntity(address); } //resident.id = dt.Select(t=>t.id).ToString(); string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "community_code", "individual_phone", "permanent_home_address" }; residentFileService.UpdatePartialPropertity(resident, propertyName); } string msg = ""; if (string.IsNullOrEmpty(id)) { if (disease_Comm_Testing_FaecesService.AddEntity(entity)) { Comm_EHR_Abstract ehr = new Comm_EHR_Abstract(); ehr.id = Guid.NewGuid().ToString(); ehr.resident_id = entity.resident_id; ehr.community_code = entity.community_code; ehr.create_time = DateTime.Now; ehr.item_id = entity.id; ehr.item_type = Model.Enum.EHRAbstractTypeEnum.Faeces.ToString(); if (eHRAbstractService.AddEntity(ehr)) { msg = "提交成功"; } else { msg = "提交失败"; } } } else { if (disease_Comm_Testing_FaecesService.UpdateEntity(entity)) { msg = "修改成功"; } } return(Content(msg + ',' + entity.id)); }