Ejemplo n.º 1
0
 public function getDiscountTypes()
 {
     $discountTypes = array();
     $enumeration = new Enumeration();
     $enumeration->populateByUniqueName(self::DISCOUNT_TYPE_ENUM_NAME);
     $enumerationClosure = new EnumerationClosure();
     $enumerationIterator = $enumerationClosure->getAllDescendants($enumeration->enumerationId, 1);
     foreach ($enumerationIterator as $enum) {
         $discountTypes[$enum->key] = $enum->name;
     }
     return $discountTypes;
 }
Ejemplo n.º 2
0
 public function editBuildingAction()
 {
     $id = (int) $this->_getParam('id');
     $enumerationId = (int) $this->_getParam('enumerationId');
     $enumerationsClosure = new EnumerationsClosure();
     $parentId = $enumerationsClosure->getParentById($enumerationId);
     $enumeration = new Enumeration();
     $enumeration->enumerationId = $parentId;
     $enumeration->populate();
     $orm = new Building();
     if ($id > 0) {
         $orm->buildingId = $id;
         $orm->populate();
     }
     $orm->practiceId = $enumeration->ormId;
     $form = new WebVista_Form(array('name' => 'edit-building'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'facilities.raw/process-edit-building');
     $form->loadORM($orm, 'Building');
     $form->setWindow('windowEditBuildingId');
     $this->view->form = $form;
     $this->view->enumerationId = $enumerationId;
     $this->view->statesList = Address::getStatesList();
     $enumeration = new Enumeration();
     $enumeration->guid = '22fb4e1e-a37a-4e7a-9dae-8e220ba939e8';
     $enumeration->populateByGuid();
     $enumerationClosure = new EnumerationClosure();
     $descendants = $enumerationClosure->getAllDescendants($enumeration->enumerationId, 1, true);
     $facilityCodes = array('' => '');
     foreach ($descendants as $descendant) {
         $facilityCodes[$descendant->key] = $descendant->key . ' : ' . $descendant->name;
     }
     $this->view->facilityCodes = $facilityCodes;
     $this->render('edit-building');
 }
Ejemplo n.º 3
0
 public function listAction()
 {
     $rows = array();
     $guid = '8e6a2456-1710-46be-a018-2afb0ec2829f';
     $enumeration = new Enumeration();
     $enumeration->populateByGuid($guid);
     $closure = new EnumerationClosure();
     $enumerationIterator = $closure->getAllDescendants($enumeration->enumerationId, 1, true);
     foreach ($enumerationIterator as $enum) {
         $row = array();
         $row['id'] = $enum->enumerationId;
         $row['data'] = array();
         $row['data'][] = $enum->name;
         $rows[] = $row;
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(array('rows' => $rows), true);
 }
Ejemplo n.º 4
0
 protected function _edit($groupId = null)
 {
     $groupId = (int) $groupId;
     $claimRule = new ClaimRule();
     $claimRule->event = ClaimRule::EVENT_WARNING;
     $action = 'add';
     if ($groupId > 0) {
         $claimRule->groupId = $groupId;
         $claimRule->populateWithGroupId();
         $claim = new ClaimRule();
         $claim->title = $claimRule->title;
         $claim->message = $claimRule->message;
         $claim->groupId = $claimRule->groupId;
         $claim->event = $claimRule->event;
         $claimRule = $claim;
         // swap, we only need the hidden fields
         $action = 'edit';
     }
     $this->view->action = $action;
     $form = new WebVista_Form(array('name' => 'claimRule'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'claim-rules.raw/process-' . $action);
     $form->loadORM($claimRule, 'claimRule');
     $form->setWindow('windowEditClaimRuleId');
     $this->view->form = $form;
     $this->view->claimRule = $claimRule;
     $modifiers = array('' => '');
     $enumeration = new Enumeration();
     $enumeration->populateByUniqueName('Procedure Modifiers');
     $closure = new EnumerationClosure();
     $descendants = $closure->getAllDescendants($enumeration->enumerationId, 1, true);
     foreach ($descendants as $row) {
         $modifiers[$row->key] = $row->key . ': ' . $row->name;
     }
     $this->view->modifiers = $modifiers;
     $insurancePrograms = array('' => '');
     foreach (InsuranceProgram::getInsurancePrograms() as $key => $value) {
         $insurancePrograms[$key] = $value;
     }
     $this->view->insurancePrograms = $insurancePrograms;
     $this->render('edit');
 }
Ejemplo n.º 5
0
 public function setFilters(array $filters)
 {
     if (!is_array($filters) || empty($filters)) {
         throw new Exception(__('Invalid filters'));
     }
     $filtersArray = array();
     foreach ($filters as $filter) {
         if (!class_exists($filter)) {
             $msg = __("Filter {$filter} does not exists");
             throw new Exception($msg);
         }
         $class = new $filter();
         if (!$class instanceof WebVista_Model_ORM) {
             $msg = __("Filter {$filter} is not an instance of WebVista_Model_ORM");
             throw new Exception($msg);
         }
         $filtersArray[$filter] = $filter;
     }
     $this->_rows = array();
     $enumeration = new Enumeration();
     $enumeration->populateByUniqueName(self::ENUM_NAME);
     $enumerationClosure = new EnumerationClosure();
     if (isset($filtersArray['Practice'])) {
         $practices = $enumerationClosure->getAllDescendants($enumeration->enumerationId, 1);
         foreach ($practices as $enumPractice) {
             if (!$enumPractice->ormId > 0 || $enumPractice->ormClass != 'Practice') {
                 continue;
             }
             $practice = new Practice();
             $practice->practiceId = $enumPractice->ormId;
             $practice->populate();
             if (isset($filtersArray['Building'])) {
                 $buildings = $enumerationClosure->getAllDescendants($enumPractice->enumerationId, 1);
                 foreach ($buildings as $enumBuilding) {
                     if (!$enumBuilding->ormId > 0 || $enumBuilding->ormClass != 'Building') {
                         continue;
                     }
                     $building = new Building();
                     $building->buildingId = $enumBuilding->ormId;
                     $building->populate();
                     if (isset($filtersArray['Room'])) {
                         $rooms = $enumerationClosure->getAllDescendants($enumBuilding->enumerationId, 1);
                         foreach ($rooms as $enumRoom) {
                             if (!$enumRoom->ormId > 0 || $enumRoom->ormClass != 'Room') {
                                 continue;
                             }
                             $room = new Room();
                             $room->roomId = $enumRoom->ormId;
                             $room->populate();
                             $this->_rows[] = array('Practice' => $practice, 'Building' => $building, 'Room' => $room);
                         }
                     } else {
                         $this->_rows[] = array('Practice' => $practice, 'Building' => $building);
                     }
                 }
             } else {
                 $this->_rows[] = $practice;
             }
         }
     } else {
         if (isset($filtersArray['Building'])) {
             $buildings = $enumerationClosure->getAllDescendants($enumPractice->enumerationId, 1);
             foreach ($buildings as $enumBuilding) {
                 if (!$enumBuilding->ormId > 0 || $enumBuilding->ormClass != 'Building') {
                     continue;
                 }
                 $building = new Building();
                 $building->buildingId = $enumBuilding->ormId;
                 $building->populate();
                 if (isset($filtersArray['Room'])) {
                     $rooms = $enumerationClosure->getAllDescendants($enumBuilding->enumerationId, 1);
                     foreach ($rooms as $enumRoom) {
                         if (!$enumRoom->ormId > 0 || $enumRoom->ormClass != 'Room') {
                             continue;
                         }
                         $room = new Room();
                         $room->roomId = $enumRoom->ormId;
                         $room->populate();
                         $this->_rows[] = array('Building' => $building, 'Room' => $room);
                     }
                 } else {
                     $this->_rows[] = $building;
                 }
             }
         } else {
             if (isset($filtersArray['Room'])) {
                 $rooms = $enumerationClosure->getAllDescendants($enumBuilding->enumerationId, 1);
                 foreach ($rooms as $enumRoom) {
                     if (!$enumRoom->ormId > 0 || $enumRoom->ormClass != 'Room') {
                         continue;
                     }
                     $room = new Room();
                     $room->roomId = $enumRoom->ormId;
                     $room->populate();
                     $this->_rows[] = $room;
                 }
             }
         }
     }
     return $this;
 }
Ejemplo n.º 6
0
 public function imagingAction()
 {
     $personId = (int) $this->_getParam('personId');
     $orderId = (int) $this->_getParam('orderId');
     $copy = (int) $this->_getParam('copy');
     $orderImaging = new OrderImaging();
     $orderImaging->orderId = $orderId;
     if (!$orderId > 0 || !$orderImaging->populate()) {
         $orderImaging->order->patientId = $personId;
     }
     if ($copy) {
         $orderImaging->orderId = 0;
     }
     $form = new WebVista_Form(array('name' => 'imagingId'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'orders.raw/process-imaging');
     $form->loadORM($orderImaging, 'imaging');
     $form->setWindow('windowImagingId');
     $this->view->form = $form;
     $namespace = $personId . '::com.clearhealth.person.examsOver7days';
     $this->view->examsOver7days = NSDR2::populate($namespace);
     $imagingList = array();
     $categories = array();
     $urgencies = array();
     $transports = array();
     $pregnants = array();
     $enumeration = new Enumeration();
     $enumeration->populateByUniqueName(OrderImaging::IMAGING_ENUM_NAME);
     $enumerationClosure = new EnumerationClosure();
     $imagingEnums = $enumerationClosure->getAllDescendants($enumeration->enumerationId, 1, true);
     foreach ($imagingEnums as $imagingEnum) {
         $rowset = $enumerationClosure->getAllDescendants($imagingEnum->enumerationId, 1, true);
         if ($imagingEnum->key == OrderImaging::IMAGING_TYPES_ENUM_KEY) {
             foreach ($rowset as $enum) {
                 $enumKey = $enum->enumerationId;
                 $imagingList[$enumKey] = array();
                 $imagingList[$enumKey]['name'] = $enum->name;
                 $imagingList[$enumKey]['procedures'] = array();
                 $imagingList[$enumKey]['modifiers'] = array();
                 $rows = $enumerationClosure->getAllDescendants($enum->enumerationId, 1, true);
                 foreach ($rows as $row) {
                     if ($row->name == 'Procedures') {
                         $rowsProcedures = $enumerationClosure->getAllDescendants($row->enumerationId, 1, true);
                         foreach ($rowsProcedures as $rowProcedure) {
                             $rowProcedureKey = $rowProcedure->enumerationId;
                             $imagingList[$enumKey]['procedures'][$rowProcedureKey]['procedure'] = $rowProcedure->name;
                             $rowsUnitComment = $enumerationClosure->getAllDescendants($rowProcedure->enumerationId, 1, true);
                             $comment = '';
                             foreach ($rowsUnitComment as $unitComment) {
                                 $comment = $unitComment->name;
                                 break;
                                 // only one comment is expected
                             }
                             $imagingList[$enumKey]['procedures'][$rowProcedureKey]['comment'] = $comment;
                         }
                     } else {
                         if ($row->name == 'Modifiers') {
                             $rowsModifiers = $enumerationClosure->getAllDescendants($row->enumerationId, 1, true);
                             foreach ($rowsModifiers as $rowModifier) {
                                 $rowModifierKey = $rowModifier->enumerationId;
                                 $imagingList[$enumKey]['modifiers'][$rowModifierKey] = $rowModifier->name;
                             }
                         }
                     }
                 }
             }
         } else {
             if ($imagingEnum->key == OrderImaging::IMAGING_CATEGORIES_ENUM_KEY) {
                 foreach ($rowset as $enum) {
                     $categories[$enum->key] = $enum->name;
                 }
             } else {
                 if ($imagingEnum->key == OrderImaging::IMAGING_URGENCIES_ENUM_KEY) {
                     foreach ($rowset as $enum) {
                         $urgencies[$enum->key] = $enum->name;
                     }
                 } else {
                     if ($imagingEnum->key == OrderImaging::IMAGING_TRANSPORTS_ENUM_KEY) {
                         foreach ($rowset as $enum) {
                             $transports[$enum->key] = $enum->name;
                         }
                     } else {
                         if ($imagingEnum->key == OrderImaging::IMAGING_PREGNANTS_ENUM_KEY) {
                             foreach ($rowset as $enum) {
                                 $pregnants[$enum->key] = $enum->name;
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->view->imagingList = $imagingList;
     $this->view->categories = $categories;
     $this->view->urgencies = $urgencies;
     $this->view->transports = $transports;
     $this->view->pregnants = $pregnants;
     $this->view->imagingSubmitTo = array('CLEARHEALTH HOSPITAL');
     // temporarily hard-coded
     $this->render();
 }
Ejemplo n.º 7
0
 protected function _applyTransforms(array $transforms, $data)
 {
     $ret = $data;
     if (!$transforms) {
         return $ret;
     }
     foreach ($transforms as $id => $transform) {
         // id, displayName, systemName, options
         $options = array();
         if (isset($transform->options)) {
             $options = $transform->options;
         }
         switch ($transform->systemName) {
             case 'ucase':
                 $ret = strtoupper($ret);
                 break;
             case 'lcase':
                 $ret = strtolower($ret);
                 break;
             case 'ucwords':
                 $ret = ucwords($ret);
                 break;
             case 'squote':
                 $ret = "'" . $ret . "'";
                 break;
             case 'dquote':
                 $ret = '"' . $ret . '"';
                 break;
             case 'pad':
                 $ret = str_pad($ret, $options['len'], $options['char'], $options['type']);
                 break;
             case 'truncate':
                 $ret = substr($ret, 0, $options['len']);
                 break;
             case 'customLink':
                 $href = str_replace('{{value}}', $ret, $options['href']);
                 $ret = '<a href="' . $href . '" onclick="' . $options['onclick'] . '" target="_blank">' . $ret . '</a>';
                 break;
             case 'regex':
                 $ret = preg_replace('/' . $options['pattern'] . '/', $options['replacement'], $ret);
                 break;
             case 'enumLookup':
                 $enumKey = $options['enumKey'];
                 $enumValue = $options['enumValue'];
                 $direction = $options['direction'];
                 $enumeration = new Enumeration();
                 $enumeration->enumerationId = (int) $enumKey;
                 $enumeration->populate();
                 $enumerationClosure = new EnumerationClosure();
                 $descendants = $enumerationClosure->getAllDescendants($enumeration->enumerationId, 1);
                 // get the first level descendants
                 foreach ($descendants as $descendant) {
                     if ($direction == 'displayName' && ($descendant->enumerationId == $ret || $descendant->key == $ret)) {
                         $ret = $descendant->name;
                         break;
                     } else {
                         if ($direction == 'key' && $descendant->name == $ret) {
                             $ret = $descendant->key;
                             break;
                         }
                     }
                 }
                 break;
             case 'dateFormat':
                 $ret = date($options['format'], strtotime($ret));
                 break;
             case 'total':
                 break;
         }
     }
     return $ret;
 }
Ejemplo n.º 8
0
 public function listSectionAction()
 {
     $rows = array();
     $diagnosis = (int) $this->_getParam('diagnosis');
     $closure = new EnumerationClosure();
     foreach ($closure->getAllDescendants($diagnosis, 1, true) as $enum) {
         $row['id'] = $enum->key;
         $row['data'] = array();
         $row['data'][] = '';
         $row['data'][] = $enum->name;
         $row['data'][] = $enum->key;
         $rows[] = $row;
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(array('rows' => $rows), true);
 }
 public function getReportAction()
 {
     $baseId = (int) $this->_getParam('baseId');
     $data = array('filters' => array(), 'views' => array());
     $reportBase = new ReportBase();
     $reportBase->reportBaseId = $baseId;
     $reportBase->populate();
     foreach ($reportBase->reportFilters as $reportFilter) {
         $filter = array();
         $filter['id'] = $reportFilter->id;
         $filter['name'] = $reportFilter->name;
         $filter['defaultValue'] = $reportFilter->defaultValue;
         $filter['type'] = $reportFilter->type;
         $filter['options'] = $reportFilter->options;
         if ($reportFilter->type == ReportBase::FILTER_TYPE_ENUM) {
             $enumerationClosure = new EnumerationClosure();
             $filter['enums'] = array();
             $paths = $enumerationClosure->generatePaths($reportFilter->enumName['id']);
             foreach ($paths as $id => $name) {
                 $filter['enums'][] = array('id' => $id, 'name' => $name);
             }
         } else {
             if ($reportFilter->type == ReportBase::FILTER_TYPE_QUERY) {
                 $reportQuery = new ReportQuery();
                 $reportQuery->reportBaseId = (int) $reportBase->reportBaseId;
                 $reportQueryIterator = $reportQuery->getIteratorByBaseId(null, ReportQuery::TYPE_SQL);
                 $filter['queries'] = array();
                 foreach ($reportQueryIterator as $query) {
                     $filter['queries'][] = array('id' => $query->reportQueryId, 'name' => $query->displayName);
                 }
             }
         }
         $data['filters'][] = $filter;
     }
     $reportView = new ReportView();
     $filters = array('reportBaseId' => $reportBase->reportBaseId, 'active' => 1);
     $reportViewIterator = $reportView->getIteratorByFilters($filters);
     foreach ($reportViewIterator as $view) {
         $row = array();
         $row['id'] = $view->reportViewId;
         $row['data'] = array();
         $row['data'][] = $view->displayName;
         $row['data'][] = $view->runQueriesImmediately;
         $row['data'][] = strlen($view->showResultsIn) > 0 ? $view->showResultsIn : 'grid';
         $data['views'][] = $row;
     }
     $this->view->filterTypes = ReportBase::getFilterTypes();
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
 public function listModifiersAction()
 {
     $guid = $this->_getParam('guid');
     $code = $this->_getParam('code');
     $fs = new FeeSchedule();
     $fs->guid = $guid;
     $fs->procedureCode = $code;
     $fs->populateByGuidCode();
     // ab377de7-8ea7-4912-a27b-2f9749499204 = coding preferences, 9eb793f8-1d5d-4ed5-959d-1e238361e00a = visit type section
     $enumeration = new Enumeration();
     $enumeration->guid = '2b15d494-dce4-4d27-89b5-ddd6f6fc1439';
     $enumeration->populateByGuid();
     $closure = new EnumerationClosure();
     $descendants = $closure->getAllDescendants($enumeration->enumerationId, 1, true);
     $rows = array();
     foreach ($descendants as $enum) {
         $mod = '';
         $fee = '';
         switch ($enum->key) {
             case $fs->modifier1:
                 $fee = $fs->modifier1fee;
                 break;
             case $fs->modifier2:
                 $fee = $fs->modifier2fee;
                 break;
             case $fs->modifier3:
                 $fee = $fs->modifier3fee;
                 break;
             case $fs->modifier4:
                 $fee = $fs->modifier4fee;
                 break;
         }
         if ($fee != '') {
             $mod = '1';
         } else {
             $fee = '0.00';
         }
         $row = array();
         $row['id'] = $enum->key;
         $row['data'] = array();
         $row['data'][] = $mod;
         $row['data'][] = $enum->key . ': ' . $enum->name;
         $row['data'][] = $fee;
         $rows[] = $row;
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(array('rows' => $rows));
 }
Ejemplo n.º 11
0
 public function paymentAction()
 {
     $personId = (int) $this->_getParam('personId');
     $payment = new Payment();
     $payment->personId = $personId;
     $form = new WebVista_Form(array('name' => 'paymentId'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'accounts.raw/process-payment');
     $form->loadORM($payment, 'Payment');
     $form->setWindow('windowUnallocPayment');
     $this->view->form = $form;
     $guid = 'd1d9039a-a21b-4dfb-b6fa-ec5f41331682';
     $enumeration = new Enumeration();
     $enumeration->populateByGuid($guid);
     $closure = new EnumerationClosure();
     $this->view->paymentTypes = $closure->getAllDescendants($enumeration->enumerationId, 1, true)->toArray('key', 'name');
     $this->render();
 }
 public function filterDemographicsAction()
 {
     $psd = new PatientStatisticsDefinition();
     $psdIterator = $psd->getAllActive();
     $demographics = array('age' => array('name' => 'Age', 'type' => ''), 'gender' => array('name' => 'Gender', 'type' => PatientStatisticsDefinition::TYPE_ENUM, 'options' => Enumeration::getEnumArray('Gender', 'key')), 'marital_status' => array('name' => 'Marital Status', 'type' => PatientStatisticsDefinition::TYPE_ENUM, 'options' => Enumeration::getEnumArray('Marital Status', 'key')));
     foreach ($psdIterator as $row) {
         $tmp = array();
         $tmp['name'] = GrowthChartBase::prettyName($row->name);
         $options = array();
         if ($row->type == PatientStatisticsDefinition::TYPE_ENUM) {
             $enumerationClosure = new EnumerationClosure();
             $options = $enumerationClosure->generatePathsKeyName($row->value);
         }
         $tmp['type'] = $row->type;
         asort($options);
         $tmp['options'] = $options;
         $demographics[$row->name] = $tmp;
     }
     $this->view->demographics = $demographics;
     $this->view->filters = $this->_session->filters['demographics'];
     $operators = array('' => '');
     foreach (Claim::balanceOperators() as $key => $value) {
         $operators[$key] = $value;
     }
     $this->view->operators = $operators;
     $this->render();
 }
Ejemplo n.º 13
0
 public function getReportAction()
 {
     $baseId = (int) $this->_getParam('baseId');
     $data = array('filters' => array(), 'views' => array());
     $reportBase = new ReportBase();
     $reportBase->reportBaseId = $baseId;
     $reportBase->populate();
     foreach ($reportBase->reportFilters as $reportFilter) {
         $filter = array();
         $filter['id'] = $reportFilter->id;
         $filter['name'] = $reportFilter->name;
         $filter['defaultValue'] = $reportFilter->defaultValue;
         $filter['type'] = $reportFilter->type;
         $filter['options'] = $reportFilter->options;
         $list = null;
         if ($reportFilter->type == ReportBase::FILTER_TYPE_ENUM) {
             $enumerationClosure = new EnumerationClosure();
             $filter['enums'] = array();
             $paths = $enumerationClosure->generatePaths($reportFilter->enumName['id']);
             foreach ($paths as $id => $name) {
                 $filter['enums'][] = array('id' => $id, 'name' => $name);
             }
         } else {
             if ($reportFilter->type == ReportBase::FILTER_TYPE_QUERY) {
                 $reportQuery = new ReportQuery();
                 $reportQuery->reportQueryId = (int) $reportFilter->query;
                 $reportQuery->populate();
                 $filter['queries'] = $reportQuery->executeQuery();
                 if ($reportFilter->includeBlank) {
                     array_unshift($filter['queries'], array('id' => '', 'name' => '&amp;nbsp;'));
                 }
             } else {
                 if ($reportFilter->type == ReportBase::FILTER_TYPE_LIST_BUILDING) {
                     $orm = new Building();
                     $list = array('ormIterator' => $orm->getIterator(), 'id' => 'buildingId', 'name' => 'displayName');
                 } else {
                     if ($reportFilter->type == ReportBase::FILTER_TYPE_LIST_PRACTICE) {
                         $orm = new Practice();
                         $list = array('ormIterator' => $orm->getIterator(), 'id' => 'practiceId', 'name' => 'name');
                     } else {
                         if ($reportFilter->type == ReportBase::FILTER_TYPE_LIST_PROVIDER) {
                             $orm = new Provider();
                             $list = array('ormIterator' => $orm->getIter(), 'id' => 'personId', 'name' => 'displayName');
                         } else {
                             if ($reportFilter->type == ReportBase::FILTER_TYPE_LIST_ROOM) {
                                 $orm = new Room();
                                 $list = array('ormIterator' => $orm->getIterator(), 'id' => 'roomId', 'name' => 'displayName');
                             } else {
                                 if ($reportFilter->type == ReportBase::FILTER_TYPE_LIST_BUILDING_PREF || $reportFilter->type == ReportBase::FILTER_TYPE_LIST_ROOM_PREF || $reportFilter->type == ReportBase::FILTER_TYPE_LIST_PROVIDER_PREF) {
                                     $room = User::myPreferencesLocation();
                                     $practiceId = (int) $room->building->practiceId;
                                     $buildingId = (int) $room->buildingId;
                                     if ($reportFilter->type == ReportBase::FILTER_TYPE_LIST_BUILDING_PREF) {
                                         $orm = new Building();
                                         $orm->practiceId = $practiceId;
                                         $list = array('ormIterator' => $orm->getIteratorByPracticeId(), 'id' => 'buildingId', 'name' => 'displayName');
                                     } else {
                                         if ($reportFilter->type == ReportBase::FILTER_TYPE_LIST_ROOM_PREF) {
                                             $orm = new Room();
                                             $orm->buildingId = $buildingId;
                                             $list = array('ormIterator' => $orm->getIteratorByBuildingId(), 'id' => 'roomId', 'name' => 'displayName');
                                         } else {
                                             $orm = new Provider();
                                             $list = array('ormIterator' => $orm->getIteratorByPracticeId($practiceId), 'id' => 'personId', 'name' => 'displayName');
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if ($list !== null) {
             $filter['lists'] = array();
             foreach ($list['ormIterator'] as $row) {
                 $filter['lists'][] = array('id' => $row->{$list['id']}, 'name' => htmlspecialchars($row->{$list['name']}));
             }
         }
         $data['filters'][] = $filter;
     }
     $reportView = new ReportView();
     $filters = array('reportBaseId' => $reportBase->reportBaseId, 'active' => 1);
     $reportViewIterator = $reportView->getIteratorByFilters($filters);
     foreach ($reportViewIterator as $view) {
         $row = array();
         $row['id'] = $view->reportViewId;
         $row['data'] = array();
         $row['data'][] = $view->displayName;
         $row['data'][] = $view->runQueriesImmediately;
         $row['data'][] = strlen($view->showResultsIn) > 0 ? $view->showResultsIn : 'grid';
         $data['views'][] = $row;
     }
     $this->view->filterTypes = ReportBase::getFilterTypes();
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
Ejemplo n.º 14
0
 protected static function _generate4010A1($claimId, array $claim)
 {
     static $ctr = 0;
     static $visits = array();
     static $practices = array();
     static $insurancePrograms = array();
     static $providers = array();
     static $patients = array();
     $claimId = (int) $claimId;
     $claimLine = new ClaimLine();
     $claimLine->populateByClaimId($claimId);
     $visitId = (int) $claimLine->visitId;
     if (!isset($visits[$visitId])) {
         $visit = new Visit();
         $visit->visitId = $visitId;
         $visit->populate();
         $visits[$visitId] = $visit;
     }
     $visit = $visits[$visitId];
     $patientId = (int) $visit->patientId;
     if (!isset($patients[$patientId])) {
         $patient = new Patient();
         $patient->personId = $patientId;
         $patient->populate();
         $patients[$patientId] = $patient;
     }
     $patient = $patients[$patientId];
     $practiceId = (int) $visit->practiceId;
     if (!isset($practices[$practiceId])) {
         $practice = new Practice();
         $practice->practiceId = $practiceId;
         $practice->populate();
         $practices[$practiceId] = $practice;
     }
     $practice = $practices[$practiceId];
     $insuranceProgramId = (int) $visit->activePayerId;
     if (!isset($insurancePrograms[$insuranceProgramId])) {
         $insurance = new InsuranceProgram();
         $insurance->insuranceProgramId = $insuranceProgramId;
         $insurance->populate();
         $insurancePrograms[$insuranceProgramId] = $insurance;
     }
     $insuranceProgram = $insurancePrograms[$insuranceProgramId];
     $providerId = (int) $visit->treatingPersonId;
     if (!isset($providers[$providerId])) {
         $provider = new Provider();
         $provider->personId = $providerId;
         $provider->populate();
         $providers[$providerId] = $provider;
     }
     $provider = $providers[$providerId];
     $billAs = (int) $provider->billAs;
     if ($billAs > 0) {
         $providerId = $billAs;
         if (!isset($providers[$providerId])) {
             $provider = new Provider();
             $provider->personId = $providerId;
             $provider->populate();
             $providers[$providerId] = $provider;
         }
         $provider = $providers[$providerId];
     }
     $subscribers = array();
     $enumeration = new Enumeration();
     $enumeration->populateByUniqueName(InsuranceProgram::INSURANCE_ENUM_NAME);
     $enumerationClosure = new EnumerationClosure();
     foreach ($enumerationClosure->getAllDescendants($enumeration->enumerationId, 1, true) as $enum) {
         $rowset = $enumerationClosure->getAllDescendants($enum->enumerationId, 1, true);
         if ($enum->key == InsuranceProgram::INSURANCE_SUBSCRIBER_ENUM_KEY) {
             foreach ($rowset as $row) {
                 $subscribers[$row->key] = $row->name;
             }
             break;
         }
     }
     $insuredRelationship = new InsuredRelationship();
     $db = Zend_Registry::get('dbAdapter');
     $sqlSelect = $db->select()->from($insuredRelationship->_table)->where('insurance_program_id = ?', (int) $insuranceProgram->insuranceProgramId)->where('person_id = ?', (int) $patientId)->where('active = 1')->order('program_order')->limit(1);
     if ($row = $db->fetchRow($sqlSelect)) {
         $insuredRelationship->populateWithArray($row);
     }
     $subs = $insuredRelationship->subscriber;
     $subscriberAddr = $subs->address;
     $relationship = null;
     $relationshipCode = $insuredRelationship->subscriberToPatientRelationship;
     if (isset($subscribers[$relationshipCode])) {
         $relationship = $subscribers[$relationshipCode];
     }
     if ($relationship === null) {
         $relationship = 'Self';
         $relationshipCode = 18;
         $subs = new Person();
         $subs->personId = $insuredRelationship->personId;
         $subs->populate();
     }
     $subscriber = array('id' => (int) $subs->personId, 'relationship_code' => $relationshipCode, 'group_number' => $insuredRelationship->groupNumber, 'group_name' => $insuredRelationship->groupName, 'relationship' => $relationship, 'last_name' => $subs->lastName, 'first_name' => $subs->firstName, 'middle_name' => $subs->middleName, 'address' => array('line1' => $subscriberAddr->line1, 'line2' => $subscriberAddr->line2, 'city' => $subscriberAddr->city, 'state' => $subscriberAddr->state, 'zip' => $subscriberAddr->zipCode), 'date_of_birth' => date('Ymd', strtotime($subs->dateOfBirth)), 'gender' => $subs->gender, 'contract_type_code' => '', 'contract_amount' => '', 'contract_percent' => '', 'contract_code' => '', 'contract_discount_percent' => '', 'contract_version' => '');
     $practiceAddr = $practice->primaryAddress;
     $room = new Room();
     $room->roomId = (int) $visit->roomId;
     $room->populate();
     $facility = $room->building;
     $phoneNumber = PhoneNumber::autoFixNumber($practice->mainPhone->number);
     $phoneLen = strlen($phoneNumber);
     if ($phoneLen < 10) {
         $phoneNumber = str_pad($phoneNumber, 10, '0', STR_PAD_LEFT);
     } else {
         if ($phoneLen > 10) {
             $phoneNumber = substr($phoneNumber, -10);
         }
     }
     $identifierType = '';
     $identifier = $practice->identifier;
     if (strlen($identifier) > 0) {
         $identifierType = 'XX';
     }
     //24';
     $data = array('hlCount' => ++$ctr);
     $data['practice'] = array('name' => $practice->name, 'identifier_type' => $identifierType, 'identifier' => $identifier, 'address' => array('line1' => $practiceAddr->line1, 'line2' => $practiceAddr->line2, 'city' => $practiceAddr->city, 'state' => $practiceAddr->state, 'zip' => $practiceAddr->zipCode), 'phoneNumber' => $phoneNumber);
     $data['treating_facility'] = array('identifier' => $facility->identifier);
     $dateOfTreatment = date('Ymd', strtotime($visit->dateOfTreatment));
     $payer2Id = $insuranceProgram->insuranceProgramId;
     if (strlen($payer2Id) < 2) {
         $payer2Id = str_pad($payer2Id, 2, '0', STR_PAD_LEFT);
     }
     $identifierType = '';
     $identifier = $provider->person->identifier;
     if (strlen($identifier) > 0) {
         $identifierType = 'XX';
     }
     //34';
     $claimData = array('claim' => $claim, 'patient' => array('date_of_initial_treatment' => $dateOfTreatment, 'date_of_onset' => $dateOfTreatment, 'comment_type' => '', 'comment' => ''), 'treating_facility' => array('facility_code' => $facility->facilityCodeId, 'name' => $facility->name, 'address' => array('line1' => $facility->line1, 'line2' => $facility->line2, 'city' => $facility->city, 'state' => $facility->state, 'zip' => $facility->zipCode)), 'provider' => array('signature_on_file' => 'Y', 'accepts_assignment' => 'A', 'last_name' => $provider->person->lastName, 'first_name' => $provider->person->firstName, 'identifier_type' => $identifierType, 'identifier' => $identifier, 'identifier_2' => ''), 'billing_facility' => array('clia_number' => ''), 'subscriber' => $subscriber, 'clearing_house' => array('credit_max_amount' => '', 'repricing_method' => '', 'allowed_amount' => '', 'savings_amount' => '', 'identifier' => '', 'rate' => '', 'apg_code' => '', 'apg_amount' => '', 'reject_code' => '', 'compliance_code' => '', 'exception_code' => ''), 'referring_provider' => array('last_name' => '', 'first_name' => '', 'referral_type' => '', 'identifier_type' => '', 'identifier' => '', 'taxonomy_code' => ''), 'supervising_provider' => array('last_name' => '', 'first_name' => '', 'identifier_type' => '', 'identifier' => ''), 'payer2' => array('id' => $payer2Id, 'name' => $insuranceProgram->name));
     $clm = array();
     $iterator = new ClaimLineIterator();
     $iterator->setFilters(array('claimId' => $claimId));
     foreach ($iterator as $row) {
         $baseFee = (double) $row->baseFee;
         $adjustedFee = (double) $row->adjustedFee;
         $paid = (double) $row->paid;
         $billed = $row->totalMiscCharge;
         if ($baseFee > 0) {
             $billed += $baseFee - $adjustedFee;
         }
         $balance = abs($billed) - $paid;
         $clm[] = array('claim' => $claimData['claim'], 'patient' => $claimData['patient'], 'claim_line' => array('amount' => $balance, 'diagnosis1' => preg_replace('/[\\.]/', '', $row->diagnosisCode1), 'diagnosis2' => preg_replace('/[\\.]/', '', $row->diagnosisCode2), 'diagnosis3' => preg_replace('/[\\.]/', '', $row->diagnosisCode3), 'diagnosis4' => preg_replace('/[\\.]/', '', $row->diagnosisCode4), 'diagnosis5' => preg_replace('/[\\.]/', '', $row->diagnosisCode5), 'diagnosis6' => preg_replace('/[\\.]/', '', $row->diagnosisCode6), 'diagnosis7' => preg_replace('/[\\.]/', '', $row->diagnosisCode7), 'diagnosis8' => preg_replace('/[\\.]/', '', $row->diagnosisCode8), 'procedure' => $row->procedureCode, 'modifier1' => $row->modifier1, 'modifier2' => $row->modifier2, 'modifier3' => $row->modifier3, 'modifier4' => $row->modifier4, 'units' => str_replace('.00', '', $row->units), 'date_of_treatment' => $dateOfTreatment, 'clia_number' => ''), 'treating_facility' => $claimData['treating_facility'], 'provider' => $claimData['provider'], 'billing_facility' => $claimData['billing_facility'], 'subscriber' => $subscriber, 'clearing_house' => $claimData['clearing_house'], 'referring_provider' => $claimData['referring_provider'], 'supervising_provider' => $claimData['supervising_provider'], 'payer2' => $claimData['payer2']);
     }
     $hl2 = array();
     $hl2[] = array('hlCount' => $ctr, 'hlCount2' => ++$ctr, 'payer' => array('responsibility' => 'P'), 'subscriber' => $subscriber, 'patient' => array('weight' => '', 'last_name' => $patient->lastName, 'first_name' => $patient->firstName), 'responsible_party' => array('last_name' => '', 'first_name' => '', 'address' => array('line1' => '', 'line2' => '', 'city' => '', 'state' => '', 'zip' => '')), 'CLM' => $clm);
     $data['HL2'] = $hl2;
     return $data;
 }
Ejemplo n.º 15
0
 public function listModifiersAction()
 {
     $visitId = (int) $this->_getParam('visitId');
     $id = (int) $this->_getParam('id');
     $rows = array();
     if ($visitId > 0) {
         $visit = new Visit();
         $visit->visitId = $visitId;
         $visit->populate();
         $patientProcedure = new PatientProcedure();
         $patientProcedure->patientProcedureId = $id;
         $patientProcedure->populate();
         $modifiers = array();
         for ($i = 1; $i <= 4; $i++) {
             $field = 'modifier' . $i;
             $key = $patientProcedure->{$field};
             if (strlen($key) > 0) {
                 $modifiers[$key] = $key;
             }
         }
         $enabled = array();
         $disabled = array();
         $enumeration = new Enumeration();
         $enumeration->populateByUniqueName('Procedure Modifiers');
         $closure = new EnumerationClosure();
         $descendants = $closure->getAllDescendants($enumeration->enumerationId, 1, true);
         foreach ($descendants as $row) {
             $tmp = array();
             $tmp['id'] = $row->key;
             $tmp['data'] = array();
             $tmp['data'][] = isset($modifiers[$row->key]) ? '1' : '';
             $tmp['data'][] = $row->key . ': ' . $row->name;
             if ($tmp['data'][0] == '1') {
                 $enabled[$modifiers[$row->key]] = $tmp;
             } else {
                 $disabled[] = $tmp;
             }
         }
         $tmp = $enabled;
         $enabled = array();
         foreach ($modifiers as $modifier) {
             $enabled[] = $tmp[$modifier];
         }
         $rows = array_merge($enabled, $disabled);
     }
     $data = array();
     $data['rows'] = $rows;
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
 public function autoCompleteEnumAction()
 {
     $match = $this->_getParam('name');
     $match = preg_replace('/[^a-zA-Z-0-9 >]/', '', $match);
     $strMatch = $match;
     $matches = array();
     if (strlen($match) < 3) {
         $this->_helper->autoCompleteDojo($matches);
     }
     $enumerations = EnumerationClosure::searchByLevels($match);
     foreach ($enumerations as $enumeration) {
         $matches[$enumeration->enumerationId] = $enumeration->name;
     }
     $this->_helper->autoCompleteDojo($matches);
 }
Ejemplo n.º 17
0
 public function ormEditMethod($ormId, $isAdd)
 {
     $controller = Zend_Controller_Front::getInstance();
     $request = $controller->getRequest();
     $enumerationId = (int) $request->getParam("enumerationId");
     $view = Zend_Layout::getMvcInstance()->getView();
     $params = array();
     if ($isAdd) {
         $params['parentId'] = $enumerationId;
         unset($_GET['enumerationId']);
         // remove enumerationId from params list
         $params['grid'] = 'enumItemsGrid';
     } else {
         $closure = new EnumerationClosure();
         $params['parentId'] = $closure->getParentById($enumerationId);
         $params['enumerationId'] = $enumerationId;
         $params['grid'] = 'enumItemsGrid';
     }
     return $view->action('edit', 'enumerations-manager', null, $params);
 }
 public function processAddVisitTypesAction()
 {
     $personId = (int) $this->_getParam('personId');
     $visitId = (int) $this->_getParam('visitId');
     $id = (int) $this->_getParam('id');
     $ret = false;
     $closure = new EnumerationClosure();
     $diagnoses = array();
     $procedures = array();
     foreach ($closure->getAllDescendants($id, 1, true) as $enum) {
         switch ($enum->ormClass) {
             case 'DiagnosisCodesICD':
                 $diagnoses[] = $enum;
                 break;
             case 'ProcedureCodesCPT':
                 $procedures[] = $enum;
                 break;
         }
     }
     $providerId = (int) Zend_Auth::getInstance()->getIdentity()->personId;
     foreach ($procedures as $procedure) {
         $patientProcedure = new PatientProcedure();
         $patientProcedure->code = $procedure->key;
         $patientProcedure->quantity = 1;
         // default to 1
         $patientProcedure->procedure = $procedure->name;
         $patientProcedure->patientId = $personId;
         $patientProcedure->providerId = $providerId;
         $patientProcedure->visitId = $visitId;
         $diagCtr = 1;
         foreach ($diagnoses as $diagnosis) {
             $key = $diagnosis->key;
             $patientDiagnosis = new PatientDiagnosis();
             $patientDiagnosis->code = $key;
             $patientDiagnosis->dateTime = date('Y-m-d H:i:s');
             $patientDiagnosis->diagnosis = $diagnosis->name;
             $patientDiagnosis->patientId = $personId;
             $patientDiagnosis->providerId = $providerId;
             $patientDiagnosis->visitId = $visitId;
             $patientDiagnosis->persist();
             $diag = 'diagnosisCode' . $diagCtr++;
             $patientProcedure->{$diag} = $key;
         }
         $patientProcedure->persist();
         $ret = true;
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($ret);
 }
Ejemplo n.º 19
0
 public function addPaymentAction()
 {
     $columnId = -1;
     $appointmentId = (int) $this->_getParam('appointmentId');
     $visitId = (int) $this->_getParam('visitId');
     $appointment = new Appointment();
     $appointment->appointmentId = $appointmentId;
     $appointment->populate();
     $payment = new Payment();
     $payment->visitId = $visitId;
     $payment->personId = (int) $appointment->patientId;
     $payment->appointmentId = $appointmentId;
     if (!$visitId > 0) {
         $columnId = (int) $this->_getParam('columnId');
     }
     $form = new WebVista_Form(array('name' => 'paymentId'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'appointment.raw/process-add-payment');
     $form->loadORM($payment, 'Payment');
     $form->setWindow('winPaymentId');
     $this->view->form = $form;
     $this->view->visitId = $visitId;
     $guid = 'd1d9039a-a21b-4dfb-b6fa-ec5f41331682';
     $enumeration = new Enumeration();
     $enumeration->populateByGuid($guid);
     $closure = new EnumerationClosure();
     $this->view->paymentTypes = $closure->getAllDescendants($enumeration->enumerationId, 1, true)->toArray('key', 'name');
     $this->view->columnId = $columnId;
     $this->render('add-payment');
 }
Ejemplo n.º 20
0
 public static function patient($personId)
 {
     $newPatient = true;
     $db = Zend_Registry::get('dbAdapter');
     $sqlSelect = $db->select()->from('audits', 'COUNT(*) AS ctr')->where("objectClass = 'Patient' AND objectId = ?", (int) $personId);
     if (($row = $db->fetchRow($sqlSelect)) && $row['ctr'] > 1) {
         $newPatient = false;
     }
     $data = self::_getPatientData($personId);
     $subscribersEnum = array();
     $enumeration = new Enumeration();
     $enumeration->populateByUniqueName(InsuranceProgram::INSURANCE_ENUM_NAME);
     $enumerationClosure = new EnumerationClosure();
     foreach ($enumerationClosure->getAllDescendants($enumeration->enumerationId, 1, true) as $enum) {
         $rowset = $enumerationClosure->getAllDescendants($enum->enumerationId, 1, true);
         if ($enum->key != InsuranceProgram::INSURANCE_SUBSCRIBER_ENUM_KEY) {
             continue;
         }
         foreach ($rowset as $row) {
             $subscribersEnum[$row->key] = $row->name;
         }
     }
     $insuredRelationship = new InsuredRelationship();
     $sqlSelect = $db->select()->from($insuredRelationship->_table)->where('person_id = ?', $personId)->where('active = 1')->order('program_order');
     $insuredRelationshipIterator = $insuredRelationship->getIterator($sqlSelect);
     $subscribers = array();
     $insurances = array();
     $guarantors = array();
     foreach ($insuredRelationshipIterator as $item) {
         $subscriberId = (int) $item->subscriberId;
         $subscriberToPatientRelationship = $item->subscriberToPatientRelationship;
         if (!$subscriberId > 0) {
             $subscriberId = $personId;
             $subscriberToPatientRelationship = 'SELF';
         }
         if (isset($subscribersEnum[$subscriberToPatientRelationship])) {
             $subscriberToPatientRelationship = $subscribersEnum[$subscriberToPatientRelationship];
         }
         if (!isset($subscribers[$subscriberId])) {
             $patient = new Patient();
             $patient->personId = $subscriberId;
             $patient->populate();
             $subscribers[$subscriberId] = $patient;
         }
         $subscriber = self::_getPatientData($subscribers[$subscriberId], false);
         $subscriber['relation'] = strtoupper(substr($subscriberToPatientRelationship, 0, 1));
         $insuranceProgram = $item->insuranceProgram;
         $companyId = (int) $insuranceProgram->companyId;
         $phoneNumber = new PhoneNumber();
         $sqlSelect = $db->select()->from(array('cn' => 'company_number'))->join(array('n' => 'number'), 'n.number_id = cn.number_id')->where('n.active = 1')->where('cn.company_id = ?', $companyId)->order('n.displayOrder')->limit(1);
         $phoneNumber->populateWithSql($sqlSelect->__toString());
         $insurance = array();
         $insurance['companyId'] = $companyId;
         $insurance['companyName'] = $insuranceProgram->company->name;
         $address = $insuranceProgram->address;
         $insurance['line1'] = $address->line1;
         $insurance['line2'] = $address->line2;
         $insurance['city'] = $address->city;
         $insurance['state'] = $address->state;
         $insurance['zip'] = $address->postalCode;
         $insurance['phoneNumber'] = $phoneNumber->number;
         $insurance['groupNumber'] = $item->groupName;
         $insurance['groupName'] = '';
         $insurance['policyNumber'] = $item->groupNumber;
         //$insurance['ssn'] = $insuranceProgram->payerIdentifier;
         $insurances[] = array('subscriber' => $subscriber, 'insurance' => $insurance);
         $guarantors[] = $subscriber;
     }
     $adt = $newPatient ? 'A04' : 'A08';
     $t = microtime();
     $x = explode(' ', $t);
     $date = date('YmdHis', $x[1]);
     $messageId = $date . str_replace('.', '0', $x[0]);
     $id = 0;
     $hl7Guarantors = array();
     foreach ($guarantors as $key => $guarantor) {
         $ctr = $key + 1;
         $hl7Guarantors[] = "GT1|{$ctr}|{$guarantor['recordNumber']}|{$guarantor['lastName']}^{$guarantor['firstName']}^{$guarantor['middleName']}^{$guarantor['suffix']}^^||{$guarantor['line1']}^{$guarantor['line2']}^{$guarantor['city']}^{$guarantor['state']}^{$guarantor['zip']}|{$guarantor['homePhone']}|{$guarantor['businessPhone']}|{$guarantor['dateOfBirth']}|{$guarantor['gender']}||S|{$guarantor['ssn']}|";
     }
     $hl7Insurances = array();
     foreach ($insurances as $key => $value) {
         $ctr = $key + 1;
         $subscriber = $value['subscriber'];
         $insurance = $value['insurance'];
         $hl7Insurances[] = "IN1|{$ctr}|{$insurance['companyId']}^{$insurance['companyName']}|{$insurance['companyId']}|{$insurance['companyName']}|{$insurance['line1']}^{$insurance['line2']}^{$insurance['city']}^{$insurance['state']}^{$insurance['zip']}||{$insurance['phoneNumber']}|{$insurance['groupNumber']}|{$insurance['groupName']}|||||||{$subscriber['lastName']}^{$subscriber['firstName']}^{$subscriber['middleName']}^{$subscriber['suffix']}^^|{$subscriber['relation']}|{$subscriber['dateOfBirth']}|{$subscriber['line1']}^{$subscriber['line2']}^{$subscriber['city']}^{$subscriber['state']}^{$subscriber['zip']}|Y||{$ctr}||||||||||||||{$insurance['policyNumber']}|0||||||{$subscriber['gender']}||||||{$subscriber['ssn']}|";
         if (!strlen($subscriber['ssn']) > 0) {
             continue;
         }
         $hl7Insurances[] = "IN2|{$ctr}|{$subscriber['ssn']}";
     }
     $patient = $data['patient'];
     $provider = $data['provider'];
     $hl7Message = array();
     $hl7Message[] = "MSH|^~\\&|MedMgr|989801|aroeshl7_prod|HEST|{$date}||ADT^{$adt}|{$messageId}|P|2.3|{$id}|";
     $hl7Message[] = "EVN|{$adt}|{$date}|||38|";
     $hl7Message[] = self::_PID($patient);
     $hl7Message[] = self::_PV1($provider);
     foreach ($hl7Guarantors as $hl7Guarantor) {
         $hl7Message[] = $hl7Guarantor;
     }
     foreach ($hl7Insurances as $hl7Insurance) {
         $hl7Message[] = $hl7Insurance;
     }
     $separator = "\r\n";
     return implode($separator, $hl7Message);
 }
Ejemplo n.º 21
0
 public function listStatsAction()
 {
     $personId = (int) $this->_getParam('personId');
     $psd = new PatientStatisticsDefinition();
     $stats = PatientStatisticsDefinition::getPatientStatistics($personId);
     $psdIterator = $psd->getAllActive();
     $rows = array();
     foreach ($psdIterator as $row) {
         $tmp = array();
         $tmp['id'] = $row->name;
         $tmp['data'] = array();
         $tmp['data'][] = GrowthChartBase::prettyName($row->name);
         $tmp['data'][] = isset($stats[$row->name]) ? $stats[$row->name] : '';
         $options = array();
         if ($row->type == PatientStatisticsDefinition::TYPE_ENUM) {
             $enumerationClosure = new EnumerationClosure();
             $paths = $enumerationClosure->generatePaths($row->value);
             foreach ($paths as $id => $name) {
                 $options[] = array('key' => $id, 'value' => $name);
             }
         }
         $tmp['userdata']['type'] = $row->type;
         $tmp['userdata']['options'] = $options;
         $rows[] = $tmp;
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(array('rows' => $rows));
 }
Ejemplo n.º 22
0
 protected function _populateTypes()
 {
     $this->_populateLabTests();
     if ($this->_types !== null) {
         return;
     }
     $this->_types = array();
     $enumerationClosure = new EnumerationClosure();
     foreach ($this->_labTests as $key => $value) {
         if ($key != OrderLabTest::LAB_TYPES_ENUM_KEY) {
             continue;
         }
         foreach ($enumerationClosure->getAllDescendants($value->enumerationId, 1) as $enum) {
             $this->_types[$enum->key] = $enum;
         }
         break;
     }
 }