TCP HL7 message has .(period) as segment terminato

2019-09-06 01:58发布

I am receiving a hl7 message through tcp, in which am getting message with .(periods) at the end of each segments, so my hl7 receiver engine is unable to process the message and its breaking, sample message through tcp is

%0D%0A00000000 | 00 00 02 fc 10 5e 00 00 00 00 00 00 02 e2 0b 4d .....^.........M
%0D%0A00000016 | 53 48 7c 5e 7e 5c 26 7c 41 54 48 45 4e 41 4e 45 SH|^~\&|AAEEAAEE
%0D%0A00000032 | 54 7c 36 31 30 5e 56 41 20 2d 20 4d 69 64 20 41 T|610^VA - Mode B
%0D%0A00000048 | 74 6c 61 6e 74 69 63 20 57 6f 6d 65 6e 27 73 20 ody test 
%0D%0A00000064 | 43 61 72 65 7c 56 49 5a 54 45 4b 3a 3a 36 31 30 Care|VIoTooK::610
%0D%0A00000080 | 7c 7c 32 30 31 34 30 35 33 30 31 35 30 33 7c 7c ||201405301503||
%0D%0A00000096 | 53 49 55 5e 53 31 35 7c 31 38 35 32 31 37 34 32 SIU^S15|18521742
%0D%0A00000112 | 7c 54 7c 32 2e 32 7c 7c 7c 7c 7c 7c 7c 7c 0d 53 |T|2.2||||||||.S
%0D%0A00000128 | 43 48 7c 36 34 30 39 36 34 33 7c 36 34 30 39 36 CH|6409643|64096
%0D%0A00000144 | 34 33 7c 7c 7c 7c 31 5e 50 54 20 43 41 4e 43 45 43||||1^PT CANCE
%0D%0A00000160 | 4c 4c 45 44 7c 54 65 73 74 69 6e 67 3b 54 45 53 LLED|Testing;TES
%0D%0A00000176 | 54 49 4e 47 7c 4d 41 32 30 5e 4d 41 4d 4d 4f 47 TING|MA20^MAMMOG
%0D%0A00000192 | 52 41 4d 7c 32 30 7c 6d 69 6e 75 74 65 73 7c 5e RAM|20|minutes|^
%0D%0A00000208 | 5e 5e 32 30 31 34 30 36 30 32 30 38 32 30 7c 7c ^^201406020820||
%0D%0A00000224 | 7c 7c 7c 6d 68 65 61 6e 67 7c 7c 7c 7c 7c 7c 7c |||mheang|||||||
%0D%0A00000240 | 7c 7c 0d 50 49 44 7c 7c 34 37 35 30 31 33 7c 34 ||.PID||475013|4
%0D%0A00000256 | 37 35 30 31 33 7c 7c 54 45 53 54 45 52 5e 41 54 75013||TESTER^AT
%0D%0A00000272 | 48 45 4e 41 5e 5e 7c 7c 31 39 39 34 30 35 33 30 HENA^^||19940530
%0D%0A00000288 | 7c 46 7c 7c 39 30 30 5e 57 68 69 74 65 7c 33 31 |F||900^White|31
%0D%0A00000304 | 31 20 41 52 53 45 4e 41 4c 20 53 54 52 45 45 54 1 ARSENAL STREET
%0D%0A00000320 | 5e 5e 57 41 54 45 52 54 4f 57 4e 5e 4d 41 5e 30 ^^WATERTOWN^MA^0
%0D%0A00000336 | 32 34 37 32 5e 55 4e 49 54 45 44 20 53 54 41 54 2472^UNITED STAT
%0D%0A00000352 | 45 53 7c 7c 28 36 36 36 29 36 36 36 2d 36 36 36 ES||(666)666-666
%0D%0A00000368 | 36 5e 28 37 37 37 29 37 37 37 2d 37 37 37 37 7c 6^(777)777-7777|
%0D%0A00000384 | 28 39 39 39 29 39 39 39 2d 39 39 39 39 7c 31 32 (999)999-9999|12
%0D%0A00000400 | 34 5e 45 6e 67 6c 69 73 68 7c 53 7c 7c 7c 31 32 4^English|S|||12
%0D%0A00000416 | 33 34 35 36 37 38 39 7c 7c 7c 34 33 5e 4e 6f 74 3456789|||43^Not
%0D%0A00000432 | 20 48 69 73 70 61 6e 69 63 20 6f 72 20 4c 61 74 Hispanic or Lat
%0D%0A00000448 | 69 6e 6f 7c 7c 7c 7c 7c 7c 7c 7c 0d 50 56 31 7c ino||||||||.PV1|
%0D%0A00000464 | 7c 7c 31 37 5e 4d 41 49 43 2d 43 68 65 73 61 70 ||17^MAIC-Chesap
%0D%0A00000480 | 65 61 6b 65 5e 5e 4d 41 49 43 2d 43 68 65 73 61 eake^^MAIC-Chesa
%0D%0A00000496 | 70 65 61 6b 65 7c 7c 7c 7c 34 35 5e 4d 41 4d 4d peake||||45^MAMM
%0D%0A00000512 | 4f 47 52 41 4d 7c 33 37 30 32 5e 53 4d 49 54 48 OGRAM|3702^SMITH
%0D%0A00000528 | 2c 20 43 4c 41 59 54 4f 4e 7c 7c 7c 7c 7c 7c 7c , CLAYTON|||||||
%0D%0A00000544 | 7c 7c 34 35 5e 4d 41 4d 4d 4f 47 52 41 4d 7c 7c ||45^MAMMOGRAM||
%0D%0A00000560 | 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c ||||||||||||||||
%0D%0A00000576 | 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c ||||||||||||||||
%0D%0A00000592 | 7c 0d 44 47 31 7c 7c 49 43 44 39 7c 7c 6e 6f 20 |.DG1||ICD9||no 
%0D%0A00000608 | 63 75 72 72 65 6e 74 20 64 69 61 67 6e 6f 73 69 current diagnosi
%0D%0A00000624 | 73 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c 7c s|||||||||||||||
%0D%0A00000640 | 0d 52 47 53 7c 7c 7c 0d 41 49 47 7c 7c 7c 4d 41 .RGS|||.AIG|||MA
%0D%0A00000656 | 4d 4d 4f 47 52 41 4d 7c 7c 7c 7c 7c 32 30 31 34 MMOGRAM|||||2014
%0D%0A00000672 | 30 36 30 32 30 38 32 30 7c 7c 7c 32 30 7c 6d 69 06020820|||20|mi
%0D%0A00000688 | 6e 75 74 65 73 7c 7c 0d 41 49 4c 7c 7c 7c 31 37 nutes||.AIL|||17
%0D%0A00000704 | 5e 4d 41 49 43 2d 43 68 65 73 61 70 65 61 6b 65 ^MAIC-Chesapeake
%0D%0A00000720 | 7c 7c 7c 32 30 31 34 30 36 30 32 30 38 32 30 7c |||201406020820|
%0D%0A00000736 | 7c 7c 32 30 7c 6d 69 6e 75 74 65 73 7c 7c 1c 0d ||20|minutes||..

As you can see each segment is ended with periods. So How to process the message? I cannot replace all periods since periods may also exist in midst of the message.

Any help will be appreciated.

标签: c# hl7
3条回答
可以哭但决不认输i
2楼-- · 2019-09-06 02:16

I would consider reading the Microsoft documentation on the HL7 format.

In particular, the following two articles may be of use:

It's worth noting that period is not mentioned as a delimiter in Microsoft's documentation. As such, it sounds like your message format is non-standard, and furthermore, periods which are not supposed to be terminators are not being escaped (\.).

It sounds like you may need to request that your client escape these characters and, if possible, follow the HL7 specification.

查看更多
Anthone
3楼-- · 2019-09-06 02:24

The message you are viewing arrived to you via TCPIP. It is wrapped in MLLP protocol for transmission. Hex 0b is the message header and 1c 0d is the footer.

You can find more information about MLLP at this link: http://www.interfaceware.com/blog/common-hl7-transports/

Incidentally the 4 characters immediately following MSH are what define the separators that should be used throughout the message. Let me know if you need a follow up.

Edit it seems I may have misunderstood the question. There appears to be nothing wrong with the message. Those are carriage returns separating the segments. Hope that helps.

查看更多
孤傲高冷的网名
4楼-- · 2019-09-06 02:36

There is no period "." segment delimiter in your HL7 Message. If you look carefully, you will see, that the segment delimiter is 0d in hex or 13 in decimal notation. This is standard. Just your editor plane shows not representable bytes as periods instead of chars.

So your issue is something different.

I recommend to show your message in two different ways, separate the hex and the character presentation.

查看更多
登录 后发表回答