private BrokerOperationResult CompleteItem(PregnancyChecklistItem item) { BrokerOperationResult result = new BrokerOperationResult(); switch (item.ItemType) { // *** For education items, create the education item, and complete the checklist item *** case DsioChecklistItemType.EducationItem: result = ChecklistUtility.CompleteEducationItem( this.DashboardRepository, item.PatientDfn, item.EducationItemIen, item.Ien); break; // *** For all other items, complete the checklist item *** default: result = this.DashboardRepository.Checklist.CompletePregnancyItem(item); break; } // *** Update the next checklist date *** if (result.Success) { result = ChecklistUtility.UpdateNextDates(this.DashboardRepository, item.PatientDfn, item.PregnancyIen); } return(result); }
private ActionResult PostDeletePregItem(PregnancyChecklistIndex model) { if (string.IsNullOrWhiteSpace(model.SelectedItemIen)) { this.Error("Please select an item to delete"); } else { BrokerOperationResult result = this.DashboardRepository.Checklist.DeletePregnancyItem(model.Patient.Dfn, model.SelectedItemIen); if (!result.Success) { this.Error(result.Message); } else { this.Information("The item has been deleted"); // *** Update the next checklist date *** BrokerOperationResult updResult = ChecklistUtility.UpdateNextDates(this.DashboardRepository, model.Patient.Dfn, model.Pregnancy.Ien); if (!updResult.Success) { this.Error("Error updating next dates: " + updResult.Message); } } } return(RedirectToAction("PregnancyIndex", new { dfn = model.Patient.Dfn, pregIen = model.Pregnancy.Ien })); }
public ActionResult PatientAddEdit(PatientEducationAddEdit model) { ActionResult returnResult; model.Item.CompletedOn = DateTime.Now; BrokerOperationResult result = this.DashboardRepository.Education.SavePatientItem(model.Item); if (!result.Success) { this.Error(result.Message); this.CurrentPatientDfn = model.Patient.Dfn; model.Patient = this.CurrentPatient; model.ItemTypeSelection = GetItemTypeSelection(); returnResult = View(model); } else { returnResult = RedirectToAction("PatientIndex", new { page = "1" }); } return(returnResult); }
private ActionResult PostCancel(PregnancyChecklistIndex model) { PregnancyChecklistItemResult opResult = this.DashboardRepository.Checklist.GetPregnancyItem(model.Patient.Dfn, model.SelectedItemIen); if (!opResult.Success) { this.Error(opResult.Message); } else { PregnancyChecklistItem item = opResult.Item; BrokerOperationResult updateResult = this.DashboardRepository.Checklist.CancelPregnancyItem(item); if (!updateResult.Success) { this.Error(updateResult.Message); } else { // *** Update the next checklist date *** BrokerOperationResult result = ChecklistUtility.UpdateNextDates(this.DashboardRepository, item.PatientDfn, item.PregnancyIen); if (!result.Success) { this.Error("Error updating next dates: " + result.Message); } } } return(RedirectToAction("PregnancyIndex", new { dfn = model.Patient.Dfn, pregIen = model.Pregnancy.Ien, page = model.Paging.CurrentPage })); }
private void DeleteAll() { EducationItemsResult result = this.DashboardRepository.Education.GetEducationItems("", "", EducationItemType.Unknown, -1, -1, EducationItemSort.Category); if (result.Success) { BrokerOperationResult delResult = null; foreach (EducationItem item in result.EducationItems) { delResult = this.DashboardRepository.Education.DeleteEducationItem(item.Ien); if (!delResult.Success) { break; } } if (delResult != null) { if (!delResult.Success) { this.Error(delResult.Message); } } else { this.Information("All items deleted"); } } }
//public ChangeVerifyCodeData ChangeVerifyCode(ChangeVerifyCodeData changeVerifyCodeData) //{ // if (this.broker != null) // { // XusCvcCommand cvcCommand = new XusCvcCommand(this.broker, changeVerifyCodeData.OriginalVerifyCode, changeVerifyCodeData.NewVerifyCode, changeVerifyCodeData.ConfirmVerifyCode); // cvcCommand.Execute(); // if (cvcCommand.Response.Status == ResponseStatus.Success) // changeVerifyCodeData.SetLastOperation(true, cvcCommand.Response.InformationalMessage); // else // changeVerifyCodeData.SetLastOperation(false, cvcCommand.Response.InformationalMessage); // } // else // changeVerifyCodeData.SetLastOperation(false, "No valid connection"); // return changeVerifyCodeData; //} public BrokerOperationResult ChangeVerifyCode(ChangeVerifyCode changeVerifyCodeData) { BrokerOperationResult returnResult = new BrokerOperationResult(); if (this.broker != null) { XusCvcCommand cvcCommand = new XusCvcCommand(this.broker); // *** Make sure everything is upper case *** changeVerifyCodeData.OriginalVerifyCode = changeVerifyCodeData.OriginalVerifyCode.ToUpper().Trim(); changeVerifyCodeData.NewVerifyCode = changeVerifyCodeData.NewVerifyCode.ToUpper().Trim(); changeVerifyCodeData.ConfirmVerifyCode = changeVerifyCodeData.ConfirmVerifyCode.ToUpper().Trim(); cvcCommand.AddCommandArguments(changeVerifyCodeData.OriginalVerifyCode, changeVerifyCodeData.NewVerifyCode, changeVerifyCodeData.ConfirmVerifyCode); RpcResponse response = cvcCommand.Execute(); if (response.Status == RpcResponseStatus.Success) { returnResult.SetResult(true, cvcCommand.Response.InformationalMessage); } else { string message = string.IsNullOrWhiteSpace(cvcCommand.Response.InformationalMessage) ? "An unspecified error has occurred" : cvcCommand.Response.InformationalMessage; returnResult.SetResult(false, message); } } else { returnResult.SetResult(false, "No valid connection"); } return(returnResult); }
public BrokerOperationResult TestServerConnection(string serverName, string serverPort) { BrokerOperationResult returnResult = new BrokerOperationResult(); int port = 0; if (int.TryParse(serverPort, out port)) { //using (RpcBroker broker = new RpcBroker(serverName, port)) ServerConfig config = new ServerConfig() { ServerName = serverName, ListenerPort = port }; IRpcBroker broker = RpcBrokerUtility.GetNewConnectedRpcBroker(config); if (broker != null) { returnResult.SetResult(true, ""); broker.Disconnect(); } } return(returnResult); }
public ActionResult AddEdit(EducationItemAddEditModel model) { ActionResult returnResult; BrokerOperationResult result = this.DashboardRepository.Education.SaveEducationItem(model.Item); if (!result.Success) { this.Error(result.Message); model.ItemTypeSelection = GetItemTypeSelection(); // *** Load category selection box *** model.CategorySelection = GetCategorySelection(); // *** Clear previously selected *** model.SelectedCategory = ""; returnResult = View(model); } else { returnResult = RedirectToAction("Index", new { page = "1" }); } return(returnResult); }
public ActionResult ProcessEditGet(ServerConfig serverConfig, bool validModelState) { // *** Edit the server settings data *** ActionResult returnResult; // *** Check the model state *** if (ModelState.IsValid) { // *** Save the data *** BrokerOperationResult opResult = this.DashboardRepository.Settings.SetServerData(serverConfig); if (opResult.Success) { // *** If good, then show info ** this.Information("Server Settings Saved"); returnResult = RedirectToAction("Dashboard", "PatientList"); } else { // *** Show error message *** this.Error("Server settings could not be saved"); // *** Return to same view *** returnResult = View(serverConfig); } } else { returnResult = View(serverConfig); } return(returnResult); }
public BrokerOperationResult SaveSingletonObservations(List <Observation> observationList) { // *** Saves a list of singleton observations and halts if an error is encountered *** BrokerOperationResult returnResult = new BrokerOperationResult(); int i = 0; bool okToContinue = true; // *** Loop through the observations *** while ((i < observationList.Count) && (okToContinue)) { // *** Get the current *** Observation observation = observationList[i]; returnResult = this.SaveSingletonObservation(observation); // *** Continue if successful *** okToContinue = returnResult.Success; // *** Set index to next *** i++; } return(returnResult); }
//private PregnancyDetails GetChecklistPregnancy(string dfn, string pregIen) //{ // PregnancyDetails returnVal = null; // // *** First try the pregnancy ien passed in *** // if (!string.IsNullOrWhiteSpace(pregIen)) // { // PregnancyListResult pregResult = this.DashboardRepository.Pregnancy.GetPregnancies(dfn, pregIen); // if (pregResult.Success) // if (pregResult.Pregnancies != null) // if (pregResult.Pregnancies.Count > 0) // returnVal = pregResult.Pregnancies[0]; // } // // *** Then try to get the current/most-recent *** // if (returnVal == null) // { // PregnancyResult pregResult = this.DashboardRepository.Pregnancy.GetCurrentOrMostRecentPregnancy(dfn); // if (pregResult.Success) // returnVal = pregResult.Pregnancy; // } // return returnVal; //} private ActionResult ClearAllItems() { ChecklistItemsResult getResult = this.DashboardRepository.Checklist.GetItems("", 1, 1000); if (getResult.Success) { BrokerOperationResult delResult = null; foreach (ChecklistItem item in getResult.Items) { delResult = this.DashboardRepository.Checklist.DeleteItem(item.Ien); if (!delResult.Success) { this.Error(delResult.Message); break; } } if (delResult != null) { if (delResult.Success) { this.Information("Deleted all"); } } } return(RedirectToAction("Index", new { page = "1" })); }
private bool UpdatePregnancyStatus(string dfn) { bool returnVal = false; PregnancyResult pregResult = this.DashboardRepository.Pregnancy.GetCurrentPregnancy(dfn); if (!pregResult.Success) { this.Error(pregResult.Message); } else if (pregResult.Pregnancy == null) { PregnancyDetails newPreg = new PregnancyDetails(); newPreg.PatientDfn = dfn; newPreg.RecordType = PregnancyRecordType.Current; BrokerOperationResult result = this.DashboardRepository.Pregnancy.SavePregnancy(newPreg); if (!result.Success) { this.Error(result.Message); } else { returnVal = true; } } return(returnVal); }
public static BrokerOperationResult UpdateNextDates(IDashboardRepository repo, string patientDfn, string pregnancyIen) { BrokerOperationResult result = new BrokerOperationResult(); // *** First get the pregnancy *** PregnancyListResult pregResult = repo.Pregnancy.GetPregnancies(patientDfn, pregnancyIen); result.SetResult(pregResult.Success, pregResult.Message); if (pregResult.Success) { if (pregResult.Pregnancies != null) { if (pregResult.Pregnancies.Count > 0) { // *** Get the checklist items *** PregnancyChecklistItemsResult getResult = GetSortedPregnancyChecklist(repo, patientDfn, pregResult.Pregnancies[0], DsioChecklistCompletionStatus.NotComplete); result.SetResult(getResult.Success, getResult.Message); if (result.Success) { if (getResult.Items != null) { if (getResult.Items.Count > 0) { // *** Find the next due *** DateTime nextChecklistDue = getResult.Items[0].DueDate; // *** Save next checklist observation *** result = repo.Observations.UpdateNextChecklistDue(patientDfn, nextChecklistDue); if (result.Success) { // *** Find next contact due *** DateTime nextContactDue = DateTime.MinValue; foreach (PregnancyChecklistItem item in getResult.Items) { if (item.ItemType == DsioChecklistItemType.MccCall) { nextContactDue = item.DueDate; break; } } result = repo.Observations.UpdateNextContactDue(patientDfn, nextContactDue); } } } } } } } return(result); }
public ActionResult CreateAddendum(TiuNoteModel model) { // *** Post data *** ActionResult returnResult; bool needPatDemo = false; if (ModelState.IsValid) { BrokerOperationResult result = this.DashboardRepository.Notes.CreateAddendum(model.Note.Ien, model.Note.NoteText, model.Note.Subject, new Dictionary <string, string>()); if (!result.Success) { this.Error(result.Message); returnResult = View(model); needPatDemo = true; } else { this.Information("Addendum Created"); if (TempData.ContainsKey(ReturnUrl)) { returnResult = Redirect(TempData.Peek(ReturnUrl).ToString()); } else { 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; } if (needPatDemo) { this.CurrentPatientDfn = model.Patient.Dfn; model.Patient = this.CurrentPatient; } // *** Set return url *** if (TempData.ContainsKey(ReturnUrl)) { model.ReturnUrl = TempData[ReturnUrl].ToString(); TempData[ReturnUrl] = TempData[ReturnUrl]; } return(returnResult); }
public ActionResult ImHere() { BrokerOperationResult result = this.DashboardRepository.Accounts.ImHere(); return(new JsonResult() { Data = new { TimeoutMinutes = this.Session.Timeout } }); }
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 BrokerOperationResult LoadDefaultChecklist() { BrokerOperationResult returnResult = new BrokerOperationResult(); // *** Create a serializer *** XmlSerializer serializer = new XmlSerializer(typeof(List <DsioChecklistItem>)); // *** Get the full name of the source file *** string fullName = Path.Combine(this.ContentPath, this.DefaultChecklistFileName); // *** Create a reader *** using (XmlReader reader = XmlReader.Create(fullName)) { // *** Deserialize It *** var list = serializer.Deserialize(reader); // *** Get list *** List <DsioChecklistItem> checklistItems = (List <DsioChecklistItem>)list; // *** Process if we have any *** if (checklistItems.Count > 0) { // *** Create the command *** DsioSaveMccChecklistCommand command = new DsioSaveMccChecklistCommand(this.broker); // *** Declare response *** RpcResponse response = null; // *** Loop *** foreach (DsioChecklistItem item in checklistItems) { // *** Don't re-use IEN *** item.Ien = ""; // *** Add the arguments *** command.AddCommandArguments(item); // *** Execute *** response = command.Execute(); // *** If not successful, stop *** if (response.Status != RpcResponseStatus.Success) { break; } } // *** Add result *** if (response != null) { returnResult.SetResult(response.Status == RpcResponseStatus.Success, response.InformationalMessage); } } } return(returnResult); }
public static BrokerOperationResult CompleteEducationItem(IDashboardRepository repo, string patientDfn, string educationItemIen, string checklistItemIen) { BrokerOperationResult returnResult = new BrokerOperationResult(); // *** Two-step process: // *** (1) Create completed patient education item // *** (2) Complete the checklist item PatientEducationItem patItem = new PatientEducationItem() { PatientDfn = patientDfn, EducationItemIen = educationItemIen, CompletedOn = DateTime.Now }; IenResult saveResult = repo.Education.SavePatientItem(patItem); returnResult.SetResult(saveResult.Success, saveResult.Message); if (saveResult.Success) { PregnancyChecklistItemsResult result = repo.Checklist.GetPregnancyItems(patientDfn, "", checklistItemIen); returnResult.SetResult(result.Success, result.Message); if (result.Success) { if (result.Items != null) { if (result.Items.Count > 0) { PregnancyChecklistItem checkItem = result.Items[0]; checkItem.CompletionStatus = DsioChecklistCompletionStatus.Complete; checkItem.CompletionLink = saveResult.Ien; IenResult ienResult = repo.Checklist.SavePregnancyItem(checkItem); returnResult.SetResult(ienResult.Success, ienResult.Message); if (returnResult.Success) { returnResult = UpdateNextDates(repo, patientDfn, checkItem.PregnancyIen); if (returnResult.Success) { returnResult.Message = "Education item completed"; } } } } } } return(returnResult); }
public ActionResult Complete(PatientEducationIndex model) { //PatientEducationItem patItem = new PatientEducationItem() //{ // PatientDfn = model.Patient.Dfn, // EducationItemIen = model.SelectedEducationIen, // CompletedOn = DateTime.Now //}; //IenResult saveResult = this.DashboardRepository.Education.SavePatientItem(patItem); //if (!saveResult.Success) // this.Error(saveResult.Message); //else //{ // PregnancyChecklistItemsResult result = this.DashboardRepository.Checklist.GetPregnancyItems(model.Patient.Dfn, "", model.SelectedChecklistIen); // if (!result.Success) // this.Error(result.Message); // else // { // if (result.Items != null) // if (result.Items.Count > 0) // { // PregnancyChecklistItem checkItem = result.Items[0]; // checkItem.CompletionStatus = DsioChecklistCompletionStatus.Complete; // checkItem.CompletionLink = saveResult.Ien; // IenResult ienResult = this.DashboardRepository.Checklist.SavePregnancyItem(checkItem); // if (!saveResult.Success) // this.Error(saveResult.Message); // this.Information("Education item completed"); // } // } //} BrokerOperationResult result = ChecklistUtility.CompleteEducationItem( this.DashboardRepository, model.Patient.Dfn, model.SelectedEducationIen, model.SelectedChecklistIen); if (result.Success) { this.Information(result.Message); } else { this.Error(result.Message); } return(RedirectToAction("PatientIndex", new { dfn = model.Patient.Dfn })); }
public ActionResult Sign(SignNoteModel model) { ActionResult returnResult; bool needDemo = false; if (ModelState.IsValid) { BrokerOperationResult result = this.DashboardRepository.Notes.SignNote(model.NoteIen, model.Esig); if (!result.Success) { this.Error(result.Message); returnResult = View(model); needDemo = true; } else { this.Information("The note has been signed."); if (TempData.ContainsKey(ReturnUrl)) { returnResult = Redirect(TempData.Peek(ReturnUrl).ToString()); } else { returnResult = RedirectToAction("Index", new { dfn = model.Patient.Dfn, filter = model.NoteIen, page = "1" }); } } } else { needDemo = true; model.NoteIen = model.NoteIen; this.Error("Please enter signature code"); returnResult = View(model); } if (needDemo) { this.CurrentPatientDfn = model.Patient.Dfn; model.Patient = this.CurrentPatient; } // *** Set return url *** if (TempData.ContainsKey(ReturnUrl)) { model.ReturnUrl = TempData[ReturnUrl].ToString(); TempData[ReturnUrl] = TempData[ReturnUrl]; } return(returnResult); }
public BrokerOperationResult SetServerData(ServerConfig serverConfig) { BrokerOperationResult returnResult = new BrokerOperationResult(); ConfigurationManager.AppSettings["vistaServer"] = serverConfig.ServerName; ConfigurationManager.AppSettings["vistaListenerPort"] = serverConfig.ListenerPort.ToString(); returnResult.SetResult(true, ""); return(returnResult); }
public BrokerOperationResult CancelPregnancyItem(PregnancyChecklistItem item) { BrokerOperationResult result = new BrokerOperationResult(); item.CompletionStatus = DsioChecklistCompletionStatus.NotNeededOrApplicable; item.InProgress = false; result = this.SavePregnancyItem(item); return(result); }
public BrokerOperationResult CompletePregnancyItem(PregnancyChecklistItem item) { BrokerOperationResult result = new BrokerOperationResult(); item.CompletionStatus = DsioChecklistCompletionStatus.Complete; item.InProgress = false; item.CompleteDate = DateTime.Now; result = this.SavePregnancyItem(item); return(result); }
public BrokerOperationResult SaveText4BabyInfo(string dfn, Text4BabyStatus t4bStat) { BrokerOperationResult returnResult = new BrokerOperationResult(); Dictionary <string, string> newValues = new Dictionary <string, string>(); newValues[DsioPatientInformationFields.T4BStatusKey] = ((int)t4bStat).ToString(); newValues[DsioPatientInformationFields.T4BDateKey] = DateTime.Now.ToString(VistaDates.VistADateFormatFour); returnResult = CallSaveRpc(dfn, newValues); return(returnResult); }
public BrokerOperationResult SaveNextChecklistDue(string dfn, DateTime nextChecklistDue) { BrokerOperationResult returnResult = new BrokerOperationResult(); Dictionary <string, string> newValues = new Dictionary <string, string>(); string val = (nextChecklistDue == DateTime.MinValue) ? "" : nextChecklistDue.ToString(VistaDates.VistADateFormatFour); newValues[DsioPatientInformationFields.NextChecklistDueKey] = val; returnResult = CallSaveRpc(dfn, newValues); return(returnResult); }
public BrokerOperationResult Select(string divId) { BrokerOperationResult returnVal = new BrokerOperationResult(); if (this.broker != null) { XusDivisionSetCommand command = new XusDivisionSetCommand(this.broker, divId); command.Execute(); returnVal.SetResult((command.Response.Status == RpcResponseStatus.Success), ""); } return(returnVal); }
/// <summary> /// Keeps connection to VistA active /// </summary> /// <returns></returns> public BrokerOperationResult ImHere() { BrokerOperationResult result = new BrokerOperationResult(); // *** Create the command *** XwbImHereCommand command = new XwbImHereCommand(this.broker); // *** Execute *** RpcResponse response = command.Execute(); // *** Put the comamnd response into the result *** result.SetResult(response.Status == RpcResponseStatus.Success, response.InformationalMessage); return(result); }
private ActionResult LoadDefaults(ChecklistIndex model) { BrokerOperationResult result = this.DashboardRepository.Checklist.LoadDefaultChecklist(); if (!result.Success) { this.Error(result.Message); } else { this.Information("Default Checklist Items Added Successfully"); } return(RedirectToAction("Index", new { page = "1" })); }
public BrokerOperationResult SaveSingletonObservationsByCategory(List <Observation> observationList) { // *** This method makes the following assumptions: *** // *** All the observations share the same, patient, category, and pregnancy *** // *** These are singleton observations, only one should exist at any time *** BrokerOperationResult returnResult = new BrokerOperationResult(); // *** Get all observations for this category **** if (observationList != null) { if (observationList.Count > 0) { // *** Use first item to find all that match *** ObservationListResult listResult = GetObservationListByCategory(observationList[0].PatientDfn, observationList[0].PregnancyIen, observationList[0].Category); // *** Get the list or empty *** List <Observation> existingList = (listResult.Success) ? listResult.Observations : new List <Observation>(); // *** For all new obs *** foreach (Observation newObs in observationList) { // *** Look for existing match, set ien if found *** foreach (Observation exObs in existingList) { if ((newObs.Code.Equals(exObs.Code ?? "", StringComparison.CurrentCultureIgnoreCase)) && (newObs.BabyIen.Equals(exObs.BabyIen ?? "", StringComparison.CurrentCultureIgnoreCase))) { newObs.Ien = exObs.Ien; } } // *** Save it *** returnResult = this.SaveObservation(newObs); // *** Abort if problem *** if (!returnResult.Success) { break; } } } } return(returnResult); }
public ActionResult TestConnection(string serverName, string serverPort) { ActionResult returnResult; BrokerOperationResult opResult = this.DashboardRepository.Settings.TestServerConnection(serverName, serverPort); if (opResult.Success) { returnResult = Content("true"); } else { returnResult = Content("false"); } return(returnResult); }