web stats
How to convert XML to HL7 where Source connector is DBREADER? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 02-14-2016, 11:24 PM
anupamd anupamd is offline
What's HL7?
 
Join Date: Feb 2016
Posts: 2
anupamd is on a distinguished road
Red face How to convert XML to HL7 where Source connector is DBREADER?

Hello All,

I'm Learning mirth by own. Just wanted step by step guidance to convert the Message into HL7 from DB Reader.
I tried to find a lot but could not get any success.

Thanks & Regards,
Anupam Deogade.
Reply With Quote
  #2  
Old 02-16-2016, 07:38 AM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 185
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

Hi Anupam,

The basic steps are:

1) Create a new channel with "Database Reader" as the source.

2) In the Source Transformer, put a "skeleton" HL7 message in the Outbound Message Template

3) Use the Inbound Message Template to drag the values you want (the green dot) down to the area (again, green dots) in the HL7 template in the Outbound Message Template to create "Mapper" steps.

That's the basics of it... I've included a quick channel.


Good luck and welcome to the world of Mirth!
Attached Files
File Type: xml DB to HL7.xml (57.4 KB, 47 views)
__________________

-= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines
Reply With Quote
  #3  
Old 02-28-2016, 10:05 PM
anupamd anupamd is offline
What's HL7?
 
Join Date: Feb 2016
Posts: 2
anupamd is on a distinguished road
Default

Quote:
Originally Posted by jackwhaines View Post
Hi Anupam,

The basic steps are:

1) Create a new channel with "Database Reader" as the source.

2) In the Source Transformer, put a "skeleton" HL7 message in the Outbound Message Template

3) Use the Inbound Message Template to drag the values you want (the green dot) down to the area (again, green dots) in the HL7 template in the Outbound Message Template to create "Mapper" steps.

That's the basics of it... I've included a quick channel.


Good luck and welcome to the world of Mirth!
Thank You!!! Very Much Jack that was very much helpful....

My configuration is overview :
1. REST is requesting some id's from JSON i.e (im_id) in the form of array,
e.g {"im_id": [12,54,76]}
2. Parsed them in string
3. Defined a variable which connects db and returns values using View in sql.
4.
var resultLRStatus;
try
{
resultLRStatus = dbConn.executeCachedQuery(resultQuery);
}
catch(e)
{
logger.error('qry executed'+ e.message);
return;
}


//logger.info('qry executed');

var patient_labtest_id = '';
var mrn = '';
var dob = '';
//var patient_id = '';
var result_id = '';
order_ids = '';
var orcIndex = 0;

var newMSH = new XML("<MSH></MSH>");
var newPID = new XML("<PID></PID>");
var newPV1 = new XML("<PV1></PV1>");
var newPD1 = new XML("<PD1></PD1>");
var newORC = new XML("<ORC></ORC>");
var newRXA = new XML("<RXA></RXA>");
var newRXR = new XML("<RXR></RXR>");


if (resultLRStatus != undefined) {
while(resultLRStatus.next())
{
logger.info("inside while loop")
mrn = '';
mrn = resultLRStatus.getString("mrn");
logger.info("mrn : "+mrn);


var datestring = DateUtil.convertDate('yyyy-MM-dd', 'yyyyMMdd', resultLRStatus.getString("date_of_birth"));
//var mshdate = Date();
//var newmshdate = mshdate.toString();
//logger.info(newmshdate);
//var MSHdatestring = DateUtil.convertDate('yyyy-MM-dd', 'yyyyMMdd', newmshdate);

tmp.appendChild(newMSH);
tmp.appendChild(newPID);
tmp.appendChild(newPV1);
tmp.appendChild(newPD1);
tmp.appendChild(newORC);
tmp.appendChild(newRXA);
tmp.appendChild(newRXR);


var mshdate = DateUtil.convertDate('yyyy-MM-dd', 'yyyyMMdd', resultLRStatus.getString("administered_date"));
//MSH Segment

tmp['MSH'][orcIndex]['MSH.7']['MSH.7.1']=mshdate;

//PID Segment
tmp['PID'][orcIndex]['PID.2']['PID.2.1'] = resultLRStatus.getString("mrn");
tmp['PID'][orcIndex]['PID.5']['PID.5.1'] = resultLRStatus.getString("lname");
tmp['PID'][orcIndex]['PID.5']['PID.5.2'] = resultLRStatus.getString("fname");


now there are some columns in my database like patient middle name that is being show as null in my output:

PID||MRN12345|||Test^example^null|null|20140204|Ma le||2106-3^White^HL7CODE^CDCREC|||^^^null|||||||||2135-2^Hispanic or Latino|||||||||||

how do i remove those null values, if it has null values then is should show me blank.


Thanks & Regards,
Anupam Deogade
.
Reply With Quote
Reply

Tags
dbreader to filewriter, xml to hl7

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 03:18 PM.


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