简体   繁体   中英

Process repeating segments from database reader source

I got a list of test results, read from a table, in the following form:

testid | testname | sampleid
-------------------------------
1001   | GLU      | 99889
1002   | CR       | 99889
1003   | NU       | 99889

And I need to build an ASTM/HL7 message with this information, but having trouble find a solution on how to build the repeating segments of the message.

Just want to know how to tackle this. I am currently trying to modify it in the source transform of the channel using the database reader.

var dbConn;

        try {
            dbConn = DatabaseConnectionFactory.createDatabaseConnection('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sqlserver://localhost:1433/DB','xxx','xxx');

            return result;
        } finally {
            if (dbConn) { 
                var sql = "SELECT IDORDEN, FSOLICITUD, NO_EXP, APELL1, APELL2, NOMBRE, FNAC, CAMA, SEXO, IDEXAMEN, PROCESADO FROM ORDENES"
                var result = dbConn.executeCachedQuery(sql);

                dbConn.close();
                return result;
            }
        }

Please advice.

In channel's Destination Transformer add an outbound message template with all required fields including a single instance of the segment that you need to repeat. Assign the segment you need to repeat to a variable and populate required fields with the first database entry. Insert that segment into the message (you may delete the initial segment template). Do the same with all other database entries. At the end you should have a valid output with multiple segments.

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