Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Replying with a customised HL7 ACK

Question
Lionel Woods · Sep 12, 2022

Replying with a customised HL7 ACK

Am trying to create a custom ACK to return to sending system as it does not accept standard 2.3:ACK, want to send the below:

 

Set pResponse=##class(EnsLib.HL7.Message).%New()
Set pResponse.DocType="2.4:ACK"
Set MSHStr="MSH|^~\&|EnsembleHL7|ISC|ARiM Server|ROWA|"_$REPLACE($REPLACE($ZDATETIME($HOROLOG,8,1),":",""), " ","")_"||ACK|"_pRequest.GetValueAt("MSH:10")_"|P|2.3"
Set MSHSeg=##class(EnsLib.HL7.Segment).ImportFromString(MSHStr,.tSC,pRequest.Separators)
Set MSAStr="MSA|AA|"_pRequest.GetValueAt("MSH:10")
Set MSASeg=##class(EnsLib.HL7.Segment).ImportFromString(MSAStr,.tSC,pRequest.Separators)
Set tSC=pResponse.SetSegmentAt(MSHSeg,1)
Set tSC=pResponse.AppendSegment(MSASeg)

The problem I have encountered is I am not sure where to trigger the custom ACK so it will not send the default 2.3:ACK 

The Service is a TCPInboundAdaptor class 

#HL7 #HealthShare
Product version: IRIS 2021.1

Source URL:https://community.intersystems.com/post/replying-customised-hl7-ack