Skip to content

Latest commit

 

History

History
747 lines (358 loc) · 8.54 KB

MSH.md

File metadata and controls

747 lines (358 loc) · 8.54 KB

Aranyasen\HL7\Segments\MSH

MSH (message header) segment class

Usage:

$seg = new MSH();

$seg->setField(9, "ADT^A24");
echo $seg->getField(1);

The MSH is an implementation of the Segment class. The MSH segment is a bit different from other segments, in that the first field is the field separator after the segment name. Other fields thus start counting from 2! The setting for the field separator for a whole message can be changed by the setField method on index 1 of the MSH for that message. The MSH segment also contains the default settings for field 2, COMPONENT_SEPARATOR, REPETITION_SEPARATOR, ESCAPE_CHARACTER and SUBCOMPONENT_SEPARATOR. These fields default to ^, ~, \ and & respectively.

Reference: https://corepointhealth.com/resource-center/hl7-resources/hl7-msh-message-header

Extend:

Aranyasen\HL7\Segment

Methods

Name Description
getDateTimeOfMessage
getMessageControlId
getMessageType ORM / ORU etc.
getProcessingId
getReceivingApplication
getReceivingFacility
getSendingApplication
getSendingFacility
getTriggerEvent
getVersionId Get HL7 version, e.g. 2.1, 2.3, 3.0 etc.
setAcceptAcknowledgementType
setApplicationAcknowledgementType
setCharacterSet
setContinuationPointer
setCountryCode
setDateTimeOfMessage
setMessageControlId
setMessageType Sets message type to MSH segment.
setPrincipalLanguage
setProcessingId
setReceivingApplication
setReceivingFacility
setSecurity
setSendingApplication
setSendingFacility
setSequenceNumber
setTriggerEvent Sets trigger event to MSH segment.
setVersionId

Inherited methods

Name Description
__construct Create a segment.
getField Get the field at index.
getFields Get fields from a segment
getName Get the name of the segment. This is basically the value at index 0
setField Set the field specified by index to value.
size Get the number of fields for this segment, not including the name

MSH::getDateTimeOfMessage

Description

public getDateTimeOfMessage (void)

Parameters

This function has no parameters.

Return Values

void


MSH::getMessageControlId

Description

public getMessageControlId (void)

Parameters

This function has no parameters.

Return Values

void


MSH::getMessageType

Description

public getMessageType (int $position)

ORM / ORU etc.

Parameters

  • (int) $position

Return Values

string


MSH::getProcessingId

Description

public getProcessingId (void)

Parameters

This function has no parameters.

Return Values

void


MSH::getReceivingApplication

Description

public getReceivingApplication (void)

Parameters

This function has no parameters.

Return Values

void


MSH::getReceivingFacility

Description

public getReceivingFacility (void)

Parameters

This function has no parameters.

Return Values

void


MSH::getSendingApplication

Description

public getSendingApplication (void)

Parameters

This function has no parameters.

Return Values

void


MSH::getSendingFacility

Description

public getSendingFacility (void)

Parameters

This function has no parameters.

Return Values

void


MSH::getTriggerEvent

Description

public getTriggerEvent (void)

Parameters

This function has no parameters.

Return Values

void


MSH::getVersionId

Description

public getVersionId (int $position)

Get HL7 version, e.g. 2.1, 2.3, 3.0 etc.

Parameters

  • (int) $position

Return Values

array|null|string


MSH::setAcceptAcknowledgementType

Description

public setAcceptAcknowledgementType (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setApplicationAcknowledgementType

Description

public setApplicationAcknowledgementType (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setCharacterSet

Description

public setCharacterSet (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setContinuationPointer

Description

public setContinuationPointer (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setCountryCode

Description

public setCountryCode (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setDateTimeOfMessage

Description

public setDateTimeOfMessage (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setMessageControlId

Description

public setMessageControlId (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setMessageType

Description

public setMessageType (string $value, int $position)

Sets message type to MSH segment.

If trigger event is already set, then it is preserved

Example:

If field value is ORU^R01 and you call

$msh->setMessageType('ORM');  

Then the new field value will be ORM^R01.
If it was empty then the new value will be just ORM.

Parameters

  • (string) $value
  • (int) $position

Return Values

bool


MSH::setPrincipalLanguage

Description

public setPrincipalLanguage (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setProcessingId

Description

public setProcessingId (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setReceivingApplication

Description

public setReceivingApplication (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setReceivingFacility

Description

public setReceivingFacility (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setSecurity

Description

public setSecurity (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setSendingApplication

Description

public setSendingApplication (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setSendingFacility

Description

public setSendingFacility (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setSequenceNumber

Description

public setSequenceNumber (void)

Parameters

This function has no parameters.

Return Values

void


MSH::setTriggerEvent

Description

public setTriggerEvent (string $value, int $position)

Sets trigger event to MSH segment.

If meessage type is already set, then it is preserved

Example:

If field value is ORU^R01 and you call

$msh->setTriggerEvent('R30');  

Then the new field value will be ORU^R30.
If trigger event was not set then it will set the new value.

Parameters

  • (string) $value
  • (int) $position

Return Values

bool


MSH::setVersionId

Description

public setVersionId (void)

Parameters

This function has no parameters.

Return Values

void