Package ca.uhn.hl7v2.model.v231.segment

Examples of ca.uhn.hl7v2.model.v231.segment.OBX


* @see org.apache.camel.component.hl7.HL7MLLPCodec
*/
public class HL7DataFormat implements DataFormat {

    public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception {
        Message message = ExchangeHelper.convertToMandatoryType(exchange, Message.class, body);
        String encoded = HL7Converter.toString(message);
        outputStream.write(encoded.getBytes());
    }
View Full Code Here


        outputStream.write(encoded.getBytes());
    }

    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
        String body = ExchangeHelper.convertToMandatoryType(exchange, String.class, inputStream);
        Message message = HL7Converter.toMessage(body);

        // add MSH fields as message out headers
        Terser terser = new Terser(message);
        exchange.getOut().setHeader(HL7Constants.HL7_SENDING_APPLICATION, terser.get("MSH-3"));
        exchange.getOut().setHeader(HL7Constants.HL7_SENDING_FACILITY, terser.get("MSH-4"));
View Full Code Here

    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

        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.
        Segment msh = (Segment) theIn.get("MSH");
        Message retVal;
        try {
            // This method takes in the MSH segment of an incoming message, and generates an
            // appropriate ACK
            retVal = DefaultApplication.makeACK(msh);
View Full Code Here

    // send the MIME message into a ByteArrayOutputStream
    ByteArrayOutputStream byte1 = new ByteArrayOutputStream();
    mimeMessage.writeTo(byte1);

    // set the value of ED with the String
    ED encapsuledData = new ED(mdmMessage);

    encapsuledData.getTypeOfData().setValue("multipart");
    encapsuledData.getDataSubtype().setValue("x-hl7-cda-level-one");
    encapsuledData.getEncoding().setValue("A");
   
    encapsuledData.getData().setValue( byte1.toString() );

    // setting the data in the OBX segment
    obx.getObservationIdentifier().getIdentifier().setValue("1");
    obx.getValueType().setValue("CE");
    obx.getObservationValue(0).setData(encapsuledData);
View Full Code Here

    /*
     * In this example, a CDA r2 document is being embedded as mime content
     * in an MDM_T02 message.
     */
   
    MDM_T02 mdmMessage = new MDM_T02();

    // A few basic MSH fields are populated. In a real situation, this would not be enough
        // to produce a valid message, but for demonstration purposes we'll skip a few
        // fields.
        mdmMessage.getMSH().getEncodingCharacters().setValue("^~\\&");
        mdmMessage.getMSH().getFieldSeparator().setValue("|");

        OBX obx = mdmMessage.getOBX();
   
        // This is not a complete CDA document, but it serves as a good example
        String sampleClinicalDocument = "<ClinicalDocument xsi:schemaLocation=\"urn:hl7-org:v3 CDA.ReleaseTwo.CommitteeBallot03.Aug.2004.xsd\" templateId=\"2.16.840.1.113883.3.27.1776\">\r\n" +
            "   <id extension=\"c266\" root=\"2.16.840.1.113883.3.933\"/>\r\n" +
            "   <code code=\"11488-4\" codeSystem=\"2.16.840.1.113883.6.1\" displayName=\"Consultation note\"/>\r\n" +
View Full Code Here

        // to produce a valid message, but for demonstration purposes we'll skip a few
        // fields.
        mdmMessage.getMSH().getEncodingCharacters().setValue("^~\\&");
        mdmMessage.getMSH().getFieldSeparator().setValue("|");

        OBX obx = mdmMessage.getOBX();
   
        // This is not a complete CDA document, but it serves as a good example
        String sampleClinicalDocument = "<ClinicalDocument xsi:schemaLocation=\"urn:hl7-org:v3 CDA.ReleaseTwo.CommitteeBallot03.Aug.2004.xsd\" templateId=\"2.16.840.1.113883.3.27.1776\">\r\n" +
            "   <id extension=\"c266\" root=\"2.16.840.1.113883.3.933\"/>\r\n" +
            "   <code code=\"11488-4\" codeSystem=\"2.16.840.1.113883.6.1\" displayName=\"Consultation note\"/>\r\n" +
            "   <title>Good Health Clinic Consultation Note</title>\r\n" +
            "   <effectiveTime value=\"20000407\"/>\r\n" +
            "</ClinicalDocument>";
       

    MimeMultipart mimeMessage = new MimeMultipart();
    MimeBodyPart bodyPart = new MimeBodyPart();
    bodyPart.setText(sampleClinicalDocument);
    mimeMessage.addBodyPart(bodyPart);
   
    // send the MIME message into a ByteArrayOutputStream
    ByteArrayOutputStream byte1 = new ByteArrayOutputStream();
    mimeMessage.writeTo(byte1);

    // set the value of ED with the String
    ED encapsuledData = new ED(mdmMessage);

    encapsuledData.getTypeOfData().setValue("multipart");
    encapsuledData.getDataSubtype().setValue("x-hl7-cda-level-one");
    encapsuledData.getEncoding().setValue("A");
   
    encapsuledData.getData().setValue( byte1.toString() );

    // setting the data in the OBX segment
    obx.getObservationIdentifier().getIdentifier().setValue("1");
    obx.getValueType().setValue("CE");
    obx.getObservationValue(0).setData(encapsuledData);
   
    // Print the message out
    System.out.println(new PipeParser().encode(mdmMessage));
   
    /*
 
View Full Code Here

        obr.getFillerOrderNumber().getEntityIdentifier().setValue("1234");
        obr.getFillerOrderNumber().getNamespaceID().setValue("LAB");
        obr.getUniversalServiceIdentifier().getIdentifier().setValue("88304");
       
        // Populate the first OBX
        OBX obx = orderObservation.getOBSERVATION(0).getOBX();
        obx.getSetIDOBX().setValue("1");
        obx.getObservationIdentifier().getIdentifier().setValue("88304");
        obx.getObservationSubID().setValue("1");

        // The first OBX has a value type of CE. So first, we populate OBX-2 with "CE"...
        obx.getValueType().setValue("CE");
       
        // ... then we create a CE instance to put in OBX-5.
        CE ce = new CE(message);
        ce.getIdentifier().setValue("T57000");
        ce.getText().setValue("GALLBLADDER");
        ce.getNameOfCodingSystem().setValue("SNM");
        Varies value = obx.getObservationValue(0);
        value.setData(ce);
       
        // Now we populate the second OBX
        obx = orderObservation.getOBSERVATION(1).getOBX();
        obx.getSetIDOBX().setValue("2");
        obx.getObservationSubID().setValue("1");

        // The second OBX in the sample message has an extra subcomponent at
        // OBX-3-1. This component is actually an ST, but the HL7 specification allows
        // extra subcomponents to be tacked on to the end of a component. This is
        // uncommon, but HAPI nontheless allows it.
        ST observationIdentifier = obx.getObservationIdentifier().getIdentifier();
        observationIdentifier.setValue("88304");
        ST extraSubcomponent = new ST(message);
        extraSubcomponent.setValue("MDT");
        observationIdentifier.getExtraComponents().getComponent(0).setData(extraSubcomponent );

        // The first OBX has a value type of TX. So first, we populate OBX-2 with "TX"...
        obx.getValueType().setValue("TX");
       
        // ... then we create a CE instance to put in OBX-5.
        TX tx = new TX(message);
        tx.setValue("MICROSCOPIC EXAM SHOWS HISTOLOGICALLY NORMAL GALLBLADDER TISSUE");
        value = obx.getObservationValue(0);
        value.setData(tx);

        // Print the message (remember, the MSH segment was not fully or correctly populated)
        System.out.append(new PipeParser().encode(message));
View Full Code Here

         * current number of repetitions,and a new repetition will be created.
         */
        ORU_R01_OBSERVATION observation = orderObservation.getOBSERVATION(0);

        // Populate the first OBX
    OBX obx = observation.getOBX();
        obx.getSetIDOBX().setValue("1");
        obx.getObservationIdentifier().getIdentifier().setValue("88304");
        obx.getObservationSubID().setValue("1");

        // The first OBX has a value type of CE. So first, we populate OBX-2 with "CE"...
        obx.getValueType().setValue("CE");
       
        // ... then we create a CE instance to put in OBX-5.
        CE ce = new CE(message);
        ce.getIdentifier().setValue("T57000");
        ce.getText().setValue("GALLBLADDER");
        ce.getNameOfCodingSystem().setValue("SNM");
        Varies value = obx.getObservationValue(0);
        value.setData(ce);
       
        // Now we populate the second OBX
        obx = orderObservation.getOBSERVATION(1).getOBX();
        obx.getSetIDOBX().setValue("2");
        obx.getObservationSubID().setValue("1");

        // The second OBX in the sample message has an extra subcomponent at
        // OBX-3-1. This component is actually an ST, but the HL7 specification allows
        // extra subcomponents to be tacked on to the end of a component. This is
        // uncommon, but HAPI nontheless allows it.
        ST observationIdentifier = obx.getObservationIdentifier().getIdentifier();
        observationIdentifier.setValue("88304");
        ST extraSubcomponent = new ST(message);
        extraSubcomponent.setValue("MDT");
        observationIdentifier.getExtraComponents().getComponent(0).setData(extraSubcomponent );

        // The first OBX has a value type of TX. So first, we populate OBX-2 with "TX"...
        obx.getValueType().setValue("TX");
       
        // ... then we create a CE instance to put in OBX-5.
        TX tx = new TX(message);
        tx.setValue("MICROSCOPIC EXAM SHOWS HISTOLOGICALLY NORMAL GALLBLADDER TISSUE");
        value = obx.getObservationValue(0);
        value.setData(tx);

        // Print the message (remember, the MSH segment was not fully or correctly populated)
        System.out.append(new PipeParser().encode(message));

View Full Code Here

    /**
     * Creates a new ADT_AXX message with DefaultModelClassFactory.
     */
    public ADT_AXX() {
       this(new DefaultModelClassFactory());
    }
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.model.v231.segment.OBX

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.