Esempio n. 1
0
        public static IPatientUpdateCommand MapHL7ToPatientUpdateCommand(IHL7MessageAdapter hl7)
        {
            var updateType = hl7.UpdateType;

            if (updateType == UpdateType.PatientUpdate ||
                updateType == UpdateType.PatientUpdatePatientSpecific ||
                updateType == UpdateType.PatientUpdateVisitSpecific ||
                updateType == UpdateType.ScheduleAppointment ||
                updateType == UpdateType.CheckInPatient ||
                updateType == UpdateType.CheckOutPatient)
            {
                var update = new UpdatePatient(hl7.getChangePatient());
                return(update);
            }
            else if (updateType == UpdateType.PatientMerge)
            {
                var merge          = new MergePatient(hl7.getMergePatient());
                var updateAttempt1 = new UpdatePatient(hl7.getChangePatient());
                var updateAttempt2 = new UpdatePatient(hl7.getChangePatientFromMrg());

                var cmd = (new CompositeContinueOnErrorCommand()).Add(merge).Add(updateAttempt1).Add(updateAttempt2);

                return(cmd);
            }
            else if (updateType == UpdateType.NewPatient)
            {
                var update = new NewPatient(hl7.getChangePatient());
                return(update);
            }
            else
            {
                throw new Exception("The requested update type is not supported.");
            }
        }
Esempio n. 2
0
        public static IMWLCommand MapHL7ToMWLCommand(IHL7MessageAdapter hl7, bool pps)
        {
            if (hl7.getOrderControl() == "NW")
            {
                var add = AddCommand(hl7, pps);

                if (HL7ServerMWL.HL7Options.HandleDuplicates)
                {
                    add.WhenFailed = UpdateCommand(hl7, pps);
                }

                return(add);
            }
            else if (hl7.getOrderControl() == "XO")
            {
                return(UpdateCommand(hl7, pps));
            }
            else if (hl7.getOrderControl() == "CA" || hl7.getOrderControl() == "DC")
            {
                return(DeleteCommand(hl7, pps));
            }
            else
            {
                throw new Exception("The order control is not recognized.");
            }
        }
Esempio n. 3
0
        public static void Execute(IHL7MessageAdapter hl7)
        {
            var AccessionNumber = hl7.getImageServiceRequest()?.AccessionNumber;

            if (string.IsNullOrEmpty(AccessionNumber))
            {
                AccessionNumber = UniqueIdProvider.NewUnique16BytesId();
            }

            var AdmissionID = hl7.getVisit()?.AdmissionID;

            if (string.IsNullOrEmpty(AdmissionID))
            {
                AdmissionID = UniqueIdProvider.NewUnique16BytesId();
            }

            if (null != hl7.getVisit())
            {
                hl7.getVisit().AdmissionID = AdmissionID;
            }
            if (null != hl7.getImageServiceRequest())
            {
                hl7.getImageServiceRequest().AccessionNumber = AccessionNumber;
            }
            if (null != hl7.getProcedure())
            {
                hl7.getProcedure().RequestedProcedureID = AccessionNumber;
            }
            if (null != hl7.getProcedureStep())
            {
                hl7.getProcedureStep().ScheduledProcedureStepID = AccessionNumber;
            }
        }
Esempio n. 4
0
        private static IMWLCommand AddCommand(IHL7MessageAdapter hl7, bool pps)
        {
            var patient   = new AddPatient(hl7.getPatient());
            var image     = new AddImageServiceRequest(hl7.getPatient(), hl7.getImageServiceRequest());
            var visit     = new AddVisit(hl7.getVisit());
            var procedure = new AddRequestedProcedure(hl7.getImageServiceRequest(), hl7.getProcedure());
            var scheduled = new AddScheduledProcedureStep(hl7.getImageServiceRequest(), hl7.getProcedure(), hl7.getProcedureStep());

            var cmd = (new TransactionCommand()).Add(patient).Add(image).Add(visit).Add(procedure).Add(scheduled);

            if (pps)
            {
                var addpps = new AddPPSInformation(hl7.getPPS());
                cmd.Add(addpps);
            }

            return(cmd.Add(new ResolveLinks()));
        }
Esempio n. 5
0
        private static IMWLCommand DeleteCommand(IHL7MessageAdapter hl7, bool pps)
        {
            var patient   = new DeletePatient(hl7.getPatient());
            var image     = new DeleteImageServiceRequest(hl7.getPatient(), hl7.getImageServiceRequest());
            var visit     = new DeleteVisit(hl7.getVisit());
            var procedure = new DeleteRequestedProcedure(hl7.getImageServiceRequest(), hl7.getProcedure());
            var scheduled = new DeleteScheduledProcedureStep(hl7.getProcedure(), hl7.getProcedureStep());

            var cmd = (new CompositeCommand()).Add(patient).Add(image).Add(scheduled).Add(procedure).Add(visit);

            if (pps)
            {
                var addpps = new DeletePPSInformation(hl7.getPPS());
                cmd.Add(addpps);
            }

            ResolveLinks.Execute(hl7);

            return(cmd);
        }