/** * Form now this is just getting the latest open encounter for all the patients. * * @param $params * @return array */ public function getPatientsByPoolAreaAccess($params) { $uid = is_object($params) ? $params->uid : $params; $this->acl = new ACL($uid); $patients = array(); if ($this->acl->hasPermission('use_pool_areas')) { if ($this->acl->hasPermission('access_poolcheckin')) { foreach ($this->getPatientsByPoolAreaId(1, 1) as $p) { $p['shortName'] = Person::ellipsis($p['name'], 20); $p['poolArea'] = 'Check In'; $p['photoSrc'] = $this->patient->getPatientPhotoSrcIdByPid($p['pid']); $p['floorPlanId'] = $this->getFloorPlanIdByPoolAreaId(1); $z = $this->getPatientCurrentZoneInfoByPid($p['pid']); $patients[] = empty($z) ? $p : array_merge($p, $z); } } if ($this->acl->hasPermission('access_pooltriage')) { foreach ($this->getPatientsByPoolAreaId(2, 1) as $p) { $p['shortName'] = Person::ellipsis($p['name'], 20); $p['poolArea'] = 'Triage'; $p['photoSrc'] = $this->patient->getPatientPhotoSrcIdByPid($p['pid']); $p['floorPlanId'] = $this->getFloorPlanIdByPoolAreaId(2); $z = $this->getPatientCurrentZoneInfoByPid($p['pid']); $patients[] = empty($z) ? $p : array_merge($p, $z); } } if ($this->acl->hasPermission('access_poolphysician')) { foreach ($this->getPatientsByPoolAreaId(3, 1) as $p) { $p['shortName'] = Person::ellipsis($p['name'], 20); $p['poolArea'] = 'Physician'; $p['photoSrc'] = $this->patient->getPatientPhotoSrcIdByPid($p['pid']); $p['floorPlanId'] = $this->getFloorPlanIdByPoolAreaId(3); $z = $this->getPatientCurrentZoneInfoByPid($p['pid']); $patients[] = empty($z) ? $p : array_merge($p, $z); } } if ($this->acl->hasPermission('access_poolcheckout')) { foreach ($this->getPatientsByPoolAreaId(4, 1) as $p) { $p['shortName'] = Person::ellipsis($p['name'], 20); $p['poolArea'] = 'Check Out'; $p['photoSrc'] = $this->patient->getPatientPhotoSrcIdByPid($p['pid']); $p['floorPlanId'] = $this->getFloorPlanIdByPoolAreaId(4); $z = $this->getPatientCurrentZoneInfoByPid($p['pid']); $patients[] = empty($z) ? $p : array_merge($p, $z); } } } $patients = array_slice($patients, 0, 6); return $patients; }
public function getEncounterSummary(stdClass $params) { $this->setEid($params->eid); $this->db->setSQL("SELECT e.*,\n\t\t\t\t\t\t\t\t p.fname,\n\t\t\t\t\t\t\t\t p.mname,\n\t\t\t\t\t\t\t\t p.lname,\n\t\t\t\t\t\t\t\t p.DOB,\n\t\t\t\t\t\t\t\t p.sex\n\t\t\t\t\t\t\t FROM encounters AS e\n\t\t\t\t\t LEFT JOIN patient_demographics AS p ON e.pid = p.pid\n\t\t\t\t\t\t\tWHERE e.eid = '{$params->eid}'"); $e = $this->db->fetchRecord(PDO::FETCH_ASSOC); $e['name'] = Person::fullname($e['fname'], $e['mname'], $e['lname']); $e['pic'] = $this->patient->getPatientPhotoSrcIdByPid($e['pid']); $e['age'] = $this->patient->getPatientAgeByDOB($e['DOB']); $this->addEncounterHistoryEvent('Encounter viewed'); if (!empty($e)) { return array('success' => true, 'encounter' => $e); } else { return array('success' => false, 'error' => "Encounter ID {$params->eid} not found"); } }