SQL Store Procedure Output (String) into HL7 message
Hi,
I am afraid I am stuck again. I have ensemble connected with a MsSQL database and I have a service that calls a store procedure. All is working, and I can get strings from the database in the service. The problem is that the data the store procedure returns is suppose to be an HL7 message so I need to convert the string into HL7 format. I have been using the
I guess, is something to be with the structure of the HL7 message...it is a special one that contains multiple ORCs, OBRs, SPMs... it can be seen as the merge of multiple HL7 messages...the problem is that seems only the first part of the message is converted to. I have put a sentence to write the message into the log before being converted and after being converted and both looks different.
The code is as follow:
SET HL7msg = ##class(EnsLib.HL7.Message).ImportFromString(pInput.GetData(1)) $$$ThrowOnError(tSC)
SET tDocType=##class(EnsLib.HL7.Schema).ResolveSchemaTypeToDocType("2.5.1","ORU_R01", tSC) $$$ThrowOnError(tSC)
SET HL7msg.DocType=tDocType
$$$LOGINFO("HL7:" _ HL7msg.RawContent)
The structure of the incoming message is as follow (the one I am receiving fine):
PID|1||~
ORC|RE|2
OBR|1|20
NTE|1|L|
NTE|2|L|
OBX|1|NM
SPM|1|||
SPM|1|||
OBR|1|20
NTE|1|L|
OBX|2|NM
OBX|3|NM
OBX|4|NM
SPM|1|||
SPM|1|||
But once converted:
PID|1||~
ORC|RE|2
OBR|1|20
NTE|1|L|
NTE|2|L|
OBX|1|NM
SPM|1|||
Is it because the schema is not defined and then is converting using a standard HL7 version?
Thanks