简体   繁体   中英

Add a '~' symbol in the HL7 message

I have an HL7 Message exporting. There's one field which has a tild symbol (~) in the input. The HL7 is converting that into symbol "\\R\\"

I also tried exporting this value by using the ASCII value (126) for the '~' character using VBScript as I am . But that was also converted by HL7 to "\\R\\"

How Can I get the '~' exported ? Any Help would be appreciated.

HL7 escapes the repetition character "~" to "\\R\\" when transferring a message. The receiver should that change back to your tilde, when working with that field.
But there is a second way to deal with that issue. HL7 allows to change the encoding chars. Unfortunately not all HL7 engines support that.

This character (~) represents that this field can have multiple values. Consider this PID.3 field from a given HL7 message

12345^^^XYZ~6789^^^PQR

What it means that, the patient has 2 patient ids coming from different sources viz. XYZ and PQR. This is what the (~) character means functionally.

If I go by the statement in the question body , I believe you want to achieve the functionality of (~) .

To do this, try following below process. I don't know vbscript so I can't give you the code, however I have some Javascript code for the same, and I think you can mimic the same on vbscript. I'll leave that task to you.

 //Calculates number of current repetitions by counting the length
 var pidfieldlen=msg.PID['PID.3'].length();

 //Store the last field node
var lastpidnode=msg['PID']['PID.3'][pidfieldlen-1];    //If length is 5,node index is 4 

 //Create new pid field and append with last pid node 
var newpidfield=<PID.3/>                      //Creating new separate element for PID.3
newpidfield['PID.3.1']="567832"               //Adding Field Values
newpidfield['PID.3.4']="NEW SOURCE"
lastpidnode.appendChild(newpidfield)          //Adding above created to the last node

This will transform the PID.3 into

12345^^^XYZ~6789^^^PQR~567832^^^NEW SOURCE

Try to replace the tilde characters with &#x7e; or &#126; (decimal). See the unicode reference for this character.

If you have already done so, this is not the source of error. I suspect that HL7 attaches a special meaning to this character. According to this webpage it denotes a "Field Repeat Separator".

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