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 InfoItem() { InfoItemViewModel infoitemview = new InfoItemViewModel(); DataSet info = _ServicesSoapClient.GetInfoItem(); foreach (DataRow row in info.Tables[0].Rows) { InfoItem infoiteminfo = new InfoItem(); infoiteminfo.CategoryCode = row[0].ToString(); infoiteminfo.Code = row[1].ToString(); infoiteminfo.Name = row[2].ToString(); infoiteminfo.ParentCode = row[3].ToString(); infoiteminfo.SortNo = Convert.ToInt32(row[4]); infoiteminfo.ControlCode = row[8].ToString(); if (infoiteminfo.ControlCode != "") { infoiteminfo.ControlType = _ServicesSoapClient.GetMstTypeName("ControlType", Convert.ToInt32(infoiteminfo.ControlCode)); } else { infoiteminfo.ControlType = ""; } infoiteminfo.OptionCategory = row[9].ToString(); infoitemview.InfoItemList.Add(infoiteminfo); } return View(infoitemview); }
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); }