예제 #1
0
        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);
        }
예제 #2
0
        //编辑(现在用不着了)
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        //个人信息(可编辑)
        public static List<List<PatientDetailInfo>> GetPatientDetailInfoEdit(ServicesSoapClient _ServicesSoapClient, string UserId, string DoctorId)
        {

            DataSet set = _ServicesSoapClient.GetPatBasicInfoDtlList(UserId);  //获取关注的详细信息

            List<List<PatientDetailInfo>> zong1 = new List<List<PatientDetailInfo>>();

            foreach (DataTable ta in set.Tables)
            {
                List<PatientDetailInfo> items1 = new List<PatientDetailInfo>();
                foreach (System.Data.DataRow row in ta.Rows)
                {
                    if (row[3].ToString() != "InvalidFlag")
                    {
                        if (row[3].ToString() == "Doctor")
                        {


                            PatientDetailInfo one = new PatientDetailInfo
                            {
                                //PatientId = row[0].ToString(),
                                //CategoryCode = row[1].ToString(),               //主键  之后来自数据库(因为改变的只有value)
                                CategoryName = row[2].ToString(),         //界面
                                ItemCode = row[3].ToString(),             //界面 //主键    
                                ItemName = row[4].ToString(),             //界面
                                ParentCode = row[5].ToString(),           //界面
                                ControlType = row[11].ToString(),         //界面    //控制是下拉框还是自由文本(放在value里,description?)
                                OptionCategory = row[12].ToString(),               //yesorno
                                //OptionList = row[],?                             //下拉框(需选中)
                                ItemSeq = Convert.ToInt32(row[6]),              //主键  
                                Value = row[7].ToString(),
                                Content = _ServicesSoapClient.GetUserName(row[7].ToString()),           //界面
                                Description = row[9].ToString()
                                //int SortNo = Convert.ToInt32(row[10]); 
                            };

                            one.OptionList = GetTypeList(_ServicesSoapClient, one.OptionCategory, one.Value);  //通过yesornoh和value,结合字典表,生成有值的下拉框
                            if (one.Value == DoctorId)
                            {
                                one.EditDeleteFlag = "true";
                            }
                            else
                            {
                                one.EditDeleteFlag = "false";
                            }
                            items1.Add(one);
                        }

                        else
                        {
                            PatientDetailInfo one = new PatientDetailInfo
                            {
                                //PatientId = row[0].ToString(),
                                //CategoryCode = row[1].ToString(),               //主键  之后来自数据库(因为改变的只有value)
                                CategoryName = row[2].ToString(),         //界面
                                ItemCode = row[3].ToString(),             //界面 //主键    
                                ItemName = row[4].ToString(),             //界面
                                ParentCode = row[5].ToString(),           //界面
                                ControlType = row[11].ToString(),         //界面    //控制是下拉框还是自由文本(放在value里,description?)
                                OptionCategory = row[12].ToString(),               //yesorno
                                //OptionList = row[],?                             //下拉框(需选中)
                                ItemSeq = Convert.ToInt32(row[6]),              //主键  
                                Value = row[7].ToString(),
                                Content = row[8].ToString(),             //界面
                                Description = row[9].ToString()
                                //int SortNo = Convert.ToInt32(row[10]); 
                            };
                            one.OptionList = GetTypeList(_ServicesSoapClient, one.OptionCategory, one.Value);  //通过yesornoh和value,结合字典表,生成有值的下拉框
                            items1.Add(one);
                        }
                    }
                }
                zong1.Add(items1);
            }
            return zong1;
        }
예제 #7
0
 //个人信息(不可编辑)
 public static List<PatientDetailInfo> GetPatientDetailInfo(ServicesSoapClient _ServicesSoapClient, string UserId, string Category)
 {
     List<PatientDetailInfo> ItemInfo = new List<PatientDetailInfo>();
     DataSet ItemInfoSet = _ServicesSoapClient.GetItemInfoByPIdAndModule(UserId, Category);
     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())
                     };
                     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(_ServicesSoapClient, NewLine.OptionCategory, NewLine.Value);  //通过yesornoh和value,结合字典表,生成有值的下拉框
                     ItemInfo.Add(NewLine);
                 }
             }
         }
     }
     return ItemInfo;
 }
예제 #8
0
        //个人信息(不可编辑)
        public static List<List<PatientDetailInfo>> GetPatientDetailInfo(ServicesSoapClient _ServicesSoapClient, string UserId)
        {
            DataSet set = _ServicesSoapClient.GetPatBasicInfoDtlList(UserId);  //获取关注的详细信息

            List<List<PatientDetailInfo>> zong1 = new List<List<PatientDetailInfo>>();

            foreach (DataTable ta in set.Tables)
            {
                List<PatientDetailInfo> items1 = new List<PatientDetailInfo>();
                foreach (System.Data.DataRow row in ta.Rows)
                {
                    if (row[3].ToString() != "InvalidFlag")
                    {
                        PatientDetailInfo one = new PatientDetailInfo();
                        if (row[3].ToString() == "Doctor")
                        {
                            one = 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()
                            };
                        }
                        else
                        {
                            one = 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()
                            };

                        }
                        items1.Add(one);
                    }

                }
                zong1.Add(items1);
            }

            return zong1;
        }
예제 #9
0
        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);
        }