public function processLookupAction() { $q = preg_replace('/[^a-zA-Z0-9\\%\\.]/', '', $this->_getParam('q', '')); $rows = array(); if (strlen($q) > 0) { $ctr = 1; $allergyIterator = new DiagnosisCodesAllergyIterator(); $allergyIterator->setFilters($q); $allergyRows = $allergyIterator->toJsonArray('code', array('textShort')); if (count($allergyRows) > 0) { $tmp = array(); $tmp['id'] = $ctr++; $tmp['data'][] = __('Allergy File'); $tmp['rows'] = $allergyRows; $rows[] = $tmp; } $drugAllergyIterator = new BaseMed24DrugAllergyIterator(); $drugAllergyIterator->setFilters(array('formulary' => 'default', 'value' => $q)); $drugAllergyRows = $drugAllergyIterator->toJsonArray('vaclass', array('notice')); if (count($drugAllergyRows)) { $tmp = array(); $tmp['id'] = $ctr++; $tmp['data'][] = __('Drug Class'); $tmp['rows'] = $drugAllergyRows; $rows[] = $tmp; } $specificDrugAllergyIterator = new BaseMed24SpecificDrugAllergyIterator(); $specificDrugAllergyIterator->setFilters($q); $specificDrugAllergyRows = $specificDrugAllergyIterator->toJsonArray('md5', array('notice')); if (count($specificDrugAllergyRows)) { $tmp = array(); $tmp['id'] = $ctr++; $tmp['data'][] = __('Specific Drug'); $tmp['rows'] = $specificDrugAllergyRows; $rows[] = $tmp; } $freeRows = array(); $tmp = array(); $tmp['id'] = $ctr++; $tmp['data'][] = $q; $freeRows[] = $tmp; $tmp = array(); $tmp['id'] = $ctr++; $tmp['data'][] = __('Add new free-text allergy'); $tmp['rows'] = $freeRows; $rows[] = $tmp; } $data = array(); $data['rows'] = $rows; $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }
public function processLookupAction() { $q = preg_replace('/[^a-zA-Z0-9\\%\\.]/', '', $this->_getParam('q', '')); $rows = array(); if (strlen($q) > 0) { $ctr = 1; $allergyIterator = new DiagnosisCodesAllergyIterator(); $allergyIterator->setFilters($q); $allergyRows = $allergyIterator->toJsonArray('code', array('textShort', 'code')); if (count($allergyRows) > 0) { $tmp = array(); $tmp['id'] = $ctr++; $tmp['data'][] = __('Diagnosis Codes Allergy File'); $tmp['rows'] = $allergyRows; $rows[] = $tmp; } $freeRows = array(); $tmp = array(); $tmp['id'] = $ctr++; $tmp['data'][] = $q; $freeRows[] = $tmp; $tmp = array(); $tmp['id'] = $ctr++; $tmp['data'][] = __('Add new free-text allergy'); $tmp['rows'] = $freeRows; $rows[] = $tmp; } $data = array(); $data['rows'] = $rows; $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }