From d6b0a4fa3c99f9a7b1ba72cfe659974cca07574b Mon Sep 17 00:00:00 2001 From: yanzai Date: Sat, 20 Jul 2024 20:50:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=80=81=E5=B9=B4=E4=BA=BA65?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=AB=AF=E9=A2=84=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../API/mH5/OrganizationController.php | 9 +- .../Controllers/API/mH5/PersonController.php | 9 +- .../Admin/YeWu/AppointmentService.php | 3 +- .../app/Services/mH5/OrganizationService.php | 96 ++++++++++++------- Laravel/routes/api.php | 1 + mH5/src/api/api.js | 4 + mH5/src/views/AppLogin.vue | 41 +++++++- mH5/src/views/SelectDate.vue | 8 ++ mH5/src/views/SelectIndustry.vue | 11 ++- mH5/src/views/SelectOrganization.vue | 87 +++++++++++++---- mH5/src/views/UploadFiles.vue | 9 ++ 11 files changed, 217 insertions(+), 61 deletions(-) diff --git a/Laravel/app/Http/Controllers/API/mH5/OrganizationController.php b/Laravel/app/Http/Controllers/API/mH5/OrganizationController.php index 28eec28..0d2a9a9 100644 --- a/Laravel/app/Http/Controllers/API/mH5/OrganizationController.php +++ b/Laravel/app/Http/Controllers/API/mH5/OrganizationController.php @@ -33,7 +33,14 @@ class OrganizationController extends Controller } $s=app()->make(OrganizationService::class); - $type=1;//1 健康证体检 2老年人体检 + if($subinfo['yuyue_type']=='laonianren_mf'){ + $type=2;//1 健康证体检 2老年人体检 + } + if($subinfo['yuyue_type']=='jiankangzheng_mf'){ + $type=1;//1 健康证体检 2老年人体检 + } + if(!isset($type)) return \Yz::echoError1("体检类型不能为空"); + return $s->StartYuYue(['openid'=>$openid,'group'=>$group,'info'=>$subinfo],$type); }else{ return \Yz::echoError1("参数不完整"); diff --git a/Laravel/app/Http/Controllers/API/mH5/PersonController.php b/Laravel/app/Http/Controllers/API/mH5/PersonController.php index 6a6752b..81eb390 100644 --- a/Laravel/app/Http/Controllers/API/mH5/PersonController.php +++ b/Laravel/app/Http/Controllers/API/mH5/PersonController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\API\mH5; use App\Http\Controllers\Controller; use App\Lib\HSM; +use App\Services\Admin\YeWu\AppointmentService; use App\Services\mH5\PersonService; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; @@ -205,5 +206,11 @@ class PersonController extends Controller } - + public function isAgeOver65() + { + $sfz =request('sfz'); + if(!isset($sfz)) return \Yz::echoError1("身份证不能为空"); + $s= new AppointmentService(); + return \Yz::Return(true,"查询完成",$s->isOver65($sfz)); + } } diff --git a/Laravel/app/Services/Admin/YeWu/AppointmentService.php b/Laravel/app/Services/Admin/YeWu/AppointmentService.php index da28c48..e54f86c 100644 --- a/Laravel/app/Services/Admin/YeWu/AppointmentService.php +++ b/Laravel/app/Services/Admin/YeWu/AppointmentService.php @@ -177,8 +177,9 @@ class AppointmentService return $result; } - function isOver65($idCard) { + public function isOver65($idCard) { // 从身份证号中提取出生日期 + if(strlen($idCard)<>18) return false; $birthYear = substr($idCard, 6, 4); $birthMonth = substr($idCard, 10, 2); $birthDay = substr($idCard, 12, 2); diff --git a/Laravel/app/Services/mH5/OrganizationService.php b/Laravel/app/Services/mH5/OrganizationService.php index 9c61b79..11d9a60 100644 --- a/Laravel/app/Services/mH5/OrganizationService.php +++ b/Laravel/app/Services/mH5/OrganizationService.php @@ -1,5 +1,6 @@ where(['enable_yuyue'=>1,'enable_jiankangzheng_mf'=>1]); } + if($arr['yuyue_type']=='laonianren_mf'){ + $list= $list->where(['enable_yuyue'=>1,'enable_laonianren_mf'=>1]); + } $list= $list->get(); if(count($list)>0){ $result['status']=true; @@ -112,44 +116,72 @@ class OrganizationService return \Yz::echoError1('身份证解密失败'); } $sfz_mingwen=$sfz_HSM['data']; + $data=[]; + if($type==1){ + $data= [ + 'type'=>$type, + 'calendar_id' => $info['calendar_id'], + 'name' => $cha_info[0]->name, + 'id_card_num' => $cha_info[0]->id_card_num, + 'sex'=>$cha_info[0]->sex, + 'age'=>\App\Lib\Tools::calculateAgeFromID($sfz_mingwen,$nowtime), + 'birthday'=>\App\Lib\Tools::getBirthdayFromIDCard($sfz_mingwen), + 'person_id'=>$cha_info[0]->id, + 'openid'=>$openid, + 'date'=>$q_date[0]->date, + 'time'=>$q_date[0]->time, + 'fee_type'=>0, + 'doc_type_id'=>$info['doc_id'], + 'doc_type_name'=>$info['doc_name'], + 'org_id'=>$info['org_id'], + 'org_code'=>$jgINfo->sn, + 'status'=>1, + 'hmac'=>$Hmac['data'], + ]; + } + if($type==2){ //如果是65老年人免费体检 + //判断年龄 + $s=new AppointmentService(); + if(!$s->isOver65($sfz_mingwen)) return \Yz::echoError1("用户年龄不满足条件,不可预约"); + $data= [ + 'type'=>$type, + 'calendar_id' => $info['calendar_id'], + 'name' => $cha_info[0]->name, + 'id_card_num' => $cha_info[0]->id_card_num, + 'sex'=>$cha_info[0]->sex, + 'age'=>\App\Lib\Tools::calculateAgeFromID($sfz_mingwen,$nowtime), + 'birthday'=>\App\Lib\Tools::getBirthdayFromIDCard($sfz_mingwen), + 'person_id'=>$cha_info[0]->id, + 'openid'=>$openid, + 'date'=>$q_date[0]->date, + 'time'=>$q_date[0]->time, + 'fee_type'=>0, + 'org_id'=>$info['org_id'], + 'org_code'=>$jgINfo->sn, + 'status'=>1, + 'hmac'=>$Hmac['data'], + ]; + } //如果都通过则继续 DB::beginTransaction(); try { - $idd=DB::table('appointment_record')->insertGetId( - [ - 'type'=>$type, - 'calendar_id' => $info['calendar_id'], - 'name' => $cha_info[0]->name, - 'id_card_num' => $cha_info[0]->id_card_num, - 'sex'=>$cha_info[0]->sex, - 'age'=>\App\Lib\Tools::calculateAgeFromID($sfz_mingwen,$nowtime), - 'birthday'=>\App\Lib\Tools::getBirthdayFromIDCard($sfz_mingwen), - 'person_id'=>$cha_info[0]->id, - 'openid'=>$openid, - 'date'=>$q_date[0]->date, - 'time'=>$q_date[0]->time, - 'fee_type'=>0, - 'doc_type_id'=>$info['doc_id'], - 'doc_type_name'=>$info['doc_name'], - 'org_id'=>$info['org_id'], - 'org_code'=>$jgINfo->sn, - 'status'=>1, - 'hmac'=>$Hmac['data'], - ] - ); - $file=array(); - foreach ($info['upfileList'] as $key=> $fvalue) { - foreach ($fvalue as $key2=> $fvalue2) { - $file[]=[ - 'type' =>$key, - 'appointment_record_id' =>$idd, - 'imgurl' =>$fvalue2, - ]; + $idd=DB::table('appointment_record')->insertGetId($data); + if($type==1){ + $file=array(); + foreach ($info['upfileList'] as $key=> $fvalue) { + foreach ($fvalue as $key2=> $fvalue2) { + $file[]=[ + 'type' =>$key, + 'appointment_record_id' =>$idd, + 'imgurl' =>$fvalue2, + ]; + } } + + $i_img=DB::table('appointment_img')->insert($file); } - $i_img=DB::table('appointment_img')->insert($file); - if($i_img){ + if($idd){ DB::commit(); return \Yz::Return(true,'预约完成'); }else{ diff --git a/Laravel/routes/api.php b/Laravel/routes/api.php index e5d92b8..a8041d8 100644 --- a/Laravel/routes/api.php +++ b/Laravel/routes/api.php @@ -70,6 +70,7 @@ Route::post('GetConfigInArray','App\Http\Controllers\API\Admin\YeWu\ConfigsContr Route::group(['middleware'=>['checktoken','log'],'prefix'=>'v1/mH5'],function () { //手机H5路由分组 Route::post('Register','App\Http\Controllers\API\mH5\PersonController@Register'); //手机H5端用户注册 Route::post('GetPersonRecode','App\Http\Controllers\API\mH5\PersonController@GetPersonRecode'); //查询用户本年度体检记录 + Route::post('isAgeOver65','App\Http\Controllers\API\mH5\PersonController@isAgeOver65'); //判断是否过65 Route::post('GetOrgEnableList','App\Http\Controllers\API\mH5\OrganizationController@GetEnableList'); //获取可用体检机构 Route::post('GetEnableCalendar','App\Http\Controllers\API\mH5\OrganizationController@GetEnableCalendar'); //获取可用体检机构日历 Route::post('StartYuYue','App\Http\Controllers\API\mH5\OrganizationController@StartYuYue'); //开始预约 diff --git a/mH5/src/api/api.js b/mH5/src/api/api.js index feb8d4e..0520d3a 100644 --- a/mH5/src/api/api.js +++ b/mH5/src/api/api.js @@ -70,4 +70,8 @@ export const GetConfigInArray = (data) => { //获取自己的预约记录 export const H5GetAppointmentRecord = (data) => { return axios({url:import.meta.env.VITE_APP_API+'v1/mH5/H5GetAppointmentRecord',data:data}) +} +//判断是否过65 +export const isAgeOver65 = (data) => { + return axios({url:import.meta.env.VITE_APP_API+'v1/mH5/isAgeOver65',data:data}) } \ No newline at end of file diff --git a/mH5/src/views/AppLogin.vue b/mH5/src/views/AppLogin.vue index 38c3c69..3badd79 100644 --- a/mH5/src/views/AppLogin.vue +++ b/mH5/src/views/AppLogin.vue @@ -1,14 +1,18 @@