protected function _getProcedures() { $ret = array(); $name = PatientProcedure::ENUM_PARENT_NAME; $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($name); $enumerationsClosure = new EnumerationsClosure(); $enumerationIterator = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); $ret = $enumerationIterator->toJsonArray('enumerationId', array('name')); return $ret; }
protected function _getEnumerationByName($name) { $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($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 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 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 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 static function populate(CCD $base, SimpleXMLElement $xml) { $component = $xml->addChild('component'); $section = $component->addChild('section'); $templateId = $section->addChild('templateId'); $templateId->addAttribute('root', '2.16.840.1.113883.3.88.11.83.102'); $templateId->addAttribute('assigningAuthorityName', 'HITSP/C83'); $templateId = $section->addChild('templateId'); $templateId->addAttribute('root', '1.3.6.1.4.1.19376.1.5.3.1.3.13'); $templateId->addAttribute('assigningAuthorityName', 'IHE PCC'); $templateId = $section->addChild('templateId'); $templateId->addAttribute('root', '2.16.840.1.113883.10.20.1.2'); $templateId->addAttribute('assigningAuthorityName', 'HL7 CCD'); // <!--Allergies/Reactions section template--> $code = $section->addChild('code'); $code->addAttribute('code', '48765-2'); $code->addAttribute('codeSystem', '2.16.840.1.113883.6.1'); $code->addAttribute('codeSystemName', 'LOINC'); $code->addAttribute('displayName', 'Allergies'); $section->addChild('title', 'Allergies and Adverse Reactions'); $enumeration = new Enumeration(); $listSymptoms = array(); $enumeration->populateByEnumerationName(PatientAllergy::ENUM_SYMPTOM_PARENT_NAME); $enumerationsClosure = new EnumerationsClosure(); $enumerationIterator = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); foreach ($enumerationIterator as $enum) { $listSymptoms[$enum->key] = $enum->name; } $filters = array('patientId' => $base->patient->personId); $base->setFiltersDateRange($filters); $rows = array(); $allergies = PatientAllergy::listMedicationAllergies($filters); foreach ($allergies as $key => $allergy) { $exp = explode(',', $allergy['symptoms']); $symptoms = array(); foreach ($exp as $symp) { $symptoms[] = isset($listSymptoms[$symp]) ? $listSymptoms[$symp] : ''; } $reactionType = $allergy['reactionType']; if (!strlen($reactionType) > 0) { $reactionType = 'Unknown'; } $active = (int) $allergy['active'] ? 'Active' : 'Inactive'; $snomed = ''; $row = array(); $row['type'] = $reactionType; //'Drug Allergy'; if ($reactionType == 'Specific Drug Allergy') { $snomed = '416098002'; } $row['snomed'] = $snomed; $row['substance'] = html_convert_entities($allergy['causativeAgent']); $row['rxnorm'] = html_convert_entities($allergy['rxnorm_cuid']); $row['reaction'] = array('id' => 'ReactionID-' . $key, 'value' => html_convert_entities(implode(', ', $symptoms))); $row['date'] = date('M d, Y', strtotime($allergy['dateTimeReaction'])); $row['status'] = html_convert_entities($active); $rows[] = $row; } /* -**SNOMED Allergy Type Code** (note from NIST: "The SNOMED Allergy Type Code is required by HITSP/C83, which is a component of the HITSP/C32 implementation guide specified by ONC in the Final Rule") -**Medication/Agent Allergy** (including medication/agent allergy and associated RxNorm code) */ $text = $section->addChild('text'); if ($rows) { $table = $text->addChild('table'); $thead = $table->addChild('thead'); $tr = $thead->addChild('tr'); $tr->addChild('th', 'Type'); $tr->addChild('th', 'Drug allergy SNOMED code'); $tr->addChild('th', 'Substance'); $tr->addChild('th', 'Substance RxNorm code'); $tr->addChild('th', 'Reaction'); $tr->addChild('th', 'Date Identified'); $tr->addChild('th', 'Status'); $tbody = $table->addChild('tbody'); foreach ($rows as $row) { $tr = $tbody->addChild('tr'); $tr->addChild('td', $row['type']); $tr->addChild('td', $row['snomed']); $tr->addChild('td', $row['substance']); $tr->addChild('td', $row['rxnorm']); $td = $tr->addChild('td', $row['reaction']['value']); $td->addAttribute('ID', $row['reaction']['id']); $tr->addChild('td', $row['date']); $tr->addChild('td', $row['status']); } } foreach ($allergies as $allergy) { $type = $allergy['reactionType']; if (!strlen($type) > 0) { $type = 'Unknown'; } $substance = html_convert_entities($allergy['causativeAgent']); $exp = explode(',', $allergy['symptoms']); $symptoms = array(); foreach ($exp as $symp) { $symptoms[] = isset($listSymptoms[$symp]) ? $listSymptoms[$symp] : ''; } $reaction = ''; if ($symptoms) { $reaction = html_convert_entities(implode(', ', $symptoms)); } $status = 'Inactive'; $statusCode = 'completed'; $effectiveTimeHigh = '<high nullFlavor="UNK"/>'; if ((int) $allergy['active']) { $status = 'Active'; $statusCode = 'active'; $effectiveTimeHigh = ''; } $status = (int) $allergy['active'] ? 'Active' : 'Inactive'; // STATUS CODES: active, suspended, aborted, completed $statusCode = (int) $allergy['active'] ? 'active' : 'completed'; $entry = '<act classCode="ACT" moodCode="EVN"> <templateId root="2.16.840.1.113883.3.88.11.83.6" assigningAuthorityName="HITSP C83"/> <templateId root="2.16.840.1.113883.10.20.1.27" assigningAuthorityName="CCD"/> <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.5.1" assigningAuthorityName="IHE PCC"/> <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.5.3" assigningAuthorityName="IHE PCC"/> <id root="' . NSDR::create_guid() . '"/> <code nullFlavor="NA"/> <statusCode code="' . $statusCode . '"/> <effectiveTime> <low nullFlavor="UNK"/>' . $effectiveTimeHigh . ' </effectiveTime> <entryRelationship typeCode="SUBJ" inversionInd="false"> <observation classCode="OBS" moodCode="EVN"> <templateId root="2.16.840.1.113883.10.20.1.18" assigningAuthorityName="CCD"/> <templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/> <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.5" assigningAuthorityName="IHE PCC"/> <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.6" assigningAuthorityName="IHE PCC"/> <id root="' . NSDR::create_guid() . '"/> <code code="416098002" codeSystem="2.16.840.1.113883.6.96" displayName="drug allergy" codeSystemName="SNOMED CT" /> <text> <reference value="PtrToValueInSectionText"/> </text> <statusCode code="completed"/> <effectiveTime> <low nullFlavor="UNK"/> </effectiveTime> <value xsi:type="CD"/> <participant typeCode="CSM"> <participantRole classCode="MANU"> <addr/> <telecom/> <playingEntity classCode="MMAT"> <code code="70618" codeSystem="2.16.840.1.113883.6.88" displayName="' . $substance . '"> <originalText> <reference value="PointrToSectionText"/> </originalText> </code> <name>' . $substance . '</name> </playingEntity> </participantRole>'; if ($reaction != '' && false) { $entry .= ' <entryRelationship typeCode="MFST" inversionInd="true"> <observation classCode="OBS" moodCode="EVN"> <templateId root="2.16.840.1.113883.10.20.1.54" assigningAuthorityName="CCD"/> <!--Reaction observation template --> <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4"/> <text/> <statusCode code="completed"/> <value xsi:type="CD" code="247472004" codeSystem="2.16.840.1.113883.6.96" displayName="' . $reaction . '"/> <entryRelationship typeCode="SUBJ"> <observation classCode="OBS" moodCode="EVN"> <templateId root="2.16.840.1.113883.10.20.1.55" assigningAuthorityName="CCD"/> <code code="SEV" displayName="Severity" codeSystemName="HL7 ActCode" codeSystem="2.16.840.1.113883.5.4"/> <text>Required by HITSP C-83</text> <statusCode code="completed"/> <value xsi:type="CE" displayName="moderate" code="6736007" codeSystemName="SNOMED" codeSystem="2.16.840.1.113883.6.96"/> </observation> </entryRelationship> </observation> </entryRelationship>'; } $entry .= ' <!--<entryRelationship typeCode="REFR"> <observation classCode="OBS" moodCode="EVN"> <templateId root="2.16.840.1.113883.10.20.1.39"/> <code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/> <statusCode code="completed"/> <value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="' . $status . '"/> </observation> </entryRelationship>--> </participant> </observation> </entryRelationship> </act>'; $entry = $section->addChild('entry', $entry); $entry->addAttribute('typeCode', 'DRIV'); } }
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 _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; }
public function selectAction() { $patientId = (int) $this->_getParam("patientId"); $patient = new Patient(); $patient->personId = $patientId; $patient->populate(); $patient->person->populate(); $hasTeam = false; if (strlen($patient->teamId) > 0) { $hasTeam = true; } $name = TeamMember::ENUM_PARENT_NAME; $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($name); $enumerationsClosure = new EnumerationsClosure(); $rowset = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); $teamList = array('' => ''); //trigger_error('sql: '.$dbSelect->__toString(),E_USER_NOTICE); $patientEnumerationId = 0; foreach ($rowset as $row) { if ($patient->teamId == $row->key) { $patientEnumerationId = $row->enumerationId; } $teamList[$row->key] = $row->name; } $this->view->teamList = $teamList; $this->view->hasTeam = $hasTeam; //$this->view->hasTeam = true; $this->view->patient = $patient; $teamMemberList = ''; if ($patientEnumerationId !== 0) { $teamMemberList = TeamMember::generateTeamTree($patientEnumerationId); } $this->view->teamMemberList = $teamMemberList; $this->render(); }
public function editMedicationAction() { $personId = (int) $this->_getParam('personId'); $medicationId = (int) $this->_getParam('medicationId'); $copy = $this->_getParam('copy'); $patient = new Patient(); $patient->personId = $personId; $patient->populate(); if (strlen($copy) > 0) { $this->view->copy = $copy; } $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->adminSchedules = $adminSchedules; $this->view->chBaseMed24Url = Zend_Registry::get('config')->healthcloud->CHMED->chBaseMed24Url; $this->view->chBaseMed24DetailUrl = Zend_Registry::get('config')->healthcloud->CHMED->chBaseMed24DetailUrl; $this->_form = new WebVista_Form(array('name' => 'new-medication')); $this->_form->setAction(Zend_Registry::get('baseUrl') . "medications.raw/process-add-medication"); $this->_medication = new Medication(); $this->_medication->personId = $personId; if ($medicationId > 0) { $this->_medication->medicationId = (int) $medicationId; $this->_medication->populate(); } if (!strlen($this->_medication->pharmacyId) > 0) { $this->_medication->pharmacyId = $patient->defaultPharmacyId; } if (strlen($copy) > 0) { $this->_medication->medicationId = 0; } $this->_form->loadORM($this->_medication, "Medication"); $this->_form->setWindow('windowNewMedication'); $this->view->form = $this->_form; $this->view->medication = $this->_medication; $this->render('new-medication'); }
public function examsAction() { $name = PatientExam::ENUM_RESULT_PARENT_NAME; $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($name); $enumerationsClosure = new EnumerationsClosure(); $enumerationIterator = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); foreach ($enumerationIterator as $enumeration) { $listResults[$enumeration->key] = $enumeration->name; } $this->view->listResults = $listResults; $this->render(); }
public static function getColorList() { $name = self::ENUM_COLORS_NAME; $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($name); $enumeration->populate(); $enumerationsClosure = new EnumerationsClosure(); $descendants = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); $colors = array(); foreach ($descendants as $descendant) { $colors[$descendant->key] = $descendant->name; } return $colors; }
public function ajaxListInteractionsAction() { $severeNotify = PermissionTemplate::hasPermission('medication-alerts', 'severe-notification') ? true : false; $criticalNotify = PermissionTemplate::hasPermission('medication-alerts', 'critical-notification') ? true : false; $allergyNotify = PermissionTemplate::hasPermission('medication-alerts', 'allergy-notification') ? true : false; $personId = (int) $this->_getParam('personId'); $md5 = preg_replace('/[^A-Za-z0-9]/', '', $this->_getParam('md5')); $vaclass = preg_replace('/[^A-Za-z0-9]/', '', $this->_getParam('vaclass')); // regular allergies search $interactionIterator = new BaseMed24InteractionIterator(); $interactionIterator->setFilters(array('personId' => $personId, 'md5' => $md5)); $regularAllergies = $interactionIterator->toJsonArray('hipaa_ndc', array('tradename', 'fda_drugname', 'notice')); $tmpArray = $regularAllergies; $regularAllergies = array(); foreach ($tmpArray as $key => $value) { // notice: S, C, Y, ^ if (!$severeNotify && $value['data'][2] == 'SIGNIFICANT' || !$criticalNotify && $value['data'][2] == 'CRITICAL') { continue; } $regularAllergies[] = $value; } $listSymptoms = array(); $enumeration = new Enumeration(); $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; } $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; } // drug class search $patientAllergyIterator = new PatientAllergyIterator(); $patientAllergyIterator->setFilters(array('patientId' => $personId, 'enteredInError' => 0, 'drugAllergy' => $vaclass, 'reactionType' => 'Drug Class Allergy')); $drugClassAllergies = array(); foreach ($patientAllergyIterator as $allergy) { if (!$allergyNotify) { break; } /*if ((!$severeNotify && $allergy->severity == 'SEVERE') || (!$criticalNotify && $allergy->severity == 'MOD')) continue;*/ $symptoms = explode(',', $allergy->symptoms); $symptom = array(); foreach ($symptoms as $sym) { $symptom[] = $listSymptoms[$sym]; } $tmpArray = array(); $tmpArray['id'] = $allergy->patientAllergyId; $tmpArray['data'][] = $allergy->causativeAgent; $tmpArray['data'][] = $allergy->reactionType; $tmpArray['data'][] = $listSeverities[$allergy->severity] . ' - ' . implode(',', $symptom); $drugClassAllergies[] = $tmpArray; } // specific drug search $patientAllergyIterator->setFilters(array('patientId' => $personId, 'enteredInError' => 0, 'drugAllergy' => $md5, 'reactionType' => 'Specific Drug Allergy')); $specificDrugAllergies = array(); foreach ($patientAllergyIterator as $allergy) { if (!$allergyNotify) { break; } /*if ((!$severeNotify && $allergy->severity == 'SEVERE') || (!$criticalNotify && $allergy->severity == 'MOD')) continue;*/ $symptoms = explode(',', $allergy->symptoms); $symptom = array(); foreach ($symptoms as $sym) { $symptom[] = $listSymptoms[$sym]; } $tmpArray = array(); $tmpArray['id'] = $allergy->patientAllergyId; $tmpArray['data'][] = $allergy->causativeAgent; $tmpArray['data'][] = $allergy->reactionType; $tmpArray['data'][] = $listSeverities[$allergy->severity] . ' - ' . implode(',', $symptom); $specificDrugAllergies[] = $tmpArray; } $interactions = array_merge_recursive($regularAllergies, $drugClassAllergies, $specificDrugAllergies); $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct(array('rows' => $interactions)); }
public function hsaJsonAction() { $enumeration = new Enumeration(); $enumeration->populateByEnumerationName(HealthStatusAlert::ENUM_PARENT_NAME); $enumerationsClosure = new EnumerationsClosure(); $enumerationIterator = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); $rows = $enumerationIterator->toJsonArray('enumerationId', array('name')); $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct(array('rows' => $rows), true); }
public static function enumerationToJson($name) { $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($name); $enumerationsClosure = new EnumerationsClosure(); $enumerationIterator = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); return $enumerationIterator->toJsonArray('enumerationId', array('name')); }
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 static function _getEnumerationIterator($name) { $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($name); $enumeration->populate(); $enumerationsClosure = new EnumerationsClosure(); return $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1); }