Got an opportunity to work in Mirth to add an entry in the OBR field. With the help of this forum, I was able to edit an existing data, that works perfectly fine. But failing to add a data to a field which doesn't exist in the source HL7. Below is the example,
SourceHL7
PV2|||||||System Alert Off~0437689973~ABC-KOTHAI-AUS
OBR|1||ABCDEDFGH|754051^ABCEDEF^MDC|||20190225133500+0000||||||||||||||||||F
In the DestinationHL7, I want to check if PV2.7.2 has "KOTHAI", if yes, then update the OBR.16 as below
OBR|1||ABCDEDFGH|754051^ABCEDEF^MDC|||20190225133500+0000|||||||||KOTHAI|||||||||F
With the below Javascript, I am able to see the last value in OBR is changed as M but no "KOTHAI" is available. I could see the change in Transformed data but not in Encoded data. Could you let me know what am I doing wrong.
tmp=msg;
var code = tmp['ORU_R01.PATIENT_RESULT']['ORU_R01.PATIENT']['ORU_R01.VISIT']['PV2']['PV2.7'][2].toString();
if (code.indexOf("ARSTALL") != -1 )
{
tmp['ORU_R01.PATIENT_RESULT']['ORU_R01.ORDER_OBSERVATION']['OBR']['OBR.25'] = "M";
tmp['ORU_R01.PATIENT_RESULT']['ORU_R01.ORDER_OBSERVATION']['OBR']['OBR.16'] = "KOTHAI";
}else {
tmp['ORU_R01.PATIENT_RESULT']['ORU_R01.ORDER_OBSERVATION']['OBR']['OBR.25'] = "F";
}
Here is the same answer I gave on your forum post http://www.mirthcorp.com/community/forums/showthread.php?t=218996
You're using the strict parser, so you need to make sure everything is named correctly depending on hl7 datatype.
I think you want to do this:
tmp['ORU_R01.PATIENT_RESULT']['ORU_R01.ORDER_OBSERVATION']['OBR']['OBR.16']['XCN.1'] = "KOTHAI";