简体   繁体   中英

Mirth - Send multiple HL7 messages during one polling interval

In Mirth, I have a JavaScript Reader connector and in the source, I have a call to a stored procedure. This procedure returns multiple rows. Is there any way to script it so that for each row returned from the procedure, I can generate the message and send appropriately? The other option that I am already aware of is to script it to generate only 1 message and have the polling interval set to every 100ms or so in addition to changing the procedure. Any help or insight would be greatly appreciated.

var procedure = 'exec dbo.mystoredprocedure';
objresult = dbConn.executeCachedQuery(procedure);
while (objresult.next())
{
    var msg = <HL7Message/>;
    msg.MSH['MSH.1'] = '|';
    msg.MSH['MSH.2'] = '^~\\&';
    msg.MSH['MSH.3'] = 'MedicalRecords';
    msg.MSH['MSH.4'] = 'Application';
    msg.MSH['MSH.5'] = 'Test';
    msg.MSH['MSH.6'] = 'Something';
    msg.MSH['MSH.7'] = DateUtil.getCurrentDate("yyyyMMddHHmmssSSS");
    msg.MSH['MSH.8'] = '';
    msg.MSH['MSH.9']['MSH.9.1'] = 'ADT';
    msg.MSH['MSH.9']['MSH.9.2'] = 'A08';
    msg.MSH['MSH.10'] = DateUtil.getCurrentDate("yyyyMMddHHmmssSSS");
    msg.MSH['MSH.11'] = 'P';
    msg.MSH['MSH.12'] = '2.5';
    .
    .
    .
    .
  return msg;
}

Yes, you can return a List with multiple messages. Each element in the list will be dispatched to the channel as a separate message.

Great thanks! I did some digging and found what I was looking for.

var messages = new java.util.ArrayList();
messages.add(message1);
messages.add(message2);
return messages;

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