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, 12: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, 9 views)

Last edited by mkohls; 05-10-2018 at 05:22 AM. Reason: Adding Channel
Reply With Quote
  #2  
Old 05-16-2018, 06:18 AM
AlexNeiva AlexNeiva is offline
Mirth Guru
 
Join Date: Oct 2013
Location: Portugal
Posts: 275
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, 11:54 AM
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
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 05:28 PM.


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