/// <summary>
 /// Constructor
 /// </summary>
 public LinkProceduresComponent(ReportingWorklistItemSummary sourceItem, List <ReportingWorklistItemSummary> candidateItems, string instructions, string heading)
 {
     _candidates   = candidateItems;
     _sourceItem   = sourceItem;
     _instructions = instructions;
     _heading      = heading;
 }
        private void PromptForLinkedInterpretations(ReportingWorklistItemSummary item, out List <ReportingWorklistItemSummary> linkedItems, out List <ReportingWorklistItemSummary> candidateItems)
        {
            linkedItems    = new List <ReportingWorklistItemSummary>();
            candidateItems = new List <ReportingWorklistItemSummary>();

            // query server for link candidates
            var anonCandidates = new List <ReportingWorklistItemSummary>();             // cannot use out param in anonymous delegate.

            Platform.GetService <IProtocollingWorkflowService>(service =>
            {
                var linkableProtocolsResponse = service.GetLinkableProtocols(new GetLinkableProtocolsRequest(item.ProcedureStepRef));
                anonCandidates = linkableProtocolsResponse.ProtocolItems;
            });
            candidateItems.AddRange(anonCandidates);

            // if there are no candidates just return
            if (candidateItems.Count <= 0)
            {
                return;
            }

            // otherwise, prompt the user to select
            ResetChildComponents();

            var linkProceduresComponent = new LinkProceduresComponent(
                item, candidateItems, SR.TextLinkProtocolInstructions, SR.TextLinkProtocolHeading);

            if (LaunchAsDialog(this.Host.DesktopWindow, linkProceduresComponent, SR.TitleLinkProcedures) ==
                ApplicationComponentExitCode.Accepted)
            {
                linkedItems.AddRange(linkProceduresComponent.CheckedItems);
            }
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            // show PD dialog if required
            //return PreliminaryDiagnosis.ShowDialogOnVerifyIfRequired(item, this.Context.DesktopWindow,
            //	delegate
            //	{
            //try
            //{
            try
            {
                ExecuteHelper(item.ProcedureStepName, item.ProcedureStepRef, null);
            }
            catch (FaultException <SupervisorValidationException> )
            {
                ExecuteHelper(item.ProcedureStepName, item.ProcedureStepRef, GetSupervisorRef());
            }
            //}
            //catch (Exception e)
            //{
            //    ExceptionHandler.Report(e, this.Context.DesktopWindow);
            //}

            this.Context.InvalidateFolders(typeof(Folders.Reporting.VerifiedFolder));
            //	});
            return(true);
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            Platform.GetService((IReportingWorkflowService service) =>
                                service.ReturnToInterpreter(new ReturnToInterpreterRequest(item.ProcedureStepRef)));

            return(true);
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            // check if the document is already open
            if (ActivateIfAlreadyOpen(item))
            {
                return(true);
            }

            ReportingWorklistItemSummary replacementItem = null;

            if (this.Context.GetOperationEnablement("ReviseResidentReport"))
            {
                Platform.GetService(
                    delegate(IReportingWorkflowService service)
                {
                    var response    = service.ReviseResidentReport(new ReviseResidentReportRequest(item.ProcedureStepRef));
                    replacementItem = response.ReplacementInterpretationStep;
                });
            }
            else if (this.Context.GetOperationEnablement("ReviseUnpublishedReport"))
            {
                Platform.GetService(
                    delegate(IReportingWorkflowService service)
                {
                    var response    = service.ReviseUnpublishedReport(new ReviseUnpublishedReportRequest(item.ProcedureStepRef));
                    replacementItem = response.ReplacementVerificationStep;
                });
            }

            OpenReportEditor(replacementItem);

            return(true);
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            if (ActivateIfAlreadyOpen(item))
            {
                return(true);
            }

            ReportingWorklistItemSummary interpretationWorklistItem = null;

            Platform.GetService <IReportingWorkflowService>(
                delegate(IReportingWorkflowService service)
            {
                CreateAddendumResponse response = service.CreateAddendum(new CreateAddendumRequest(item.ProcedureRef));
                interpretationWorklistItem      = response.ReportingWorklistItem;
            });

            this.Context.InvalidateFolders(typeof(Folders.Reporting.DraftFolder));

            if (ActivateIfAlreadyOpen(interpretationWorklistItem))
            {
                return(true);
            }

            OpenReportEditor(interpretationWorklistItem);

            return(true);
        }
Exemple #7
0
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            if (item.ReportRef == null)
            {
                return(false);
            }

            try
            {
                //todo: loc
                var title = string.Format("Print Report for {0} {1} -  {2}",
                                          Formatting.MrnFormat.Format(item.Mrn),
                                          Formatting.PersonNameFormat.Format(item.PatientName),
                                          Formatting.AccessionFormat.Format(item.AccessionNumber));

                var component = new PrintReportComponent(item.OrderRef, item.ReportRef);
                ApplicationComponent.LaunchAsDialog(
                    this.Context.DesktopWindow,
                    component,
                    title);
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, this.Context.DesktopWindow);
            }

            // always return false - we didn't change any data
            return(false);
        }
Exemple #8
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ProtocolEditorComponent(ReportingWorklistItemSummary worklistItem)
        {
            _worklistItem = worklistItem;

            _availableProtocolCodes = new ProtocolCodeTable();
            _selectedProtocolCodes  = new ProtocolCodeTable();
            _selectedProtocolCodes.Items.ItemsChanged += SelectedProtocolCodesChanged;
            _protocolGroupChoices = new List <ProtocolGroupSummary>();
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            Platform.GetService <IReportingWorkflowService>(
                delegate(IReportingWorkflowService service)
            {
                service.PublishReport(new PublishReportRequest(item.ProcedureStepRef));
            });

            return(true);
        }
        private static bool ActivateIfAlreadyOpen(ReportingWorklistItemSummary item)
        {
            var document = DocumentManager.Get <ProtocolDocument>(item.OrderRef);

            if (document != null)
            {
                document.Open();
                return(true);
            }
            return(false);
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            Platform.GetService <ITranscriptionWorkflowService>(
                delegate(ITranscriptionWorkflowService service)
            {
                service.CompleteTranscription(new CompleteTranscriptionRequest(item.ProcedureStepRef));
            });

            this.Context.InvalidateFolders(typeof(Folders.Transcription.CompletedFolder));

            return(true);
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            // check if the document is already open
            if (ActivateIfAlreadyOpen(item))
            {
                return(true);
            }

            OpenProtocolEditor(item);

            return(true);
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            // check if the document is already open
            if (ActivateIfAlreadyOpen(item))
            {
                return(true);
            }

            // open the report editor
            OpenTranscriptionEditor(item);

            return(true);
        }
        public void SetContext(ReportingWorklistItemSummary worklistItem, EntityRef reportRef)
        {
            _reportRef    = reportRef;
            _worklistItem = worklistItem;

            if (this.IsStarted)
            {
                _relevantPriors = null;
                _allPriors      = null;
                UpdateReportList();
                ((ReportViewComponent)_reportViewComponentHost.Component).Refresh();
            }
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            try
            {
                ExecuteHelper(item.ProcedureStepRef, null);
            }
            catch (FaultException <SupervisorValidationException> )
            {
                ExecuteHelper(item.ProcedureStepRef, GetSupervisorRef());
            }

            this.Context.InvalidateFolders(typeof(Folders.Reporting.CompletedProtocolFolder));

            return(true);
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            if (this.Context.DesktopWindow.ShowMessageBox(SR.MessageConfirmDiscardSelectedProtocol, MessageBoxActions.OkCancel)
                == DialogBoxAction.Cancel)
            {
                return(false);
            }

            Platform.GetService <IProtocollingWorkflowService>(
                delegate(IProtocollingWorkflowService service)
            {
                service.DiscardProtocol(new DiscardProtocolRequest(item.ProcedureStepRef));
            });

            return(true);
        }
        private IContinuousWorkflowComponentMode GetMode(ReportingWorklistItemSummary item)
        {
            if (item == null)
            {
                return(ProtocollingComponentModes.Review);
            }

            if (CanCreateProtocol(item))
            {
                return(ProtocollingComponentModes.Assign);
            }

            return(CanEditProtocol(item)
                                ? ProtocollingComponentModes.Edit
                                : ProtocollingComponentModes.Review);
        }
Exemple #18
0
        private void ClaimWorklistItem(ReportingWorklistItemSummary item)
        {
            if (item.ActivityStatus.Code != StepState.Scheduled)
            {
                return;
            }

            // start the interpretation step
            // note: updating only the ProcedureStepRef is hacky - the service should return an updated item
            StartTranscriptionResponse response = null;

            Platform.GetService <ITranscriptionWorkflowService>(
                service => response = service.StartTranscription(new StartTranscriptionRequest(item.ProcedureStepRef)));

            item.ProcedureStepRef = response.TranscriptionStepRef;
        }
Exemple #19
0
        public TranscriptionDocument(ReportingWorklistItemSummary worklistItem, IReportingWorkflowItemToolContext context)
            : base(worklistItem.ProcedureStepRef, context.DesktopWindow)
        {
            _worklistItem = worklistItem;
            _folderName   = context.SelectedFolder.Name;

            if (context.SelectedFolder is TranscriptionWorkflowFolder)
            {
                _worklistRef       = ((TranscriptionWorkflowFolder)context.SelectedFolder).WorklistRef;
                _worklistClassName = ((TranscriptionWorkflowFolder)context.SelectedFolder).WorklistClassName;
            }
            else
            {
                _worklistRef       = null;
                _worklistClassName = null;
            }
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            try
            {
                ApplicationComponentExitCode exitCode = ApplicationComponent.LaunchAsDialog(
                    this.Context.DesktopWindow,
                    new ReassignComponent(item),
                    SR.TitleReassignItem);

                return(exitCode == ApplicationComponentExitCode.Accepted);
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, this.Context.DesktopWindow);
                return(false);
            }
        }
Exemple #21
0
        public ReportDocument(ReportingWorklistItemSummary worklistItem, bool shouldOpenImages, IReportingWorkflowItemToolContext context)
            : base(worklistItem.ProcedureStepRef, context.DesktopWindow)
        {
            _worklistItem     = worklistItem;
            _folderName       = context.SelectedFolder.Name;
            _shouldOpenImages = shouldOpenImages;

            if (context.SelectedFolder is ReportingWorkflowFolder)
            {
                _worklistRef       = ((ReportingWorkflowFolder)context.SelectedFolder).WorklistRef;
                _worklistClassName = ((ReportingWorkflowFolder)context.SelectedFolder).WorklistClassName;
            }
            else
            {
                _worklistRef       = null;
                _worklistClassName = null;
            }
        }
Exemple #22
0
        public ProtocolDocument(ReportingWorklistItemSummary item, IContinuousWorkflowComponentMode mode, IReportingWorkflowItemToolContext context)
            : base(item.OrderRef, context.DesktopWindow)
        {
            _item       = item;
            _mode       = mode;
            _folderName = context.SelectedFolder.Name;

            if (context.SelectedFolder is ReportingWorkflowFolder)
            {
                _worklistRef       = ((ReportingWorkflowFolder)context.SelectedFolder).WorklistRef;
                _worklistClassName = ((ReportingWorkflowFolder)context.SelectedFolder).WorklistClassName;
            }
            else
            {
                _worklistRef       = null;
                _worklistClassName = null;
            }
        }
Exemple #23
0
        public void MakePrimary()
        {
            // Swap the current primary item with the selected candidate item. Update both tables and selections
            var originalSelectedCandidate = _selectedCandidate.Item;
            var isChecked = _selectedCandidate.IsChecked;

            var index = _candidateTable.Items.IndexOf(_selectedCandidate);

            _candidateTable.Items.RemoveAt(index);
            _selectedCandidate = new Checkable <ReportingWorklistItemSummary>(_primaryItem, isChecked);
            _candidateTable.Items.Insert(index, _selectedCandidate);

            _primaryItem = originalSelectedCandidate;
            _sourceTable.Items.Clear();
            _sourceTable.Items.Add(_primaryItem);

            NotifyPropertyChanged("CandidateTableSelection");
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            TranscriptionRejectReasonComponent component = new TranscriptionRejectReasonComponent();

            if (this.Context.DesktopWindow.ShowDialogBox(component, "Reason") == DialogBoxAction.Ok)
            {
                Platform.GetService <ITranscriptionWorkflowService>(
                    delegate(ITranscriptionWorkflowService service)
                {
                    service.RejectTranscription(new RejectTranscriptionRequest(
                                                    item.ProcedureStepRef,
                                                    component.Reason,
                                                    CreateAdditionalCommentsNote(component.OtherReason)));
                });

                this.Context.InvalidateFolders(typeof(Folders.Transcription.CompletedFolder));
            }
            return(true);
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            ProtocolReasonComponent component = new ProtocolReasonComponent();

            if (this.Context.DesktopWindow.ShowDialogBox(component, "Reason") == DialogBoxAction.Ok)
            {
                try
                {
                    ExecuteHelper(item.ProcedureStepRef, component.Reason, component.OtherReason, null);
                }
                catch (FaultException <SupervisorValidationException> )
                {
                    ExecuteHelper(item.ProcedureStepRef, component.Reason, component.OtherReason, GetSupervisorRef());
                }

                this.Context.InvalidateFolders(typeof(Folders.Reporting.RejectedProtocolFolder));
            }
            return(true);
        }
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            string msg = item.IsAddendumStep ? SR.MessageConfirmDiscardSelectedAddendum : SR.MessageConfirmDiscardSelectedReport;

            if (this.Context.DesktopWindow.ShowMessageBox(msg, MessageBoxActions.OkCancel)
                == DialogBoxAction.Cancel)
            {
                return(false);
            }


            Platform.GetService <IReportingWorkflowService>(
                delegate(IReportingWorkflowService service)
            {
                service.CancelReportingStep(new CancelReportingStepRequest(item.ProcedureStepRef, null));
            });

            // no point in invalidating "to be reported" folder because its communal

            return(true);
        }
        private void OpenProtocolEditor(ReportingWorklistItemSummary item)
        {
            if (ActivateIfAlreadyOpen(item))
            {
                return;
            }

            if (!ProtocollingSettings.Default.AllowMultipleProtocollingWorkspaces)
            {
                var documents = DocumentManager.GetAll <ProtocolDocument>();

                // Show warning message and ask if the existing document should be closed or not
                if (documents.Count > 0)
                {
                    var firstDocument = CollectionUtils.FirstElement(documents);
                    firstDocument.Open();

                    var message = string.Format(SR.MessageProtocollingComponentAlreadyOpened,
                                                ProtocolDocument.StripTitle(firstDocument.GetTitle()),
                                                ProtocolDocument.StripTitle(ProtocolDocument.GetTitle(item)));
                    if (DialogBoxAction.No == this.Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo))
                    {
                        return;                                 // Leave the existing document open
                    }
                    // close documents and continue
                    CollectionUtils.ForEach(documents, document => document.SaveAndClose());
                }
            }

            // open the protocol editor
            var protocolDocument = new ProtocolDocument(item, GetMode(item), this.Context);

            protocolDocument.Open();

            var selectedFolderType = this.Context.SelectedFolder.GetType();

            protocolDocument.Closed += delegate { DocumentManager.InvalidateFolder(selectedFolderType); };
        }
Exemple #28
0
        protected override bool Execute(ReportingWorklistItemSummary item)
        {
            // check if the document is already open
            if (ActivateIfAlreadyOpen(item))
            {
                // if we want to load images, and the document was already open, ensure the images are visible
                if (_loadImages)
                {
                    var document  = DocumentManager.Get <ReportDocument>(item.ProcedureStepRef);
                    var component = document != null?document.GetComponent() as ReportingComponent : null;

                    if (component != null)
                    {
                        component.EnsureImagesAreVisible();
                    }
                }
                return(true);
            }

            // open the report editor
            OpenReportEditor(item, _loadImages);

            return(true);
        }
 private bool CanEditProtocol(ReportingWorklistItemSummary item)
 {
     // there is no specific workflow operation for editing a previously created draft,
     // so we enable the tool if it looks like a draft and SaveReport is enabled
     return(this.Context.GetOperationEnablement("SaveProtocol") && item.ActivityStatus.Code == StepState.InProgress);
 }
 private bool CanCreateProtocol(ReportingWorklistItemSummary item)
 {
     return(this.Context.GetOperationEnablement("StartProtocol"));
 }