Sidebar

How can I add HL7 data to a database?

0 votes
452 views
asked Oct 24, 2019 by michael-h-5027 (14,390 points)
MSH|^~\&|ADT1|MCM|LABADT|MCM|198808181126|SECURITY|ADT^A04|MSG00001|P|2.4
EVN|A01-|198808181123
PID|||PATID1234^5^M11||JONES^WILLIAM^A^III||19610615|M-||2106-3|1200 N ELM STREET^^GREENSBORO^NC^27401-1020|GL|(919)555-1212|(919)555-3434~(919)555-3114||S||PATID12345001^2^M10|123456789|9-87654^NC
NK1|1|JONES^BARBARA^K|SPO|||||20011105
NK1|1|JONES^MICHAEL^A|FTH|||||20011105
NK1|1|JONES^MARGO^J|MTH|||||20011105

1 Answer

0 votes

Here is a sample channel link that covers multiple methods as well as a for loop for NK1 segments and how to query your inserted data.

You can do an update query in qvera and reference the HL7 nodes.

var sqlQuery = "INSERT INTO myTable \n" +
   "(tableid, patientid, lastname, firstname)\n" +
   "VALUES (" + qie.formatDate('yyyyMMddHHmmss') + ", '" + message.getNode('PID-3.1') + "', '" + message.getNode('PID-5.1') + "', '" + message.getNode('PID-5.2') + "')";

var updateResult = qie.doUpdateQuery('MyDB', sqlQuery);

// qie.doUpdateQuery is the better way to do this since

// we should get back a response of one row added.
 

answered Oct 24, 2019 by michael-h-5027 (14,390 points)
...