HL7 How to send a NACK message with hapifhir

159 Views Asked by At

I am creating an HL7 interface. When the messages that are recieved are correct, i reply to HIS with a ACK message like this:

msg.generateACK();

How do i send a NACK message, indicating that the message was recieved but it's content was not correct? I am using ca.uhn.hl7v2.model.Message.

1

There are 1 best solutions below

0
BlessedHIT On

To generate a NACK, you need to

msg.generateACK(theAcknowlegementCode,theException);

Parameters:

  1. theAcknowlegementCode - If null, defaults to AcknowledgmentCode.AA. To generate a typical NAK, use AcknowledgmentCode.AE
  2. theException - The exceptions used to populate the ERR segment (if any)

See https://hapifhir.github.io/hapi-hl7v2/base/apidocs/index.html for more details

Also Why NACK message misses to create the Fields 3,4 and 5 in Hapi has an example