From 7ac26cf78100f871e6f8542864e866cc361efaca Mon Sep 17 00:00:00 2001 From: suizihe <2958847195@qq.com> Date: Wed, 5 Nov 2025 11:38:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=9B=91=E6=8A=A4=E4=BA=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E9=99=90=E5=88=B6,=E5=9C=A8=E9=97=A8?= =?UTF-8?q?=E8=AF=8A=E6=8C=82=E5=8F=B7=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=8C=89=E9=92=AE=E5=AE=8C=E6=88=90=E6=82=A3?= =?UTF-8?q?=E8=80=85=E6=A1=A3=E6=A1=88=E7=AE=A1=E7=90=86=E7=9A=84=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/patientAddDialog.vue | 29 ++++++++++++++++-- .../charge/outpatientregistration/index.vue | 23 +++++++++++--- .../outPatientCharge.vue | 30 +++++++++++++++---- 3 files changed, 70 insertions(+), 12 deletions(-) diff --git a/openhis-ui-vue3/src/views/charge/outpatientregistration/components/patientAddDialog.vue b/openhis-ui-vue3/src/views/charge/outpatientregistration/components/patientAddDialog.vue index a4211d62..2d4f2d98 100644 --- a/openhis-ui-vue3/src/views/charge/outpatientregistration/components/patientAddDialog.vue +++ b/openhis-ui-vue3/src/views/charge/outpatientregistration/components/patientAddDialog.vue @@ -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); diff --git a/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue b/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue index a8cfa5b8..69fb7179 100644 --- a/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue +++ b/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue @@ -3,7 +3,14 @@ - + @@ -56,6 +63,7 @@ 医保卡 +