SuperService.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace app\api\servies\super;
  3. use app\api\response\ZskkErrorResponse;
  4. use app\api\servies\ZskkDefaultService;
  5. use app\api\dao\super\SuperDao;
  6. /**
  7. * 后台控制器基类
  8. * 接口方法权限 必传参数 接口返回 错误抛出 通用参数处理
  9. */
  10. class SuperService extends ZskkDefaultService {
  11. protected $logName = "SuperService";
  12. private $super = null;
  13. public function __construct(SuperDao $superDao) {
  14. parent::__construct();
  15. $this->super = $superDao;
  16. }
  17. public function getUser($token)
  18. {
  19. $user = $this->super->getUser($token);
  20. return $user;
  21. }
  22. public function getParentInstitution($institution)
  23. {
  24. // $field = ['parent_institution'];
  25. // $parent_id = $this->super->getInstitutionInfo($institution,$field);
  26. // $ids = explode(',',$parent_id['parent_institution']);
  27. $hospitanInfo = $this->super->getRemoteIns($institution);
  28. $ids = $hospitanInfo;
  29. $parent = [];
  30. $special = $this->super->getSpecialIns();
  31. foreach ($special as $k=>$v){
  32. $s = [];
  33. $s['id'] = $v['id'];
  34. $s['name'] = $v['hospital_name'];
  35. $s['is_special'] = $v['is_special'];
  36. $parent[] = $s;
  37. }
  38. if(!empty($ids))
  39. {
  40. foreach($ids as $k=>$v){
  41. $pay = $this->super->getPayType($institution,$v);
  42. if($pay == null){
  43. $pay = '0';
  44. }
  45. $pField = ['ID AS id','NAME AS name','2 AS is_special','id AS hid',"$pay AS pay_type"];
  46. $parent[] = $this->super->getInstitutionInfo($v,$pField);
  47. }
  48. }
  49. return $parent;
  50. }
  51. public function getDoctorInfo($params,$doctor)
  52. {
  53. if(empty($params['id'])){
  54. return '';
  55. }
  56. if($params['is_special'] == 1){
  57. $info = $this->super->getSpecialDoctor($params['id']);
  58. }else{
  59. $field = ['NAME AS name'];
  60. $institution_name = $this->super->getInstitutionInfo($params['id'],$field);
  61. $info = $this->super->getDoctor($params['id'],$params['exam_class'],$doctor['institution_id']);
  62. foreach($info as $k=>$v){
  63. $info[$k]['institution_name'] = $institution_name['name'];
  64. }
  65. }
  66. return $info;
  67. }
  68. }