/** * @param \stdClass $params * @internal param $pid * @return mixed */ public function currPatientSet(stdClass $params) { include_once $_SESSION['root'] . '/dataProvider/PoolArea.php'; $poolArea = new PoolArea(); $_SESSION['patient']['pid'] = $params->pid; $_SESSION['patient']['name'] = $this->getPatientFullNameByPid($params->pid); $p = $this->isPatientChartOutByPid($params->pid); $area = $poolArea->getCurrentPatientPoolAreaByPid($params->pid); if ($p === false || is_array($p) && $p['uid'] == $_SESSION['user']['id']) { $this->patientChartOutByPid($params->pid, $area['area_id']); $_SESSION['patient']['readOnly'] = false; } else { $_SESSION['patient']['readOnly'] = true; } return array('patient' => array('pid' => $params->pid, 'name' => $_SESSION['patient']['name'], 'pic' => $this->getPatientPhotoSrcIdByPid($params->pid), 'sex' => $this->getPatientSexByPid($params->pid), 'dob' => $dob = $this->getPatientDOBByPid($params->pid), 'age' => $this->getPatientAgeByDOB($dob), 'area' => $p === false ? null : $poolArea->getAreaTitleById($p['pool_area_id']), 'priority' => empty($area) ? null : $area['priority']), 'readOnly' => $_SESSION['patient']['readOnly'], 'overrideReadOnly' => $this->acl->hasPermission('override_readonly'), 'user' => $p === false ? null : $this->user->getUserFullNameById($p['uid']), 'area' => $p === false ? null : $poolArea->getAreaTitleById($p['pool_area_id'])); }
/** * @param $params * * @return array */ public function getPatientSetDataByPid($params) { include_once ROOT . '/dataProvider/PoolArea.php'; $this->setPatient($params->pid); $poolArea = new PoolArea(); $area = $poolArea->getCurrentPatientPoolAreaByPid($this->patient['pid']); $chart = $this->patientChartOutByPid($this->patient['pid'], $area['area_id']); return ['patient' => ['pid' => $this->patient['pid'], 'pubpid' => $this->patient['pubpid'], 'name' => $this->getPatientFullName(), 'pic' => $this->patient['image'], 'sex' => $this->getPatientSex(), 'dob' => $this->getPatientDOB(), 'age' => $this->getPatientAge(), 'area' => $area['poolArea'], 'priority' => empty($area) ? null : $area['priority'], 'rating' => isset($this->patient['rating']) ? $this->patient['rating'] : 0, 'record' => $this->patient], 'chart' => ['readOnly' => $chart->read_only == '1', 'overrideReadOnly' => $this->acl->hasPermission('override_readonly'), 'outUser' => isset($chart->outChart->uid) ? $this->user->getUserFullNameById($chart->outChart->uid) : 0, 'outArea' => isset($chart->outChart->pool_area_id) ? $poolArea->getAreaTitleById($chart->outChart->pool_area_id) : 0]]; }