//求助医生 public ActionResult QuestionDoctor(string PatientId) { try { var user = Session["CurrentUser"] as UserAndRole; QuestionDoctorViewModel MMVM = new QuestionDoctorViewModel(); if (PatientId != null && PatientId != "") { MMVM.PatientId = PatientId; List<HealthCoach> dclist = new List<HealthCoach>(); 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=" + user.UserId).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); HealthCoach dc = new HealthCoach() { ItemSeq = "", HealthCoachId = "0", HealthCoachName = "", HCDivName = Detail[1], DataTableName = Detail[3], HealthCoachList = GetHealthCoachInfoList("Doctor") }; dclist.Add(dc); } } } MMVM.HealthCoachInfoList = dclist; MMVM.HealthCoachList = GetHealthCoachInfoList("Doctor"); } return View(MMVM); } catch (Exception ex) { throw ex; } }
public List<HealthCoach> GetHealthCareList(string PatientId) { List<HealthCoach> hclist = new List<HealthCoach>(); DataTable hcOfPat = _ServicesSoapClient.GetConForPatient(PatientId, "HC").Tables[0]; foreach (DataRow row in hcOfPat.Rows) { HealthCoach hc = new HealthCoach() { ItemSeq = row[2].ToString(), HealthCoachId = row[0].ToString(), HealthCoachName = _ServicesSoapClient.GetUserName(row[0].ToString()), HCDivName = "HC" + row[2].ToString() + "Div", DataTableName = "HC" + row[2].ToString() + "DataTable", HealthCoachList = GetHealthCoachInfoList("HealthCoach") }; hclist.Add(hc); } if (hclist.Count == 0) { hclist.Add(new HealthCoach { ItemSeq = "1", HealthCoachId = "0", HealthCoachName = "", HCDivName = "HC1Div", DataTableName = "HC1DataTable", HealthCoachList = GetHealthCoachInfoList("HealthCoach") }); } return hclist; }