public ActionResult Index(string dfn, string filter, string page) { // *** Show list of dashboard notes by patient NoteListModel model = new NoteListModel(); model.Patient = this.CurrentPatient; int pageVal = this.GetPage(page); if (!model.Patient.NotFound) { // *** Set up the pregnancy list filter *** // *** Get the pregnancies *** List <PregnancyDetails> pregList = PregnancyUtilities.GetPregnancies(this.DashboardRepository, dfn); // *** Get the selection *** model.PregnancyFilters = PregnancyUtilities.GetPregnanciesSelection(pregList, true); // *** Get valid filter *** model.CurrentPregnancyFilter = PregnancyUtilities.GetValidatedPregnancyFilter(pregList, filter); // *** Set up pregIen for repo *** string pregIen = ""; int tempIen = -1; if (int.TryParse(model.CurrentPregnancyFilter, out tempIen)) { pregIen = model.CurrentPregnancyFilter; } // *** Build a list of titles *** List <TiuNoteTitle> titlesToInclude = new List <TiuNoteTitle>(); foreach (object val in Enum.GetValues(typeof(TiuNoteTitle))) { titlesToInclude.Add((TiuNoteTitle)val); } NoteListResult notesResult = this.DashboardRepository.Notes.GetNotesByTitle(titlesToInclude, dfn, pageVal, ItemsPerPage, pregIen); if (!notesResult.Success) { this.Error(notesResult.Message); } else { model.ProgressNotes = notesResult.Notes; model.ProgressNotePaging.SetPagingData(ItemsPerPage, pageVal, notesResult.TotalResults); model.ProgressNotePaging.BaseUrl = Url.Action("Index", new { dfn = dfn, filter = model.CurrentPregnancyFilter, page = "" }); TempData[ReturnUrl] = Url.Action("Index", new { dfn = dfn, filter = model.CurrentPregnancyFilter, page = pageVal }); } model.DetailAction = "Details"; } return(View(model)); }
public ActionResult CreateNote(string dfn) { // *** Create a new dashboard note *** TiuNoteModel model = new TiuNoteModel(); model.Patient = this.CurrentPatient; // *** Get a list of pregnancies *** List <PregnancyDetails> pregList = PregnancyUtilities.GetPregnancies(this.DashboardRepository, dfn); // *** Get pregnancy selection dictionary *** model.Pregnancies = PregnancyUtilities.GetPregnanciesSelection(pregList, false); // *** Default to current pregnancy *** foreach (PregnancyDetails preg in pregList) { if (preg.RecordType == PregnancyRecordType.Current) { model.Note.PregnancyIen = preg.Ien; } } // *** Set return url *** if (TempData.ContainsKey(ReturnUrl)) { model.ReturnUrl = TempData[ReturnUrl].ToString(); TempData[ReturnUrl] = TempData[ReturnUrl]; } return(View(model)); }
public ActionResult CreateNote(TiuNoteModel model) { // *** Post data *** ActionResult returnResult; bool needPatDemo = false; if (ModelState.IsValid) { BrokerOperationResult result = this.DashboardRepository.Notes.CreateNote(TiuNoteTitle.MccDashboardNote, model.Patient.Dfn, model.Note.NoteText, model.Note.Subject, new Dictionary <string, string>(), model.Note.PregnancyIen); if (!result.Success) { this.Error(result.Message); returnResult = View(model); needPatDemo = true; } else { this.Information("Dashboard Note Created"); returnResult = RedirectToAction("Index", new { dfn = model.Patient.Dfn, filter = model.Note.PregnancyIen, page = "1" }); needPatDemo = false; } } else { this.Error("Please enter note details"); returnResult = View(model); needPatDemo = true; } // *** Get patient demographics *** if (needPatDemo) { this.CurrentPatientDfn = model.Patient.Dfn; model.Patient = this.CurrentPatient; // *** Pregnancies are needed also *** // *** Get a list of pregnancies *** List <PregnancyDetails> pregList = PregnancyUtilities.GetPregnancies(this.DashboardRepository, this.CurrentPatientDfn); // *** Get pregnancy selection dictionary *** model.Pregnancies = PregnancyUtilities.GetPregnanciesSelection(pregList, false); } // *** Set return url *** if (TempData.ContainsKey(ReturnUrl)) { model.ReturnUrl = TempData[ReturnUrl].ToString(); TempData[ReturnUrl] = TempData[ReturnUrl]; } return(returnResult); }
public static Dictionary <string, string> GetPregnanciesSelection(IDashboardRepository repo, string dfn) { Dictionary <string, string> returnVal = new Dictionary <string, string>(); List <PregnancyDetails> pregList = PregnancyUtilities.GetPregnancies(repo, dfn); returnVal = PregnancyUtilities.GetPregnanciesSelection(pregList, false); return(returnVal); }
public ActionResult Details(string dfn, string ien) { // *** Show details of a dashboard note *** TiuNoteModel model = new TiuNoteModel(); model.Patient = this.CurrentPatient; if (!model.Patient.NotFound) { TiuNoteResult headerResult = this.DashboardRepository.Notes.GetNoteHeader(dfn, ien); if (headerResult.Success) { if (headerResult.Note == null) { this.Error("Could not retrieve note data"); } else { model.Note = headerResult.Note; TiuNoteResult noteResult = this.DashboardRepository.Notes.GetNote(ien); if (!noteResult.Success) { this.Error(noteResult.Message); } else { model.Note.NoteText = noteResult.Note.NoteText; } } } else { this.Error(headerResult.Message); } } // *** Get pregnancies *** List <PregnancyDetails> pregList = PregnancyUtilities.GetPregnancies(this.DashboardRepository, dfn); // *** Get pregnancy description *** if (!string.IsNullOrWhiteSpace(model.Note.PregnancyIen)) { foreach (PregnancyDetails preg in pregList) { if (preg.Ien == model.Note.PregnancyIen) { model.PregnancyDescription = preg.Description; } } } // *** Set default description *** if (string.IsNullOrWhiteSpace(model.PregnancyDescription)) { model.PregnancyDescription = PregnancyUtilities.NotAssociatedMessage; } // *** Set return url *** if (TempData.ContainsKey(ReturnUrl)) { model.ReturnUrl = TempData[ReturnUrl].ToString(); TempData[ReturnUrl] = TempData[ReturnUrl]; } return(View(model)); }