门诊挂号-》新增患者:监护人信息录入控制,当患者的年龄小于等于维护的监护人规定年龄时,则需要登记患者监护人的相关信息,反之无需填写。

This commit is contained in:
2025-12-08 10:20:26 +08:00
parent 46c9787216
commit 00e1c62de0
2 changed files with 27 additions and 7 deletions

View File

@@ -350,7 +350,7 @@
</template> </template>
<script setup name="PatientAddDialog"> <script setup name="PatientAddDialog">
import { watch } from "vue"; import { watch, defineProps } from "vue";
import pcas from 'china-division/dist/pcas-code.json'; import pcas from 'china-division/dist/pcas-code.json';
import { addPatient, patientlLists, getOutpatientRegistrationList } from './outpatientregistration'; import { addPatient, patientlLists, getOutpatientRegistrationList } from './outpatientregistration';
import { fromPairs } from 'lodash'; import { fromPairs } from 'lodash';
@@ -587,19 +587,19 @@ const validateIdCard = (rule, value, callback) => {
// 监护人信息条件验证函数 // 监护人信息条件验证函数
const validateGuardianInfo = (rule, value, callback) => { const validateGuardianInfo = (rule, value, callback) => {
// 只有当年龄小于18岁时才验证监护人信息 // 只有当年龄小于规定年龄时才验证监护人信息
if (form.value.age) { if (form.value.age) {
// 提取年龄数字部分 // 提取年龄数字部分
const ageMatch = form.value.age.toString().match(/\d+/); const ageMatch = form.value.age.toString().match(/\d+/);
if (ageMatch) { if (ageMatch) {
const age = parseInt(ageMatch[0]); const age = parseInt(ageMatch[0]);
// 如果年龄小于18岁监护人信息必须填写 const guardianAgeValue = parseInt(props.guardianAge) || 16;
if (age < 18 && !value) { // 如果年龄小于规定年龄,监护人信息必须填写
return callback(new Error('年龄小于18岁的患者必须填写监护人信息')); if (age < guardianAgeValue && !value) {
return callback(new Error(`年龄小于${guardianAgeValue}岁的患者必须填写监护人信息`));
} }
} }
} }
// 18岁及以上患者或年龄未填写时跳过验证
callback(); callback();
} }
@@ -658,6 +658,10 @@ const props = defineProps({
type: Object, type: Object,
required: false, required: false,
}, },
guardianAge: {
type: String,
default: '18'
}
}); });
// 处理出生日期变化,自动计算年龄 // 处理出生日期变化,自动计算年龄

View File

@@ -620,7 +620,7 @@
:searchInfo="form.searchKey" :searchInfo="form.searchKey"
@submit="setForm" @submit="setForm"
/> />
<patient-add-dialog ref="patientAddRef" @submit="setForm" /> <patient-add-dialog ref="patientAddRef" @submit="setForm" :guardian-age="guardianAgeConfig" />
<ChargeDialog <ChargeDialog
:open="openDialog" :open="openDialog"
@close="handleClose" @close="handleClose"
@@ -696,8 +696,11 @@ import ReprintDialog from './components/reprintDialog.vue';
import { handleColor } from '@/utils/his'; import { handleColor } from '@/utils/his';
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
import { formatDate, formatDateStr } from '@/utils/index'; import { formatDate, formatDateStr } from '@/utils/index';
import { getConfigKey } from '@/api/system/config';
const patientInfo = ref({}); const patientInfo = ref({});
// 监护人规定年龄配置
const guardianAgeConfig = ref(null);
// 跳转到患者档案管理页面 // 跳转到患者档案管理页面
const goToPatientRecord = () => { const goToPatientRecord = () => {
@@ -1581,6 +1584,19 @@ getList();
getContract(); getContract();
// getConditionDefinition(); // getConditionDefinition();
getLocationInfo(); getLocationInfo();
// 获取监护人规定年龄配置
async function loadGuardianAgeConfig() {
try {
const response = await getConfigKey('guardianAge');
if (response.code === 200) {
guardianAgeConfig.value = response.data;
}
} catch (error) {
console.error('获取监护人规定年龄配置失败:', error);
}
}
// 组件加载时获取配置
loadGuardianAgeConfig();
</script> </script>
<style scoped> <style scoped>
.el-form--inline .el-form-item { .el-form--inline .el-form-item {