Announcement

Collapse
No announcement yet.

How to use fields from SQL to generate HL7?

Collapse
X
 
  • 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).

    François.

  • #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:@193.101.5.13:1521rcl", "faisal", "faisal");
    var result = dbConn.executeCachedQuery("SELECT NAME FROM HL_DATA WHERE ID=1");
    result.next();
    //tmp['PID']['PID.5']['PID.5.3'] = "Test";
    tmp['PID']['PID.5']['PID.5.3'] = result.getString(1);
    result.close();
    dbConn.close();

    Hope it will help.

    Regards
    Fasial

    Comment

    Working...
    X