SuperService.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. foreach($ids as $k=>$v){
  39. $pay = $this->super->getPayType($institution,$v);
  40. if($pay == null){
  41. $pay = '0';
  42. }
  43. $pField = ['ID AS id','NAME AS name','2 as is_special','ID as hid',"$pay as pay_type"];
  44. $arr = [];
  45. $arr = $this->super->getInstitutionInfo($v,$pField);
  46. if(!empty($arr))
  47. {
  48. $arr['is_special'] = 2;
  49. $arr['hid'] = $arr['id'];
  50. $arr['pay_type'] = $pay;
  51. }
  52. $parent[] = $arr;
  53. }
  54. return $parent;
  55. }
  56. public function getDoctorInfo($params,$doctor)
  57. {
  58. if(empty($params['id'])){
  59. return '';
  60. }
  61. if($params['is_special'] == 1){
  62. $info = $this->super->getSpecialDoctor($params['id']);
  63. }else{
  64. $field = ['NAME AS name'];
  65. $institution_name = $this->super->getInstitutionInfo($params['id'],$field);
  66. $info = $this->super->getDoctor($params['id'],$params['exam_class'],$doctor['institution_id']);
  67. foreach($info as $k=>$v){
  68. $info[$k]['institution_name'] = $institution_name['name'];
  69. }
  70. }
  71. return $info;
  72. }
  73. }