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');
 }
 public function editInsurerAction()
 {
     $patientId = (int) $this->_getParam('patientId');
     $id = (int) $this->_getParam('id');
     $this->_insurer = new InsuredRelationship();
     $this->_insurer->personId = $patientId;
     if ($id > 0) {
         $this->_insurer->insuredRelationshipId = $id;
         $this->_insurer->populate();
     }
     $this->_form = new WebVista_Form(array('name' => 'edit-insurer'));
     $this->_form->setAction(Zend_Registry::get('baseUrl') . "patient.raw/process-edit-insurer");
     $this->_form->loadORM($this->_insurer, "Insurer");
     $this->_form->setWindow('winEditInsurerId');
     $this->view->form = $this->_form;
     $insuranceProgram = new InsuranceProgram();
     $insurancePrograms = array('' => '');
     foreach (InsuranceProgram::getInsurancePrograms() as $id => $val) {
         $insurancePrograms[$id] = $val;
     }
     $this->view->insurancePrograms = $insurancePrograms;
     $assignings = array('' => '');
     $this->view->assignings = $assignings;
     $subscribers = array('' => '');
     $this->view->subscribers = $subscribers;
     $this->render('edit-insurer');
 }
예제 #3
0
 public function populatePayers(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.9');
     // <!-- Payers section template -->
     $code = $section->addChild('code');
     $code->addAttribute('code', '48768-6');
     $code->addAttribute('codeSystem', '2.16.840.1.113883.6.1');
     $section->addChild('title', 'Payers');
     $rows = array();
     $insurancePrograms = InsuranceProgram::getInsurancePrograms();
     $insuredRelationship = new InsuredRelationship();
     $insuredRelationshipIterator = $insuredRelationship->getIteratorByPersonId($this->_patientId);
     foreach ($insuredRelationshipIterator as $item) {
         $company = '';
         $program = '';
         if (isset($insurancePrograms[$item->insuranceProgramId])) {
             $exp = explode('->', $insurancePrograms[$item->insuranceProgramId]);
             $company = html_convert_entities($exp[0]);
             $program = html_convert_entities($exp[1]);
         }
         $rows[] = array('company' => $company, 'program' => $program, 'groupNumber' => html_convert_entities($item->groupNumber));
     }
     $text = $section->addChild('text');
     if ($rows) {
         $table = $text->addChild('table');
         $thead = $table->addChild('thead');
         $tr = $thead->addChild('tr');
         $tr->addChild('th', 'Payer name');
         $tr->addChild('th', 'Policy type / Coverage type');
         $tr->addChild('th', 'Covered party ID');
         $tr->addChild('th', 'Authorization(s)');
         $tbody = $table->addChild('tbody');
         foreach ($rows as $row) {
             $tr = $tbody->addChild('tr');
             $tr->addChild('td', $row['company']);
             $tr->addChild('td', $row['program']);
             $tr->addChild('td', $row['groupNumber']);
             $tr->addChild('td', '');
         }
     }
 }
 public function listInsuranceProgramsAction()
 {
     $guid = $this->_getParam('fid');
     $fs = new FeeSchedule();
     $fs->guid = $guid;
     $fs->populateByGuid();
     $ids = array();
     foreach (explode(',', $fs->insuranceProgramIds) as $id) {
         $ids[$id] = $id;
     }
     $rows = array();
     foreach (InsuranceProgram::getInsurancePrograms() as $id => $value) {
         $checked = '';
         if (isset($ids[$id])) {
             $checked = '1';
         }
         $rows[] = array('id' => $id, 'data' => array($checked, $value), 'userdata' => array('program' => $value));
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(array('rows' => $rows));
 }
예제 #5
0
 public function patientAction()
 {
     if (!isset($this->_session->patientFilters)) {
         $this->_session->patientFilters = array();
     }
     $filters = $this->_session->patientFilters;
     if (!isset($filters['dateStart'])) {
         $filters['dateStart'] = date('Y-m-d', strtotime('-1 week'));
         $this->_session->patientFilters = $filters;
     }
     if (!isset($filters['dateEnd'])) {
         $filters['dateEnd'] = date('Y-m-d');
         $this->_session->patientFilters = $filters;
     }
     $this->view->filters = $filters;
     $this->view->personId = (int) $this->_getParam('personId');
     $facilities = array('' => '');
     $facilityIterator = new FacilityIterator();
     $facilityIterator->setFilter(array('Practice', 'Building', 'Room'));
     foreach ($facilityIterator as $facility) {
         $key = $facility['Practice']->practiceId . '_' . $facility['Building']->buildingId . '_' . $facility['Room']->roomId;
         $name = $facility['Practice']->name . '->' . $facility['Building']->name . '->' . $facility['Room']->name;
         $facilities[$key] = $name;
     }
     $this->view->facilities = $facilities;
     $payers = array('' => '');
     foreach (InsuranceProgram::getInsurancePrograms() as $key => $value) {
         $payers[$key] = $value;
     }
     $this->view->payers = $payers;
     $providers = array('' => '');
     $provider = new Provider();
     foreach ($provider->getIter() as $row) {
         $providers[$row->personId] = $row->displayName;
     }
     $this->view->providers = $providers;
     $users = array('' => '');
     $db = Zend_Registry::get('dbAdapter');
     $user = new User();
     $sqlSelect = $db->select()->from($user->_table)->order('username');
     foreach ($user->getIterator($sqlSelect) as $row) {
         $users[$row->userId] = $row->username;
     }
     $this->view->users = $users;
     $this->render();
 }
예제 #6
0
 public function processPaymentSendToAction()
 {
     $claimId = (int) $this->_getParam('claimId');
     $payerId = 0;
     $insurance = $this->_getParam('insurance');
     switch ($insurance) {
         case 'Collections':
         case 'Patient Responsibility':
             foreach (InsuranceProgram::getInsurancePrograms() as $key => $value) {
                 if ($value == 'System->' . $insurance) {
                     $payerId = (int) $key;
                     break;
                 }
             }
             break;
     }
     $ret = false;
     if ($claimId > 0 && $payerId > 0) {
         $this->_sendToPayer($claimId, $payerId);
         $ret = true;
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($ret);
 }
예제 #7
0
 public function editInsurerAction()
 {
     $patientId = (int) $this->_getParam('patientId');
     $id = (int) $this->_getParam('id');
     $insurer = new InsuredRelationship();
     $insurer->personId = $patientId;
     $time = time();
     $insurer->effectiveStart = date('Y-m-d', $time);
     $insurer->effectiveEnd = date('Y-m-d', strtotime('+1 year', $time));
     if ($id > 0) {
         $insurer->insuredRelationshipId = $id;
         $insurer->populate();
     }
     $this->view->subscriber = $insurer->subscriber;
     $this->view->subscriberPhone = $insurer->subscriber->phoneNumber;
     $this->view->subscriberAddress = $insurer->subscriber->address;
     $this->_form = new WebVista_Form(array('name' => 'edit-insurer'));
     $this->_form->setAction(Zend_Registry::get('baseUrl') . 'patient.raw/process-edit-insurer');
     $this->_form->loadORM($insurer, 'Insurer');
     $this->_form->setWindow('winEditInsurerId');
     $this->view->form = $this->_form;
     $insuranceProgram = new InsuranceProgram();
     $insurancePrograms = array('' => '');
     foreach (InsuranceProgram::getInsurancePrograms() as $id => $val) {
         $insurancePrograms[$id] = $val;
     }
     $this->view->insurancePrograms = $insurancePrograms;
     $assignings = array();
     $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_ASSIGNING_ENUM_KEY) {
             foreach ($rowset as $row) {
                 $assignings[$row->key] = $row->name;
             }
         } else {
             if ($enum->key == InsuranceProgram::INSURANCE_SUBSCRIBER_ENUM_KEY) {
                 foreach ($rowset as $row) {
                     $subscribers[$row->key] = $row->name;
                 }
             }
         }
     }
     $this->view->assignings = $assignings;
     $this->view->subscribers = $subscribers;
     $this->view->listVerified = InsuredRelationship::getVerifiedOptions();
     $this->render('edit-insurer');
 }