Hi Bob,
well its obvious, because PID directly in
ca.uhn.hl7v2.model.v22.message.ORU_R01 really does not exist.
If you take a look at the source, you will need to get the group
ORU_R01_PATIENT_RESULT first that contains a ORU_R01_PATIENT group that
contains the PID segment.
To fetch the PID you would write it like that:
ORU_R01 oru_r01 = (ORU_R01) msg;
PID pid = oru_r01.getPATIENT_RESULT().getPATIENT().getPID();
Greets
Torben
Dilworth, Bob schrieb:
> Hi All!
>
>
>
> I’m trying to extract data from field 5 in the PID segment of an ORU R01
> message using Terser. I receive the error: Exception in thread "main"
> ca.uhn.hl7v2.HL7Exception: PID does not exist in the group
> ca.uhn.hl7v2.model.v22.message.ORU_R01 when I run my code. It’s a
> really simple little program and I’m stumped as to what’s wrong. Here’s
> the code:
>
>
>
> String [] theHL7;
>
> FileInputStream is = new
> FileInputStream("t:/ci/hl7testdata/pwlraworu-testside.dat");
>
> theHL7 =
> ca.uhn.hl7v2.util.Hl7InputStreamReader.read((FileInputStream)is);
>
> Parser p = new PipeParser();
>
> Message msg = p.parse(theHL7[0]);
>
> Segment pid = (Segment) msg.get("PID");
>
> Terser terser = new Terser((Message)msg);
>
> String x = terser.get(pid,5,0,1,1);
>
> System.out.println(x + "\n");
>
>
>
> The above mentioned error occurs when trying to execute the following
> line: Segment pid = (Segment) msg.get("PID");
>
>
>
> Here’s the test data I’m using:
>
>
>
> MSH|^~\&|LA01|A||A|200705041010|RESULTR01OUT|ORU^R01|129080|P|2.2|||AL|NE||||||2.2b
>
> PID|1|00664921|00727521^^^A^MR||TEST^BARB||199507260000|F||||||||||0709500001|999000303
>
> ORC|RE|0712400001^LA01|0712400001^LA01|R505040003^LA01|CM||1^^^200705041009^^R||200705041009|CHOOD||61999^FEDERMAN^DOUGLAS|MCO||200705041010||4CD^^SF
>
> OBR|1|0712400001^LA01|0712400001^LA01|26438^DIGOXIN^LA01^26438^^LA01|R||200705041009|||CHOOD||||200705041009|1&BLOOD^^^^^GRN
> C&Vacutainer green top; lithium heparin 7 ml,
> Chem|61999^FEDERMAN^DOUGLAS||||||200705041010||CHEM|FINAL
> RSLT||1^^^200705041009^^R||||^^I9||||||||LABO^LAB DRAW^^^0
>
> OBX|1|NM|DIG^DIGOXIN^LA01|1|2.7|ng/mL^ng/mL|.7-2.0|HH|||F|||200705041010|MCO^MEDICAL
> COLLEGE OF OHIO|CHOOD|AXS^^^M~N
>
> NTE|1|L|Pharmacy system indicates active order for digoxin, please
> consider|Y|200705041009|CHOOD|Pharmacy system indicates active order for
> digoxin, please consider adjusting d
>
> NTE|2|L|adjusting dose.|Y|200705041009|CHOOD|Pharmacy system indicates
> active order for digoxin, please consider adjusting d
>
> ZOM|1||||12450037||||||CHEM||||||12450037|1|H|||200705041009|659||||||||||||||||S||||||0712400001^LA01|||||F||A||||AXS|A|D|||DIGOXIN
>
> ZCA|||4CD|||||||||||||||||||||||||||||||||||||00664921|||TEST|$ReleaseId:
> rel10.0.1.2.20060929.1.hot$|$Id: pwic.pad,v 1.162.1.9.1.0, 2006-07-26
> 19:41:30Z$;$ReleaseId: rel10.0.1.2.20|$Date: 7/26/06 12:41:30
> PM$||||199507260500+0000|system||||4CD^\R\4CD NURSING
> STATION|||||415301^4153-01
>
>
>
> Any thoughts and/or pointers in the right direction would be greatly
> appreciated!
>
>
>
> Thanks in Advance!!!!
>
>
>
> Bob Dilworth
>
> Toleod, Ohio
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Hl7api-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel