I\'m working with Mirth Connect v2.0 and getting stuck on one task, transformation of XML to HL7 v3. I\'ve connected to an Ms-Access Database (the hospital system is in Acce
I am converting XML into hl7 using sample xml data, you can use your own. You can paste the below code in soure transformer:
var length = msg['orderList']['order'].length();
var rcount = 0;
for(var i=0;i ");
SEG['OBR.1']['OBR.1.1']=i+1;
SEG['OBR.16']['OBR.16.1']=msg['orderList']['order'][i]['provider'].toString();
tmp['OBR'][i]=SEG;
var reslen = msg['orderList']['order'][i]['result'].length();
logger.info(reslen);
for(var j=0;j ");
RSEG['OBX.1']['OBX.1.1'] = rcount;
RSEG['OBX.3']['OBX.3.1'] = msg['orderList']['order'][i]['result'][j]['resultcode'].toString();
RSEG['OBX.3']['OBX.3.2']=msg['orderList']['order'][i]['result'][j]['text'].toString();
RSEG['OBX.7'] = msg['orderList']['order'][i]['result'][j]['range'].toString();
RSEG['OBX.6']['OBX.6.2'] = msg['orderList']['order'][i]['result'][j]['unit'].toString();
tmp['OBX'][rcount]=RSEG;
rcount++;
}
}
logger.info(**SerializerFactory.getSerializer('HL7V2').fromXML(tmp)**);
Dont forgot to create a HL& template in source outbound
**MSH|^~\&|||||||||
PID|||||||||||||||||||||||||||
ORC|||||||||||||||||||**
sample XML
XXXXXXXXXXX, XXXX. XXXXX XXXXX
XXXXXX XXXX XXXX Med XXXX Information XXXXX Fl XXXX XXXX St XXXXXX XXXXXX, XX XXXXX XXX/XXXX-XXXX XXX/XXX-XXX X2.XXXXX -X1.XXXXX
57423
result
7685-1
Hemoglobin test2
3to52
mg
result
7685-1
Hemoglobin test2
3to52
mg
57423
result
7685-1
Hemoglobin test2
3to52
mg