package com.ruoyi.outpatientvisit.api; import com.ruoyi.outpatientvisit.domain.PatMedOuthosp; import com.ruoyi.outpatientvisit.service.OuthospDataService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Collection; import java.util.Set; /** * 门急诊随访模块的业务能力门面(常驻 Bean)。 * *
* ⚠️ 唯一的例外是 {@link #dealOutpatientInfo()}:它是"生成随访"的编排动作, * 必须受开关管辖,故转发给带守卫的 {@code OuthospVisitFacade}。 * 这个例外曾经是"漏网":本类注释说不受管辖、实现也真的没有守卫, * 于是 {@code outpatientvisit.enabled=false} 经此路径完全失效 —— 详见该方法的注释。 * *
* ⚠️ 用 {@code ObjectProvider} 惰性取,而不是直接 {@code @Autowired} 字段:
* {@code OuthospVisitFacade} 与本类是同一模块内的两个常驻 Bean,
* 直接用硬依赖会引入 Bean 之间的初始化顺序耦合;
* 惰性取还顺带保证"装配缺失也不会让本门面启动失败"(与本模块既有写法一致)。
*/
@Autowired
private ObjectProvider 对应原 {@code IPatMedOuthospService#insertPatMedOuthosp}。
*/
public int insert(PatMedOuthosp row) {
return dataService.insert(row);
}
/**
* 修改门诊记录。
* 对应原 {@code IPatMedOuthospService#updatePatMedOuthosp}。
*/
public int update(PatMedOuthosp row) {
return dataService.update(row);
}
/**
* 批量查已入库的 serialnum。
* 对应原 {@code IPatMedOuthospService#selectExistingSerialnums}。
*/
public Set
* 供 smartor 侧【未迁】的单患者按需随访链路内部使用(它需要按条件取历史门诊记录)。
*
* ⚠️ 展示富化只在 {@code query.pageNum != null} 时发生(原实现如此)——
* 内部链路不设 pageNum,因此拿到的是未富化的原始行,与原实现一致。
*/
public java.util.List 对应原 {@code IPatMedOuthospService#dealOutpatientInfo}。
*
*
* 为什么专门写这段注释:本类类注释写的是"本类的方法都是纯数据访问、不受开关管辖",
* 而本方法是个编排动作 —— 这两句话曾经矛盾,且方法实现确实没有守卫。
* 后果是 {@code outpatientvisit.enabled=false} 经此路径调用时完全失效
* (定时任务当时正是走这条路)。保留此方法是为了让既有调用方零改动,
* 但守卫只应有一处,就是被转发的那个门面方法。
*/
public Integer dealOutpatientInfo() {
OuthospVisitFacade facade = outhospVisitFacadeProvider == null
? null : outhospVisitFacadeProvider.getIfAvailable();
if (facade == null) {
log.warn("【门急诊随访】OuthospVisitFacade 不可用(装配缺失),dealOutpatientInfo 跳过。");
return 0;
}
// 开关判断由被转发方统一负责,此处不再重复判一次(避免两处判断漂移)
return facade.dealOutpatientInfo();
}
/**
* 按条件走存储过程查门诊记录(原 {@code PatMedOuthospMapper#callSpQueryOuthosp})。
*
* 供 smartor 侧「随访答复/明细」类服务按条件取门诊记录用。
* 加它的原因:那几个服务原先直接注入 {@code PatMedOuthospMapper},
* 而该 Mapper 已独占搬入本模块 —— 跨模块直连 Mapper 是架构探针明确禁止的
* ({@code verify_inhospvisit_api_boundary} 的 mapper 归零约束)。
* 这里只是纯转发,SQL 一行未改。
*
* @param req 存储过程入参(调用方按最小必要字段构造,不要用 DtoConversionUtils 全量带字段,
* 否则可能改变存储过程的 WHERE 分支)
* @return 门诊记录列表;无数据返回空列表
*/
public java.util.List
* 与 {@link #callSpQueryOuthosp} 同一口径,只是一次取 count。
* 同样是纯转发,供 smartor 侧跨模块调用。
*/
public Long callSpQueryOuthospCount(
com.ruoyi.outpatientvisit.domain.PatMedOuthospQueryReq req) {
return dataService.callSpQueryOuthospCount(req);
}
}
⚠️ 本方法受 {@code outpatientvisit.enabled} 管辖
* 它是本类里唯一的"业务动作"(其余方法都是纯数据访问,刻意不受开关管)——
* 所以它必须转发到带守卫的 {@link OuthospVisitFacade#dealOutpatientInfo()},
* 而不是直接调 {@code taskService}。
*