Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2823f8eb05 | ||
|
|
487b05c845 | ||
|
|
71f99da69a | ||
|
|
15a65063a3 | ||
|
|
72fdafb032 | ||
|
|
56b8d0e98d |
@@ -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()) {
|
||||||
// 聚合所有批次的可用库存
|
// 聚合所有批次的可用库存
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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({
|
||||||
|
|||||||
@@ -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 = [];
|
||||||
|
|||||||
@@ -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);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user