LinkDao.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace app\api\dao\link;
  3. use app\api\actions\ZskkCache;
  4. use app\api\dao\ZskkDefaultDao;
  5. use app\api\model\exam\ExamModel;
  6. use app\api\model\institution\InstitutionModel;
  7. use app\api\model\report\ReportModel;
  8. /**
  9. * 后台控制器基类
  10. * 接口方法权限 必传参数 接口返回 错误抛出 通用参数处理
  11. */
  12. class LinkDao extends ZskkDefaultDao {
  13. protected $flag = true;
  14. protected $logName = "LinkDao";
  15. protected $institution;
  16. protected $examModel;
  17. protected $reportModel;
  18. public function __construct(InstitutionModel $institutionModel,ExamModel $examModel,ReportModel $reportModel)
  19. {
  20. parent::__construct();
  21. $this->institution = $institutionModel;
  22. $this->examModel = $examModel;
  23. $this->reportModel = $reportModel;
  24. }
  25. public function getAllIns()
  26. {
  27. return $this->institution->cache('3600')->select();
  28. }
  29. public function getinsExam()
  30. {
  31. return $this->examModel->field('count(*) AS num,institution_id')->group('institution_id')->select();
  32. }
  33. public function getPacsDateExam()
  34. {
  35. $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();
  36. return $data;
  37. }
  38. public function getPacsAgeExam()
  39. {
  40. $data = $this->examModel->field("age, COUNT(*) AS row_cnt")->group("age")->order('age')->select();
  41. return $data;
  42. }
  43. public function countExam()
  44. {
  45. return $this->examModel->count();
  46. }
  47. public function getSexData()
  48. {
  49. $arr = $this->examModel->group('sex')->field('sex,count(*) AS cnt')->select();
  50. return $arr;
  51. }
  52. public function getReportResult()
  53. {
  54. 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();
  55. }
  56. public function getMiddleProjectList()
  57. {
  58. 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();
  59. }
  60. }