Skip to main content

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

NameTypeDescription
segmentsHl7Segment[]The HL7 segments.
contextHl7ContextOptional HL7 parsing context.

Defined in

packages/core/src/hl7.ts:53

Properties

context

Readonly context: Hl7Context

Defined in

packages/core/src/hl7.ts:45


segments

Readonly segments: Hl7Segment[]

Defined in

packages/core/src/hl7.ts:46

Methods

get

get(index): undefined | Hl7Segment

Returns an HL7 segment by index or by name.

Parameters

NameTypeDescription
indexstring | numberThe HL7 segment index or name.

Returns

undefined | Hl7Segment

The HL7 segment if found; otherwise, undefined.

Defined in

packages/core/src/hl7.ts:63


getAll

getAll(name): Hl7Segment[]

Returns all HL7 segments of a given name.

Parameters

NameTypeDescription
namestringThe HL7 segment name.

Returns

Hl7Segment[]

An array of HL7 segments with the specified name.

Defined in

packages/core/src/hl7.ts:75


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:83


buildAck

buildAck(): Hl7Message

Returns an HL7 "ACK" (acknowledgement) message for this message.

Returns

Hl7Message

The HL7 "ACK" message.

Defined in

packages/core/src/hl7.ts:91


parse

Static parse(text): Hl7Message

Parses an HL7 message string into an Hl7Message object.

Parameters

NameTypeDescription
textstringThe HL7 message text.

Returns

Hl7Message

The parsed HL7 message.

Defined in

packages/core/src/hl7.ts:128