fuyu 5 lat temu
rodzic
commit
bf9fde75d1
1 zmienionych plików z 29 dodań i 6 usunięć
  1. 29 6
      application/inter/controller/Application.php

+ 29 - 6
application/inter/controller/Application.php

@@ -557,12 +557,16 @@ class Application extends Base
                 $url = Message::url($sessionid,$param['id'],1,$exam_info['exam_class'],$r_id,$aid);
                 Message::insert($t,$c,$d,$type,$url,1,$aid);
                 //保存  申请
-                $dinfo = DB::table('doctors')->where('id',$application_info['remote_doctor_id'])->find();
-                $d_phone = $dinfo['phone'];
-                $d_name = $dinfo['realname'];
-                if($dinfo['institution_id'] == '22100003' || $dinfo['send_sms'] == 1){ //魏庙
-                    $repsone = send_message::sendSms2Apply($d_phone,$d_time,$d_name);
-                }
+
+                // 发送通知短信
+                $this->sendApplySms($d_time, $application_info['remote_doctor_id'], $application_info['remote_institution_id']);
+
+                // $dinfo = DB::table('doctors')->where('id',$application_info['remote_doctor_id'])->find();
+                // $d_phone = $dinfo['phone'];
+                // $d_name = $dinfo['realname'];
+                // if($dinfo['institution_id'] == '22100003' || $dinfo['send_sms'] == 1){ //魏庙
+                //     $repsone = send_message::sendSms2Apply($d_phone,$d_time,$d_name);
+                // }
                     // $tel = '18910184804';
                     // $type = '发起申请';
                     // $content  = $aid;
@@ -574,6 +578,25 @@ class Application extends Base
         }
     }
 
+    private function sendApplySms($d_time, $d_id, $i_id) {
+        $dinfo = false;
+        if(!empty($did)) {
+            $dinfo = DB::table('doctors')->where('id', $d_id)->find();
+        }
+        if($dinfo) {
+            if($dinfo['institution_id'] == '22100003' || $dinfo['send_sms'] == 1){ //魏庙
+                $repsone = send_message::sendSms2Apply($dinfo['phone'], $d_time, $dinfo['realname']);
+            }
+            return;
+        }
+        // 查找医院管理员并发送短信
+        $admins = DB::table('doctors')->where('institution_id', $i_id)->where('is_admin', '1')->where('send_sms', '1')->select();
+        foreach($admins as $key=>$value){
+            $repsone = send_message::sendSms2Apply($value['phone'], $d_time, $value['realname']);
+        }
+    }
+
+
     private function createHospitalOrder($hospital_id, $super_hospital_id, $doctor_id, $super_doctor_id, $exam_class, $application_id, $order_money, $is_urgent = 0, $wechatService) {
         DB::startTrans();
         $pay_type = self::PAY_TYPE['HOSPITAL'];