public ActionResult PatientDetail(string dfn, string ien) { ActionResult returnResult; PatientEducationItemDetail model = new PatientEducationItemDetail(); model.Patient = this.CurrentPatient; if (!string.IsNullOrWhiteSpace(ien)) { PatientEducationItemsResult result = this.DashboardRepository.Education.GetPatientItems(dfn, ien, DateTime.MinValue, DateTime.MinValue, EducationItemType.Unknown, 0, 0); if (!result.Success) { this.Error(result.Message); } else if (result.Items != null) { if (result.Items.Count > 0) { model.Item = result.Items[0]; } } returnResult = View(model); } else { returnResult = RedirectToAction("PatientIndex", new { dfn = dfn }); } return(returnResult); }
private List <PatientEducationItem> GetEducationItems(string dfn, DateTime fromDate, DateTime toDate) { List <PatientEducationItem> returnList = new List <PatientEducationItem>(); PatientEducationItemsResult edResult = this.dashboardRepository.Education.GetPatientItems(dfn, "", fromDate, toDate, EducationItemType.Unknown, 1, 1000); if (edResult.Success) { returnList = edResult.Items; } return(returnList); }
public ActionResult PatientAddEdit(string dfn, string ien) { PatientEducationAddEdit model = new PatientEducationAddEdit(); model.Patient = this.CurrentPatient; if (!string.IsNullOrWhiteSpace(ien)) { PatientEducationItemsResult result = this.DashboardRepository.Education.GetPatientItems( dfn, ien, DateTime.MinValue, DateTime.MinValue, EducationItemType.Unknown, 0, 0); if (!result.Success) { this.Error(result.Message); } else if (result.Items != null) { if (result.Items.Count > 0) { model.Item = result.Items[0]; } } } else { model.Item.PatientDfn = dfn; } model.ItemTypeSelection = GetItemTypeSelection(); return(View(model)); }
private void GetPatientEducationItemList(PatientEducationIndex model) { // *** Get patient education items *** PatientEducationItemsResult edResult = this.DashboardRepository.Education.GetPatientItems( model.Patient.Dfn, "", DateTime.MinValue, DateTime.MinValue, EducationItemType.Unknown, 1, 1000 ); if (!edResult.Success) { this.Error(edResult.Message); } else { if (edResult.Items != null) { foreach (PatientEducationItem patEdItem in edResult.Items) { PatientEducationChecklistItem newItem = new PatientEducationChecklistItem(); newItem.PatientEducationItem = patEdItem; model.ItemList.Add(newItem); } } model.ItemList.Sort(delegate(PatientEducationChecklistItem x, PatientEducationChecklistItem y) { return(x.CompareDate.CompareTo(y.CompareDate)); }); } }
private void GetMergedList(PatientEducationIndex model, PregnancyDetails preg) { PregnancyChecklistItemsResult result = this.DashboardRepository.Checklist.GetPregnancyItems(model.Patient.Dfn, preg.Ien, ""); if (!result.Success) { this.Error(result.Message); } else { // *** Create view items *** if (result.Items != null) { foreach (PregnancyChecklistItem item in result.Items) { if (item.ItemType == DsioChecklistItemType.EducationItem) { PatientEducationChecklistItem newItem = new PatientEducationChecklistItem(); newItem.PregnancyChecklistItem = item; model.ItemList.Add(newItem); } } } // *** Get patient education items *** PatientEducationItemsResult edResult = this.DashboardRepository.Education.GetPatientItems( model.Patient.Dfn, "", DateTime.MinValue, DateTime.MinValue, EducationItemType.Unknown, 1, 1000 ); if (!edResult.Success) { this.Error(edResult.Message); } else { Dictionary <string, PatientEducationItem> patEdItems = new Dictionary <string, PatientEducationItem>(); // *** Place patient education items in dictionary for lookup *** if (edResult.Items != null) { foreach (PatientEducationItem patEdItem in edResult.Items) { patEdItems.Add(patEdItem.Ien, patEdItem); } } // *** Go through checklist to find links to patient education *** foreach (PatientEducationChecklistItem finalItem in model.ItemList) { if (finalItem.PregnancyChecklistItem != null) { if (finalItem.PregnancyChecklistItem.CompletionStatus == DsioChecklistCompletionStatus.Complete) { if (!string.IsNullOrWhiteSpace(finalItem.PregnancyChecklistItem.CompletionLink)) { if (patEdItems.ContainsKey(finalItem.PregnancyChecklistItem.CompletionLink)) { // *** If found add to final *** finalItem.PatientEducationItem = patEdItems[finalItem.PregnancyChecklistItem.CompletionLink]; // *** Remove since already added *** patEdItems.Remove(finalItem.PregnancyChecklistItem.CompletionLink); } } } } } // *** Now that we've added all items that are linked, add remainder *** foreach (PatientEducationItem patEdItem in patEdItems.Values) { PatientEducationChecklistItem newItem = new PatientEducationChecklistItem(); newItem.PatientEducationItem = patEdItem; model.ItemList.Add(newItem); } // *** Finally get education items linked by a checklist but incomplete *** foreach (PatientEducationChecklistItem finalItem in model.ItemList) { if (finalItem.PregnancyChecklistItem != null) { if (finalItem.PregnancyChecklistItem.CompletionStatus != DsioChecklistCompletionStatus.Complete) { if (!string.IsNullOrWhiteSpace(finalItem.Link)) { EducationItemsResult edItemsResult = this.DashboardRepository.Education.GetEducationItems(finalItem.Link, "", EducationItemType.Unknown, 0, 0, EducationItemSort.Type); if (edItemsResult.Success) { if (edItemsResult.EducationItems != null) { if (edItemsResult.EducationItems.Count > 0) { finalItem.EducationItem = edItemsResult.EducationItems[0]; } } } } } } } } model.ItemList.AddPregnancyDates(preg.EDD, preg.EndDate); model.ItemList.Sort(delegate(PatientEducationChecklistItem x, PatientEducationChecklistItem y) { return(x.CompareDate.CompareTo(y.CompareDate)); }); } }