public override void HandleEvent(LogicalHL7EventArgs args)
        {
            Platform.Log(LogLevel.Info, "Handling Logical HL7 event {0} for {1}", args.EventType, Peer);
            var order          = GetOrder(args);
            var patientProfile = GetPatientProfile(order);
            var visit          = GetVisit(patientProfile, order);
            var report         = args.IsReportEvent() ? GetReport(args) : null;

            if (report == null)
            {
                //should log this weird condtion
                return;
            }

            var applicableProcedures = args.IsProcedureEvent()
                ? CollectionUtils.Select(report.Procedures, orderProcedure => args.ProcedureOID.Equals(orderProcedure.OID))
                : (IEnumerable <Procedure>)order.Procedures;

            foreach (var procedure in applicableProcedures)
            {
                var message = new ORU_R01();
                var helper  = new MessageHelper("CCRis", "CCRisFacility", "TestPeer", "TestPeerFacility");
                helper.SetMSH(message.MSH, "ORU", "R01");
                helper.SetOBR(message.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR, order, procedure);
                helper.SetORC(message.GetPATIENT_RESULT().GetORDER_OBSERVATION().ORC,
                              order, procedure, GetOrderControlCode(args.EventType));
                helper.SetPID(message.GetPATIENT_RESULT().PATIENT.PID, patientProfile);
                helper.SetPV1(message.GetPATIENT_RESULT().PATIENT.VISIT.PV1, visit);
                helper.SetTQ1(message.GetPATIENT_RESULT().GetORDER_OBSERVATION().GetTIMING_QTY().TQ1, procedure);
                helper.SetOrderNotes(message, order);
                helper.SetReport(message, order, report);
                EnqueueMessage(message, "ORU^R01");
            }
        }
        protected static Report GetReport(LogicalHL7EventArgs item)
        {
            var criteria = new ReportSearchCriteria();

            criteria.OID.EqualTo(item.ReportOID);
            return(PersistenceScope.CurrentContext.GetBroker <IReportBroker>().FindOne(criteria));
        }
        protected Order GetOrder(LogicalHL7EventArgs item)
        {
            var criteria = new OrderSearchCriteria();

            criteria.OID.EqualTo(item.OrderOID);
            return(PersistenceScope.CurrentContext.GetBroker <IOrderBroker>().FindOne(criteria));
        }
예제 #4
0
		protected override void ActOnItem(WorkQueueItem item)
		{
			var logicalEvent = new LogicalHL7EventArgs(item);
			Platform.Log(LogLevel.Info, String.Format("Procssing HL7LogicalEvent {0}", item.OID));

			foreach (ILogicalHL7EventListener listener in new LogicalHL7EventListenerExtensionPoint().CreateExtensions())
			{
				listener.OnEvent(logicalEvent);
			}
		}
        protected override void ActOnItem(WorkQueueItem item)
        {
            var logicalEvent = new LogicalHL7EventArgs(item);

            Platform.Log(LogLevel.Info, String.Format("Procssing HL7LogicalEvent {0}", item.OID));

            foreach (ILogicalHL7EventListener listener in new LogicalHL7EventListenerExtensionPoint().CreateExtensions())
            {
                listener.OnEvent(logicalEvent);
            }
        }
예제 #6
0
 public void OnEvent(LogicalHL7EventArgs eventArgs)
 {
     if (_handlers.ContainsKey(eventArgs.EventType))
     {
         var instance = Activator.CreateInstance(_handlers[eventArgs.EventType]) as THandlerInterface;
         if (instance != null)
         {
             instance.HandleEvent(eventArgs);
         }
     }
 }
        public override void HandleEvent(LogicalHL7EventArgs args)
        {
            Platform.Log(LogLevel.Info, "Handling Logical HL7 event {0} for {1}", args.EventType, Peer);
            var order                = GetOrder(args);
            var patientProfile       = GetPatientProfile(order);
            var visit                = GetVisit(patientProfile, order);
            var applicableProcedures = args.IsProcedureEvent()
                ? CollectionUtils.Select(order.Procedures, orderProcedure => args.ProcedureOID.Equals(orderProcedure.OID))
                : (IEnumerable <Procedure>)order.Procedures;

            foreach (var procedure in applicableProcedures)
            {
                var message = new OMI_O23();
                var helper  = new MessageHelper("CCRis", "CCRisFacility", "TestPeer", "TestPeerFacility");
                helper.SetMSH(message.MSH, "OMI", "023");
                helper.SetOBR(message.GetORDER().OBR, order, procedure);
                helper.SetORC(message.GetORDER().ORC, order, procedure, GetOrderControlCode(args.EventType));
                helper.SetPID(message.PATIENT.PID, patientProfile);
                helper.SetPV1(message.PATIENT.PATIENT_VISIT.PV1, visit);
                helper.SetTQ1(message.GetORDER().GetTIMING().TQ1, procedure);

                EnqueueMessage(message, "OMI^023");
            }
        }
 public abstract void HandleEvent(LogicalHL7EventArgs args);