Message Class

1.0.0

Hierarchy

  • RootBase
    • Message

Constructors

  • Build the Message or Parse It

    Returns Message

    1.0.0

    If you are processing a full message, do this:

    const message = new Message({text: "The HL7 Message Here"})
    ... output cut ...

    If you are building out a message, do this:

    const message = new Message({messageHeader: { ... MSH Header Required Values Here ... }});

    which then you add segments with fields and values for your Hl7 message.

Properties

_name: string
parent: null | NodeBase
empty: EmptyNode = ...

Accessors

Methods

  • Add a new segment to a message.

    Parameters

    • path: string

    Returns Segment

    1.0.0

    Creating a new segment adds an empty segment to the message. It could be blank, or it could have values added into it.

    const message = new Message({. the correct options here .})

    const segment = message.addSegment('PV1')
    segment.set('PV1.1', 'Value Here');

    // When doing this, it overall adds it to the 'message' object
    // when your output is the final result.

    const finalMessage = message.toString();
  • Protected

    Create a new child of a message which is a segment.

    Parameters

    • text: string

      Segment string. Must be 3 characters long.

    • _index: number

      Not used to create a segment.

    Returns HL7Node

  • Protected

    Path Core

    Returns string[]

    1.0.0

  • Create File from a Message

    Parameters

    • name: string

      File Name

    • OptionalnewLine: boolean

      Provide a New Line

    • Optionallocation: string

      Where to save the exported file

    • extension: string = "hl7"

      Custom extension of the file. Default: hl7

    Returns string

    Will procure a file of the saved MSH in the proper format that includes a FHS and FTS segments.

    1.0.0

    const message = new Message({text: hl7_batch_string})
    message.toFile('readTestMSH', true, 'temp/')

    You can set an extension parameter on Batch to set a custom extension if you don't want to be HL7.