Example #1
0
        protected bool ExecuteCore(WorklistItemSummaryBase item)
        {
            var list      = new List <TItem>(this.Context.SelectedItems);
            var orderRefs = CollectionUtils.Map <TItem, EntityRef>(list, x => x.OrderRef);
            var component = new MergeOrdersComponent(orderRefs);

            string failureReason;

            if (!ValidateMergeRequest(orderRefs, out failureReason))
            {
                this.Context.DesktopWindow.ShowMessageBox(failureReason, MessageBoxActions.Ok);
                return(false);
            }

            var args = new DialogBoxCreationArgs(component, SR.TitleMergeOrders, null)
            {
                AllowUserResize = true
            };

            if (ApplicationComponentExitCode.Accepted != ApplicationComponent.LaunchAsDialog(this.Context.DesktopWindow, args))
            {
                return(false);
            }

            InvalidateFolders();

            return(true);
        }
Example #2
0
 private static void OpenViewer(WorklistItemSummaryBase item, IDesktopWindow desktopWindow)
 {
     if (item != null)
     {
         OpenViewer(item.AccessionNumber, desktopWindow);
     }
 }
        /// <summary>
        /// Displays the PD dialog.
        /// </summary>
        /// <param name="worklistItem"></param>
        /// <param name="window"></param>
        /// <param name="continuationCode"></param>
        private static void ShowDialog(WorklistItemSummaryBase worklistItem, IDesktopWindow window, Action <ApplicationComponentExitCode> continuationCode)
        {
            var component = CreateComponent(worklistItem);
            var dialog    = ApplicationComponent.LaunchAsWorkspaceDialog(window, component, MakeTitle(worklistItem));

            dialog.Closed += delegate { continuationCode(component.ExitCode); };
        }
		/// <summary>
		/// Determines if the PD dialog must be shown upon verification for the specified worklist item, and shows it if needed.
		/// </summary>
		/// <param name="worklistItem"></param>
		/// <param name="desktopWindow"></param>
		/// <param name="continuation">Code block that is executed if the dialog was shown and accepted, or if it was not required. </param>
		/// <returns>True if the dialog was shown and accepted, or if it was not required.  False if the user cancelled out of the dialog.</returns>
		public static bool ShowDialogOnVerifyIfRequired(WorklistItemSummaryBase worklistItem, IDesktopWindow desktopWindow,
			Action<object> continuation)
		{
			if(!NeedDialogOnVerify(worklistItem, desktopWindow))
			{
				// we don't need the dialog, so we can continue
				continuation(null);
				return true;
			}

			// show the pd dialog
			var completed = false;
			ShowDialog(worklistItem, desktopWindow,
				exitCode =>
				{
					if(exitCode == ApplicationComponentExitCode.Accepted)
					{
						// if the dialog was accepted, continue
						continuation(null);
						completed = true;
					}
				});

			return completed;
		}
 private static string MakeTitle(WorklistItemSummaryBase worklistItem)
 {
     return(string.Format(SR.FormatTitleContextDescriptionReviewOrderNoteConversation,
                          PersonNameFormat.Format(worklistItem.PatientName),
                          MrnFormat.Format(worklistItem.Mrn),
                          AccessionFormat.Format(worklistItem.AccessionNumber)));
 }
        /// <summary>
        /// Determines if the PD dialog must be shown upon verification for the specified worklist item, and shows it if needed.
        /// </summary>
        /// <param name="worklistItem"></param>
        /// <param name="desktopWindow"></param>
        /// <param name="continuation">Code block that is executed if the dialog was shown and accepted, or if it was not required. </param>
        /// <returns>True if the dialog was shown and accepted, or if it was not required.  False if the user cancelled out of the dialog.</returns>
        public static bool ShowDialogOnVerifyIfRequired(WorklistItemSummaryBase worklistItem, IDesktopWindow desktopWindow,
                                                        Action <object> continuation)
        {
            if (!NeedDialogOnVerify(worklistItem, desktopWindow))
            {
                // we don't need the dialog, so we can continue
                continuation(null);
                return(true);
            }

            // show the pd dialog
            var completed = false;

            ShowDialog(worklistItem, desktopWindow,
                       exitCode =>
            {
                if (exitCode == ApplicationComponentExitCode.Accepted)
                {
                    // if the dialog was accepted, continue
                    continuation(null);
                    completed = true;
                }
            });

            return(completed);
        }
Example #7
0
        public void View()
        {
            if (this.ContextBase is IWorkflowItemToolContext)
            {
                var context = (IWorkflowItemToolContext)ContextBase;
                if (this.Context is IOrderNoteboxItemToolContext)
                {
                    var item = (OrderNoteboxItemSummary)context.Selection.Item;

                    // this is super-hokey, but it should work as long as we fill out
                    // the key properties
                    var worklistItem = new WorklistItemSummaryBase
                    {
                        AccessionNumber       = item.AccessionNumber,
                        DiagnosticServiceName = item.DiagnosticServiceName,
                        Mrn               = item.Mrn,
                        OrderRef          = item.OrderRef,
                        PatientName       = item.PatientName,
                        PatientProfileRef = item.PatientProfileRef,
                        PatientRef        = item.PatientRef,
                    };

                    OpenPatient(worklistItem, context.DesktopWindow);
                }
                else
                {
                    var item = (WorklistItemSummaryBase)context.Selection.Item;
                    OpenPatient(item, context.DesktopWindow);
                }
            }
        }
Example #8
0
        private static void NewOrder(WorklistItemSummaryBase worklistItem, IDesktopWindow desktopWindow)
        {
            if (worklistItem == null)
            {
                NewOrder(null, "New Order", desktopWindow);
                return;
            }

            PatientProfileSummary summary = null;

            Platform.GetService <IBrowsePatientDataService>(
                service =>
            {
                var response = service.GetData(new GetDataRequest
                {
                    GetPatientProfileDetailRequest = new GetPatientProfileDetailRequest
                    {
                        PatientProfileRef = worklistItem.PatientProfileRef
                    }
                });
                summary = response.GetPatientProfileDetailResponse.PatientProfile.GetSummary();
            });

            NewOrder(summary, desktopWindow);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public PerformedProcedureComponent(WorklistItemSummaryBase worklistItem, PerformingDocumentationComponent owner)
        {
            Platform.CheckForNullReference(worklistItem, "worklistItem");
            Platform.CheckForNullReference(owner, "owner");

            _worklistItem = worklistItem;
            _orderRef     = worklistItem.OrderRef;
            _owner        = owner;
        }
Example #10
0
 protected bool ExecuteCore(WorklistItemSummaryBase item)
 {
     if (OrderCancelHelper.CancelOrder(item.OrderRef, PersonNameFormat.Format(item.PatientName), this.Context.DesktopWindow))
     {
         InvalidateFolders();
         return(true);
     }
     return(false);
 }
Example #11
0
		public PatientBiographyDocument(WorklistItemSummaryBase worklistItem, IDesktopWindow window)
			: base(worklistItem.PatientRef, window)
        {
			Platform.CheckForNullReference(worklistItem.PatientRef, "PatientRef");
			Platform.CheckForNullReference(worklistItem.PatientProfileRef, "PatientProfileRef");
			// the worklist item may not have an OrderRef (may represent just a patient)

			_patientRef = worklistItem.PatientRef;
			_profileRef = worklistItem.PatientProfileRef;
			_patientName = worklistItem.PatientName;
			_mrn = worklistItem.Mrn;

			_orderRef = worklistItem.OrderRef;
        }
        public PatientBiographyDocument(WorklistItemSummaryBase worklistItem, IDesktopWindow window)
            : base(worklistItem.PatientRef, window)
        {
            Platform.CheckForNullReference(worklistItem.PatientRef, "PatientRef");
            Platform.CheckForNullReference(worklistItem.PatientProfileRef, "PatientProfileRef");
            // the worklist item may not have an OrderRef (may represent just a patient)

            _patientRef  = worklistItem.PatientRef;
            _profileRef  = worklistItem.PatientProfileRef;
            _patientName = worklistItem.PatientName;
            _mrn         = worklistItem.Mrn;

            _orderRef = worklistItem.OrderRef;
        }
        protected bool ExecuteCore(WorklistItemSummaryBase item)
        {
            EnumValueInfo reason;
            var           reasonCode = OrderMergeSettings.Default.UnmergeDefaultReasonCode;

            if (string.IsNullOrEmpty(reasonCode))
            {
                var unmergeComponent = new UnmergeOrderComponent();
                var exitCode         = ApplicationComponent.LaunchAsDialog(
                    this.Context.DesktopWindow,
                    unmergeComponent,
                    string.Format("Undo merge order {0}", AccessionFormat.Format(item.AccessionNumber)));

                if (exitCode != ApplicationComponentExitCode.Accepted)
                {
                    return(false);
                }

                reason = unmergeComponent.SelectedReason;
            }
            else
            {
                // confirm
                var message = string.Format("Un-merge all orders merged into {0}?", item.AccessionNumber);
                if (DialogBoxAction.No == this.Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo))
                {
                    return(false);
                }
                reason = new EnumValueInfo(reasonCode, null, null);
            }

            Platform.GetService(
                delegate(IOrderEntryService service)
            {
                var request = new UnmergeOrderRequest(item.OrderRef)
                {
                    UnmergeReason = reason
                };
                service.UnmergeOrder(request);
            });

            InvalidateFolders();
            return(true);
        }
		/// <summary>
		/// Checks the PD dialog must be shown when verifying the specified worklist item.
		/// </summary>
		/// <param name="worklistItem"></param>
		/// <param name="window"></param>
		/// <returns></returns>
		private static bool NeedDialogOnVerify(WorklistItemSummaryBase worklistItem, IDesktopWindow window)
		{
			var existingConv = ConversationExists(worklistItem.OrderRef);

			// if no existing conversation, may not need to show the dialog
			if (!existingConv)
			{
				// if this is not an emergency order, do not show the dialog
				if (!IsEmergencyOrder(worklistItem.PatientClass.Code))
					return false;

				// otherwise, ask the user if they would like to initiate a PD review
				var msg = string.Format(SR.MessageQueryPrelimDiagnosisReviewRequired, worklistItem.PatientClass.Value);
				var action = window.ShowMessageBox(msg, MessageBoxActions.YesNo);
				if (action == DialogBoxAction.No)
					return false;
			}
			return true;
		}
Example #15
0
 protected static void OpenPatient(WorklistItemSummaryBase worklistItem, IDesktopWindow window)
 {
     try
     {
         var document = DocumentManager.Get <PatientBiographyDocument>(worklistItem.PatientRef);
         if (document == null)
         {
             document = new PatientBiographyDocument(worklistItem, window);
             document.Open();
         }
         else
         {
             document.Open();
         }
     }
     catch (Exception e)
     {
         ExceptionHandler.Report(e, window);
     }
 }
        protected bool ExecuteCore(WorklistItemSummaryBase item)
        {
            // first check for warnings
            var warnings = new List <string>();

            Platform.GetService <IOrderEntryService>(
                service => warnings = service.QueryCancelOrderWarnings(new QueryCancelOrderWarningsRequest(item.OrderRef)).Warnings);

            if (warnings.Count > 0)
            {
                var warn   = CollectionUtils.FirstElement(warnings);
                var action = this.Context.DesktopWindow.ShowMessageBox(
                    warn + "\n\nAre you sure you want to cancel and replace this order?",
                    MessageBoxActions.YesNo);
                if (action == DialogBoxAction.No)
                {
                    return(false);
                }
            }

            var title = string.Format("Replace Order {0} - {1} {2}",
                                      AccessionFormat.Format(item.AccessionNumber),
                                      PersonNameFormat.Format(item.PatientName),
                                      MrnFormat.Format(item.Mrn));
            var component = new OrderEditorComponent(new OrderEditorComponent.ReplaceOrderOperatingContext {
                OrderRef = item.OrderRef
            });
            var result = ApplicationComponent.LaunchAsDialog(
                this.Context.DesktopWindow,
                component,
                title);

            if (result == ApplicationComponentExitCode.Accepted)
            {
                InvalidateFolders();
                return(true);
            }

            return(false);
        }
Example #17
0
        protected bool ExecuteCore(WorklistItemSummaryBase item)
        {
            var title = string.Format("Modify Order {0} - {1} {2}",
                                      AccessionFormat.Format(item.AccessionNumber),
                                      PersonNameFormat.Format(item.PatientName),
                                      MrnFormat.Format(item.Mrn));
            var component = new OrderEditorComponent(new OrderEditorComponent.ModifyOrderOperatingContext {
                OrderRef = item.OrderRef
            });
            var result = ApplicationComponent.LaunchAsDialog(
                this.Context.DesktopWindow,
                component,
                title);

            if (result == ApplicationComponentExitCode.Accepted)
            {
                InvalidateFolders();
                return(true);
            }

            return(false);
        }
Example #18
0
        private static void OpenViewer(WorklistItemSummaryBase item, IDesktopWindow desktopWindow)
        {
            if (item == null)
            {
                return;
            }
            if (!CheckSupported(desktopWindow))
            {
                return;
            }

            try
            {
                ViewImagesHelper.ViewStudies(item.OrderRef, new[] { item.ProcedureRef },
                                             new ViewImagesHelper.ViewStudiesOptions {
                    FallbackToOrder = true, Interactive = true, DesktopWindow = desktopWindow
                });
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, desktopWindow);
            }
        }
        /// <summary>
        /// Checks the PD dialog must be shown when verifying the specified worklist item.
        /// </summary>
        /// <param name="worklistItem"></param>
        /// <param name="window"></param>
        /// <returns></returns>
        private static bool NeedDialogOnVerify(WorklistItemSummaryBase worklistItem, IDesktopWindow window)
        {
            var existingConv = ConversationExists(worklistItem.OrderRef);

            // if no existing conversation, may not need to show the dialog
            if (!existingConv)
            {
                // if this is not an emergency order, do not show the dialog
                if (!IsEmergencyOrder(worklistItem.PatientClass.Code))
                {
                    return(false);
                }

                // otherwise, ask the user if they would like to initiate a PD review
                var msg    = string.Format(SR.MessageQueryPrelimDiagnosisReviewRequired, worklistItem.PatientClass.Value);
                var action = window.ShowMessageBox(msg, MessageBoxActions.YesNo);
                if (action == DialogBoxAction.No)
                {
                    return(false);
                }
            }
            return(true);
        }
Example #20
0
        public void View()
        {
            WorklistItemSummaryBase item = (WorklistItemSummaryBase)this.Context.Selection.Item;

            Open(item.OrderRef, this.Context.DesktopWindow);
        }
Example #21
0
 public OperationAuditData(string operation, WorklistItemSummaryBase worklistItem)
     : this(operation, worklistItem.Mrn, worklistItem.PatientName, worklistItem.AccessionNumber, worklistItem.ProcedureName)
 {
 }
Example #22
0
 public OpenWorkspaceOperationAuditData(string workspace, WorklistItemSummaryBase worklistItem)
     : base(AuditHelper.Operations.DocumentWorkspaceOpen, worklistItem)
 {
     this.Workspace = workspace;
 }
Example #23
0
 public PreviewOperationAuditData(string folderSystem, WorklistItemSummaryBase worklistItem)
     : base(AuditHelper.Operations.FolderItemPreview, worklistItem)
 {
     this.FolderSystem = folderSystem;
 }
Example #24
0
		/// <summary>
		/// Formats the procedure name, portable and laterality similar to "Name (Portable/Laterality)".  
		/// Name is formatted according to the default person name format as specified in <see cref="FormatSettings"/>
		/// </summary>
		/// <param name="item"></param>
		/// <returns></returns>
		public static string Format(WorklistItemSummaryBase item)
		{
			return Format(item.ProcedureName, item.ProcedurePortable, item.ProcedureLaterality, FormatSettings.Default.ProcedurePortableLateralityDefaultFormat);
		}
		private static string MakeTitle(WorklistItemSummaryBase worklistItem)
		{
			return string.Format(SR.FormatTitleContextDescriptionReviewOrderNoteConversation,
								 PersonNameFormat.Format(worklistItem.PatientName),
								 MrnFormat.Format(worklistItem.Mrn),
								 AccessionFormat.Format(worklistItem.AccessionNumber));
		}
 private static OrderNoteConversationComponent CreateComponent(WorklistItemSummaryBase worklistItem)
 {
     return(new OrderNoteConversationComponent(worklistItem.OrderRef, OrderNoteCategory.PreliminaryDiagnosis.Key,
                                               PreliminaryDiagnosisSettings.Default.VerificationTemplatesXml,
                                               PreliminaryDiagnosisSettings.Default.VerificationSoftKeysXml));
 }
		public PreviewOperationAuditData(string folderSystem, WorklistItemSummaryBase worklistItem)
			: base(AuditHelper.Operations.FolderItemPreview, worklistItem)
		{
			this.FolderSystem = folderSystem;
		}
		public OpenWorkspaceOperationAuditData(string workspace, WorklistItemSummaryBase worklistItem)
			: base(AuditHelper.Operations.DocumentWorkspaceOpen, worklistItem)
		{
			this.Workspace = workspace;
		}
		public OperationAuditData(string operation, WorklistItemSummaryBase worklistItem)
			:this(operation, worklistItem.Mrn, worklistItem.PatientName, worklistItem.AccessionNumber, worklistItem.ProcedureName)
		{
		}
Example #30
0
 /// <summary>
 /// Formats the procedure name, portable and laterality similar to "Name (Portable/Laterality)".
 /// Name is formatted according to the default person name format as specified in <see cref="FormatSettings"/>
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public static string Format(WorklistItemSummaryBase item)
 {
     return(Format(item.ProcedureName, item.ProcedurePortable, item.ProcedureLaterality, FormatSettings.Default.ProcedurePortableLateralityDefaultFormat));
 }
		/// <summary>
		/// Displays the PD dialog.
		/// </summary>
		/// <param name="worklistItem"></param>
		/// <param name="window"></param>
		/// <param name="continuationCode"></param>
		private static void ShowDialog(WorklistItemSummaryBase worklistItem, IDesktopWindow window, Action<ApplicationComponentExitCode> continuationCode)
		{
			var component = CreateComponent(worklistItem);
			var dialog = ApplicationComponent.LaunchAsWorkspaceDialog(window, component, MakeTitle(worklistItem));
			dialog.Closed += delegate { continuationCode(component.ExitCode); };
		}
		private static OrderNoteConversationComponent CreateComponent(WorklistItemSummaryBase worklistItem)
		{
			return new OrderNoteConversationComponent(worklistItem.OrderRef, OrderNoteCategory.PreliminaryDiagnosis.Key,
													  PreliminaryDiagnosisSettings.Default.VerificationTemplatesXml,
													  PreliminaryDiagnosisSettings.Default.VerificationSoftKeysXml);
		}
 /// <summary>
 /// Constructor
 /// </summary>
 public PerformingDocumentationOrderDetailsComponent(IPerformingDocumentationContext context, WorklistItemSummaryBase worklistItem)
 {
     _context      = context;
     _worklistItem = worklistItem;
 }