Exemplo n.º 1
0
        static void Main(string[] args)
        {
            try
            {
                // create a new MLLP client over the specified port (note this class is from NHAPI Tools)
                //Note that using higher level encodings such as UTF-16 is not recommended due to conflict with
                //MLLP wrapping characters

                var connection = new SimpleMLLPClient("13.82.236.66", PORT_NUMBER, Encoding.UTF8);

                for (int i = 0; i <= 5; i++)
                {
                    Stopwatch watch = new Stopwatch();
                    watch.Start();
                    System.Threading.Thread.Sleep(3000);
                    SendBinaryDataB64InMessageHL7(connection); // new SimpleMLLPClient("localhost", PORT_NUMBER, Encoding.UTF8));
                    watch.Stop();
                    Console.WriteLine($"Tiempo Transcurrido Mensaje # {i} + " + watch.Elapsed.TotalSeconds);
                }



                // connection.Disconnect();

                //TerserMessageHL7();
                //ParserCustomMessageHL7();
                //ParserMessageHL7();
                //SendMessageHL7();
                //CreateMessagesParser(adtMessage);
            }
            catch (Exception e)
            {
                LogToDebugConsole($"Error occured while creating HL7 message {e.Message}");
            }
        }
Exemplo n.º 2
0
        private static int PORT_NUMBER = 57550;// change this to whatever your port number is
        public static void Main(String[] args)
        {
            try
            {
                // create the HL7 message
                // this OruMessageFactory class is not from NHAPI but my own wrapper class
                // check my GitHub page or see my earlier article for reference
                var oruMessage = OruMessageFactory.CreateMessage();

                // create a new MLLP client over the specified port (note this class is from NHAPI Tools)
                //Note that using higher level encodings such as UTF-16 is not recommended due to conflict with
                //MLLP wrapping characters

                var connection = new SimpleMLLPClient("localhost", PORT_NUMBER, Encoding.UTF8);

                // send the previously created HL7 message over the connection established
                var parser = new PipeParser();
                LogToDebugConsole("Sending ORU R01 message:" + "\n" + parser.Encode(oruMessage));
                var response = connection.SendHL7Message(oruMessage);

                // display the message response received from the remote party
                var responseString = parser.Encode(response);
                LogToDebugConsole("Received response:\n" + responseString);
            }
            catch (Exception e)
            {
                LogToDebugConsole($"Error occured while creating and transmitting HL7 message {e.Message}");
            }
        }
Exemplo n.º 3
0
        public SSLClientEndPoint(string hostname, int port, string serverCommunicationName, string serverEnvironment, string pathToCertificate, string certificatePassword)
        {
            mllpClient = new SimpleMLLPClient(hostname, port);

            // Add client certificate authentication if needed
            if (!string.IsNullOrEmpty(pathToCertificate) && !string.IsNullOrEmpty(certificatePassword))
            {
                mllpClient.AddCertificate(pathToCertificate, certificatePassword);
            }
            mllpClient.EnableSsl();

            ServerCommunicationName = serverCommunicationName;
            ServerEnvironment       = serverEnvironment;
        }
Exemplo n.º 4
0
        public string StringSendHl7MessageToRemote(string message)
        {
            string testMessage =
                @"MSH|^~\&|OAZIS||||201[FromBody] 40202232501||ADT^A04|07112951|P|2.3||||||ASCII"
                + "EVN | A04 | 20140202232501 |||| 201402022324"
                + "PID | 1 || 9012214504 | 90122124631 ^^^^ NN | Kasmi ^ Nora ^^^ Mevr.|| 19901221 | F ||| Borsbeeksesteenweg 96 ^^ DEURNE(ANTWERPEN) ^^ 2100 ^ B ^ H || 0496076965 ^^ CP || NL | 0 || 16037779 ^^^^ VN | 896076704 | 90122124631 |||||| B |||| N"
                + "PD1 |||| 115854 ^ Claeys ^ Margaretha |||||||| N"
                + "PV1 | 1 | E | 1521 ^ 01U ^ 01 ^ 002 ^ 0 ^ 0 | NULL ||| 115854 ^ Claeys ^ Margaretha || 002802 ^ Moni ^ Diane | 1502 ||||||| 002802 ^ Moni ^ Diane | 0 | 16037779 ^^^^ VN | 1 ^ 20140202 | 40 |||||||||||||||||| O ||||| 201402022324"
                + "PV2 || 040 ^^^ 40 | NULL |||||||||||||||||| 0 | N |||||||| T |||||||| 0 / 1 / 1 / 09 / A"
                + "OBX | 1 | CE | CODE_ADM | RCM | A"
                + "OBX | 2 | CE | REF_BY | RCM | 1 ^ 1 Op eigen initiatief"
                + "OBX | 3 | CE | COMING_FROM | RCM | 1 ^ 1 Thuis"
                + "OBX | 4 | CE | URG_CAUSE | RCM | Z ^ Z Somatische Ziekte"
                + "IN1 | 1 | 1 | 101000 | CHRIST.VERBOND ZIEKENFONDSEN | MOLENBERGSTRAAT, 2 ^^ ANTWERPEN 1 ^^ 2000 ^ B ||||||| 20100401 ||||| 0 || |||||||||||||||||||||||||||| 111 / 111 || 90122124631"
                + "FTS | 0 | 7112951";

            mllpClient = new SimpleMLLPClient(_mllpHostname, _mllpPort);
            return(mllpClient.SendHL7Message(message));
        }
        public String sendHL7Message()
        {
            String ackReceived = null;

            if ((this.destinationAddress != null) && (this.message != null))
            {
                try
                {
                    SimpleMLLPClient mllpClient = new SimpleMLLPClient(destinationAddress.Address.ToString(), destinationAddress.Port);
                    IMessage         response   = mllpClient.SendHL7Message(message);
                    ackReceived = TransformHL7Message.EncodeHL7Message(response);
                    mllpClient.Disconnect();
                }
                catch (Exception exception)
                {
                    ConnectionStatus.AddConnectionStatus(exception);
                }
            }
            return(ackReceived);
        }
        public IActionResult HL7messageSendToServer(int exmiantionId)
        {
            try
            {
                var examination = _patientInfoRepository.GetExamination(exmiantionId);

                if (examination == null)
                {
                    return(NotFound());
                }

                var patient = _patientInfoRepository.GetPatient(examination.PatientId);

                if (patient == null)
                {
                    return(NotFound());
                }

                var examDetail = _patientInfoRepository.GetExaminationDetail(patient.Id, examination.Id);

                if (examDetail == null)
                {
                    return(NotFound());
                }

                Message msg = CreateHL7Message(examination, "2.3", patient, examDetail);

                string           hl7msg = msg.Serialize();
                HL7RequestInfo   info   = hL7CommunicationService.ParseHL7RawMessage(hl7msg, "Http");
                SimpleMLLPClient client = new SimpleMLLPClient("localhost", 2021);
                //MLLPSession session = new MLLPSession();
                var result = client.SendHL7Message(info.Message);
                _patientInfoRepository.UpdateExaminationStatus(exmiantionId, true);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Internal Server Error"));
            }
        }
Exemplo n.º 7
0
        private static void SendMessageHL7()
        {
            // create the HL7 message
            // this AdtMessageFactory class is not from NHAPI but my own wrapper
            LogToDebugConsole("Creating ADT A01 message...");
            var adtMessage = AdtMessageFactory.CreateMessage("A01");

            // create a new MLLP client over the specified port (note this class is from NHAPI Tools)
            //Note that using higher level encodings such as UTF-16 is not recommended due to conflict with
            //MLLP wrapping characters
            var connection = new SimpleMLLPClient("localhost", PORT_NUMBER, Encoding.UTF8);

            var parser = new PipeParser();

            LogToDebugConsole("Sending message:" + "\n" + parser.Encode(adtMessage));
            var response = connection.SendHL7Message(adtMessage);

            var responseString = parser.Encode(response);

            LogToDebugConsole("Received response:\n" + responseString);
        }
Exemplo n.º 8
0
        private static void SendBinaryDataB64InMessageHL7(SimpleMLLPClient connection)
        {
            // create the HL7 message
            // this OruMessageFactory class is not from NHAPI but my own wrapper class
            var oruMessage = AdtMessageFactory.CreateMessage("R01");

            // send the previously created HL7 message over the connection established
            var pipeParser = new PipeParser();

            LogToDebugConsole($"Sending  :" + "\n" + pipeParser.Encode(oruMessage));
            var responseMessage = connection.SendHL7Message(oruMessage);

            //var ackError=  new Ack("HL7ServerIntegration360","Development").MakeACK(oruMessage, AckTypes.AE, "Error por malos datos");
            //LogToDebugConsole("Received response:\n" + pipeParser.Encode(ackError));

            // display the message response received from the remote party
            var responseString = pipeParser.Encode(responseMessage);

            LogToDebugConsole("Received response:\n" + responseString);

            //connection.Disconnect();
        }
Exemplo n.º 9
0
 public MLLPClientEndPoint(string hostname, int port, string serverCommunicationName, string serverEnvironment)
 {
     mllpClient = new SimpleMLLPClient(hostname, port);
     ServerCommunicationName = serverCommunicationName;
     ServerEnvironment       = serverEnvironment;
 }