Example #1
0
            public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
            {
                if (!step.Is <InterpretationStep>() && !step.Is <TranscriptionReviewStep>())
                {
                    return(false);
                }

                // interpretation steps must be in progress
                if (step.Is <InterpretationStep>() && step.State != ActivityStatus.IP)
                {
                    return(false);
                }

                // transcription review step must not be terminated
                if (step.Is <TranscriptionReviewStep>() && step.IsTerminated)
                {
                    return(false);
                }

                // must not be assigned to someone else
                if (!Equals(step.AssignedStaff, executingStaff))
                {
                    return(false);
                }

                return(true);
            }
Example #2
0
            public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
            {
                if (!step.Is <VerificationStep>())
                {
                    return(false);
                }

                // must be scheduled
                if (step.State != ActivityStatus.SC)
                {
                    return(false);
                }

                if (step.AssignedStaff != null && !Equals(executingStaff, step.AssignedStaff))
                {
                    return(false);
                }

                if (step.ReportPart.Supervisor != null && !Equals(executingStaff, step.ReportPart.Supervisor))
                {
                    return(false);
                }

                return(true);
            }
Example #3
0
            public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
            {
                // Publication steps cannot be cancelled after starting
                if (step.Is <PublicationStep>() && step.State != ActivityStatus.SC)
                {
                    return(false);
                }

                // cannot cancel an unclaimed interpretation step
                if (step.Is <InterpretationStep>() && step.AssignedStaff == null)
                {
                    return(false);
                }

                // cannot cancel once transcription has begun
                if (step.Is <TranscriptionStep>() && step.State != ActivityStatus.SC)
                {
                    return(false);
                }

                // cannot cancel a step that is already completed or cancelled
                if (step.IsTerminated)
                {
                    return(false);
                }

                return(true);
            }
Example #4
0
            public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
            {
                if (!step.Is <VerificationStep>())
                {
                    return(false);
                }

                // must not be already completed or cancelled
                if (step.IsTerminated)
                {
                    return(false);
                }

                if (step.AssignedStaff != null && !Equals(executingStaff, step.AssignedStaff))
                {
                    return(false);
                }

                if (step.ReportPart.Supervisor != null && !Equals(executingStaff, step.ReportPart.Supervisor))
                {
                    return(false);
                }

                return(true);
            }
        private ReportingWorklistItemSummary GetWorklistItemSummary(ReportingProcedureStep reportingProcedureStep)
        {
            var worklistItem = new ReportingWorklistItem();

            worklistItem.InitializeFromProcedureStep(reportingProcedureStep, WorklistItemField.ProcedureStepCreationTime);
            return(new ReportingWorkflowAssembler().CreateWorklistItemSummary(worklistItem, this.PersistenceContext));
        }
        private void UpdatePriority(ReportingProcedureStep step, EnumValueInfo priority)
        {
            if (priority == null)
            {
                return;
            }

            // update the priority of the associated order
            step.Procedure.Order.Priority = EnumUtils.GetEnumValue <OrderPriority>(priority);
        }
        private void ValidateReportTextExists(ReportingProcedureStep step)
        {
            string content;

            if (step.ReportPart == null || step.ReportPart.ExtendedProperties == null ||
                !step.ReportPart.ExtendedProperties.TryGetValue(ReportPartDetail.ReportContentKey, out content) ||
                string.IsNullOrEmpty(content))
            {
                throw new RequestValidationException(SR.ExceptionVerifyWithNoReport);
            }
        }
        /// <summary>
        /// Get the supervisor, using the new supervisor if supplied, otherwise using an existing supervisor if found.
        /// </summary>
        /// <param name="step"></param>
        /// <param name="newSupervisorRef"></param>
        /// <returns></returns>
        private Staff ResolveSupervisor(ReportingProcedureStep step, EntityRef newSupervisorRef)
        {
            var supervisor = newSupervisorRef == null ? null : this.PersistenceContext.Load <Staff>(newSupervisorRef, EntityLoadFlags.Proxy);

            if (supervisor == null && step.ReportPart != null)
            {
                supervisor = step.ReportPart.Supervisor;
            }

            return(supervisor);
        }
Example #9
0
            public ReportingProcedureStep Execute(ReportingProcedureStep step, Staff executingStaff, IWorkflow workflow)
            {
                UpdateStep(step, executingStaff);

                var verificationStep = new VerificationStep(step);

                // supervisor can be null, in which case the verification step is unassigned.
                verificationStep.Assign(step.ReportPart.Supervisor);

                workflow.AddEntity(verificationStep);
                return(verificationStep);
            }
Example #10
0
			public void Execute(ReportingProcedureStep step, Dictionary<string, string> reportPartExtendedProperties, Staff supervisor)
			{
				step.ReportPart.Supervisor = supervisor;

				// if this value is null, it means we don't want to update the report content
				if (reportPartExtendedProperties == null)
					return;

				foreach (var pair in reportPartExtendedProperties)
				{
					step.ReportPart.ExtendedProperties[pair.Key] = pair.Value;
				}
			}
Example #11
0
            public ReportingProcedureStep Execute(ReportingProcedureStep step, Staff executingStaff, IWorkflow workflow)
            {
                UpdateStep(step, executingStaff);

                // Ensure Supervisor and Reject reason from previous transcriptions of the same report part are
                // removed.
                step.ReportPart.ResetTranscription();

                var transcriptionStep = new TranscriptionStep(step);

                transcriptionStep.Schedule(Platform.Time);
                workflow.AddEntity(transcriptionStep);
                return(transcriptionStep);
            }
Example #12
0
            public void Execute(ReportingProcedureStep step, Dictionary <string, string> reportPartExtendedProperties, Staff supervisor)
            {
                step.ReportPart.Supervisor = supervisor;

                // if this value is null, it means we don't want to update the report content
                if (reportPartExtendedProperties == null)
                {
                    return;
                }

                foreach (var pair in reportPartExtendedProperties)
                {
                    step.ReportPart.ExtendedProperties[pair.Key] = pair.Value;
                }
            }
Example #13
0
			public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
			{
				// cannot save if no report part
				if (step.ReportPart == null)
					return false;

				// cannot save if the report part is no longer modifiable
				if (!step.ReportPart.IsModifiable)
					return false;

				// only the owner of this step can save
				if (step.PerformingStaff != null && !Equals(step.PerformingStaff, executingStaff))
					return false;

				return true;
			}
Example #14
0
            public ReportingProcedureStep Execute(ReportingProcedureStep step, Staff executingStaff, IWorkflow workflow)
            {
                UpdateStep(step, executingStaff);

                var verificationStep = new VerificationStep(step);

                verificationStep.Assign(executingStaff);
                verificationStep.Complete(executingStaff);
                workflow.AddEntity(verificationStep);

                var publicationStep = CreateScheduledPublicationStep(executingStaff, verificationStep);

                workflow.AddEntity(publicationStep);

                return(publicationStep);
            }
Example #15
0
            public List <InterpretationStep> Execute(ReportingProcedureStep step, Staff executingStaff, Staff assignStaff, IWorkflow workflow)
            {
                step.Discontinue();

                // cancel the report part if exists
                if (step.ReportPart != null)
                {
                    step.ReportPart.Cancel();
                }

                var interpretationSteps = new List <InterpretationStep>();

                if (!IsAddendumStep(step))
                {
                    var procedures = new HashedSet <Procedure> {
                        step.Procedure
                    };

                    // if there are linked procedures, schedule a new interpretation for each procedure being reported
                    if (step.ReportPart != null)
                    {
                        procedures.AddAll(step.ReportPart.Report.Procedures);
                    }

                    // schedule new interpretations
                    foreach (var procedure in procedures)
                    {
                        var interpretationStep = new InterpretationStep(procedure);

                        // Bug: #5128 - if the procedure is not document, do not schedule the replacement interpretation step,
                        // since interpretation steps aren't scheduled until documentation is complete.
                        if (procedure.IsDocumented)
                        {
                            interpretationStep.Schedule(procedure.PerformedTime);
                        }

                        if (assignStaff != null)
                        {
                            interpretationStep.Assign(assignStaff);
                        }

                        interpretationSteps.Add(interpretationStep);
                        workflow.AddEntity(interpretationStep);
                    }
                }
                return(interpretationSteps);
            }
Example #16
0
            protected void UpdateStep(ReportingProcedureStep step, Staff executingStaff)
            {
                if (step.PerformingStaff == null)
                {
                    step.Complete(executingStaff);
                }
                else
                {
                    step.Complete();
                }

                // move draft report to prelim status
                if (step.ReportPart.Status == ReportPartStatus.D)
                {
                    step.ReportPart.MarkPreliminary();
                }
            }
Example #17
0
            public InterpretationStep Execute(ReportingProcedureStep step, IWorkflow workflow)
            {
                // Cancel the current step
                step.Discontinue();

                // Create a new interpreatation step that uses the same report part
                var interpretationStep = new InterpretationStep(step);

                // Reset the verifier
                interpretationStep.ReportPart.Verifier = null;

                // Assign the new step to the interpreter
                var interpreter = interpretationStep.ReportPart.Interpreter;

                interpretationStep.Assign(interpreter);
                interpretationStep.Schedule(Platform.Time);

                workflow.AddEntity(interpretationStep);
                return(interpretationStep);
            }
Example #18
0
            public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
            {
                if (!step.Is <PublicationStep>())
                {
                    return(false);
                }

                // must be a scheduled publication step
                if (step.State != ActivityStatus.SC)
                {
                    return(false);
                }

                // can only publish reports verified by the same staff
                if (!Equals(step.ReportPart.Verifier, executingStaff))
                {
                    return(false);
                }

                return(true);
            }
Example #19
0
            public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
            {
                if (step.Is <VerificationStep>() == false)
                {
                    return(false);
                }

                // must be scheduled
                if (step.State != ActivityStatus.SC)
                {
                    return(false);
                }

                // cannot revise a report that was read by someone else
                if (!Equals(step.ReportPart.Interpreter, executingStaff))
                {
                    return(false);
                }

                return(true);
            }
Example #20
0
            public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
            {
                // cannot save if no report part
                if (step.ReportPart == null)
                {
                    return(false);
                }

                // cannot save if the report part is no longer modifiable
                if (!step.ReportPart.IsModifiable)
                {
                    return(false);
                }

                // only the owner of this step can save
                if (step.PerformingStaff != null && !Equals(step.PerformingStaff, executingStaff))
                {
                    return(false);
                }

                return(true);
            }
Example #21
0
            public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
            {
                // must be an interpretation step
                if (step.Is <TranscriptionReviewStep>() == false)
                {
                    return(false);
                }

                // must be scheduled
                if (step.State != ActivityStatus.SC)
                {
                    return(false);
                }

                // must not be assigned to another staff
                if (!Equals(step.AssignedStaff, executingStaff))
                {
                    return(false);
                }

                return(true);
            }
Example #22
0
            public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
            {
                // must be scheduled or in progress
                if (step.State != ActivityStatus.SC && step.State != ActivityStatus.IP)
                {
                    return(false);
                }

                // Cannot send back a report if it does not exist!
                if (step.ReportPart == null)
                {
                    return(false);
                }

                // cannot send back a report that was interpreted by the current staff
                if (Equals(step.ReportPart.Interpreter, executingStaff))
                {
                    return(false);
                }

                return(true);
            }
Example #23
0
			public ReportingProcedureStep Execute(ReportingProcedureStep step, Staff executingStaff, IWorkflow workflow)
			{
				UpdateStep(step, executingStaff);

				var verificationStep = new VerificationStep(step);

				// supervisor can be null, in which case the verification step is unassigned.
				verificationStep.Assign(step.ReportPart.Supervisor);

				workflow.AddEntity(verificationStep);
				return verificationStep;
			}
Example #24
0
			public ReportingProcedureStep Execute(ReportingProcedureStep step, Staff executingStaff, IWorkflow workflow)
			{
				UpdateStep(step, executingStaff);

				var verificationStep = new VerificationStep(step);
				verificationStep.Assign(executingStaff);
				verificationStep.Complete(executingStaff);
				workflow.AddEntity(verificationStep);

				var publicationStep = CreateScheduledPublicationStep(executingStaff, verificationStep);
				workflow.AddEntity(publicationStep);

				return publicationStep;
			}
Example #25
0
			public List<InterpretationStep> Execute(ReportingProcedureStep step, Staff executingStaff, Staff assignStaff, IWorkflow workflow)
			{
				step.Discontinue();

				// cancel the report part if exists
				if (step.ReportPart != null)
					step.ReportPart.Cancel();

				var interpretationSteps = new List<InterpretationStep>();
				if (!IsAddendumStep(step))
				{
					var procedures = new HashedSet<Procedure> { step.Procedure };

					// if there are linked procedures, schedule a new interpretation for each procedure being reported
					if (step.ReportPart != null)
					{
						procedures.AddAll(step.ReportPart.Report.Procedures);
					}

					// schedule new interpretations
					foreach (var procedure in procedures)
					{
						var interpretationStep = new InterpretationStep(procedure);

						// Bug: #5128 - if the procedure is not document, do not schedule the replacement interpretation step,
						// since interpretation steps aren't scheduled until documentation is complete.
						if (procedure.IsDocumented)
							interpretationStep.Schedule(procedure.PerformedTime);

						if (assignStaff != null)
							interpretationStep.Assign(assignStaff);

						interpretationSteps.Add(interpretationStep);
						workflow.AddEntity(interpretationStep);
					}
				}
				return interpretationSteps;
			}
Example #26
0
			public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
			{
				if (!step.Is<PublicationStep>())
					return false;

				// must be a scheduled publication step
				if (step.State != ActivityStatus.SC)
					return false;

				// can only publish reports verified by the same staff
				if (!Equals(step.ReportPart.Verifier, executingStaff))
					return false;

				return true;
			}
Example #27
0
 public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
 {
     return(CanExecute(step.Procedure, executingStaff));
 }
Example #28
0
			public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
			{
				// must be an interpretation step
				if (step.Is<TranscriptionReviewStep>() == false)
					return false;

				// must be scheduled
				if (step.State != ActivityStatus.SC)
					return false;

				// must not be assigned to another staff
				if (!Equals(step.AssignedStaff, executingStaff))
					return false;

				return true;
			}
 public ConcreteReportingProcedureStep(ReportingProcedureStep procedureStep)
     : base(procedureStep)
 {
 }
Example #30
0
			public ReportingProcedureStep Execute(ReportingProcedureStep step, Staff executingStaff, IWorkflow workflow)
			{
				UpdateStep(step, executingStaff);

				// Ensure Supervisor and Reject reason from previous transcriptions of the same report part are
				// removed.
				step.ReportPart.ResetTranscription();

				var transcriptionStep = new TranscriptionStep(step);
				transcriptionStep.Schedule(Platform.Time);
				workflow.AddEntity(transcriptionStep);
				return transcriptionStep;
			}
Example #31
0
			public abstract bool CanExecute(ReportingProcedureStep step, Staff executingStaff);
Example #32
0
			public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
			{
				// must be scheduled or in progress
				if (step.State != ActivityStatus.SC && step.State != ActivityStatus.IP)
					return false;

				// Cannot send back a report if it does not exist!
				if (step.ReportPart == null)
					return false;

				// cannot send back a report that was interpreted by the current staff
				if (Equals(step.ReportPart.Interpreter, executingStaff))
					return false;

				return true;
			}
		public TranscriptionReviewStep(ReportingProcedureStep previousStep)
			: base(previousStep)
		{
		}
Example #34
0
 public TranscriptionReviewStep(ReportingProcedureStep previousStep)
     : base(previousStep)
 {
 }
Example #35
0
			public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
			{
				if (!step.Is<VerificationStep>())
					return false;

				// must be scheduled
				if (step.State != ActivityStatus.SC)
					return false;

				if (step.AssignedStaff != null && !Equals(executingStaff, step.AssignedStaff))
					return false;

				if (step.ReportPart.Supervisor != null && !Equals(executingStaff, step.ReportPart.Supervisor))
					return false;

				return true;
			}
Example #36
0
 private bool IsAddendumStep(ReportingProcedureStep step)
 {
     return(step.ReportPart != null && step.ReportPart.IsAddendum);
 }
Example #37
0
			public InterpretationStep Execute(ReportingProcedureStep step, IWorkflow workflow)
			{
				// Cancel the current step
				step.Discontinue();

				// Create a new interpreatation step that uses the same report part
				var interpretationStep = new InterpretationStep(step);

				// Reset the verifier
				interpretationStep.ReportPart.Verifier = null;

				// Assign the new step to the interpreter
				var interpreter = interpretationStep.ReportPart.Interpreter;
				interpretationStep.Assign(interpreter);
				interpretationStep.Schedule(Platform.Time);

				workflow.AddEntity(interpretationStep);
				return interpretationStep;
			}
Example #38
0
			public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
			{
				if (!step.Is<VerificationStep>())
					return false;

				// must not be already completed or cancelled
				if (step.IsTerminated)
					return false;

				if (step.AssignedStaff != null && !Equals(executingStaff, step.AssignedStaff))
					return false;

				if (step.ReportPart.Supervisor != null && !Equals(executingStaff, step.ReportPart.Supervisor))
					return false;

				return true;
			}
Example #39
0
			public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
			{
				if (!step.Is<InterpretationStep>() && !step.Is<TranscriptionReviewStep>())
					return false;

				// interpretation steps must be in progress
				if (step.Is<InterpretationStep>() && step.State != ActivityStatus.IP)
					return false;

				// transcription review step must not be terminated
				if (step.Is<TranscriptionReviewStep>() && step.IsTerminated)
					return false;

				// must not be assigned to someone else
				if (!Equals(step.AssignedStaff, executingStaff))
					return false;

				return true;
			}
Example #40
0
			public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
			{
				if (step.Is<VerificationStep>() == false)
					return false;

				// must be scheduled
				if (step.State != ActivityStatus.SC)
					return false;

				// cannot revise a report that was read by someone else
				if (!Equals(step.ReportPart.Interpreter, executingStaff))
					return false;

				return true;
			}
Example #41
0
			protected void UpdateStep(ReportingProcedureStep step, Staff executingStaff)
			{
				if (step.PerformingStaff == null)
					step.Complete(executingStaff);
				else
					step.Complete();

				// move draft report to prelim status
				if (step.ReportPart.Status == ReportPartStatus.D)
					step.ReportPart.MarkPreliminary();
			}
Example #42
0
			private bool IsAddendumStep(ReportingProcedureStep step)
			{
				return step.ReportPart != null && step.ReportPart.IsAddendum;
			}
Example #43
0
			public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
			{
				// Publication steps cannot be cancelled after starting
				if (step.Is<PublicationStep>() && step.State != ActivityStatus.SC)
					return false;

				// cannot cancel an unclaimed interpretation step
				if (step.Is<InterpretationStep>() && step.AssignedStaff == null)
					return false;

				// cannot cancel once transcription has begun
				if (step.Is<TranscriptionStep>() && step.State != ActivityStatus.SC)
					return false;

				// cannot cancel a step that is already completed or cancelled
				if (step.IsTerminated)
					return false;

				return true;
			}
Example #44
0
 public abstract bool CanExecute(ReportingProcedureStep step, Staff executingStaff);
        /// <summary>
        /// Saves the report, and validates that a supervisor is present if the current user does not have 'unsupervised reporting' permissions.
        /// </summary>
        /// <param name="reportPartExtendedProperties"></param>
        /// <param name="step"></param>
        /// <param name="supervisor"></param>
        /// <param name="supervisorValidationRequired"></param>
        private void SaveReportHelper(Dictionary <string, string> reportPartExtendedProperties, ReportingProcedureStep step, Staff supervisor, bool supervisorValidationRequired)
        {
            if (supervisorValidationRequired &&
                Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.SubmitForReview) &&
                Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.OmitSupervisor) == false &&
                supervisor == null)
            {
                throw new SupervisorValidationException();
            }

            var saveReportOp = new Operations.SaveReport();

            saveReportOp.Execute(step, reportPartExtendedProperties, supervisor);
        }
Example #46
0
			public override bool CanExecute(ReportingProcedureStep step, Staff executingStaff)
			{
				return CanExecute(step.Procedure, executingStaff);
			}
            public ConcreteReportingProcedureStep(ReportingProcedureStep procedureStep)
                : base(procedureStep)
            {

            }
        private static RisServiceOperationRecorderBase.OperationData Capture(string operation, ReportingProcedureStep rps)
        {
            var reportPart     = rps.ReportPart;
            var procedures     = reportPart.Report.Procedures;
            var order          = procedures.First().Order;
            var patientProfile = procedures.First().PatientProfile;

            return(new RisServiceOperationRecorderBase.OperationData(operation, patientProfile, order, procedures));
        }