package com.foo.hapitest;
import ognl.Ognl;
import ca.uhn.hl7v2.model.Message;
import ca.uhn.hl7v2.parser.CanonicalModelClassFactory;
import ca.uhn.hl7v2.parser.Parser;
import ca.uhn.hl7v2.parser.PipeParser;
import ca.uhn.hl7v2.util.Terser;
import ca.uhn.hl7v2.validation.impl.NoValidation;
public class OGNLHAPITest {
public static void main(String[] args) {
String HL7_VERSION = "2.6";
try {
StringBuffer sb = new StringBuffer();
sb.append("MSH|^~\\&|SENDAPP|SENDFAC|RECAPP|RECFAC|20120604074542|1|EHC^E20|10157748|P|2.3|||||||||\r");
sb.append("IVC|12345678^^87654321|||||L||||^^^^^^^^10^67584392|^^^^^^^^^43|||||||||1001\r");
sb.append("ROL|||RP|^^^^^\r");
sb.append("PRA|||||\r");
sb.append("STF||\r");
sb.append("PID|||X23764532||||19990909|M\r");
sb.append("IN1|1|||||||||||||\r");
sb.append("PSL|||1|||D|86140^^CPT(R)|||20120524|20120524|1||||24|POS~TOS|11~
5|||||||10010101\r");
sb.append("DG1|1||368.8\r");
sb.append("ROL|1||SP|256^JINGLEHEIMER^JOHN^J^^MD\r");
sb.append("PRA|1||||08\r");
sb.append("STF|1|H50246\r");
sb.append("ROL|2||BP|256^JINGLEHEIMER Jr^JOHN^J^^MD\r");
sb.append("PRA|2||||08\r");
sb.append("STF|2|H50246\r");
sb.append("PSL|||2|||D|92567^^CPT(R)|||20120524|20120524|1||||24|POS~TOS|11~
5|||||||10010101\r");
sb.append("DG1|1||382.9\r");
sb.append("ROL|1||SP|256^JINGLEHEIMER^JOHN^J^^MD\r");
sb.append("PRA|1||||08\r");
sb.append("STF|1|H50246\r");
sb.append("ROL|2||BP|256^JINGLEHEIMER Jr^JOHN^J^^MD\r");
sb.append("PRA|2||||08\r");
sb.append("STF|2|H50246\r");
String hl7RawMessage = sb.toString();
Parser parser = new PipeParser(new
CanonicalModelClassFactory(System.getProperty("MPVHL7ParserVersion",
HL7_VERSION)));
parser.setValidationContext(new NoValidation());
Message message = parser.parse(hl7RawMessage);
Terser t = new Terser(message);
System.out.println("ROL Count: " +
Ognl.getValue("getPSL_ITEM_INFO().getROLReps()", message));
System.out.println("ROL(0)-3-1 : " + t.get("/PSL_ITEM_INFO(0)/ROL(0)-3-1"));
System.out.println("ROL(1)-3-1 : " + t.get("/PSL_ITEM_INFO(0)/ROL(1)-3-1"));
}
catch (Throwable e) {
e.printStackTrace();
}
}
}
Output:
ROL Count: 1
ROL(0)-3-1 : SP
ROL(1)-3-1 : null
How many ROL segments should HAPI report for the first PSL_ITEM_INFO group
above? I was assuming there should be two ROL segments but HAPI only reports
one. What am I missing/not understanding?
Thanks in advance!
JR
------------------------------------------------------------------------------
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