public bool CanCancelReportingStep(ReportingWorklistItemKey itemKey)
        {
            // if there is no proc step ref, operation is not available
            if (itemKey.ProcedureStepRef == null)
            {
                return(false);
            }

            var procedureStep = this.PersistenceContext.Load <ProcedureStep>(itemKey.ProcedureStepRef);

            var isAssignedToMe = procedureStep.AssignedStaff != null && Equals(procedureStep.AssignedStaff, this.CurrentUserStaff);

            if (isAssignedToMe)
            {
                // Report is assigned to current user, allow cancel only if user has Create or Cancel token
                if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Create) &&
                    !Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Cancel))
                {
                    return(false);
                }
            }
            else
            {
                // Report not assigned to current user, allow cancel only if user has Cancel token
                if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Cancel))
                {
                    return(false);
                }
            }

            return(CanExecuteOperation(new Operations.CancelReportingStep(), itemKey));
        }
        private bool CanExecuteOperation(Operations.ReportingOperation op, ReportingWorklistItemKey itemKey, bool disableIfSubmitForReview)
        {
            // if there is no proc step ref, operation is not available
            if (itemKey.ProcedureStepRef == null)
            {
                return(false);
            }

            var procedureStep = this.PersistenceContext.Load <ProcedureStep>(itemKey.ProcedureStepRef);

            // for now, all of these operations assume they are operating on a ReportingProcedureStep
            // this may need to change in future
            if (!procedureStep.Is <ReportingProcedureStep>())
            {
                return(false);
            }

            // Special Case:
            // If the user has the SubmitForReview token and the step is unassigned, disable the operation
            if (disableIfSubmitForReview &&
                procedureStep.AssignedStaff == null &&
                Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.SubmitForReview))
            {
                return(false);
            }

            return(op.CanExecute(procedureStep.As <ReportingProcedureStep>(), this.CurrentUserStaff));
        }
 public bool CanCompleteInterpretationForTranscription(ReportingWorklistItemKey itemKey)
 {
     if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Create))
     {
         return(false);
     }
     return(CanExecuteOperation(new Operations.CompleteInterpretationForTranscription(), itemKey));
 }
 public bool CanStartTranscriptionReview(ReportingWorklistItemKey itemKey)
 {
     if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Create))
     {
         return(false);
     }
     return(CanExecuteOperation(new Operations.StartTranscriptionReview(), itemKey));
 }
        public bool CanReviseUnpublishedReport(ReportingWorklistItemKey itemKey)
        {
            if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Verify))
            {
                return(false);
            }

            return(CanExecuteOperation(new Operations.ReviseUnpublishedReport(), itemKey));
        }
 public bool CanCreateAddendum(ReportingWorklistItemKey itemKey)
 {
     // special case: procedure step not known, but procedure is
     if (itemKey.ProcedureRef != null)
     {
         var procedure = this.PersistenceContext.Load <Procedure>(itemKey.ProcedureRef);
         return((new Operations.CreateAddendum()).CanExecute(procedure, CurrentUserStaff));
     }
     return(false);
 }
        public bool CanCompleteVerification(ReportingWorklistItemKey itemKey)
        {
            if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Verify))
            {
                return(false);
            }

            // If the submit for review token is present, do not enable verification, defer to
            // revise report.  This ensures items submitted with or without a supervisor have a
            // consistent set of operations.
            return(CanExecuteOperation(new Operations.CompleteVerification(), itemKey, true));
        }
        public bool CanPublishReport(ReportingWorklistItemKey itemKey)
        {
#if DEBUG
            if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Development.TestPublishReport))
            {
                return(false);
            }

            return(CanExecuteOperation(new Operations.PublishReport(), itemKey));
#else
            return(false);
#endif
        }
        public bool CanCompleteDowntimeProcedure(ReportingWorklistItemKey itemKey)
        {
            // does the item have a procedure ref, or is it just a patient?
            if (itemKey.ProcedureRef == null)
            {
                return(false);
            }

            var procedure = this.PersistenceContext.Load <Procedure>(itemKey.ProcedureRef);

            // is the procedure a downtime proc, and is it performed and documented??
            return(procedure.DowntimeRecoveryMode && procedure.IsPerformed && procedure.IsDocumented);
        }
        public bool CanReassignProcedureStep(ReportingWorklistItemKey itemKey)
        {
            if (itemKey.ProcedureStepRef == null)
            {
                return(false);
            }

            var procedureStep = this.PersistenceContext.Load <ProcedureStep>(itemKey.ProcedureStepRef);

            if (procedureStep.Is <ProtocolProcedureStep>())
            {
                return(Thread.CurrentPrincipal.IsInRole(Common.AuthorityTokens.Workflow.Protocol.Reassign));
            }

            return(false);
        }
        public bool CanSendReportToQueue(ReportingWorklistItemKey itemKey)
        {
            // does the item have a procedure ref, or is it just a patient?
            if (itemKey.ProcedureRef == null)
            {
                return(false);
            }

            // does the procedure have an active report
            var procedure = this.PersistenceContext.Load <Procedure>(itemKey.ProcedureRef);

            if (procedure.ActiveReport == null)
            {
                return(false);
            }

            return(true);
        }
        public bool CanReassignProcedureStep(ReportingWorklistItemKey itemKey)
        {
            if (itemKey.ProcedureStepRef == null)
            {
                return(false);
            }

            var procedureStep = this.PersistenceContext.Load <ProcedureStep>(itemKey.ProcedureStepRef);

            // bug #6418 - this operation doesn't apply to transcription steps, because it doesn't make any sense to assign
            // a transcription step to a radiologist
            if (procedureStep.Is <TranscriptionStep>())
            {
                return(false);
            }

            if (procedureStep.Is <ReportingProcedureStep>())
            {
                return(Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Reassign) &&
                       !(procedureStep.Is <PublicationStep>()));
            }

            return(false);
        }
 private bool CanExecuteOperation(Operations.ReportingOperation op, ReportingWorklistItemKey itemKey)
 {
     return(CanExecuteOperation(op, itemKey, false));
 }
Beispiel #14
0
		public bool CanReviseResidentReport(ReportingWorklistItemKey itemKey)
		{
			if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.SubmitForReview))
				return false;

			return CanExecuteOperation(new Operations.ReviseResidentReport(), itemKey);
		}
Beispiel #15
0
		public bool CanCompleteDowntimeProcedure(ReportingWorklistItemKey itemKey)
		{
			// does the item have a procedure ref, or is it just a patient?
			if (itemKey.ProcedureRef == null)
				return false;

			var procedure = this.PersistenceContext.Load<Procedure>(itemKey.ProcedureRef);

			// is the procedure a downtime proc, and is it performed and documented??
			return procedure.DowntimeRecoveryMode && procedure.IsPerformed && procedure.IsDocumented;
		}
        private bool CanExecuteOperation(TranscriptionOperations.TranscriptionOperation op, ReportingWorklistItemKey itemKey)
        {
            if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Transcription.Create))
            {
                return(false);
            }

            // if there is no proc step ref, operation is not available
            if (itemKey.ProcedureStepRef == null)
            {
                return(false);
            }

            var step = this.PersistenceContext.Load <ProcedureStep>(itemKey.ProcedureStepRef);

            // for now, all of these operations assume they are operating on a
            // this may need to change in future
            if (!step.Is <TranscriptionStep>())
            {
                return(false);
            }

            return(op.CanExecute(step.As <TranscriptionStep>(), this.CurrentUserStaff));
        }
 public bool CanSubmitTranscriptionForReview(ReportingWorklistItemKey itemKey)
 {
     return(CanExecuteOperation(new TranscriptionOperations.SubmitTranscriptionForReview(), itemKey));
 }
		public bool CanRejectTranscription(ReportingWorklistItemKey itemKey)
		{
			return CanExecuteOperation(new TranscriptionOperations.RejectTranscription(), itemKey);
		}
Beispiel #19
0
		public bool CanReviseUnpublishedReport(ReportingWorklistItemKey itemKey)
		{
			if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Verify))
				return false;

			return CanExecuteOperation(new Operations.ReviseUnpublishedReport(), itemKey);
		}
Beispiel #20
0
		public bool CanCompleteInterpretationAndVerify(ReportingWorklistItemKey itemKey)
		{
			if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Verify))
				return false;

			return CanExecuteOperation(new Operations.CompleteInterpretationAndVerify(), itemKey);
		}
Beispiel #21
0
		public bool CanPublishReport(ReportingWorklistItemKey itemKey)
		{
#if DEBUG
			if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Development.TestPublishReport))
				return false;

			return CanExecuteOperation(new Operations.PublishReport(), itemKey);
#else
			return false;
#endif
		}
Beispiel #22
0
		public bool CanSaveReport(ReportingWorklistItemKey itemKey)
		{
			return CanExecuteOperation(new Operations.SaveReport(), itemKey);
		}
Beispiel #23
0
		public bool CanReassignProcedureStep(ReportingWorklistItemKey itemKey)
		{
			if (itemKey.ProcedureStepRef == null)
				return false;

			var procedureStep = this.PersistenceContext.Load<ProcedureStep>(itemKey.ProcedureStepRef);

			// bug #6418 - this operation doesn't apply to transcription steps, because it doesn't make any sense to assign
			// a transcription step to a radiologist
			if (procedureStep.Is<TranscriptionStep>())
				return false;

			if (procedureStep.Is<ReportingProcedureStep>())
				return Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Reassign)
					   && !(procedureStep.Is<PublicationStep>());

			return false;
		}
Beispiel #24
0
		private bool CanExecuteOperation(Operations.ReportingOperation op, ReportingWorklistItemKey itemKey, bool disableIfSubmitForReview)
		{
			// if there is no proc step ref, operation is not available
			if (itemKey.ProcedureStepRef == null)
				return false;

			var procedureStep = this.PersistenceContext.Load<ProcedureStep>(itemKey.ProcedureStepRef);

			// for now, all of these operations assume they are operating on a ReportingProcedureStep
			// this may need to change in future
			if (!procedureStep.Is<ReportingProcedureStep>())
				return false;

			// Special Case:
			// If the user has the SubmitForReview token and the step is unassigned, disable the operation
			if (disableIfSubmitForReview
				&& procedureStep.AssignedStaff == null
				&& Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.SubmitForReview))
			{
				return false;
			}

			return op.CanExecute(procedureStep.As<ReportingProcedureStep>(), this.CurrentUserStaff);
		}
Beispiel #25
0
		private bool CanExecuteOperation(Operations.ReportingOperation op, ReportingWorklistItemKey itemKey)
		{
			return CanExecuteOperation(op, itemKey, false);
		}
Beispiel #26
0
		public bool CanCancelReportingStep(ReportingWorklistItemKey itemKey)
		{
			// if there is no proc step ref, operation is not available
			if (itemKey.ProcedureStepRef == null)
				return false;

			var procedureStep = this.PersistenceContext.Load<ProcedureStep>(itemKey.ProcedureStepRef);

			var isAssignedToMe = procedureStep.AssignedStaff != null && Equals(procedureStep.AssignedStaff, this.CurrentUserStaff);
			if (isAssignedToMe)
			{
				// Report is assigned to current user, allow cancel only if user has Create or Cancel token
				if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Create) &&
					!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Cancel))
					return false;
			}
			else
			{
				// Report not assigned to current user, allow cancel only if user has Cancel token
				if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Cancel))
					return false;
			}

			return CanExecuteOperation(new Operations.CancelReportingStep(), itemKey);
		}
		public bool CanSubmitTranscriptionForReview(ReportingWorklistItemKey itemKey)
		{
			return CanExecuteOperation(new TranscriptionOperations.SubmitTranscriptionForReview(), itemKey);
		}
Beispiel #28
0
		public bool CanCreateAddendum(ReportingWorklistItemKey itemKey)
		{
			// special case: procedure step not known, but procedure is
			if (itemKey.ProcedureRef != null)
			{
				var procedure = this.PersistenceContext.Load<Procedure>(itemKey.ProcedureRef);
				return (new Operations.CreateAddendum()).CanExecute(procedure, CurrentUserStaff);
			}
			return false;
		}
		private bool CanExecuteOperation(TranscriptionOperations.TranscriptionOperation op, ReportingWorklistItemKey itemKey)
		{
			if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Transcription.Create))
				return false;

			// if there is no proc step ref, operation is not available
			if (itemKey.ProcedureStepRef == null)
				return false;

			var step = this.PersistenceContext.Load<ProcedureStep>(itemKey.ProcedureStepRef);

			// for now, all of these operations assume they are operating on a 
			// this may need to change in future
			if (!step.Is<TranscriptionStep>())
				return false;

			return op.CanExecute(step.As<TranscriptionStep>(), this.CurrentUserStaff);
		}
Beispiel #30
0
		public bool CanCompleteVerification(ReportingWorklistItemKey itemKey)
		{
			if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Verify))
				return false;

			// If the submit for review token is present, do not enable verification, defer to 
			// revise report.  This ensures items submitted with or without a supervisor have a
			// consistent set of operations.
			return CanExecuteOperation(new Operations.CompleteVerification(), itemKey, true);
		}
 public bool CanRejectTranscription(ReportingWorklistItemKey itemKey)
 {
     return(CanExecuteOperation(new TranscriptionOperations.RejectTranscription(), itemKey));
 }
 public bool CanSaveReport(ReportingWorklistItemKey itemKey)
 {
     return(CanExecuteOperation(new Operations.SaveReport(), itemKey));
 }
Beispiel #33
0
		public bool CanStartTranscriptionReview(ReportingWorklistItemKey itemKey)
		{
			if (!Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.Create))
				return false;
			return CanExecuteOperation(new Operations.StartTranscriptionReview(), itemKey);
		}
Beispiel #34
0
		public bool CanSendReportToQueue(ReportingWorklistItemKey itemKey)
		{
			// does the item have a procedure ref, or is it just a patient?
			if (itemKey.ProcedureRef == null)
				return false;

			// does the procedure have an active report
			var procedure = this.PersistenceContext.Load<Procedure>(itemKey.ProcedureRef);
			if (procedure.ActiveReport == null)
				return false;

			return true;
		}