web stats
Converting MDM message to an ORU R01 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 05-29-2019, 07:54 AM
math1964 math1964 is offline
What's HL7?
 
Join Date: Apr 2019
Posts: 1
math1964 is on a distinguished road
Default Converting MDM message to an ORU R01

What is the best way to convert a MDM message to an ORU R01?

Below is code to do the opposite. What changes are needed?

tmp = msg;
createSegmentAfter('EVN', tmp['MSH']);
tmp['EVN']['EVN.1']['EVN.1.1'] = 'T02';
tmp['EVN']['EVN.2']['EVN.2.1'] = msg['MSH']['MSH.7']['MSH.7.1'].toString();
createSegmentAfter('TXA', tmp['PV1']);
tmp['TXA']['TXA.1']['TXA.1.1'] = '1';
tmp['TXA']['TXA.2']['TXA.2.1'] = msg['OBR']['OBR.4']['OBR.4.1'].toString();
tmp['TXA']['TXA.4']['TXA.4.1'] = msg['OBR']['OBR.7']['OBR.7.1'].toString();
tmp['TXA']['TXA.5'] = '';
if (msg['OBR']['OBR.16']['OBR.16.1'].toString() != '') {
//tmp['TXA']['TXA.5']['TXA.5.1'] = msg['OBR']['OBR.16']['OBR.16.1'].toString().replace(/^0+/,'');
tmp['TXA']['TXA.5']['TXA.5.1'] = msg['OBR']['OBR.16'][0]['OBR.16.1'].toString();
} else {
tmp['TXA']['TXA.5']['TXA.5.1'] = msg['OBR']['OBR.32']['OBR.32.1'].toString().replace(/^0+/,'');
}
tmp['TXA']['TXA.6']['TXA.6.1'] = msg['OBR']['OBR.7']['OBR.7.1'].toString();
tmp['TXA']['TXA.7']['TXA.7.1'] = msg['OBR']['OBR.7']['OBR.7.1'].toString();
tmp['TXA']['TXA.9']['TXA.9.1'] = msg['OBR']['OBR.32']['OBR.32.1'].toString().replace(/^0+/,'');
tmp['TXA']['TXA.9']['TXA.9.2'] = msg['OBR']['OBR.32']['OBR.32.2'].toString();
tmp['TXA']['TXA.9']['TXA.9.3'] = msg['OBR']['OBR.32']['OBR.32.3'].toString();
tmp['TXA']['TXA.12']['TXA.12.1'] = msg['OBR']['OBR.3']['OBR.3.1'].toString();
tmp['TXA']['TXA.12']['TXA.12.2'] = msg['OBR']['OBR.16']['OBR.16.2'].toString();
tmp['TXA']['TXA.12']['TXA.12.3'] = msg['OBR']['OBR.16']['OBR.16.3'].toString();
tmp['TXA']['TXA.14']['TXA.14.1'] = msg['OBR']['OBR.18']['OBR.18.1'].toString();
tmp['TXA']['TXA.15']['TXA.15.1'] = msg['OBR']['OBR.20']['OBR.20.1'].toString();
tmp['TXA']['TXA.17']['TXA.17.1'] = 'AU';
tmp['TXA']['TXA.22']['TXA.22.1'] = msg['OBR']['OBR.32']['OBR.32.1'].toString().replace(/^0+/,'');
tmp['TXA']['TXA.22']['TXA.22.2'] = msg['OBR']['OBR.32']['OBR.32.2'].toString();
tmp['TXA']['TXA.22']['TXA.22.3'] = msg['OBR']['OBR.32']['OBR.32.3'].toString();
tmp['TXA']['TXA.22']['TXA.22.15'] = msg['OBR']['OBR.7']['OBR.7.1'].toString();
delete tmp['OBR'];

Last edited by math1964; 05-29-2019 at 11:00 AM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 07:46 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation