Sidebar

SQL Query from HL7 fields

0 votes
547 views
asked Jun 14, 2017 by cliff-s-2873 (240 points)
edited Jun 14, 2017 by amanda-w-3695
I have a SQL connection and I'm trying to insert the PatientID into PID-18.  Here's the mapping I have built but can't get it to work. I keep getting an error about invalid column name:

 

var queryResult = qie.doQuery(
   "CentricityPS",
   "select patientId from patientprofile where last = {PID-5.1} and first = {PID-5.2} and birthdate = {PID-7}");
message.setNode("PID-18", queryResult.getNode("1"));

2 Answers

0 votes
Instead of queryResult.getNode("1"), use queryResult.getNode('patientId')
answered Jun 14, 2017 by jon-t-6024 (560 points)
0 votes

The getNode is going to be the column name in the Select statement. 

var queryResult = qie.doQuery(
   "CentricityPS",
   "Select patientId From patientprofile Where last = '{PID-5.1}' and first = '{PID-5.2}' and birthdate = '{PID-7}'");
message.setNode("PID-18", queryResult.getNode("patientId"));

answered Jun 14, 2017 by amanda-w-3695 (4,840 points)
edited Jun 14, 2017 by amanda-w-3695
...