fix:问题修复

This commit is contained in:
huxuejian 2026-10-23 16:03:59 +08:00
parent 9ab5190405
commit 15d3f32921
2 changed files with 27 additions and 4 deletions

View File

@ -46,7 +46,7 @@
import { computed, ref, watch } from "vue"; import { computed, ref, watch } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app"; import { onLoad, onShow } from "@dcloudio/uni-app";
import useUser from "@/hooks/useUser"; 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 { set } from "@/utils/cache";
import { toast } from "@/utils/widget"; import { toast } from "@/utils/widget";
import { themeBg, themeColor, themeSecondary } from "@/utils/theme-config"; import { themeBg, themeColor, themeSecondary } from "@/utils/theme-config";
@ -125,7 +125,7 @@ async function bindInsurance(psnToken, idCard, name, mobile) {
return patient; return patient;
} }
async function getHisArchive(profile) { async function addHisArchive(profile) {
const params = { const params = {
name: profile.name, name: profile.name,
idCard: profile.certNo, idCard: profile.certNo,
@ -140,10 +140,19 @@ async function getHisArchive(profile) {
toast(message || "获取档案信息失败"); toast(message || "获取档案信息失败");
return Promise.reject(message || "获取档案信息失败"); return Promise.reject(message || "获取档案信息失败");
} }
patient.tmbxx = tmbxx; patient.tmbxx = Array.isArray(tmbxx) ? tmbxx : [];
return patient; 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() { async function nextStep() {
if (!currentProfile.value) { if (!currentProfile.value) {
toast("请选择就诊人"); toast("请选择就诊人");
@ -184,6 +193,7 @@ async function nextStep() {
} else { } else {
hisArchive = await getHisArchive(currentProfile.value); hisArchive = await getHisArchive(currentProfile.value);
} }
if (!hisArchive) return;
const consultPatientProfile = { const consultPatientProfile = {
patientId: hisArchive.patientId, patientId: hisArchive.patientId,
blhno: hisArchive.blhno, 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() { async function scanInsuranceCode() {
if (scanning.value) return; if (scanning.value) return;
scanning.value = true; scanning.value = true;

View File

@ -306,6 +306,7 @@ async function saveYbQrcodePatient() {
}), }),
}); });
const patients = Array.isArray(res && res.list) ? res.list : []; 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; const hisArchive = patients.find(patient => patient.socialno === idCard) || patients[0] || null;
if (!res || !res.success || !hisArchive) { if (!res || !res.success || !hisArchive) {
toast((res && res.message) || '医保建档失败'); toast((res && res.message) || '医保建档失败');
@ -321,7 +322,7 @@ async function saveYbQrcodePatient() {
age: parseInt(hisArchive.age) > 0 ? parseInt(hisArchive.age) : '', age: parseInt(hisArchive.age) > 0 ? parseInt(hisArchive.age) : '',
address: hisArchive.address, address: hisArchive.address,
socialno: hisArchive.socialno, socialno: hisArchive.socialno,
tmbxx: Array.isArray(hisArchive.tmbxx) ? hisArchive.tmbxx : [] tmbxx
} }
set("consult-patient-profile", consultPatientProfile); set("consult-patient-profile", consultPatientProfile);
uni.redirectTo({ uni.redirectTo({