web stats
HL7 -> transform based on db query -> HL7 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-04-2010, 07:33 AM
mwolfe83 mwolfe83 is offline
Mirth Newb
 
Join Date: Jun 2010
Posts: 11
mwolfe83 is on a distinguished road
Default HL7 -> transform based on db query -> HL7

I have an HL7 messaging coming in.
I want to take the inbound OBR.2 record and query a database. If the database has a matching OBR.2 record then it adds to the out bound message obx.5. If there isn't a match then an outbound message never happens.

I'm not great at javascript but below is kind of what I have started and it is giving me a " The content of elements must consist of well-formed character data or markup." error.

Any help would be much appreciated.

Quote:
var Accession_Num = msg['OBR']['OBR.2']['OBR.2.1'].toString();
var dbConn =
DatabaseConnectionFactory.createDatabaseConnection ('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sql server://10.0.0.55:1433/raypax','MIRTH','MIRTH');
var result;
result = dbConn.executeCachedQuery("select REPORT_TEXT from PACS_T_REPORT_TEXT where EXAM_KEY= Accession_Num");
result.first();
var report_text = result.getString("REPORT_TEXT");

tmp['OBX']['OBX.5']['OBX.5.1']= report_text
Reply With Quote
  #2  
Old 11-04-2010, 08:48 AM
john.newman john.newman is offline
OBX.3 Kenobi
 
Join Date: Oct 2009
Posts: 124
john.newman is on a distinguished road
Default

var report_text = result.getString("REPORT_TEXT");

tmp['OBX']['OBX.5']['OBX.5.1']= report_text

you probably need to encode or escape that in some way or another. (i do not know hl7 well enough to say how)

Check the reference tab in the transformer to see if any functions there sound applicable. Try putting a log statement in between there and see if it has any funny characters. I'm guessing if report_text has a |,^,&,", etc in there it probably wont go right in the hl7 output.
Reply With Quote
  #3  
Old 11-05-2010, 11:46 AM
mwolfe83 mwolfe83 is offline
Mirth Newb
 
Join Date: Jun 2010
Posts: 11
mwolfe83 is on a distinguished road
Default scrapped

Well, I can't seem to delete this post so I will kind of give my current position. I scrapped trying to configure it this way. I was making it too difficult.
Reply With Quote
Reply

Tags
hl7, mssql, query

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 07:43 AM.


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