web stats
Transformer DataReader (SQL Server) to HL7 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 01-22-2015, 05:40 AM
joanafncunha@gmail.com joanafncunha@gmail.com is offline
What's HL7?
 
Join Date: Nov 2014
Posts: 3
joanafncunha@gmail.com is on a distinguished road
Default Transformer DataReader (SQL Server) to HL7

I use the mirth connect 3.0 and I'm trying to write a transfomer script to modify the NK1 and AL1 segments in a message I want which all segments appear together.
The communication is DataReader to HL7.

---------------------------------------------------------
My Result Message:
---------------------------------------------------------
MSH|^~&|ADT4||eHs||201501151703||ADT^A04^ADT_A04|| P|2.8|||
EVN|A04|201501151703|20150115 170341||administrator|
PID|332|ZZZZZ00006|||Lennon^John^Amaro||19600101|M ||White|Buffalo Av^^Buffalo^New York^14222^<none>||(716)123-4455||French|S|||123-13-2546|324223423424||Central American||||||<none>||||||||||||teste@teste||||
PV1|ZZZZZ00006||^^Test|E||||||||||||||<none>|||||| ||||||||||||||||||||2014-12-18 15:36:46.0
NK1|1|Barton^Julie|Emergency contact|100 Fairway Drive, Suite 130^^VERNON HILLS^Illinois^60061|(131)231-2313|(131)231-2313|||||||||||||||||||
AL1|1||0000000002^Penicillins|S||||
DG1|1||150|Malignant neoplasm of esophagus|2014-12-04 12:52:14.0||||
DG1|2||V17.4|Family history of cardiovascular disease - other|2014-12-04 12:55:11.0||||
IN1|1||ZZZZZ00002|Evergreen|1 Seneca Place^^Greenwich^Connecticut^06830^US|||teste|test e|||||||||||||||||||||||||||123132546|||||
NK1|2|Figueiredo^Raj|Brother|1 Seneca Place^^Greenwich^Connecticut^06830|(324)242-4444|(324)234-8211|||||||||||||||||||
AL1|2||0000000002^Penicillins|O||||
AL1|3||0000000003^Alcohol|O||||
DG1|3||V17.4|Family history of cardiovascular disease - other|2014-12-04 12:55:11.0||||

---------------------------------------------------------
What I want
---------------------------------------------------------
MSH|^~&|ADT4||eHs||201501151703||ADT^A04^ADT_A04|| P|2.8|||
EVN|A04|201501151703|20150115 170341||administrator|
PID|332|ZZZZZ00006|||Lennon^John^Amaro||19600101|M ||White|Buffalo Av^^Buffalo^New York^14222^<none>||(716)123-4455||French|S|||123-13-2546|324223423424||Central American||||||<none>||||||||||||teste@teste||||
PV1|ZZZZZ00006||^^Test|E||||||||||||||<none>|||||| ||||||||||||||||||||2014-12-18 15:36:46.0
NK1|1|Barton^Julie|Emergency contact|100 Fairway Drive, Suite 130^^VERNON HILLS^Illinois^60061|(131)231-2313|(131)231-2313|||||||||||||||||||
NK1|2|Figueiredo^Raj|Brother|1 Seneca Place^^Greenwich^Connecticut^06830|(324)242-4444|(324)234-8211|||||||||||||||||||
AL1|1||0000000002^Penicillins|S||||
AL1|2||0000000002^Penicillins|O||||
AL1|3||0000000003^Alcohol|O||||
DG1|1||150|Malignant neoplasm of esophagus|2014-12-04 12:52:14.0||||
DG1|2||V17.4|Family history of cardiovascular disease - other|2014-12-04 12:55:11.0||||
DG1|3||V17.4|Family history of cardiovascular disease - other|2014-12-04 12:55:11.0||||
IN1|1||ZZZZZ00002|Evergreen|1 Seneca Place^^Greenwich^Connecticut^06830^US|||teste|test e|||||||||||||||||||||||||||123132546|||||

Any idea?
Reply With Quote
  #2  
Old 01-22-2015, 09:15 AM
joanafncunha@gmail.com joanafncunha@gmail.com is offline
What's HL7?
 
Join Date: Nov 2014
Posts: 3
joanafncunha@gmail.com is on a distinguished road
Default

I think this happened because the outbound message template free ...

Any help?

I attached my transformer.

Thank you in advance.
Attached Files
File Type: xml transformer1.xml (34.2 KB, 5 views)
Reply With Quote
  #3  
Old 01-22-2015, 09:17 PM
tnagaraj tnagaraj is offline
Mirth Newb
 
Join Date: Jan 2015
Location: India
Posts: 19
tnagaraj is on a distinguished road
Default Transformer Logic

You can change the logic as mentioned below for your channel.


var i = 0;
//var nk1 = tmp['NK1'];
while(i != '5'){
tmp['NK1'][i]=new XML("<NK1/>");
tmp['NK1'][i]['NK1.1']['NK1.1.1'] = i + 1;
tmp['NK1'][i]['NK1.2']['NK1.2.1'] = 'ln';
tmp['NK1'][i]['NK1.2']['NK1.2.2'] = 'fn';
tmp['NK1'][i]['NK1.3']['NK1.3.1'] = 'relation';
tmp['NK1'][i]['NK1.4']['NK1.4.1'] = 'addr';
tmp['NK1'][i]['NK1.4']['NK1.4.3'] = 'city';
tmp['NK1'][i]['NK1.4']['NK1.4.4'] = 'state';
tmp['NK1'][i]['NK1.4']['NK1.4.5'] = 'zipCode';
i++;
}


var a = 0;
//var al1 = tmp['AL1'];
while(a != '5'){

tmp['AL1'][i]=new XML("<AL1/>");
tmp['AL1'][a]['AL1.1']['AL1.1.1'] = a + 1;
tmp['AL1'][a]['AL1.3']['AL1.3.2'] = 'cause';
tmp['AL1'][a]['AL1.4']['AL1.4.1'] = 'severity';
tmp['AL1'][a]['AL1.5']['AL1.5.1'] = 'reaction';
a++;
}

Find the attached channel for reference.

Thanks,
Nagaraj T.
Attached Files
File Type: xml testHL7.xml (24.5 KB, 7 views)
Reply With Quote
  #4  
Old 01-23-2015, 07:56 AM
joanafncunha@gmail.com joanafncunha@gmail.com is offline
What's HL7?
 
Join Date: Nov 2014
Posts: 3
joanafncunha@gmail.com is on a distinguished road
Default

Thank you for your help!

I resolve with this function:

normalize(tmp);

function normalize(node,dontRecurse) {
for (var i in node)
if (node[i].hasComplexContent()) {
if (!dontRecurse)
for each (child in node[i].children())
normalize(child);
node[i].setChildren(node[i].*.(function(){return this != ''}()));
}
}
Reply With Quote
Reply

Tags
segments together

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 01:49 PM.


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