Sidebar

How can I create an HL7 message from a database query?

+1 vote
692 views
asked Jul 18, 2017 by michael-h-5027 (13,630 points)
I want to create an HL7 message from a database query for a specific patient with patient ID 677.

1 Answer

–1 vote

Your source node could be a SQL query or a CSV list of patient IDs. You would want to change the 677 in this query below to a variable based on the source node values.

 

message = qie.createHL7Message('UTF-8');

var queryResult = qie.doQuery('Database Name',
   "SELECT lastname, firstname FROM person\n" +
   " WHERE patientid = '677'"
);

message.setNode('PID-5.1', queryResult.getNode('lastname'));
message.setNode('PID-5.2', queryResult.getNode('firstname'));

answered Jul 18, 2017 by michael-h-5027 (13,630 points)
...