Skip navigation
Currently Being Moderated

HL7 Interface

May 30, 2006 7:51 AM

I work for a hospital and we have lots of HL7 interfaces. I decided to try and create one to CF using a Socket gateway for a project.
The Datagate Interface Engine (DIE) seems to talk to my gateway ok, as I am receiving the message, but I am not able to get the DIE to accept my ACKnowledgement that I received the messsage, thus the DIE keeps resending me the same message.
I removed the socket default response "CRLF > " from the java socket code and recompiled so I can respond with exactly the characters I want. Still no ACK. I tried sending just CHR(06), also tried sending an HL7 message back with the |MSH|^~\&|.... it does not respond.
I was wondering if anyone else has been successful and if so, what did you do??
My specs are: CF7.0.1 Enterprise on Win 2003 server. Interface engine is on an AIX box running Datagate.
Thanks...Dan
 
Replies
  • Currently Being Moderated
    Jun 28, 2006 2:10 PM   in reply to Dmadzia
    Hi Dan,

    Just wondered whether you'd got anywhere with this. I've been trying to do the same thing, i.e. use socket gateway to receive HL7 messages. One of the issues I ran into is that each segement in the HL7 message is delimited by a carriage return. This results in each segment being received as a separate message, and not necessarily in the same order as in the original HL7 message. I'm able to work around that in this particualr case because I know the order they should be in and am able to rebuld original message. Now like you I'm stuck trying to send a succesful ack message.

    If i understand things correctly the ack message must use the MLLP protocol, i.e. the message must start with chr(11)and end with chr(13) chr(28) . Maybe the socket gateway is unable to return the entire message when it contains carriage returns??

    Bob
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 29, 2006 9:24 AM   in reply to Dmadzia
    Dan,

    Thanks for the response. That helped me see what I was doing wrong (didn't realize that the MSA part was a separate segment). I got around the carriage return issue by concatenating the various segments in their expected order. Trouble is they arrive asynchronously and not necessarily in the correct order. Your solution sounds better - have to talk to the interface team;-)


    I managed the empty list items by replacing them with a special value:

    theMsg=replace(replace(theMsg,'||', '|@@|','all'),'||', '|@@|','all');

    then substituting '' back when accessing the element:

    val=replace(trim(listgetat(theMsg,locn,"|")),'@@','');

    But ListGetAtIncNulls looks promising, I'll check that out.

    Thanks

    Bob
     
    |
    Mark as:
  • Currently Being Moderated
    Dec 2, 2009 3:19 AM   in reply to Dmadzia

    Dan, Your knowledge on this matter seems a bit beyond mine. I know this is an old post, but do you have an example of your code? I am attempting a HL7 to CF8 interface (socket gateway), and I'm having the same issue with the acknowledgement response. I'm getting the messages, but i get tons of them because the E*Gate engine never receives a response telling it to stop attempting. Any help would be greatly appreciated.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 2, 2009 12:21 PM   in reply to bobk1

    Bob, I am new to the HL7/CF integration world, and I noticed this posting that looks to be addressing exactly what I'm trying to achieve. Do you have any working examples that you feel comfortable sharing? I know it's been over 3 years since you addressed these issues on the Adobe forum, but any help would be greatly appreciated.

     

    Thank you

     

    Ed

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 9, 2010 9:23 PM   in reply to etkoto

    Hello,

     

    We re-wrote an hl7 interface to use a .net app instead of CF, as doing so in CF proved unreliable. Check out the software from Symphonia to add some great .dll's to your .net app for message processing.

     

    We use the .net app to save the message into a table, acknowledge the message etc. Once its in the database it just text in a big string...

     

    BUT, poking around I found some old code from many many many years ago when it was attempted within CF ( not my code, or know who to attribute):

     

    it may provide some inspiration. this code took the message and other code saved the string into the database...

     

    but stil I would recommned against doing it in cf

     

    <cfscript>
    function createsocket(port) {
    // Create a server socket, and start listening.

    // get a socket object
    getsocket = CreateObject("java", "java.net.ServerSocket");
    try{
    getsocket.init(port);
    // wait for external connection
    socket = getsocket.accept();
    }
    //  If socket pre-exists from a previous program failure, attempt to connect to it, rather than create it.
    // This code does not actually seem to connect, but does result in the socket dying within about 15 seconds
    // so that the next invocation of this program can run cleanly.
    // A restart of the CF application service will also kill any leftover sockets.
    catch (any excpt) {
        socket = CreateObject("java", "java.net.Socket");
        socket.init('127.0.0.1',port);
        }

    // get an InputStreamReader object
    inputsr = CreateObject("java", "java.io.InputStreamReader");
    // call the InputStreamReader constructor
    inputsr.init(socket.getInputStream());

    // get a BufferedReader object
    input = CreateObject("java", "java.io.BufferedReader");
    // call the BufferedReader constructor
    input.init(inputsr);

    // get a PrintWriter object
    printWriter = CreateObject("java", "java.io.PrintWriter");
    // call the PrintWriter constructor
    printWriter.init(socket.getOutputStream(), true);

    return 'OK';
    }

    function getMsg() {
    // Read a complete HL7 message from the socket.

    f_hl7_msg = input.readLine();
    while (input.ready())
      {
       f_hl7_msg = f_hl7_msg & Chr(13) & Chr(10) & input.readLine();
      }
    return f_hl7_msg;
    }

    function sendAck(msg_id, src, resp) {

    // Construct and Send the ACK
    thistime = DateFormat(Now(),'yyyymmdd') & TimeFormat(Now(),'HHmmss');
    msg_seg = 'MSH|^~\&|'   &
        src     & '|' &
                '|' &
        resp     & '|' &
                '|' &
        thistime    & '|' &
                '|' &
        'ACK'     & '|' &
        msg_id  & '|' &
       'P'     & '|' &
       '2.3.1'    & '||||';

    msa_seg   = 'MSA'    & '|' &
        'AA'     & '|' &
        msg_id    & '|' &
        'Message Processed Successfully';
       
    hl7_ack  =  CHR(11) &
         msg_seg & CHR(13) &
         msa_seg & CHR(13) &
         CHR(28) & CHR(13);

    printWriter.println(hl7_ack);
    }     

    function closePort() {
             printWriter.close();
             input.close();
             socket.close();
    }

    </cfscript>

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 12, 2010 4:41 AM   in reply to Scott_thornton

    Scott, thank you for taking the time to look into this. I was able to accomplish exactly what I was trying to do by working with someone who new a bit more Java than I did. What we did was duplicate the demo event gateway listener in Coldfusion's default instance copied it, renamed it and modified it to deal with HL7 messages. We also created a cfg file to allow us to select the HL7 message that we were interested in picking up as they were sent  across a specified port. We did this all with CF8 and a retrofitted Java component. We may actually decide to sell this one, because I believe there is a need out there for HL7/CF plug-in-play functionality.

     

    Again thank you for taking the time to respond to my inquiry. These types of forums keep us all in business!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points