/**
  * Default action to dispatch
  */
 public function indexAction()
 {
     $enumerationId = (int) $this->_getParam("enumerationId");
     $enumeration = new Enumeration();
     $enumeration->enumerationId = $enumerationId;
     $enumeration->populate();
     $ormClass = $enumeration->ormClass;
     $ormId = $enumeration->ormId;
     $ormEditMethod = $enumeration->ormEditMethod;
     if (!class_exists($ormClass)) {
         throw new Exception("ORM Class {$ormClass} does not exists");
     }
     $ormObject = new $ormClass();
     if (!$ormObject instanceof ORM) {
         throw new Exception("ORM Class {$ormClass} is not an instance of an ORM");
     }
     if (strlen($ormEditMethod) > 0 && method_exists($ormObject, $ormEditMethod)) {
         $form = $ormObject->{$ormEditMethod}($ormId);
     } else {
         foreach ($ormObject->_primaryKeys as $key) {
             $ormObject->{$key} = $ormId;
         }
         $ormObject->populate();
         $form = new WebVista_Form(array('name' => 'edit-object'));
         $form->setAction(Zend_Registry::get('baseUrl') . "generic-edit.raw/process-edit?enumerationId={$enumerationId}");
         $form->loadORM($ormObject, "ormObject");
         $form->setWindow('windowEditORMObjectId');
     }
     $this->_ormObject = $ormObject;
     $this->view->ormObject = $this->_ormObject;
     $this->view->form = $form;
     $this->render('index');
 }
 public function editAction()
 {
     //$ormId = (int)$this->_getParam('ormId');
     $enumerationId = (int) $this->_getParam('enumerationId');
     $edu = new EducationResource();
     $edu->educationResourceId = $enumerationId;
     $edu->populate();
     $form = new WebVista_Form(array('name' => 'education'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'education-resources.raw/process-edit');
     $form->loadORM($edu, 'education');
     $form->setWindow('windowEditORMObjectId');
     $this->view->form = $form;
     $this->render();
 }
 public function editAction()
 {
     $id = (int) $this->_getParam('id');
     $psd = new PatientStatisticsDefinition();
     if ($id > 0) {
         $psd->patientStatisticsDefinitionId = $id;
         $psd->populate();
     }
     $form = new WebVista_Form(array('name' => 'stats'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'statistics-manager.raw/process-edit');
     $form->loadORM($psd, 'stats');
     $form->setWindow('winEditStatsId');
     $this->view->form = $form;
     $this->view->ORM = $psd;
     $this->view->types = $psd->_types;
     $this->render();
 }
 protected function _renderEdit($id = '', $action = 'add')
 {
     $discountTable = new DiscountTable();
     if (strlen($id) > 0) {
         $discountTable->guid = $id;
         $discountTable->populateByGuid();
     } else {
         $discountTable->dateStart = date('Y-m-d');
         $discountTable->dateEnd = date('Y-m-d', strtotime('+30 days'));
     }
     $form = new WebVista_Form(array('name' => 'editDiscountTable'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'discount-table-manager.raw/process-' . $action);
     $form->loadORM($discountTable, 'discountTable');
     $form->setWindow('windowEditDiscountTableId');
     $this->view->form = $form;
     $this->view->discountTypes = $discountTable->discountTypes;
     $this->render('edit');
 }
 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 editAction()
 {
     $ormId = (int) $this->_getParam('ormId');
     $enumerationId = (int) $this->_getParam('enumerationId');
     $enumeration = new Enumeration();
     $enumeration->enumerationId = $enumerationId;
     $enumeration->populate();
     $inventory = new ImmunizationInventory();
     $inventory->immunization = $enumeration->name;
     $inventory->expiration = date('Y-m-d', strtotime('+1 year'));
     $form = new WebVista_Form(array('name' => 'edit'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'immunization-inventory.raw/process-edit');
     $form->loadORM($inventory, 'inventory');
     $form->setWindow('windowEditORMObjectId');
     $this->view->form = $form;
     $this->view->enumerationId = $enumerationId;
     $this->view->totalInStock = 0;
     //$inventory->totalInStock;
     $this->view->totalExpired = 0;
     //$inventory->totalExpired;
     $this->render('edit');
 }
 public function editAction()
 {
     $ormId = $this->_getParam('ormId');
     $enumerationId = (int) $this->_getParam('enumerationId');
     $enumerationsClosure = new EnumerationsClosure();
     //$depth = (int)$enumerationsClosure->getDepthById($enumerationId);
     //if ($depth > 1) {
     $diagnosis = new DiagnosisCodesICD();
     $diagnosis->code = $ormId;
     $diagnosis->populate();
     $form = new WebVista_Form(array('name' => 'diagnosisId'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'diagnosis.raw/process-edit');
     $form->loadORM($diagnosis, 'Diagnosis');
     $form->setWindow('windowEditORMObjectId');
     $this->view->form = $form;
     //}
     //else {
     //	$this->view->message = __('There is nothing to edit on the Diagnosis Sections definition, add diagnosis beneath it');
     //}
     $this->view->enumerationId = $enumerationId;
     $this->render();
 }
 public function ajaxEditAction()
 {
     if (isset($this->_session->messages)) {
         $this->view->messages = $this->_session->messages;
     }
     $menuId = $this->_getParam('menuId');
     if ((int) $menuId === 0 && substr($menuId, 0, 11) != 'newMenuItem') {
         $msg = __("Root menu id cannot be modified.");
         throw new Exception($msg);
     }
     $objMenu = new MenuItem();
     $objMenu->menuId = $menuId;
     $objMenu->populate();
     $data = array();
     $data['menuId'] = $menuId;
     $data['type'] = $objMenu->type;
     $data['parentId'] = $objMenu->parentId;
     $data['active'] = $objMenu->active;
     $data['siteSection'] = $objMenu->siteSection;
     $objForm = new WebVista_Form(array('name' => 'menu-item'));
     $objForm->setAction(Zend_Registry::get('baseUrl') . "menu-manager.raw/edit-process");
     $objForm->loadORM($objMenu, "MenuItem");
     $objForm->setWindow('windowEditMenuId');
     $this->view->form = $objForm;
     if (!isset($data['siteSection'])) {
         $data['siteSection'] = 'default';
     }
     if (!isset($data['type'])) {
         $data['type'] = 'freeform';
     }
     $this->view->mainTabs = $this->getMainTabs();
     $this->view->types = array('freeform', 'report', 'form', 'submenu');
     $data['val'] = $objMenu->typeValue;
     $data['report'] = array();
     $objReport = new Report();
     $data['report'] = $objReport->getReportList();
     $data['form'] = array();
     $objForm = new Form();
     $data['form'] = $objForm->getFormList();
     $data['typeValue'] = $objMenu->action;
     switch ($objMenu->type) {
         case 'report':
             $x = explode('?', $objMenu->action);
             $requestUri = explode('&', $x[1]);
             foreach ($requestUri as $uri) {
                 $kvp = explode('=', $uri);
                 if ($kvp[0] == 'templateId') {
                     $data['typeValue'] = $kvp[1];
                     break;
                 }
             }
             break;
         case 'form':
             $x = explode('?', $objMenu->action);
             $requestUri = explode('&', $x[1]);
             foreach ($requestUri as $uri) {
                 $kvp = explode('=', $uri);
                 if ($kvp[0] == 'formId') {
                     $data['typeValue'] = $kvp[1];
                     break;
                 }
             }
             break;
     }
     $this->view->data = $data;
     $this->render('ajax-edit');
 }
 public function _editAppointment(array $params, $action = 'new')
 {
     $appointmentId = isset($params['appointmentId']) ? (int) $params['appointmentId'] : 0;
     $appointment = new Appointment();
     $appointment->appointmentId = $appointmentId;
     $date = isset($params['date']) ? $params['date'] : '';
     if ($appointmentId > 0 && $appointment->populate()) {
         $filter = $this->getCurrentDisplayFilter();
         $start = explode(' ', date('Y-m-d H:i', strtotime($appointment->start)));
         $date = $start[0];
         $appointment->start = $start[1];
         $appointment->end = date('H:i', strtotime($appointment->end));
         $recordNumber = $appointment->patient->record_number;
         $patientName = $appointment->patient->displayName;
         $this->view->patient = "{$patientName} #{$recordNumber} PID:{$appointment->patient->person_id}";
     } else {
         $start = isset($params['start']) ? $params['start'] : self::FILTER_TIME_START;
         $appointment->start = $start;
         $appointment->end = date('H:i', strtotime('+1 hour', strtotime($start)));
         $appointment->providerId = isset($params['providerId']) ? (int) $params['providerId'] : 0;
         $appointment->roomId = isset($params['roomId']) ? (int) $params['roomId'] : 0;
     }
     $this->view->date = $date;
     $form = new WebVista_Form(array('name' => $action . '-appointment'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'calendar.raw/process-' . $action . '-appointment');
     $form->loadORM($appointment, 'Appointment');
     $form->setWindow('windowAppointmentId');
     $this->view->form = $form;
     $this->view->reasons = PatientNote::listReasons();
     $phones = array();
     $phone = new PhoneNumber();
     $phoneIterator = $phone->getIteratorByPersonId($appointment->patientId);
     foreach ($phoneIterator as $row) {
         $phones[] = $row->number;
     }
     $this->view->phones = $phones;
     $appointmentTemplate = new AppointmentTemplate();
     $this->view->appointmentReasons = $appointmentTemplate->getAppointmentReasons();
     $this->view->appointment = $appointment;
     $this->view->callbackId = $this->_getParam('callbackId', '');
     $this->render('appointment');
 }
 public function editVisitTypeAction()
 {
     $ormId = $this->_getParam('ormId');
     $enumerationId = (int) $this->_getParam('enumerationId');
     $enumerationsClosure = new EnumerationsClosure();
     $depth = (int) $enumerationsClosure->getDepthById($enumerationId);
     $ormClasses = Visit::ormClasses();
     if ($depth > 2) {
         $enumeration = new Enumeration();
         $enumeration->enumerationId = $enumerationId;
         $enumeration->populate();
         $ormClass = $enumeration->ormClass;
         if (!in_array($ormClass, $ormClasses)) {
             $ormClass = $ormClasses[0];
             // temporary set to ProcedureCodesCPT as default ORM Class
         }
         $orm = new $ormClass();
         $orm->code = $ormId;
         $orm->populate();
         $form = new WebVista_Form(array('name' => 'visitTypeId'));
         $form->setAction(Zend_Registry::get('baseUrl') . 'visit-details.raw/process-edit-visit-type');
         $form->loadORM($orm, 'visit');
         $form->setWindow('windowEditORMObjectId');
         $this->view->form = $form;
     } else {
         $this->view->message = __('There is nothing to edit on the Visit Type Sections definition, add diagnosis or procedure beneath it');
     }
     $this->view->ormClasses = $ormClasses;
     $this->view->enumerationId = $enumerationId;
     $this->render();
 }
 public function setFeesAction()
 {
     $guid = $this->_getParam('id');
     $fs = new FeeSchedule();
     if (strlen($guid) > 0) {
         $fs->guid = $guid;
         $fs->populateByGuid();
         $fs->insuranceProgramIds = implode(', ', InsuranceProgram::getInsuranceProgramsByIds($fs->insuranceProgramIds));
     }
     $form = new WebVista_Form(array('name' => 'edit-fee-schedule'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'fee-schedule-manager.raw/process-set-fees');
     $form->loadORM($fs, 'feeSchedule');
     $form->setWindow('windowEditFeeScheduleId');
     $this->view->form = $form;
     $this->render();
 }
Esempio n. 12
0
 public function manualJournalAction()
 {
     $postingJournal = new PostingJournal();
     $form = new WebVista_Form(array('name' => 'journalId'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'accounts.raw/process-manual-journal');
     $form->loadORM($postingJournal, 'Journal');
     $form->setWindow('windowManualJournal');
     $this->view->form = $form;
     $this->render();
 }
 public function addAppointmentAction()
 {
     $appointmentId = $this->_getParam('appointmentId');
     $appointment = new Appointment();
     if (strlen($appointmentId) > 0) {
         $filter = $this->getCurrentDisplayFilter();
         $appointment->appointmentId = (int) $appointmentId;
         $appointment->populate();
         $this->view->start = date('H:i', strtotime($appointment->start));
         $this->view->end = date('H:i', strtotime($appointment->end));
         foreach ($filter->columns as $index => $col) {
             if ($col['providerId'] > 0 && $col['roomId'] > 0 && $col['providerId'] == $appointment->providerId && $col['roomId'] == $appointment->roomId || $col['providerId'] > 0 && $col['providerId'] == $appointment->providerId || $col['roomId'] > 0 && $col['roomId'] == $appointment->roomId) {
                 $this->view->columnId = $index;
                 break;
             }
         }
         $recordNumber = $appointment->patient->record_number;
         $lastName = $appointment->patient->last_name;
         $firstName = $appointment->patient->first_name;
         $middleInitial = '';
         if (strlen($appointment->patient->middle_name) > 0) {
             $middleInitial = $appointment->patient->middle_name[0];
         }
         $this->view->patient = "{$lastName}, {$firstName} {$middleInitial} #{$recordNumber} PID:{$appointment->patient->person_id}";
     } else {
         $columnId = $this->_getParam('columnId');
         $rowId = $this->_getParam('rowId');
         $start = $this->_getParam('start');
         if (strlen($columnId) > 0) {
             $this->view->columnId = $columnId;
             $filter = $this->getCurrentDisplayFilter();
             if (!isset($filter->columns[$columnId])) {
                 throw new Exception(__("Cannot generate column with that index, there is no filter defined for that column Index: ") . $columnId);
             }
             $column = $filter->columns[$columnId];
             $appointment->providerId = isset($column['providerId']) ? $column['providerId'] : 0;
             $appointment->roomId = isset($column['roomId']) ? $column['roomId'] : 0;
         }
         if (strlen($start) > 0) {
             $this->view->start = $start;
             $this->view->end = date('H:i', strtotime('+1 hour', strtotime($start)));
         }
     }
     $form = new WebVista_Form(array('name' => 'add-appointment'));
     $form->setAction(Zend_Registry::get('baseUrl') . "calendar.raw/process-add-appointment");
     $form->loadORM($appointment, "Appointment");
     $form->setWindow('windowNewAppointment');
     $this->view->form = $form;
     $reasons = array();
     $enumeration = new Enumeration();
     $enumeration->populateByEnumerationName(PatientNote::ENUM_REASON_PARENT_NAME);
     $enumerationsClosure = new EnumerationsClosure();
     $enumerationIterator = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1);
     $ctr = 0;
     foreach ($enumerationIterator as $enum) {
         // since data type of patient_note.reason is tinyint we simply use the counter as id
         $reasons[$ctr++] = $enum->name;
     }
     /*
     $patientNotes = array();
     $patientNote = new PatientNote();
     $patientNoteIterator = $patientNote->getIterator();
     $filters = array();
     $filters['patient_id'] = (int)$appointment->patientId;
     $filters['active'] = 1;
     $filters['posting'] = 0;
     $patientNoteIterator->setFilters($filters);
     foreach ($patientNoteIterator as $row) {
     	$patientNotes[$row->patientNoteId] = $reasons[$row->reason];
     }
     $this->view->patientNotes = $patientNotes;
     */
     $phones = array();
     $phone = new PhoneNumber();
     $phoneIterator = $phone->getIteratorByPatientId($appointment->patientId);
     foreach ($phoneIterator as $row) {
         $phones[] = $row->number;
     }
     $this->view->phones = $phones;
     $appointmentTemplate = new AppointmentTemplate();
     $appointmentReasons = $appointmentTemplate->getAppointmentReasons();
     $this->view->appointmentReasons = $appointmentReasons;
     $this->view->appointment = $appointment;
     $this->render('add-appointment');
 }
 protected function _editView($viewId = 0, $mode = 'add')
 {
     $reportView = new ReportView();
     $reportView->reportBaseId = (int) $this->_getParam('baseId');
     if ($viewId > 0) {
         $reportView->reportViewId = $viewId;
         $reportView->populate();
     }
     $form = new WebVista_Form(array('name' => $mode . '-view'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'reports-manager.raw/process-' . $mode . '-view');
     $form->loadORM($reportView, 'ReportView');
     $form->setWindow('winReportBaseViewId');
     $this->view->form = $form;
     $queries = array();
     $reportQuery = new ReportQuery();
     $reportQuery->reportBaseId = $reportView->reportBaseId;
     $reportQueryIterator = $reportQuery->getIteratorByBaseId();
     $this->view->queries = $reportQueryIterator->toArray('reportQueryId', 'displayName');
     $mappings = array();
     if ($reportView->unserializedColumnDefinitions === null) {
         $reportView->unserializedColumnDefinitions = array();
     }
     foreach ($reportView->unserializedColumnDefinitions as $col) {
         $mappings[] = $this->_generateMappingGridRowData($col);
     }
     $this->view->mappings = $mappings;
     $this->view->transformTypes = ReportView::getTransformTypes();
     $this->view->showResults = ReportView::getShowResultOptions();
     $showResultsOptions = $reportView->unserializedShowResultsOptions;
     if (isset($showResultsOptions['pdfTemplateFile'])) {
         $attachment = new Attachment();
         $attachment->attachmentId = (int) $showResultsOptions['pdfTemplateFile'];
         $attachment->populate();
         $showResultsOptions['pdfTemplateFileContent'] = '<a href="' . $this->view->baseUrl . '/attachments.raw/view-attachment?attachmentId=' . $attachment->attachmentId . '">' . $attachment->name . '</a>';
     }
     $this->view->showResultsOptions = $showResultsOptions;
     $this->view->lineEndings = ReportView::getLineEndingOptions();
     $this->render('edit-view');
 }
 /**
  * Render edit page
  */
 public function editAction()
 {
     $enumerationId = (int) $this->_getParam('enumerationId');
     $parentId = (int) $this->_getParam('parentId');
     $category = $this->_getParam('category', null);
     $this->view->ormClass = $this->_getParam('ormClass', null);
     $this->view->enumerationId = $enumerationId;
     $enum = new Enumeration();
     if ($enumerationId > 0) {
         $enum->enumerationId = $enumerationId;
         $enum->populate();
     }
     if ($category !== null) {
         $enum->category = $category;
     }
     if (!strlen($enum->ormEditMethod) > 0) {
         $enum->ormEditMethod = 'ormEditMethod';
     }
     if ($parentId > 0) {
         $parent = new Enumeration();
         $parent->enumerationId = (int) $parentId;
         $parent->populate();
         $this->view->parent = $parent;
         if ($parent->name == 'Facilities') {
             $this->view->ormClass = 'Practice';
             // overrides ormClass
         }
     }
     $form = new WebVista_Form(array("name" => "edit-enumeration"));
     $form->setAction(Zend_Registry::get('baseUrl') . "enumerations-manager.raw/process-edit");
     $form->loadORM($enum, "enumeration");
     $form->setWindow('windowEditORMObjectId');
     $this->view->form = $form;
     $this->view->categoryIterator = Enumeration::getIterByDistinctCategories();
     $this->view->grid = $this->_getParam('grid');
     $this->render('edit');
 }
 /**
  * Edit clinical notes definition, this must be called using AJAX
  */
 public function editDefinitionAction()
 {
     $clinicalNoteDefinitionId = (int) $this->_getParam('clinicalNoteDefinitionId');
     $clinicalNoteTemplateId = (int) $this->_getParam('clinicalNoteTemplateId');
     $cnDefinition = new ClinicalNoteDefinition();
     $cnDefinition->clinicalNoteTemplateId = $clinicalNoteTemplateId;
     if ($clinicalNoteDefinitionId > 0) {
         $cnDefinition->clinicalNoteDefinitionId = $clinicalNoteDefinitionId;
         $cnDefinition->populate();
     }
     $objForm = new WebVista_Form(array('name' => 'cnDefinition'));
     $objForm->setAction(Zend_Registry::get('baseUrl') . "clinical-notes-manager.raw/process-edit-definition");
     $objForm->loadORM($cnDefinition, "cnDefinition");
     $objForm->setWindow('windowEditDefinition');
     $this->view->form = $objForm;
     $this->render();
 }
 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');
 }
 function addNoteAction()
 {
     $personId = (int) $this->_getParam('personId');
     $this->view->personId = $personId;
     $this->view->clinicalNoteDefinitions = new ClinicalNoteDefinitionIterator();
     $this->view->currentPersonId = (int) Zend_Auth::getInstance()->getIdentity()->personId;
     $this->view->personId = $personId;
     $form = new WebVista_Form(array('name' => 'add-note'));
     $form->setAction(Zend_Registry::get('baseUrl') . "clinical-notes.raw/process-add-note");
     $clinicalNote = new ClinicalNote();
     $form->loadORM($clinicalNote, "ClinicalNote");
     $form->setWindow('windowAddNote');
     $this->view->form = $form;
 }
 public function uploadAction()
 {
     $updateFile = new UpdateFile();
     $form = new WebVista_Form(array('name' => 'edit'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'update-manager.raw/process-upload');
     $form->loadORM($updateFile, 'updateFile');
     $form->setWindow('winNewUploadId');
     $form->setAttrib('enctype', 'multipart/form-data');
     $this->view->form = $form;
     $this->render('upload');
 }
Esempio n. 20
0
 public function labResultsAction()
 {
     $orderId = (int) $this->_getParam('orderId');
     $order = new OrderLabTest();
     $order->orderId = $orderId;
     if (!$order->populate()) {
         $error = 'Order Id ' . $orderId . ' not found';
         trigger_error($error);
         throw new Exception($error);
     }
     $loinc = new ProcedureCodesLOINC();
     $loinc->loincNum = $order->labTest;
     $loinc->populate();
     $shortname = $loinc->shortname;
     if (!strlen($shortname) > 0) {
         $shortname = $loinc->longCommonName;
     }
     $labTest = new LabTest();
     $labTest->labOrderId = $order->orderId;
     $labTest->populateByLabOrderId();
     $labOrder = new LabOrder();
     $labOrder->labOrderId = $order->orderId;
     if (!$labOrder->populate()) {
         $labOrder->labOrderId = $order->orderId;
         $labOrder->patientId = $order->order->patientId;
         $labOrder->personId = $order->order->patientId;
         $labOrder->orderingProvider = $order->order->provider->displayName;
         $labOrder->manualOrderDate = $order->order->dateTime;
         $labOrder->orderDescription = $shortname;
         $labOrder->persist();
         $labTest = new LabTest();
         $labTest->labOrderId = $labOrder->labOrderId;
         $labTest->componentCode = $loinc->class;
         $labTest->service = $shortname;
         $labTest->orderNum = $order->orderId;
         $labTest->persist();
         $orderObs = strtolower($loinc->orderObs);
         if ($orderObs == 'both') {
             // create default lab_results
             $labResult = new LabResult();
             $labResult->description = $order->displayLabTest;
             $labResult->labTestId = $labTest->labTestId;
             $labResult->observationTime = date('Y-m-d H:i');
             $labResult->units = $loinc->exampleUcumUnits;
             $labResult->identifier = $loinc->loincNum;
             $labResult->persist();
         } else {
             if ($orderObs == 'order') {
                 // temporarily do nothing
             }
         }
     }
     $this->view->order = $order;
     $form = new WebVista_Form(array('name' => 'labTestId'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'orders.raw/set-lab-test');
     $form->loadORM($labTest, 'LabTest');
     $this->view->form = $form;
     $this->render();
 }
 public function editRoomAction()
 {
     $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 Room();
     if ($id > 0) {
         $orm->roomId = $id;
         $orm->populate();
     }
     $orm->buildingId = $enumeration->ormId;
     $form = new WebVista_Form(array('name' => 'edit-room'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'facilities.raw/process-edit-room');
     $form->loadORM($orm, 'Room');
     $form->setWindow('windowEditRoomId');
     $this->view->form = $form;
     $routingStations = LegacyEnum::getEnumArray('routing_stations');
     $routingStations = array_merge(array('' => ''), $routingStations);
     $this->view->colors = Room::getColorList();
     $this->view->routingStations = $routingStations;
     $this->view->enumerationId = $enumerationId;
     $this->render('edit-room');
 }
Esempio n. 22
0
 public function makePaymentAction()
 {
     $ids = explode(',', $this->_session->ids);
     $data = array('claims' => array(), 'patients' => array(), 'payers' => array(), 'facilities' => array(), 'funds' => array());
     $visits = array();
     foreach ($ids as $id) {
         $visitId = (int) $id;
         if (!$visitId > 0) {
             continue;
         }
         $visit = new Visit();
         $visit->visitId = $visitId;
         if (!$visit->populate()) {
             continue;
         }
         $funds = $visit->unallocatedFunds;
         $claims = $visit->uniqueClaims;
         $data['claimIds'][$visitId] = array('personId' => (int) $visit->patientId, 'unallocatedFunds' => $funds['total'], 'claimIds' => $claims['claimId'], 'payerIds' => $claims['payerId']);
     }
     $this->view->data = $data;
     $payment = new Payment();
     $form = new WebVista_Form(array('name' => 'editPayment'));
     $form->setAction(Zend_Registry::get('baseUrl') . 'claims.raw/process-payments');
     $form->loadORM($payment, 'payment');
     $form->setWindow('windowClaimsMakePaymentId');
     $this->view->form = $form;
     $payers = array('' => '');
     foreach (InsuranceProgram::getInsurancePrograms() as $key => $value) {
         $payers[$key] = $value;
     }
     $this->view->payers = $payers;
     $this->view->visitIds = $ids;
     $this->view->payerSelf = InsuranceProgram::lookupSystemId('Self Pay');
     // ID of System->Self Pay
     $this->render();
 }