예제 #1
0
        public void onDebugStartWithMessage()
        {
            string path  = @"C:\Users\chrisb\Documents\ApplicationDevelopment\Working\HL7Broker.root\HL7Broker\HL7Broker\Messages\ORMSC_LOCATION.hl7";
            string input = HL7Message.ReadHL7FromFile(path);
            // attempt to scrub message
            string hl7Input = HL7MessageUtility.scrubHL7MessageForParse(input);

            // Get Incoming HL7 Message Configuration
            HL7Message hl7Message = HL7MessageDAO.getMessage(hl7Input);

            string value = HL7MessageUtility.getValueByPosition(hl7Message, Generic.SegmentType.PV1, "11.2");
        }
예제 #2
0
        public static void handleIncomingHL7MessageToBroker(string hl7Input,
                                                            Communication interfaceCommunication,
                                                            HL7Broker.Model.Socket socket)
        {
            // attempt to scrub message
            hl7Input = HL7MessageUtility.scrubHL7MessageForParse(hl7Input);

            // Get Incoming HL7 Message Configuration
            HL7Message hl7Message = HL7MessageDAO.getMessage(hl7Input);

            // if the message is not null
            if (hl7Message != null)
            {
                // set the hl7 message to the socket object
                socket.setHL7Message(hl7Message);
            }
        }
예제 #3
0
        public static void handleProcessingForOutboundHandler(Configuration masterConfig, OutboundHandler outboundHandler)
        {
            // to control some basic CPU handling settings
            Config outboundConfig = new Config();

            // load each of the configurations into their own objects
            List <Application>           applications          = masterConfig.applications;
            List <Communication>         communications        = masterConfig.communications;
            List <WebserviceObject>      webserviceObjects     = masterConfig.webserviceObjects;
            List <WebserviceInstance>    webserviceInstances   = masterConfig.webserviceInstances;
            List <WebservicePropertySet> webserviceProperties  = masterConfig.webservicePropertySets;
            List <MessageGroup>          messageGroups         = masterConfig.messageGroups;
            List <MessageGroupInstance>  messageGroupInstances = masterConfig.messageGroupInstances;

            // continue to read the table
            while (true)
            {
                applications.ForEach(delegate(Application app)
                {
                    if (app.name == outboundHandler.getApplicationName())
                    {
                        // get the unprocessed message count for the application
                        List <MessageBucket> brokerInformation
                            = MessageBucketDAO.GetUnprocessedMessageHeaderInstancesByApplication(app);

                        // set the MOD from config file.
                        var options = new ParallelOptions {
                            MaxDegreeOfParallelism = outboundConfig.MaxDegreeOfParallelism
                        };
                        // parallel For each
                        Parallel.ForEach(brokerInformation, options, broker =>
                        {
                            // get the message header and message
                            MessageHeaderInstance messageHeaderInstance = broker.messageHeaderInstance;
                            Message message = broker.message;

                            // srub the input of bad stuff
                            string hl7Scrubbed = HL7MessageUtility.scrubHL7MessageForParse(message.hl7Raw);

                            // make the hl7 message
                            HL7Message hl7Message = HL7MessageDAO.getMessage(hl7Scrubbed);

                            // locally retrieve the communication object from memory
                            Communication communication
                                = ConfigurationUtility.GetIncomingWebserviceCommunication(app, communications);

                            // locally retrieve the webservice instance object from memory
                            WebserviceInstance webserviceInstance
                                = ConfigurationUtility.GetIncomingWebserviceInstance(communication, webserviceInstances);

                            // locally retrieve the web service objects from memory
                            List <WebserviceObject> wsObjects
                                = ConfigurationUtility.GetIncomingWebserviceObjects(webserviceInstance, webserviceObjects);

                            // determine the message type
                            Generic.MessageType messageType
                                = HL7MessageUtility.getMessageType(hl7Message, hl7Scrubbed);

                            switch (messageType)
                            {
                            // to handle a new message add message type then its own handler
                            case Generic.MessageType.ADT:
                                break;

                            case Generic.MessageType.ORM:
                                handleProcessingForORM(wsObjects,
                                                       webserviceProperties,
                                                       hl7Message,
                                                       messageGroupInstances,
                                                       messageGroups,
                                                       app,
                                                       message);
                                break;

                            case Generic.MessageType.ORU:
                                handleProcessingForORU(wsObjects,
                                                       webserviceProperties,
                                                       hl7Message,
                                                       messageGroupInstances,
                                                       messageGroups,
                                                       app,
                                                       message);
                                break;

                            case Generic.MessageType.SIU:
                                break;

                            case Generic.MessageType.UNKNOWN:
                                break;

                            default:
                                break;
                            }

                            // update the table to processed
                            MessageBucketDAO.UpdateProcessedFlagAndMessageLog(messageHeaderInstance, message, true);

                            // update broker stats
                            handleBrokerStatUpdate(message, communication);
                        });
                    }
                });

                // provide blocking if there is no data to process.
                Thread.Sleep(1000);
            }
        }