public function patientAction()
 {
     $personId = (int) $this->_getParam('personId');
     $this->view->reasons = PatientNote::listReasons();
     if (!isset($this->_session->active)) {
         $this->_session->active = 1;
     }
     if (!isset($this->_session->inactive)) {
         $this->_session->inactive = 1;
     }
     $this->view->active = $this->_session->active;
     $this->view->inactive = $this->_session->inactive;
     $this->render('patient');
 }
 public function detailsAction()
 {
     $patientId = (int) $this->_getParam('patientId');
     $this->_patient = new Patient();
     $this->_patient->person_id = $patientId;
     $this->_patient->populate();
     $facilityIterator = new FacilityIterator();
     $facilityIterator->setFilter(array('Practice'));
     $this->_form = new WebVista_Form(array('name' => 'patient-details'));
     $this->_form->setAction(Zend_Registry::get('baseUrl') . "patient.raw/process-details");
     $this->_form->loadORM($this->_patient, "Patient");
     $this->_form->setWindow('windowPatientDetailsId');
     $this->view->form = $this->_form;
     $this->view->facilityIterator = $facilityIterator;
     $this->view->reasons = PatientNote::listReasons();
     $this->view->statesList = Address::getStatesList();
     $this->view->phoneTypes = PhoneNumber::getListPhoneTypes();
     $this->view->addressTypes = Address::getListAddressTypes();
     $this->render();
 }
 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');
 }