I adjusted an earlier message example I had played with to try out the
message.getall() that you are using. See below. It looked to work ok, so I’m
not able to offer much more. You may note that I went through a parse step on a
message string first, before trying to use getAll. I presume you had similar
code. I am also a big supporter of using printstructure when I am trying things
out. It helps me avoid invalid assumptions about how HAPI has parsed the
message.
Ian
Code example:
String msg =
"MSH|^~\\&|SCM|SCM|HL7ADT||20130114001147||ADT^A08|8456356603013|P|2.1\r"
+ "PID||5012223067^^^Corporate Num|50730137^^^EAST
MRN|300000003^^^EID|Moose^Bullwinkle^J||19091011|F||1|1 Roanoke St^^New
York^NY^11111^USA^Home||(888)111-1111^^^^^888^111-1111^^Home|^^^^^^^^Cellular|ENG|W|CA|3000000039^^^EAST
MRN|111165812|11119791||Hispanic Origin \r"
+
"NK1|1|Bugs^Bee|19||(888)111-1111^^^^^888^111-1111^^Home||Emergency \r"
+ "PV1||E|ERM^^^EAST
MRN|Emergency|||N20714^Chris^Bob^Bruce~1907828742^^^^^^^^^^^^NPI|||REH||||Non-Health
Care||0||Emergency|3000000039^^^EAST
MRN|||||||||||||||||||||Clean||||20130115001000 \r"
+ "PV2||^N|ABDOMINAL PAIN NAUSEA COLD SYM
OBX|1|ST|Intolerances||None Entered||||||X \r"
+ "DG1|1||^CHEST PAIN DEHYDRATION NAUSE|CHEST PAIN
DEHYDRATION NAUSE||Visit Reason\r"
+ "ZDG|1||^CHEST PAIN DEHYDRATION NAUSE|CHEST PAIN
DEHYDRATION NAUSE||Visit Reason\r"
+ "DG1|2||^CHEST PAIN DEHYDRATION NAUSE|CHEST PAIN
DEHYDRATION NAUSE||Visit Reason\r"
+ "ZDG|2||^CHEST PAIN DEHYDRATION NAUSE|CHEST PAIN
DEHYDRATION NAUSE||Visit Reason\r"
+ "DG1|3||^CHEST PAIN DEHYDRATION NAUSE|CHEST PAIN
DEHYDRATION NAUSE||Visit Reason\r"
+ "ZDG|3||^CHEST PAIN DEHYDRATION NAUSE|CHEST PAIN
DEHYDRATION NAUSE||Visit Reason\r"
+ "OBX|2|ST|Allergies||See Allergy Icon/Pt Info Tab||||||X \r"
+ "AL1|1|Drug|quinolone
antibiotics^^^^23^Multum|Swelling|facial swelling ZAL||||AL|Swelling \r"
+ "AL1|2|Drug|quinolone topicals^^^^70^Multum|Swelling|facial
swelling ZAL||||AL|Swelling \r"
+ "IN1|1||BLUE|BLUE CROSS^MEDICARE|PO BOX
880031^^Boston^MA^02201||(888)111-1111^^^^^888^111-1111||||||||Medicare|Bugs^Bunny^M|18|19000928|1
Roanoke St^^New York^NY^11111^USA||||||||||||||||||||||||Male||||||1112223067
\r"
+
"IN2||475846521|DISABLED||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||(888)111-1111^^Phone^^^888^111-1111|||||||DISABLED\r";
HapiContext hapiContext = new DefaultHapiContext();
hapiContext.setValidationRuleBuilder(new NoValidationBuilder());
final PipeParser pipeParser = hapiContext.getPipeParser();
final Message hapiMessage = pipeParser.parse(msg);
System.out.println("hapiMsg.printStructure() = " +
hapiMessage.printStructure());
Structure[] nk1Segments = hapiMessage.getAll("NK1");
System.out.println("There are " + nk1Segments.length + " NK1 segments
present.");
From: Dayu Han [mailto:d...@stratahealth.com]
Sent: Tuesday, 17 May 2016 7:56 AM
To: HAPI Devel List
Subject: Re: [HAPI-devel] How to parse NK1 segment in HL7 v2.1
Hello
In processing HL7 ADT message v2.1, I use the following code to parse NK1
segment:
Structure[] nk1Segments = message.getAll("NK1”);
However, this returns no element. My question is how to get ALL NK1 segments
directly ?
Thanks
Dayu
--
Dayu Han
Software Developer
Strata Health Solutions
Office: +1.403.261.0855 x2102
Website<http://www.stratahealth.com/> | Overview
Video<http://youtu.be/5wHGcurxMyY> |
Resources<http://www.stratahealth.com/resources/>
********************************************************************************
This email, including any attachments sent with it, is confidential and for the
sole use of the intended recipient(s). This confidentiality is not waived or
lost, if you receive it and you are not the intended recipient(s), or if it is
transmitted/received in error.
Any unauthorised use, alteration, disclosure, distribution or review of this
email is strictly prohibited. The information contained in this email,
including any attachment sent with it, may be subject to a statutory duty of
confidentiality if it relates to health service matters.
If you are not the intended recipient(s), or if you have received this email in
error, you are asked to immediately notify the sender by telephone collect on
Australia +61 1800 198 175 or by return email. You should also delete this
email, and any copies, from your computer system network and destroy any hard
copies produced.
If not an intended recipient of this email, you must not copy, distribute or
take any action(s) that relies on it; any form of disclosure, modification,
distribution and/or publication of this email is also prohibited.
Although Queensland Health takes all reasonable steps to ensure this email does
not contain malicious software, Queensland Health does not accept
responsibility for the consequences if any person's computer inadvertently
suffers any disruption to services, loss of information, harm or is infected
with a virus, other malicious computer programme or code that may occur as a
consequence of receiving this email.
Unless stated otherwise, this email represents only the views of the sender and
not the views of the Queensland Government.
**********************************************************************************
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel