Package ca.uhn.hl7v2.model.v22.segment

Examples of ca.uhn.hl7v2.model.v22.segment.QRD


    public static Message toMessage(String body) throws HL7Exception {
        // replace \n with \r as HL7 uses 0x0d = \r as segment terminators and HAPI only parses with \r
        body = body.replace('\n', '\r');

        Parser parser = new PipeParser();
        Message message = parser.parse(body);
        return message;
    }
View Full Code Here


        return new RouteBuilder() {
            public void configure() throws Exception {
                from("mina:tcp://localhost:8888?sync=true&codec=hl7codec")
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            Message input = exchange.getIn().getBody(Message.class);

                            assertEquals("2.4", input.getVersion());
                            QRD qrd = (QRD)input.get("QRD");
                            assertEquals("0101701234", qrd.getWhoSubjectFilter(0).getIDNumber().getValue());

                            Message response = createHL7AsMessage();
                            exchange.getOut().setBody(response);
                        }
                    })
                    .to("mock:result");
            }
View Full Code Here

        mock.expectedMessageCount(1);
        mock.message(0).body().isInstanceOf(byte[].class);
        mock.message(0).bodyAs(String.class).contains("MSA|AA|123");
        mock.message(0).bodyAs(String.class).contains("QRD|20080805120000");

        Message message = createHL7AsMessage();
        template.sendBody("direct:marshal", message);

        assertMockEndpointsSatisifed();
    }
View Full Code Here

        String body = createHL7AsString();
        template.sendBody("direct:unmarshal", body);

        assertMockEndpointsSatisifed();

        Message msg = mock.getExchanges().get(0).getIn().getBody(Message.class);
        assertEquals("2.4", msg.getVersion());
        QRD qrd = (QRD) msg.get("QRD");
        assertEquals("0101701234", qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
    }
View Full Code Here

        return new RouteBuilder() {
            public void configure() throws Exception {
                from("mina:tcp://localhost:8888?sync=true&codec=hl7codec")
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            Message input = exchange.getIn().getBody(Message.class);

                            assertEquals("2.4", input.getVersion());
                            QRD qrd = (QRD)input.get("QRD");
                            assertEquals("0101701234", qrd.getWhoSubjectFilter(0).getIDNumber().getValue());

                            Message response = createHL7AsMessage();
                            exchange.getOut().setBody(response);
                        }
                    })
                    .to("mock:result");
            }
View Full Code Here

         * Now let's retrieve the patient's name from the parsed message.
         *
         * PN is an HL7 data type consisting of several components, such as
         * family name, given name, etc.
         */
        PN patientName = adtMsg.getPID().getPatientName();

        // Prints "SMITH"
        String familyName = patientName.getFamilyName().getValue();
        System.out.println(familyName);

    }
View Full Code Here

         * Now let's retrieve the patient's name from the parsed message.
         *
         * PN is an HL7 data type consisting of several components, such as
         * family name, given name, etc.
         */
        PN patientName = adtMsg.getPID().getPatientName();

        // Prints "SMITH"
        String familyName = patientName.getFamilyName().getValue();
        System.out.println(familyName);

    }
View Full Code Here

        String encodedMessage = new PipeParser().encode(theIn);
        System.out.println("Received message:\n" + encodedMessage + "\n\n");

        // Now we need to generate a message to return. This will generally be an ACK message.
        MSH msh = (MSH)theIn.get("MSH");
        ACK retVal;
        try {
            // This method takes in the MSH segment of an incoming message, and generates an
            // appropriate ACK
            retVal = (ACK)DefaultApplication.makeACK(msh);
        } catch (IOException e) {
View Full Code Here

         * accessors for ADT^A01's segments.
         *
         * HAPI provides several versions of the ADT_A01 class, each in a different package (note
         * the import statement above) corresponding to the HL7 version for the message.
         */
        ADT_A01 adtMsg = (ADT_A01)hapiMsg;

        MSH msh = adtMsg.getMSH();

        // Retrieve some data from the MSH segment
        String msgType = msh.getMessageType().getMessageType().getValue();
        String msgTrigger = msh.getMessageType().getTriggerEvent().getValue();

        // Prints "ADT A01"
        System.out.println(msgType + " " + msgTrigger);

        /*
         * Now let's retrieve the patient's name from the parsed message.
         *
         * PN is an HL7 data type consisting of several components, such as
         * family name, given name, etc.
         */
        PN patientName = adtMsg.getPID().getPatientName();

        // Prints "SMITH"
        String familyName = patientName.getFamilyName().getValue();
        System.out.println(familyName);

View Full Code Here

         * accessors for ADT^A01's segments.
         *
         * HAPI provides several versions of the ADT_A01 class, each in a different package (note
         * the import statement above) corresponding to the HL7 version for the message.
         */
        ADT_A01 adtMsg = (ADT_A01)hapiMsg;

        MSH msh = adtMsg.getMSH();

        // Retrieve some data from the MSH segment
        String msgType = msh.getMessageType().getMessageType().getValue();
        String msgTrigger = msh.getMessageType().getTriggerEvent().getValue();

        // Prints "ADT A01"
        System.out.println(msgType + " " + msgTrigger);

        /*
         * Now let's retrieve the patient's name from the parsed message.
         *
         * PN is an HL7 data type consisting of several components, such as
         * family name, given name, etc.
         */
        PN patientName = adtMsg.getPID().getPatientName();

        // Prints "SMITH"
        String familyName = patientName.getFamilyName().getValue();
        System.out.println(familyName);

View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.model.v22.segment.QRD

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.