Hi all

As a start, I'd like to retrieve the patient name from a Pharm H2 request 
message. Unfortunatelly the XPN's family name seems to be empty.
If i open the same content in the TestPanel, I can see that the TestPanel 
recognizes PID-5-1 and PID-5-2. Any hints?

The code I use is the following :

import ca.uhn.hl7v2.model.v26.datatype.XPN;
import ca.uhn.hl7v2.model.v26.message.RDE_O11;
import ca.uhn.hl7v2.model.v26.segment.PID;
import ca.uhn.hl7v2.parser.PipeParser;


public class MessageParserExample {

        public static void main(String[] args) throws Exception{

                PipeParser parser = new PipeParser();
                RDE_O11 msg = (RDE_O11) parser.parse( getExampleMessage() );
                PID pid = msg.getPATIENT().getPID();
                XPN patientName = pid.getPid5_PatientName(0);
                System.out.println(patientName.getFamilyName());
        }


        /**
         * returns the sample message H2Req
         * @return
         */
        private static String getExampleMessage(){
                StringBuilder sb = new StringBuilder();
                
sb.append("MSH|^~\\&|IHE|EU-CAT2011|||20110307194153||RDE^O11|MSG00003|P|2.6||||||UTF-8");
                sb.append("PID|||A9283923889^^^^||Doe^John||19680306|M");
                
sb.append("PV1||I|Cardiology^4^01^CATEUR_WARDS&&L||||||||||||||||V00001");
                sb.append("IN1|s|ID001^Full Insurance|XXXX|INSURANCE_Ltd.");
                
sb.append("ORC|NW|PL001||P001|||||20110414153220|||00000999^Strangelove^Peter^^^Dr.|||||||P0343874^Jansen^Patricia||Connectathon
 Europe 2011^^^^^^^^^CATEUR2011|Casa della Citta Leopolda, Piazza Guerrazzi, 
56125 Pisa|0039 50 48587||P3;V3");
                sb.append("TQ1|1|2^Tab&Tablets&99FCS|TID");
                
sb.append("RXO|S0002^Paracetamol^99SCS|500||mg^milligram^99UCS|Tab^Tablets^99FCS||||G|||||||||||J00.0^Cold^I10");
                sb.append("NTE|1||TAKE WITH WATER");
                sb.append("RXR|PO|MOUTH|");
                
sb.append("RXC|B|N02BE01^Paracetamol^ATC|500|mg^milligram^ANS+");
                sb.append("RXE||054565^Dafalgan 500 mg 
tablets^99LCN|2|||Tab^Tablets^99FCS|01^Take with 
Water|||||||P0343874^Jansen^Patricia|P001");
                sb.append("NTE|1||Prescription Item OK|IA^Prescription item 
Advice notes");
                sb.append("NTE|2||Prescription OK|PA^Prescription-wide Advice 
notes");
                
sb.append("TQ1|1|1^Tab&Tablets&99FCS||070000~150000~230000|||20110307");
                sb.append("RXR|PO|MOUTH|");
                return sb.toString();
        }
}

Best Regards,
Michael

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to