Browse Source

医生端订单列表,状态组合

lizhen_gitee 9 months ago
parent
commit
c089ad0d60

+ 1 - 1
application/api/controller/Notify.php

@@ -203,7 +203,7 @@ class Notify extends Api
                 'name' => '待接单',
                 'status' => '10',
                 'id' => $wenzhen_order['id'],
-                'content' => '已通知医生尽快接诊,超时自动取消订单并退款',
+                'content' => '已通知医生尽快接诊,超时未接诊的将自动取消订单并退款',
             ];
             $rs = $tenim->sendCustomMessageToUser('user'.$wenzhen_order['user_id'],'doctor'.$wenzhen_order['doctor_id'],$message);
         }

+ 32 - 0
application/api/controller/doctor/Wenzhen.php

@@ -5,6 +5,7 @@ namespace app\api\controller\doctor;
 use app\common\controller\Apic;
 use think\Db;
 use app\common\model\Wenzhenorder;
+use app\common\library\Tenim;
 /**
  * 问诊订单
  */
@@ -25,6 +26,9 @@ class Wenzhen extends Apic
         if($status != 'all'){
             $where['order.status'] = $status;
 
+            if($status == 20){
+                $where['order.status'] = ['IN',[20,25]];
+            }
             if($status == 100){
                 $where['order.status'] = ['IN',[13,16,18,22]];
             }
@@ -95,6 +99,21 @@ class Wenzhen extends Apic
         //订单类型,辅助
         $val['ordertype_data'] = $ordertype_data[$val['ordertype']];
 
+        //状态组合
+        $status_array = [
+            0  => 0,
+            3  => 3,
+            10 => 10,
+            13 => 100, //已退珍
+            16 => 100, //已退珍
+            18 => 100, //已退珍
+            20 => 20,             //咨询中
+            22 => 100, //已退珍
+            25 => 20,             //咨询中
+            30 => 30
+        ];
+        $val['status'] = $status_array[$val['ordertype']];
+
 
         //处理完成,返回
         return $val;
@@ -253,6 +272,19 @@ class Wenzhen extends Apic
             $this->error('接诊失败');
         }
 
+        //发送im消息给用户
+        if($wenzhen_order['ordertype'] == 1){
+            $tenim = new Tenim();
+            $message = [
+                'businessID' => 'order_status_doctor',
+                'name' => '您已接诊',
+                'status' => '20',
+                'id' => (string)$order_id,
+                'content' => '请尽快联系患者,超时将自动取消订单',
+            ];
+            $rs = $tenim->sendCustomMessageToUser('user'.$wenzhen_order['user_id'],'doctor'.$wenzhen_order['doctor_id'],$message);
+        }
+
         $this->success(1,'接珍成功');
     }