core.hl7message
Home > @medplum/core > Hl7Message
Hl7Message class
The Hl7Message class represents one HL7 message. A message is a collection of segments.
Signature:
export declare class Hl7Message
Constructors
Constructor | Modifiers | Description |
|---|---|---|
Creates a new HL7 message. Segment strings are not parsed until they are accessed via Hl7Message.getSegment(), Hl7Message.getAllSegments(), Hl7Message.header, or the Hl7Message.segments getter. |
Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
| |||
| Returns the HL7 message header. | ||
| Returns all HL7 segments, parsing any unparsed segment strings on first access. Prefer Hl7Message.getSegment() or Hl7Message.getAllSegments() when you only need a subset of segments; those methods avoid parsing unrelated segments. |
Methods
Method | Modifiers | Description |
|---|---|---|
Returns an HL7 "ACK" (acknowledgement) message for this message. | ||
Returns an HL7 segment by index or by name. | ||
Returns all HL7 segments of a given name. | ||
Returns all HL7 segments of a given name. Only the segments that match the requested name are parsed, which avoids parsing unrelated segments when scanning a message. | ||
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. Segments are lazily parsed; the requested segment is parsed and cached on demand. | ||
| Parses an HL7 message string into an Hl7Message object. | |
Sets or replaces a segment at the specified index. Only allows MSH header to be replaced as first segment. If index is a number and is larger than the length of the segments array, it will be appended as the last segment. If the index is a string, replaces the first segment with that name. | ||
Returns the HL7 message as a string. Unparsed segments are emitted directly from their original string form, which preserves the source text without forcing a parse. |