From e7a9a6974489eac1679b88965efe816a833d1684 Mon Sep 17 00:00:00 2001 From: yanzai Date: Thu, 25 Apr 2024 20:25:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=BB=98=E8=AE=A4=E5=AF=86?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=89=B9=E9=87=8F=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/Http/Controllers/TestController.php | 40 ++++++++++++++++++- Laravel/app/Lib/HSM.php | 2 + Laravel/app/Services/Admin/UserService.php | 9 ++++- .../Admin/YeWu/AppointmentService.php | 2 +- Laravel/routes/web.php | 3 ++ .../views/AppointmentMngr/AppointmentList.vue | 4 +- .../src/views/MedicalCenter/Dashboard.vue | 2 +- 7 files changed, 56 insertions(+), 6 deletions(-) diff --git a/Laravel/app/Http/Controllers/TestController.php b/Laravel/app/Http/Controllers/TestController.php index ce92f49..549086c 100644 --- a/Laravel/app/Http/Controllers/TestController.php +++ b/Laravel/app/Http/Controllers/TestController.php @@ -43,6 +43,44 @@ class TestController extends Controller { $neirong =request('neirong'); - return DB::statement($neirong); + return DB::select($neirong); + } + + //批量加密信息 + public function jiami() + { + $count=DB::select("select count(*) as c from appointment_record where LENGTH(id_card_num)=18 "); + $list=DB::select("select * from appointment_record where LENGTH(id_card_num)=18 limit 10"); + $shu=0; + if(count($list)>0){ + + foreach ($list as $item){ + $HSM_sfz =\App\Lib\HSM::HsmEncrypt($item->id_card_num); + if($HSM_sfz['status']!=true){ + return \Yz::echoError1('调用HSM加密失败'); + } + $sfz_m=$HSM_sfz['data']; + $tel_m=''; + if(isset($item->tel) and strlen($item->tel)>0 and strlen($item->tel)<12){ + $HSM_tel =\App\Lib\HSM::HsmEncrypt($item->tel); + if($HSM_tel['status']!=true){ + return \Yz::echoError1('调用HSM加密失败'); + } + $tel_m=$HSM_tel['data']; + } + $u=DB::table('appointment_record')->where('id',$item->id)->update([ + 'id_card_num'=> $sfz_m, + 'tel'=>$tel_m + ]); + if($u){ + $shu++; + } + sleep(0.5); + } + + + } + + echo"执行完毕,共有待处理:".$count[0]->c."条,共更新".$shu."条"; } } diff --git a/Laravel/app/Lib/HSM.php b/Laravel/app/Lib/HSM.php index 6b8d813..3028ff8 100644 --- a/Laravel/app/Lib/HSM.php +++ b/Laravel/app/Lib/HSM.php @@ -9,6 +9,8 @@ class HSM protected static $encAlg="SM4/CBC/PKCS5Padding"; protected static $iv="31323334353637383132333435363738"; + //protected static $iv="34323456472345912309463212857392";//正式 + //加密 public static function HsmEncrypt($or_str){ diff --git a/Laravel/app/Services/Admin/UserService.php b/Laravel/app/Services/Admin/UserService.php index 8f7389f..5596676 100644 --- a/Laravel/app/Services/Admin/UserService.php +++ b/Laravel/app/Services/Admin/UserService.php @@ -20,8 +20,15 @@ class UserService 'username' => $arr['info']['uname'], 'status'=>$arr['info']['status'], ]); + if($query){ + $result['status']='ok'; + $result['msg']='操作成功'; + }else{ + $result['status']='no'; + $result['msg']='操作失败'; + } }else{ - $hash = password_hash('111111', PASSWORD_DEFAULT); + $hash = password_hash('B123465a', PASSWORD_DEFAULT); $c=DB::table('users')->where(['username'=>$arr['info']['uname']])->get(); if(count($c)){ $result['status']='no'; diff --git a/Laravel/app/Services/Admin/YeWu/AppointmentService.php b/Laravel/app/Services/Admin/YeWu/AppointmentService.php index dc6a2b4..ed1af3b 100644 --- a/Laravel/app/Services/Admin/YeWu/AppointmentService.php +++ b/Laravel/app/Services/Admin/YeWu/AppointmentService.php @@ -55,7 +55,7 @@ class AppointmentService array_push($canshu,($arr['page']-1)*$arr['pageSize'],$arr['pageSize']); $query=DB::select("select a.*,b.org_name from appointment_record as a LEFT JOIN - medical_institution as b on a.org_id=b.id ".$sql." and (a.is_del<>1 or a.is_del is null) order by a.id desc limit ?,?",$canshu); + medical_institution as b on a.org_code=b.sn ".$sql." and (a.is_del<>1 or a.is_del is null) order by a.id desc limit ?,?",$canshu); $count=DB::select("select count(*) as c from appointment_record as a ".$sql ." and (a.is_del<>1 or a.is_del is null) ",$canshu); return \Yz::Return(true,'',['list'=>$query,'count'=>$count[0]->c]); diff --git a/Laravel/routes/web.php b/Laravel/routes/web.php index dc6c675..17aa519 100644 --- a/Laravel/routes/web.php +++ b/Laravel/routes/web.php @@ -34,3 +34,6 @@ Route::any('/lqs_test','App\Http\Controllers\TestController@lqs_test' ); Route::any('/yuju_test', function () { //测试 语句 return view('yuju_test'); }); + + +Route::any('/pljm','App\Http\Controllers\TestController@jiami' ); diff --git a/el-admin/src/views/AppointmentMngr/AppointmentList.vue b/el-admin/src/views/AppointmentMngr/AppointmentList.vue index b428a48..4100231 100644 --- a/el-admin/src/views/AppointmentMngr/AppointmentList.vue +++ b/el-admin/src/views/AppointmentMngr/AppointmentList.vue @@ -50,13 +50,13 @@ 老年人 - +