HL7 教育訓練課程教材 訊息結構與規則說明

92
1 台台台台台台台台台台台台台台台 台台台台 HL7 台台台台台台台台 台台台台台台台台台 台台台台台台台 Education Technical Committees 台台台 台台台 台台台台台台台

description

HL7 教育訓練課程教材 訊息結構與規則說明. 教育訓練委員會 Education Technical Committees. 秘書長 范士展 改編自總會教材. 講授大綱. Control Formatting Processing Rules Data Type Conformance. What is HL7 Standard?. Protocol for exchange of healthcare information Not an application Not a data structure or database specification - PowerPoint PPT Presentation

Transcript of HL7 教育訓練課程教材 訊息結構與規則說明

Page 1: HL7 教育訓練課程教材 訊息結構與規則說明

1 台灣健康資訊交換第七層協定協會 版權所有

HL7 教育訓練課程教材訊息結構與規則說明

教育訓練委員會Education Technical Committees

秘書長 范士展 改編自總會教材

Page 2: HL7 教育訓練課程教材 訊息結構與規則說明

2

講授大綱

Control Formatting Processing Rules

Data Type Conformance

Page 3: HL7 教育訓練課程教材 訊息結構與規則說明

3

What is HL7 Standard?

Protocol for exchange of healthcare information Not an application Not a data structure or database specification Not an architecture for designing health

applications Not a specification for a message router or

Gateway

Page 4: HL7 教育訓練課程教材 訊息結構與規則說明

4 台灣健康資訊交換第七層協定協會 版權所有

Control

Chapter 2 of the HL7 V2.x Standard

Page 5: HL7 教育訓練課程教材 訊息結構與規則說明

5

Appendix A - Data definition tables Appendix B - Lower layer protocolsAppendix C - BNF message descriptions managementAppendix D - Glossary

HL7 Chapters (Version 2.5)

CHAPTER CHAPTER

1. Introduction

2. Control

2a. Data type

3. Patient administration

4. Order entry

5. Query

6. Financial management

7. Observation reporting

8. Master files

9. Medical records/Information

10. Scheduling

11. Patient referral

12. Patient care

13. Laboratory automation

14. Application management

15. Personnel management

Page 6: HL7 教育訓練課程教材 訊息結構與規則說明

6

What Control Covers…

Defines the generic rules that apply to all messages The Key: How to read the rest of the specification HL7 Encoding Rules: what the !@#$ are those |^&\

in my data stream? The programming procedures required to exchange all

messages Standard conformance profiling rules for message

specification

Page 7: HL7 教育訓練課程教材 訊息結構與規則說明

7

Conceptual Approach

Critical Care Unit

ADT System

Response Message

Initiating Message

Clinical Data Repository

Initiating Message

Page 8: HL7 教育訓練課程教材 訊息結構與規則說明

8

V2 Message Definition

MESSAGE

MESSAGE

(Admission

(Admission

Message)Message)

SENDINGAPPLICATION

(Patient Administration)

RECEIVINGAPPLICATION

(Lab System)

TRIGGER EVENT

(Admit)

Page 9: HL7 教育訓練課程教材 訊息結構與規則說明

9

HL7 CONTROL

Framework– Trigger Event– Message– Segment– Field (Data Type)– Component– Sub-Component

Message

Segment Segment ……

Field

Component Component ……….

Field Field

Page 10: HL7 教育訓練課程教材 訊息結構與規則說明

10

以火車系統為例

台北站 高雄站車 站: System時刻表: Trigger Event火 車: Message車 廂: Segment座 位: Field車 票: Data Type乘 客: Component

Page 11: HL7 教育訓練課程教材 訊息結構與規則說明

11

HL7 Has Two Transaction Flows

UnsolicitedUpdate

Patient is admitted

Admit Ack

Query / Request

MD request

QueryReport

Trigger Event

Trigger Event

Page 12: HL7 教育訓練課程教材 訊息結構與規則說明

12

Trigger Event

A real world event that necessitates an exchange of information.

Page 13: HL7 教育訓練課程教材 訊息結構與規則說明

13

Unsolicited Update

When the transfer of information is initiated by the application system that deals with the trigger event, the transaction is termed an unsolicited update.

Example: Patient is admitted. Glucose test is resulted.

Page 14: HL7 教育訓練課程教材 訊息結構與規則說明

14

Query and Response

When the transfer of information is initiated by an application requesting information from another system, the transaction is termed a query.

Example: Request all lab results from a patient’s prior visit.

Page 15: HL7 教育訓練課程教材 訊息結構與規則說明

15

Recipe for an HL7 Message

• Messages are made up of segments which are made up of fields which may have components which may have sub-components.

Page 16: HL7 教育訓練課程教材 訊息結構與規則說明

16

Abstract Message

The information associated with the trigger event.

Who came to the hospital?When did they arrive?

What was wrong?What doctor did they see?

Page 17: HL7 教育訓練課程教材 訊息結構與規則說明

17

Abstract Message

The data fields that will be sent within a message

The valid response messages The treatment of application

level errors or the failure of the underlying communications system

Abstract Message

dataresponses

errors

Page 18: HL7 教育訓練課程教材 訊息結構與規則說明

18

Message

An atomic unit of data transferred between systems.

A Message Type defines its domain. A Trigger Event defines the reason for the

exchange.

HL7 MessageADT MessageA01 Admit

HL7 Message

A03 DischargeADT Message

HL7 Message

A02 TransferADT Message

Page 19: HL7 教育訓練課程教材 訊息結構與規則說明

19

Message Type

A 3-character code contained within each message that identifies its type or domain.

Page 20: HL7 教育訓練課程教材 訊息結構與規則說明

20

Trigger Events and Message Types

One message type can have many different trigger event codes.

A trigger event code may not be associated withmore than onemessage type.

Page 21: HL7 教育訓練課程教材 訊息結構與規則說明

21

Message

A message is comprised of a group of segments in a defined sequence.

Page 22: HL7 教育訓練課程教材 訊息結構與規則說明

22

Segment Characteristics

Segments of a message:– are identified by a unique three

character code known as the Segment ID.

– Can be required MSH is ALWAYS required!

– May be optional [..]– May repeat {…}

Page 23: HL7 教育訓練課程教材 訊息結構與規則說明

23

Segment Groups

Logical grouping of segments containing more than one type of segment

A segment group is assigned a name that represents a permanent identifier that may not be changed.

How many groups can you identify here?– { OBR, [NTE], {OBX, [{NTE}]}}

Page 24: HL7 教育訓練課程教材 訊息結構與規則說明

24

Fields

An HL7 field is a set of characters defined by an HL7 data type. For example, marital status.PID.15 (data type CE)

|M|User Defined Table 0002

(suggested values)

Page 25: HL7 教育訓練課程教材 訊息結構與規則說明

25

Components

A field entry may also have parts called components. For example, the patient’s name has components such as – last name– first name– middle name or initial

Components may be further divided into sub-components.

Page 26: HL7 教育訓練課程教材 訊息結構與規則說明

26

HL7 CONTROL review

Framework– Trigger Event– Message– Segment– Field (Data Type)– Component– Sub-Component

Message

Segment Segment ……

Field

Component Component ……….

Field Field

Page 27: HL7 教育訓練課程教材 訊息結構與規則說明

27

Message Header (MSH) Segment

SEQ LEN DT OPT RP/# TBL# ITEM # ELEMENT NAME

1 1 ST R     00001 Field Separator

2 4 ST R     00002 Encoding Characters

3 227 HD O   0361 00003 Sending Application

4 227 HD O   0362 00004 Sending Facility

5 227 HD O   0361 00005 Receiving Application

6 227 HD O   0362 00006 Receiving Facility

7 26 TS R     00007 Date/Time Of Message

8 40 ST O     00008 Security

9 15 MSG R     00009 Message Type

10 20 ST R     00010 Message Control ID

11 3 PT R     00011 Processing ID

12 60 VID R     00012 Version ID

Page 28: HL7 教育訓練課程教材 訊息結構與規則說明

28

Message Header (MSH) Segment

SEQ LEN DT OPT RP# TBL# ITEM # ELEMENT NAME

13 15 NM O     00013 Sequence Number

14 180 ST O     00014 Continuation Pointer

15 2 ID O   0155 00015 Accept Acknowledgment Type

16 2 ID O   0155 00016 Application Acknowledgment Type

17 3 ID O   0399 00017 Country Code

18 16 ID O Y 0211 00692 Character Set

19 250 CE O     00693 Principal Language Of Message

20 20 ID O   0356 01317 Alternate Character Set Handling Scheme

21 427 EI O Y   01598 Message Profile Identifier

Page 29: HL7 教育訓練課程教材 訊息結構與規則說明

29

Field Attributes: SEQ SEQuenc

Definition: Ordinal position of the data field within the segment. This number is used to refer to the data field in the text comments that follow the segment definition table.

In the segment attribute tables this information is provided in the column labeled SEQ

Page 30: HL7 教育訓練課程教材 訊息結構與規則說明

30

Field Attributes: LEN Max LENgth

Definition: Maximum number of characters that one occurrence of the data field may occupy.– “65536” replaces 64K to express a very large field– “99999” indicates that the length may vary

Normative, but can be changed on a site specific basis

Includes components and sub-components Does not include repetitions

Page 31: HL7 教育訓練課程教材 訊息結構與規則說明

31

Field Attributes: DT Data Type

Definition: Restrictions on the contents of the data field.

In the segment attribute tables this information is provided in the column labeled DT. If the data type of the field is variable, the notation “varies” will be displayed.

There are a number of data types defined by HL7.

Page 32: HL7 教育訓練課程教材 訊息結構與規則說明

32

Field Attributes: OPT OPTionality

Definition: Whether the field is required, optional, or conditional in a segment.

The designations for optionality are:R - required

O - optional

C - conditional on trigger event or other field(s).

X - not used with this trigger event

B - left in for backward compatibility with previous versions

Page 33: HL7 教育訓練課程教材 訊息結構與規則說明

33

Field Attributes: RP# REPetition

Definition: Indicates whether the field may repeat. The designations for Repetition are:

– N or blank - no repetition– Y - the field may repeat an indefinite or site-determined number o

f times– (integer) - the field may repeat up to the number of times specifie

d by the integer

Each occurrence may contain the number of characters specified by the field’s maximum length

Page 34: HL7 教育訓練課程教材 訊息結構與規則說明

34

Field Attributes: TBL# Table Number - 1

Definition: The table attribute of the data field definition specifies the HL7 identifier for a set of coded values.

An entry in the table number column means that the table name and the element name are equivalent.

If this attribute is not valued or blank, there is not a table of values defined for the field.

Page 35: HL7 教育訓練課程教材 訊息結構與規則說明

35

Field Attributes: TBL# Table Number - 2

If more than one table is applicable, the format xxxx/yyyy

ID or IS a table number will be allocated even if, in the case of IS, there may be a notation "No Suggested values”

Page 36: HL7 教育訓練課程教材 訊息結構與規則說明

36 台灣健康資訊交換第七層協定協會 版權所有

Formatting

Page 37: HL7 教育訓練課程教材 訊息結構與規則說明

37

Encoding Rules

To determine the exact representation of an abstract message, one applies the HL7 encoding rules defined in Chapter 2 to the abstract definition from the functional chapter (example - Chapter 3, Patient Administration).

MSH|^~\&|ADTSYS|LABSYS|...HL7 MessageADT MessageA01 Admit

Page 38: HL7 教育訓練課程教材 訊息結構與規則說明

38

Example Transaction

住院病人 范士展 男性生於 10/31/1965

於 8/5/2000 12:30 PM住進了 WARD NO 8B

住院病人 范士展 男性生於 10/31/1965

於 8/5/2000 12:30 PM住進了 WARD NO 8B

MSH|^~\&|^~\&|REGAMT|MCM|NURCAR||200005081232||ADT^A01|00001|P|2.3<CR><CR>EVN|A01|200005081230||01||200005081230<CR><CR>PID|||191919^^^GENHOSP|253763| 范 ^士展 ||19651031|M|||407^台中港路 ^ISHPEMING^台中市 ^49849^””^||(900)4855344|(900)4855344||S|C|10199925<CR><CR>PV1||I|8B^06^01^某醫院 ||||0200^JONES,GEORGE|0148^ADDISON,JAMES||8B ||||||||0148^ANDERSON,CARL|||<CR><CR>

真實世界真實世界

電腦世界電腦世界

HL7 HL7 訊息參考結構訊息參考結構HL7 HL7 國際認證分析師國際認證分析師

Page 39: HL7 教育訓練課程教材 訊息結構與規則說明

39

Message Delimiters

In a message certain encoding characters delimit the constructs. – The Segment Terminator– The Field Separator– The Component Separator– The Sub-Component Separator– The Repetition Character– The Escape Character.

^|

&~\

<CR>

Page 40: HL7 教育訓練課程教材 訊息結構與規則說明

40

Selection of Delimiters

The Encoding Characters are specified immediately following the segment ID in the MSH Segment.

With the exception of the segment terminator, delimiter values are at the discretion of the sender.

Most senders use the suggested values.

MSH|^~\&|...

Page 41: HL7 教育訓練課程教材 訊息結構與規則說明

41

Field Separator

The HL7 field separator marks the beginning of a data field within an HL7 segment.

It always follows the segment ID to indicate the first data field in the segment.

EVN|A04|200502082159|||SJT3C<CR>

|

Page 42: HL7 教育訓練課程教材 訊息結構與規則說明

42

Component Separator

Used to separate adjacent components within a field.

The data type defines whether a field has components.

^|Anderson^Hans^Christian|

Page 43: HL7 教育訓練課程教材 訊息結構與規則說明

43

Repetition Separator

Used to separate occurrences of a repeating field. The “repetitions” are of a common structure (like

rows in a database) defined by the data type. The content of each repetition may be (and usually is) different.

|.61^RUL^ACR~.212^Bronchopneumonia^ACR|~

Page 44: HL7 教育訓練課程教材 訊息結構與規則說明

44

Subcomponent Separator

Used to separate adjacent subcomponents. The data type defines whether the components of

a field have subcomponents. When a component of a data type is itself a data

type with components, its parts will be expressed as subcomponents of the full data type.

&|2E^215^B^General Hospital&123.11.154.1.8&ISO|

Page 45: HL7 教育訓練課程教材 訊息結構與規則說明

45

Escape Character

Used in alphanumeric fields defined by data types ST, TX or FT

Used for highlighting Used to escape the other delimiters Used for hex character representation Must both precede and follow the character(s)

being escaped \

\H\Low\N\\T\

\X0FA3\

Page 46: HL7 教育訓練課程教材 訊息結構與規則說明

46

Escape Sequences

Code Meaning \ H\ Start Highlighting \ N\ Normal Text (end highlighting) \ F\ Field Separator \ S\ Component Separator \ R\ \ T\

Repetition Separator Subcomponent Separator

\ E\ Escape Character \ Xdddd\ Hexadecimal data \ Zdddd\ \ Cxxxx\

Locally Defined Escape Sequence Character Set Escape Sequenced

\ . xxx\ Text format (FT data type only)

Page 47: HL7 教育訓練課程教材 訊息結構與規則說明

47

Segment Terminator

Is the last character of EVERY segment.

Is ALWAYS the ASCII CR character (hex 0D).

Is NEVER omitted.

Can NEVER be changed. OBX||CE|organism^413^L|1|^E. Coli||||||F<CR>

<CR>

Page 48: HL7 教育訓練課程教材 訊息結構與規則說明

48

Sending Rules 1/4For Encoding HL7 Messages

Encode each segment in the order specified in the abstract message formatThe segment ID is required to identify the segment

Precede each data field with the field separator

Admit MessageMSHEVNPID[ { PD1 } ][ { ROL } ][ { NK1 } ]PV1[ PV2 ][ { ROL } ][ { DB1 } ][ { OBX } ][ { AL1 } ][ { DG1 } ][ DRG ][ { PR1 [ { ROL } ]} ][ { GT1 } ][ { IN1 [ IN2 ] [ { IN3 } ] [ { ROL } ]} ][ ACC ][ UB1 ][ UB2 ][ PDA ]

PID|||2-68708-5|253763|COX^JAMES...

Page 49: HL7 教育訓練課程教材 訊息結構與規則說明

49

Sending Rules 2/4For Encoding HL7 Messages

Data fields ‘present but null’ are encoded with ”” (double quotes)

Data fields that are ‘not present’ require no characters

Encode the data fields in the order specified in the segment definition table

PID attributesSq Ln DT O # Tbl Item Element Name1 4 SI 00104 Set ID - Patient2 20 CX B 00105 Patient ID3 250 CX R Y 00106 Patient Identifier4 20 CX B Y 00107 Alternate Patient5 250 XPN R 00108 Patient Name6 250 XPN O Y 00109 Mother’s Maide

PID|||2-68708||COX^JAMES|””|...

Page 50: HL7 教育訓練課程教材 訊息結構與規則說明

50

Sending Rules 3/4For Encoding HL7 Messages

If components, subcomponents, or repetitions at the end of a data field are ‘not present’, their separators may be omitted

If no more fields are present in a segment, the data field separators may be omitted

|Anderson^Hans^Christian^^^| |Anderson^Hans^Christian|

PID|...|Last Field||||||||<CR> PID|...|Last Field<CR>

Padding doesn’t violate the rules, it’s just not good practice!

Page 51: HL7 教育訓練課程教材 訊息結構與規則說明

51

Sending Rules 4/4For Encoding HL7 Messages

End each segment with the REQUIRED segment terminator

PID|...|Last Field<CR>

Page 52: HL7 教育訓練課程教材 訊息結構與規則說明

52

Receiving Rules 1For Decoding HL7 Messages

Rule 1: Ignore the unexpected

Rule 2: If it’s not there, assume it’s not present.

Page 53: HL7 教育訓練課程教材 訊息結構與規則說明

53

Receiving Rule 1 2Ignore the unexpected

Ignore segments, fields, components, subcomponents, and repetitions of a field that are present but not expected.

SEG|A|B|C|New1|New2|New3<CR>

Page 54: HL7 教育訓練課程教材 訊息結構與規則說明

54

Receiving Rule 2 3Not there = Not present

Treat segments that were expected but are not present as consisting entirely of fields that are not present.

– Example: If the PR1 procedure segment is not sent on a discharge, assume that procedure info is not present - do NOT assume it’s NULL.

Treat fields and components that are expected but were not included in a segment as not present.

– DON’T break the interface– DO return an ERR segment in the acknowledgment message for

each required field that is missing

Page 55: HL7 教育訓練課程教材 訊息結構與規則說明

55

Backwards Compatibility (2.x)What the HL7 Standard Can Do

New messages may be introduced in subsequent versions. New segments may be introduced and placed anywhere in an

existing message structure in subsequent versions. In subsequent versions new F/C/S/R - can only be introduced

at the end of a segment, field, component, or repetition list. Data types can only be extended in subsequent versions by

adding components to the end. Non-repeating field can become repeating, but first repetition

meaning should remain the same. “Retained for backwards compatibility only” designates

fields no longer recommended for use, but retained as place holders. These fields may need to be valued to support prior versions.

Page 56: HL7 教育訓練課程教材 訊息結構與規則說明

56

How would you encode the following in an HL7 message?

Outpatient Registration (Patient Class - O):Patient Name: Alice E. Smith.MRN: 123456, Assigning Authority “ABC”Address:

123 Meridian Street(street address 2 deleted)Philadelphia, PA 19345-1012

County Code: 12Primary Home Phone: (215) 783-1010Secondary Home Phone: (215) 393-2100Allergy Description: “Cheap Cologne”Allergies on record: Cologne

Penicillin

This suggests

?

Page 57: HL7 教育訓練課程教材 訊息結構與規則說明

57

Finish the Message:

MSH|^~\&|ADT|MF|ADT|HL7SYS|200511150013||ADT^A04^ADT_A04|1289337|P|2.5<CR>

EVN|A04|200511150013<CR>

Page 58: HL7 教育訓練課程教材 訊息結構與規則說明

58

Possible Answer:

MSH|^~\&|ADT|MF|ADT|HL7SYS|200511150013||ADT^A04^ADT_A04|128933718|P|2.5<CR>

EVN|A04|200511150013<CR>PID|||123456^^^ABC||Smith^Alice^E||||||123 Meridian Street^””^Philadelphia^PA^19345-1012^^^^12||(215)783-1010~(215)393-2100<CR>

PV1||O<CR>AL1|1||^Cologne<CR>AL1|2||^Penicillin<CR>AL1|3||^Cheap Cologne<CR>

Page 59: HL7 教育訓練課程教材 訊息結構與規則說明

59

Apply to receiving system

MessageMSHEVNPID

[ { NK1 } ]PV1

[ { AL1 } ]

PATIENT DEMOGRAPHICS:Name: Dr. Alice Smythe MRN: 123456DOB: 10/10/1962Address: 456 John Street

Apt. 6B Philadelphia, PA 19202Phone: (215) 243-1234NEXT OF KIN:Name: Jeff Smith Relationship: SpouseALLERGIES: cologne

penicillin

Page 60: HL7 教育訓練課程教材 訊息結構與規則說明

60

Possible Answer

MessageMSHEVNPID

[ { NK1 } ]PV1

[ { AL1 } ]

PATIENT DEMOGRAPHICS:Name: Dr. Alice E. Smith MRN: 123456DOB: 10/10/1962Address: 123 Meridian Street

Philadelphia, PA 19345-1012Phone: (215) 783-1010

(215) 393-2100NEXT OF KIN:Name: Jeff Smith Relationship: SpouseALLERGIES: Cologne

PenicillinCheap Cologne

Page 61: HL7 教育訓練課程教材 訊息結構與規則說明

61 台灣健康資訊交換第七層協定協會 版權所有

Processing Rules

Page 62: HL7 教育訓練課程教材 訊息結構與規則說明

62

Acknowledgment of Messages

Original Mode– Application Level

Acknowledgements– Version 2.1

Enhanced Mode– Accept and Application

Level Acknowledgements– Version 2.2+

ACK!

Page 63: HL7 教育訓練課程教材 訊息結構與規則說明

63

Original Acknowledgment

Original Mode (only mode in V2.1)– Application acknowledgment only

System A

1. ORM message

System B2. ORR message

Application ACK

Page 64: HL7 教育訓練課程教材 訊息結構與規則說明

64

Enhanced Acknowledgment

Enhanced Mode (available in V2.2 and later)– Allows accept/commit and application acknowledgments

System B

3. ORR (optional)

(Application ACK)

2. Accept ACK

System A

1. ORM message

(optional)

(optional)

4. Accept ACK

Page 65: HL7 教育訓練課程教材 訊息結構與規則說明

65

Original Acknowledgement

Receiver gets message:– Sends a reject message if it fails syntactically– Otherwise the message is passed to the application

which creates either an: accept response (the good) reject response (the bad) reject with error response (the ugly)

– Response message is sent back to the initiating application

Page 66: HL7 教育訓練課程教材 訊息結構與規則說明

66

Original Syntactic Validation

The value in MSH-9 (message type) is acceptable to the receiving system.

The value in MSH-12 (version ID) is acceptable to the receiving system.

The value in MSH-11 (processing ID) is appropriate for the applicationprocess handling the message. HL7 Message

ACK MessageMSA|AR|...

Page 67: HL7 教育訓練課程教材 訊息結構與規則說明

67

ACKGeneral Acknowledgement Message

Used to respond to a message when– the application does not define a special message type

(example ORR) for the response or

– there has been an error that precludes application processing.

All acknowledgements contain MSH and MSA segments. ACK Message

MSHMSA[ERR]

Page 68: HL7 教育訓練課程教材 訊息結構與規則說明

68

Original Mode Responses

Processed successfully (AA)

Process failure (reject) unrelated to content or format (AR)

Reject with Error response (AE)

HL7 MessageACK MessageMSA|AA|...

HL7 MessageACK MessageMSA|AE|...

HL7 MessageACK MessageMSA|AR|...

Page 69: HL7 教育訓練課程教材 訊息結構與規則說明

69

MSA Segment

MSA 1-Acknowledgment Code: <AA|AR|AE>

Page 70: HL7 教育訓練課程教材 訊息結構與規則說明

70

Acknowledgement Processing

Page 71: HL7 教育訓練課程教材 訊息結構與規則說明

71

Enhanced Acknowledgement

Supports two levels of acknowledgement1. Accept Level

2. Application Level

Page 72: HL7 教育訓練課程教材 訊息結構與規則說明

72

1. Accept Level

The receiving system commits the message to safe storage in a manner that releases the sending system from any obligation to resend the message.

A response is returned to the sender indicating successful receipt and secure storage of the message.

Page 73: HL7 教育訓練課程教材 訊息結構與規則說明

73

2. Application Level

The appropriate application on the receiving system accepts and processes the transaction.

The receiving system returns an application-dependent response to the sender.

Page 74: HL7 教育訓練課程教材 訊息結構與規則說明

74

Acknowledgement Types

MSH-15-Accept Acknowledgement Type

MSH-16-Application Acknowledgement Type

Data Type is ID

Table # is 155Table 155AL - AlwaysNE - NeverER - Error/Reject Conditions OnlySU - Successful Completion Only

Page 75: HL7 教育訓練課程教材 訊息結構與規則說明

75

MSH

Page 76: HL7 教育訓練課程教材 訊息結構與規則說明

Special Protocols

Page 77: HL7 教育訓練課程教材 訊息結構與規則說明

77

Sequence Number Protocol:When keeping data bases synchronized is critical

Normal acknowledgement protocol prevents out of sequence transactions

BUT… Only sequence number processing prevents

duplicate transactions.

1 23

4 5 67 8

Page 78: HL7 教育訓練課程教材 訊息結構與規則說明

78

I send One; You get One

I’m at one. You’re at one. Sender increments the sequence number, receiver echoes it back.

Restarting the Link (Where was I?) Sender wants to start up where it left off; asks receiver for next expected sequence number.

Re-synchronizing the link! Sender wants to restart with an arbitrary number - tells receiver to forget expected sequence number and reset counter with next sequence number sent.

Page 79: HL7 教育訓練課程教材 訊息結構與規則說明

79

Normal Operation

Sender increments the sequence number Receiver echoes it back

Sending sequence 7 Got sequence 7

Page 80: HL7 教育訓練課程教材 訊息結構與規則說明

80

Starting/Restarting the Link

Sender uses sequence number 0 to start or restart the link. The receiving system returns a general acknowledgment

message with a sequence number one greater than the last received successfully.

If the link is starting for the first time, the receiving system returns a sequence of -1 meaning: I’ll accept the next positive integer sequence number as the starting sequence.

I say 0 I’m expecting 8

Page 81: HL7 教育訓練課程教材 訊息結構與規則說明

81

Forcing Synchronization

A sequence number of -1 is sent when the initiating system wishes to synchronize the link.

The receiving system will return a general acknowledgment message with a -1 in the expected sequence number field.

The receiving system will reset its sequence number to the sequence number of the next transaction it receives.

Let’s reset the sequence number!

You’re the Boss.

Page 82: HL7 教育訓練課程教材 訊息結構與規則說明

82

Normal Operation of the Link

MSH|^~\&|NeoReg|MGH|Lab-R-Us|MGH|200412312359||ADT^A01|NR12345|P|2.3.1|4321||AL|NE|<CR>

MSH|^~\&|Labs-R-Us|MGH|NeoReg|MGH|200501010001||ACK^A01|ZZ4364|P|2.3.1<CR>

MSA|AA|NR12345|4321<CR>

Page 83: HL7 教育訓練課程教材 訊息結構與規則說明

83

Starting/Restarting the Link

MSH|^~\&|NeoReg|MGH|Lab-R-Us|MGH|200503141325|||NR22346|P|2.3.1|0<CR>

MSH|^~\&|Labs-R-Us|MGH|NeoReg|MGH|200503141325||ACK^|ZZ6365|P|2.3.1<CR>

MSA|AA|NR22346|4322<CR>

Page 84: HL7 教育訓練課程教材 訊息結構與規則說明

84

Re-synchronizing the Link

MSH|^~\&|NeoReg|MGH|Lab-R-Us|MGH|200504010001|||NR22646|P|2.3.1|-1<CR>

MSH|^~\&|Labs-R-Us|MGH|NeoReg|MGH|200504010001||ACK^|ZZ6665|P|2.3.1<CR>

MSA|AA|NR22646|-1<CR>

Page 85: HL7 教育訓練課程教材 訊息結構與規則說明

85

HL7 Continuation Protocol

A protocol for breaking long messages into a series of transactions.

DSC: Continuation Pointer Segment– Message fragmentation; breaks the message on

segment boundary.

ADD:Addendum Segment– Segment Fragmentation; breaks the message on field

boundary within a segment.

For Unsolicited Updates and Queries

Page 86: HL7 教育訓練課程教材 訊息結構與規則說明

86

Use DSC for Message Fragmentation

MSH|… (no CP)

PID|…PV1|…ORC|…OBR|…OBX|…OBX|…DSC|CP1

MSH|… CP1…

OBX|…OBX|…OBX|…DSC |CP2

MSH|… CP2…

OBX|…OBX|…(no DSC)

CP is MSH-14 Continuation Pointer

DSC-1 Continuation Pointer

Page 87: HL7 教育訓練課程教材 訊息結構與規則說明

87

Use ADD for Segment Fragmentation

MSH|… (no CP)

PID|…PV1|…ORC|…OBR|…OBX|…OBX|…|This is a very very very veryADDDSC|CP1

MSH|… CP1…ADD|very long segmentOBX|…OBX|…OBX|…DSC|CP2

MSH|… CP2…OBX|…OBX|…(no DSC)

Page 88: HL7 教育訓練課程教材 訊息結構與規則說明

88

HL7 Batch Protocol

To transfer a batch of HL7 messages Example: Charges sent from an ancillary system

to a billing system. [FHS] (file header segment)

{ --- BATCH begin

[BHS] (batch header segment)

{ [ --- MESSAGE begin

MSH (zero or more HL7 messages)

....  

....  

....  

] } --- MESSAGE end

[BTS] (batch trailer segment)

} --- Batch end

[FTS] (file trailer segment)

Page 89: HL7 教育訓練課程教材 訊息結構與規則說明

89

Updating Repetitions

Snapshot mode– Sender always sends all repetitions– Receiver deletes all existing repetitions and replaces with new list

of repetitions.– Primarily relevant to: IN1, NK1, DG1, PR1, AL1

Action Code/Unique Key– Sender sends each changed repetition with a unique id and with

an action code (add, update, delete, etc.).– Receiver finds each repetition using the unique key and applies

the appropriate action

Page 90: HL7 教育訓練課程教材 訊息結構與規則說明

90

When the standard is not enough…

Locally defined – Message Types– Segments– Trigger Events– Escape Sequences

All must begin with ‘Z’.

The Big

ZDon’t use as a substitute for reading

the specification

Page 91: HL7 教育訓練課程教材 訊息結構與規則說明

91

Z Message

Messages may be locally extended as follows: – Users may develop local Z messages to cover areas not already covered

by existing HL7 messages. These should be composed of HL7 segments where possible.

– A local Z message may consist entirely of Z segments except that it must begin with a MSH segment.

– A local Z Acknowledgement message must begin with an MSH segment followed by an MSA segment, an optional SFT segment and a conditional ERR segment.

– Users may develop Z segments and add them to Z messages. – Users may develop Z segments and add them to HL7 messages. The

trigger event may remain the same if the intent of the message has remained unchanged.

– The practice of adding additional HL7 segments, like NTE, to existing HL7 messages locally is ill-advised. HL7 may move or change the segment in a future release; this will render the message unparsible.

Page 92: HL7 教育訓練課程教材 訊息結構與規則說明

92 台灣健康資訊交換第七層協定協會 版權所有

感謝聆聽 HL7 教育訓練課程教材─訊息結構與規則說明

下一場: HL7 資料型態