Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

How to use fields from SQL to generate HL7?

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use fields from SQL to generate HL7?

    I have to create HL7 ADT message from data read in a database. I have created a channel with a database reader in source and a file writer in destination.

    The data are read in the database with a SQL statement (defined in SQL field) like SELECT NAME, FIRSTNAME FROM PATIENTS WHERE ... and another SQL order to update the record (defined in On-Update SQL field).

    In the destination field of the destination tab, I have put my HL7 message (MSH & PID) in the Template field.

    The question is : how can I use my SQL fields to update the template message? I have try to user variable like $('NAME') or $(NAME), but it doesn't work.

    Thanks in advance for your help (I'm new in MIRTH).


  • #2
    Re:How to use fields from SQL to generate HL7?

    Following is excerpt from TRANSFORMER. The following makes connection with database and reads value to place it in the outgoing message. I am using Oracle, I am sure, SQL Server shouldn't have any problems with following code.

    I am reading from my table HL_DATA.

    var dbConn = DatabaseConnectionFactory.createDatabaseConnection ("oracle.jdbc.OracleDriver", "jdbcracle:thin:@", "faisal", "faisal");
    var result = dbConn.executeCachedQuery("SELECT NAME FROM HL_DATA WHERE ID=1");;
    //tmp['PID']['PID.5']['PID.5.3'] = "Test";
    tmp['PID']['PID.5']['PID.5.3'] = result.getString(1);

    Hope it will help.