549【住院医生站-临床医嘱-检验】打开“检验申请单”弹窗获取项目列表响应极其缓慢

546 【患者管理】-【患者列表】-【新增患者】,新增患者,保存成功,但没有数据
536 [门诊手术安排]“手术申请查询”弹窗底部,分页组件与界底部元素重叠,影响操作。
This commit is contained in:
wangjian963
2026-05-20 09:45:33 +08:00
parent d9c975a950
commit 3394aa54d7
10 changed files with 180 additions and 162 deletions

View File

@@ -17,17 +17,14 @@
style="width: 300px; margin-bottom: 10px"
>
<template #append>
<el-button @click="handleSearch">搜索</el-button>
<el-button @click="handleSearch" :loading="loading">搜索</el-button>
</template>
</el-input>
<span v-if="!searchKey" class="total-count"> {{ totalCount }} </span>
<span v-else class="total-count">搜索到 {{ filteredCount }} / {{ totalCount }} </span>
<span class="total-count"> {{ totalCount }} </span>
</div>
<el-transfer
v-model="transferValue"
:data="transferData"
filter-placeholder="项目代码/名称"
filterable
:titles="['未选择', '已选择']"
/>
</div>
@@ -136,7 +133,8 @@
<script setup name="LaboratoryTests">
import {getCurrentInstance, nextTick, onMounted, reactive, ref, watch, computed} from 'vue';
import {patientInfo} from '../../../store/patient.js';
import {getApplicationList, saveInspection} from './api';
import {getExaminationPage, saveInspection} from './api';
import {ActivityCategory} from '@/utils/medicalConstants';
import {getDepartmentList} from '@/api/public.js';
import {getEncounterDiagnosis} from '../../api.js';
import {ElMessage} from 'element-plus';
@@ -173,9 +171,8 @@ const skipDeptAutoFill = ref(false);
// 将已加载的全部数据转为 transfer 组件所需的格式
const buildTransferData = (records) => {
return records.map((item) => {
const priceInfo = item.priceList?.[0] || {};
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
const unit = item.unitCode_dictText || item.unitCode || '';
const price = item.price != null ? Number(item.price).toFixed(2) : '0.00';
const unit = item.unitCodeDictText || item.unitCode || '';
return {
adviceDefinitionId: item.adviceDefinitionId,
orgId: item.orgId,
@@ -185,7 +182,8 @@ const buildTransferData = (records) => {
});
};
// 加载全部数据(不分页,一次性拉取)
const selectedItemsCache = ref(new Map());
const loadAllData = async () => {
if (!patientInfo.value?.inHospitalOrgId) {
applicationListAll.value = [];
@@ -193,13 +191,12 @@ const loadAllData = async () => {
}
loading.value = true;
try {
// 使用大 pageSize 一次性拉取所有启用状态的检验类诊疗项目
const res = await getApplicationList({
pageSize: 9999,
const res = await getExaminationPage({
pageSize: 100,
pageNo: 1,
categoryCode: '22',
categoryCode: ActivityCategory.PROOF,
organizationId: patientInfo.value.inHospitalOrgId,
adviceTypes: [3], // 1 药品 2 耗材 3 诊疗
searchKey: searchKey.value,
});
if (res.code !== 200) {
proxy.$message.error(res.message);
@@ -208,8 +205,9 @@ const loadAllData = async () => {
}
applicationListAll.value = res.data?.records || [];
totalCount.value = res.data?.total || 0;
// 检验项目列表为异步加载,编辑回显必须在数据就绪后执行,否则已选区一直为空
applyEditTransferSelection()
if (!searchKey.value) {
applyEditTransferSelection();
}
} catch (e) {
proxy.$message.error('获取检验项目列表失败');
applicationListAll.value = [];
@@ -218,32 +216,18 @@ const loadAllData = async () => {
}
};
// 根据搜索关键词过滤数据
const filterData = (key) => {
if (!key || key.trim() === '') {
return applicationListAll.value;
}
const lowerKey = key.toLowerCase().trim();
return applicationListAll.value.filter((item) => {
return (
item.adviceName?.toLowerCase().includes(lowerKey) ||
item.pyStr?.toLowerCase().includes(lowerKey) ||
item.adviceBusNo?.toLowerCase().includes(lowerKey)
);
});
};
// transfer 组件实际显示的数据(受搜索词影响)
const transferData = computed(() => buildTransferData(filterData(searchKey.value)));
// 当前显示的条数
const filteredCount = computed(() => filterData(searchKey.value).length);
const transferData = computed(() => buildTransferData(applicationListAll.value));
const getList = async () => {
await loadAllData();
};
let searchTimer = null;
const handleSearch = () => {
// 搜索时保持已选中的项目不受影响
clearTimeout(searchTimer);
searchTimer = setTimeout(() => {
loadAllData();
}, 300);
};
// 编辑初始化标志:避免 applyEditTransferSelection 设置 transferValue 时触发 projectWithDepartment 覆盖 descJson 中的科室值
const isInitializing = ref(false);
@@ -302,13 +286,17 @@ const projectWithDepartment = (selectProjectIds, type) => {
const arr = [];
// 根据选中的项目id查找对应的项目从全部原始数据中查找
selectProjectIds.forEach((element) => {
const searchData = applicationListAll.value.find((item) => {
let searchData = applicationListAll.value.find((item) => {
return element == item.adviceDefinitionId;
});
if (!searchData) {
searchData = selectedItemsCache.value.get(element);
}
if (searchData) {
const priceInfo = searchData.priceList?.[0] || {};
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
const unit = searchData.unitCode_dictText || searchData.unitCode || '';
const price = searchData.price != null ? Number(searchData.price).toFixed(2)
: priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
const unit = searchData.unitCodeDictText || searchData.unitCode_dictText || searchData.unitCode || '';
arr.push({
adviceDefinitionId: searchData.adviceDefinitionId,
orgId: searchData.orgId,
@@ -371,6 +359,12 @@ watch(
(newValue) => {
if (skipDeptAutoFill.value) return;
if (isInitializing.value) return;
newValue.forEach((id) => {
if (!selectedItemsCache.value.has(id)) {
const item = applicationListAll.value.find((i) => i.adviceDefinitionId == id);
if (item) selectedItemsCache.value.set(id, item);
}
});
projectWithDepartment(newValue, 1);
}
);
@@ -455,13 +449,14 @@ watch(
}
)
// 编辑模式下,项目字典加载完成后重新回显已选项目
// 编辑模式下,项目字典首次加载完成后回显已选项目(搜索刷新不重置)
watch(
() => applicationListAll.value,
() => {
if (!props.editData?.requestFormId) return;
if (!props.editData.requestFormDetailList?.length) return;
if (!applicationListAll.value.length) return;
if (searchKey.value) return;
const selectedIds = [];
props.editData.requestFormDetailList.forEach((detail) => {
@@ -486,26 +481,29 @@ const submit = () => {
if (!projectWithDepartment(transferValue.value, 2)) {
return;
}
let applicationListAllFilter = applicationListAll.value.filter((item) => {
return transferValue.value.includes(item.adviceDefinitionId);
});
applicationListAllFilter = applicationListAllFilter.map((item) => {
let applicationListAllFilter = transferValue.value.map((id) => {
let item = applicationListAll.value.find((i) => i.adviceDefinitionId == id);
if (!item) {
item = selectedItemsCache.value.get(id);
}
if (!item) return null;
const priceInfo = item.priceList?.[0] || {};
return {
adviceDefinitionId: item.adviceDefinitionId /** 诊疗定义id */,
quantity: 1, // /** 请求数量 */
unitCode: item.priceList[0].unitCode /** 请求单位编码 */,
unitPrice: item.priceList[0].price /** 单价 */,
totalPrice: item.priceList[0].price /** 总价 */,
unitCode: item.unitCode || priceInfo.unitCode || '' /** 请求单位编码 */,
unitPrice: item.price ?? priceInfo.price ?? 0 /** 单价 */,
totalPrice: item.price ?? priceInfo.price ?? 0 /** 总价 */,
positionId: form.targetDepartment || item.positionId, // 用户指定发往科室优先于项目默认执行科室
ybClassEnum: item.ybClassEnum, //类别医保编码
conditionId: item.conditionId, //诊断ID
encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id
adviceType: item.adviceType, ///** 医嘱类型 */
definitionId: item.priceList[0].definitionId, //费用定价主表ID */
definitionDetailId: item.definitionDetailId, //费用定价子表ID */
ybClassEnum: item.ybClassEnum || '', //类别医保编码
conditionId: item.conditionId || '', //诊断ID
encounterDiagnosisId: item.encounterDiagnosisId || '', //就诊诊断id
adviceType: item.adviceType || 3, ///** 医嘱类型 */
definitionId: item.chargeItemDefinitionId || priceInfo.definitionId || '', //费用定价主表ID */
definitionDetailId: item.definitionDetailId || priceInfo.definitionDetailId || '', //费用定价子表ID */
accountId: patientInfo.value.accountId, // // 账户id
};
});
}).filter(Boolean);
const params = {
activityList: applicationListAllFilter,
patientId: patientInfo.value.patientId, //患者ID
@@ -520,6 +518,7 @@ const submit = () => {
if (res.code === 200) {
proxy.$message.success(isEditMode.value ? '修改成功' : res.msg);
transferValue.value = [];
selectedItemsCache.value.clear();
emits('submitOk');
} else {
proxy.$message.error(res.message);

View File

@@ -207,6 +207,7 @@ import {patientInfo} from '../../../store/patient.js';
import {getDepartmentList} from '@/api/public.js';
import {getEncounterDiagnosis} from '../../api.js';
import {getExaminationPage, saveCheckd} from './api';
import {ActivityCategory} from '@/utils/medicalConstants';
import {ElMessage, ElMessageBox} from 'element-plus';
import {WarningFilled, Warning, Refresh, Files, Document, EditPen, Aim, DocumentCopy} from '@element-plus/icons-vue';
@@ -276,6 +277,7 @@ const getList = () => {
pageNo: 1,
pageSize: 5000,
searchKey: '',
categoryCode: ActivityCategory.TEST,
})
.then((res) => {
if (res.code === 200 && res.data?.records) {