feat: 优化病历记录和标签解析逻辑,更新接口名称

This commit is contained in:
Jafeng 2026-01-29 18:44:02 +08:00
parent b0080c1df8
commit 8842217b61
3 changed files with 91 additions and 27 deletions

View File

@ -4,7 +4,7 @@
<view class="header"> <view class="header">
<view class="team-selector" @click="toggleTeamPopup"> <view class="team-selector" @click="toggleTeamPopup">
<text class="team-name">{{ teamDisplay }}</text> <text class="team-name">{{ teamDisplay }}</text>
<uni-icons type="loop" size="18" color="#333" class="team-icon"></uni-icons> <text class="team-icon"></text>
</view> </view>
<view class="header-actions"> <view class="header-actions">
<view class="action-item" @click="goToSearch"> <view class="action-item" @click="goToSearch">
@ -89,7 +89,7 @@
</text> </text>
</template> </template>
<template v-else> <template v-else>
<text v-if="patient.record" class="record-text"> <text v-if="patient.record" class="record-text record-ellipsis">
{{ patient.record.type }} / {{ patient.record.date }} / {{ patient.record.diagnosis }} {{ patient.record.type }} / {{ patient.record.date }} / {{ patient.record.diagnosis }}
</text> </text>
<text v-else class="no-record">暂无病历记录</text> <text v-else class="no-record">暂无病历记录</text>
@ -323,24 +323,46 @@ function formatPatient(raw) {
const createTime = parseCreateTime(raw?.createTime); const createTime = parseCreateTime(raw?.createTime);
const createTimeStr = createTime ? createTime.format('YYYY-MM-DD HH:mm') : ''; const createTimeStr = createTime ? createTime.format('YYYY-MM-DD HH:mm') : '';
const rawTags = asArray(raw?.tags).filter((i) => typeof i === 'string'); // 使 tagNames
const rawTagNames = asArray(raw?.tagNames).filter((i) => typeof i === 'string'); const rawTagNames = asArray(raw?.tagNames).filter((i) => typeof i === 'string' && i.trim());
// 使 tags
const rawTags = asArray(raw?.tags).filter((i) => typeof i === 'string' && i.trim());
// 使 tagIds
const tagIds = asArray(raw?.tagIds).map(String).filter(Boolean); const tagIds = asArray(raw?.tagIds).map(String).filter(Boolean);
// tagNames > tags > tagIds
const displayTags = rawTagNames.length ? rawTagNames : (rawTags.length ? rawTags : []);
//
let record = null;
if (raw?.latestRecord && typeof raw.latestRecord === 'object') {
const lr = raw.latestRecord;
const type = lr.type || '';
const date = lr.date || '';
const diagnosis = lr.diagnosis || '';
// record
if (type || date || diagnosis) {
record = {
type: type || '-',
date: date || '-',
diagnosis: diagnosis || '-'
};
}
}
return { return {
...raw, ...raw,
_id: raw?._id || raw?.id || '', _id: raw?._id || raw?.id || '',
name: String(name || ''), name: String(name || ''),
gender: String(sex || ''), gender: String(sex || ''),
age, age,
tags: rawTags.length ? rawTags : (rawTagNames.length ? rawTagNames : tagIds), tags: displayTags,
mobiles, mobiles,
mobile, mobile,
createTime: createTimeStr, createTime: createTimeStr,
creator: raw?.creatorName || raw?.creator || '', creator: raw?.creatorName || raw?.creator || '',
hospitalId: raw?.customerNumber || raw?.hospitalId || '', hospitalId: raw?.customerNumber || raw?.hospitalId || '',
record: null, record,
createdByDoctor: raw?.addMethod ? String(raw.addMethod) === 'manual' : Boolean(raw?.createdByDoctor), createdByDoctor: raw?.addMethod ? String(raw.addMethod) === 'manual' : Boolean(raw?.createdByDoctor),
hasBindWechat: Boolean(raw?.externalUserId || raw?.unionid || raw?.hasBindWechat), hasBindWechat: Boolean(raw?.externalUserId || raw?.unionid || raw?.hasBindWechat),
}; };
@ -419,7 +441,8 @@ async function reload(reset = true) {
userId, userId,
teamId, teamId,
page: page.value, page: page.value,
pageSize: pageSize.value, pageSize: 1000, //
sortByFirstLetter: true, //
}; };
if (currentTab.value.kind === 'group' && currentTab.value.groupId) { if (currentTab.value.kind === 'group' && currentTab.value.groupId) {
@ -432,7 +455,7 @@ async function reload(reset = true) {
} }
loading.value = true; loading.value = true;
const res = await api('searchCorpCustomerWithFollowTime', query); const res = await api('searchCorpCustomerForCaseList', query);
loading.value = false; loading.value = false;
if (!res?.success) { if (!res?.success) {
@ -802,13 +825,18 @@ onShow(async () => {
.team-selector { .team-selector {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 18px; font-size: 32rpx; /* 16px */
font-weight: bold; font-weight: bold;
color: #333; color: #333;
.team-name { .team-name {
margin-right: 5px; margin-right: 5px;
} }
.team-icon {
font-size: 32rpx; /* 16px */
color: #333;
}
} }
.header-actions { .header-actions {
@ -822,7 +850,7 @@ onShow(async () => {
justify-content: center; justify-content: center;
.action-text { .action-text {
font-size: 10px; font-size: 20rpx; /* 10px */
color: #333; color: #333;
margin-top: 2px; margin-top: 2px;
} }
@ -849,7 +877,7 @@ onShow(async () => {
.tab-item { .tab-item {
padding: 5px 15px; padding: 5px 15px;
margin-right: 10px; margin-right: 10px;
font-size: 14px; font-size: 28rpx; /* 14px */
color: #666; color: #666;
background-color: #fff; background-color: #fff;
border-radius: 4px; border-radius: 4px;
@ -865,7 +893,7 @@ onShow(async () => {
} }
.total-count-inline { .total-count-inline {
font-size: 12px; font-size: 24rpx; /* 12px */
color: #666; color: #666;
white-space: nowrap; white-space: nowrap;
flex-shrink: 0; flex-shrink: 0;
@ -889,7 +917,7 @@ onShow(async () => {
.group-title { .group-title {
padding: 5px 15px; padding: 5px 15px;
font-size: 14px; font-size: 28rpx; /* 14px */
color: #333; color: #333;
} }
@ -922,14 +950,14 @@ onShow(async () => {
margin-right: 10px; margin-right: 10px;
.patient-name { .patient-name {
font-size: 18px; font-size: 32rpx; /* 16px */
font-weight: bold; font-weight: bold;
color: #333; color: #333;
margin-right: 8px; margin-right: 8px;
} }
.patient-meta { .patient-meta {
font-size: 12px; font-size: 24rpx; /* 12px */
color: #999; color: #999;
margin-bottom: 2px; margin-bottom: 2px;
} }
@ -940,7 +968,7 @@ onShow(async () => {
gap: 5px; gap: 5px;
.tag { .tag {
font-size: 10px; font-size: 20rpx; /* 10px */
color: #5d8aff; color: #5d8aff;
border: 1px solid #5d8aff; border: 1px solid #5d8aff;
padding: 0 4px; padding: 0 4px;
@ -952,12 +980,20 @@ onShow(async () => {
} }
.card-row-bottom { .card-row-bottom {
font-size: 14px; font-size: 28rpx; /* 14px */
.record-text { .record-text {
color: #666; color: #666;
} }
.record-ellipsis {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
}
.no-record { .no-record {
color: #bdc3c7; color: #bdc3c7;
} }
@ -983,7 +1019,7 @@ onShow(async () => {
align-items: center; align-items: center;
.footer-text { .footer-text {
margin-left: 5px; margin-left: 5px;
font-size: 14px; font-size: 28rpx; /* 14px */
color: #333; color: #333;
} }
} }
@ -993,7 +1029,7 @@ onShow(async () => {
gap: 10px; gap: 10px;
.footer-btn { .footer-btn {
font-size: 14px; font-size: 28rpx; /* 14px */
padding: 0 15px; padding: 0 15px;
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
@ -1033,7 +1069,7 @@ onShow(async () => {
z-index: 10; z-index: 10;
.index-item { .index-item {
font-size: 10px; font-size: 20rpx; /* 10px */
color: #555; color: #555;
padding: 2px 0; padding: 2px 0;
width: 20px; width: 20px;

View File

@ -98,23 +98,45 @@ function getTeamContext() {
} }
function formatPatient(raw) { function formatPatient(raw) {
const rawTags = asArray(raw?.tags).filter((i) => typeof i === 'string'); // 使 tagNames
const rawTagNames = asArray(raw?.tagNames).filter((i) => typeof i === 'string'); const rawTagNames = asArray(raw?.tagNames).filter((i) => typeof i === 'string' && i.trim());
// 使 tags
const rawTags = asArray(raw?.tags).filter((i) => typeof i === 'string' && i.trim());
// 使 tagIds
const tagIds = asArray(raw?.tagIds).map(String).filter(Boolean); const tagIds = asArray(raw?.tagIds).map(String).filter(Boolean);
// tagNames > tags > tagIds
const displayTags = rawTagNames.length ? rawTagNames : (rawTags.length ? rawTags : []);
const mobiles = asArray(raw?.mobiles).map(String).filter(Boolean); const mobiles = asArray(raw?.mobiles).map(String).filter(Boolean);
const mobile = raw?.mobile ? String(raw.mobile) : (mobiles[0] || ''); const mobile = raw?.mobile ? String(raw.mobile) : (mobiles[0] || '');
//
let record = null;
if (raw?.latestRecord && typeof raw.latestRecord === 'object') {
const lr = raw.latestRecord;
const type = lr.type || '';
const date = lr.date || '';
const diagnosis = lr.diagnosis || '';
if (type || date || diagnosis) {
record = {
type: type || '-',
date: date || '-',
diagnosis: diagnosis || '-'
};
}
}
return { return {
...raw, ...raw,
_id: raw?._id || raw?.id || '', _id: raw?._id || raw?.id || '',
name: raw?.name || raw?.customerName || '', name: raw?.name || raw?.customerName || '',
gender: raw?.sex || raw?.gender || '', gender: raw?.sex || raw?.gender || '',
age: raw?.age ?? '', age: raw?.age ?? '',
tags: rawTags.length ? rawTags : (rawTagNames.length ? rawTagNames : tagIds), tags: displayTags,
mobiles, mobiles,
mobile, mobile,
record: null, record,
createTime: raw?.createTime || '', createTime: raw?.createTime || '',
creator: raw?.creatorName || raw?.creator || '', creator: raw?.creatorName || raw?.creator || '',
hospitalId: raw?.customerNumber || raw?.hospitalId || '', hospitalId: raw?.customerNumber || raw?.hospitalId || '',
@ -142,7 +164,7 @@ const doSearch = useDebounce(async () => {
} }
searching.value = true; searching.value = true;
const res = await api('searchCorpCustomerWithFollowTime', { const res = await api('searchCorpCustomerForCaseList', {
corpId, corpId,
userId, userId,
teamId, teamId,
@ -315,6 +337,11 @@ const goDetail = (patient) => {
.record-text { .record-text {
color: #666; color: #666;
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
} }
.no-record { .no-record {

View File

@ -73,6 +73,7 @@ const urlsConfig = {
getUnbindMiniAppCustomers: 'getUnbindMiniAppCustomers', getUnbindMiniAppCustomers: 'getUnbindMiniAppCustomers',
searchCorpCustomer: 'searchCorpCustomer', searchCorpCustomer: 'searchCorpCustomer',
searchCorpCustomerWithFollowTime: 'searchCorpCustomerWithFollowTime', searchCorpCustomerWithFollowTime: 'searchCorpCustomerWithFollowTime',
searchCorpCustomerForCaseList: 'searchCorpCustomerForCaseList', // 档案列表专用接口
unbindMiniAppArchive: 'unbindMiniAppArchive', unbindMiniAppArchive: 'unbindMiniAppArchive',
// 健康档案相关接口 // 健康档案相关接口
addMedicalRecord: 'addMedicalRecord', addMedicalRecord: 'addMedicalRecord',