|
@@ -82,7 +82,7 @@ class Wenzhen extends Api
|
|
|
];
|
|
|
$check_order = Db::name('wenzhen_order')->where($checkmap)->whereTime('createtime','month')->count();
|
|
|
if($check_order >= $mouth_times){
|
|
|
- //$this->error('您本月的免费问诊次数已用完');
|
|
|
+ $this->error('您本月的问诊次数已用完');
|
|
|
}
|
|
|
|
|
|
//问诊患者
|
|
@@ -99,6 +99,9 @@ class Wenzhen extends Api
|
|
|
if($doctor_info['video_switch'] != 1){
|
|
|
$this->error('该医生未开通视频问诊');
|
|
|
}
|
|
|
+ if($doctor_info['video_model'] != 2){
|
|
|
+ $this->error('该医生未开通即时问诊');
|
|
|
+ }
|
|
|
if($doctor_info['video_model'] == 2 && $doctor['job_status'] != 1){ //即时方式,需要在上班中
|
|
|
$this->error('该医生现在不在上班中');
|
|
|
}
|
|
@@ -296,9 +299,61 @@ class Wenzhen extends Api
|
|
|
$this->success(1,$wenzhen_order);
|
|
|
}
|
|
|
|
|
|
+ //换医生
|
|
|
+ public function change_doctor(){
|
|
|
+ //判断用户来源
|
|
|
+ if($this->auth->comefrom != 2){
|
|
|
+ $this->error('用户错误');
|
|
|
+ }
|
|
|
+
|
|
|
+ //医生信息
|
|
|
+ $doctor_id = input('doctor_id',0);
|
|
|
+ $doctor = Db::name('doctor')->where('id',$doctor_id)->find();
|
|
|
+ $doctor_info = Db::name('doctor_info')->where('doctor_id',$doctor_id)->find();
|
|
|
+ if(empty($doctor_info)){
|
|
|
+ $this->error('不存在的医生');
|
|
|
+ }
|
|
|
+
|
|
|
+ if($doctor_info['video_switch'] != 1){
|
|
|
+ $this->error('该医生未开通视频问诊');
|
|
|
+ }
|
|
|
+ if($doctor_info['video_model'] != 2){
|
|
|
+ $this->error('该医生未开通即时问诊');
|
|
|
+ }
|
|
|
+ if($doctor_info['video_model'] == 2 && $doctor['job_status'] != 1){ //即时方式,需要在上班中
|
|
|
+ $this->error('该医生现在不在上班中');
|
|
|
+ }
|
|
|
+
|
|
|
+ //订单信息
|
|
|
+ $order_id = input('order_id',0);
|
|
|
+ $wenzhen_order = Db::name('wenzhen_order')->where('user_id',$this->auth->id)->where('comefrom',2)->where('id',$order_id)->find();
|
|
|
+ if(empty($wenzhen_order)){
|
|
|
+ $this->error('不存在的订单');
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!in_array($wenzhen_order['status'],[10])){
|
|
|
+ Db::rollback();
|
|
|
+ $this->error('当前订单不能换医生');
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改订单
|
|
|
+ $update = [
|
|
|
+ 'doctor_id' => $doctor_id,
|
|
|
+ ];
|
|
|
+
|
|
|
+ $update_rs = Db::name('wenzhen_order')->where('id',$order_id)->update($update);
|
|
|
+ if($update_rs === false){
|
|
|
+ $this->error('换医生失败');
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('操作成功');
|
|
|
+ }
|
|
|
+
|
|
|
//用户发起退珍
|
|
|
//因为存在第三方,悲观锁
|
|
|
public function tuizhen(){
|
|
|
+ $this->error('不允许取消');
|
|
|
+
|
|
|
$apilimit = $this->apiLimit();
|
|
|
if(!$apilimit){
|
|
|
$this->error('操作频繁');
|