6 Commits

Author SHA1 Message Date
关羽
2823f8eb05 Fix Bug #481: [住院护士站-医嘱执行] 药品库存充足但执行时提示库存不足
根因: AdviceUtils.checkExeMedInventory() 中硬编码 performLocation == locationId 的匹配条件,
当医嘱的 performLocation 指向的药房没有该药品库存时(库存实际在其他药房),匹配失败导致"库存不足"错误。

修复策略: 采用两步匹配法 -
1. 先按 performLocation 匹配指定药房的库存(添加 null 容错)
2. 若指定药房无匹配,则放宽条件跨所有药房聚合库存

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 03:14:08 +08:00
赵云
487b05c845 Fix Bug #465: [住院医生工作站-检验申请] 检验项目选择列表被限制为500项,导致医生无法检索并开立其余800多项
根因分析:
1. 前端参数名错误:getList 发送 pageNum 但后端期望 pageNo,导致分页参数被忽略
2. 后端 MyBatis Plus 分页拦截器单页最多返回500条,前端用 pageSize:9999 无效
3. 总共有1300+条检验项目,但只返回了前500条

修复方案:
- 修正参数名为 pageNo 匹配后端接口
- 使用分页循环拉取全部数据(每页500条,循环直到数据全部拉取)
- 添加 try/catch 错误处理

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 03:12:41 +08:00
关羽
71f99da69a Fix Bug #480: [住院护士站-医嘱执行] 非耗材类医嘱执行报"耗材库存"错误且全选逻辑联动异常
修复 handleExecute 中 hasDevice 判断逻辑错误:原代码用 includes('device') 判断
adviceTable 是否包含耗材类医嘱,但 adviceTable 实际取值为 med_medication_request
(药品)或 wor_service_request(诊疗/耗材),均不含 "device" 字符串,导致 hasDevice
恒为 false。

改为检查 adviceTable === 'wor_service_request',确保仅当选中医嘱包含诊疗类(可能
绑定耗材)时才调用 lotNumberMatch,纯药品医嘱不再触发耗材库存校验。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 02:43:27 +08:00
荀彧
15a65063a3 Fix Bug #470: 住院医生工作站-手术申请单加载手术项目耗时过长,影响医生开单效率
添加模块级缓存(surgeryRecordsCache + surgeryMappedCache),首次打开弹窗请求API后
缓存数据,后续打开直接复用,避免重复请求500条手术项目列表导致加载缓慢。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 02:18:29 +08:00
关羽
72fdafb032 Fix Bug #469: [住院医生工作站-检验申请] 完善【操作】列临床业务逻辑:支持按状态动态切换修改、删除、撤回等功能
根因:后端返回字段名为 status,而操作列条件判断使用了 scope.row.billStatus,
billStatus 为 undefined 导致所有状态条件判断失败,仅显示固定的"详情"按钮。
修复:将操作列条件中的 billStatus 统一改为 status。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 02:14:51 +08:00
关羽
56b8d0e98d Fix Bug #475: 【住院医生工作站】开立检查申请单报错"请先配置当前时间段的执行科室"后,系统仍生成申请记录
- 将requestFormId判空改为requestFormId != null && requestFormId != 0L,防止前端空字符串反序列化为0L误入编辑场景
- 在循环中逐个校验activityList中的项目是否都配置了执行科室,将所有校验前置到任何数据库操作之前,避免部分通过后在save中途抛异常
- 统一使用isEdit标志变量替代重复的null检查

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 02:12:06 +08:00
6 changed files with 93 additions and 41 deletions

View File

@@ -178,15 +178,26 @@ public class AdviceUtils {
// 生命提示信息集合 // 生命提示信息集合
List<String> tipsList = new ArrayList<>(); List<String> tipsList = new ArrayList<>();
for (MedicationRequestUseExe medicationRequestUseExe : medUseExeList) { for (MedicationRequestUseExe medicationRequestUseExe : medUseExeList) {
// 聚合同一位置所有批次的库存总量 // 第一步:按 performLocation 匹配指定药房的库存
List<AdviceInventoryDto> matchedInventories = adviceInventory.stream() List<AdviceInventoryDto> matchedInventories = adviceInventory.stream()
.filter(inventoryDto -> medicationRequestUseExe.getMedicationId().equals(inventoryDto.getItemId()) .filter(inventoryDto -> medicationRequestUseExe.getMedicationId().equals(inventoryDto.getItemId())
&& CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(inventoryDto.getItemTable()) && CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(inventoryDto.getItemTable())
&& medicationRequestUseExe.getPerformLocation().equals(inventoryDto.getLocationId()) && (medicationRequestUseExe.getPerformLocation() == null
|| medicationRequestUseExe.getPerformLocation().equals(inventoryDto.getLocationId()))
// 如果选择了具体的批次号,校验库存时需要加上批次号的匹配条件 // 如果选择了具体的批次号,校验库存时需要加上批次号的匹配条件
&& (StringUtils.isEmpty(medicationRequestUseExe.getLotNumber()) && (StringUtils.isEmpty(medicationRequestUseExe.getLotNumber())
|| medicationRequestUseExe.getLotNumber().equals(inventoryDto.getLotNumber()))) || medicationRequestUseExe.getLotNumber().equals(inventoryDto.getLotNumber())))
.collect(Collectors.toList()); .collect(Collectors.toList());
// 第二步:如果指定药房没有匹配到库存,则放宽条件查询所有药房的库存
if (matchedInventories.isEmpty()) {
matchedInventories = adviceInventory.stream()
.filter(inventoryDto -> medicationRequestUseExe.getMedicationId().equals(inventoryDto.getItemId())
&& CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(inventoryDto.getItemTable())
// 如果选择了具体的批次号,校验库存时需要加上批次号的匹配条件
&& (StringUtils.isEmpty(medicationRequestUseExe.getLotNumber())
|| medicationRequestUseExe.getLotNumber().equals(inventoryDto.getLotNumber())))
.collect(Collectors.toList());
}
// 匹配到库存信息 // 匹配到库存信息
if (!matchedInventories.isEmpty()) { if (!matchedInventories.isEmpty()) {
// 聚合所有批次的可用库存 // 聚合所有批次的可用库存

View File

@@ -76,6 +76,10 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public R<?> saveRequestForm(RequestFormSaveDto requestFormSaveDto, String typeCode) { public R<?> saveRequestForm(RequestFormSaveDto requestFormSaveDto, String typeCode) {
// 申请单ID前端空字符串可能反序列化为0L需同时判0
Long requestFormId = requestFormSaveDto.getRequestFormId();
boolean isEdit = requestFormId != null && requestFormId != 0L;
// 诊疗执行科室配置校验(必须在任何数据库操作之前) // 诊疗执行科室配置校验(必须在任何数据库操作之前)
List<ActivityOrganizationConfigDto> activityOrganizationConfig = List<ActivityOrganizationConfigDto> activityOrganizationConfig =
requestFormManageAppMapper.getActivityOrganizationConfig(typeCode); requestFormManageAppMapper.getActivityOrganizationConfig(typeCode);
@@ -83,12 +87,23 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
throw new ServiceException("请先配置当前时间段的执行科室"); throw new ServiceException("请先配置当前时间段的执行科室");
} }
// 逐个校验activityList中的项目是否都配置了执行科室避免部分通过后在循环中抛异常导致事务复杂化
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
if (activityList != null && !activityList.isEmpty()) {
for (ActivitySaveDto activitySaveDto : activityList) {
Long positionId = activityOrganizationConfig.stream()
.filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId()))
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
if (positionId == null) {
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
}
}
}
// 诊疗处方号 // 诊疗处方号
String prescriptionNo; String prescriptionNo;
// 申请单ID
Long requestFormId = requestFormSaveDto.getRequestFormId();
// 编辑场景 // 编辑场景
if (requestFormId != null) { if (isEdit) {
RequestForm requestFormInfo = iRequestFormService.getById(requestFormId); RequestForm requestFormInfo = iRequestFormService.getById(requestFormId);
prescriptionNo = requestFormInfo.getPrescriptionNo(); prescriptionNo = requestFormInfo.getPrescriptionNo();
// 该申请单存在的待发送医嘱个数 // 该申请单存在的待发送医嘱个数
@@ -132,7 +147,7 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
iRequestFormService.saveOrUpdate(requestForm); iRequestFormService.saveOrUpdate(requestForm);
// 编辑场景时,先删除掉原有诊疗项目及账单再新增 // 编辑场景时,先删除掉原有诊疗项目及账单再新增
if (requestFormId != null) { if (isEdit) {
List<Long> serviceRequestIds = iServiceRequestService List<Long> serviceRequestIds = iServiceRequestService
.list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getPrescriptionNo, prescriptionNo)) .list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getPrescriptionNo, prescriptionNo))
.stream().map(ServiceRequest::getId).collect(Collectors.toList()); .stream().map(ServiceRequest::getId).collect(Collectors.toList());
@@ -146,8 +161,6 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
ServiceRequest serviceRequest; ServiceRequest serviceRequest;
ChargeItem chargeItem; ChargeItem chargeItem;
// 诊疗集合
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
log.info("保存申请单typeCode={}, activityListSize={}, encounterId={}", typeCode, activityList != null ? activityList.size() : 0, encounterId); log.info("保存申请单typeCode={}, activityListSize={}, encounterId={}", typeCode, activityList != null ? activityList.size() : 0, encounterId);
for (ActivitySaveDto activitySaveDto : activityList) { for (ActivitySaveDto activitySaveDto : activityList) {

View File

@@ -103,11 +103,11 @@
<el-table-column prop="requesterId_dictText" label="申请者" width="120" /> <el-table-column prop="requesterId_dictText" label="申请者" width="120" />
<el-table-column label="操作" align="center" fixed="right" width="160"> <el-table-column label="操作" align="center" fixed="right" width="160">
<template #default="scope"> <template #default="scope">
<template v-if="scope.row.billStatus == 0 || scope.row.status == 0"> <template v-if="scope.row.status == 0">
<el-button link type="primary" @click="handleEdit(scope.row)">修改</el-button> <el-button link type="primary" @click="handleEdit(scope.row)">修改</el-button>
<el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button> <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
</template> </template>
<template v-else-if="scope.row.billStatus == 1 || scope.row.status == 1"> <template v-else-if="scope.row.status == 1">
<el-button link type="warning" @click="handleWithdraw(scope.row)">撤回</el-button> <el-button link type="warning" @click="handleWithdraw(scope.row)">撤回</el-button>
</template> </template>
<el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button> <el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button>

View File

@@ -144,23 +144,40 @@ const applicationListAll = ref();
const applicationList = ref(); const applicationList = ref();
const loading = ref(false); const loading = ref(false);
const orgOptions = ref([]); // 科室选项 const orgOptions = ref([]); // 科室选项
const getList = () => { const getList = async () => {
if (!patientInfo.value?.inHospitalOrgId) { if (!patientInfo.value?.inHospitalOrgId) {
applicationList.value = []; applicationList.value = [];
return; return;
} }
loading.value = true; loading.value = true;
getApplicationList({ try {
pageSize: 9999, const allRecords = [];
pageNum: 1, let currentPage = 1;
const pageSize = 500;
// 分页拉取全部数据后端单页最多500条
while (true) {
const res = await getApplicationList({
pageSize,
pageNo: currentPage,
categoryCode: '22', categoryCode: '22',
organizationId: patientInfo.value.inHospitalOrgId, organizationId: patientInfo.value.inHospitalOrgId,
adviceTypes: [3], //1 药品 2耗材 3诊疗 adviceTypes: [3], // 1 药品 2 耗材 3 诊疗
}) });
.then((res) => { if (res.code !== 200) {
if (res.code === 200) { proxy.$message.error(res.message);
applicationListAll.value = res.data.records; applicationList.value = [];
applicationList.value = res.data.records.map((item) => { return;
}
const records = res.data?.records || [];
allRecords.push(...records);
// 当前页不足 pageSize 或已无数据,说明已全部拉取
if (records.length < pageSize) break;
currentPage++;
}
applicationListAll.value = allRecords;
applicationList.value = allRecords.map((item) => {
const priceInfo = item.priceList?.[0] || {}; const priceInfo = item.priceList?.[0] || {};
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00'; const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
const unit = item.unitCode_dictText || item.unitCode || ''; const unit = item.unitCode_dictText || item.unitCode || '';
@@ -171,15 +188,12 @@ const getList = () => {
key: item.adviceDefinitionId, key: item.adviceDefinitionId,
}; };
}); });
console.log('applicationList========>', JSON.stringify(res.data.records)); } catch (e) {
} else { proxy.$message.error('获取检验项目列表失败');
proxy.$message.error(res.message);
applicationList.value = []; applicationList.value = [];
} } finally {
})
.finally(() => {
loading.value = false; loading.value = false;
}); }
}; };
const transferValue = ref([]); const transferValue = ref([]);
const form = reactive({ const form = reactive({

View File

@@ -86,6 +86,9 @@ import {getApplicationList, saveSurgery} from './api';
import {ElMessage} from 'element-plus'; import {ElMessage} from 'element-plus';
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
// 模块级缓存:避免每次打开弹窗都重新请求手术项目列表
let surgeryRecordsCache = null; // 原始 API 记录
let surgeryMappedCache = null; // 映射后的 el-transfer 数据
// 递归查找树形科室节点 // 递归查找树形科室节点
const findTreeItem = (list, id) => { const findTreeItem = (list, id) => {
if (!list || list.length === 0) return null; if (!list || list.length === 0) return null;
@@ -110,6 +113,12 @@ const getList = () => {
applicationList.value = []; applicationList.value = [];
return; return;
} }
// 命中缓存时直接使用,避免重复请求导致加载缓慢
if (surgeryMappedCache && surgeryMappedCache.length > 0) {
applicationList.value = surgeryMappedCache;
applicationListAll.value = surgeryRecordsCache;
return;
}
loading.value = true; loading.value = true;
getApplicationList({ getApplicationList({
pageSize: 500, pageSize: 500,
@@ -132,6 +141,9 @@ const getList = () => {
key: item.adviceDefinitionId, key: item.adviceDefinitionId,
}; };
}); });
// 写入模块缓存,后续打开弹窗直接复用
surgeryRecordsCache = res.data.records;
surgeryMappedCache = applicationList.value;
} else { } else {
console.warn('获取手术项目列表失败:', res.message); console.warn('获取手术项目列表失败:', res.message);
applicationList.value = []; applicationList.value = [];

View File

@@ -471,11 +471,13 @@ function handleExecute() {
console.log(list, 'list'); console.log(list, 'list');
adviceExecute({ exeDate: exeDate.value, adviceExecuteDetailList: list }).then((res) => { adviceExecute({ exeDate: exeDate.value, adviceExecuteDetailList: list }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
// 仅当选中医嘱中包含耗材类医嘱时,才调用耗材批号匹配(排除纯药品医嘱场景) // 仅当选中医嘱中包含诊疗类医嘱(可能绑定耗材)时,才调用耗材批号匹配
const hasDevice = list.some((item) => // adviceTable 取值为 med_medication_request药品或 wor_service_request诊疗/耗材)
String(item.adviceTable || '').includes('device'), // 原代码用 includes('device') 判断有误,两个表名均不含 "device" 字符串
const hasServiceRequest = list.some((item) =>
String(item.adviceTable || '') === 'wor_service_request',
); );
if (hasDevice) { if (hasServiceRequest) {
lotNumberMatch({ encounterIdList: encounterIds }, { skipErrorMsg: true }).catch((error) => { lotNumberMatch({ encounterIdList: encounterIds }, { skipErrorMsg: true }).catch((error) => {
console.warn('lotNumberMatch failed after adviceExecute:', error); console.warn('lotNumberMatch failed after adviceExecute:', error);
}); });