fix:问题修复
This commit is contained in:
parent
9ab5190405
commit
15d3f32921
@ -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;
|
||||
|
||||
@ -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({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user