public ActionResult ModuleProfileEdit(BasicProfileViewModel model, FormCollection formCollection) { string UserId = model.Patient.UserId; var user = Session["CurrentUser"] as UserAndRole; string DoctorId = user.UserId; //加载患者基本信息 model.Patient = GetPatientBasicInfo(UserId); //加载患者详细信息 //GetPatientInfoDetail(ref model); #region 从病人详细信息表中加载 DataSet ItemInfoBoughtds = _ServicesSoapClient.GetPatBasicInfoDtlList(UserId); List<List<PatientDetailInfo>> ItemInfoBought = new List<List<PatientDetailInfo>>(); bool flag = false; string Patient = UserId; string CategoryCode = ""; string ItemCode = ""; int ItemSeq = 1; string Value = ""; string Content = ""; string ControlType = ""; int SortNo = 1; if (ItemInfoBoughtds.Tables.Count > 0) { foreach (DataTable datatable in ItemInfoBoughtds.Tables) { if ((datatable.Rows[0][3].ToString() == "Doctor") && (datatable.Rows[0][7].ToString() == DoctorId)) { int DeleteFlag = 0; CategoryCode = datatable.Rows[0][1].ToString(); while (DeleteFlag == 0) { DeleteFlag = _ServicesSoapClient.DeleteModuleDetail(Patient, CategoryCode); } foreach (DataRow row in datatable.Rows) { if ((row[3].ToString() != "InvalidFlag") && (row[3].ToString() != "Doctor") && (row[4].ToString() != "伴随疾病")) { //PatientDetailInfo item = new PatientDetailInfo //PatientId = row[0].ToString(), CategoryCode = row[1].ToString(); //CategoryName = row[2].ToString(), ItemCode = row[3].ToString(); ItemSeq = Convert.ToInt32(row[10]); //Description = row[9].ToString(); Content = row[9].ToString(); SortNo = Convert.ToInt32(row[10]); ControlType = row[11].ToString(); Value = Request.Form[row[3].ToString()]; //只更改了Value if (ControlType != "7") { flag = _ServicesSoapClient.SetPatBasicInfoDetail(Patient, CategoryCode, ItemCode, ItemSeq, Value, Content, SortNo, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); } } } } } } #endregion //flag为TRUE即全部插成功 if (flag == true) { return RedirectToAction("ModuleProfile", "DoctorHome", new { PatientId = UserId }); //成功跳转至详细 } else { Response.Write("<script>alert('数据保存失败');</script>"); //失败返回编辑,提示失败 return RedirectToAction("ModuleProfileEdit", "DoctorHome", new { UserId = UserId }); } }
public ActionResult ModuleProfile(BasicProfileViewModel model, FormCollection formCollection) { if (ModelState.IsValid) { var user = Session["CurrentUser"] as UserAndRole; string DoctorId = user.UserId; //string DoctorName = user.UserName; //操作标识符 页面所有操作只做一次判断 bool flag = true; string UserId = model.Patient.UserId; string UserName = model.Patient.UserName; string CategoryCode = ""; DataSet ItemInfoSet = new DataSet(); CategoryCode = Request.Form["ModuleDetailList[0].CategoryCode"]; List<PatientDetailInfo> ItemInfo = new List<PatientDetailInfo>(); if (CategoryCode != null) { ItemInfoSet = _ServicesSoapClient.GetItemInfoByPIdAndModule(UserId, CategoryCode); foreach (DataTable Item in ItemInfoSet.Tables) { foreach (DataRow Row in Item.Rows) { if (Row[3].ToString() != "InvalidFlag" && Row[3].ToString() != "Patient" && Row[3].ToString() != "Doctor") { PatientDetailInfo NewLine = new PatientDetailInfo { ItemCode = Row[3].ToString(), OptionCategory = Row[12].ToString() }; ItemInfo.Add(NewLine); } } } } List<ModuleInfo> ModuleInfo = new List<Models.ModuleInfo>(); DataSet ModulesInfo = new DataSet(); if (user.Role == "Doctor") { ModulesInfo = _ServicesSoapClient.GetModulesBoughtByPId(UserId); foreach (DataTable item in ModulesInfo.Tables) { foreach (DataRow row in item.Rows) { ModuleInfo NewLine = new Models.ModuleInfo(); NewLine.Category = row[0].ToString(); NewLine.ModuleName = row[1].ToString(); ModuleInfo.Add(NewLine); } } } else { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://121.43.107.106:9000/"); HttpResponseMessage response = client.GetAsync("Api/v1/Users/HModulesByID?PatientId=" + UserId + "&DoctorId=" + DoctorId).Result; if (response.IsSuccessStatusCode) { if (response.Content.ReadAsStringAsync().Result != "[]") { string[] Modules = response.Content.ReadAsStringAsync().Result.Split(new string[] { "},{", "[{\"", "\"}]" }, StringSplitOptions.RemoveEmptyEntries); foreach (string Module in Modules) { string[] Detail = Module.Split(new string[] { "\",\"", "\":\"" }, StringSplitOptions.RemoveEmptyEntries); ModuleInfo NewLine = new Models.ModuleInfo(); NewLine.Category = Detail[1].Substring(1); NewLine.ModuleName = Detail[3]; ModuleInfo.Add(NewLine); } } } } model.ModuleBoughtInfo = ModuleInfo; ModuleInfo = new List<Models.ModuleInfo>(); if (user.Role == "Doctor") { ModulesInfo = _ServicesSoapClient.GetModulesUnBoughtByPId(UserId); } else { ModulesInfo = _ServicesSoapClient.GetModuleList(); } DataSet DoctorModule = _ServicesSoapClient.GetDoctorModuleList(DoctorId); List<string> DoctorModules = new List<string>(); foreach (DataRow item in DoctorModule.Tables[0].Rows) { DoctorModules.Add(item[0].ToString()); } foreach (DataTable item in ModulesInfo.Tables) { foreach (DataRow row in item.Rows) { if ((user.Role == "Doctor" && DoctorModules.IndexOf(row[0].ToString()) != -1) || (user.Role == "HealthCoach" && row[0].ToString() != "M4" && row[0].ToString() != "M5" && model.ModuleBoughtInfo.Find(delegate(ModuleInfo x) { return x.Category == row[0].ToString(); }) == null)) { ModuleInfo NewLine = new Models.ModuleInfo(); NewLine.Category = row[0].ToString(); NewLine.ModuleName = row[1].ToString(); ModuleInfo.Add(NewLine); } } } model.ModuleUnBoughtInfo = ModuleInfo; //#region 从病人详细信息表中加载模块关注信息 //DataSet ItemInfoBoughtds = _ServicesSoapClient.GetPatBasicInfoDtlList(UserId); //List<List<PatientDetailInfo>> ItemInfoBought = new List<List<PatientDetailInfo>>(); //ArrayList modulesBoughtCode = new ArrayList(); //ArrayList modulesBoughtName = new ArrayList(); //if (ItemInfoBoughtds != null) //{ // foreach (DataTable datatable in ItemInfoBoughtds.Tables) // { // List<PatientDetailInfo> items = new List<PatientDetailInfo>(); // foreach (DataRow row in datatable.Rows) // { // if (row[3].ToString() != "InvalidFlag") // { // PatientDetailInfo item = new PatientDetailInfo // { // //PatientId = row[0].ToString(), // CategoryCode = row[1].ToString(), // CategoryName = row[2].ToString(), // ItemCode = row[3].ToString(), // ItemName = row[4].ToString(), // ParentCode = row[5].ToString(), // //ControlType = row[11].ToString(), // // OptionCategory = row[12].ToString(), // //OptionSelected = row[0].ToString(), // //OptionList = row[0], // //ItemSeq = Convert.ToInt32(row[6]), // Value = row[7].ToString(), // Content = row[8].ToString(), // //Description = row[9].ToString() // }; // items.Add(item); // } // } // modulesBoughtCode.Add(items[0].CategoryCode); // modulesBoughtName.Add(items[0].CategoryName); // ItemInfoBought.Add(items); // } //} //model.PatientDetailInfo = ItemInfoBought; //#endregion //#region 从字典表中加载模块信息 ////修改:只加载医生负责的模块&患者购买的模块 ////DataTable Moduledt = _ServicesSoapClient.GetModuleList().Tables[0]; //DataTable Moduledt = _ServicesSoapClient.GetDoctorModuleList(DoctorId).Tables[0]; ////ArrayList moduleUnBought = new ArrayList(); //int indicator = 0; //foreach (DataRow dr in Moduledt.Rows) //{ // //string dictCode = dr["Code"].ToString(); // //string dictName = dr["Name"].ToString(); // string dictCode = dr["CategoryCode"].ToString(); // string dictName = dr["CategoryName"].ToString(); // foreach (string modulesBt in modulesBoughtCode) // { // if (modulesBt == dictCode) // { // indicator = 1; //已购买 // break; // } // } // if (indicator == 0) //未购买 // { // //mubt.CategoryCode = dictCode; // //mubt.CategoryName = dictName; // //model.moduleUnBought.Add(mubt); // model.moduleUnBoughtCode.Add(dictCode); // model.moduleUnBoughtName.Add(dictName); // //indicator = 1; // } // else // { // indicator = 0; // } //} ////string code = ""; //DataTable dt = new DataTable(); ////ArrayList selectedModule = new ArrayList(); ////ViewBag.SelectedModule = selectedModule; ////foreach (DataRow dr in Moduledt.Rows) //foreach (string mubt in model.moduleUnBoughtCode) //{ // List<InfoItem> list = new List<InfoItem>(); // //code = mubt.CategoryCode; // dt = _ServicesSoapClient.GetMstInfoItemByCategoryCode(mubt).Tables[0]; // foreach (DataRow InfoItemDr in dt.Rows) // { // InfoItem item = new InfoItem(); // item.Code = InfoItemDr["Code"].ToString(); // item.Name = InfoItemDr["Name"].ToString(); // item.ParentCode = InfoItemDr["ParentCode"].ToString(); // item.SortNo = Convert.ToInt32(InfoItemDr["SortNo"]); // item.GroupHeaderFlag = Convert.ToInt32(InfoItemDr["GroupHeaderFlag"]); // item.ControlType = InfoItemDr["ControlType"].ToString(); // item.OptionCategory = InfoItemDr["OptionCategory"].ToString(); // list.Add(item); // } // model.InfoItemList.Add(list); //} //#endregion string Patient = UserId; string ItemCode = ""; int ItemSeq = 1; string Value = ""; string Description = ""; int SortNo = 1; string OptionCategory = ""; #region 插入购买的模块关注详细信息 int j = 0; if (CategoryCode != null) { //是否购买 ModuleInfo ModuleFind = model.ModuleBoughtInfo.Find(delegate(ModuleInfo x) { return x.Category == CategoryCode; }); if (ModuleFind == null) { //插入 医生详细信息表 负责患者信息 if (user.Role == "Doctor") { flag = _ServicesSoapClient.SetPsDoctorDetailOnPat(DoctorId, CategoryCode, UserId, Description, 0, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); } else { flag = _ServicesSoapClient.SetPsDoctorDetailOnPat(DoctorId, "H" + CategoryCode, UserId, Description, 0, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); } model.ModuleBoughtInfo.Add(new ModuleInfo { Category = CategoryCode, ModuleName = model.ModuleUnBoughtInfo.Find(delegate(ModuleInfo x) { return x.Category == CategoryCode; }).ModuleName }); model.ModuleUnBoughtInfo.Remove(model.ModuleUnBoughtInfo.Find(delegate(ModuleInfo x) { return x.Category == CategoryCode; })); } if (user.Role == "Doctor") { flag = _ServicesSoapClient.SetBasicInfoDetail(Patient, CategoryCode, "InvalidFlag", ItemSeq, "0", Description, SortNo, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //插入 患者详细信息表 负责医生信息 flag = _ServicesSoapClient.SetBasicInfoDetail(Patient, CategoryCode, "Doctor", ItemSeq, DoctorId, "", SortNo, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); } else { flag = _ServicesSoapClient.SetBasicInfoDetail(Patient, "H" + CategoryCode, "InvalidFlag", ItemSeq, "0", Description, SortNo, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //插入 患者详细信息表 负责医生信息 flag = _ServicesSoapClient.SetBasicInfoDetail(Patient, "H" + CategoryCode, "Doctor", ItemSeq, DoctorId, "", SortNo, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); } for (j = 0; j < ItemInfo.Count; j++) { ItemCode = ItemInfo[j].ItemCode; OptionCategory = ItemInfo[j].OptionCategory; Value = Request.Form[ItemInfo[j].ItemCode]; //插入患者详细信息表中的模块关注详细信息 if (OptionCategory != "Cm.MstHypertensionDrug" && OptionCategory != "Cm.MstDiabetesDrug" && OptionCategory != "Cm.MstLipidDrug" && OptionCategory != "Cm.MstUricAcidReductionDrug") { flag = _ServicesSoapClient.SetBasicInfoDetail(Patient, "M", ItemCode, ItemSeq, Value, Description, SortNo, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); } //string[] Array = Value.Split(','); //if (Value ==null) //{ //插入患者详细信息表中的模块关注详细信息 //flag = _ServicesSoapClient.SetBasicInfoDetail(Patient, CategoryCode, ItemCode, ItemSeq, Value, Description, SortNo, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //} //else //{ //string[] values = Value.Split(','); //int vLength = values.Length; //if (vLength > 1) //{ //for (int vnum = 0; vnum < vLength; vnum++) //{ //插入患者详细信息表中的模块关注详细信息 //flag = _ServicesSoapClient.SetBasicInfoDetail(Patient, CategoryCode, ItemCode, ItemSeq, values[vnum].ToString(), Description, SortNo, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //SortNo++; //ItemSeq++; //} //} //else //{ //插入患者详细信息表中的模块关注详细信息 // flag = _ServicesSoapClient.SetBasicInfoDetail(Patient, CategoryCode, ItemCode, ItemSeq, Value, Description, SortNo, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //} //} } } #endregion if (CategoryCode != "") { ItemInfo = new List<PatientDetailInfo>(); ItemInfoSet = _ServicesSoapClient.GetItemInfoByPIdAndModule(UserId, CategoryCode); bool InvalidFlag = false; foreach (DataTable item in ItemInfoSet.Tables) { foreach (DataRow row in item.Rows) { if (row[3].ToString() != "InvalidFlag" && row[3].ToString() != "Patient") { if (row[3].ToString() == "Doctor") { PatientDetailInfo NewLine = new PatientDetailInfo() { CategoryCode = row[1].ToString(), CategoryName = row[2].ToString(), ItemCode = row[3].ToString(), ItemName = row[4].ToString(), ParentCode = row[5].ToString(), ItemSeq = Convert.ToInt32(row[6]), Value = row[7].ToString(), Content = _ServicesSoapClient.GetUserName(row[7].ToString()) }; if (user.Role == "HealthCoach") { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://121.43.107.106:9000/"); HttpResponseMessage response = client.GetAsync("Api/v1/Users/BasicDtlValue?UserId=" + UserId + "&CategoryCode=H" + CategoryCode + "&ItemCode=Doctor&ItemSeq=1").Result; if (response.IsSuccessStatusCode) { NewLine.Value = response.Content.ReadAsStringAsync().Result.Split(new string[] { "{", ":", "}", "\"" }, StringSplitOptions.RemoveEmptyEntries)[1]; } } if (NewLine.Value == DoctorId) { NewLine.EditDeleteFlag = "true"; } else { NewLine.EditDeleteFlag = "false"; } ItemInfo.Add(NewLine); } else { PatientDetailInfo NewLine = new PatientDetailInfo() { ItemCode = row[3].ToString(), ItemName = row[4].ToString(), ParentCode = row[5].ToString(), ControlType = row[11].ToString(), OptionCategory = row[12].ToString(), ItemSeq = Convert.ToInt32(row[6]), Value = row[7].ToString(), Content = row[8].ToString(), GroupHeaderFlag = Convert.ToInt32(row[13]) }; if (NewLine.ControlType != "7") NewLine.OptionList = GetTypeList(NewLine.OptionCategory, NewLine.Value); //通过yesornoh和value,结合字典表,生成有值的下拉框 ItemInfo.Add(NewLine); } } else { if (row[3].ToString() == "InvalidFlag") { if (user.Role == "HealthCoach") { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://121.43.107.106:9000/"); HttpResponseMessage response = client.GetAsync("Api/v1/Users/BasicDtlValue?UserId=" + UserId + "&CategoryCode=H" + CategoryCode + "&ItemCode=InvalidFlag&ItemSeq=1").Result; if (response.IsSuccessStatusCode) { InvalidFlag = (response.Content.ReadAsStringAsync().Result.Split(new string[] { "{", ":", "}", "\"" }, StringSplitOptions.RemoveEmptyEntries)[1] == "0"); } } else InvalidFlag = (row[7].ToString() != ""); } } } } model.ModuleDetailList = ItemInfo; model.InvalidFlag = InvalidFlag; } } return View(model); }
//编辑(现在用不着了) public ActionResult ModuleProfileEdit(string UserId) { var user = Session["CurrentUser"] as UserAndRole; string DoctorId = user.UserId; BasicProfileViewModel model = new BasicProfileViewModel(); //加载患者基本信息 model.Patient = GetPatientBasicInfo(UserId); //加载患者详细信息 //GetPatientInfoDetail(ref model); #region 从病人详细信息表中加载模块信息 DataSet ItemInfoBoughtds = _ServicesSoapClient.GetPatBasicInfoDtlList(UserId); List<List<PatientDetailInfo>> ItemInfoBought = new List<List<PatientDetailInfo>>(); ArrayList modulesBoughtCode = new ArrayList(); ArrayList modulesBoughtName = new ArrayList(); foreach (DataTable datatable in ItemInfoBoughtds.Tables) { List<PatientDetailInfo> items = new List<PatientDetailInfo>(); foreach (DataRow row in datatable.Rows) { if (row[3].ToString() != "InvalidFlag") { if (row[3].ToString() == "Doctor") { PatientDetailInfo item = new PatientDetailInfo { //PatientId = row[0].ToString(), CategoryCode = row[1].ToString(), CategoryName = row[2].ToString(), ItemCode = row[3].ToString(), ItemName = row[4].ToString(), ParentCode = row[5].ToString(), ControlType = row[11].ToString(), OptionCategory = row[12].ToString(), //OptionSelected = row[0].ToString(), //OptionList = row[0], ItemSeq = Convert.ToInt32(row[6]), Value = row[7].ToString(), Content = _ServicesSoapClient.GetUserName(row[7].ToString()) //Description = row[9].ToString() }; item.OptionList = GetTypeList(item.OptionCategory, item.Value); if (item.Value == DoctorId) { item.EditDeleteFlag = "true"; } else { item.EditDeleteFlag = "false"; } items.Add(item); } else { PatientDetailInfo item = new PatientDetailInfo { //PatientId = row[0].ToString(), CategoryCode = row[1].ToString(), CategoryName = row[2].ToString(), ItemCode = row[3].ToString(), ItemName = row[4].ToString(), ParentCode = row[5].ToString(), ControlType = row[11].ToString(), OptionCategory = row[12].ToString(), //OptionSelected = row[0].ToString(), //OptionList = row[0], ItemSeq = Convert.ToInt32(row[6]), Value = row[7].ToString(), Content = row[8].ToString(), //Description = row[9].ToString() }; item.OptionList = GetTypeList(item.OptionCategory, item.Value); items.Add(item); } } } modulesBoughtCode.Add(items[0].CategoryCode); modulesBoughtName.Add(items[0].CategoryName); ItemInfoBought.Add(items); } model.PatientDetailInfo = ItemInfoBought; #endregion return View(model); }
public ActionResult BasicProfile(BasicProfileViewModel model, FormCollection formCollection) { if (ModelState.IsValid) { var user = Session["CurrentUser"] as UserAndRole; string DoctorId = user.UserId; string DoctorName = user.UserName; //操作标识符 页面所有操作只做一次判断 bool flag = false; string UserId = model.Patient.UserId; Session["PatientId"] = model.Patient.UserId; #region 插入患者基本信息 //插入患者基本信息 string UserName = model.Patient.UserName; string Birthday = ""; if (model.Patient.Birthday != "") { Birthday = System.Text.RegularExpressions.Regex.Replace(model.Patient.Birthday, @"[^0-9]+", ""); } int Gender = Convert.ToInt32(model.Patient.Gender); int BloodType = Convert.ToInt32(model.Patient.BloodType); string IDNo = model.Patient.IDNo; //患者身份证号码 2014/12/11 CSQ string InsuranceType = model.Patient.InsuranceType; int InvalidFlag = 0; flag = _ServicesSoapClient.SetPatBasicInfo(UserId, UserName, Convert.ToInt32(Birthday), Gender, BloodType, IDNo, "", InsuranceType, InvalidFlag, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //插入MstUser //用户已存在 if (_ServicesSoapClient.CheckUserExist(UserId) == true) { DataSet ds = _ServicesSoapClient.GetUserInfoList(UserId, ""); if (ds.Tables.Count > 0) { User userInfo = new User(); foreach (DataRow row in ds.Tables[0].Rows) { //userInfo.UserName = row[1].ToString(); userInfo.Password = row[2].ToString(); userInfo.Class = row[3].ToString(); //userInfo.ClassName = row[4].ToString(); userInfo.StartDate = row[5].ToString(); userInfo.EndDate = row[6].ToString(); flag = _ServicesSoapClient.SetMstUser(UserId, UserName, userInfo.Password, "", "", 1, Convert.ToInt32(userInfo.StartDate), Convert.ToInt32(userInfo.EndDate), DateTime.Now, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); } } DataSet roleDs = _ServicesSoapClient.GetAllRoleMatch(UserId); int patientFlag = 0; if (roleDs.Tables.Count != 0) { DataTable roleDt = roleDs.Tables[0]; foreach (DataRow dr in roleDt.Rows) { if (dr["RoleClass"].ToString() == "Patient") { patientFlag = 1; } } } if (patientFlag == 0) { flag = _ServicesSoapClient.SetPsRoleMatch(UserId, "Patient", "", "1", "") == 1? true : false; } } else //新增用户 { flag = _ServicesSoapClient.SetMstUser(UserId, UserName, "123456", "", "", 1, Convert.ToInt32(DateTime.Now.ToString("yyyyMMdd")), Convert.ToInt32(DateTime.Now.AddYears(1).ToString("yyyyMMdd")), DateTime.Now, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //string test = Request["PhoneNo"].ToString(); if ((_ServicesSoapClient.SetPhoneNo(UserId, "PhoneNo", Request.Form["PhoneNo"].ToString(), user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType)) == 1) { flag = true; } if (_ServicesSoapClient.SetPsRoleMatch(UserId, "Patient", "", "1", "") == 1) { flag = true; } //flag = _ServicesSoapClient.SetHUserId(UserId, model.Patient.HospitalId, model.Patient.HospitalCode, "", user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); } #endregion string Patient = UserId; #region 插入患者详细信息 //插入 身份证号 flag = _ServicesSoapClient.SetPatBasicInfoDetail(Patient, "Contact", "Contact001_1", 1, IDNo, "", 1, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //插入 职业 string Occupation = model.Occupation; flag = _ServicesSoapClient.SetPatBasicInfoDetail(Patient, "Contact", "Contact001_2", 1, Occupation, "", 1, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //插入 国籍 string Nationality = model.Nationality; flag = _ServicesSoapClient.SetPatBasicInfoDetail(Patient, "Contact", "Contact001_3", 1, Nationality, "", 1, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //插入 手机号码 string Phone = model.Phone; flag = _ServicesSoapClient.SetPatBasicInfoDetail(Patient, "Contact", "Contact002_1", 1, Phone, "", 1, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //插入 家庭住址 string Address = model.Address; flag = _ServicesSoapClient.SetPatBasicInfoDetail(Patient, "Contact", "Contact002_2", 1, Address, "", 1, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //插入 紧急联系人 string EmergencyContact = model.EmergencyContact; flag = _ServicesSoapClient.SetPatBasicInfoDetail(Patient, "Contact", "Contact002_3", 1, EmergencyContact, "", 1, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //插入 紧急联系人电话 string EmergencyContactNumber = model.EmergencyContactNumber; flag = _ServicesSoapClient.SetPatBasicInfoDetail(Patient, "Contact", "Contact002_4", 1, EmergencyContactNumber, "", 1, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); #endregion if (flag == true) { return RedirectToAction("ClinicalInfo", "DoctorHome", new { UserId = UserId }); } else { return View(model); } } return View(model); }
public ActionResult ModuleProfile(string PatientId, string Category) { var user = Session["CurrentUser"] as UserAndRole; string DoctorId = user.UserId; BasicProfileViewModel model = new BasicProfileViewModel(); model.Patient.UserId = PatientId; //加载患者基本信息 model.Patient = GetPatientBasicInfo(PatientId); #region 修改说明 //1 获取患者已购买的模块 //2 获取患者未购买的模块 //3 之前已购买和未购买是分别调用Ps和Cm表的方法做的,现在可以都调用Ps表中的方法,获取问卷信息 //4 不同模块的问卷分别加载,不要一次性加载,这样可以不用在前端做不同模块信息的同步,用JsonResult实现 //5 把模块信息相关的三个页面用同一种方式实现,方便以后的维护 //6 高血压和糖尿病模块的问卷只有二级标题,心衰模块还有三级标题以及显示控制的条目,需要再做修改 #endregion List<ModuleInfo> ModuleInfo = new List<Models.ModuleInfo>(); DataSet ModulesInfo = new DataSet(); if (user.Role == "Doctor") { ModulesInfo = _ServicesSoapClient.GetModulesBoughtByPId(PatientId); foreach (DataTable item in ModulesInfo.Tables) { foreach (DataRow row in item.Rows) { ModuleInfo NewLine = new Models.ModuleInfo(); NewLine.Category = row[0].ToString(); NewLine.ModuleName = row[1].ToString(); ModuleInfo.Add(NewLine); } } } else { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://121.43.107.106:9000/"); HttpResponseMessage response = client.GetAsync("Api/v1/Users/HModulesByID?PatientId=" + PatientId + "&DoctorId=" + DoctorId).Result; if (response.IsSuccessStatusCode) { if (response.Content.ReadAsStringAsync().Result != "[]") { string[] Modules = response.Content.ReadAsStringAsync().Result.Split(new string[] { "},{", "[{\"", "\"}]" }, StringSplitOptions.RemoveEmptyEntries); foreach (string Module in Modules) { string[] Detail = Module.Split(new string[] { "\",\"", "\":\"" }, StringSplitOptions.RemoveEmptyEntries); ModuleInfo NewLine = new Models.ModuleInfo(); NewLine.Category = Detail[1].Substring(1); NewLine.ModuleName = Detail[3]; ModuleInfo.Add(NewLine); } } } } model.ModuleBoughtInfo = ModuleInfo; ModuleInfo = new List<Models.ModuleInfo>(); if (user.Role == "Doctor") { ModulesInfo = _ServicesSoapClient.GetModulesUnBoughtByPId(PatientId); } else { ModulesInfo = _ServicesSoapClient.GetModuleList(); } DataSet DoctorModule = _ServicesSoapClient.GetDoctorModuleList(DoctorId); List<string> DoctorModules = new List<string>(); foreach (DataRow item in DoctorModule.Tables[0].Rows) { DoctorModules.Add(item[0].ToString()); } foreach (DataTable item in ModulesInfo.Tables) { foreach (DataRow row in item.Rows) { if ((user.Role == "Doctor" && DoctorModules.IndexOf(row[0].ToString()) != -1) || (user.Role == "HealthCoach" && row[0].ToString() != "M4" && row[0].ToString() != "M5" && model.ModuleBoughtInfo.Find(delegate(ModuleInfo x){return x.Category == row[0].ToString();}) == null)) { ModuleInfo NewLine = new Models.ModuleInfo(); NewLine.Category = row[0].ToString(); NewLine.ModuleName = row[1].ToString(); ModuleInfo.Add(NewLine); } } } model.ModuleUnBoughtInfo = ModuleInfo; List<PatientDetailInfo> ItemInfo = new List<PatientDetailInfo>(); DataSet ItemInfoSet = _ServicesSoapClient.GetItemInfoByPIdAndModule(PatientId, Category); bool InvalidFlag = false; foreach (DataTable item in ItemInfoSet.Tables) { foreach (DataRow row in item.Rows) { if (row[3].ToString() != "InvalidFlag" && row[3].ToString() != "Patient") { if (row[3].ToString() == "Doctor") { PatientDetailInfo NewLine = new PatientDetailInfo() { CategoryCode = row[1].ToString(), CategoryName = row[2].ToString(), ItemCode = row[3].ToString(), ItemName = row[4].ToString(), ParentCode = row[5].ToString(), ItemSeq = Convert.ToInt32(row[6]), Value = row[7].ToString(), Content = _ServicesSoapClient.GetUserName(row[7].ToString()) }; if (user.Role == "HealthCoach") { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://121.43.107.106:9000/"); HttpResponseMessage response = client.GetAsync("Api/v1/Users/BasicDtlValue?UserId=" + PatientId + "&CategoryCode=H" + Category + "&ItemCode=Doctor&ItemSeq=1").Result; if (response.IsSuccessStatusCode) { NewLine.Value = response.Content.ReadAsStringAsync().Result.Split(new string[] { "{", ":", "}", "\"" }, StringSplitOptions.RemoveEmptyEntries)[1]; } } if (NewLine.Value == DoctorId) { NewLine.EditDeleteFlag = "true"; } else { NewLine.EditDeleteFlag = "false"; } ItemInfo.Add(NewLine); } else { PatientDetailInfo NewLine = new PatientDetailInfo() { ItemCode = row[3].ToString(), ItemName = row[4].ToString(), ParentCode = row[5].ToString(), ControlType = row[11].ToString(), OptionCategory = row[12].ToString(), ItemSeq = Convert.ToInt32(row[6]), Value = row[7].ToString(), Content = row[8].ToString(), GroupHeaderFlag = Convert.ToInt32(row[13]) }; if (NewLine.ControlType != "7") NewLine.OptionList = GetTypeList(NewLine.OptionCategory, NewLine.Value); //通过yesornoh和value,结合字典表,生成有值的下拉框 ItemInfo.Add(NewLine); } } else { if (row[3].ToString() == "InvalidFlag") { if (user.Role == "HealthCoach") { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://121.43.107.106:9000/"); HttpResponseMessage response = client.GetAsync("Api/v1/Users/BasicDtlValue?UserId=" + PatientId + "&CategoryCode=H" + Category + "&ItemCode=InvalidFlag&ItemSeq=1").Result; if (response.IsSuccessStatusCode) { InvalidFlag = (response.Content.ReadAsStringAsync().Result.Split(new string[] { "{", ":", "}", "\"" }, StringSplitOptions.RemoveEmptyEntries)[1] == "0"); } } else InvalidFlag = (row[7].ToString() != ""); } } } } model.ModuleDetailList = ItemInfo; model.InvalidFlag = InvalidFlag; //#region 从病人详细信息表中加载模块关注详细信息 //DataSet ItemInfoBoughtds = _ServicesSoapClient.GetPatBasicInfoDtlList(PatientId); //List<List<PatientDetailInfo>> ItemInfoBought = new List<List<PatientDetailInfo>>(); //ArrayList modulesBoughtCode = new ArrayList(); //ArrayList modulesBoughtName = new ArrayList(); //if (ItemInfoBoughtds!=null) //{ // foreach (DataTable datatable in ItemInfoBoughtds.Tables) // { // List<PatientDetailInfo> items = new List<PatientDetailInfo>(); // foreach (DataRow row in datatable.Rows) // { // if (row[3].ToString() != "InvalidFlag" && row[3].ToString() != "Patient") // { // if (row[3].ToString() == "Doctor") // { // PatientDetailInfo item = new PatientDetailInfo() // { // //PatientId = row[0].ToString(), // CategoryCode = row[1].ToString(), // CategoryName = row[2].ToString(), // ItemCode = row[3].ToString(), // ItemName = row[4].ToString(), // ParentCode = row[5].ToString(), // //ControlType = row[11].ToString(), // // OptionCategory = row[12].ToString(), // //OptionSelected = row[0].ToString(), // //OptionList = row[0], // ItemSeq = Convert.ToInt32(row[6]), // Value = row[7].ToString(), // //Content = row[9].ToString() // Content = _ServicesSoapClient.GetUserName(row[7].ToString()) // //Description = row[9].ToString() // }; // if (item.Value == DoctorId) // { // item.EditDeleteFlag = "true"; // } // else // { // item.EditDeleteFlag = "false"; // } // items.Add(item); // } // else // { // PatientDetailInfo item = new PatientDetailInfo() // { // //PatientId = row[0].ToString(), // CategoryCode = row[1].ToString(), // CategoryName = row[2].ToString(), // ItemCode = row[3].ToString(), // ItemName = row[4].ToString(), // ParentCode = row[5].ToString(), // ControlType = row[11].ToString(), // OptionCategory = row[12].ToString(), // //OptionSelected = row[0].ToString(), // //OptionList = row[0], // ItemSeq = Convert.ToInt32(row[6]), // Value = row[7].ToString(), // Content = row[8].ToString() // //Description = row[9].ToString() // }; // item.OptionList = GetTypeList(item.OptionCategory, item.Value); //通过yesornoh和value,结合字典表,生成有值的下拉框 // items.Add(item); // } // } // } // modulesBoughtCode.Add(items[0].CategoryCode); // modulesBoughtName.Add(items[0].CategoryName); // ItemInfoBought.Add(items); // } //} //model.PatientDetailInfo = ItemInfoBought; //#endregion return View(model); }
public ActionResult BasicProfile(string PatientId, string Role) { var user = Session["CurrentUser"] as UserAndRole; string DoctorId = user.UserId; Session["PatientId"] = PatientId; BasicProfileViewModel model = new BasicProfileViewModel(); if (PatientId != null) { ViewBag.OperationInvalidFlag = "false"; //手机号输入框不显示 if (Role == "Patient") { //加载患者基本信息 ServiceReference.PatientBasicInfo basicInfo = new ServiceReference.PatientBasicInfo(); basicInfo = _ServicesSoapClient.GetPatBasicInfo(PatientId); model.Patient.UserId = basicInfo.UserId; model.Patient.UserName = basicInfo.UserName; model.Patient.Birthday = basicInfo.Birthday; model.Patient.Gender = basicInfo.Gender; model.Patient.BloodType = basicInfo.BloodType; model.Patient.InsuranceType = basicInfo.InsuranceType; //加载患者详细信息 GetPatientInfoDetail(ref model); } else { DataSet basicInfoDs = _ServicesSoapClient.GetDoctorInfo(PatientId); if (basicInfoDs.Tables.Count > 0) { DataTable basicInfoDt = basicInfoDs.Tables[0]; model.Patient.UserId = basicInfoDt.Rows[0]["DoctorId"].ToString(); model.Patient.UserName = basicInfoDt.Rows[0]["DoctorName"].ToString(); model.Patient.Birthday = basicInfoDt.Rows[0]["Birthday"].ToString(); model.Patient.Gender = basicInfoDt.Rows[0]["Gender"].ToString(); model.Patient.BloodType = ""; model.Patient.InsuranceType = ""; } var DetailInfo = _ServicesSoapClient.GetDoctorInfoDetail(PatientId); if (DetailInfo!=null) { model.Patient.IDNo = DetailInfo.IDNo; model.Occupation = DetailInfo.Occupation; model.Nationality = DetailInfo.Nationality; model.Phone = DetailInfo.PhoneNumber; model.Address = DetailInfo.HomeAddress; model.EmergencyContact = DetailInfo.EmergencyContact; model.EmergencyContactNumber = DetailInfo.EmergencyContactPhoneNumber; } } //加载操作医生未负责患者列表 20150629 //model.PatientList = GetPotentialPatientList(DoctorId); return View(model); } else { ViewBag.OperationInvalidFlag = "true"; //显示手机号输入框 //加载操作医生未负责患者列表 20150629 //model.PatientList = GetPotentialPatientList(DoctorId); return View(model); } }
//加载患者详细信息 public BasicProfileViewModel GetPatientInfoDetail(ref BasicProfileViewModel model) { string PatientId = model.Patient.UserId; var basicInfoDtl = _ServicesSoapClient.GetPatientDetailInfo(PatientId); model.Patient.IDNo = basicInfoDtl.IDNo; model.Occupation = basicInfoDtl.Occupation; model.Nationality = basicInfoDtl.Nationality; model.Phone = basicInfoDtl.PhoneNumber; model.Address = basicInfoDtl.HomeAddress; model.EmergencyContact = basicInfoDtl.EmergencyContact; model.EmergencyContactNumber = basicInfoDtl.EmergencyContactPhoneNumber; return model; }
public ActionResult ModuleProfile(BasicProfileViewModel model, FormCollection formCollection) { if (ModelState.IsValid) { var user = Session["CurrentUser"] as UserAndRole; string DoctorId = user.UserId; //string DoctorName = user.UserName; //操作标识符 页面所有操作只做一次判断 bool flag = true; string UserId = model.Patient.UserId; string UserName = model.Patient.UserName; #region 从病人详细信息表中加载模块关注信息 DataSet ItemInfoBoughtds = _ServicesSoapClient.GetPatBasicInfoDtlList(UserId); List<List<PatientDetailInfo>> ItemInfoBought = new List<List<PatientDetailInfo>>(); ArrayList modulesBoughtCode = new ArrayList(); ArrayList modulesBoughtName = new ArrayList(); foreach (DataTable datatable in ItemInfoBoughtds.Tables) { List<PatientDetailInfo> items = new List<PatientDetailInfo>(); foreach (DataRow row in datatable.Rows) { if (row[3].ToString() != "InvalidFlag") { PatientDetailInfo item = new PatientDetailInfo { //PatientId = row[0].ToString(), CategoryCode = row[1].ToString(), CategoryName = row[2].ToString(), ItemCode = row[3].ToString(), ItemName = row[4].ToString(), ParentCode = row[5].ToString(), //ControlType = row[11].ToString(), // OptionCategory = row[12].ToString(), //OptionSelected = row[0].ToString(), //OptionList = row[0], //ItemSeq = Convert.ToInt32(row[6]), Value = row[7].ToString(), Content = row[8].ToString(), //Description = row[9].ToString() }; items.Add(item); } } modulesBoughtCode.Add(items[0].CategoryCode); modulesBoughtName.Add(items[0].CategoryName); ItemInfoBought.Add(items); } model.PatientDetailInfo = ItemInfoBought; #endregion #region 从字典表中加载模块信息 //修改:只加载医生负责的模块&患者购买的模块 //DataTable Moduledt = _ServicesSoapClient.GetModuleList().Tables[0]; DataTable Moduledt = _ServicesSoapClient.GetDoctorModuleList(DoctorId).Tables[0]; //ArrayList moduleUnBought = new ArrayList(); int indicator = 0; foreach (DataRow dr in Moduledt.Rows) { //string dictCode = dr["Code"].ToString(); //string dictName = dr["Name"].ToString(); string dictCode = dr["CategoryCode"].ToString(); string dictName = dr["CategoryName"].ToString(); foreach (string modulesBt in modulesBoughtCode) { if (modulesBt == dictCode) { indicator = 1; //已购买 break; } } if (indicator == 0) //未购买 { //mubt.CategoryCode = dictCode; //mubt.CategoryName = dictName; //model.moduleUnBought.Add(mubt); model.moduleUnBoughtCode.Add(dictCode); model.moduleUnBoughtName.Add(dictName); //indicator = 1; } else { indicator = 0; } } //string code = ""; DataTable dt = new DataTable(); //ArrayList selectedModule = new ArrayList(); //ViewBag.SelectedModule = selectedModule; //foreach (DataRow dr in Moduledt.Rows) foreach (string mubt in model.moduleUnBoughtCode) { List<InfoItem> list = new List<InfoItem>(); //code = mubt.CategoryCode; dt = _ServicesSoapClient.GetMstInfoItemByCategoryCode(mubt).Tables[0]; foreach (DataRow InfoItemDr in dt.Rows) { InfoItem item = new InfoItem(); item.Code = InfoItemDr["Code"].ToString(); item.Name = InfoItemDr["Name"].ToString(); item.ParentCode = InfoItemDr["ParentCode"].ToString(); item.SortNo = Convert.ToInt32(InfoItemDr["SortNo"]); item.GroupHeaderFlag = Convert.ToInt32(InfoItemDr["GroupHeaderFlag"]); item.ControlType = InfoItemDr["ControlType"].ToString(); item.OptionCategory = InfoItemDr["OptionCategory"].ToString(); list.Add(item); } model.InfoItemList.Add(list); } #endregion string Patient = UserId; string CategoryCode = ""; string ItemCode = ""; int ItemSeq = 1; string Value = ""; string Description = ""; int SortNo = 1; #region 插入购买的模块关注详细信息 int i, j = 0; for (i = 0; i < model.InfoItemList.Count; i++) { string abc = Request.Form["select" + model.moduleUnBoughtCode[i]]; if (abc != null) { string[] Array = abc.Split(','); string select = "false"; for (int ii = 0; ii < Array.Length; ii++) { if (Array[ii] == "true") { select = Array[ii]; break; } else { continue; } } if (select == "true") { CategoryCode = model.moduleUnBoughtCode[i].ToString(); //是否购买 flag = _ServicesSoapClient.SetBasicInfoDetail(Patient, CategoryCode, "InvalidFlag", ItemSeq, "0", Description, SortNo, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //插入 医生详细信息表 负责患者信息 flag = _ServicesSoapClient.SetPsDoctorDetailOnPat(DoctorId, CategoryCode, UserId, Description, SortNo, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); //插入 患者详细信息表 负责医生信息 flag = _ServicesSoapClient.SetBasicInfoDetail(Patient, CategoryCode, "Doctor", ItemSeq, DoctorId, "", SortNo, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); for (j = 0; j < model.InfoItemList[i].Count; j++) { ItemCode = model.InfoItemList[i][j].Code; Value = Request.Form[model.InfoItemList[i][j].Code]; //插入 患者详细信息表中的模块关注详细信息 flag = _ServicesSoapClient.SetBasicInfoDetail(Patient, CategoryCode, ItemCode, ItemSeq, Value, Description, SortNo, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType); } } } } #endregion if (flag == true) { return RedirectToAction("ClinicalInfo", "DoctorHome", new { UserId = UserId }); } else { return View(model); } } return View(model); }
public ActionResult ModuleProfile(string PatientId) { var user = Session["CurrentUser"] as UserAndRole; string DoctorId = user.UserId; BasicProfileViewModel model = new BasicProfileViewModel(); model.Patient.UserId = PatientId; //加载患者基本信息 model.Patient = GetPatientBasicInfo(PatientId); #region 从病人详细信息表中加载模块关注详细信息 DataSet ItemInfoBoughtds = _ServicesSoapClient.GetPatBasicInfoDtlList(PatientId); List<List<PatientDetailInfo>> ItemInfoBought = new List<List<PatientDetailInfo>>(); ArrayList modulesBoughtCode = new ArrayList(); ArrayList modulesBoughtName = new ArrayList(); foreach (DataTable datatable in ItemInfoBoughtds.Tables) { List<PatientDetailInfo> items = new List<PatientDetailInfo>(); foreach (DataRow row in datatable.Rows) { if (row[3].ToString() != "InvalidFlag") { if (row[3].ToString() == "Doctor") { PatientDetailInfo item = new PatientDetailInfo() { //PatientId = row[0].ToString(), CategoryCode = row[1].ToString(), CategoryName = row[2].ToString(), ItemCode = row[3].ToString(), ItemName = row[4].ToString(), ParentCode = row[5].ToString(), //ControlType = row[11].ToString(), // OptionCategory = row[12].ToString(), //OptionSelected = row[0].ToString(), //OptionList = row[0], //ItemSeq = Convert.ToInt32(row[6]), Value = row[7].ToString(), //Content = row[9].ToString() Content = _ServicesSoapClient.GetUserName(row[7].ToString()) //Description = row[9].ToString() }; if (item.Value == DoctorId) { item.EditDeleteFlag = "true"; } else { item.EditDeleteFlag = "false"; } items.Add(item); } else { PatientDetailInfo item = new PatientDetailInfo() { //PatientId = row[0].ToString(), CategoryCode = row[1].ToString(), CategoryName = row[2].ToString(), ItemCode = row[3].ToString(), ItemName = row[4].ToString(), ParentCode = row[5].ToString(), ControlType = row[11].ToString(), OptionCategory = row[12].ToString(), //OptionSelected = row[0].ToString(), //OptionList = row[0], //ItemSeq = Convert.ToInt32(row[6]), Value = row[7].ToString(), Content = row[8].ToString() //Description = row[9].ToString() }; item.OptionList = GetTypeList(item.OptionCategory, item.Value); //通过yesornoh和value,结合字典表,生成有值的下拉框 items.Add(item); } } } modulesBoughtCode.Add(items[0].CategoryCode); modulesBoughtName.Add(items[0].CategoryName); ItemInfoBought.Add(items); } model.PatientDetailInfo = ItemInfoBought; #endregion #region 从字典表中加载模块信息 //修改:只加载医生负责的模块&患者购买的模块 //DataTable Moduledt = _ServicesSoapClient.GetModuleList().Tables[0]; DataTable Moduledt = _ServicesSoapClient.GetDoctorModuleList(DoctorId).Tables[0]; int indicator = 0; foreach (DataRow dr in Moduledt.Rows) { //string dictCode = dr["Code"].ToString(); //string dictName = dr["Name"].ToString(); string dictCode = dr["CategoryCode"].ToString(); string dictName = dr["CategoryName"].ToString(); foreach (string modulesBt in modulesBoughtCode) { if (modulesBt == dictCode) { indicator = 1; //已购买 break; } } if (indicator == 0) //未购买 { model.moduleUnBoughtCode.Add(dictCode); model.moduleUnBoughtName.Add(dictName); } else { indicator = 0; } } DataTable dt = new DataTable(); DataTable docList = new DataTable(); //string selected="2"; foreach (string mubt in model.moduleUnBoughtCode) { List<InfoItem> list = new List<InfoItem>(); //code = mubt.CategoryCode; //dt = _ServicesSoapClient.GetMstInfoItemByCategoryCode(mubt).Tables[0]; DataSet ds = _ServicesSoapClient.GetMstInfoItemByCategoryCode(mubt); if (ds.Tables.Count > 0) { dt = ds.Tables[0]; foreach (DataRow InfoItemDr in dt.Rows) { InfoItem item = new InfoItem() { Code = InfoItemDr["Code"].ToString(), Name = InfoItemDr["Name"].ToString(), ParentCode = InfoItemDr["ParentCode"].ToString(), SortNo = Convert.ToInt32(InfoItemDr["SortNo"]), GroupHeaderFlag = Convert.ToInt32(InfoItemDr["GroupHeaderFlag"]), ControlType = InfoItemDr["ControlType"].ToString(), OptionCategory = InfoItemDr["OptionCategory"].ToString() }; item.OptionList = GetTypeList(item.OptionCategory, ""); //通过yesornoh和value,结合字典表,生成有值的下拉框 list.Add(item); } } model.InfoItemList.Add(list); docList = _ServicesSoapClient.GetDoctorListByModule(mubt).Tables[0]; foreach (DataRow DR in docList.Rows) { model.DoctorList.Add(new SelectListItem { Text = DR["DoctorName"].ToString(), Value = DR["DoctorId"].ToString() }); } } #endregion return View(model); }
//加载患者详细信息 public BasicProfileViewModel GetPatientInfoDetail(ref BasicProfileViewModel model) { string PatientId = model.Patient.UserId; DataSet basicInfoDtl = _ServicesSoapClient.GetPatientBasicInfoDetail(PatientId, "Contact"); if (basicInfoDtl.Tables[0].Rows.Count > 0) { model.Patient.IDNo = basicInfoDtl.Tables[0].Rows[0]["Value"].ToString(); model.Occupation = basicInfoDtl.Tables[0].Rows[1]["Value"].ToString(); model.Nationality = basicInfoDtl.Tables[0].Rows[2]["Value"].ToString(); model.Phone = basicInfoDtl.Tables[0].Rows[3]["Value"].ToString(); model.Address = basicInfoDtl.Tables[0].Rows[4]["Value"].ToString(); model.EmergencyContact = basicInfoDtl.Tables[0].Rows[5]["Value"].ToString(); model.EmergencyContactNumber = basicInfoDtl.Tables[0].Rows[6]["Value"].ToString(); } return model; }
public ActionResult BasicProfile(string PatientId) { var user = Session["CurrentUser"] as UserAndRole; string DoctorId = user.UserId; Session["PatientId"] = PatientId; BasicProfileViewModel model = new BasicProfileViewModel(); if (PatientId != null) { ViewBag.OperationInvalidFlag = "false"; //新建按钮的权限 //加载患者基本信息 ServiceReference.PatientBasicInfo basicInfo = new ServiceReference.PatientBasicInfo(); basicInfo = _ServicesSoapClient.GetPatBasicInfo(PatientId); model.Patient.UserId = basicInfo.UserId; model.Patient.UserName = basicInfo.UserName; model.Patient.Birthday = basicInfo.Birthday; model.Patient.Gender = basicInfo.Gender; model.Patient.BloodType = basicInfo.BloodType; model.Patient.InsuranceType = basicInfo.InsuranceType; //加载患者详细信息 GetPatientInfoDetail(ref model); //加载操作医生未负责患者列表 model.PatientList = GetPotentialPatientList(DoctorId); return View(model); } else { ViewBag.OperationInvalidFlag = "true"; //新建按钮的权限 //加载操作医生未负责患者列表 model.PatientList = GetPotentialPatientList(DoctorId); return View(model); } }
public ActionResult ModuleProfile(string PatientId, string Category) { var user = Session["CurrentUser"] as UserAndRole; string DoctorId = user.UserId; BasicProfileViewModel model = new BasicProfileViewModel(); model.Patient.UserId = PatientId; //加载患者基本信息 model.Patient = GetPatientBasicInfo(PatientId); #region 修改说明 //1 获取患者已购买的模块 //2 获取患者未购买的模块 //3 之前已购买和未购买是分别调用Ps和Cm表的方法做的,现在可以都调用Ps表中的方法,获取问卷信息 //4 不同模块的问卷分别加载,不要一次性加载,这样可以不用在前端做不同模块信息的同步,用JsonResult实现 //5 把模块信息相关的三个页面用同一种方式实现,方便以后的维护 //6 高血压和糖尿病模块的问卷只有二级标题,心衰模块还有三级标题以及显示控制的条目,需要再做修改 #endregion List<ModuleInfo> ModuleInfo = new List<Models.ModuleInfo>(); DataSet ModulesInfo = _ServicesSoapClient.GetModulesBoughtByPId(PatientId); foreach (DataTable item in ModulesInfo.Tables) { foreach (DataRow row in item.Rows) { ModuleInfo NewLine = new Models.ModuleInfo(); NewLine.Category = row[0].ToString(); NewLine.ModuleName = row[1].ToString(); ModuleInfo.Add(NewLine); } } model.ModuleBoughtInfo = ModuleInfo; ModuleInfo = new List<Models.ModuleInfo>(); ModulesInfo = _ServicesSoapClient.GetModulesUnBoughtByPId(PatientId); DataSet DoctorModule = _ServicesSoapClient.GetDoctorModuleList(DoctorId); List<string> DoctorModules = new List<string>(); foreach (DataRow item in DoctorModule.Tables[0].Rows) { DoctorModules.Add(item[0].ToString()); } foreach (DataTable item in ModulesInfo.Tables) { foreach (DataRow row in item.Rows) { if (DoctorModules.IndexOf(row[0].ToString()) != -1) { ModuleInfo NewLine = new Models.ModuleInfo(); NewLine.Category = row[0].ToString(); NewLine.ModuleName = row[1].ToString(); ModuleInfo.Add(NewLine); } } } model.ModuleUnBoughtInfo = ModuleInfo; List<PatientDetailInfo> ItemInfo = new List<PatientDetailInfo>(); DataSet ItemInfoSet = _ServicesSoapClient.GetItemInfoByPIdAndModule(PatientId, Category); bool InvalidFlag = false; foreach (DataTable item in ItemInfoSet.Tables) { foreach (DataRow row in item.Rows) { if (row[3].ToString() != "InvalidFlag" && row[3].ToString() != "Patient") { if (row[3].ToString() == "Doctor") { PatientDetailInfo NewLine = new PatientDetailInfo() { CategoryCode = row[1].ToString(), CategoryName = row[2].ToString(), ItemCode = row[3].ToString(), ItemName = row[4].ToString(), ParentCode = row[5].ToString(), ItemSeq = Convert.ToInt32(row[6]), Value = row[7].ToString(), Content = _ServicesSoapClient.GetUserName(row[7].ToString()) }; if (NewLine.Value == DoctorId) { NewLine.EditDeleteFlag = "true"; } else { NewLine.EditDeleteFlag = "false"; } ItemInfo.Add(NewLine); } else { PatientDetailInfo NewLine = new PatientDetailInfo() { ItemCode = row[3].ToString(), ItemName = row[4].ToString(), ParentCode = row[5].ToString(), ControlType = row[11].ToString(), OptionCategory = row[12].ToString(), ItemSeq = Convert.ToInt32(row[6]), Value = row[7].ToString(), Content = row[8].ToString(), GroupHeaderFlag = Convert.ToInt32(row[13]) }; if (NewLine.ControlType != "7") NewLine.OptionList = GetTypeList(NewLine.OptionCategory, NewLine.Value); //通过yesornoh和value,结合字典表,生成有值的下拉框 ItemInfo.Add(NewLine); } } else { if (row[3].ToString() == "InvalidFlag") InvalidFlag = (row[7].ToString() != ""); } } } model.ModuleDetailList = ItemInfo; model.InvalidFlag = InvalidFlag; //#region 从病人详细信息表中加载模块关注详细信息 //DataSet ItemInfoBoughtds = _ServicesSoapClient.GetPatBasicInfoDtlList(PatientId); //List<List<PatientDetailInfo>> ItemInfoBought = new List<List<PatientDetailInfo>>(); //ArrayList modulesBoughtCode = new ArrayList(); //ArrayList modulesBoughtName = new ArrayList(); //if (ItemInfoBoughtds!=null) //{ // foreach (DataTable datatable in ItemInfoBoughtds.Tables) // { // List<PatientDetailInfo> items = new List<PatientDetailInfo>(); // foreach (DataRow row in datatable.Rows) // { // if (row[3].ToString() != "InvalidFlag" && row[3].ToString() != "Patient") // { // if (row[3].ToString() == "Doctor") // { // PatientDetailInfo item = new PatientDetailInfo() // { // //PatientId = row[0].ToString(), // CategoryCode = row[1].ToString(), // CategoryName = row[2].ToString(), // ItemCode = row[3].ToString(), // ItemName = row[4].ToString(), // ParentCode = row[5].ToString(), // //ControlType = row[11].ToString(), // // OptionCategory = row[12].ToString(), // //OptionSelected = row[0].ToString(), // //OptionList = row[0], // ItemSeq = Convert.ToInt32(row[6]), // Value = row[7].ToString(), // //Content = row[9].ToString() // Content = _ServicesSoapClient.GetUserName(row[7].ToString()) // //Description = row[9].ToString() // }; // if (item.Value == DoctorId) // { // item.EditDeleteFlag = "true"; // } // else // { // item.EditDeleteFlag = "false"; // } // items.Add(item); // } // else // { // PatientDetailInfo item = new PatientDetailInfo() // { // //PatientId = row[0].ToString(), // CategoryCode = row[1].ToString(), // CategoryName = row[2].ToString(), // ItemCode = row[3].ToString(), // ItemName = row[4].ToString(), // ParentCode = row[5].ToString(), // ControlType = row[11].ToString(), // OptionCategory = row[12].ToString(), // //OptionSelected = row[0].ToString(), // //OptionList = row[0], // ItemSeq = Convert.ToInt32(row[6]), // Value = row[7].ToString(), // Content = row[8].ToString() // //Description = row[9].ToString() // }; // item.OptionList = GetTypeList(item.OptionCategory, item.Value); //通过yesornoh和value,结合字典表,生成有值的下拉框 // items.Add(item); // } // } // } // modulesBoughtCode.Add(items[0].CategoryCode); // modulesBoughtName.Add(items[0].CategoryName); // ItemInfoBought.Add(items); // } //} //model.PatientDetailInfo = ItemInfoBought; //#endregion return View(model); }