sse实时开发 微修

This commit is contained in:
weixin_45799331
2026-01-28 12:11:50 +08:00
parent b0f2eabf6b
commit a6a4e0ed58
3 changed files with 13 additions and 5 deletions

View File

@@ -245,7 +245,7 @@ public class TriageQueueAppServiceImpl implements TriageQueueAppService {
selected.setStatus(STATUS_CALLING).setUpdateTime(LocalDateTime.now()); selected.setStatus(STATUS_CALLING).setUpdateTime(LocalDateTime.now());
triageQueueItemService.updateById(selected); triageQueueItemService.updateById(selected);
// 叫号后推送 SSE 消息(实时通知显示屏刷新) // 叫号后推送 SSE 消息(实时通知显示屏刷新)
pushDisplayUpdate(selected.getOrganizationId(), selected.getQueueDate(), selected.getTenantId()); pushDisplayUpdate(selected.getOrganizationId(), selected.getQueueDate(), selected.getTenantId());
return R.ok(true); return R.ok(true);
@@ -332,7 +332,7 @@ public class TriageQueueAppServiceImpl implements TriageQueueAppService {
recalcOrders(actualOrgId, null); recalcOrders(actualOrgId, null);
// 完成后推送 SSE 消息(实时通知显示屏刷新) // 完成后推送 SSE 消息(实时通知显示屏刷新)
pushDisplayUpdate(actualOrgId, calling.getQueueDate(), tenantId); pushDisplayUpdate(actualOrgId, calling.getQueueDate(), tenantId);
return R.ok(true); return R.ok(true);

View File

@@ -16,7 +16,9 @@ import java.util.concurrent.CopyOnWriteArraySet;
@Component @Component
public class CallNumberSseManager { public class CallNumberSseManager {
private static final long NO_TIMEOUT = 0L; private static final long NO_TIMEOUT = 0L; // 0 表示“永不超时”
// 按科室分组保存连接消化内科有3个屏、心内科有2个屏
// 很多屏幕同时连、同时断。故用 ConcurrentHashMap 存储,线程安全。内部分段锁,不阻塞其他科室的操作。
private static final Map<Long, CopyOnWriteArraySet<SseEmitter>> emitterMap = new ConcurrentHashMap<>(); private static final Map<Long, CopyOnWriteArraySet<SseEmitter>> emitterMap = new ConcurrentHashMap<>();
/** /**

View File

@@ -815,6 +815,8 @@ const loadDataFromApi = async () => {
appointmentType: item.healthcareName ?? '普通', appointmentType: item.healthcareName ?? '普通',
room: item.organizationName ? `${item.organizationName}` : '-', room: item.organizationName ? `${item.organizationName}` : '-',
doctor: item.practitionerName ?? '-', doctor: item.practitionerName ?? '-',
// 当前接口返回的是 practitionerUserId保存为 practitionerId 供入队使用
practitionerId: item.practitionerUserId ?? null,
matchingRule: '-' // 这里先不做智能规则匹配 matchingRule: '-' // 这里先不做智能规则匹配
})) }))
console.log('【心内科】候选池已加载', originalCandidatePoolList.value.length, '条今天的数据') console.log('【心内科】候选池已加载', originalCandidatePoolList.value.length, '条今天的数据')
@@ -1031,7 +1033,9 @@ const handleAddToQueue = async () => {
patientId: c.patientId, patientId: c.patientId,
patientName: c.patientName, patientName: c.patientName,
healthcareName: c.appointmentType, healthcareName: c.appointmentType,
practitionerName: c.doctor practitionerName: c.doctor,
practitionerId: c.practitionerId ?? null,
roomNo: c.roomNo ?? c.room ?? null
}) })
}) })
@@ -1144,7 +1148,9 @@ const handleAddAllToQueue = async () => {
patientId: c.patientId, patientId: c.patientId,
patientName: c.patientName, patientName: c.patientName,
healthcareName: c.appointmentType, healthcareName: c.appointmentType,
practitionerName: c.doctor practitionerName: c.doctor,
practitionerId: c.practitionerId ?? null,
roomNo: c.roomNo ?? c.room ?? null
}) })
}) })