Package ca.uhn.hl7v2.parser

Examples of ca.uhn.hl7v2.parser.GenericParser.encode()


    }

    @Converter
    public static String toString(Message message) throws HL7Exception {
        Parser parser = new PipeParser();
        String encoded = parser.encode(message);
        return encoded;
    }

    @Converter
    public static Message toMessage(String body) throws HL7Exception {
View Full Code Here


        // convert to string
        String body;
        if (message instanceof Message) {
            Parser parser = new PipeParser();
            body = parser.encode((Message)message);
        } else if (message instanceof String) {
            body = (String)message;
        } else if (message instanceof byte[]) {
            body = new String((byte[])message);
        } else {
View Full Code Here

    static String encode(Message message, boolean validate) throws HL7Exception {
        Parser parser = new PipeParser();
        if (!validate) {
            parser.setValidationContext(new NoValidation());
        }
        return parser.encode(message);
    }

}
View Full Code Here

        // convert to string
        String body;
        if (message instanceof Message) {
            Parser parser = new PipeParser();
            body = parser.encode((Message)message);
        } else if (message instanceof String) {
            body = (String)message;
        } else if (message instanceof byte[]) {
            body = new String((byte[])message);
        } else {
View Full Code Here

         * In a real situation, of course, many more segments and fields would be populated
         */
               
        // Now, let's encode the message and look at the output
        Parser parser = new PipeParser();
        String encodedMessage = parser.encode(adt);
        System.out.println("Printing ER7 Encoded Message:");
        System.out.println(encodedMessage);
       
        /*
         * Prints:
 
View Full Code Here

         * PID|||123456||Doe^John
         */

        // Next, let's use the XML parser to encode as XML
        parser = new DefaultXMLParser();
        encodedMessage = parser.encode(adt);
        System.out.println("Printing XML Encoded Message:");
        System.out.println(encodedMessage);
       
        /*
         * Prints:
 
View Full Code Here

            terser.set("/PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(" + i + ")/OBX-1", "" + (i + 1));
            terser.set("/PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(" + i + ")/OBX-3", "ST");
            terser.set("/PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(" + i + ")/OBX-5", "This is the value for rep " + i);
        }
       
        System.out.println(p.encode(oru));
       
        /*
         *   MSH|^~\&|||||||ORU^R01|||2.5
         *   OBX|1||ST||This is the value for rep 0
         *   OBX|2||ST||This is the value for rep 1
View Full Code Here

                return super.parse(theMessage);
            }};
       
        Message message = parser.parse(msg);
       
        System.out.println(parser.encode(message));
       
        /* PI has been fixed:
        
            MSH|^~\&|HIS|RIH|EKG|EKG|199904140038||ADT^A01||P|2.2
            PID|0001|00009874|00001122|A00977|SMITH^JOHN^M|MOM|19581119|F|NOTREAL^LINDA^M|C|564 SPRING ST^^NEEDHAM^MA^02494^US|0002|(818)565-1551|(425)828-3344|E|S|C|0000444444|252-00-4414||||SA|||SA||||NONE|V1|0001|I|D.ER^50A^M110^01|ER|P00055|11B^M011^02|070615^BATMAN^GEORGE^L|555888^NOTREAL^BOB^K^DR^MD|777889^NOTREAL^SAM^T^DR^MD^PHD|ER|D.WT^1A^M010^01|||ER|AMB|02|070615^NOTREAL^BILL^L|ER|000001916994|D||||||||||||||||GDD|WA|NORM|02|O|02|E.IN^02D^M090^01|E.IN^01D^M080^01|199904072124|199904101200|199904101200||||5555112333|||666097^NOTREAL^MANNY^P
View Full Code Here

         * In a real situation, of course, many more segments and fields would be populated
         */
               
        // Now, let's encode the message and look at the output
        Parser parser = new PipeParser();
        String encodedMessage = parser.encode(adt);
        System.out.println("Printing ER7 Encoded Message:");
        System.out.println(encodedMessage);
       
        /*
         * Prints:
 
View Full Code Here

         * PID|||123456||Doe^John
         */

        // Next, let's use the XML parser to encode as XML
        parser = new DefaultXMLParser();
        encodedMessage = parser.encode(adt);
        System.out.println("Printing XML Encoded Message:");
        System.out.println(encodedMessage);
       
        /*
         * Prints:
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.