DataBiServies.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. declare (strict_types=1);
  3. namespace app\admin\servies;
  4. use app\admin\servies\bi\BiExamServies;
  5. use app\admin\servies\bi\BiInspectServies;
  6. use app\admin\servies\bi\BiPatientServies;
  7. use Exception;
  8. class DataBiServies
  9. {
  10. /**
  11. * 患者主表模型
  12. */
  13. private $biPatientServies;
  14. /**
  15. * 检验主表模型
  16. */
  17. private $biInspectServies;
  18. /**
  19. * 检查主表模型
  20. */
  21. private $biExamServies;
  22. /**
  23. * 统计数据类型字典
  24. */
  25. private $TYPE_DICT = [
  26. "PATIENT" => 'patient',
  27. "EXAM" => 'exam',
  28. "INSPECT" => 'inspect',
  29. ];
  30. public function __construct(
  31. BiPatientServies $biPatientServies,
  32. BiInspectServies $biInspectServies,
  33. BiExamServies $biExamServies
  34. )
  35. {
  36. $this->biPatientServies = $biPatientServies;
  37. $this->biInspectServies = $biInspectServies;
  38. $this->biExamServies = $biExamServies;
  39. }
  40. /**
  41. * 获取数据概览返回数据
  42. */
  43. public function getBiData($params) {
  44. $type = $params['type'] ?? $this->TYPE_DICT['PATIENT'];
  45. switch ($type) {
  46. case $this->TYPE_DICT['PATIENT']:
  47. return $this->biPatientServies->getBiData($params);
  48. case $this->TYPE_DICT['EXAM']:
  49. return $this->biExamServies->getBiData($params);
  50. case $this->TYPE_DICT['INSPECT']:
  51. return $this->biInspectServies->getBiData($params);
  52. }
  53. throw new Exception("数据统计类型异常");
  54. }
  55. }