public void Test_RevertCheckIn() { DateTime?now = DateTime.Now; var procedure = new Procedure { ProcedureCheckIn = new ProcedureCheckIn() }; var regStep = new RegistrationProcedureStep(procedure); var staff = TestStaffFactory.CreateStaff(); procedure.CheckIn(staff, now); Assert.IsFalse(procedure.IsPreCheckIn); Assert.IsTrue(procedure.IsCheckedIn); Assert.IsFalse(procedure.IsCheckedOut); Assert.AreEqual(ActivityStatus.IP, regStep.State); Assert.IsNull(regStep.EndTime); procedure.RevertCheckIn(); Assert.IsTrue(procedure.IsPreCheckIn); Assert.IsFalse(procedure.IsCheckedIn); Assert.IsFalse(procedure.IsCheckedOut); Assert.IsNull(procedure.ProcedureCheckIn.CheckInTime); Assert.IsNull(procedure.ProcedureCheckIn.CheckOutTime); // the registration step is not reverted Assert.AreEqual(ActivityStatus.IP, regStep.State); Assert.AreEqual(staff, regStep.PerformingStaff); }
public void UpdateProcedureFromRequisition(Procedure procedure, ProcedureRequisition requisition, Staff currentUserStaff, IPersistenceContext context) { // check if the procedure was cancelled if (requisition.Cancelled) { if (procedure.Status == ProcedureStatus.SC) { // if RP is still scheduled, cancel it procedure.Cancel(); } else if (procedure.Status == ProcedureStatus.IP) { // if RP in-progress, discontinue it procedure.Discontinue(); } // early exit - nothing else to update return; } // The following properties are appropriate only for procedures in SC status. if (!IsProcedureModifiable(procedure)) { return; } procedure.Schedule(requisition.ScheduledTime, requisition.ScheduledDuration); procedure.SchedulingCode = EnumUtils.GetEnumValue <SchedulingCodeEnum>(requisition.SchedulingCode, context); procedure.PerformingFacility = context.Load <Facility>(requisition.PerformingFacility.FacilityRef, EntityLoadFlags.Proxy); procedure.PerformingDepartment = requisition.PerformingDepartment == null ? null : context.Load <Department>(requisition.PerformingDepartment.DepartmentRef, EntityLoadFlags.Proxy); // if the requisition explicitly specifies a modality, assign that modality to all MPS // (we ignore the fact that the procedure plan can theoretically contain modality procedures steps spanning multiple // DICOM modalities, since in the small clinic use-case, each procedure type generally only has a single MPS) if (requisition.Modality != null) { foreach (var mps in procedure.ModalityProcedureSteps) { mps.Modality = context.Load <Modality>(requisition.Modality.ModalityRef, EntityLoadFlags.Proxy); } } procedure.Laterality = EnumUtils.GetEnumValue <Laterality>(requisition.Laterality); procedure.Portable = requisition.PortableModality; if (requisition.CheckedIn && procedure.IsPreCheckIn) { procedure.CheckIn(currentUserStaff, null); } else if (!requisition.CheckedIn && procedure.IsCheckedIn) { procedure.RevertCheckIn(); } }
public void Execute(Procedure rp, Staff checkInStaff, DateTime?checkInTime, IWorkflow workflow) { rp.CheckIn(checkInStaff, checkInTime); }
public void Execute(Procedure rp, Staff checkInStaff, DateTime? checkInTime, IWorkflow workflow) { rp.CheckIn(checkInStaff, checkInTime); }
public void Test_RevertCheckIn() { DateTime? now = DateTime.Now; var procedure = new Procedure { ProcedureCheckIn = new ProcedureCheckIn() }; var regStep = new RegistrationProcedureStep(procedure); var staff = TestStaffFactory.CreateStaff(); procedure.CheckIn(staff, now); Assert.IsFalse(procedure.IsPreCheckIn); Assert.IsTrue(procedure.IsCheckedIn); Assert.IsFalse(procedure.IsCheckedOut); Assert.AreEqual(ActivityStatus.IP, regStep.State); Assert.IsNull(regStep.EndTime); procedure.RevertCheckIn(); Assert.IsTrue(procedure.IsPreCheckIn); Assert.IsFalse(procedure.IsCheckedIn); Assert.IsFalse(procedure.IsCheckedOut); Assert.IsNull(procedure.ProcedureCheckIn.CheckInTime); Assert.IsNull(procedure.ProcedureCheckIn.CheckOutTime); // the registration step is not reverted Assert.AreEqual(ActivityStatus.IP, regStep.State); Assert.AreEqual(staff, regStep.PerformingStaff); }