• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

HL7 Interface

New Here ,
May 30, 2006 May 30, 2006

Copy link to clipboard

Copied

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
TOPICS
Event gateways

Views

4.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 28, 2006 Jun 28, 2006

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 29, 2006 Jun 29, 2006

Copy link to clipboard

Copied

Bob,
This is what I had to do to get this working (yes it works now).
First I modified the Socket java code. I removed the "CR >" from the code and recompiled the class (not an easy job to get it to compile with all the right stuff).
I don't think this was necessary, but I did it anyway.

The CR's in the message are bad as it breaks up the message and it is very difficult for the CFC to "remember" the previous segments since each CR really is another call to the function. So, I had my interface guy change the interface to send CHR(30) which is RS instead of CHR(13) so I get one long record with the standard CHR(28) and CHR(13) at the end. I do a find and if I find a CHR(28) I reply with a return value of CHR(11)&"MSH|^~\&|CFADT|CFADT|DATAGATE|STC|||ACK|"&serialnum&"|P|2.2||"&chr(30)&"MSA|AA|"&serialnum&"||1|"&chr(13)&chr(28)&chr(13)

Note I pull the serial number out of the message and send it back.
I also found a usefull function on CFLIB.org called ListGetAtIncNulls(list,position,delimiter) that helps me pull the correct data from the message. The CF listgetat function will not count any list items that are empty (null). This of course throws off where to find data in an HL7 message.

I think that is all I did. If you want a copy of my test CFC, I will be happy to send it to you. Hope this helps.
Dan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 29, 2006 Jun 29, 2006

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 02, 2009 Dec 02, 2009

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 09, 2010 Feb 09, 2010

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 12, 2010 Feb 12, 2010

Copy link to clipboard

Copied

LATEST

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 01, 2009 Dec 01, 2009

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation