When trying to parse ADT A28 messages from string to java object we see that the resulting object is of type ADT_A01 and not the expected ADT_A28. The HL7 ADT 128 files are generated by another system already in production for a long time and should be OK, our system is reading them in and processing data from them. This works fine for A01 and A05 messages but now we would also like to add A28 messages, this is failing as they are being recognized as A01 messages.
We use v1.2 of the HAPI framework, the messages are v23, in our project POM we have defined both hapi-base and hapi-structures-v23, both vesion 1.2 (tried with version 1.0.1 and 1.1, same result)
I've included a simple code-sample to (hopefully) allow you to reproduce this behaviour:
String msg = "MSH|^~\\&|OAZIS||||20110829111012||ADT^A05^ADT_A28|00084077|P|2.3||||||8859/1/r"+
"EVN|A28|20110829111012||||19900101/r"+
"PID|1||03000381||PAT^STIJN^^^De heer||19871229|M|||straat 25^^LEUVEN^^3000^BE^H|||||0||||88090930179||||||BE||||N/r"+
"PD1||||||||||||N/r"+
"PV1|1|N|||||||||||||||||||||||||||||||||||||N/r"+
"FTS|0|84077";
Parser genericParser = new GenericParser();
Message hl7message = genericParser.parse(msg);
//outputs ADT_A01 instead of ADT_A28
System.out.println(hl7message.getName());
As of v2.3, HL7 introduced message structures, used by more than one HL7 trigger event. HAPI message classes reflect these structures, unfortunately their names overlap with the actual trigger events. E.g. in v2.3, the ADT_A01 structure is used by A01, A04, A05, A08, A13, A14, A28, A31, and parsing each of these messages returns an ADT_A01 class, and getName() returns the class name.
Check the field MSH-9 for the actual trigger event.