lgy 6 gadi atpakaļ
vecāks
revīzija
160a171556

+ 9 - 12
application/common/library/send_message.php

@@ -1,6 +1,8 @@
 <?php
 namespace app\common\library;
 
+use think\Db;
+
 class send_message extends AliyunSms{
     /*
     * 向上级医师发送[远程诊断申请]短信
@@ -10,6 +12,7 @@ class send_message extends AliyunSms{
     * @param {string} name 姓名(姓)
     */
     public static function sendSms2Apply($phone, $time = '', $name = '') {
+        DB::table('send_message')->insert(['phone'=>$phone,'type'=>'远程申请','name'=>$name]);
         return self::sendSms($phone,"中世康恺","SMS_153325044",array("time" => $time,"name" => $name));
     }
     /*
@@ -18,14 +21,16 @@ class send_message extends AliyunSms{
     * @param {string} description 驳回理由
     */
     public static function sendSms2RejectApply($phone, $description = '') {
+        DB::table('send_message')->insert(['phone'=>$phone,'type'=>'申请驳回','content'=>$description]);
         return self::sendSms($phone,"中世康恺","SMS_153330722",array("description" => $description));
     }
     /*
     * 向下级医院发送[远程诊断报告已经被写完]短信
     * 您发起的远程诊断申请已由${doctor}医师完成,请您登录系统查看
-    * @param {string} doctor 医生 
+    * @param {string} doctor 医生
     */
     public static function sendSms2CompleteReport($phone, $doctor = '') {
+        DB::table('send_message')->insert(['phone'=>$phone,'type'=>'报告完成','name'=>$doctor]);
         return self::sendSms($phone,"中世康恺","SMS_153330824",array("doctor" => $doctor));
     }
     /*
@@ -35,19 +40,10 @@ class send_message extends AliyunSms{
     * @param {string} content 通知内容
     */
     public static function sendSms2Self($phone,$type = '', $content = '') {
+        DB::table('send_message')->insert(['phone'=>$phone,'type'=>'内部通知'.$type,'content'=>$content]);
         return self::sendSms($phone,"中世康恺","SMS_153325903",array("t" => $type, "c" => $content));
     }
 
-    /*
-    * 发送[登录短信验证码]短信
-    * 通知: 类型:${code} 验证码
-    * @param {string} phone 手机号码
-    * @param {string} code 验证码
-    */
-    public static function sendSms2Login($phone,$code) {
-        return self::sendSms($phone,"中世康恺","SMS_163620994",array("code" => $codo));
-    }
-
     /*
     * 发送[修改短信验证码]短信
     * 通知: 类型:${code} 验证码
@@ -55,6 +51,7 @@ class send_message extends AliyunSms{
     * @param {string} code 验证码
     */
     public static function sendSms2UpDate($phone,$code) {
-        return self::sendSms($phone,"中世康恺","SMS_163620994",array("code" => $codo));
+        DB::table('send_message')->insert(['phone'=>$phone,'type'=>'登录验证'.$code]);
+        return self::sendSms($phone,"中世康恺","SMS_163620994",array("code" => $code));
     }
 }

+ 12 - 0
application/inter/controller/Application.php

@@ -673,4 +673,16 @@ class Application extends Base
         Message::insert($t,$c,$d,$type,$url,1,$status['id']);
         return json_encode(['status'=>'ok','code'=>'0000','msg'=>'撤回成功']);
     }
+
+    public function bind_doctor()
+    {
+        try{
+            $ra_id = $_REQUEST['ra_id'];
+            $did = $_REQUEST['did'];
+            $info = DB::table('remote_application')->where('id',$ra_id)->update(['remote_doctor_id'=>$did]);
+            return  json_encode(['status'=>'ok','code'=>'0000','info'=>$info]);
+        }catch(\Exception $e){
+            return json_encode(['status'=>'fail','code'=>'2000','msg'=>$e->getMessage()]);
+        }
+    }
 }

+ 13 - 0
application/inter/controller/Doctors.php

@@ -242,4 +242,17 @@ class Doctors extends Base
             return  json_encode(['status'=>'ok','code'=>'0000','info'=>'80ddb7d09ebc44b4']);
         }
     }
+
+    //当前医院医生下拉
+    public function doctor_option()
+    {
+        try{
+            $sessionid = $_REQUEST['sessionid'];
+            $doctor = Cache::get($sessionid);
+            $list = DB::table('doctors')->where('is_admin',0)->where('institution_id',$doctor['institution_id'])->field('id,realname')->select();
+            return  json_encode(['status'=>'ok','code'=>'0000','info'=>$list]);
+        }catch(\Exception $e){
+            return json_encode(['status'=>'fail','code'=>'2000','msg'=>$e->getMessage()]);
+        }
+    }
 }

+ 36 - 40
application/inter/controller/Login.php

@@ -10,7 +10,7 @@ use think\Cache;
 use app\common\library\UUIDs;
 use app\common\library\Verify;
 use think\Validate;
-use app\common\library\AliyunSms;
+use app\common\library\send_message;
 
 class Login extends Controller
 {
@@ -74,7 +74,7 @@ class Login extends Controller
                 return json_encode(['status'=>'fail','code'=>'1101','msg'=>'密码不能为空']);
             }
             //医生信息
-            $info = DB::table('doctors')->where('username',$param['userName'])->field('message_push,id,exam_class,attachment,username,password,login_time,login_failure,realname,email,phone,doctor_title,institution_id,department_id,doctor_role,is_report')->find();
+            $info = DB::table('doctors')->where('username',$param['userName'])->field('is_send_message,is_admin,message_push,id,exam_class,attachment,username,password,login_time,login_failure,realname,email,phone,doctor_title,institution_id,department_id,doctor_role,is_report')->find();
             log::record($info);
             if(!$info){
                 return json_encode(['status'=>'fail','code'=>'1004','msg'=>'用户名'.$param['userName'].'或密码错误']);
@@ -113,7 +113,41 @@ class Login extends Controller
         }catch(\Exception $e){
             return json_encode(['status'=>'fail','code'=>'2000','msg'=>$e->getMessage()]);
         }
+    }
+
+    //发送短信
+    public function send_message()
+    {
+        try{
+            $sessionid = $_REQUEST['sessionid'];
+            $doctor = Cache::get($sessionid);
+            $phone = $doctor['phone'];
+            $code = rand('1000','9999');
+            Cache::set($phone,$code,600);
+            $info = send_message::sendSms2UpDate($phone,$code);
+            return json_encode(['status'=>'ok','code'=>'0000','info'=>$info,'sessionid'=>$sessionid]);
+        }catch(\Exception $e){
+            return json_encode(['status'=>'fail','code'=>'2000','msg'=>$e->getMessage()]);
+        }
+    }
+
+    public function check_code()
+    {
+        try{
+            $sessionid = $_REQUEST['sessionid'];
+            $doctor = Cache::get($sessionid);
+            $check_phone = $doctor['phone'];
+            $code = Cache::get($check_phone);
+            $number  =$_REQUEST['code'];
+            if($code == $number){
+                return json_encode(['status'=>'ok','code'=>'0000','msg'=>'验证成功','sessionid'=>$sessionid]);
+            }else{
+                return json_encode(['status'=>'fail','code'=>'0090','msg'=>' 错误的验证码','sessionid'=>$sessionid]);
+            }
 
+        }catch(\Exception $e){
+            return json_encode(['status'=>'fail','code'=>'2000','msg'=>$e->getMessage()]);
+        }
     }
 
     //注册功能
@@ -157,42 +191,4 @@ class Login extends Controller
         }
     }
 
-    public function send_message(){
-        // $response = AliyunSms::sendSms('18246195584', '中世康恺','SMS_153325044',array("name" => "", "time" => "12:00"));
-        // var_dump($response);
-        
-        /*
-        * 向上级医师发送[远程诊断申请]短信
-        * 亲爱的${name}医生您好!收到新的${type},请您及时于${time}前登录系统处理
-        * @param {string} phone 手机号码
-        * @param {string} time 时间
-        * @param {string} name 姓名(姓)
-        */
-        // AliyunSms::sendSms2Apply($phone, $time=, $name=);
-        liyunSms::sendSms2Apply("13763459789", '12:00', '刘');
-        /*
-        * 向下级医师发送[远程诊断申请被驳回]短信
-        * 很抱歉,您发起的远程诊断申请被驳回,请您及时处理后重新发起申请。驳回原因:${description}
-        * @param {string} description 驳回理由
-        */
-        // AliyunSms::sendSms2RejectApply($phone, $description);
-        liyunSms::sendSms2RejectApply("13763459789", '申请单描述信息不全');
-
-        /*
-        * 向下级医院发送[远程诊断报告已经被写完]短信
-        * 您发起的远程诊断申请已由${doctor}医师完成,请您登录系统查看
-        * @param {string} doctor 医生 
-        */
-        // AliyunSms::sendSms2CompleteReport($phone, $doctor);
-        AliyunSms::sendSms2CompleteReport("13763459789", "301医师集团刘桂岩");
-        
-       /*
-        * 发送[内部通知]短信
-        * 通知: 类型:${type} 内容:${content}
-        * @param {string} type 通知类型
-        * @param {string} content 通知内容
-        */
-        // AliyunSms::sendSms2Self($phone, $type, $content);
-        AliyunSms::sendSms2Self("13763459789", "发起申请", "魏庙xx医院xx医师向301医师集团刘xx医师发起了远程诊断申请,申请单idxxx");
-    }
 }

+ 2 - 2
application/inter/controller/Writereport.php

@@ -216,8 +216,8 @@ class Writereport extends Base
                 $status = DB::table('remote_application')->where('id',$param['rid'])->field('report_status')->find();
                 if($status['report_status']  ==  12){
                     return json_encode(['status'=>'fail','code'=>'1034','msg'=>'报告已被撤回,无法进行保存填写']);
-                }elseif($status['report_status'] > 6){
-                    return json_encode(['status'=>'fail','code'=>'1034','msg'=>'报告已被保存,无法再次被修改']);
+                }elseif($status['report_status'] > 7){
+                    return json_encode(['status'=>'fail','code'=>'1034','msg'=>'报告已被审核,无法再次被保存']);
                 }
             }else{
                 //本地