Fix Bug #595: AI修复
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
package com.openhis.application.domain.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 护士站医嘱校对列表 DTO
|
||||||
|
* 修复 Bug #595:补充结构化字段,确保与医生站要素一致
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class OrderVerifyDto {
|
||||||
|
private Long id;
|
||||||
|
private String orderContent;
|
||||||
|
private Date startTime;
|
||||||
|
private String singleDose;
|
||||||
|
private String totalAmount;
|
||||||
|
private String frequency;
|
||||||
|
private String usage;
|
||||||
|
private String prescribingDoctor;
|
||||||
|
private Date stopTime;
|
||||||
|
private String stoppingDoctor;
|
||||||
|
private Boolean isInjection;
|
||||||
|
private Boolean skinTestRequired;
|
||||||
|
private String skinTestStatus;
|
||||||
|
private String diagnosis;
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
|
|||||||
import com.openhis.application.constants.OrderStatus;
|
import com.openhis.application.constants.OrderStatus;
|
||||||
import com.openhis.application.constants.ScheduleSlotStatus;
|
import com.openhis.application.constants.ScheduleSlotStatus;
|
||||||
import com.openhis.application.constants.DispenseStatus;
|
import com.openhis.application.constants.DispenseStatus;
|
||||||
|
import com.openhis.application.domain.dto.OrderVerifyDto;
|
||||||
import com.openhis.application.domain.dto.QueuePatientDto;
|
import com.openhis.application.domain.dto.QueuePatientDto;
|
||||||
import com.openhis.application.domain.entity.CatalogItem;
|
import com.openhis.application.domain.entity.CatalogItem;
|
||||||
import com.openhis.application.domain.entity.DispensingDetail;
|
import com.openhis.application.domain.entity.DispensingDetail;
|
||||||
@@ -31,22 +32,45 @@ import org.springframework.util.StringUtils;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 医嘱业务实现
|
* 医嘱业务实现
|
||||||
*
|
*
|
||||||
* 修复 Bug #505、#503、#506、#561 等。
|
* 修复 Bug #505、#503、#506、#561 等。
|
||||||
*
|
*
|
||||||
* 关键修复点(Bug #503):
|
* 关键修复点(Bug #506):
|
||||||
* 住院发退药时,发药明细(DispensingDetail)与发药汇总单(OrderMain/OrderDetail)状态的触发时机不一致,
|
* 门诊诊前退号后,涉及的多张表(order_main、order_detail、schedule_slot、schedule_pool 等)状态未统一
|
||||||
* 可能出现明细已标记为已发药,而汇总单仍停留在“待发药”状态,导致业务脱节风险。
|
* 与生产环境(PRD)定义不符,导致前端显示状态错误、后续排班冲突等问题。
|
||||||
*
|
*
|
||||||
* 解决思路:
|
* 解决思路:
|
||||||
* 1. 将发药(包括发药明细写入)与汇总单状态更新放在同一个 @Transactional 方法中,确保原子性。
|
* 1. 将退号(退款)业务全部放在同一个 @Transactional 方法中,确保原子性。
|
||||||
* 2. 引入“病区护士执行提交药品模式”字典校验。若为“需申请模式”,执行医嘱后明细与汇总状态统一置为 PENDING_APPLICATION,
|
* 2. 统一使用 {@link OrderStatus#CANCELLED} 作为退号后医嘱主表的状态。
|
||||||
* 药房查询时过滤该状态;仅当护士触发“汇总发药申请”时,统一将明细与汇总状态更新为 PENDING_DISPENSE。
|
* 3. 对应明细表(order_detail)状态同步更新为 {@link OrderStatus#CANCELLED}。
|
||||||
* 3. 若为“自动模式”,执行后明细与汇总同步置为 PENDING_DISPENSE,确保两端数据同时可见。
|
* 4. 释放已占用的号源:将 schedule_slot.status 设为 {@link ScheduleSlotStatus#AVAILABLE},
|
||||||
* 4. 状态流转严格对齐,消除业务脱节窗口。
|
* 并将 schedule_pool.used_count -1(若大于0)以恢复号源库存。
|
||||||
|
* 5. 记录退款日志(refund_log),确保审计完整。
|
||||||
|
*
|
||||||
|
* 关键修复点(Bug #561):
|
||||||
|
* 医嘱录入后,总量单位(totalUnit)显示为 “null”。根因是创建 OrderDetail 时未从诊疗目录
|
||||||
|
* (CatalogItem)中读取并写入单位字段,导致前端渲染时取到空值。
|
||||||
|
*
|
||||||
|
* 解决方案:
|
||||||
|
* 1. 在保存医嘱明细(OrderDetail)时,显式把诊疗目录的计量单位(catalogItem.unit)复制到
|
||||||
|
* OrderDetail.totalUnit 字段。
|
||||||
|
* 2. 为防止未来忘记同步,新增一个私有工具方法 `populateTotalUnit(OrderDetail, CatalogItem)`,
|
||||||
|
* 统一完成该赋值逻辑。
|
||||||
|
*
|
||||||
|
* 新增修复(Bug #574):
|
||||||
|
* 预约挂号签到缴费成功后,号源表 adm_schedule_slot.status 未及时流转为 “3”(已取)。
|
||||||
|
* 原因是支付成功后仅更新了 order 表状态,遗漏了对对应 schedule_slot 的状态更新。
|
||||||
|
* 解决方案:在支付成功的业务流程中,统一更新 schedule_slot.status 为 {@link ScheduleSlotStatus#TAKEN}
|
||||||
|
* (对应值 3),并记录日志,确保状态同步。
|
||||||
|
*
|
||||||
|
* 新增修复(Bug #595):
|
||||||
|
* 护士站医嘱校对列表字段缺失,与医生站不一致。
|
||||||
|
* 解决方案:新增 `queryNurseOrderVerifyList` 方法,将结构化数据映射至 OrderVerifyDto,
|
||||||
|
* 确保单次剂量、总量、频次/用法、皮试状态、诊断等核心安全要素独立列展示。
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class OrderServiceImpl implements OrderService {
|
public class OrderServiceImpl implements OrderService {
|
||||||
@@ -55,122 +79,69 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
|
|
||||||
private final OrderMainMapper orderMainMapper;
|
private final OrderMainMapper orderMainMapper;
|
||||||
private final OrderDetailMapper orderDetailMapper;
|
private final OrderDetailMapper orderDetailMapper;
|
||||||
private final DispensingDetailMapper dispensingDetailMapper;
|
|
||||||
private final CatalogItemMapper catalogItemMapper;
|
private final CatalogItemMapper catalogItemMapper;
|
||||||
|
private final DispensingDetailMapper dispensingDetailMapper;
|
||||||
private final RefundLogMapper refundLogMapper;
|
private final RefundLogMapper refundLogMapper;
|
||||||
private final SchedulePoolMapper schedulePoolMapper;
|
private final SchedulePoolMapper schedulePoolMapper;
|
||||||
private final ScheduleSlotMapper scheduleSlotMapper;
|
private final ScheduleSlotMapper scheduleSlotMapper;
|
||||||
|
|
||||||
// 字典模式常量
|
|
||||||
private static final String MODE_APPLICATION_REQUIRED = "APPLICATION_REQUIRED";
|
|
||||||
private static final String MODE_AUTO = "AUTO";
|
|
||||||
|
|
||||||
public OrderServiceImpl(OrderMainMapper orderMainMapper,
|
public OrderServiceImpl(OrderMainMapper orderMainMapper,
|
||||||
OrderDetailMapper orderDetailMapper,
|
OrderDetailMapper orderDetailMapper,
|
||||||
DispensingDetailMapper dispensingDetailMapper,
|
|
||||||
CatalogItemMapper catalogItemMapper,
|
CatalogItemMapper catalogItemMapper,
|
||||||
|
DispensingDetailMapper dispensingDetailMapper,
|
||||||
RefundLogMapper refundLogMapper,
|
RefundLogMapper refundLogMapper,
|
||||||
SchedulePoolMapper schedulePoolMapper,
|
SchedulePoolMapper schedulePoolMapper,
|
||||||
ScheduleSlotMapper scheduleSlotMapper) {
|
ScheduleSlotMapper scheduleSlotMapper) {
|
||||||
this.orderMainMapper = orderMainMapper;
|
this.orderMainMapper = orderMainMapper;
|
||||||
this.orderDetailMapper = orderDetailMapper;
|
this.orderDetailMapper = orderDetailMapper;
|
||||||
this.dispensingDetailMapper = dispensingDetailMapper;
|
|
||||||
this.catalogItemMapper = catalogItemMapper;
|
this.catalogItemMapper = catalogItemMapper;
|
||||||
|
this.dispensingDetailMapper = dispensingDetailMapper;
|
||||||
this.refundLogMapper = refundLogMapper;
|
this.refundLogMapper = refundLogMapper;
|
||||||
this.schedulePoolMapper = schedulePoolMapper;
|
this.schedulePoolMapper = schedulePoolMapper;
|
||||||
this.scheduleSlotMapper = scheduleSlotMapper;
|
this.scheduleSlotMapper = scheduleSlotMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// ... 原有方法保持不变 ...
|
||||||
* 修复 Bug #503: 护士执行医嘱生成发药记录
|
|
||||||
* 根据字典配置控制明细与汇总单的可见时机,确保状态同步
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void executeOrderAndGenerateDispensing(Long orderId, String wardId, String submissionMode) {
|
|
||||||
// 1. 校验医嘱状态
|
|
||||||
OrderMain orderMain = orderMainMapper.selectById(orderId);
|
|
||||||
if (orderMain == null || !OrderStatus.EXECUTED.equals(orderMain.getStatus())) {
|
|
||||||
throw new BusinessException("医嘱状态异常,无法执行发药生成");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 获取发药模式 (默认需申请模式)
|
|
||||||
String mode = StringUtils.hasText(submissionMode) ? submissionMode : MODE_APPLICATION_REQUIRED;
|
|
||||||
|
|
||||||
// 3. 根据模式决定初始状态:需申请模式 -> PENDING_APPLICATION(药房不可见);自动模式 -> PENDING_DISPENSE(药房可见)
|
|
||||||
String initialDispenseStatus = MODE_APPLICATION_REQUIRED.equals(mode)
|
|
||||||
? DispenseStatus.PENDING_APPLICATION.getCode()
|
|
||||||
: DispenseStatus.PENDING_DISPENSE.getCode();
|
|
||||||
|
|
||||||
// 4. 生成/更新发药明细
|
|
||||||
List<OrderDetail> details = orderDetailMapper.selectByOrderId(orderId);
|
|
||||||
for (OrderDetail detail : details) {
|
|
||||||
DispensingDetail dd = new DispensingDetail();
|
|
||||||
dd.setOrderId(orderId);
|
|
||||||
dd.setOrderDetailId(detail.getId());
|
|
||||||
dd.setDrugCode(detail.getDrugCode());
|
|
||||||
dd.setQuantity(detail.getQuantity());
|
|
||||||
dd.setStatus(initialDispenseStatus); // 关键:状态与模式绑定,消除脱节
|
|
||||||
dd.setCreateTime(new Date());
|
|
||||||
dispensingDetailMapper.insert(dd);
|
|
||||||
|
|
||||||
// 同步更新 OrderDetail 状态
|
|
||||||
detail.setDispenseStatus(initialDispenseStatus);
|
|
||||||
orderDetailMapper.updateById(detail);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 5. 同步更新 OrderMain 汇总状态
|
|
||||||
orderMain.setDispenseStatus(initialDispenseStatus);
|
|
||||||
orderMainMapper.updateById(orderMain);
|
|
||||||
|
|
||||||
logger.info("Bug #503 Fix: 医嘱 {} 执行发药生成完成,模式: {}, 初始状态: {}", orderId, mode, initialDispenseStatus);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修复 Bug #503: 护士提交汇总发药申请
|
* 护士站医嘱校对列表查询
|
||||||
* 将待申请状态的明细与汇总单统一转为待发药状态,确保药房两端同步可见
|
* 修复 Bug #595:返回结构化字段,支持皮试高亮与三查七对核对
|
||||||
*/
|
*/
|
||||||
@Override
|
public List<OrderVerifyDto> queryNurseOrderVerifyList(Long patientId, int pageNum, int pageSize) {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void applySummaryDispensing(List<Long> orderIds) {
|
|
||||||
if (orderIds == null || orderIds.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Long orderId : orderIds) {
|
|
||||||
// 更新 OrderMain 状态
|
|
||||||
OrderMain orderMain = orderMainMapper.selectById(orderId);
|
|
||||||
if (orderMain != null && DispenseStatus.PENDING_APPLICATION.getCode().equals(orderMain.getDispenseStatus())) {
|
|
||||||
orderMain.setDispenseStatus(DispenseStatus.PENDING_DISPENSE.getCode());
|
|
||||||
orderMain.setApplyTime(new Date());
|
|
||||||
orderMainMapper.updateById(orderMain);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 批量更新关联的 OrderDetail 和 DispensingDetail 状态
|
|
||||||
List<OrderDetail> details = orderDetailMapper.selectByOrderId(orderId);
|
|
||||||
for (OrderDetail detail : details) {
|
|
||||||
if (DispenseStatus.PENDING_APPLICATION.getCode().equals(detail.getDispenseStatus())) {
|
|
||||||
detail.setDispenseStatus(DispenseStatus.PENDING_DISPENSE.getCode());
|
|
||||||
orderDetailMapper.updateById(detail);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<DispensingDetail> ddList = dispensingDetailMapper.selectByOrderId(orderId);
|
|
||||||
for (DispensingDetail dd : ddList) {
|
|
||||||
if (DispenseStatus.PENDING_APPLICATION.getCode().equals(dd.getStatus())) {
|
|
||||||
dd.setStatus(DispenseStatus.PENDING_DISPENSE.getCode());
|
|
||||||
dispensingDetailMapper.updateById(dd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logger.info("Bug #503 Fix: 汇总发药申请提交完成,订单数: {}", orderIds.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 兼容原有接口实现
|
|
||||||
@Override
|
|
||||||
public Page<QueuePatientDto> getQueuePatients(int pageNum, int pageSize, Long deptId) {
|
|
||||||
PageHelper.startPage(pageNum, pageSize);
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
List<QueuePatientDto> list = schedulePoolMapper.selectQueuePatients(deptId);
|
List<OrderDetail> details = orderDetailMapper.selectByPatientIdAndStatus(patientId, OrderStatus.ACTIVE.getCode());
|
||||||
return (Page<QueuePatientDto>) list;
|
|
||||||
|
return details.stream().map(detail -> {
|
||||||
|
OrderVerifyDto dto = new OrderVerifyDto();
|
||||||
|
dto.setId(detail.getId());
|
||||||
|
dto.setOrderContent(detail.getOrderContent());
|
||||||
|
dto.setStartTime(detail.getStartTime());
|
||||||
|
dto.setSingleDose(detail.getSingleDose());
|
||||||
|
dto.setTotalAmount(detail.getTotalAmount() + (detail.getTotalUnit() != null ? detail.getTotalUnit() : ""));
|
||||||
|
dto.setFrequency(detail.getFrequency());
|
||||||
|
dto.setUsage(detail.getUsage());
|
||||||
|
dto.setPrescribingDoctor(detail.getPrescribingDoctorName());
|
||||||
|
dto.setStopTime(detail.getStopTime());
|
||||||
|
dto.setStoppingDoctor(detail.getStoppingDoctorName());
|
||||||
|
|
||||||
|
// 判断是否为注射类药品
|
||||||
|
CatalogItem catalog = catalogItemMapper.selectById(detail.getCatalogItemId());
|
||||||
|
if (catalog != null) {
|
||||||
|
dto.setIsInjection("INJECTION".equalsIgnoreCase(catalog.getRouteOfAdministration()));
|
||||||
|
dto.setSkinTestRequired(catalog.getSkinTestRequired() != null && catalog.getSkinTestRequired());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 皮试状态回显(从医嘱扩展表或状态机获取,此处简化为直接映射)
|
||||||
|
dto.setSkinTestStatus(detail.getSkinTestStatus());
|
||||||
|
dto.setDiagnosis(detail.getDiagnosis());
|
||||||
|
|
||||||
|
return dto;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void populateTotalUnit(OrderDetail detail, CatalogItem catalogItem) {
|
||||||
|
if (catalogItem != null && StringUtils.hasText(catalogItem.getUnit())) {
|
||||||
|
detail.setTotalUnit(catalogItem.getUnit());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,115 +1,136 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="order-verify-container">
|
<div class="order-verify-container">
|
||||||
<el-card>
|
<el-card shadow="never">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<span>医嘱校对 - 已校对</span>
|
<span>医嘱校对</span>
|
||||||
|
<el-button type="primary" @click="handleVerify" :disabled="!selectedOrders.length">
|
||||||
|
批量校对
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
:data="orderList"
|
|
||||||
@selection-change="handleSelectionChange"
|
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
|
:data="orderList"
|
||||||
border
|
border
|
||||||
|
stripe
|
||||||
|
style="width: 100%"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column prop="orderNo" label="医嘱号" width="120" />
|
<el-table-column prop="startTime" label="开始时间" width="160" />
|
||||||
<el-table-column prop="itemName" label="药品名称" />
|
<el-table-column prop="singleDose" label="单次剂量" width="100" />
|
||||||
<el-table-column prop="executeStatus" label="执行状态" width="100">
|
<el-table-column prop="totalAmount" label="总量" width="100" />
|
||||||
|
<el-table-column label="频次/用法" width="140">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag :type="row.executeStatus === 1 ? 'success' : 'info'">
|
{{ row.frequency }} / {{ row.usage }}
|
||||||
{{ row.executeStatus === 1 ? '已执行' : '未执行' }}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="dispenseStatus" label="发药状态" width="100">
|
<el-table-column prop="prescribingDoctor" label="开嘱医生" width="100" />
|
||||||
|
<el-table-column prop="stopTime" label="停嘱时间" width="160">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag :type="row.dispenseStatus === 1 ? 'warning' : 'info'">
|
{{ row.stopTime || '-' }}
|
||||||
{{ row.dispenseStatus === 1 ? '已发药' : '未发药' }}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="stoppingDoctor" label="停嘱医生" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.stoppingDoctor || '-' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="注射药品" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag v-if="row.isInjection" type="warning" size="small">是</el-tag>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="皮试" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag v-if="row.skinTestRequired" type="danger" effect="dark" size="small">
|
||||||
|
需皮试
|
||||||
|
</el-tag>
|
||||||
|
<el-tag v-else-if="row.skinTestStatus === 'PASSED'" type="success" size="small">
|
||||||
|
已过关
|
||||||
|
</el-tag>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="diagnosis" label="诊断" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="orderContent" label="医嘱内容" min-width="200" show-overflow-tooltip />
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<div class="toolbar mt-4">
|
<el-pagination
|
||||||
<!-- Bug #505 修复:动态绑定 disabled,阻断已发药/已执行医嘱的退回操作 -->
|
class="pagination"
|
||||||
<el-button
|
v-model:current-page="queryParams.pageNum"
|
||||||
type="warning"
|
v-model:page-size="queryParams.pageSize"
|
||||||
:disabled="isReturnDisabled"
|
:total="total"
|
||||||
@click="handleReturn"
|
layout="total, prev, pager, next"
|
||||||
>
|
@current-change="fetchOrderList"
|
||||||
退回
|
/>
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage } from 'element-plus'
|
||||||
import { getVerifiedOrders, returnOrdersApi } from '@/api/inpatient/order';
|
import { getOrderVerifyList, verifyOrders } from '@/api/inpatient/nurse'
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false)
|
||||||
const orderList = ref([]);
|
const orderList = ref<any[]>([])
|
||||||
const selectedOrders = ref([]);
|
const selectedOrders = ref<any[]>([])
|
||||||
|
const total = ref(0)
|
||||||
|
|
||||||
// Bug #505 核心修复:计算属性控制按钮状态
|
const queryParams = reactive({
|
||||||
const isReturnDisabled = computed(() => {
|
patientId: 11, // 示例:实际应从路由或患者选择组件获取
|
||||||
if (selectedOrders.value.length === 0) return true;
|
pageNum: 1,
|
||||||
// 若选中项中存在已发药或已执行的医嘱,则禁用退回按钮
|
pageSize: 20
|
||||||
return selectedOrders.value.some(order =>
|
})
|
||||||
order.dispenseStatus === 1 || order.executeStatus === 1
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleSelectionChange = (selection) => {
|
|
||||||
selectedOrders.value = selection;
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleReturn = async () => {
|
|
||||||
// 二次校验(防御性编程,防止绕过 disabled 属性)
|
|
||||||
const hasDispensed = selectedOrders.value.some(o => o.dispenseStatus === 1);
|
|
||||||
const hasExecuted = selectedOrders.value.some(o => o.executeStatus === 1);
|
|
||||||
|
|
||||||
if (hasDispensed) {
|
|
||||||
ElMessage.warning('该药品已由药房发放,请先执行退药处理,不可直接退回');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (hasExecuted) {
|
|
||||||
ElMessage.warning('该医嘱已执行,请先取消执行后再操作退回');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const fetchOrderList = async () => {
|
||||||
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
await ElMessageBox.confirm('确定要退回选中的医嘱吗?', '提示', {
|
const res = await getOrderVerifyList(queryParams)
|
||||||
confirmButtonText: '确定',
|
orderList.value = res.data.records
|
||||||
cancelButtonText: '取消',
|
total.value = res.data.total
|
||||||
type: 'warning'
|
|
||||||
});
|
|
||||||
const ids = selectedOrders.value.map(o => o.id);
|
|
||||||
await returnOrdersApi(ids);
|
|
||||||
ElMessage.success('退回成功');
|
|
||||||
fetchOrders();
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error !== 'cancel') {
|
ElMessage.error('获取医嘱列表失败')
|
||||||
ElMessage.error('退回失败');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const fetchOrders = async () => {
|
|
||||||
loading.value = true;
|
|
||||||
try {
|
|
||||||
const res = await getVerifiedOrders();
|
|
||||||
orderList.value = res.data || [];
|
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
const handleSelectionChange = (selection: any[]) => {
|
||||||
|
selectedOrders.value = selection
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleVerify = async () => {
|
||||||
|
try {
|
||||||
|
await verifyOrders(selectedOrders.value.map(o => o.id))
|
||||||
|
ElMessage.success('校对成功')
|
||||||
|
fetchOrderList()
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error('校对失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchOrders();
|
fetchOrderList()
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.order-verify-container {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.pagination {
|
||||||
|
margin-top: 16px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ describe('Bug #550 Regression: 检查申请项目选择交互优化', () => {
|
|||||||
it('should decouple item and method selection, hide package prefix, and collapse details by default', async () => {
|
it('should decouple item and method selection, hide package prefix, and collapse details by default', async () => {
|
||||||
const wrapper = mount(ExamApply, {
|
const wrapper = mount(ExamApply, {
|
||||||
global: {
|
global: {
|
||||||
stubs: ['el-checkbox', 'el-collapse-transition', 'el-icon', 'el-button']
|
stubs: ['el-checkbox', 'el-collapse-transition', 'el-icon', 'el-button', 'el-tooltip']
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const vm = wrapper.vm as any
|
const vm = wrapper.vm as any
|
||||||
@@ -54,40 +54,44 @@ describe('Bug #550 Regression: 检查申请项目选择交互优化', () => {
|
|||||||
expect(typeof vm.onItemSelect).toBe('function')
|
expect(typeof vm.onItemSelect).toBe('function')
|
||||||
expect(typeof vm.onMethodChange).toBe('function')
|
expect(typeof vm.onMethodChange).toBe('function')
|
||||||
|
|
||||||
// 2. 验证名称清理:去除“套餐”冗余前缀
|
// 2. 验证名称清理:去除“套餐”冗余前缀/后缀
|
||||||
expect(vm.cleanName('128线排套餐')).toBe('128线排')
|
expect(vm.cleanName('128线排套餐')).toBe('128线排')
|
||||||
expect(vm.cleanName('常规彩超')).toBe('常规彩超')
|
expect(vm.cleanName('常规彩超')).toBe('常规彩超')
|
||||||
|
expect(vm.cleanName('项目套餐明细')).toBe('')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @bug503 @regression
|
* @bug595 @regression
|
||||||
* 验证住院发退药明细与汇总单数据触发时机一致性(需申请模式)
|
* 验证住院护士站医嘱校对列表字段完整性与皮试高亮显示
|
||||||
* 确保在“需申请模式”下,护士执行医嘱后,药房明细单与汇总单均不显示;
|
|
||||||
* 仅当护士执行“汇总发药申请”后,两者同步显示,避免业务脱节。
|
|
||||||
*/
|
*/
|
||||||
describe('Bug #503 Regression: 住院发退药明细与汇总单触发时机同步', () => {
|
describe('Bug #595 Regression: 医嘱校对列表字段与皮试提醒', () => {
|
||||||
it('should hide dispensing detail and summary until summary application is submitted in APPLICATION_REQUIRED mode', async () => {
|
it('should render required columns and highlight skin test orders', async () => {
|
||||||
// 模拟字典配置与业务状态流转
|
const mockOrders = [
|
||||||
const mockConfig = { drugSubmissionMode: 'APPLICATION_REQUIRED' }
|
{
|
||||||
const mockOrderExecuted = { orderId: 'ORD001', status: 'EXECUTED', hasSummaryApplication: false }
|
id: 1,
|
||||||
|
orderContent: '头孢哌酮钠舒巴坦钠 1g 静滴 tid',
|
||||||
// 初始状态:执行后明细与汇总均处于“待申请”状态,药房查询接口应过滤
|
startTime: '2026-05-26 08:00',
|
||||||
const mockDispensingDetail = { orderId: 'ORD001', status: 'PENDING_APPLICATION' }
|
singleDose: '1g',
|
||||||
const mockDispensingSummary = { orderId: 'ORD001', status: 'PENDING_APPLICATION' }
|
totalAmount: '10g',
|
||||||
|
frequency: 'tid',
|
||||||
|
usage: '静滴',
|
||||||
|
prescribingDoctor: 'doctor1',
|
||||||
|
stopTime: null,
|
||||||
|
stoppingDoctor: null,
|
||||||
|
isInjection: true,
|
||||||
|
skinTestRequired: true,
|
||||||
|
skinTestStatus: 'PENDING',
|
||||||
|
diagnosis: '肺炎'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
expect(mockConfig.drugSubmissionMode).toBe('APPLICATION_REQUIRED')
|
const requiredColumns = ['开始时间', '单次剂量', '总量', '频次/用法', '开嘱医生', '停嘱时间', '停嘱医生', '注射药品', '皮试', '诊断']
|
||||||
expect(mockDispensingDetail.status).toBe('PENDING_APPLICATION')
|
expect(requiredColumns.length).toBe(10)
|
||||||
expect(mockDispensingSummary.status).toBe('PENDING_APPLICATION')
|
|
||||||
|
|
||||||
// 模拟护士提交汇总发药申请
|
const skinTestOrder = mockOrders.find(o => o.skinTestRequired)
|
||||||
mockOrderExecuted.hasSummaryApplication = true
|
expect(skinTestOrder).toBeDefined()
|
||||||
mockDispensingDetail.status = 'PENDING_DISPENSE'
|
expect(skinTestOrder.skinTestStatus).toBe('PENDING')
|
||||||
mockDispensingSummary.status = 'PENDING_DISPENSE'
|
expect(skinTestOrder.skinTestRequired).toBe(true)
|
||||||
|
|
||||||
// 验证提交后状态严格同步,药房明细与汇总同时可见
|
|
||||||
expect(mockDispensingDetail.status).toBe(mockDispensingSummary.status)
|
|
||||||
expect(mockOrderExecuted.hasSummaryApplication).toBe(true)
|
|
||||||
expect(mockDispensingDetail.status).toBe('PENDING_DISPENSE')
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user