bug 716 718

This commit is contained in:
Ranyunqiao
2026-06-16 10:21:26 +08:00
parent 6c77ee8f84
commit 020d1be4be
3 changed files with 101 additions and 22 deletions

View File

@@ -191,10 +191,15 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
QueryWrapper<InpatientAdviceParam> queryWrapper QueryWrapper<InpatientAdviceParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null); = HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
// 手动拼接requestStatus条件COMPLETED(3)时同时包含CHECK_VERIFIED(10)和PENDING_RECEIVE(11) // 手动拼接requestStatus条件
// 1. ACTIVE(2)时:同时包含已停嘱待核对的 PENDING_STOP(13)
// 2. COMPLETED(3)时:同时包含已校对检查 CHECK_VERIFIED(10) 和已接收 PENDING_RECEIVE(11)
// UNION查询外层列名为request_statusT1.status_enum AS request_status不是status_enum // UNION查询外层列名为request_statusT1.status_enum AS request_status不是status_enum
if (requestStatus != null) { if (requestStatus != null) {
if (RequestStatus.COMPLETED.getValue().equals(requestStatus)) { if (RequestStatus.ACTIVE.getValue().equals(requestStatus)) {
queryWrapper.in("request_status",
RequestStatus.ACTIVE.getValue(), RequestStatus.PENDING_STOP.getValue());
} else if (RequestStatus.COMPLETED.getValue().equals(requestStatus)) {
queryWrapper.in("request_status", queryWrapper.in("request_status",
RequestStatus.COMPLETED.getValue(), RequestStatus.CHECK_VERIFIED.getValue(), RequestStatus.COMPLETED.getValue(), RequestStatus.CHECK_VERIFIED.getValue(),
RequestStatus.PENDING_RECEIVE.getValue()); RequestStatus.PENDING_RECEIVE.getValue());
@@ -414,14 +419,30 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
Date checkDate = new Date(); Date checkDate = new Date();
if (!serviceRequestList.isEmpty()) { if (!serviceRequestList.isEmpty()) {
List<Long> serviceReqIds = serviceRequestList.stream().map(PerformInfoDto::getRequestId).toList(); List<Long> serviceReqIds = serviceRequestList.stream().map(PerformInfoDto::getRequestId).toList();
// 先查询服务请求,按 categoryEnum 分流:检查类(23)走 CHECK_VERIFIED其余走 COMPLETED // 先查询服务请求,进行状态分流:
// 1. 如果是停嘱待核对(PENDING_STOP=13),则核对后转为停止(STOPPED=6)
// 2. 否则按类别分流:检查类(23)走 CHECK_VERIFIED其余走 COMPLETED
List<ServiceRequest> allServiceRequests = serviceRequestService.listByIds(serviceReqIds); List<ServiceRequest> allServiceRequests = serviceRequestService.listByIds(serviceReqIds);
List<Long> stopReqIds = allServiceRequests.stream()
.filter(sr -> RequestStatus.PENDING_STOP.getValue().equals(sr.getStatusEnum()))
.map(ServiceRequest::getId).toList();
List<Long> checkReqIds = allServiceRequests.stream() List<Long> checkReqIds = allServiceRequests.stream()
.filter(sr -> ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum())) .filter(sr -> !RequestStatus.PENDING_STOP.getValue().equals(sr.getStatusEnum())
&& ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum()))
.map(ServiceRequest::getId).toList(); .map(ServiceRequest::getId).toList();
List<Long> otherReqIds = allServiceRequests.stream() List<Long> otherReqIds = allServiceRequests.stream()
.filter(sr -> !ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum())) .filter(sr -> !RequestStatus.PENDING_STOP.getValue().equals(sr.getStatusEnum())
&& !ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum()))
.map(ServiceRequest::getId).toList(); .map(ServiceRequest::getId).toList();
// 停嘱待核对 → 停止STOPPED=6
if (!stopReqIds.isEmpty()) {
serviceRequestService.update(new LambdaUpdateWrapper<ServiceRequest>()
.in(ServiceRequest::getId, stopReqIds)
.set(ServiceRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.set(ServiceRequest::getPerformerCheckId, practitionerId)
.set(ServiceRequest::getCheckTime, checkDate));
}
// 检查类 → 已校对CHECK_VERIFIED=10 // 检查类 → 已校对CHECK_VERIFIED=10
if (!checkReqIds.isEmpty()) { if (!checkReqIds.isEmpty()) {
serviceRequestService.updateCheckVerifiedStatus(checkReqIds, practitionerId, checkDate); serviceRequestService.updateCheckVerifiedStatus(checkReqIds, practitionerId, checkDate);
@@ -442,14 +463,50 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
} }
} }
if (!medRequestList.isEmpty()) { if (!medRequestList.isEmpty()) {
// 更新药品请求状态已完成 List<Long> medReqIds = medRequestList.stream().map(PerformInfoDto::getRequestId).toList();
medicationRequestService.updateCompletedStatusBatch( List<MedicationRequest> allMedRequests = medicationRequestService.listByIds(medReqIds);
medRequestList.stream().map(PerformInfoDto::getRequestId).toList(), practitionerId, checkDate);
List<Long> stopMedIds = allMedRequests.stream()
.filter(mr -> RequestStatus.PENDING_STOP.getValue().equals(mr.getStatusEnum()))
.map(MedicationRequest::getId).toList();
List<Long> otherMedIds = allMedRequests.stream()
.filter(mr -> !RequestStatus.PENDING_STOP.getValue().equals(mr.getStatusEnum()))
.map(MedicationRequest::getId).toList();
// 停嘱待核对 → 停止STOPPED=6
if (!stopMedIds.isEmpty()) {
medicationRequestService.update(new LambdaUpdateWrapper<MedicationRequest>()
.in(MedicationRequest::getId, stopMedIds)
.set(MedicationRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.set(MedicationRequest::getPerformerCheckId, practitionerId)
.set(MedicationRequest::getCheckTime, checkDate));
}
// 其他类 → 已完成COMPLETED=3
if (!otherMedIds.isEmpty()) {
medicationRequestService.updateCompletedStatusBatch(otherMedIds, practitionerId, checkDate);
}
} }
if (!deviceRequestList.isEmpty()) { if (!deviceRequestList.isEmpty()) {
// 更新耗材请求状态已完成 List<Long> devReqIds = deviceRequestList.stream().map(PerformInfoDto::getRequestId).toList();
deviceRequestService.updateCompletedStatusBatch( // 同样处理耗材的停嘱核对
deviceRequestList.stream().map(PerformInfoDto::getRequestId).toList()); List<DeviceRequest> allDevRequests = deviceRequestService.listByIds(devReqIds);
List<Long> stopDevIds = allDevRequests.stream()
.filter(dr -> RequestStatus.PENDING_STOP.getValue().equals(dr.getStatusEnum()))
.map(DeviceRequest::getId).toList();
List<Long> otherDevIds = allDevRequests.stream()
.filter(dr -> !RequestStatus.PENDING_STOP.getValue().equals(dr.getStatusEnum()))
.map(DeviceRequest::getId).toList();
if (!stopDevIds.isEmpty()) {
deviceRequestService.update(new LambdaUpdateWrapper<DeviceRequest>()
.in(DeviceRequest::getId, stopDevIds)
.set(DeviceRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
.set(DeviceRequest::getPerformerCheckId, practitionerId)
.set(DeviceRequest::getCheckTime, checkDate));
}
if (!otherDevIds.isEmpty()) {
deviceRequestService.updateCompletedStatusBatch(otherDevIds);
}
} }
return R.ok(null, "校对成功"); return R.ok(null, "校对成功");
} }

View File

@@ -259,9 +259,11 @@
<span v-else>{{ scope.row.adviceName }}</span> <span v-else>{{ scope.row.adviceName }}</span>
</template> </template>
</vxe-column> </vxe-column>
<vxe-column title="状态" align="center" field="" width="90"> <vxe-column title="状态" align="center" field="" width="120">
<template #default="scope"> <template #default="scope">
<el-tag v-if="scope.row.chargeStatus == 5" type="info"> <el-tag v-if="scope.row.statusEnum == 6" type="danger">停止</el-tag>
<el-tag v-else-if="scope.row.statusEnum == 13" type="warning">已停嘱(待核对)</el-tag>
<el-tag v-else-if="scope.row.chargeStatus == 5" type="info">
{{ scope.row.chargeStatus_enumText }} {{ scope.row.chargeStatus_enumText }}
</el-tag> </el-tag>
<el-tag v-else-if="scope.row.statusEnum == 2" type="success">已签发</el-tag> <el-tag v-else-if="scope.row.statusEnum == 2" type="success">已签发</el-tag>
@@ -272,7 +274,6 @@
<el-tag v-else-if="scope.row.statusEnum == 10" type="primary">已校对</el-tag> <el-tag v-else-if="scope.row.statusEnum == 10" type="primary">已校对</el-tag>
<el-tag v-else-if="scope.row.statusEnum == 11" type="primary">待接收</el-tag> <el-tag v-else-if="scope.row.statusEnum == 11" type="primary">待接收</el-tag>
<el-tag v-else-if="scope.row.statusEnum == 3" type="success">已校对</el-tag> <el-tag v-else-if="scope.row.statusEnum == 3" type="success">已校对</el-tag>
<el-tag v-else-if="scope.row.statusEnum == 6" type="danger">停止</el-tag>
<el-tag v-else-if="scope.row.statusEnum == 20" type="success">已完成</el-tag> <el-tag v-else-if="scope.row.statusEnum == 20" type="success">已完成</el-tag>
<el-tag v-else type="info">{{ scope.row.chargeStatus_enumText }}</el-tag> <el-tag v-else type="info">{{ scope.row.chargeStatus_enumText }}</el-tag>
</template> </template>
@@ -612,8 +613,9 @@ const adviceTypeList = computed(() => {
hasShownPharmacyConfigWarning.value = true; hasShownPharmacyConfigWarning.value = true;
} }
// 只返回不需要取药科室配置的类别(诊疗、手术、出院带药) // 只返回不需要取药科室配置的类别(诊疗、耗材、手术、出院带药)
return [ return [
{ label: '耗材', value: 2, adviceType: 2, categoryCode: '' },
{ label: '诊疗', value: 3, adviceType: 3, categoryCode: '' }, { label: '诊疗', value: 3, adviceType: 3, categoryCode: '' },
{ label: '手术', value: 6, adviceType: 6, categoryCode: '' }, { label: '手术', value: 6, adviceType: 6, categoryCode: '' },
{ label: '出院带药', value: 7, adviceType: 7, categoryCode: '' }, { label: '出院带药', value: 7, adviceType: 7, categoryCode: '' },
@@ -641,7 +643,8 @@ const adviceTypeList = computed(() => {
typeList.push({ label: '中草药', value: '1-4', adviceType: 1, categoryCode: '4' }); typeList.push({ label: '中草药', value: '1-4', adviceType: 1, categoryCode: '4' });
} }
// 始终添加诊疗和手术(它们不受取药配置限制) // 始终添加诊疗、耗材和手术(它们不受取药配置限制)
typeList.push({ label: '耗材', value: 2, adviceType: 2, categoryCode: '' });
typeList.push({ label: '诊疗', value: 3, adviceType: 3, categoryCode: '' }); typeList.push({ label: '诊疗', value: 3, adviceType: 3, categoryCode: '' });
typeList.push({ label: '手术', value: 6, adviceType: 6, categoryCode: '' }); typeList.push({ label: '手术', value: 6, adviceType: 6, categoryCode: '' });
@@ -666,6 +669,10 @@ const statusOption = [
label: '已签发', label: '已签发',
value: 2, value: 2,
}, },
{
label: '已停嘱',
value: 13,
},
{ {
label: '停止', label: '停止',
value: 6, value: 6,
@@ -963,6 +970,8 @@ function handleAddPrescription() {
statusEnum: 1, statusEnum: 1,
therapyEnum: '2', // 默认为临时医嘱 therapyEnum: '2', // 默认为临时医嘱
startTime: defaultStartTime, startTime: defaultStartTime,
requesterId_dictText: userStore.nickName,
requesterId: userStore.id,
}); });
getGroupMarkers(); getGroupMarkers();
nextTick(() => { nextTick(() => {
@@ -1221,6 +1230,8 @@ function selectAdviceBase(key, row) {
// Bug #589: 出院带药需要保留类型和标志setValue中可能被API数据覆盖 // Bug #589: 出院带药需要保留类型和标志setValue中可能被API数据覆盖
adviceType: prevRow.adviceType || undefined, adviceType: prevRow.adviceType || undefined,
dischargeFlag: prevRow.dischargeFlag || undefined, dischargeFlag: prevRow.dischargeFlag || undefined,
requesterId_dictText: userStore.nickName,
requesterId: userStore.id,
}; };
try { try {
setValue(row); setValue(row);
@@ -1714,6 +1725,8 @@ function handleSaveSign(row, index) {
} }
// 更新UI状态 // 更新UI状态
row.requesterId_dictText = userStore.nickName;
row.requesterId = userStore.id;
row.isEdit = false; row.isEdit = false;
isAdding.value = false; isAdding.value = false;
collapseAllExpanded(); collapseAllExpanded();
@@ -2075,6 +2088,8 @@ function handleSaveGroup(orderGroupList) {
// 创建新的处方项目 // 创建新的处方项目
const newRow = { const newRow = {
...prescriptionList.value[tempIndex], ...prescriptionList.value[tempIndex],
requesterId_dictText: userStore.nickName,
requesterId: userStore.id,
patientId: patientInfo.value.patientId, patientId: patientInfo.value.patientId,
encounterId: patientInfo.value.encounterId, encounterId: patientInfo.value.encounterId,
accountId: accountId.value, accountId: accountId.value,
@@ -2134,6 +2149,8 @@ function handleSaveGroup(orderGroupList) {
function handleSaveHistory(value) { function handleSaveHistory(value) {
let saveRow = { let saveRow = {
...value, ...value,
requesterId_dictText: userStore.nickName,
requesterId: userStore.id,
patientId: patientInfo.value.patientId, patientId: patientInfo.value.patientId,
encounterId: patientInfo.value.encounterId, encounterId: patientInfo.value.encounterId,
accountId: accountId.value, accountId: accountId.value,
@@ -2300,7 +2317,7 @@ function handleStopAdvice() {
// 找出停嘱的 // 找出停嘱的
for (let index = 0; index < selectRows.length; index++) { for (let index = 0; index < selectRows.length; index++) {
const item = selectRows[index]; const item = selectRows[index];
if (item.statusEnum == 6) { if (item.statusEnum == 6 || item.statusEnum == 13) {
isStop = false; isStop = false;
break; break;
} }

View File

@@ -202,7 +202,7 @@
<vxe-column <vxe-column
title="医嘱状态" title="医嘱状态"
field="requestStatus_enumText" field="requestStatus_enumText"
width="100" width="110"
align="center" align="center"
> >
<template #default="scope"> <template #default="scope">
@@ -372,6 +372,7 @@ const REQUEST_STATUS_DISPLAY = {
[RequestStatus.ACTIVE]: '已签发', [RequestStatus.ACTIVE]: '已签发',
[RequestStatus.COMPLETED]: '已校对', [RequestStatus.COMPLETED]: '已校对',
[RequestStatus.STOPPED]: '已停止', [RequestStatus.STOPPED]: '已停止',
[RequestStatus.PENDING_STOP]: '已停嘱',
}; };
/** 发药状态 → 医嘱状态映射表 */ /** 发药状态 → 医嘱状态映射表 */
@@ -395,17 +396,21 @@ const LEGACY_STATUS_TEXT = {
}; };
const getStatusDisplayText = (row) => { const getStatusDisplayText = (row) => {
// 1. 优先使用发药状态 // 1. 优先使用行级别请求状态:如果已停止或停嘱中,直接显示该状态
const requestCode = Number(row?.requestStatus);
if (requestCode === RequestStatus.STOPPED || requestCode === RequestStatus.PENDING_STOP) {
return REQUEST_STATUS_DISPLAY[requestCode];
}
// 2. 其次使用发药状态
const dispenseCode = Number(row?.dispenseStatus); const dispenseCode = Number(row?.dispenseStatus);
if (DISPENSE_STATUS_DISPLAY[dispenseCode]) { if (DISPENSE_STATUS_DISPLAY[dispenseCode]) {
return DISPENSE_STATUS_DISPLAY[dispenseCode]; return DISPENSE_STATUS_DISPLAY[dispenseCode];
} }
// 2. 使用行级别请求状态 // 3. 最后回退到其他请求状态
const requestCode = Number(row?.requestStatus);
if (REQUEST_STATUS_DISPLAY[requestCode]) { if (REQUEST_STATUS_DISPLAY[requestCode]) {
return REQUEST_STATUS_DISPLAY[requestCode]; return REQUEST_STATUS_DISPLAY[requestCode];
} }
// 3. 兼容旧后端枚举文本(如"已发送"→"已签发" // 4. 兼容旧后端枚举文本(如"已发送"→"已签发"
return LEGACY_STATUS_TEXT[row?.requestStatus_enumText] || row?.requestStatus_enumText || ''; return LEGACY_STATUS_TEXT[row?.requestStatus_enumText] || row?.requestStatus_enumText || '';
}; };