Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da57354324 | ||
|
|
d646afa0c0 | ||
|
|
d31b7ff549 | ||
|
|
5b6f33912d | ||
|
|
c7f87a9c95 | ||
|
|
2823f8eb05 |
@@ -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()) {
|
||||||
// 聚合所有批次的可用库存
|
// 聚合所有批次的可用库存
|
||||||
|
|||||||
@@ -710,11 +710,21 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
|
|||||||
|
|
||||||
// 批量更新诊疗医嘱状态(使用 update 确保状态字段必定更新)
|
// 批量更新诊疗医嘱状态(使用 update 确保状态字段必定更新)
|
||||||
if (!processedRequestIds.isEmpty()) {
|
if (!processedRequestIds.isEmpty()) {
|
||||||
iServiceRequestService.update(null,
|
// 🔧 Bug #487 修复:签发时额外设置 authoredTime,确保签发时间被记录
|
||||||
new LambdaUpdateWrapper<ServiceRequest>()
|
if (is_sign) {
|
||||||
.set(ServiceRequest::getStatusEnum,
|
iServiceRequestService.update(null,
|
||||||
is_save ? RequestStatus.DRAFT.getValue() : RequestStatus.ACTIVE.getValue())
|
new LambdaUpdateWrapper<ServiceRequest>()
|
||||||
.in(ServiceRequest::getId, processedRequestIds));
|
.set(ServiceRequest::getStatusEnum, RequestStatus.ACTIVE.getValue())
|
||||||
|
.set(ServiceRequest::getAuthoredTime, authoredTime)
|
||||||
|
.set(ServiceRequest::getSignCode, signCode)
|
||||||
|
.in(ServiceRequest::getId, processedRequestIds));
|
||||||
|
log.info("签发诊疗医嘱成功,requestIds: {}, signCode: {}", processedRequestIds, signCode);
|
||||||
|
} else {
|
||||||
|
iServiceRequestService.update(null,
|
||||||
|
new LambdaUpdateWrapper<ServiceRequest>()
|
||||||
|
.set(ServiceRequest::getStatusEnum, RequestStatus.DRAFT.getValue())
|
||||||
|
.in(ServiceRequest::getId, processedRequestIds));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const currentSelectRow = ref<any>({});
|
|||||||
const queryParams = ref({
|
const queryParams = ref({
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
adviceTypes: '1,2,3,6',
|
adviceTypes: [1, 2, 3, 6],
|
||||||
searchKey: '',
|
searchKey: '',
|
||||||
organizationId: '',
|
organizationId: '',
|
||||||
categoryCode: '',
|
categoryCode: '',
|
||||||
@@ -88,10 +88,10 @@ const tableColumns = computed<TableColumn[]>(() => [
|
|||||||
function refresh(adviceType: any, categoryCode: string, searchKey: string) {
|
function refresh(adviceType: any, categoryCode: string, searchKey: string) {
|
||||||
// 有搜索词时跨类型搜索,避免用户输入"级护理"但因当前adviceType为药品而搜不到诊疗类护理项目
|
// 有搜索词时跨类型搜索,避免用户输入"级护理"但因当前adviceType为药品而搜不到诊疗类护理项目
|
||||||
if (searchKey) {
|
if (searchKey) {
|
||||||
queryParams.value.adviceTypes = '1,2,3,6';
|
queryParams.value.adviceTypes = [1, 2, 3, 6];
|
||||||
} else {
|
} else {
|
||||||
queryParams.value.adviceTypes =
|
queryParams.value.adviceTypes =
|
||||||
adviceType !== undefined && adviceType !== '' ? String(adviceType) : '1,2,3,6';
|
adviceType !== undefined && adviceType !== '' ? [parseInt(adviceType)] : [1, 2, 3, 6];
|
||||||
}
|
}
|
||||||
queryParams.value.categoryCode = categoryCode || '';
|
queryParams.value.categoryCode = categoryCode || '';
|
||||||
queryParams.value.searchKey = searchKey || '';
|
queryParams.value.searchKey = searchKey || '';
|
||||||
|
|||||||
@@ -310,32 +310,26 @@ const hasMatchedFields = computed(() => {
|
|||||||
|
|
||||||
/** 查询科室 */
|
/** 查询科室 */
|
||||||
const getLocationInfo = async () => {
|
const getLocationInfo = async () => {
|
||||||
const res = await getDepartmentList();
|
try {
|
||||||
orgOptions.value = res.data || [];
|
const res = await getDepartmentList();
|
||||||
|
orgOptions.value = Array.isArray(res.data) ? res.data : [];
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('科室列表加载失败:', e.message);
|
||||||
|
orgOptions.value = [];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const recursionFun = (targetDepartment) => {
|
// 递归查找树形科室节点
|
||||||
if (!targetDepartment) return '';
|
const findTreeItem = (list, id) => {
|
||||||
let name = '';
|
if (!list || list.length === 0) return null;
|
||||||
for (let index = 0; index < orgOptions.value.length; index++) {
|
for (const item of list) {
|
||||||
const obj = orgOptions.value[index];
|
if (item.id == id) return item;
|
||||||
if (obj.id == targetDepartment) {
|
if (item.children && item.children.length > 0) {
|
||||||
name = obj.name;
|
const found = findTreeItem(item.children, id);
|
||||||
break;
|
if (found) return found;
|
||||||
}
|
}
|
||||||
const subObjArray = obj['children'];
|
|
||||||
if (subObjArray && subObjArray.length > 0) {
|
|
||||||
for (let i = 0; i < subObjArray.length; i++) {
|
|
||||||
const item = subObjArray[i];
|
|
||||||
if (item.id == targetDepartment) {
|
|
||||||
name = item.name;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (name) break;
|
|
||||||
}
|
}
|
||||||
return name;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleViewDetail = async (row) => {
|
const handleViewDetail = async (row) => {
|
||||||
@@ -349,7 +343,11 @@ const handleViewDetail = async (row) => {
|
|||||||
if (row.descJson) {
|
if (row.descJson) {
|
||||||
try {
|
try {
|
||||||
const obj = JSON.parse(row.descJson);
|
const obj = JSON.parse(row.descJson);
|
||||||
obj.targetDepartment = recursionFun(obj.targetDepartment);
|
// 将发往科室 ID 转换为名称
|
||||||
|
if (obj.targetDepartment) {
|
||||||
|
const deptItem = findTreeItem(orgOptions.value, obj.targetDepartment);
|
||||||
|
obj.targetDepartment = deptItem ? deptItem.name : obj.targetDepartment;
|
||||||
|
}
|
||||||
descJsonData.value = obj;
|
descJsonData.value = obj;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('解析 descJson 失败:', e);
|
console.error('解析 descJson 失败:', e);
|
||||||
|
|||||||
@@ -82,7 +82,11 @@
|
|||||||
</template>
|
</template>
|
||||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||||
<el-table-column prop="patientName" label="患者姓名" width="120" />
|
<el-table-column prop="patientName" label="患者姓名" width="120" />
|
||||||
<el-table-column prop="name" label="申请单名称" width="140" />
|
<el-table-column label="申请单名称" width="140">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ buildApplicationName(scope.row) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="createTime" label="创建时间" width="160" />
|
<el-table-column prop="createTime" label="创建时间" width="160" />
|
||||||
<el-table-column prop="prescriptionNo" label="申请单号" width="140" />
|
<el-table-column prop="prescriptionNo" label="申请单号" width="140" />
|
||||||
<el-table-column label="单据状态" width="100" align="center">
|
<el-table-column label="单据状态" width="100" align="center">
|
||||||
@@ -137,7 +141,7 @@
|
|||||||
<el-descriptions-item label="创建时间">{{
|
<el-descriptions-item label="创建时间">{{
|
||||||
currentDetail.createTime || '-'
|
currentDetail.createTime || '-'
|
||||||
}}</el-descriptions-item>
|
}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="处方号">{{
|
<el-descriptions-item label="申请单号">{{
|
||||||
currentDetail.prescriptionNo || '-'
|
currentDetail.prescriptionNo || '-'
|
||||||
}}</el-descriptions-item>
|
}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="申请者">{{
|
<el-descriptions-item label="申请者">{{
|
||||||
@@ -339,6 +343,24 @@ const parseSpecimenType = (descJson) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据申请单详情构建申请单名称
|
||||||
|
* 单一项目:显示项目名称+数量
|
||||||
|
* 多个项目:显示首个项目名称+数量+"等X项"
|
||||||
|
*/
|
||||||
|
const buildApplicationName = (row) => {
|
||||||
|
const details = row.requestFormDetailList;
|
||||||
|
if (!details || details.length === 0) {
|
||||||
|
return row.name || '-';
|
||||||
|
}
|
||||||
|
if (details.length === 1) {
|
||||||
|
const item = details[0];
|
||||||
|
return `${item.adviceName}${item.quantity || ''}`;
|
||||||
|
}
|
||||||
|
const first = details[0];
|
||||||
|
return `${first.adviceName}${first.quantity || ''}等${details.length}项`;
|
||||||
|
};
|
||||||
|
|
||||||
const isFieldMatched = (key) => {
|
const isFieldMatched = (key) => {
|
||||||
return key in labelMap;
|
return key in labelMap;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -256,12 +256,16 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
|||||||
if (type === 2 && manualDept) {
|
if (type === 2 && manualDept) {
|
||||||
form.targetDepartment = manualDept;
|
form.targetDepartment = manualDept;
|
||||||
isRelease = true;
|
isRelease = true;
|
||||||
} else {
|
} else if (type === 2 && !manualDept) {
|
||||||
|
// 提交时用户未手动选择科室,才提示错误
|
||||||
isRelease = false;
|
isRelease = false;
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: '未找到项目执行的科室',
|
message: '未找到项目执行的科室',
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// type=1(选择项目变化)时,不弹窗,仅清空科室让用户自行选择
|
||||||
|
isRelease = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (findItem && isRelease) {
|
if (findItem && isRelease) {
|
||||||
|
|||||||
@@ -1241,6 +1241,13 @@ function handleSave() {
|
|||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
proxy.$modal.msgSuccess('签发成功');
|
proxy.$modal.msgSuccess('签发成功');
|
||||||
isSaving.value = false;
|
isSaving.value = false;
|
||||||
|
// 乐观更新:立即将已签发医嘱的状态设为"已签发",确保列表实时刷新
|
||||||
|
saveList.forEach((item) => {
|
||||||
|
const row = prescriptionList.value.find((r) => r.requestId && r.requestId === item.requestId);
|
||||||
|
if (row) {
|
||||||
|
row.statusEnum = 2;
|
||||||
|
}
|
||||||
|
});
|
||||||
getListInfo(false);
|
getListInfo(false);
|
||||||
bindMethod.value = {};
|
bindMethod.value = {};
|
||||||
nextId.value = 1;
|
nextId.value = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user