From 15d3f32921ddc8b420c3d09284694d0692c80004 Mon Sep 17 00:00:00 2001 From: huxuejian Date: Fri, 23 Oct 2026 16:03:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/consult/index.vue | 28 +++++++++++++++++++++++++--- pages/member/detail.vue | 3 ++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/pages/consult/index.vue b/pages/consult/index.vue index 5ee52cc..5577718 100644 --- a/pages/consult/index.vue +++ b/pages/consult/index.vue @@ -46,7 +46,7 @@ import { computed, ref, watch } from "vue"; import { onLoad, onShow } from "@dcloudio/uni-app"; import useUser from "@/hooks/useUser"; -import { bindHisPatient, createSelfAuthRequest, addHisCustomer } from "@/utils/api"; +import { bindHisPatient, createSelfAuthRequest, addHisCustomer, getHisCustomer } from "@/utils/api"; import { set } from "@/utils/cache"; import { toast } from "@/utils/widget"; import { themeBg, themeColor, themeSecondary } from "@/utils/theme-config"; @@ -125,7 +125,7 @@ async function bindInsurance(psnToken, idCard, name, mobile) { return patient; } -async function getHisArchive(profile) { +async function addHisArchive(profile) { const params = { name: profile.name, idCard: profile.certNo, @@ -140,10 +140,19 @@ async function getHisArchive(profile) { toast(message || "获取档案信息失败"); return Promise.reject(message || "获取档案信息失败"); } - patient.tmbxx = tmbxx; + patient.tmbxx = Array.isArray(tmbxx) ? tmbxx : []; return patient; } +async function getHisArchive(profile) { + if (profile.certNo) { + const patient = await searchHisArchive(profile.certNo) + if (patient) return patient; + } + const newPatient = await addHisArchive(profile); + return newPatient +} + async function nextStep() { if (!currentProfile.value) { toast("请选择就诊人"); @@ -184,6 +193,7 @@ async function nextStep() { } else { hisArchive = await getHisArchive(currentProfile.value); } + if (!hisArchive) return; const consultPatientProfile = { patientId: hisArchive.patientId, blhno: hisArchive.blhno, @@ -201,6 +211,18 @@ async function nextStep() { }); } +async function searchHisArchive(idCard) { + const { success, list, tmbxx, message } = await getHisCustomer(idCard); + const patients = Array.isArray(list) ? list : []; + const patient = patients.find(item => item.socialno === idCard); + if (!success || !patient) { + toast(message || "获取档案信息失败"); + return Promise.reject(message || "获取档案信息失败"); + } + patient.tmbxx = tmbxx; + return patient; +} + async function scanInsuranceCode() { if (scanning.value) return; scanning.value = true; diff --git a/pages/member/detail.vue b/pages/member/detail.vue index 7c41214..8a00c80 100644 --- a/pages/member/detail.vue +++ b/pages/member/detail.vue @@ -306,6 +306,7 @@ async function saveYbQrcodePatient() { }), }); const patients = Array.isArray(res && res.list) ? res.list : []; + const tmbxx = Array.isArray(res && res.tmbxx) ? res.tmbxx : []; const hisArchive = patients.find(patient => patient.socialno === idCard) || patients[0] || null; if (!res || !res.success || !hisArchive) { toast((res && res.message) || '医保建档失败'); @@ -321,7 +322,7 @@ async function saveYbQrcodePatient() { age: parseInt(hisArchive.age) > 0 ? parseInt(hisArchive.age) : '', address: hisArchive.address, socialno: hisArchive.socialno, - tmbxx: Array.isArray(hisArchive.tmbxx) ? hisArchive.tmbxx : [] + tmbxx } set("consult-patient-profile", consultPatientProfile); uni.redirectTo({