public function actionIndex() { $this->currentMenu = '1000'; // 获取病历总条数 // 限制医院权限 $mHospital = $this->_userInfo['hospital']; $shareModel = new ShareModel(); $shareSet = $shareModel->getTargetSetByCode($mHospital); if ($shareSet) { $inArray = array_keys($shareSet); } $hospitalModel = new ConfigModel(); $allHos = $hospitalModel->getSetByType(Yii::app()->params['configType']['HOSPITAL']); $hospitals = $allHos; //查询 $c = new CDbCriteria(); if ($this->_userInfo['role'] > 0) { $c->addInCondition('HOSPITAL', $inArray); $hospitals = array(); foreach ($inArray as $value) { $hospitals[$value] = $allHos[$value]; } } $hospitalModel = new ConfigModel(); $hospitals = $hospitalModel->getSetByType(Yii::app()->params['configType']['HOSPITAL']); $jcxxModel = new JcxxModel(); //总数 $total = $jcxxModel->count($c); $totals = $jcxxModel->getPatientGroupTotal(); $data = array(); if ($totals) { foreach ($totals as $value) { $item = array(); $item['value'] = $value['total']; $item['label'] = $hospitals[$value['hospital']]; $item['color'] = '#F7464A'; $item['highlight'] = '#FF5A5E'; $data[] = $item; } } $this->render('index', array('userinfo' => $this->_userInfo, 'total' => $total, 'data' => json_encode($data), 'hospitals' => $hospitals)); }
private function getPatientCode() { $code = $_SESSION['pid']; if (!isset($code)) { // 获取数据库中最大的patientid $patientModel = new JcxxModel(); $patient = $patientModel->getMaxPatientCode(); if ($patient) { $code = $patient['CODE']; } } if (!isset($code)) { $code = date('Ymd', time()) . '0001'; } else { // echo $code; // exit; $date = substr($code, 0, 8); if ($date == date('Ymd', time())) { $sequence = intval(substr($code, 9)); $sequence += 10001; $code = $date . substr(strval($sequence), 1); } else { $code = date('Ymd', time()) . '0001'; } } $_SESSION['pid'] = $code; return $code; }