From da6f03961c896385c3b65cc9cbf9a0a1388d02c8 Mon Sep 17 00:00:00 2001 From: chenqi Date: Sat, 20 Jun 2026 22:03:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(dataflow):=20=E6=96=B0=E5=A2=9EChain11=20?= =?UTF-8?q?=E6=89=8B=E6=9C=AF=E2=86=92=E7=97=85=E7=90=86=E9=80=81=E6=A3=80?= =?UTF-8?q?=E9=93=BE=E8=B7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PathologySpecimenSubmittedEvent.java | 22 ++++++++++ .../handler/PathologySubmissionHandler.java | 40 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/dataflow/event/PathologySpecimenSubmittedEvent.java create mode 100644 healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/dataflow/handler/PathologySubmissionHandler.java diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/dataflow/event/PathologySpecimenSubmittedEvent.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/dataflow/event/PathologySpecimenSubmittedEvent.java new file mode 100644 index 000000000..26c18d421 --- /dev/null +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/dataflow/event/PathologySpecimenSubmittedEvent.java @@ -0,0 +1,22 @@ +package com.healthlink.his.web.dataflow.event; + +import org.springframework.context.ApplicationEvent; +import lombok.Getter; + +@Getter +public class PathologySpecimenSubmittedEvent extends ApplicationEvent { + private final Long encounterId; + private final Long patientId; + private final Long surgeryId; + private final String specimenType; + private final String specimenSource; + + public PathologySpecimenSubmittedEvent(Object source, Long encounterId, Long patientId, Long surgeryId, String specimenType, String specimenSource) { + super(source); + this.encounterId = encounterId; + this.patientId = patientId; + this.surgeryId = surgeryId; + this.specimenType = specimenType; + this.specimenSource = specimenSource; + } +} diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/dataflow/handler/PathologySubmissionHandler.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/dataflow/handler/PathologySubmissionHandler.java new file mode 100644 index 000000000..8966a62ea --- /dev/null +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/dataflow/handler/PathologySubmissionHandler.java @@ -0,0 +1,40 @@ +package com.healthlink.his.web.dataflow.handler; + +import com.healthlink.his.web.dataflow.event.PathologySpecimenSubmittedEvent; +import com.healthlink.his.web.dataflow.util.EventRetryUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.event.EventListener; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; + +@Slf4j +@Component +public class PathologySubmissionHandler { + + @Async + @EventListener + public void onSpecimenSubmitted(PathologySpecimenSubmittedEvent event) { + log.info("Chain11 Pathology: encounterId={}, surgeryId={}, specimenType={}", + event.getEncounterId(), event.getSurgeryId(), event.getSpecimenType()); + EventRetryUtil.executeVoidWithRetry("11-Pathology", () -> { + Map pathologyOrder = new HashMap<>(); + pathologyOrder.put("encounterId", event.getEncounterId()); + pathologyOrder.put("patientId", event.getPatientId()); + pathologyOrder.put("surgeryId", event.getSurgeryId()); + pathologyOrder.put("specimenType", event.getSpecimenType()); + pathologyOrder.put("specimenSource", event.getSpecimenSource()); + pathologyOrder.put("status", "PENDING_COLLECTION"); + + // TODO: 保存病理申请到数据库 + + // TODO: 调用条码服务生成唯一标识 + + // TODO: WebSocket推送通知病理科接收标本 + + log.info("Chain11 Pathology: order created for surgeryId={}", event.getSurgeryId()); + }, 3); + } +}