| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace app\api\dao\link;
- use app\api\actions\ZskkCache;
- use app\api\dao\ZskkDefaultDao;
- use app\api\model\exam\ExamModel;
- use app\api\model\institution\InstitutionModel;
- use app\api\model\report\ReportModel;
- /**
- * 后台控制器基类
- * 接口方法权限 必传参数 接口返回 错误抛出 通用参数处理
- */
- class LinkDao extends ZskkDefaultDao {
- protected $flag = true;
- protected $logName = "LinkDao";
- protected $institution;
- protected $examModel;
- protected $reportModel;
- public function __construct(InstitutionModel $institutionModel,ExamModel $examModel,ReportModel $reportModel)
- {
- parent::__construct();
- $this->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();
- }
- }
|