public function generatePathsKeyName($id) { $db = Zend_Registry::get('dbAdapter'); $className = $this->_ormClass; $ormClass = new $className(); $ormKey = $ormClass->_primaryKeys[0]; $whrSelect = $db->select()->from(array('ccc' => $this->_table), 'ccc.ancestor')->where('ccc.depth != 0')->where('ccc.ancestor = ?', (int) $id); $sqlSelect = $db->select()->from(array('c' => $this->_table), "c.descendant AS node, GROUP_CONCAT(n.name ORDER BY n.enumerationId SEPARATOR ' -> ') AS path")->join(array('cc' => $this->_table), 'cc.descendant = c.descendant', array())->join(array('n' => $ormClass->_table), 'n.' . $ormKey . ' = cc.ancestor', array())->where('c.ancestor = ?', (int) $id)->where('c.descendant != c.ancestor')->group('c.descendant'); $ret = array(); $rows = $db->fetchAll($sqlSelect); if ($rows) { $statisticsStoreKeyAsValue = (string) Zend_Registry::get('config')->statisticsStoreKeyAsValue == 'true' ? true : false; foreach ($rows as $row) { $enumeration = new Enumeration(); $enumeration->enumerationId = (int) $row['node']; $enumeration->populate(); if ($statisticsStoreKeyAsValue) { $ret[$enumeration->key] = $row['path']; } else { $ret[$enumeration->name] = $row['path']; } } } return $ret; }
/** * 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 getDisplayedValue() { $ret = null; if ($this->type != self::TYPE_ENUM) { return $ret; } $enumeration = new Enumeration(); $enumeration->enumerationId = (int) $this->value; $enumeration->populate(); return $enumeration->name; }
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; }
public static function listReasons() { $reasons = array(); $enumeration = new Enumeration(); $enumeration->populateByUniqueName(self::ENUM_REASON_PARENT_NAME); $enumerationsClosure = new EnumerationsClosure(); $enumerationIterator = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); foreach ($enumerationIterator as $enum) { $reasons[$enum->key] = $enum->name; } return $reasons; }
protected function _getEnumerationByName($name) { $enumeration = new Enumeration(); $enumeration->populateByUniqueName($name); $enumerationsClosure = new EnumerationsClosure(); $enumerationIterator = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); $ret = array(); foreach ($enumerationIterator as $enumeration) { $ret[$enumeration->key] = $enumeration->name; } return $ret; }
protected function _getReasons() { $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; } return $reasons; }
public function editAction() { $personId = (int) $this->_getParam('personId'); if (isset($this->_session->messages)) { $this->view->messages = $this->_session->messages; } $this->_form = new WebVista_Form(array('name' => 'provider-detail')); $this->_form->setAction(Zend_Registry::get('baseUrl') . "admin-providers.raw/edit-process"); $this->_provider = new Provider(); $this->_provider->person_id = $personId; if (!$this->_provider->populate()) { if ($personId > 0) { //handle case where person exists but no provider record $this->view->noProvider = true; } //do nothing if personId is 0, no person selected yet } $this->_form->loadORM($this->_provider, 'provider'); //var_dump($this->_form); $this->view->form = $this->_form; $this->view->person = $this->_provider; $stations = Enumeration::getEnumArray(Routing::ENUM_PARENT_NAME); $stations = array_merge(array('' => ''), $stations); $this->view->stations = $stations; $specialties = array('' => ''); $listSpecialties = Provider::getListSpecialties(); // temporarily use AM = American Medical Association foreach ($listSpecialties['AM'] as $specialty) { $specialties[$specialty['code']] = $specialty['description']; } $this->view->specialties = $specialties; $this->view->colors = Room::getColorList(); $this->render('edit'); }
public function indexAction() { $enumAr = Enumeration::getEnumArray("Gender", "key", "name"); var_dump($enumAr); exit; $this->render(); }
public function setUp() { $this->_guids = NSDR::generateTestData(); Enumeration::generateTestData(); NSDR::systemUnload(); NSDR::systemStart(); }
public function indexAction() { $enumAr = Enumeration::getEnumArray('Gender', 'key'); var_dump($enumAr); exit; $this->render(); }
public static function generateMenus($menu = 'default', $attributes = array('name' => '', 'absolutePosition' => 'auto', 'mixedImages' => 'yes')) { static $_menus = array(); if (!strlen($menu) > 0) { throw new Exception("Menu argument must be a string referencing a valid activity tab"); return; } $rootTag = '<menu'; foreach ($attributes as $k => $v) { $rootTag .= " {$k}=\"{$v}\""; } $rootTag .= ' />'; $xml = new SimpleXMLElement($rootTag); $name = 'Menu'; $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($name); self::_generateEnumerationTree($xml, $enumeration->enumerationId); return $xml->asXML(); }
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); }
public function getDisplayGender() { $enumeration = new Enumeration(); $enumeration->enumerationId = $this->gender; $enumeration->populate(); return $enumeration->name; $gender = ""; switch ($this->gender) { case "1": $gender = "M"; break; case "2": $gender = "F"; break; case "3": $gender = "O"; break; } return $gender; }
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 getAppointmentReasons() { $name = self::ENUM_PARENT_NAME; $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($name); $enumerationId = $enumeration->enumerationId; $db = Zend_Registry::get('dbAdapter'); $enumerationsClosure = new EnumerationsClosure(); $dbSelect = $db->select()->from(array('e' => $enumeration->_table))->join(array('ec' => 'enumerationsClosure'), 'e.enumerationId = ec.descendant')->join(array('at' => $this->_table), 'at.appointmentTemplateId = e.ormId', array('appointmentTemplateName' => 'name', 'breakdown'))->where('ec.ancestor = ?', (int) $enumerationId)->where('ec.ancestor != ec.descendant')->where('ec.depth = 1')->where('e.active = 1')->order('ec.weight ASC')->order('at.name ASC'); $rows = array(); if ($rowset = $db->fetchAll($dbSelect)) { foreach ($rowset as $row) { // unserialize breakdown if (strlen($row['breakdown']) > 0) { $row['breakdown'] = unserialize($row['breakdown']); } else { $row['breakdown'] = array(); } $rows[$row['enumerationId']] = $row; } } return $rows; }
public function editAction() { $tableName = preg_replace('/[^a-zA-Z]+/', '', $this->_getParam("id", "")); $prettyName = preg_replace('/([A-Z]{1})/', ' \\1', substr($tableName, 9)); $this->view->tableName = $tableName; $this->view->prettyName = $prettyName; $this->view->chBaseMed24Url = Zend_Registry::get('config')->healthcloud->CHMED->chBaseMed24Url; $this->view->chBaseMed24DetailUrl = Zend_Registry::get('config')->healthcloud->CHMED->chBaseMed24DetailUrl; $name = Medication::ENUM_ADMIN_SCHED; $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($name); $enumerationsClosure = new EnumerationsClosure(); $rowset = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); $scheduleOptions = array(); $adminSchedules = array(); foreach ($rowset as $row) { $scheduleOptions[] = $row->key; $adminSchedules[$row->key] = $row->name; } $this->view->scheduleOptions = $scheduleOptions; $this->view->quantityQualifiers = Medication::listQuantityQualifiersMapping(); $this->render(); }
public function processEditAction() { $this->editAction(); $enumerationId = (int) $this->_getParam('enumerationId'); $params = $this->_getParam('appointmentTemplate'); $appointmentTemplateId = (int) $params['appointmentTemplateId']; $this->_appointmentTemplate->populateWithArray($params); $breakdownNames = $this->_getParam('breakdownName'); $breakdownLength = $this->_getParam('breakdownLength'); $breakdownType = $this->_getParam('breakdownType'); $breakdowns = array(); if (is_array($breakdownNames) && is_array($breakdownLength) && is_array($breakdownType)) { foreach ($breakdownNames as $key => $value) { if (!isset($breakdownLength[$key]) || !isset($breakdownType[$key])) { continue; } $data = array(); $data['n'] = $value; $data['l'] = (int) $breakdownLength[$key]; $data['t'] = $breakdownType[$key]; $breakdowns[] = $data; } if (count($breakdowns) > 0) { $this->_appointmentTemplate->breakdown = serialize($breakdowns); } } $this->_appointmentTemplate->persist(); if ($appointmentTemplateId === 0 && $enumerationId !== 0) { $enumeration = new Enumeration(); $enumeration->enumerationId = $enumerationId; $enumeration->populate(); $enumeration->ormId = $this->_appointmentTemplate->appointmentTemplateId; $enumeration->persist(); } $this->view->message = __("Record saved successfully"); $this->render('edit'); }
public function indexAction() { $memcache = Zend_Registry::get('memcache'); $defaultQuickList = $memcache->get('defaultQuickList'); if ($defaultQuickList === false) { $defaultQuickList = array(); $defaultQuickList['type'] = 'mostRecent'; $defaultQuickList['id'] = 'mostRecent'; $defaultQuickList['text'] = 'Most Recent'; } else { $defaultQuickList = unserialize($defaultQuickList); } $this->view->defaultQuickList = $defaultQuickList; $this->view->quickList = $this->_getQuickList(); $providerIterator = new ProviderIterator(); $this->view->providerIterator = $providerIterator; $name = TeamMember::ENUM_PARENT_NAME; $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($name); $enumerationsClosure = new EnumerationsClosure(); $enumerationIterator = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); $this->view->teamList = $enumerationIterator; $this->render(); }
public function _setActivePatient($personId, $visitId) { if (!$personId > 0) { return; } $memcache = Zend_Registry::get('memcache'); $patient = new Patient(); $patient->personId = (int) $personId; $patient->populate(); $patient->person->populate(); $this->_patient = $patient; $this->view->patient = $this->_patient; $mostRecentRaw = $memcache->get('mostRecent'); $currentUserId = (int) Zend_Auth::getInstance()->getIdentity()->personId; $personId = $patient->personId; $teamId = $patient->teamId; if ($mostRecentRaw === false) { $mostRecent = array(); } else { $mostRecent = unserialize($mostRecentRaw); } if (!array_key_exists($currentUserId, $mostRecent)) { $mostRecent[$currentUserId] = array(); } if (array_key_exists($personId, $mostRecent[$currentUserId])) { unset($mostRecent[$currentUserId][$personId]); } $name = $patient->person->last_name . ', ' . $patient->person->first_name . ' ' . substr($patient->person->middle_name, 0, 1) . ' #' . $patient->record_number; $mostRecent[$currentUserId][$patient->personId] = array('name' => $name, 'teamId' => $teamId); $memcache->set('mostRecent', serialize($mostRecent)); if (strlen($patient->teamId) > 0) { $name = TeamMember::ENUM_PARENT_NAME; $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($name); $enumerationsClosure = new EnumerationsClosure(); $rowset = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); $patientEnumerationId = 0; foreach ($rowset as $row) { if ($patient->teamId == $row->key) { $patientEnumerationId = $row->enumerationId; break; } } if ($patientEnumerationId !== 0) { $this->view->team = TeamMember::generateTeamTree($patientEnumerationId); } } // POSTINGS $allergies = array(); $patientAllergy = new PatientAllergy(); $patientAllergyIterator = $patientAllergy->getIteratorByPatient($personId); foreach ($patientAllergyIterator as $allergy) { if ($allergy->noKnownAllergies) { continue; } $allergies[] = $allergy->toArray(); } $this->view->allergies = $allergies; $notes = array(); $patientNote = new PatientNote(); $patientNoteIterator = $patientNote->getIterator(); $filters = array(); $filters['patient_id'] = $personId; $filters['active'] = 1; $filters['posting'] = 1; $patientNoteIterator->setFilters($filters); foreach ($patientNoteIterator as $note) { $notes[] = $note->toArray(); } $this->view->notes = $notes; //REMINDERS $ctr = 0; $hsa = new HealthStatusAlert(); $hsaIterator = $hsa->getIteratorByStatusWithPatientId('active', $personId); foreach ($hsaIterator as $row) { $ctr++; } if ($ctr > 0) { $this->view->reminders = $ctr; } // VISITS //$this->_visit = null; if (!$visitId > 0) { return; } $visit = new Visit(); $visit->encounter_id = (int) $visitId; $visit->populate(); $this->_visit = $visit; $this->view->visit = $this->_visit; }
/** * @return LogLevel **/ public function setId($id) { Assert::isNull($this->id, 'i am immutable one!'); return parent::setId($id); }
public function addAction() { $this->_patientNote = new PatientAllergy(); $this->_patientNote->patientId = (int) $this->_getParam('personId'); $this->_patientNote->causativeAgent = $this->_getParam('allergy', ''); $this->_form = new WebVista_Form(array('name' => 'add')); $this->_form->setAction(Zend_Registry::get('baseUrl') . 'allergies.raw/process-add'); $this->_form->loadORM($this->_patientNote, 'allergy'); $this->_form->setWindow('winAddAllergyId'); $this->view->form = $this->_form; $patientNoteIterator = $this->_patientNote->getIteratorByPatient(); $ctr = 0; foreach ($patientNoteIterator as $allergy) { $ctr++; } $this->view->disableNoKnownAllergies = $ctr > 0 ? true : false; $listReactionTypes = array('' => ''); $enumeration = new Enumeration(); $enumeration->populateByEnumerationName(PatientAllergy::ENUM_REACTION_TYPE_PARENT_NAME); $enumerationsClosure = new EnumerationsClosure(); $enumerationIterator = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); $ctr = 0; foreach ($enumerationIterator as $enum) { $listReactionTypes[$enum->key] = $enum->name; } $this->view->listReactionTypes = $listReactionTypes; $listSeverities = array('' => ''); $enumeration->populateByEnumerationName(PatientAllergy::ENUM_SEVERITY_PARENT_NAME); $enumerationsClosure = new EnumerationsClosure(); $enumerationIterator = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); $ctr = 0; foreach ($enumerationIterator as $enum) { $listSeverities[$enum->key] = $enum->name; } $this->view->listSeverities = $listSeverities; $listSymptoms = array(); $enumeration->populateByEnumerationName(PatientAllergy::ENUM_SYMPTOM_PARENT_NAME); $enumerationsClosure = new EnumerationsClosure(); $enumerationIterator = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); $ctr = 0; foreach ($enumerationIterator as $enum) { $listSymptoms[$enum->key] = $enum->name; } $this->view->listSymptoms = $listSymptoms; $listObservers = array('' => ''); $providerIterator = new ProviderIterator(); foreach ($providerIterator as $provider) { $listObservers[$provider->personId] = $provider->displayName; } $this->view->listObservers = $listObservers; $this->render('add'); }
public function ajaxGetMenuAction() { $menus = array(); $menus[] = array('text' => __('Add Column'), 'id' => 'add_column'); $menus[] = array('text' => __('Remove This Column'), 'id' => 'remove_column'); $menus[] = array('text' => __('Select Date'), 'id' => 'select_date'); $menus[] = array('text' => __('Edit This Appointment'), 'id' => 'edit_appointment'); $menus[] = array('text' => __('Create Visit'), 'id' => 'create_visit'); $menus[] = array('text' => __('Add Payment'), 'id' => 'add_payment'); $menus[] = array('text' => __('Cancel Move'), 'id' => 'cancel_move'); $menus[] = array('text' => __('Find First'), 'id' => 'find_first'); $menus[] = array('text' => __('Time Search'), 'id' => 'timeSearch'); $this->view->menus = $menus; $this->view->stations = Enumeration::getEnumArray(Routing::ENUM_PARENT_NAME); header('Content-Type: application/xml;'); $this->render('ajax-get-menu'); }
/** * @param string $id one of DBType constants * @param boolean $nullable optional whether type is nullable; default is NOT NULL * @param int|null $size size of a type, if the type can have size; by default size is not set * @param int|null $precision precision of a type, if the type can have precision; by default precision is not set * @param int|null $scale scale of a type, if the type can have scale; by default scale is not set * @param boolean $generated whether type can be generated by the database; by default is not */ function __construct($id, $nullable = false, $size = null, $precision = null, $scale = null, $generated = false) { parent::__construct($id); $this->setIsNullable($nullable); if ($this->canHaveSize()) { $this->setSize($size); } else { if ($this->canHavePrecision()) { $this->setPrecision($precision); if ($this->canHaveScale()) { $this->setScale($scale); } } } if ($this->canBeGenerated()) { $this->setGenerated($generated); } }
public function getDisplayMaritalStatus() { static $maritalStatuses = null; if ($maritalStatuses === null) { $maritalStatuses = Enumeration::getEnumArray('Marital Status', 'key'); } $maritalStatus = $this->marital_status; if (isset($maritalStatuses[$maritalStatus])) { $maritalStatus = $maritalStatuses[$maritalStatus]; } return $maritalStatus; }
public static function getListInsurancePreferences() { $enumeration = new Enumeration(); $enumeration->populateByUniqueName(self::INSURANCE_ENUM_NAME); $enumerationsClosure = new EnumerationsClosure(); $enumerationIterator = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); $ret = array(); foreach ($enumerationIterator as $enum) { $ret[$enum->key] = $enumerationsClosure->getAllDescendants($enum->enumerationId, 1)->toArray('key', 'name'); } return $ret; }
public function setUp() { parent::setUp(); Enumeration::generateTestData(true); }
private function _populateAndPersist($class, $id, $data, $enumerationId) { // this method assumes that is being called in this controller only and that $class is valid and exists $orm = new $class(); if ($id > 0) { $orm->id = $id; $orm->populate(); } $orm->populateWithArray($data); $orm->persist(); if (!$id > 0 && $enumerationId > 0) { $enumeration = new Enumeration(); $enumeration->enumerationId = $enumerationId; $enumeration->populate(); $enumeration->ormId = $orm->id; $enumeration->persist(); } return $orm; }
public function listAction() { $rows = array(); $guid = 'fac51e51-95fd-485e-a8f3-62e1228057ad'; $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); }