forked from Pharma-Intelligence/HL7
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
23 lines (20 loc) · 709 Bytes
/
index.php
File metadata and controls
23 lines (20 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
use PharmaIntelligence\HL7\Unserializer;
include_once 'autoload.php';
$file = 'Resources/orm.txt';
$testHl7 = file_get_contents($file);
// file_put_contents($file, str_replace(chr(10), chr(13), $testHl7));
// return;
$unserializer = new Unserializer();
$map = array(
'MSH' => '\PharmaIntelligence\HL7\Node\Segment\MSHSegment'
);
$message = $unserializer->loadMessageFromString($testHl7, $map);
foreach($message->getSegmentsByName('MSH') as $msh) {
echo $msh->getSendingApplication().PHP_EOL;
echo $msh->getDateTimeOfMessage()->format('d-m-Y H:i:s').PHP_EOL;
echo $msh->getMessageType().PHP_EOL;
}
return;
$message->setEscapeSequences(array('cursor_return' => PHP_EOL));
echo $message;