Need to get message type(ADT,ORU tec) before parsing this, is there any way ? Currently after parsing the message to Message Class object we can get its version & Type (ORU, ADT etc)
Like:
public static String getMsgStructureName(String msgStr, HapiContext context){
String structureName = null;
// context.setModelClassFactory(mcf);
PipeParser parser = context.getPipeParser();
Message msg;
try {
msg = parser.parse(msgStr);
structureName = msg.getName();
** System.out.println("Message Version: "+msg.getVersion());
System.out.println("Message Structure: "+msg.getName());**
} catch (HL7Exception e) {
e.printStackTrace();
}
return structureName;
}
I want to get before this line
msg = parser.parse(msgStr);
There is ca.uhn.hl7v2.preparser.PreParser.getFields(msg, fields...) that returns the value of fields without parsing it into a structure. Check out the javadocs
Last edit: Christian Ohr 2019-01-17
Thanks Christian Ohr