From 800914a0000c8acfd7245abba228c204977a8527 Mon Sep 17 00:00:00 2001 From: yanzai Date: Fri, 28 Jun 2024 16:47:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=A5=E5=BA=B7=E8=AF=81=E4=BD=93=E6=A3=80?= =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3=E6=8F=92=E5=85=A5=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=EF=BC=8C=E5=A6=82=E6=9E=9Capp=E9=A2=84?= =?UTF-8?q?=E7=BA=A6=E4=BF=AE=E6=94=B9=E7=8A=B6=E6=80=81=E4=B8=BA=E5=88=B0?= =?UTF-8?q?=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../API/Admin/YeWu/AppointmentController.php | 23 ++++++++------ .../Admin/YeWu/AppointmentService.php | 30 ++++++++++++------- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/AppointmentController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/AppointmentController.php index 801573f..21385a3 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/AppointmentController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/AppointmentController.php @@ -47,14 +47,19 @@ class AppointmentController extends Controller $c=DB::table('appointment_record as a') ->where([['a.id_card_num','=',$info['id_card_num']],['a.is_del','=',0],['a.fee_type','=',0],['a.created_at','>=',$firstDay],['a.created_at','<=',$lastDay]])->get(); if(count($c)>0){ - $result['status']=false; - $result['msg']='已体检过'; - $result['info']=$c; - return \Yz::Return(false,'本年度已经有体检登记记录',['info'=>$c]); - }else{ - $result['status']=true; - $result['msg']='可以继续,本年度无免费体检记录'; - $result['info']=$c; + if($c[0]->status==2){ + return \Yz::Return(false,'本年度已经有体检登记记录',['info'=>$c]); + } + + //如果是预约状态,则修改状态为 到检 + if($c[0]->status==1){ + $up=DB::table('appointment_record')->where(['id'=>$c[0]->id])->update(['status'=>2]); + if($up){ + return \Yz::Return(true,'保存成功',[]); + }else{ + return \Yz::echoError1('保存失败'); + } + } } $currentDateTime = date('Y-m-d H:i:s'); $org_code=isset($info['org_code'])?$info['org_code']:''; @@ -69,7 +74,7 @@ class AppointmentController extends Controller 'id_card_num'=>$info['id_card_num'], 'sex'=>$info['sex'], 'tel'=>$info['tel'], - 'status'=>1, + 'status'=>2, //1预约2到检 只要调用这个接口 直接到检 'is_del'=>0, //'content'=>json_encode($info['content']), 'content'=>isset($info['content'])?json_encode($info['content'],JSON_UNESCAPED_UNICODE):'', diff --git a/Laravel/app/Services/Admin/YeWu/AppointmentService.php b/Laravel/app/Services/Admin/YeWu/AppointmentService.php index b50e2b7..da28c48 100644 --- a/Laravel/app/Services/Admin/YeWu/AppointmentService.php +++ b/Laravel/app/Services/Admin/YeWu/AppointmentService.php @@ -91,22 +91,30 @@ class AppointmentService $query->where('a.id_card_num', $id_card_num) ->orWhere('a.id_card_num', $encode_id_card_num); }) - ->where(['a.type' => $type,'a.is_del'=>0, ['a.created_at', '>=', $firstDay], ['a.created_at', '<=', $lastDay]]) - ->whereIn('a.status', [1, 2]) - ->get(); + ->where(['a.type' => $type,'a.is_del'=>0, ['a.created_at', '>=', $firstDay], ['a.created_at', '<=', $lastDay]]); + if($type==2){ + $c=$c->whereIn('a.status', [1, 2]); + } + if($type==1){ + $c=$c->whereIn('a.status', [2]); + } + + $c=$c->get(); if(count($c)){ $result['status']=false; $result['msg']='已体检过'; $result['info']=$c; }else{ - - $gongwei= self::CheckGongWei($name,$id_card_num); - if( $gongwei['status']===false) { - $result['status'] = false; - $result['msg'] = $gongwei['msg']; - $result['GongWeiinfo'] = $gongwei['GongWeiinfo']; - return $result; - } + if($type==2){ + $gongwei= self::CheckGongWei($name,$id_card_num); + if( $gongwei['status']===false) { + $result['status'] = false; + $result['msg'] = $gongwei['msg']; + $result['GongWeiinfo'] = $gongwei['GongWeiinfo']; + return $result; + } + } + $result['status']=true; $result['msg']='可以继续,本年度无免费体检记录'; $result['info']=$c;