//病患資料主畫面 public ActionResult Index() { ViewBag.item = TempData["item"].ToString(); ViewBag.item_MedDose = TempData["item_MedDose"].ToString(); ViewBag.item_medTime = TempData["item_medTime"].ToString(); ViewBag.P_ID = Session["PatientID"]; PresentModel p = new PresentModel(); //抓側邊欄藥物名稱 IEnumerable <PresentViewModel> vm_med = p.GetMed(Session["PatientID"].ToString()); return(View(vm_med)); }
public ActionResult index() { PresentModel p = new PresentModel(); //IEnumerable<PresentViewModel> vm_PatientID = p.GetPatientID(); //string jsonSeries_PatientID = JsonConvert.SerializeObject(vm_PatientID); //ViewBag.item_PatientID = jsonSeries_PatientID; IEnumerable <PresentViewModel> vm_Patient = p.GetPatient(); string jsonSeries = JsonConvert.SerializeObject(vm_Patient); ViewBag.item = jsonSeries; IEnumerable <PresentViewModel> vm2 = p.GetMed_Dormicum(); string jsonSeries2 = JsonConvert.SerializeObject(vm2); ViewBag.item2 = jsonSeries2; IEnumerable <PresentViewModel> vm3 = p.GetMed_TARGO(); string jsonSeries3 = JsonConvert.SerializeObject(vm3); ViewBag.item3 = jsonSeries3; IEnumerable <PresentViewModel> vm4 = p.GetMed_MEPE2(); string jsonSeries4 = JsonConvert.SerializeObject(vm4); ViewBag.item4 = jsonSeries4; IEnumerable <PresentViewModel> vm_MedRecord = p.GetMedRecord(); string jsonSerie_MedRecord = JsonConvert.SerializeObject(vm_MedRecord); ViewBag.item_MedRecord = jsonSerie_MedRecord; IEnumerable <PresentViewModel> vm_med = p.GetMed(); return(View(vm_med)); }
//For TEST public ActionResult IndexTest() { PresentModel p = new PresentModel(); //病患資料 IEnumerable <PresentViewModel> getPatientData = p.GetPIDTest(); string jsonSeries = JsonConvert.SerializeObject(getPatientData); ViewBag.item = jsonSeries; //要跨Action要使用TempData才能記住資料 //病患藥物劑量 List <Dictionary <string, object> > mRet_Dose = new List <Dictionary <string, object> >(); mRet_Dose = p.GetMedDoseTest(); List <Dictionary <string, object> > samedateDose = new List <Dictionary <string, object> >(); for (int i = 0; i < mRet_Dose.Count; i++) { if (samedateDose.Count == 0) { Dictionary <string, object> dict = new Dictionary <string, object>(); //拿MedPRS的時間 dict.Add("MedPRS", mRet_Dose[i]["MedPRS"]); dict.Add("Time13", mRet_Dose[i]["Time13"]); dict.Add("Dose", mRet_Dose[i]["Dose"]); dict.Add("DoseUnit", mRet_Dose[i]["DoseUnit"]); dict.Add("MedPRS_Name", mRet_Dose[i]["MedPRS_Name"]); samedateDose.Add(dict); } else { var mRet_DoseCount = samedateDose.Count; bool IsExist = false; for (int n = 0; n < mRet_DoseCount; n++) { if (samedateDose[n].ContainsValue(mRet_Dose[i]["MedPRS"]) && samedateDose[n].ContainsValue(mRet_Dose[i]["Time13"])) { IsExist = true; samedateDose[n]["Dose"] = float.Parse(samedateDose[n]["Dose"].ToString()) + float.Parse(mRet_Dose[i]["Dose"].ToString()); break; } else { IsExist = false; } } if (IsExist == false) { Dictionary <string, object> dict = new Dictionary <string, object>(); //拿MedPRS的時間 dict.Add("MedPRS", mRet_Dose[i]["MedPRS"]); dict.Add("Time13", mRet_Dose[i]["Time13"]); dict.Add("Dose", mRet_Dose[i]["Dose"]); dict.Add("DoseUnit", mRet_Dose[i]["DoseUnit"]); dict.Add("MedPRS_Name", mRet_Dose[i]["MedPRS_Name"]); samedateDose.Add(dict); } } } string jsonSeries_mRet_Dose = JsonConvert.SerializeObject(samedateDose); ViewBag.item_MedDose = jsonSeries_mRet_Dose; //病歷時間 List <string> vm_medTime = p.GetMedTimeTest(); string medTimeStr = ""; for (int i = 0; i < vm_medTime.Count; i++) { if (i == 0) { medTimeStr = "[ { x:" + vm_medTime[i] + ", title:'R' }"; } else if (i == (vm_medTime.Count - 1)) { medTimeStr = medTimeStr + ",{ x:" + vm_medTime[i] + ", title:'R' }]"; } else { medTimeStr = medTimeStr + ",{ x:" + vm_medTime[i] + ", title:'R'}"; } } ViewBag.item_medTime = medTimeStr; Session["PatientID"] = "321"; ViewBag.P_ID = Session["PatientID"]; //抓側邊欄藥物名稱 var teststr = "321"; IEnumerable <PresentViewModel> vm_med = p.GetMed(teststr); return(View(vm_med)); }