feat: 优化病历记录和标签解析逻辑,更新接口名称
This commit is contained in:
parent
b0080c1df8
commit
8842217b61
@ -4,7 +4,7 @@
|
||||
<view class="header">
|
||||
<view class="team-selector" @click="toggleTeamPopup">
|
||||
<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 class="header-actions">
|
||||
<view class="action-item" @click="goToSearch">
|
||||
@ -89,7 +89,7 @@
|
||||
</text>
|
||||
</template>
|
||||
<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 }}
|
||||
</text>
|
||||
<text v-else class="no-record">暂无病历记录</text>
|
||||
@ -323,24 +323,46 @@ function formatPatient(raw) {
|
||||
const createTime = parseCreateTime(raw?.createTime);
|
||||
const createTimeStr = createTime ? createTime.format('YYYY-MM-DD HH:mm') : '';
|
||||
|
||||
const rawTags = asArray(raw?.tags).filter((i) => typeof i === 'string');
|
||||
const rawTagNames = asArray(raw?.tagNames).filter((i) => typeof i === 'string');
|
||||
|
||||
// 优先使用后端返回的 tagNames(标签名称数组)
|
||||
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);
|
||||
|
||||
// 解析标签:优先 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 {
|
||||
...raw,
|
||||
_id: raw?._id || raw?.id || '',
|
||||
name: String(name || ''),
|
||||
gender: String(sex || ''),
|
||||
age,
|
||||
tags: rawTags.length ? rawTags : (rawTagNames.length ? rawTagNames : tagIds),
|
||||
tags: displayTags,
|
||||
mobiles,
|
||||
mobile,
|
||||
createTime: createTimeStr,
|
||||
creator: raw?.creatorName || raw?.creator || '',
|
||||
hospitalId: raw?.customerNumber || raw?.hospitalId || '',
|
||||
record: null,
|
||||
record,
|
||||
createdByDoctor: raw?.addMethod ? String(raw.addMethod) === 'manual' : Boolean(raw?.createdByDoctor),
|
||||
hasBindWechat: Boolean(raw?.externalUserId || raw?.unionid || raw?.hasBindWechat),
|
||||
};
|
||||
@ -419,7 +441,8 @@ async function reload(reset = true) {
|
||||
userId,
|
||||
teamId,
|
||||
page: page.value,
|
||||
pageSize: pageSize.value,
|
||||
pageSize: 1000, // 按首字母排序时,一次加载更多数据以显示完整的字母分组
|
||||
sortByFirstLetter: true, // 按姓名首字母排序
|
||||
};
|
||||
|
||||
if (currentTab.value.kind === 'group' && currentTab.value.groupId) {
|
||||
@ -432,7 +455,7 @@ async function reload(reset = true) {
|
||||
}
|
||||
|
||||
loading.value = true;
|
||||
const res = await api('searchCorpCustomerWithFollowTime', query);
|
||||
const res = await api('searchCorpCustomerForCaseList', query);
|
||||
loading.value = false;
|
||||
|
||||
if (!res?.success) {
|
||||
@ -802,13 +825,18 @@ onShow(async () => {
|
||||
.team-selector {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 18px;
|
||||
font-size: 32rpx; /* 16px */
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
|
||||
.team-name {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.team-icon {
|
||||
font-size: 32rpx; /* 16px */
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
@ -822,7 +850,7 @@ onShow(async () => {
|
||||
justify-content: center;
|
||||
|
||||
.action-text {
|
||||
font-size: 10px;
|
||||
font-size: 20rpx; /* 10px */
|
||||
color: #333;
|
||||
margin-top: 2px;
|
||||
}
|
||||
@ -849,7 +877,7 @@ onShow(async () => {
|
||||
.tab-item {
|
||||
padding: 5px 15px;
|
||||
margin-right: 10px;
|
||||
font-size: 14px;
|
||||
font-size: 28rpx; /* 14px */
|
||||
color: #666;
|
||||
background-color: #fff;
|
||||
border-radius: 4px;
|
||||
@ -865,7 +893,7 @@ onShow(async () => {
|
||||
}
|
||||
|
||||
.total-count-inline {
|
||||
font-size: 12px;
|
||||
font-size: 24rpx; /* 12px */
|
||||
color: #666;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
@ -889,7 +917,7 @@ onShow(async () => {
|
||||
|
||||
.group-title {
|
||||
padding: 5px 15px;
|
||||
font-size: 14px;
|
||||
font-size: 28rpx; /* 14px */
|
||||
color: #333;
|
||||
}
|
||||
|
||||
@ -922,14 +950,14 @@ onShow(async () => {
|
||||
margin-right: 10px;
|
||||
|
||||
.patient-name {
|
||||
font-size: 18px;
|
||||
font-size: 32rpx; /* 16px */
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.patient-meta {
|
||||
font-size: 12px;
|
||||
font-size: 24rpx; /* 12px */
|
||||
color: #999;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
@ -940,7 +968,7 @@ onShow(async () => {
|
||||
gap: 5px;
|
||||
|
||||
.tag {
|
||||
font-size: 10px;
|
||||
font-size: 20rpx; /* 10px */
|
||||
color: #5d8aff;
|
||||
border: 1px solid #5d8aff;
|
||||
padding: 0 4px;
|
||||
@ -952,12 +980,20 @@ onShow(async () => {
|
||||
}
|
||||
|
||||
.card-row-bottom {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx; /* 14px */
|
||||
|
||||
.record-text {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.record-ellipsis {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.no-record {
|
||||
color: #bdc3c7;
|
||||
}
|
||||
@ -983,7 +1019,7 @@ onShow(async () => {
|
||||
align-items: center;
|
||||
.footer-text {
|
||||
margin-left: 5px;
|
||||
font-size: 14px;
|
||||
font-size: 28rpx; /* 14px */
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
@ -993,7 +1029,7 @@ onShow(async () => {
|
||||
gap: 10px;
|
||||
|
||||
.footer-btn {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx; /* 14px */
|
||||
padding: 0 15px;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
@ -1033,7 +1069,7 @@ onShow(async () => {
|
||||
z-index: 10;
|
||||
|
||||
.index-item {
|
||||
font-size: 10px;
|
||||
font-size: 20rpx; /* 10px */
|
||||
color: #555;
|
||||
padding: 2px 0;
|
||||
width: 20px;
|
||||
|
||||
@ -98,23 +98,45 @@ function getTeamContext() {
|
||||
}
|
||||
|
||||
function formatPatient(raw) {
|
||||
const rawTags = asArray(raw?.tags).filter((i) => typeof i === 'string');
|
||||
const rawTagNames = asArray(raw?.tagNames).filter((i) => typeof i === 'string');
|
||||
|
||||
// 优先使用后端返回的 tagNames(标签名称数组)
|
||||
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);
|
||||
|
||||
// 解析标签:优先 tagNames > tags(字符串) > tagIds
|
||||
const displayTags = rawTagNames.length ? rawTagNames : (rawTags.length ? rawTags : []);
|
||||
|
||||
const mobiles = asArray(raw?.mobiles).map(String).filter(Boolean);
|
||||
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 {
|
||||
...raw,
|
||||
_id: raw?._id || raw?.id || '',
|
||||
name: raw?.name || raw?.customerName || '',
|
||||
gender: raw?.sex || raw?.gender || '',
|
||||
age: raw?.age ?? '',
|
||||
tags: rawTags.length ? rawTags : (rawTagNames.length ? rawTagNames : tagIds),
|
||||
tags: displayTags,
|
||||
mobiles,
|
||||
mobile,
|
||||
record: null,
|
||||
record,
|
||||
createTime: raw?.createTime || '',
|
||||
creator: raw?.creatorName || raw?.creator || '',
|
||||
hospitalId: raw?.customerNumber || raw?.hospitalId || '',
|
||||
@ -142,7 +164,7 @@ const doSearch = useDebounce(async () => {
|
||||
}
|
||||
|
||||
searching.value = true;
|
||||
const res = await api('searchCorpCustomerWithFollowTime', {
|
||||
const res = await api('searchCorpCustomerForCaseList', {
|
||||
corpId,
|
||||
userId,
|
||||
teamId,
|
||||
@ -315,6 +337,11 @@ const goDetail = (patient) => {
|
||||
|
||||
.record-text {
|
||||
color: #666;
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.no-record {
|
||||
|
||||
@ -73,6 +73,7 @@ const urlsConfig = {
|
||||
getUnbindMiniAppCustomers: 'getUnbindMiniAppCustomers',
|
||||
searchCorpCustomer: 'searchCorpCustomer',
|
||||
searchCorpCustomerWithFollowTime: 'searchCorpCustomerWithFollowTime',
|
||||
searchCorpCustomerForCaseList: 'searchCorpCustomerForCaseList', // 档案列表专用接口
|
||||
unbindMiniAppArchive: 'unbindMiniAppArchive',
|
||||
// 健康档案相关接口
|
||||
addMedicalRecord: 'addMedicalRecord',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user