private void ExecuteUpcomingPatientSelectedCommand(PatientScheduleItem psri) { var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; localSettings.Values["CurrentPatientID"] = psri.ID; ShowViewModel<PatientOverviewViewModel>(); }
private void ExecuteRecentPatientSelectedCommand(PatientScheduleItem psri) { //var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; //localSettings.Values["CurrentPatientID"] = psri.ID; PageNavigationService pns = new PageNavigationService(); pns.PatientID = psri.ID; ShowViewModel<PatientOverviewViewModel>(); }
/// <summary> /// /// </summary> /// <param name="sAppUser"></param> /// <param name="patientID"></param> /// <returns></returns> public async Task<PatientScheduleItem> GetPatientHub(string sAppUser, string patientID) { PatientScheduleItem patienthub = new PatientScheduleItem(); string sJson = await UnityDataService.Magic(UnityDataAccessActions.GetPatient, sAppUser, UnityDataService.UnityAppName, patientID, UnityDataService.Token, "Y", "png", "100", "100", "", "", ""); JArray obj = Newtonsoft.Json.Linq.JArray.Parse(sJson); foreach (JObject jo in obj) { JToken table = jo.SelectToken("getpatientinfo", false); if (!table.ToString().Equals(UnityDataService.EMPTY_JSON_TABLE)) { foreach (JToken joRow in table) { //ID lastname firstname middlename gender dateofbirth ssn AddressLine1 AddressLine2 City State ZipCode HomePhone WorkPhone PhoneNumber ageMRNOtherNumber orgid patienthub.ID = joRow["ID"].ToString(); patienthub.shortTitle = joRow["LastName"].ToString().ToUpper() + ", " + joRow["Firstname"].ToString(); patienthub.FirstName = joRow["Firstname"].ToString(); patienthub.LastName = joRow["LastName"].ToString(); patienthub.LastFI = joRow["LastName"].ToString(); if (joRow["Firstname"].ToString().Length > 0) { patienthub.LastFI = patienthub.LastFI + ", " + joRow["Firstname"].ToString().Substring(0, 1); } string gender = (joRow["gender"].ToString().ToLower().Equals("male") ? "M" : "F"); if (gender.Equals("M")) { patienthub.GenderPathGray = @"/Assets/gender/male_gray_small.png"; patienthub.GenderPathWhite = @"/Assets/gender/male_white_small.png"; patienthub.GenderPathBlack = @"/Assets/gender/male_black_small.png"; } else { patienthub.GenderPathGray = @"/Assets/gender/female_gray_small.png"; patienthub.GenderPathWhite = @"/Assets/gender/female_white_small.png"; patienthub.GenderPathBlack = @"/Assets/gender/female_black_small.png"; } // if (joRow["age"].ToString().Length > 2) // { // patienthub.Age = joRow["age"].ToString().Substring(0, 2); // } // else // { patienthub.Age = joRow["age"].ToString(); // } string base64string = joRow["base64image"].ToString(); if (!string.IsNullOrEmpty(base64string)) //Note: always set to empty.string { Utility util = new Utility(); patienthub.Img = await util.Base64ToBitmapImage(joRow["base64image"].ToString()); } List<ChartSectionItem> lstChartSection = await GetChartSections(UnityDataService.UnityAppUser, patientID, "problems"); int upperBounds = lstChartSection.Count - 1; for (int i = 0; i < upperBounds & i < 4; i++) //we only want the first 4 items { switch (i) { case 0: patienthub.problem1 = lstChartSection[i].expdescription; //description; break; case 1: patienthub.problem2 = lstChartSection[i].expdescription; //description; break; case 2: patienthub.problem3 = lstChartSection[i].expdescription; //description; break; case 3: patienthub.problem4 = lstChartSection[i].expdescription; //description; break; default: break; } } } } } return patienthub; }
/// <summary> /// /// </summary> /// <param name="sAppUser"></param> /// <returns></returns> public async Task<List<PatientScheduleItem>> GetRecentPatientsHub(string sAppUser) { List<PatientScheduleItem> patientList = new List<PatientScheduleItem>(); string sJson = await UnityDataService.Magic(UnityDataAccessActions.GetRecentPatients, sAppUser, UnityDataService.UnityAppName, "", UnityDataService.Token, "", "", "", "", "", "", ""); string patientID = string.Empty; JArray obj = Newtonsoft.Json.Linq.JArray.Parse(sJson); foreach (JObject jo in obj) { JToken table = jo.SelectToken("getrecentpatientsinfo", false); if (!table.ToString().Equals(UnityDataService.EMPTY_JSON_TABLE)) { int i = 0; foreach (JToken joRow in table) { if (i < 3) { PatientScheduleItem patient = new PatientScheduleItem(); patientID = joRow["ID"].ToString(); patient = await GetPatientHub(UnityDataService.UnityAppUser, patientID); patientList.Add(patient); i++; } } } } return patientList; }
/// <summary> /// /// </summary> /// <param name="appUser"></param> /// <param name="ScheduleDate"></param> /// <param name="meridian"></param> /// <returns></returns> /// <author>BD 20120823</author> /// <revisions></revisions> public async Task<List<PatientScheduleItem>> GetSchedule(string appUser, string ScheduleDate, string meridian, bool includeProblems) { List<PatientScheduleItem> lstPatients = new List<PatientScheduleItem>(); int hour; UnityDataAccess uda = new UnityDataAccess(); string sJson = await uda.Magic("GetSchedule", appUser, objUnityData.UnityAppName, "", objUnityData.Token, ScheduleDate, null, "Y", "", "", "", ""); int appointmentCount = 0; JArray obj = Newtonsoft.Json.Linq.JArray.Parse(sJson); foreach (JObject jo in obj) { JToken table = jo.SelectToken("getscheduleinfo", false); if (!table.ToString().Equals(objUnityData.EMPTY_JSON_TABLE)) { foreach (JToken joRow in table) { if (joRow["ApptTime"].ToString().Length > 0) { hour = int.Parse(joRow["ApptTime"].ToString().Substring(0,2)); string recordMeridian = "am"; if (hour > 11) { recordMeridian = "pm"; } //Filter by requested Meridian || or No filter if (meridian.ToLower().Equals(recordMeridian) || meridian.Length.Equals(0)) { PatientScheduleItem patient = new PatientScheduleItem(); patient.OrderKey = appointmentCount; switch (hour) { case 0: case 12: patient.DisplayHour = "12:00 " + recordMeridian; break; case 1: case 13: patient.DisplayHour = "1:00 " + recordMeridian; break; case 2: case 14: patient.DisplayHour = "12:00 " + recordMeridian; break; case 3: case 15: patient.DisplayHour = "3:00 " + recordMeridian; break; case 4: case 16: patient.DisplayHour = "4:00 " + recordMeridian; break; case 5: case 17: patient.DisplayHour = "5:00 " + recordMeridian; break; case 6: case 18: patient.DisplayHour = "6:00 " + recordMeridian; break; case 7: case 19: patient.DisplayHour = "7:00 " + recordMeridian; break; case 8: case 20: patient.DisplayHour = "8:00 " + recordMeridian; break; case 9: case 21: patient.DisplayHour = "9:00 " + recordMeridian; break; case 10: case 22: patient.DisplayHour = "10:00 " + recordMeridian; break; case 11: case 23: patient.DisplayHour = "11:00 " + recordMeridian; break; default: break; } patient.ID = joRow["patientID"].ToString(); if (joRow["ApptTime"].ToString().Length > 0) { patient.ApptTime = patient.DisplayHour; } string middleName = string.Empty; if (joRow["patientmiddlename"].ToString().Length > 0) { middleName = joRow["patientmiddlename"].ToString(); } patient.shortTitle = joRow["PatientLastName"].ToString() + ", " + joRow["PatientFirstName"].ToString() + " " + middleName; patient.LastName = joRow["PatientLastName"].ToString() + ", "; patient.FirstName = joRow["PatientFirstName"].ToString(); patient.LastFI = patient.LastName + patient.FirstName.Substring(0, 1); PatientItem pi = await GetPatient(appUser,patient.ID,true); if (pi.Subtitle.Length > 0) { if (pi.GenderPath.ToLower().Contains("male")) { patient.GenderPathBlack = "/Assets/gender/male_black_small.png"; patient.GenderPathGray = "/Assets/gender/male_grey_small.png"; patient.GenderPathWhite = "/Assets/gender/male_white_small.png"; } else { patient.GenderPathBlack = "/Assets/gender/female_black_small.png"; patient.GenderPathGray = "/Assets/gender/female_grey_small.png"; patient.GenderPathWhite = "/Assets/gender/female_white_small.png"; } } patient.Age = pi.Age; if (joRow["Status"].ToString().Length > 0) { string status = joRow["Status"].ToString(); if (status == "Arr") { patient.checkedinpathgray = "/Assets/checkedin/checkedin_gray_large.png"; patient.checkedinpathwhite = "/Assets/checkedin/checkedin_white_large.png"; } } if (joRow["SchedComment"].ToString().Length > 0) { patient.Note = joRow["SchedComment"].ToString(); } else { patient.Note = " "; } if (pi.Img != null) //Note: always set to empty.string { patient.Img = pi.Img; } if (includeProblems && appointmentCount < 3) { List<ChartSectionItem> lstChartSection = await GetChartSections(appUser, patient.ID, "problems"); int upperBounds = lstChartSection.Count - 1; for (int i = 0; i < upperBounds & i < 4; i++) //we only want the first 4 items { switch (i) { case 0: patient.problem1 = lstChartSection[i].description; break; case 1: patient.problem2 = lstChartSection[i].description; break; case 2: patient.problem3 = lstChartSection[i].description; break; case 3: patient.problem4 = lstChartSection[i].description; break; default: break; } } } appointmentCount++; lstPatients.Add(patient); } //meridian filter }//no hour - then no play } //loop } //end if }//loop return lstPatients; }