增加获取用户报告url接口

main
yanzai 1 year ago
parent 36f6b3fa67
commit 74193c2c82

@ -3,6 +3,7 @@
namespace App\Http\Controllers\API\mH5;
use App\Http\Controllers\Controller;
use App\Lib\HSM;
use App\Services\mH5\PersonService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
@ -33,7 +34,7 @@ class PersonController extends Controller
return \Yz::echoError1('调用HSM加密失败');
}
$sfz=$HSM_sfz['data'];
$info=DB::table('examination_records')->where(['id_card_num'=>$sfz]) ->orderBy('id', 'desc')->first();
$info=DB::table('examination_records')->where(['id_card_num'=>$sfz,'is_del'=>0]) ->orderBy('id', 'desc')->first();
if($info){
$info->pdfs=count(json_decode($info->pdfs, true));
$item=DB::table('report_result_item')
@ -85,26 +86,42 @@ class PersonController extends Controller
//用户扫码跳转输入身份证和电话 查询用户体检详情和pdf
public function H5GetPersonReportDetail(){
$get_info =request('info');
if(!isset($get_info['sfz'])) return \Yz::echoError1('身份证不能为空');
if(!isset($get_info['tel'])) return \Yz::echoError1('电话不能为空');
$info=DB::table('examination_records');
if(isset($get_info['tj_num'])){
$HSM =\App\Lib\HSM::HsmDecrypt($get_info['tj_num']);
if($HSM['status']!=true){
return \Yz::echoError1('调用HSM解密失败');
}
$get_info['tj_num'] = $HSM['data'];
$info=$info->where(['tijian_num'=>$get_info['tj_num']]);
}else{
if(!isset($get_info['sfz'])) return \Yz::echoError1('身份证不能为空');
if(!isset($get_info['tel'])) return \Yz::echoError1('电话不能为空');
//HSM加密
$HSM_sfz =\App\Lib\HSM::HsmEncrypt($get_info['sfz']);
if($HSM_sfz['status']!=true){
return \Yz::echoError1('调用HSM加密失败');
}
$get_info['sfz']=$HSM_sfz['data'];
if(isset($get_info['tel'])){
$HSM_tel =\App\Lib\HSM::HsmEncrypt($get_info['tel']);
if($HSM_tel['status']!=true){
//HSM加密
$HSM_sfz =\App\Lib\HSM::HsmEncrypt($get_info['sfz']);
if($HSM_sfz['status']!=true){
return \Yz::echoError1('调用HSM加密失败');
}
$get_info['tel']=$HSM_tel['data'];
$get_info['sfz']=$HSM_sfz['data'];
if(isset($get_info['tel'])){
$HSM_tel =\App\Lib\HSM::HsmEncrypt($get_info['tel']);
if($HSM_tel['status']!=true){
return \Yz::echoError1('调用HSM加密失败');
}
$get_info['tel']=$HSM_tel['data'];
}
$info=$info->where(['id_card_num'=>$get_info['sfz'],'tel'=>$get_info['tel']]);
}
$info=DB::table('examination_records')->where(['id_card_num'=>$get_info['sfz'],'tel'=>$get_info['tel']]) ->orderBy('id', 'desc')->first();
$info=$info->where(['is_del'=>0]) ->orderBy('id', 'desc')->first();
if($info){
$HSM_sfz =\App\Lib\HSM::HsmDecrypt($info->id_card_num);
if($HSM_sfz['status']!=true){
return \Yz::echoError1('调用HSM解密失败');
}
$info->id_card_num = $HSM_sfz['data'];
$item=DB::table('report_result_item')
->where(['examination_id'=>$info->id])
->select(['item_name','item_result','flag'])->get();
@ -112,8 +129,8 @@ class PersonController extends Controller
$accessTimeout = \JWT::GetGetSecretTimeOut();
$refreshTimeout = \JWT::GetRefreshTokenTimeOut();
$access_token = \JWT::BuildJWT('yz','access',$get_info['sfz'],'mH5user',$accessTimeout);
$refresh_token = \JWT::BuildJWT('yz','refresh',$get_info['sfz'],'',$refreshTimeout);
$access_token = \JWT::BuildJWT('yz','access',$info->id_card_num,'mH5user',$accessTimeout);
$refresh_token = \JWT::BuildJWT('yz','refresh',$info->id_card_num,'',$refreshTimeout);
return \Yz::Return(true,'',['info'=>$info,'token'=>$access_token,'refresh_token'=>$refresh_token]);
}else{
@ -121,4 +138,27 @@ class PersonController extends Controller
}
}
//给体检提供查看用户健康证报告的url 用于体检那边生成二维码
public function GetReportUrl()
{
$tijian_num =request('tijian_num');
//$baseUrl='http://223.71.106.251:82';
$baseUrl=env('QIANZHI_WAIWANG');
$report=DB::table('examination_records')->where(['tijian_num'=>$tijian_num,'is_del'=>0])->first();
if(!!$report){
$HSM=\App\Lib\HSM::HsmEncrypt($tijian_num);
if($HSM['status']!=true){
return \Yz::echoError1('调用HSM加密失败');
}
$tijian_num=$HSM['data'];
$url=$baseUrl.'/mh5/#/personReportLogin?lg_type=ewm&tj_num='.$tijian_num;
return \Yz::Return(true,'获取成功',$url);
}else{
return \Yz::echoError1('没有此体检号对应的记录');
}
}
}

@ -92,6 +92,7 @@ Route::group(['middleware'=>['check.sign','log'],'prefix'=>'v1'],function () {
Route::get('GetPersonCheckUpDetail','App\Http\Controllers\API\Admin\YeWu\HealthCheckupController@GetPersonCheckUpDetail');//根据体检号查询体检详情
Route::post('CreateAppointment','App\Http\Controllers\API\Admin\YeWu\AppointmentController@CreateAppointment');//创建预约记录
Route::post('CreateCheckupPdf','App\Http\Controllers\API\Admin\YeWu\HealthCheckupController@CreateCheckupPdf');//对外接口,创建体检记录 姓名、电话、身份证、体检机构编码、体检号、pdfs
Route::get('GetReportUrl','App\Http\Controllers\API\mH5\PersonController@GetReportUrl');//对外接口获取用户体检报告url
});

@ -9,7 +9,9 @@
</template>
<script setup>
import { defineProps } from 'vue';
defineProps({status:false});
console.log(status)
</script>
<style scoped>

@ -1,5 +1,5 @@
<template>
<div class="LoginMain">
<div class="LoginMain" v-if="logintype !='ewm'">
<div class="info">
<div class="tip">查询体检信息</div>
<div class="label">身份证</div>
@ -41,15 +41,22 @@
tel:''
})
let buttonText=ref('开始预约')
const SearchInfo=()=>{
if(info.value.sfz=='' || info.value.tel==''){
showToast('请输入身份证和手机号码');
return false
const SearchInfo=(tijian_num=null)=>{
if(tijian_num !=null && tijian_num!=undefined){
info.value={
tj_num:tijian_num
}
}else{
if(info.value.sfz=='' || info.value.tel==''){
showToast('请输入身份证和手机号码');
return false
}
}
H5GetPersonReportDetail({info:info.value}).then(res => {
loading.value=false
if (res.status) {
sessionStorage.setItem('sfz', info.value.sfz);
sessionStorage.setItem('sfz', res.data.info.id_card_num);
sessionStorage.setItem('token', res.data.token);
sessionStorage.setItem('refreshToken', res.data.refresh_token);
var token = sessionStorage.getItem('token');
@ -62,22 +69,24 @@
})
}
let tijian_num=ref('');
let logintype=ref('');
onMounted(() => {
let tijian_num =route.query.tijian_num
let logintype =route.query.logintype
tijian_num.value =route.query.tj_num
logintype.value =route.query.lg_type
sessionStorage.setItem('loginType', logintype);
sessionStorage.setItem('tijian_num', tijian_num);
sessionStorage.setItem('loginType', logintype.value);
sessionStorage.setItem('tijian_num', tijian_num.value);
let sloginType=sessionStorage.getItem('loginType');
console.log(sloginType)
if(sloginType=='undefined'){
console.log('denglu')
buttonText.value='开始预约'
}else{
console.log('report')
buttonText.value='查看报告'
}
console.log(logintype.value)
if(sloginType=='ewm'){ //
if(tijian_num.value != undefined){
SearchInfo(tijian_num.value)
}else{
showToast('参数缺失');
}
}
//router.replace('/selectOrganization')
//window.location.href="http://localhostcommon/wxLogin"

@ -1,41 +1,44 @@
<template>
<div class="showreport" v-if="reportinfo !=''">
<div >
<LoadingD :status="loading"></LoadingD>
<div class="top">
<van-row class="title">
<van-col span="6">姓名</van-col>
<van-col span="18">{{reportinfo.name}}</van-col>
</van-row>
<van-row class="title">
<van-col span="6">性别</van-col>
<van-col span="18" v-if="reportinfo.sex==0"></van-col>
<van-col span="18" v-if="reportinfo.sex==1"></van-col>
</van-row>
<van-row class="title">
<van-col span="6">身份证</van-col>
<van-col span="18">{{reportinfo.id_card_num}}</van-col>
</van-row>
<van-row class="button">
<van-col span="12"><van-button @click="gotoHealthCertificate" size="small" plain>查看健康证</van-button></van-col>
<van-col span="12"><van-button size="small" @click="previewReport" plain>查看报告</van-button></van-col>
</van-row>
<div class="title1">北京市从业人员体检结果</div>
</div>
<div class="bottom">
<van-row style="margin-top: 20px;color: #9e9e9e;">
<van-col span="4"></van-col>
<van-col span="16">项目</van-col>
<van-col span="4">结果</van-col>
</van-row>
<van-row v-for="(item, index) in reportinfo.items" :key="index" class="list">
<van-col v-if="item.flag == '' || item.flag == null" span="4"><van-icon name="checked" color="#4dde79" size="20px" /></van-col>
<van-col v-else span="4"><van-icon name="warning" color="#de554d" size="20px" /></van-col>
<van-col span="16">{{ item.item_name }}</van-col>
<van-col v-if="item.flag == '' || item.flag == null" span="4"><span style="color: #ccc;"></span></van-col>
<van-col v-else span="4">{{item.item_result}}</van-col>
</van-row>
</div>
<div class="showreport" v-if="reportinfo !=''">
<div class="top" >
<van-row class="title">
<van-col span="6">姓名</van-col>
<van-col span="18">{{reportinfo.name}}</van-col>
</van-row>
<van-row class="title">
<van-col span="6">性别</van-col>
<van-col span="18" v-if="reportinfo.sex==0"></van-col>
<van-col span="18" v-if="reportinfo.sex==1"></van-col>
</van-row>
<van-row class="title">
<van-col span="6">身份证</van-col>
<van-col span="18">{{reportinfo.id_card_num}}</van-col>
</van-row>
<van-row class="button">
<!-- <van-col span="12"><van-button @click="gotoHealthCertificate" size="small" plain>查看健康证</van-button></van-col> -->
<van-col span="24"><van-button size="small" @click="previewReport" plain>查看报告</van-button></van-col>
</van-row>
<div class="title1">北京市从业人员体检结果</div>
</div>
<div class="bottom">
<van-row style="margin-top: 20px;color: #9e9e9e;">
<van-col span="4"></van-col>
<van-col span="16">项目</van-col>
<van-col span="4">结果</van-col>
</van-row>
<van-row v-for="(item, index) in reportinfo.items" :key="index" class="list">
<van-col v-if="item.flag == '' || item.flag == null" span="4"><van-icon name="checked" color="#4dde79" size="20px" /></van-col>
<van-col v-else span="4"><van-icon name="warning" color="#de554d" size="20px" /></van-col>
<van-col span="16">{{ item.item_name }}</van-col>
<van-col v-if="item.flag == '' || item.flag == null" span="4"><span style="color: #ccc;"></span></van-col>
<van-col v-else span="4">{{item.item_result}}</van-col>
</van-row>
</div>
</div>
<van-popup v-model:show="showPicker" round position="bottom">
<van-picker
:columns="columns"

Loading…
Cancel
Save