Bi.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <?php
  2. namespace app\index\controller;
  3. use app\common\controller\Frontend;
  4. use think\Lang;
  5. use app\index\service\BiService;
  6. use think\Response;
  7. /**
  8. * Ajax异步请求接口
  9. * @internal
  10. */
  11. class Bi extends Frontend
  12. {
  13. protected $noNeedLogin = ['lang'];
  14. protected $noNeedRight = ['*'];
  15. protected $layout = '';
  16. public $institution = '';
  17. public function __construct()
  18. {
  19. $this->institution = '43600001';
  20. header('Access-Control-Allow-Origin:*');//允许跨域
  21. if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
  22. header('Access-Control-Allow-Headers:x-requested-with,content-type,token');//浏览器页面ajax跨域请求会请求2次,第一次会发送OPTIONS预请求,不进行处理,直接exit返回,但因为下次发送真正的请求头部有带token,所以这里设置允许下次请求头带token否者下次请求无法成功
  23. }
  24. }
  25. // 获取医院id
  26. public function _getInstitutionId()
  27. {
  28. return $this->institution;
  29. }
  30. // 成功返回封装函数
  31. public function _success($data)
  32. {
  33. return new Response(json_encode([
  34. "code" => 0,
  35. "data" => $data
  36. ]));
  37. }
  38. // 当前20条检查数据
  39. public function getExams(BiService $service)
  40. {
  41. return $this->_success($service->getExams($this->_getInstitutionId()));
  42. }
  43. // 七天检查数据 弃用 ?
  44. public function getStudy(BiService $service)
  45. {
  46. return $this->_success($service->getStudy($this->_getInstitutionId()));
  47. }
  48. // 七天远程诊断数据 弃用 ?
  49. public function getRemote(BiService $service) {
  50. return $this->_success($service->getRemote($this->_getInstitutionId()));
  51. }
  52. // 七天远程阳性数据 弃用 ?
  53. public function getPositive(BiService $service) {
  54. return $this->_success($service->getPositive($this->_getInstitutionId()));
  55. }
  56. // 科室检查统计
  57. public function getModality(BiService $service)
  58. {
  59. return $this->_success($service->getModality($this->_getInstitutionId()));
  60. }
  61. // 科室检查统计
  62. public function getModalityToday(BiService $service)
  63. {
  64. return $this->_success($service->getModalityToday($this->_getInstitutionId()));
  65. }
  66. // 科室检查统计
  67. public function getDepartment(BiService $service)
  68. {
  69. return $this->_success($service->getDepartment($this->_getInstitutionId()));
  70. }
  71. // 科室检查统计
  72. public function getDepartmentToday(BiService $service)
  73. {
  74. return $this->_success($service->getDepartmentToday($this->_getInstitutionId()));
  75. }
  76. // 患者年龄统计
  77. public function getAge(BiService $service)
  78. {
  79. return $this->_success($service->getAge($this->_getInstitutionId()));
  80. }
  81. // 患者年龄统计
  82. // todo
  83. public function getAgeToday(BiService $service)
  84. {
  85. return $this->_success($service->getAgeToday($this->_getInstitutionId()));
  86. }
  87. // 主页数据
  88. public function getMain(BiService $service)
  89. {
  90. return $this->_success($service->getMain($this->_getInstitutionId()));
  91. }
  92. // 主页数据
  93. public function getMainToday(BiService $service)
  94. {
  95. return $this->_success($service->getMainToday($this->_getInstitutionId()));
  96. }
  97. // 运营数据
  98. public function getOperate(BiService $service)
  99. {
  100. return $this->_success($service->getOperate($this->_getInstitutionId()));
  101. }
  102. // 运营数据
  103. public function getOperateToday(BiService $service)
  104. {
  105. return $this->_success($service->getOperateToday($this->_getInstitutionId()));
  106. }
  107. // 检查部位
  108. public function getArea(BiService $service)
  109. {
  110. return $this->_success($service->getArea($this->_getInstitutionId()));
  111. }
  112. // 检查部位
  113. public function getAreaToday(BiService $service)
  114. {
  115. return $this->_success($service->getAreaToday($this->_getInstitutionId()));
  116. }
  117. // 患者来源
  118. public function getSource(BiService $service)
  119. {
  120. return $this->_success($service->getSource($this->_getInstitutionId()));
  121. }
  122. // 患者来源
  123. public function getSourceToday(BiService $service)
  124. {
  125. return $this->_success($service->getSourceToday($this->_getInstitutionId()));
  126. }
  127. // 科室人员
  128. public function getDoctor(BiService $service)
  129. {
  130. return $this->_success($service->getDoctor($this->_getInstitutionId()));
  131. }
  132. // 科室人员
  133. public function getDeviceList(BiService $service)
  134. {
  135. return $this->_success($service->getDeviceList($this->_getInstitutionId()));
  136. }
  137. // 科室人员
  138. public function getDevice(BiService $service)
  139. {
  140. return $this->_success($service->getDevice($this->_getInstitutionId()));
  141. }
  142. // 科室人员
  143. public function getDeviceToday(BiService $service)
  144. {
  145. return $this->_success($service->getDeviceToday($this->_getInstitutionId()));
  146. }
  147. // 科室人员
  148. public function getExamProject($device = 'all', BiService $service)
  149. {
  150. return $this->_success($service->getExamProject($device, $this->_getInstitutionId()));
  151. }
  152. // 科室人员
  153. public function getExamProjectToday($device = 'all',BiService $service)
  154. {
  155. return $this->_success($service->getExamProjectToday($device, $this->_getInstitutionId()));
  156. }
  157. // 设备的检查人次
  158. // 设备的检查部位人次
  159. // 检查部位
  160. // 部位数量
  161. // 导出excel
  162. public function downExcel(BiService $service)
  163. {
  164. return $this->_success($service->downExcel($this->_getInstitutionId()));
  165. }
  166. }