This is a simple PHP library that allows you to parse an HL7 message into a PHP array, following the HL7 standard. It allows you to easily parse and access the different segments and fields of an HL7 message.
-
Copy the
SRCdirectory include the autoloader. -
Pass an HL7 message to the
parseHL7Messagefunction:$hl7Message = 'Your HL7 message goes here'; $parsedData = parseHL7Message($hl7Message);
Replace
'Your HL7 message goes here'with the actual HL7 message you want to convert. -
Access the parsed data using the segment and field indexes:
$segment = 'PID'; $field = 'F5'; $pid5_1 = $parsedData['get']($segment, $field)['C1'];
Replace
$segmentand$fieldwith the desired segment and field indexes. -
Use the
$parsedDataarray to retrieve the necessary values from the HL7 message. -
check out the test file for more information, this is more for my own notes than a project.
@author: Gavin R. Nesmith grnesmith@gmail.com
This project is licensed under the Apache License 2.0.