private static OperationData Capture(DiscontinueModalityProcedureStepsRequest request, IPersistenceContext persistenceContext)
			{
				var procedures = request.ModalityProcedureSteps.Select(r => persistenceContext.Load<ModalityProcedureStep>(r, EntityLoadFlags.None).Procedure).ToList();
				var order = procedures.First().Order;
				var patientProfile = procedures.First().PatientProfile;

				return new OperationData(Operations.Discontinue, patientProfile, order, procedures);
			}
Пример #2
0
		public DiscontinueModalityProcedureStepsResponse DiscontinueModalityProcedureSteps(DiscontinueModalityProcedureStepsRequest request)
		{
			Platform.CheckForNullReference(request, "request");
			Platform.CheckMemberIsSet(request.ModalityProcedureSteps, "ModalityProcedureSteps");

			// load the set of mps
			var modalitySteps = CollectionUtils.Map<EntityRef, ModalityProcedureStep>(
				request.ModalityProcedureSteps,
				mpsRef => this.PersistenceContext.Load<ModalityProcedureStep>(mpsRef));

			foreach (var step in modalitySteps)
			{
				var op = new DiscontinueModalityProcedureStepOperation();
				op.Execute(step, request.DiscontinuedTime, new PersistentWorkflow(this.PersistenceContext));

				// If discontinuing the procedure step caused the parent procedure to be discontinued,
				// create an HL7 event.
				if (step.Procedure.IsTerminated)
					LogicalHL7Event.ProcedureCancelled.EnqueueEvents(step.Procedure);
			}

			this.PersistenceContext.SynchState();

			var assembler = new ProcedurePlanAssembler();
			return new DiscontinueModalityProcedureStepsResponse(
				assembler.CreateProcedurePlanSummary(modalitySteps[0].Procedure.Order, this.PersistenceContext));
		}