package com.ruoyi.datacollection.collect; import com.ruoyi.common.core.service.dto.InhospPositionRecord; import com.ruoyi.common.core.service.dto.SltdGatherReq; import com.ruoyi.datacollection.domain.HnDataGatherVO; import com.ruoyi.datacollection.domain.ServiceSLTDDeptReqVO; import com.ruoyi.datacollection.domain.ServiceSLTDInhospReqVO; import com.ruoyi.datacollection.domain.ServiceSLTDInhospResDTO; import com.ruoyi.datacollection.service.IHNGatherPatArchiveService; import com.ruoyi.common.core.service.IIcd10Service; import com.ruoyi.datacollection.service.IServiceSLTDHealthcareRecordService; import com.ruoyi.datacollection.service.IXHGatherPatArchiveService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.time.LocalDateTime; import java.util.Date; import java.util.List; /** * 4 个 HIS 采集器的聚合入口(原 smartor 的 HisGatherApiBridge) —— 四个 HIS 采集实现的归属方。 * *

方向说明

* 契约声明在 {@code ruoyi-common}、实现放在 smartor:因为 * 采集实现目前仍在 smartor(新华 / 河南 / 省立同德·南华附一 / 疾病字典), * 而 {@code ruoyi-datacollection} 不能依赖 smartor(否则新模块被单体绑死,模块化倒退)。 * Spring 运行期注入本实现。 * *

⚠️ 本类必须保持"纯转发"

* 只做两件事:契约 DTO → 内部 VO 的逐字段搬运、调用既有 Service。 * 不得在这里加业务判断、补默认值、吞异常或改调用顺序 —— * 移植前后的行为差异都要能在 {@code HisDataCollectionServiceImpl} 一处看清。 * *

将来动作(分阶段搬迁)

* 采集实现按批搬进 {@code ruoyi-datacollection} 后,对应方法从本类与 * {@link HisGatherApi} 一起删除;全部搬完时本类整体删除。 * 见 {@code doc/数据采集模块化_调研与实施方案.md}。 */ @Slf4j @Component public class HisGatherCollectors { @Autowired private IXHGatherPatArchiveService ixhGatherPatArchiveService; @Autowired private IHNGatherPatArchiveService ihnGatherPatArchiveService; @Autowired private IServiceSLTDHealthcareRecordService serviceSLTDHealthcareRecordService; @Autowired private IIcd10Service iIcd10Service; public void gatherXhInhospRecords(String cry, LocalDateTime startTime, LocalDateTime endTime) { // 原 RyTask#dealHisData 直调 ixhGatherPatArchiveService.getInHospDataGather(cry, start, end) ixhGatherPatArchiveService.getInHospDataGather(cry, startTime, endTime); } public void gatherHnRecords(Date startTime, Date endTime) { // 原 RyTask#dealHisData 组装 HnDataGatherVO(只有 startTime / endTime 两个字段)后调用 HnDataGatherVO hnDataGatherVO = new HnDataGatherVO(); hnDataGatherVO.setStartTime(startTime); hnDataGatherVO.setEndTime(endTime); ihnGatherPatArchiveService.hnDataGather(hnDataGatherVO); } public Boolean gatherSltdDeptWardArea(SltdGatherReq req) { ServiceSLTDDeptReqVO deptReqVO = new ServiceSLTDDeptReqVO(); deptReqVO.setOrgId(req.getOrgId()); deptReqVO.setCampusIds(req.getCampusIds()); return serviceSLTDHealthcareRecordService.queryDeptWardAreaInfoList(deptReqVO); } public Boolean gatherSltdHospUser(SltdGatherReq req) { return serviceSLTDHealthcareRecordService.queryHospUserInfoList(toInhospReq(req)); } public int gatherSltdHealthcareRecords(SltdGatherReq req) { // 原调用点丢弃返回值(只关心落库副作用);这里把条数透出,供编排判断接口是否触顶截断 List records = serviceSLTDHealthcareRecordService.queryHealthcareRecordList(toInhospReq(req)); return records == null ? 0 : records.size(); } public List querySltdInhospPosition(SltdGatherReq req) { return serviceSLTDHealthcareRecordService.queryInhospPosition(toInhospReq(req)); } public int gatherIcd10() { return iIcd10Service.queryAddIcd10(); } /** * 契约 DTO → 内部 VO 的逐字段搬运(契约 DTO 刻意只保留编排真正会设置的字段)。 */ private ServiceSLTDInhospReqVO toInhospReq(SltdGatherReq req) { ServiceSLTDInhospReqVO reqVO = new ServiceSLTDInhospReqVO(); reqVO.setOrgId(req.getOrgId()); reqVO.setCampusId(req.getCampusId()); reqVO.setEncounterTimeStart(req.getEncounterTimeStart()); reqVO.setEncounterTimeEnd(req.getEncounterTimeEnd()); reqVO.setStartHeadTime(req.getStartHeadTime()); reqVO.setStartTailTime(req.getStartTailTime()); reqVO.setPreOutHospitalHeadDate(req.getPreOutHospitalHeadDate()); reqVO.setPreOutHospitalTailDate(req.getPreOutHospitalTailDate()); reqVO.setStatusList(req.getStatusList()); reqVO.setHealthcareRecordTypeList(req.getHealthcareRecordTypeList()); reqVO.setHealthcareRecordNo(req.getHealthcareRecordNo()); return reqVO; } }