web stats
Remove FT1 then Change PR1 to FT1 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 10-25-2013, 12:02 PM
cmcwhorter cmcwhorter is offline
OBX.2 Kenobi
Join Date: Apr 2008
Location: Texas
Posts: 83
Cool Remove FT1 then Change PR1 to FT1

The code I am using works, but I wanted to post it and see if there is a better programming to accomplish what I am doing. I am using Mirth version

Explanation: I receive supply and procedure charges in one interface feed. I need to split this into two messages one with only supply codes/charges, one with procedure codes/charges. The message I receive has supply codes in FT1's and procedure codes in PR1's. The messages I create for supply codes and procedure codes must only have FT1's and must be in the same format as the FT1's in the original message.

This is the message I receive:
MSH|^~\&|CATH^Sensis||^Server||20131022172800||DFT ^P03|1564|P|2.4
PID||M000000049|M000000049||ONBASE^JESSIE^WILLIAM| |19421019|M|||V00000000022|||||||V00000000022|123-45-6782
FT1|0|||20131022130525|20131022172801|CG|4810027|C HC and Coronaries|1|1
FT1|2|||20131022130525|20131022172801|CG|0007687|C ook Needle|1|1
FT1|3|||20131022130525|20131022172801|CG|0009987|C OOK Microstick Stiff|1|1
FT1|4|||20131022130525|20131022172801|CG|0007685|E ngage 7Fr 12cm Sheath|1|1
FT1|5|||20131022130525|20131022172801|CG|0008561|E dwards Swan Ganz|1|1
FT1|6|||20131022130525|20131022172801|CG|0007691|. 035-145 3mm J Guidewire|1|1
FT1|7|||20131022130525|20131022172801|CG|0008587|T ransducer|1|1
FT1|8|||20131022130525|20131022172801|CG|0008429|M anifold Kit|1|1
FT1|9|||20131022130525|20131022172801|CG|0007321|C ath Pack/Cardiac|1|1
FT1|10|||20131022130525|20131022172801|CG|0007684| Engage 6Fr 12cm Sheath|1|1
FT1|11|||20131022130525|20131022172801|CG|0007532| 6F IM Impulse Catheter|1|1
FT1|12|||20131022130525|20131022172801|CG|0007511| 6F FR4 Impulse Catheter|1|1
FT1|13|||20131022130525|20131022172801|CG|0004259| Transducer IBP Kit|1|1
FT1|14|||20131022130525|20131022172801|CG|0007681| Mynx Grip 6/7Fr|1|1
FT1|15|||20131022130525|20131022172801|CG|0008742| C02 Detector|1|1
FT1|16|||20131022130525|20131022172801|CG|0008552| Defib Pads|1|1
PR1|0||3601526|Right Heart Cath|20030422082900|I
PR1|1||3601527|Left Heart Cath, Retrograde|20030422082900|I

This is my transformer code to create the procedures only message:
First I delete existing FT1's which are supply codes using:
delete msg['FT1'];

Then copy the values in PR1's to variables, create new FT1's and finally delete the PR1's:
var n = '0';
for each (seg in msg..PR1) {
//if (seg.name().toString() == "PR1") {

var n = msg['PR1'][n]['PR1.1']['PR1.1.1'].toString();
var code = msg['PR1'][n]['PR1.3']['PR1.3.1'].toString();
var desc = msg['PR1'][n]['PR1.4']['PR1.4.1'].toString();
var date = msg['PR1'][n]['PR1.5']['PR1.5.1'].toString();

if (n !== '') {
msg['FT1'][n]['FT1.1']['FT1.1.1'] = n;
msg['FT1'][n]['FT1.4']['FT1.4.1'] = date;
msg['FT1'][n]['FT1.5']['FT1.5.1'] = date;
msg['FT1'][n]['FT1.6']['FT1.6.1'] = 'CG';
msg['FT1'][n]['FT1.7']['FT1.7.1'] = code;
msg['FT1'][n]['FT1.8']['FT1.8.1'] = desc;
msg['FT1'][n]['FT1.9']['FT1.9.1'] = 1;
msg['FT1'][n]['FT1.10']['FT1.10.1'] = 1;
delete msg['PR1'];

This is my output message for procedure codes only:
MSH|^~\&|CATHLAB^Sensis|CATHLAB|^Server|GVH|201310 22172800||DFT^P03|1564|P|2.4
PID||M000000049|M000000049||ONBASE^JESSIE^WILLIAM| |19421019|M|||V00000000022|||||||V00000000022|123-45-6782
FT1|0|||20030422082900|20030422082900|CG|3601526|R ight Heart Cath|1|1
FT1|1|||20030422082900|20030422082900|CG|3601527|L eft Heart Cath, Retrograde|1|1

Last edited by cmcwhorter; 10-25-2013 at 12:17 PM.
Reply With Quote

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 12:02 PM.

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