web stats
Accept HL7, Read from SQL, Send modified HL7 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 05-08-2018, 01:28 PM
mkohls mkohls is offline
What's HL7?
 
Join Date: Jul 2014
Posts: 5
mkohls is on a distinguished road
Default Accept HL7, Read from SQL, Send modified HL7

Hello,

Up until now, I have been working with Mirth Connect 3.02.7140 to accept HL7 messages and write the data out to SQL.
I have been tasked with doing something a little different, and after trying many times, I am stuck.

For certain HL7 messages, I want to forward them on to a new channel so I do not hang up the current writing process.
After receiving them in a new channel, parse out parts of the HL7 message to create a new message. Then pull some data from SQL to add to custom Z segment, and send the message back out. For right now, I am trying to test using File Writer destination.

I have created the Channel Writer on the existing Channel.
I have created a new channel set up as a Channel Reader, and on the Source Transformer, parsed out the data from the message I plan to use in the new message.
In my first destination, I have a JavaScript SQL query to pull the data.
var sql = dbConn.executeUpdate("SELECT Hosp, pmort30, PRISMscore, PRISMscoreDt, PRISMscoreExpirationDt from WorstLVPS_90days where MRN = '"+ $('MRN') +"'");
var results = dbConn.executeUpdate(sql);

I am having problems figuring out out to get the SQL results to a mapping?

In the File Writer destination, I have created a template and I am able to pull the mappings from the source transformer. But the SQL results are putting the descriptive name from the destination mapping instead of the actual values from SQL.
MSH|^~\&|PRISM|2.16.840.1.113883.3.137.3100^2.16.8 40.1.113883.3.137|||${date.get('yyyyMMddHHmmss')}| |ADT^A31|${UUID}|D|2.3||||||||||2.2B
EVN|A31|${date.get('yyyyMMddHHmmss')}||CPIU|Auto
PID|0001||${Patient_CKS}||${Patient_LastName}^${Pa tient_FirstName}^${Patient_MiddleName}||${Patient_ DOB}|${Patient_Sex}||${Patient_Race}|^^^^${Patient _Zip}^^^^||||||||${Patient_SSN}||||||||||||||||||| ||||||||||||
ZPR|0001|PrismActive^^${PRISMscore_LVPS}^${PRISMsc oreDt_LVPS}^Worst PRISM Score with score date within 90 days^enter OID^${PRISMscoreExpirationDt}

Thanks in advance for any suggestions.
Attached Files
File Type: xml MiHIN_PRISM_Outbound_Test.xml (41.9 KB, 15 views)

Last edited by mkohls; 05-10-2018 at 06:22 AM. Reason: Adding Channel
Reply With Quote
  #2  
Old 05-16-2018, 07:18 AM
AlexNeiva AlexNeiva is offline
Mirth Guru
 
Join Date: Oct 2013
Location: Portugal
Posts: 280
AlexNeiva is on a distinguished road
Default

Hello,

you are doing something wrong when query the DB.
I uploaded your channel and saw that.
Please change this into your "SQL_Read" Destination:

Code:
var dbConn;
var result;

try 
{
    dbConn = dbConn = DatabaseConnectionFactory.createDatabaseConnection('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sqlserver://aasjaptlv152:1433/WA_PredMort','mirthuser','mirth3112');

    var query="SELECT Hosp, pmort30, PRISMscore, PRISMscoreDt, PRISMscoreExpirationDt from WorstLVPS_90days where MRN = '"+ $('MRN') +"'";
    
    result = dbConn.executeCachedQuery(query);

    while(result.next())
    {
        var hosp = result.getString("Hosp");
        var pmort = result.getString("pmort30");
        var score = result.getString("PRISMscore");
        var core = result.getString("PRISMscoreDt");
        var exp = result.getString("PRISMscoreExpirationDt");
    }

    /*
    * Create here your channelMap.put('XXX',...);
    */
} 
finally 
{
    if (dbConn) 
    {
        dbConn.close();
    }
}
And on the same Destination transformer, remove the HL7 Outbound Template, leave it blank and change the Data Type to XML.
__________________
Best Regards,
Alex Neiva
Reply With Quote
  #3  
Old 05-18-2018, 12:54 PM
mkohls mkohls is offline
What's HL7?
 
Join Date: Jul 2014
Posts: 5
mkohls is on a distinguished road
Default

Alex,

That did the trick, thank you very much.

Michael
Reply With Quote
  #4  
Old 10-10-2019, 10:02 AM
MassimilianoD MassimilianoD is offline
What's HL7?
 
Join Date: Dec 2018
Posts: 3
MassimilianoD is on a distinguished road
Default

Hi all,
I'm trying to do something similar.
I'am able to read data from SQL, put it into a variabile, but the channel hang when creating the HL7 message.
My aim is to dispatch HL7 message I received, changing only the ['OBR'][1]['OBR.2.1'] and ['ORC'][1]['ORC.2.1'] with the data I got from SQL.

Can you help me, please?
I attached the channel.
Thank you so much
Attached Files
File Type: zip ENDOX_2_H2O_REPORT_2.zip (1.11 MB, 5 views)
Reply With Quote
  #5  
Old 10-10-2019, 12:48 PM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 254
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

In your destination, HL7_send, you have an HL7 message in the Outbound Message Template. That is almost never what you want, and will cause the incoming message to not be used, but the output to "start" with what is there. Try removing that and reprocessing?

If you do and you remove the template, be sure to update:

Code:
tmp['ORC'][1]['ORC.2']['ORC.2.1'] = newOrderId;
tmp['OBR'][1]['OBR.2']['OBR.2.1'] = newOrderId;
to

Code:
msg['ORC'][1]['ORC.2']['ORC.2.1'] = newOrderId;
msg['OBR'][1]['OBR.2']['OBR.2.1'] = newOrderId;
I disabled the database lookup, and it processed fine for me. You seem to be doing the lookup and writing to a channelMap just fine...

Good luck!
__________________

-= 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

Last edited by jackwhaines; 10-10-2019 at 12:57 PM.
Reply With Quote
  #6  
Old 10-11-2019, 02:20 AM
MassimilianoD MassimilianoD is offline
What's HL7?
 
Join Date: Dec 2018
Posts: 3
MassimilianoD is on a distinguished road
Default

Thank you jackwhaines for your reply!
Even if I disabled the SQL destination, removed the outbound message template, the HL7 destination remains in RECEIVED state... and I have to send HALT to channel
Reply With Quote
  #7  
Old 10-11-2019, 02:34 AM
MassimilianoD MassimilianoD is offline
What's HL7?
 
Join Date: Dec 2018
Posts: 3
MassimilianoD is on a distinguished road
Default

I did it!
I was sending encoded data to the same channel that was processing the message... my fault!
Reply With Quote
  #8  
Old 10-11-2019, 06:56 AM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 254
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

Nice! It's always nice when it's something simple!
__________________

-= 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
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 12:54 AM.


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