Class: Hl7Message
The Hl7Message class represents one HL7 message. A message is a collection of segments.
Constructors
constructor
• new Hl7Message(segments
, context?
)
Creates a new HL7 message.
Parameters
Name | Type | Description |
---|---|---|
segments | Hl7Segment [] | The HL7 segments. |
context | Hl7Context | Optional HL7 parsing context. |
Defined in
packages/core/src/hl7.ts:55
Properties
context
• Readonly
context: Hl7Context
Defined in
packages/core/src/hl7.ts:47
segments
• Readonly
segments: Hl7Segment
[]
Defined in
packages/core/src/hl7.ts:48
Accessors
header
• get
header(): Hl7Segment
Returns the HL7 message header.
Returns
The HL7 message header.
Defined in
packages/core/src/hl7.ts:64
Methods
get
▸ get(index
): undefined
| Hl7Segment
Returns an HL7 segment by index or by name.
Parameters
Name | Type | Description |
---|---|---|
index | string | number | The HL7 segment index or name. |
Returns
undefined
| Hl7Segment
The HL7 segment if found; otherwise, undefined.
Deprecated
Use getSegment() instead. This method will be removed in a future release.
Defined in
packages/core/src/hl7.ts:74
getAll
▸ getAll(name
): Hl7Segment
[]
Returns all HL7 segments of a given name.
Parameters
Name | Type | Description |
---|---|---|
name | string | The HL7 segment name. |
Returns
An array of HL7 segments with the specified name.
Deprecated
Use getAllSegments() instead. This method will be removed in a future release.
Defined in
packages/core/src/hl7.ts:84
getSegment
▸ getSegment(index
): undefined
| Hl7Segment
Returns an HL7 segment by index or by name.
When using a numeric index, the first segment (usually the MSH header segment) is at index 0.
When using a string index, this method returns the first segment with the specified name.
Parameters
Name | Type | Description |
---|---|---|
index | string | number | The HL7 segment index or name. |
Returns
undefined
| Hl7Segment
The HL7 segment if found; otherwise, undefined.
Defined in
packages/core/src/hl7.ts:98
getAllSegments
▸ getAllSegments(name
): Hl7Segment
[]
Returns all HL7 segments of a given name.
Parameters
Name | Type | Description |
---|---|---|
name | string | The HL7 segment name. |
Returns
An array of HL7 segments with the specified name.
Defined in
packages/core/src/hl7.ts:110
toString
▸ toString(): string
Returns the HL7 message as a string.
Returns
string
The HL7 message as a string.
Defined in
packages/core/src/hl7.ts:118
buildAck
▸ buildAck(): Hl7Message
Returns an HL7 "ACK" (acknowledgement) message for this message.
Returns
The HL7 "ACK" message.
Defined in
packages/core/src/hl7.ts:126
parse
▸ Static
parse(text
): Hl7Message
Parses an HL7 message string into an Hl7Message object.
Parameters
Name | Type | Description |
---|---|---|
text | string | The HL7 message text. |
Returns
The parsed HL7 message.
Defined in
packages/core/src/hl7.ts:182