diff --git a/Laravel/app/Http/Controllers/API/Admin/ConfigController.php b/Laravel/app/Http/Controllers/API/Admin/ConfigController.php index 1882c9a..3b2997d 100644 --- a/Laravel/app/Http/Controllers/API/Admin/ConfigController.php +++ b/Laravel/app/Http/Controllers/API/Admin/ConfigController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers\API\Admin; use App\Http\Controllers\Controller; use App\Services\ConfigService; use Illuminate\Http\Request; +use Illuminate\Support\Facades\DB; class ConfigController extends Controller { @@ -12,7 +13,17 @@ class ConfigController extends Controller //获取站点配置信息 public function GetConfigInfo(){ $configs = new ConfigService(); - return $configs->GetConfigInfo(['站点名称','站点图片','门诊缴费超时时间','门诊缴费轮询间隔']); + $config_arrs = request('config_arrs'); + if(!isset($config_arrs) || empty($config_arrs)){ + $config_arrs =['站点名称','站点图片','门诊缴费超时时间','门诊缴费轮询间隔']; + } + return $configs->GetConfigInfo($config_arrs); + } + public function GetConfigInfo2(){ + $config_arrs = request('config_arrs'); + $q=DB::table('configs')->select(['label','value'])->whereIn('label',$config_arrs)->get(); + return \Yz::JsonReturn(true,"查询完成",['list'=>$q]); + } public function SaveConfig(){ $info = request('info'); diff --git a/Laravel/app/Http/Controllers/API/PdfController.php b/Laravel/app/Http/Controllers/API/PdfController.php new file mode 100644 index 0000000..4abad0a --- /dev/null +++ b/Laravel/app/Http/Controllers/API/PdfController.php @@ -0,0 +1,96 @@ +where(['a.entrust_id'=>$orderNo,'a.list_status'=>1,'a.is_nullify'=>0])->first(); + $url=""; + if(!!$entrustInfo) $url=env('APP_URL') .$entrustInfo->check_aply_pdf ; + $list[] = [ + 'OrderNo' => $orderNo, + 'PdfUrl' => $url, + ]; + } + return \Yz::JsonReturn(true, '查询完成', ['list' => $list]); + } + + //创建检查申请单pdf文件 + public function CreateJianChaShenQingDanPdf() + { + $OrderNoList = request('OrderNoList');//医嘱号列表(数组) + if (!isset($OrderNoList) or empty($OrderNoList)) return \Yz::JsonReturn("OrderNoList,不能为空"); + if (!is_array($OrderNoList)) return \Yz::JsonReturn("OrderNoList,应为数组"); + $config=DB::table('configs')->where(['label'=>'开启申请单pdf'])->first(); + if (!$config or $config->value<>1) return \Yz::JsonError("未开启申请单pdf"); + $generator = new \Picqer\Barcode\BarcodeGeneratorHTML(); + $successCount=0; + foreach ($OrderNoList as $orderNo) { + $entrustInfo=DB::table('s_list as a')->where(['a.entrust_id'=>$orderNo,'a.list_status'=>1,'a.is_nullify'=>0]) + ->select('a.*','c.period_begin_time','c.period_end_time') + ->leftJoin('s_period as c','a.reservation_time','=','c.id') + ->first(); + if(!$entrustInfo) continue; + $tiaoma = $generator->getBarcode($entrustInfo->app_num, $generator::TYPE_CODE_128, 2, 40); + + $source=null; + if(!empty($entrustInfo->reservation_sources)){ + $source=DB::table('s_department_resources')->where(['id'=>$entrustInfo->reservation_sources])->first(); + } + $entrustInfo->department_resources=$source; + $entrustInfo->user_sex_label=''; + if($entrustInfo->user_sex==1){ + $entrustInfo->user_sex_label='男'; + } + if($entrustInfo->user_sex==2){ + $entrustInfo->user_sex_label='女'; + } + $entrustInfo->age=\Tools::getAgeFromBirthday($entrustInfo->user_brithday); + //患者类型 + $p_type=config('app.globals.患者类型'); + $entrustInfo->patient_type_label=$p_type[$entrustInfo->patient_type] ?? ''; + //星期 + $entrustInfo->weekday_label=\Tools::GetWeekName($entrustInfo->reservation_date); + + // 准备数据 + $data = [ + 'printInfo' =>$entrustInfo, + 'barcode' => $tiaoma, + ]; + + $filePath = storage_path('app/public/CheckPdf/' . date('Ymd') . '/' . $orderNo . '.pdf'); +// 检查文件是否存在,存在则删除 + if (File::exists($filePath)) { + File::delete($filePath); + } +// 生成并保存新文件 + $pdf = SnappyPdf::loadView('pdf.JianChaShenQingDan', $data) + ->setOption('page-size', 'a5') + // 设置方向(portrait 纵向 / landscape 横向) + ->setOption('orientation', 'landscape'); + $pdf->save($filePath); + $fileUrl = Storage::url('CheckPdf/' . date('Ymd') . '/' . $orderNo . '.pdf'); + DB::table('s_list')->where('entrust_id', $orderNo)->update(['check_aply_pdf' => $fileUrl]); + $successCount++; + } + + return \Yz::JsonReturn(true, '生成检查申请单pdf成功', ['success_count' => $successCount]); + + + } + +} diff --git a/Laravel/composer.json b/Laravel/composer.json index a4eb26c..f1394f9 100644 --- a/Laravel/composer.json +++ b/Laravel/composer.json @@ -6,6 +6,7 @@ "license": "MIT", "require": { "php": "^7.4|^8.0", + "barryvdh/laravel-snappy": "^1.0", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "laravel/framework": "^8.75", diff --git a/Laravel/composer.lock b/Laravel/composer.lock index 6eb020c..23fb4ea 100644 --- a/Laravel/composer.lock +++ b/Laravel/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f37155ab1899ea3d5b3c56dba1cf5e92", + "content-hash": "091dac62fedbd23925a364176d123da9", "packages": [ { "name": "asm89/stack-cors", @@ -68,6 +68,84 @@ }, "time": "2022-01-18T09:12:03+00:00" }, + { + "name": "barryvdh/laravel-snappy", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-snappy.git", + "reference": "2c18a3602981bc6f25b32908cf8aaa05952ab2f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/laravel-snappy/zipball/2c18a3602981bc6f25b32908cf8aaa05952ab2f7", + "reference": "2c18a3602981bc6f25b32908cf8aaa05952ab2f7", + "shasum": "" + }, + "require": { + "illuminate/filesystem": "^6|^7|^8|^9", + "illuminate/support": "^6|^7|^8|^9", + "knplabs/knp-snappy": "^1", + "php": ">=7.2" + }, + "require-dev": { + "orchestra/testbench": "^4|^5|^6|^7" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "PDF": "Barryvdh\\Snappy\\Facades\\SnappyPdf", + "SnappyImage": "Barryvdh\\Snappy\\Facades\\SnappyImage" + }, + "providers": [ + "Barryvdh\\Snappy\\ServiceProvider" + ] + }, + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Barryvdh\\Snappy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "Snappy PDF/Image for Laravel", + "keywords": [ + "image", + "laravel", + "pdf", + "snappy", + "wkhtmltoimage", + "wkhtmltopdf" + ], + "support": { + "issues": "https://github.com/barryvdh/laravel-snappy/issues", + "source": "https://github.com/barryvdh/laravel-snappy/tree/v1.0.0" + }, + "funding": [ + { + "url": "https://fruitcake.nl", + "type": "custom" + }, + { + "url": "https://github.com/barryvdh", + "type": "github" + } + ], + "time": "2022-01-29T19:36:49+00:00" + }, { "name": "brick/math", "version": "0.9.3", @@ -1032,6 +1110,80 @@ ], "time": "2023-08-03T15:06:02+00:00" }, + { + "name": "knplabs/knp-snappy", + "version": "v1.4.4", + "source": { + "type": "git", + "url": "https://github.com/KnpLabs/snappy.git", + "reference": "3db13fe45d12a7bccb2b83f622e5a90f7e40b111" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/KnpLabs/snappy/zipball/3db13fe45d12a7bccb2b83f622e5a90f7e40b111", + "reference": "3db13fe45d12a7bccb2b83f622e5a90f7e40b111", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/log": "^1.0||^2.0||^3.0", + "symfony/process": "~3.4||~4.3||~5.0||~6.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16||^3.0", + "pedrotroller/php-cs-custom-fixer": "^2.19", + "phpstan/phpstan": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.0.0", + "phpunit/phpunit": "~7.4||~8.5" + }, + "suggest": { + "h4cc/wkhtmltoimage-amd64": "Provides wkhtmltoimage-amd64 binary for Linux-compatible machines, use version `~0.12` as dependency", + "h4cc/wkhtmltoimage-i386": "Provides wkhtmltoimage-i386 binary for Linux-compatible machines, use version `~0.12` as dependency", + "h4cc/wkhtmltopdf-amd64": "Provides wkhtmltopdf-amd64 binary for Linux-compatible machines, use version `~0.12` as dependency", + "h4cc/wkhtmltopdf-i386": "Provides wkhtmltopdf-i386 binary for Linux-compatible machines, use version `~0.12` as dependency", + "wemersonjanuario/wkhtmltopdf-windows": "Provides wkhtmltopdf executable for Windows, use version `~0.12` as dependency" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Knp\\Snappy\\": "src/Knp/Snappy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "KNP Labs Team", + "homepage": "http://knplabs.com" + }, + { + "name": "Symfony Community", + "homepage": "http://github.com/KnpLabs/snappy/contributors" + } + ], + "description": "PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage.", + "homepage": "http://github.com/KnpLabs/snappy", + "keywords": [ + "knp", + "knplabs", + "pdf", + "snapshot", + "thumbnail", + "wkhtmltopdf" + ], + "support": { + "issues": "https://github.com/KnpLabs/snappy/issues", + "source": "https://github.com/KnpLabs/snappy/tree/v1.4.4" + }, + "time": "2023-09-13T12:18:19+00:00" + }, { "name": "laravel/framework", "version": "v8.83.27", diff --git a/Laravel/config/app.php b/Laravel/config/app.php index 7e18451..dcf2386 100644 --- a/Laravel/config/app.php +++ b/Laravel/config/app.php @@ -191,6 +191,7 @@ return [ App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, App\Providers\SoapServiceProvider::class, + Barryvdh\Snappy\ServiceProvider::class, ], /* @@ -245,7 +246,6 @@ return [ 'URL' => Illuminate\Support\Facades\URL::class, 'Validator' => Illuminate\Support\Facades\Validator::class, 'View' => Illuminate\Support\Facades\View::class, - ], ]; diff --git a/Laravel/config/snappy.php b/Laravel/config/snappy.php new file mode 100644 index 0000000..01a6d92 --- /dev/null +++ b/Laravel/config/snappy.php @@ -0,0 +1,52 @@ + [ + 'enabled' => true, + 'binary' => '"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe"', + 'timeout' => false, + 'options' => [], + 'env' => [], + ], + + 'image' => [ + 'enabled' => true, + 'binary' => '"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltoimage.exe"', + 'timeout' => false, + 'options' => [], + 'env' => [], + ], + +]; diff --git a/Laravel/resources/views/pdf/JianChaShenQingDan.blade.php b/Laravel/resources/views/pdf/JianChaShenQingDan.blade.php new file mode 100644 index 0000000..ef55c3f --- /dev/null +++ b/Laravel/resources/views/pdf/JianChaShenQingDan.blade.php @@ -0,0 +1,103 @@ + + + + + 11 + + + +
+
+
秦皇岛市中医医院
+
检查预约回执单
+
+
{!! $barcode !!}
+
{{$printInfo->app_num}}
+
+
+ +
+ + + + + + + + + + @if($printInfo->patient_type==0) + @endif + + +
姓名:{{$printInfo->user_name}}性别:{{$printInfo->user_sex_label}}年龄:{{$printInfo->age}}病人类型:{{$printInfo->patient_type_label}}
+ {{$printInfo->patient_type_label}}号:{{$printInfo->reg_num}} + 病区:{{$printInfo->warddesc ?? ''}}床号:{{$printInfo->bedno ?? ''}}联系电话:{{$printInfo->user_phone}}
+
+
+
检查项目:{{$printInfo->entrust}}
+
预约时间:{{$printInfo->reservation_date}} + {{substr($printInfo->period_begin_time,0,5)}}-{{substr($printInfo->period_end_time,0,5)}} + {{$printInfo->weekday_label}} +
+
检查地点:{{$printInfo->department_resources->department_resources_name}}
+
+
+ + + + + +
温馨提示: +
1、预约后请您及时缴费,门诊患者预约成功后60分钟内不缴费,系统会自动取消您的预约申请。自动取消后,如需继续预约,请到相关检查科室重新预约。
+
2、预约时间为8点~10点的,请8点到登记处签到,预约时间为10点~12点的,请10点前到登记处签到,便于工作人员进行检查评估和准备。
+
3、预约时间不是实际检查时间,以现场登记后排队号为准。
+
+
+
+
检查须知:
+
+ 腹部检查禁食4小时,腹部、盆腔、泌尿系统检查请尽量饮水,充盈肠道及膀胱;危重病人需由家属陪同;孕妇及婴幼儿请慎行检查。 +
+
+
+ 申请时间:{{$printInfo->entrust_date.' '.$printInfo->entrust_time}} +
+
+ + diff --git a/Laravel/routes/api.php b/Laravel/routes/api.php index f6fc786..db4eaa2 100644 --- a/Laravel/routes/api.php +++ b/Laravel/routes/api.php @@ -108,6 +108,7 @@ Route::group(['middleware'=>['checktoken','log'],'prefix'=>'v1'],function () { //暂时不加权限 Route::group(['middleware'=>['log']],function () { + Route::post('admin/GetConfigInfo','App\Http\Controllers\API\Admin\ConfigController@GetConfigInfo2'); //获取配置信息 Route::post('admin/getMainDetail','App\Http\Controllers\API\Admin\YeWu\WorkMainController@getMainDetail');//获取主表信息 Route::post('admin/GetEnablePlan','App\Http\Controllers\API\Admin\YeWu\PlanListController@GetEnablePlan');//获取可用的计划,用于计划占用 Route::post('admin/PlanYuYue','App\Http\Controllers\API\Admin\YeWu\PlanListController@YuYue');//开始预约 @@ -128,6 +129,7 @@ Route::group(['middleware'=>['log']],function () { Route::post('admin/HisGetDepartmentList','App\Http\Controllers\API\His\DepartmentController@GetDepartmentList');//获取his科室列表 Route::post('admin/HisGetUserList','App\Http\Controllers\API\His\UserController@GetUserList');//获取his用户列表 Route::post('admin/HisAutoLogin','App\Http\Controllers\API\His\UserController@AutoLogin' ); + Route::any('CreateJianChaShenQingDanPdf','App\Http\Controllers\API\PdfController@CreateJianChaShenQingDanPdf' ); }); //H5端接口 @@ -158,6 +160,7 @@ Route::group(['middleware'=>['log']],function () { Route::post('/PacsSignIn','App\Http\Controllers\API\Third\PacsController@SignIn' ); Route::post('/PacsCancelSignIn','App\Http\Controllers\API\Third\PacsController@CancelSignIn' ); Route::post('/GetEntrustInfo','App\Http\Controllers\API\Third\PacsController@GetEntrustInfo' ); + Route::post('/GetCheckPdf','App\Http\Controllers\API\PdfController@GetCheckPdf' ); }); diff --git a/YiJi-admin/src/api/api.js b/YiJi-admin/src/api/api.js index e6d082f..38557db 100644 --- a/YiJi-admin/src/api/api.js +++ b/YiJi-admin/src/api/api.js @@ -100,6 +100,9 @@ export const ChangInfo = (data = {}) => { export const GetConfigInfo = (data = {}) => { return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/GetConfigInfo', data: data }) } +export const GetConfigInfo2 = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'admin/GetConfigInfo', data: data }) +} //admin后台保存站点配置信息 export const SaveConfigInfo = (data = {}) => { return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/SaveConfigInfo', data: data }) @@ -375,4 +378,8 @@ export const ChangeDefaultDept = (data = {}) => { //his自动登录,医生直接跳转过来,查看开单记录 export const HisAutoLogin = (data = {}) => { return axios({ url: import.meta.env.VITE_APP_API + 'admin/HisAutoLogin', data: data }) +} +//生成检查申请单pdf文件 +export const CreateJianChaShenQingDanPdf = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'CreateJianChaShenQingDanPdf', data: data }) } \ No newline at end of file diff --git a/YiJi-admin/src/components/Yewu/YuYue202506.vue b/YiJi-admin/src/components/Yewu/YuYue202506.vue index 3b3db54..bc96b39 100644 --- a/YiJi-admin/src/components/Yewu/YuYue202506.vue +++ b/YiJi-admin/src/components/Yewu/YuYue202506.vue @@ -2,15 +2,18 @@
- {{patientInfo.user_name}}({{patientInfo.user_sex_label}} {{patientInfo.age}}岁) - 登记号:{{patientInfo.reg_num}} 电话:{{patientInfo.user_phone}} +
{{patientInfo.user_name}}({{patientInfo.user_sex_label}} {{patientInfo.age}}岁)
+
登记号:{{patientInfo.reg_num}}
+
电话:{{patientInfo.user_phone}}
+
病区:{{patientInfo.warddesc}}
+
床号:{{patientInfo.bedname}}
+
诊断:{{patientInfo.diagnosisName}}
获取患者信息失败
- @@ -127,7 +130,7 @@ CheckIsDaiJian, PlanYuYue, CheckEntrstItemGroup2, - DoctorCancelYuYue + DoctorCancelYuYue,GetConfigInfo2,CreateJianChaShenQingDanPdf } from '@/api/api.js' import { ElMessage, @@ -170,6 +173,7 @@ let shenqingdan_show = ref(false); let handleType = ref('add'); let startDate = ref(''); + let systemConfigs=ref([]);//系统参数 const getWeekday = (date1) => { let days = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; const date = new Date(date1); // 注意:格式可能因浏览器而异 @@ -391,6 +395,7 @@ zhenShiList.value=[] if (res.status) { let plans = res.data.plan_list + let zhanWeiCount=res.data.zhanWeiCount if (plans.length > 0) { if (activeZhenShi.value == '') activeZhenShi.value = plans[0].department_resources_name @@ -425,7 +430,7 @@ ); let plan_enable = false if (matchingPlan) { - if (matchingPlan.count - matchingPlan.used_count > 0) { + if (matchingPlan.count - matchingPlan.used_count >= zhanWeiCount ) { plan_enable = true } row[date] = { @@ -564,6 +569,11 @@ }).then(res => { planLoading.value = false if (res.status) { + systemConfigs.value.forEach((v,i)=>{ + if(v.label=='开启申请单pdf' && v.value==="1"){ + CreateJianChaShenQingDanPdfFunc() + } + }) GetMainInfo() if (auto_print.value.length > 0) { print_shenqingdan() @@ -626,6 +636,31 @@ }) } + const GetConfigInfoFunc=()=>{ + GetConfigInfo2({ + config_arrs: ['开启申请单pdf','医生端打印'], + }).then(res => { + if(res.status){ + systemConfigs.value=res.data.list + systemConfigs.value.forEach((v,i)=>{ + console.log(props.appointment_type) + if(v.label=='医生端打印' && v.value==="0" && props.appointment_type==1){ + auto_print.value=[] + } + }) + } + }) + } + //生成pdf文件 + const CreateJianChaShenQingDanPdfFunc=()=>{ + CreateJianChaShenQingDanPdf({ + OrderNoList: selectedEntrustId.value, + }).then(res => { + if(res.status){ + + } + }) + } //打印申请单 let shenqingdan_list = ref([]) const print_shenqingdan = () => { @@ -729,6 +764,7 @@ return `${year}-${month}-${day}`; } onMounted(() => { + GetConfigInfoFunc() date_list.value = getDatesAfter() GetMainInfo() }) @@ -736,13 +772,17 @@