Fixes for restoreSession logic. (#4378)
[openemr.git] / controllers / C_Hl7.class.php
blob75e109c5f94308a2dc8650891d64364e900b8a3a
1 <?php
3 class C_Hl7 extends Controller
6 function __construct($template_mod = "general")
8 parent::__construct();
9 $this->template_mod = $template_mod;
10 $this->assign("STYLE", $GLOBALS['style']);
13 function default_action()
15 return $this->fetch($GLOBALS['template_dir'] . "hl7/" . $this->template_mod . "_parse.html");
17 function default_action_process()
19 $msg = '';
20 if ($_POST['process'] == "true") {
21 $msg = $_POST['hl7data'];
24 $hp = new Parser_HL7v2($msg);
25 $err = $hp->parse();
26 //print_r($hp);
27 if (!empty($err)) {
28 $this->assign("hl7_message_err", nl2br("Error:<br />" . $err));
31 $this->assign("hl7_array", $hp->composite_array());
32 return;
37 //sample HL7 message used for testing
38 /*$msg = <<<EOF
39 MSH|^~\&|ADT1|CUH|LABADT|CUH|198808181127|SECURITY|ADT^A01|MSG00001|P|2.3|
40 EVN|A01|198808181122||
41 PID|||PATID1234^5^M11||RYAN^HENRY^P||19610615|M||C|1200 N ELM STREET^^GREENSBORO^NC^27401-1020|GL|(919)379-1212|(919)271-3434 ||S||PATID12345001^2^M10|123456789|987654^NC|
42 NK1|JOHNSON^JOAN^K|WIFE||||||NK^NEXT OF KIN
43 PV1|1|I|2000^2053^01||||004777^FISHER^BEN^J.|||SUR||||ADM|A0|
44 EOF;
45 $hp = new Parser_HL7v2($msg);
46 print_r($hp->MSH);
47 echo "<br /><br />";
48 print_r($hp->EVN);*/