public static function generate($patientId)
 {
     $patientId = (int) $patientId;
     $ret = array();
     $msh = array();
     $msh['messageType'] = array('code' => 'VXU', 'eventType' => 'V04', 'structure' => 'VXU_V04');
     $ret[] = self::generateMSH($msh);
     // MSH
     $ret[] = self::generatePID($patientId);
     // PID
     $iterator = new PatientImmunizationIterator();
     $iterator->setFilters(array('patientId' => $patientId));
     foreach ($iterator as $immunization) {
         $ret[] = self::generateORC();
         // 'ORC|RE';
         $ret[] = self::generateRXA($immunization);
         // RXA
     }
     return implode("\r\n", $ret);
 }
 public function listPatientImmunizationsJsonAction()
 {
     $patientId = (int) $this->_getParam("patientId");
     $rows = array();
     if ($patientId > 0) {
         $patientImmunizationIterator = new PatientImmunizationIterator();
         $filter = array();
         $filter['patientId'] = $patientId;
         $patientImmunizationIterator->setFilter($filter);
         foreach ($patientImmunizationIterator as $pi) {
             $rows[] = $this->_generateImmunizationRowData($pi);
         }
     }
     $data = array();
     $data['rows'] = $rows;
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
Example #3
0
 public function populateImmunizations(SimpleXMLElement $xml)
 {
     $component = $xml->addChild('component');
     $section = $component->addChild('section');
     $templateId = $section->addChild('templateId');
     $templateId->addAttribute('root', '2.16.840.1.113883.10.20.1.6');
     // <!-- Immunizations section template -->
     $code = $section->addChild('code');
     $code->addAttribute('code', '11369-6');
     $code->addAttribute('codeSystem', '2.16.840.1.113883.6.1');
     $section->addChild('title', 'Immunizations');
     $rows = array();
     $iterator = new PatientImmunizationIterator();
     $this->setFiltersDateRange($filters);
     $iterator->setFilter(array('patientId' => $this->_patientId));
     foreach ($iterator as $immunization) {
         $status = 'Completed';
         // TODO: where to get the status?
         $rows[] = array('vaccine' => html_convert_entities($immunization->immunization), 'date' => date('M d, Y', strtotime($immunization->dateAdministered)), 'status' => html_convert_entities($status));
     }
     $text = $section->addChild('text');
     if ($rows) {
         $table = $text->addChild('table');
         $thead = $table->addChild('thead');
         $tr = $thead->addChild('tr');
         $tr->addChild('th', 'Vaccine');
         $tr->addChild('th', 'Date');
         $tr->addChild('th', 'Status');
         $tbody = $table->addChild('tbody');
         foreach ($rows as $row) {
             $tr = $tbody->addChild('tr');
             $tr->addChild('td', $row['vaccine']);
             $tr->addChild('td', $row['date']);
             $tr->addChild('td', $row['status']);
         }
     }
 }
 public function listPatientImmunizationsJsonAction()
 {
     $patientId = (int) $this->_getParam("patientId");
     $rows = array();
     if ($patientId > 0) {
         $patientImmunizationIterator = new PatientImmunizationIterator();
         $filter = array();
         $filter['patientId'] = $patientId;
         $patientImmunizationIterator->setFilter($filter);
         $rows = $patientImmunizationIterator->toJsonArray('code', array('dateAdministered', 'lot', 'route', 'site', 'series', 'reaction', 'immunization', 'patientReported', 'comment'));
     }
     $data = array();
     $data['rows'] = $rows;
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }