增加监护人信息限制,在门诊挂号页面增加档案按钮完成患者档案管理的跳转

This commit is contained in:
2025-11-05 11:38:47 +08:00
parent b7412648b4
commit 7ac26cf781
3 changed files with 70 additions and 12 deletions

View File

@@ -372,6 +372,23 @@ const validateIdCard = (rule, value, callback) => {
callback(); // 校验通过
}
// 监护人信息条件验证函数
const validateGuardianInfo = (rule, value, callback) => {
// 只有当年龄小于18岁时才验证监护人信息
if (form.value.age) {
// 提取年龄数字部分
const ageMatch = form.value.age.toString().match(/\d+/);
if (ageMatch) {
const age = parseInt(ageMatch[0]);
// 如果年龄小于18岁监护人信息必须填写
if (age < 18 && !value) {
return callback(new Error('年龄小于18岁的患者必须填写监护人信息'));
}
}
}
// 18岁及以上患者或年龄未填写时跳过验证
callback();
}
const data = reactive({
isViewMode: false,
@@ -393,7 +410,12 @@ const data = reactive({
{ validator: validateIdCard, trigger: 'blur' },
{ validator: validateUniquePatient, trigger: 'blur' }
],
birthDate: [{ required: false, message: '请选择出生日期', trigger: 'change' }],
birthDate: [{ required: false, message: '请选择出生日期', trigger: 'change' }],
// 监护人信息条件验证规则
guardianName: [{ validator: validateGuardianInfo, trigger: 'blur' }],
guardianRelation: [{ validator: validateGuardianInfo, trigger: 'blur' }],
guardianPhone: [{ validator: validateGuardianInfo, trigger: 'blur' }],
guardianIdNo: [{ validator: validateGuardianInfo, trigger: 'blur' }],
},
});
@@ -583,13 +605,16 @@ function submitForm() {
form.value.idCard.toString().substring(12, 14);
console.log(form.value.birthDate, 123);
}
// 进行表单验证
proxy.$refs['patientRef'].validate((valid) => {
if (valid) {
// 使用
// 提交表单前的处理
if (!form.value.identifierNo) {
form.value.typeCode = undefined;
}
form.value.address = getAddress(form);
// 提交新增患者请求
addPatient(form.value).then((response) => {
proxy.$modal.msgSuccess('新增成功');
getPatientInfo(response.data.idCard);