简体   繁体   中英

Mirth selecting from database on destinations

Have a situation where our patientID does not match whats coming from the HL7 file. So what I had to do was query the database get the patientID based off of the name and birthdate in the HL7 file. I search and was unable to find any info on how to do this. Thought I'd share how I ended up getting it to work for others. Currently this only selects off the lastname but it shows the point.

var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('com.mysql.jdbc.Driver','jdbc:mysql://localhost:3306/YOURDB','username','password');
var query = "SELECT PatientID FROM YOURTABLENAME " + "WHERE Last = '" + $('lname')+ "'";
var result = dbConn.executeCachedQuery( query );

result.next();
var patientID = result.getString(1)
//logger.info(result.getString(1));
result.close();

var query = "INSERT INTO YOURTABLENAME (id, name) VALUES ('"+patientID+"','"+$('lname')+"')";
var result = dbConn.executeUpdate( query );

dbConn.close(); 

Your code is only matching the last name which is not enough to make a safe match. Last name and birth-date is not safe either. You need last name, first name, and birth-date and even then it would be better to use SSN or add more data points to your match. The first sentence in your "question" isn't really a question and doesn't give us much to go on if you are truly wanting help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM