An Iintroduction to the HL7Query Segments Currently Used in the Module

This document lists the hl7 message types / segments currently supported by the hl7query module, and what data they represent.

The hl7query module supports ORUR01 messages by default.

The default message structure constains the following message segments.

  • MSH
  • PID
  • PV1
  • OBR
  • OBX

The MSH segment

The MSH (Message Header) segment is present in every HL7 message type and defines the message’s source, purpose, destination, and certain syntax specifics like delimiters (separator characters) and character sets. It is always the first segment in the HL7 message, with the only exception being HL7 batch messages.
This segment contains many fields which must be configured immidiately after installation.
For a more detailed description of what each segment represents, see here.

The PID segment

The PID segment contains 30 different fields with values ranging from patient ID number, to patient sex, to address, to marital status, to citizenship. The PID segment provides important identification information about the patient.
For a more detailed description of what each segments represents, see here.

The PV1 segment

The PV1 segment contains information on patient visits.
For a more detailed description of what each segment represents, see here.

The OBR segment

The OBR segment is used to represent an OpenMRS Encounter.
For a more detailed description of what each segment represents, see here.

The OBX segment

The OBX segment is used to carry key clinical observation/results reporting information within report messages. It is used to represent an OpenMRS Observation object.
For a more detailed description of what each segment represents, see here.

Returning a single encounter object

The hl7 message will contain an OBR segment representing each obs group, and an OBX segment representing each Observation.

Therefore, an hl7 message representing an encounter with two obs groups will contain two OBR segments. However, in the event that the Observations are NOT grouped, then the message contains a 'blank' OBR segment, which indicates that the Observations are not grouped.

Returning multiple encounters as a single hl7 message

In the event that the request results in multiple encounters, each encounter will be represented by a single Patient result segment. This means multiple PID, PV1, OBR and OBX segments. However, the message can always have one and one MSh segment only.

For a sample message structure containing two encounters, see here