updated user manual wiki page link for future 4.1.2
[openemr.git] / controllers / C_Hl7.class.php
blob3b265a68cc521c3116d3c1937f44fdc203fd4d10
1 <?php
3 require_once ($GLOBALS['fileroot'] . "/library/classes/Controller.class.php");
4 require_once($GLOBALS['fileroot'] ."/library/classes/Pharmacy.class.php");
5 include_once ($GLOBALS['fileroot'] ."/library/classes/class.Parser_HL7v2.php");
7 class C_Hl7 extends Controller {
9 function C_Hl7($template_mod = "general") {
10 parent::Controller();
11 $this->template_mod = $template_mod;
12 $this->assign("STYLE", $GLOBALS['style']);
15 function default_action() {
16 return $this->fetch($GLOBALS['template_dir'] . "hl7/" . $this->template_mod . "_parse.html");
18 function default_action_process() {
19 $msg = '';
20 if ($_POST['process'] == "true") {
21 $msg = $_POST['hl7data'];
23 $hp = new Parser_HL7v2($msg);
24 $err = $hp->parse();
25 //print_r($hp);
26 if (!empty($err)) {
27 $this->assign("hl7_message_err", nl2br("Error:<br>" . $err));
29 $this->assign("hl7_array", $hp->composite_array());
30 return;
36 //sample HL7 message used for testing
37 /*$msg = <<<EOF
38 MSH|^~\&|ADT1|CUH|LABADT|CUH|198808181127|SECURITY|ADT^A01|MSG00001|P|2.3|
39 EVN|A01|198808181122||
40 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|
41 NK1|JOHNSON^JOAN^K|WIFE||||||NK^NEXT OF KIN
42 PV1|1|I|2000^2053^01||||004777^FISHER^BEN^J.|||SUR||||ADM|A0|
43 EOF;
44 $hp = new Parser_HL7v2($msg);
45 print_r($hp->MSH);
46 echo "<br><br>";
47 print_r($hp->EVN);*/