Merge branch 'develop' of https://gitea.gentronhealth.com/wangyizhe/his into develop
This commit is contained in:
@@ -274,27 +274,8 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
||||
return R.fail("非就诊中患者不能完诊");
|
||||
}
|
||||
|
||||
// 2. 获取 pool_id 和 slot_id:从 encounter → order_main → adm_schedule_slot 链路获取
|
||||
// 确保 div_log 中的值与排班主表一致,不依赖 triage_queue_item(队列项可能不存在或值错误)
|
||||
// 2. 查找队列项(限定当天,避免复诊患者匹配到历史队列记录)
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
Long divPoolId = null;
|
||||
Long divSlotId = null;
|
||||
if (encounter.getOrderId() != null) {
|
||||
try {
|
||||
Order order = iOrderService.getById(encounter.getOrderId());
|
||||
if (order != null && order.getSlotId() != null) {
|
||||
divSlotId = order.getSlotId();
|
||||
ScheduleSlot slot = scheduleSlotMapper.selectById(divSlotId);
|
||||
if (slot != null) {
|
||||
divPoolId = slot.getPoolId();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取完诊div_log的pool_id/slot_id失败,encounterId={}", encounterId, e);
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 查找队列项(限定当天,避免复诊患者匹配到历史队列记录)
|
||||
TriageQueueItem queueItem = triageQueueItemService.getOne(
|
||||
new LambdaQueryWrapper<TriageQueueItem>()
|
||||
.eq(TriageQueueItem::getTenantId, tenantId)
|
||||
@@ -319,14 +300,41 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 获取 pool_id 和 slot_id:优先使用 triage_queue_item(挂号时录入的号源信息,为权威来源)
|
||||
// 队列项不存在或值缺失时,回退使用 encounter → order_main → adm_schedule_slot 链路
|
||||
Long divPoolId = null;
|
||||
Long divSlotId = null;
|
||||
if (queueItem != null && queueItem.getPoolId() != null && queueItem.getSlotId() != null) {
|
||||
divPoolId = queueItem.getPoolId();
|
||||
divSlotId = queueItem.getSlotId();
|
||||
} else if (encounter.getOrderId() != null) {
|
||||
try {
|
||||
Order order = iOrderService.getById(encounter.getOrderId());
|
||||
if (order != null && order.getSlotId() != null) {
|
||||
divSlotId = order.getSlotId();
|
||||
ScheduleSlot slot = scheduleSlotMapper.selectById(divSlotId);
|
||||
if (slot != null) {
|
||||
divPoolId = slot.getPoolId();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("回退获取完诊div_log的pool_id/slot_id失败,encounterId={}", encounterId, e);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果队列项存在且未完成,更新队列状态为已完成
|
||||
// 使用排除法而非白名单:只要不是"已完成"就可以完诊,覆盖跳过、等待等非标准流转状态
|
||||
if (queueItem != null &&
|
||||
!TriageQueueStatus.COMPLETED.getValue().equals(queueItem.getStatus())) {
|
||||
java.time.LocalDateTime nowLocal = java.time.LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS);
|
||||
queueItem.setStatus(TriageQueueStatus.COMPLETED.getValue());
|
||||
queueItem.setUpdateTime(nowLocal);
|
||||
triageQueueItemService.updateById(queueItem);
|
||||
// 使用 LambdaUpdateWrapper 直接更新,确保 status 字段必定写入数据库
|
||||
boolean queueUpdate = triageQueueItemService.update(new LambdaUpdateWrapper<TriageQueueItem>()
|
||||
.eq(TriageQueueItem::getId, queueItem.getId())
|
||||
.set(TriageQueueItem::getStatus, TriageQueueStatus.COMPLETED.getValue())
|
||||
.set(TriageQueueItem::getUpdateTime, nowLocal));
|
||||
if (!queueUpdate) {
|
||||
log.error("完诊:triage_queue_item 状态更新失败,queueItemId={}", queueItem.getId());
|
||||
}
|
||||
} else if (queueItem == null) {
|
||||
log.error("完诊:未找到任何 triage_queue_item 记录,encounterId={}, tenantId={}",
|
||||
encounterId, tenantId);
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -91,8 +92,14 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
||||
return R.fail("无待签发的医嘱,该申请单不可编辑");
|
||||
}
|
||||
} else {
|
||||
// 诊疗处方号
|
||||
prescriptionNo = assignSeqUtil.getSeq(AssignSeqEnum.ACTIVITY_PSYCHOTROPIC_NO.getPrefix(), 8);
|
||||
// 诊疗处方号 - 按申请单类型生成不同规则的单号
|
||||
if (ActivityDefCategory.TEST.getCode().equals(typeCode)) {
|
||||
// 检查申请单:JC(检查)+ Z(住院标识)+ yyMMdd(日期)+ 5位顺序号
|
||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
prescriptionNo = "JCZ" + dateStr + assignSeqUtil.getSeq("JCZ_" + dateStr, 5);
|
||||
} else {
|
||||
prescriptionNo = assignSeqUtil.getSeq(AssignSeqEnum.ACTIVITY_PSYCHOTROPIC_NO.getPrefix(), 8);
|
||||
}
|
||||
}
|
||||
|
||||
// 当前时间
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<el-table-column prop="patientName" label="患者姓名" width="120" />
|
||||
<el-table-column prop="name" label="申请单名称" width="140" />
|
||||
<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 prop="requesterId_dictText" label="申请者" width="120" />
|
||||
<el-table-column label="申请单状态" width="120" align="center">
|
||||
<template #default="scope">
|
||||
@@ -118,7 +118,7 @@
|
||||
<el-descriptions-item label="创建时间">{{
|
||||
currentDetail.createTime || '-'
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="处方号">{{
|
||||
<el-descriptions-item label="申请单号">{{
|
||||
currentDetail.prescriptionNo || '-'
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="申请者">{{
|
||||
|
||||
Reference in New Issue
Block a user