public function getAmendments($params) { Matcha::pauseLog(true); $records = $this->a->load($params)->leftJoin(['title' => 'response_title', 'fname' => 'response_fname', 'mname' => 'response_mname', 'lname' => 'response_lname'], 'users', 'response_uid', 'id')->all(); Matcha::pauseLog(false); return $records; }
public function updateSession() { $id = $_SESSION['session_id']; $last_request = $_SESSION['inactive']['timeout'] = time(); Matcha::pauseLog(true); $conn = Matcha::getConn(); $conn->exec("UPDATE `users_sessions` SET `last_request` = '{$last_request}' WHERE `id` = '{$id}'"); Matcha::pauseLog(false); return true; }
public function setLog(stdClass $params) { $params->date = date('Y-m-d H:i:s'); $params->fid = $_SESSION['user']['facility']; $params->uid = $_SESSION['user']['id']; Matcha::pauseLog(true); $record = $this->l->save($params); Matcha::pauseLog(false); return $record; }
public function updateSession() { $data = new stdClass(); $data->id = $_SESSION['session_id']; $data->last_request = $_SESSION['inactive']['timeout'] = time(); Matcha::pauseLog(true); $this->s->save($data); Matcha::pauseLog(false); unset($data); return true; }
private function setRules($alertType, $category = 'C') { $params = new stdClass(); $params->filter[0] = new stdClass(); $params->filter[0]->property = 'active'; $params->filter[0]->value = 1; $params->filter[1] = new stdClass(); $params->filter[1]->property = 'alert_type'; $params->filter[1]->value = $alertType; $params->filter[2] = new stdClass(); $params->filter[2]->property = 'category'; $params->filter[2]->value = $category; $this->rules = $this->getDecisionSupportRules($params); $this->rules = $this->rules['data']; // unset filter[2] to use $params to filter concepts unset($params->filter[2]); // change property to filter concepts $params->filter[0]->property = 'rule_id'; $params->filter[1]->property = 'concept_type'; Matcha::pauseLog(true); foreach ($this->rules as $i => $rule) { $params->filter[0]->value = $rule['id']; $params->filter[1]->value = 'PROC'; $this->rules[$i]['concepts']['PROC'] = $this->getDecisionSupportRuleConcepts($params); $params->filter[1]->value = 'PROB'; $this->rules[$i]['concepts']['PROB'] = $this->getDecisionSupportRuleConcepts($params); $params->filter[1]->value = 'SOCI'; $this->rules[$i]['concepts']['SOCI'] = $this->getDecisionSupportRuleConcepts($params); $params->filter[1]->value = 'MEDI'; $this->rules[$i]['concepts']['MEDI'] = $this->getDecisionSupportRuleConcepts($params); $params->filter[1]->value = 'ALLE'; $this->rules[$i]['concepts']['ALLE'] = $this->getDecisionSupportRuleConcepts($params); $params->filter[1]->value = 'LAB'; $this->rules[$i]['concepts']['LAB'] = $this->getDecisionSupportRuleConcepts($params); $params->filter[1]->value = 'VITA'; $this->rules[$i]['concepts']['VITA'] = $this->getDecisionSupportRuleConcepts($params); } // unset params since will not be use again unset($params); Matcha::pauseLog(false); }
/** * Form now this is just getting the latest open encounter for all the patients. * * @param $params * * @return array */ public function getPatientsByPoolAreaAccess($params) { Matcha::pauseLog(true); if (is_numeric($params)) { $uid = $params; } elseif (!is_numeric($params) && isset($params->eid)) { $uid = $params->eid; } elseif (!isset($_SESSION['user']['id'])) { return []; } else { $uid = $_SESSION['user']['id']; } $this->acl = new ACL($uid); $pools = []; if ($this->acl->hasPermission('use_pool_areas')) { $this->setPatient(); $activeAreas = $this->getFacilityActivePoolAreas(); $areas = []; $pools = []; if (!empty($activeAreas)) { foreach ($activeAreas as $activeArea) { if ($activeArea['id'] == 1 && $this->acl->hasPermission('access_poolcheckin') || $activeArea['id'] == 2 && $this->acl->hasPermission('access_pooltriage') || $activeArea['id'] == 3 && $this->acl->hasPermission('access_poolphysician') || $activeArea['id'] == 4 && $this->acl->hasPermission('access_poolcheckout')) { $areas[] = 'pp.area_id = \'' . $activeArea['id'] . '\''; } } $whereAreas = '(' . implode(' OR ', $areas) . ')'; $sql = "SELECT pp.*, p.fname, p.lname, p.mname, pa.title\n\t\t\t\t\t FROM `patient_pools` AS pp\n\t\t\t\t LEFT JOIN `patient` AS p ON pp.pid = p.pid\n\t\t\t\t LEFT JOIN `pool_areas` AS pa ON pp.area_id = pa.id\n\t\t\t\t WHERE {$whereAreas}\n\t\t\t\t\t AND pp.time_out IS NULL\n\t\t\t\t\t AND pp.in_queue = '1'\n\t\t\t ORDER BY pp.time_in\n\t\t\t LIMIT 25"; $patientPools = $this->pa->sql($sql)->all(); $pools = []; foreach ($patientPools as $patientPool) { $patientPool['name'] = ($patientPool['eid'] != null ? '*' : '') . Person::fullname($patientPool['fname'], $patientPool['mname'], $patientPool['lname']); $patientPool['shortName'] = Person::ellipsis($patientPool['name'], 15); $patientPool['poolArea'] = $patientPool['title']; $patientPool['patient'] = $this->patient->getPatientDemographicDataByPid($patientPool['pid']); $patientPool['floorPlanId'] = $this->getFloorPlanIdByPoolAreaId($patientPool['area_id']); $z = $this->getPatientCurrentZoneInfoByPid($patientPool['pid']); $pools[] = empty($z) ? $patientPool : array_merge($patientPool, $z); } $pools = array_slice($pools, 0, 25); } } Matcha::pauseLog(false); return $pools; }
/** * this method will insert the new active modules in site database if * does not exist */ private function setNewModules() { Matcha::pauseLog(true); foreach (FileManager::scanDir($this->modulesDir) as $module) { $ModuleConfig = $this->getModuleConfig($module); if ($ModuleConfig['active']) { $moduleRecord = $this->m->load(['name' => $ModuleConfig['name']])->one(); if (empty($moduleRecord)) { $data = new stdClass(); $data->title = $ModuleConfig['title']; $data->name = $ModuleConfig['name']; $data->description = $ModuleConfig['description']; $data->enable = '0'; $data->installed_version = $ModuleConfig['version']; $this->m->save($data); } } } Matcha::pauseLog(false); return; }