institution = $institutionModel; $this->examModel = $examModel; $this->reportModel = $reportModel; } public function getAllIns() { return $this->institution->cache('3600')->select(); } public function getinsExam() { return $this->examModel->field('count(*) AS num,institution_id')->group('institution_id')->select(); } public function getPacsDateExam() { $data = $this->examModel->field("TO_CHAR(TRUNC(createdat,'MM'),'yyyy/mm') AS month_begin, COUNT(*) AS row_cnt")->group("TO_CHAR(TRUNC(createdat,'MM'),'yyyy/mm')")->order('month_begin')->select(); return $data; } public function getPacsAgeExam() { $data = $this->examModel->field("age, COUNT(*) AS row_cnt")->group("age")->order('age')->select(); return $data; } public function countExam() { return $this->examModel->count(); } public function getSexData() { $arr = $this->examModel->group('sex')->field('sex,count(*) AS cnt')->select(); return $arr; } public function getReportResult() { return $this->examModel->alias('e')->join(['report'=>'r'],'r.exam_id=e.id','left')->field('r.report_result,count(*) AS cnt')->group('r.report_result')->select(); } public function getMiddleProjectList() { return $this->examModel->alias('e')->join(['institution'=>'i'],'i.id=e.institution_id')->field('i.name AS ORGNAME,e.EXAM_CLASS,e.NAME,e.EXAM_CLASS,e.CREATEDAT AS STUDYTIME,e.exam_project AS EXAM_ITEMNAME')->order('e.CREATEDAT desc')->limit(10)->select(); } }