I am a new comer and try to use Hapi to parse back and forth the HL7 message
between Medical Instrument and Lab Information System. I don't know why I get
null in parse ORC and OBR segment. I tried to search on web, but didn't find
the solusion. I really appreciate if some body can help me out.
My sample message are as follows:
String msg = "MSH|^~\\&|VIP|Test Bed|LIS|Pathology
Lab|20080829142634427||ORL^O22|VMSG1|P|2.4|\r"
+ "MSA|AA|MSG1|\r"
+ "PID||123-45-6789|||Doe^Jane||19610520|F|\r"
+ "PV1|||||||Dr.^Grogan^Tom|\r"
+ "SAC||S05-2248||||Skin/Biopsy|20070409|\r"
+ "ORC|OK|S05-2248|00026||ID|L~B~E|||20080829||||||||||||University Medical
Center|\r"
+ "OBR||S05-2248-C-4|00026|58^ANTI-
CEA^STAIN||||||||||||||MyTemplate|Custom|Custom|Breast|\r";
I follow the sample program on Hapi web site to do the parse. The MSA, PID and
SAC segments were fine, but ORC and OBR had null.Parser p = newGenericParser();
Message hapiMsg;
try{
// The parse method performs the actual parsing
hapiMsg = p.parse(msg);
} catch(EncodingNotSupportedException e) {
e.printStackTrace();
return;
} catch(HL7Exception e) {
e.printStackTrace();
return;
}
ORL_O22 orlMsg = (ORL_O22)hapiMsg;
MSH msh = orlMsg.getMSH();
// Retrieve some data from the MSH segment
String msgType = msh.getMessageType().getMessageType().getValue();
String msgTrigger = msh.getMessageType().getTriggerEvent().getValue();
// Prints "ORL O22"
System.out.println(msgType + " " + msgTrigger);
MSA msa = orlMsg.getMSA();
String acknowledgementCode = msa.getAcknowledgementCode().getValue();
System.out.println("In response: acknowledgementCode = " + acknowledgementCode
);
PID pid = orlMsg.getRESPONSE().getPATIENT().getPID();
String patientID = pid.getPatientID().getID().getValue();
System.out.println("In response: patientID = " + patientID);
SAC sac =
orlMsg.getRESPONSE().getPATIENT().getGENERAL_ORDER().getORDER().getOBSERVATION_REQUEST().getSAC();
String accession =
sac.getAccessionIdentifier().getEntityIdentifier().getValue();
System.out.println("In response: accession = " + accession);
ORC orc =
orlMsg.getRESPONSE().getPATIENT().getGENERAL_ORDER().getORDER().getORC();
String orderControl = orc.getOrderControl().getValue();
System.out.println("In response: orderControl = " + orderControl);
String placerOrderNumber =
orc.getPlacerGroupNumber().getEntityIdentifier().getValue();
System.out.println("In response: placerOrderNumber = " + placerOrderNumber);
OBR obr =
orlMsg.getRESPONSE().getPATIENT().getGENERAL_ORDER().getORDER().getOBSERVATION_REQUEST().getOBR();
String placerOrderNumber_obr =
obr.getPlacerOrderNumber().getEntityIdentifier().toString();
System.out.println("In response: placerOrderNumber_obr = " +
placerOrderNumber_obr);
String filledOrderNumber_obr =
obr.getFillerOrderNumber().getEntityIdentifier().toString();
System.out.println("In response: filledOrderNumber_obr = " +
filledOrderNumber_obr);
Thanks,
Chin Hsueh
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel