main
鹿和sa0ChunLuyu 2 weeks ago
parent 8c09b60ae2
commit 608445836a

@ -104,6 +104,8 @@ public function public()
'GetPendingOrders' => $base_url . '/api/H5/GetPendingOrders', // 获取用户待预约订单
'LockPlan' => $base_url . '/api/H5/LockPlan', // 锁定号源
'ChangeOrderButtonStatus' => $base_url . '/api/H5/ChangeOrderButtonStatus', // 锁定号源
'CheckChildCare' => $base_url . '/api/H5/User/checkChildCare', // 儿保科校验
'CheckTestButton' => $base_url . '/api/H5/User/checkTestButton', // 测试按钮显示
];
}

@ -274,6 +274,7 @@ public function info(Request $request)
'sex' => isset($default_person->sex) ? $default_person->sex : null,
'phone' => isset($default_person->phone) ? $default_person->phone:null,
'id_number' => isset($default_person->id_number) ? $default_person->id_number:null,
'birthday' => isset($default_person->birthday) ? $default_person->birthday : null,
'count' => $count,
'openid' => $openid,
'person_id' => $default_person->id,
@ -458,4 +459,125 @@ public function UpdatePersonList($openid)
// }
return true;
}
public function checkChildCare(Request $request)
{
$person_id = $request->post('person_id');
if (!$person_id) return \Yz::echoError1('person_id 不能为空');
$person = DB::table('web_user_person')->where(['id' => $person_id, 'is_del' => 0])->first();
if (!$person) return \Yz::echoError1('就诊人不存在');
// 获取出生日期,为空则从身份证号提取
$birthday = $person->birthday;
if (!$birthday && $person->id_number) {
$id_number = $person->id_number;
$len = strlen($id_number);
if ($len == 18) {
$birth = substr($id_number, 6, 8);
$birthday = substr($birth, 0, 4) . '-' . substr($birth, 4, 2) . '-' . substr($birth, 6, 2);
} elseif ($len == 15) {
$birth = substr($id_number, 6, 6);
$birthday = '19' . substr($birth, 0, 2) . '-' . substr($birth, 2, 2) . '-' . substr($birth, 4, 2);
}
}
if (!$birthday) return \Yz::echoError1('无法获取出生日期');
// 计算周岁年龄
$birth = new \DateTime($birthday);
$now = new \DateTime();
$age = $now->diff($birth)->y;
// 读取儿保科配置
$config = DB::table('configs')->where(['label' => '儿保科配置'])->first();
if (!$config) return \Yz::echoError1('儿保科配置未设置');
$configJson = json_decode($config->value, true);
if (!$configJson || !isset($configJson['age']) || !isset($configJson['check'])) {
return \Yz::echoError1('儿保科配置格式异常');
}
// status 灰度控制0=白名单模式1=全量模式
$status = $configJson['status'] ?? '1';
if ($status == '0') {
$testConfig = DB::table('configs')->where(['label' => '首页测试按钮'])->first();
$idList = $testConfig ? json_decode($testConfig->value, true) : [];
$inWhitelist = false;
if (is_array($idList)) {
if ($person->id_number) {
// 有身份证号,直接判断
$inWhitelist = in_array($person->id_number, $idList);
} else {
// 身份证号为空(新生儿),查同 user_id 下其他就诊人
$siblings = DB::table('web_user_person')
->where(['user_id' => $person->user_id, 'is_del' => 0])
->where('id', '!=', $person->id)
->whereNotNull('id_number')
->where('id_number', '!=', '')
->get();
foreach ($siblings as $sibling) {
if (in_array($sibling->id_number, $idList)) {
$inWhitelist = true;
break;
}
}
}
}
if (!$inWhitelist) {
return \Yz::Return(true, '成功', ['check' => '0', 'path' => '']);
}
}
$configAge = (int)$configJson['age'];
$check = $configJson['check'];
$path = $age < $configAge ? ($configJson['path'] ?? '') : '';
return \Yz::Return(true, '成功', [
'check' => $check,
'path' => $path
]);
}
public function checkTestButton(Request $request)
{
$person_id = $request->post('person_id');
if (!$person_id) return \Yz::echoError1('person_id 不能为空');
$person = DB::table('web_user_person')->where(['id' => $person_id, 'is_del' => 0])->first();
if (!$person) return \Yz::echoError1('就诊人不存在');
// 读取首页测试按钮配置
$config = DB::table('configs')->where(['label' => '首页测试按钮'])->first();
if (!$config) return \Yz::Return(true, '成功', ['check' => '0']);
$idList = json_decode($config->value, true);
if (!is_array($idList)) return \Yz::Return(true, '成功', ['check' => '0']);
$inWhitelist = false;
if ($person->id_number) {
// 有身份证号,直接判断
$inWhitelist = in_array($person->id_number, $idList);
} else {
// 身份证号为空(新生儿),查同 user_id 下其他就诊人
$siblings = DB::table('web_user_person')
->where(['user_id' => $person->user_id, 'is_del' => 0])
->where('id', '!=', $person->id)
->whereNotNull('id_number')
->where('id_number', '!=', '')
->get();
foreach ($siblings as $sibling) {
if (in_array($sibling->id_number, $idList)) {
$inWhitelist = true;
break;
}
}
}
$check = $inWhitelist ? '1' : '0';
return \Yz::Return(true, '成功', ['check' => $check]);
}
}

@ -27,6 +27,8 @@
Route::any("/api/H5/User/info", [\App\Http\Controllers\API\H5\UserController::class, 'info']);
Route::any("/api/H5/Config/version", [\App\Http\Controllers\API\H5\HomeController::class, 'config_version']);
Route::any("/api/H5/Config/config", [\App\Http\Controllers\API\H5\HomeController::class, 'config']);
Route::any("/api/H5/User/checkChildCare", [\App\Http\Controllers\API\H5\UserController::class, 'checkChildCare']);
Route::any("/api/H5/User/checkTestButton", [\App\Http\Controllers\API\H5\UserController::class, 'checkTestButton']);
Route::any("/api/Demo/pay_back", [\App\Http\Controllers\API\DemoController::class, 'pay_back']);
Route::any("/api/Demo/pay", [\App\Http\Controllers\API\DemoController::class, 'pay']);

@ -305,6 +305,14 @@
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/test/test2",
"style" :
{
"navigationBarTitleText" : "测试页",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/main/order/order_new",
"style" :

@ -18,6 +18,7 @@
import {
useStore
} from '@/store'
import wx from 'weixin-js-sdk'
const $store = useStore()
const $props = defineProps({
@ -80,10 +81,35 @@
url: '/pages/main/order/order'
})
}
const toPlan=()=>{
uni.reLaunch({
url: '/pages/main/yytjsj/yytjsj_new?id='+$props.id
const toPlan=async ()=>{
try {
const person_id = order_info.value.person_id || $store.user.person_id
const response = await $api('CheckChildCare', { person_id }, { loading: true, loading_text: ' ' })
$response(response, () => {
const { check, path } = response.data
if (!path) {
uni.reLaunch({ url: '/pages/main/yytjsj/yytjsj_new?id=' + $props.id })
} else {
if (check == 1) {
uni.showModal({
title: '提示',
content: '即将跳转到儿保科,是否确认?',
success: (res) => {
if (res.confirm) {
wx.miniProgram.navigateTo({ url: path.startsWith('/') ? path : '/' + path })
}
}
})
} else {
wx.miniProgram.navigateTo({ url: path.startsWith('/') ? path : '/' + path })
}
}
}, {}, () => {
uni.reLaunch({ url: '/pages/main/yytjsj/yytjsj_new?id=' + $props.id })
})
} catch (e) {
uni.reLaunch({ url: '/pages/main/yytjsj/yytjsj_new?id=' + $props.id })
}
}
onShow(() => {

@ -44,6 +44,7 @@
// $store.user = response.data.info
$store.setUser(response.data.info);
GetNoticeFunc()
checkTestButton()
})
} catch (e) {
console.error('[获取用户信息失败]', e)
@ -58,7 +59,7 @@
// '/pages/main/order/order',
// '/pages/main/combo/combo',
]
const buttonClick = (info) => {
const buttonClick = async (info) => {
if ('message' in info && !!info.message) {
uni.$lu.toast(info.message)
} else {
@ -70,7 +71,35 @@
} else if (info.jump.indexOf('http') !== -1) {
window.location.href = info.jump
} else {
if (switch_arr.includes(info.jump)) {
if (info.jump.indexOf('/pages/main/yytjsj/yytjsj_front') !== -1) {
try {
const response = await $api('CheckChildCare', { person_id: $store.user.person_id }, { loading: true, loading_text: ' ' })
$response(response, () => {
const { check, path } = response.data
if (!path) {
uni.navigateTo({ url: info.jump })
} else {
if (check == 1) {
uni.showModal({
title: '提示',
content: '即将跳转到儿保科,是否确认?',
success: (res) => {
if (res.confirm) {
wx.miniProgram.navigateTo({ url: path.startsWith('/') ? path : '/' + path })
}
}
})
} else {
wx.miniProgram.navigateTo({ url: path.startsWith('/') ? path : '/' + path })
}
}
}, {}, () => {
uni.navigateTo({ url: info.jump })
})
} catch (e) {
uni.navigateTo({ url: info.jump })
}
} else if (switch_arr.includes(info.jump)) {
uni.switchTab({
url: info.jump
})
@ -84,6 +113,7 @@
}
const user_box_ref = ref(null)
const showTestBar = ref(false)
const userBoxRef = (e) => {
if (!user_box_ref.value) {
user_box_ref.value = e
@ -127,6 +157,32 @@
}
}
const goTest2 = () => {
uni.navigateTo({
url: '/pages/test/test2'
})
}
const checkTestButton = async () => {
try {
const response = await $api('CheckTestButton', { person_id: $store.user.person_id }, { loading: false })
$response(response, () => {
showTestBar.value = response.data.check == '1'
})
} catch (e) {
showTestBar.value = false
}
}
const calcAge = (birthday) => {
if (!birthday) return '未知'
const birth = new Date(birthday)
const now = new Date()
let age = now.getFullYear() - birth.getFullYear()
const m = now.getMonth() - birth.getMonth()
if (m < 0 || (m === 0 && now.getDate() < birth.getDate())) {
age--
}
return age
}
//
let NoticeInfo=ref([])
const GetNoticeFunc = async () => {
@ -241,6 +297,7 @@
</view>
</view>
</view>
<view v-if="showTestBar" class="test-bar" @click="goTest2"></view>
<view>
<swiper v-if="$store.config?.lunbo" class="bannder_wrapper" circular interval="2000" autoplay="true" >
<swiper-item v-for="(item,index) in $store.config.lunbo" :key="index" @click="gotoUrl(item.action)">
@ -580,6 +637,16 @@
align-items: center;
}
.test-bar {
width: calc(750rpx - 40rpx);
margin: 20rpx auto 0;
padding: 20rpx;
background: #FFFFFF;
font-size: 28rpx;
color: #35ACB2;
text-align: center;
}
.order_wrapper {
width: 678rpx;
height: 195rpx;

@ -216,10 +216,35 @@
});
}
//
const toPlan=(id)=>{
uni.navigateTo({
url: '/pages/main/yytjsj/yytjsj_new?id='+id
const toPlan=async (id)=>{
try {
const person_id = order_info.person_id || $store.user.person_id
const response = await $api('CheckChildCare', { person_id }, { loading: true, loading_text: ' ' })
$response(response, () => {
const { check, path } = response.data
if (!path) {
uni.navigateTo({ url: '/pages/main/yytjsj/yytjsj_new?id=' + id })
} else {
if (check == 1) {
uni.showModal({
title: '提示',
content: '即将跳转到儿保科,是否确认?',
success: (res) => {
if (res.confirm) {
wx.miniProgram.navigateTo({ url: path.startsWith('/') ? path : '/' + path })
}
}
})
} else {
wx.miniProgram.navigateTo({ url: path.startsWith('/') ? path : '/' + path })
}
}
}, {}, () => {
uni.navigateTo({ url: '/pages/main/yytjsj/yytjsj_new?id=' + id })
})
} catch (e) {
uni.navigateTo({ url: '/pages/main/yytjsj/yytjsj_new?id=' + id })
}
}
//
const ZhuanZeng=async(id)=>{

@ -0,0 +1,65 @@
<template>
<view class="test2-wrapper">
<view class="test2-title">测试页面</view>
<view class="test2-info">
<view class="info-row">
<text class="info-label">就诊人</text>
<text>{{ $store.user.name }}</text>
</view>
<view class="info-row">
<text class="info-label">身份证</text>
<text>{{ $store.user.id_number }}</text>
</view>
<view class="info-row">
<text class="info-label">person_id</text>
<text>{{ $store.user.person_id }}</text>
</view>
</view>
<view class="test2-btn" @click="goJump"></view>
</view>
</template>
<script setup>
import wx from 'weixin-js-sdk'
import { useStore } from '@/store'
const $store = useStore()
const goJump = () => {
wx.miniProgram.navigateTo({
url: '/pages/other/entry/index?scene=1002&hospitalAreaId=6&path=/pages/outpatient/doctor-appointment/index&departmentCode=A0030003&subDepartmentCode='
})
}
</script>
<style scoped>
.test2-wrapper {
padding: 40rpx;
}
.test2-title {
font-size: 36rpx;
font-weight: 500;
color: #323232;
margin-bottom: 40rpx;
}
.info-row {
display: flex;
align-items: center;
margin-bottom: 20rpx;
font-size: 28rpx;
}
.info-label {
color: #939393;
margin-right: 10rpx;
}
.test2-btn {
width: 100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
background: #35ACB2;
color: #FFFFFF;
font-size: 28rpx;
border-radius: 10rpx;
margin-top: 40rpx;
}
</style>

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save