diff --git a/src/main/java/com/docus/server/mzsy/entity/MzsyShoumaReportDataView.java b/src/main/java/com/docus/server/mzsy/entity/MzsyShoumaReportDataView.java new file mode 100644 index 0000000..0a8cb77 --- /dev/null +++ b/src/main/java/com/docus/server/mzsy/entity/MzsyShoumaReportDataView.java @@ -0,0 +1,36 @@ +package com.docus.server.mzsy.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * 梅州三院检验、检查、心电等报告视图 + * + * @author YongBin Wen + * @date 2024/8/16 14:39 + */ +@Data +@ApiModel("梅州三院手麻报告视图") +public class MzsyShoumaReportDataView { + + @ApiModelProperty("住院号") + private String zyh; + + @ApiModelProperty("住院次数") + private String zycs; + + @ApiModelProperty("文件路径 HTTP路径") + private String filePath; + + @ApiModelProperty("报告标题") + private String fileTitle; + + @ApiModelProperty("申请单号") + private String requestNo; + + @ApiModelProperty("归档时间") + private Date archiveTime; +} diff --git a/src/main/java/com/docus/server/mzsy/job/MzsyReportCollectJob.java b/src/main/java/com/docus/server/mzsy/job/MzsyReportCollectJob.java index 6108b01..0b98b17 100644 --- a/src/main/java/com/docus/server/mzsy/job/MzsyReportCollectJob.java +++ b/src/main/java/com/docus/server/mzsy/job/MzsyReportCollectJob.java @@ -6,7 +6,9 @@ import com.docus.infrastructure.core.utils.TableJsonRead; import com.docus.infrastructure.web.api.CommonResult; import com.docus.infrastructure.web.api.ResultCode; import com.docus.server.mzsy.entity.MzsyReportDataView; +import com.docus.server.mzsy.entity.MzsyShoumaReportDataView; import com.docus.server.mzsy.mapper.MzsyReportDataViewMapper; +import com.docus.server.mzsy.mapper.MzsyShoumaReportDataViewMapper; import com.docus.server.rpc.DownPlatformService; import com.docus.server.rpc.TaskDistributeService; import com.docus.server.rpc.dto.*; @@ -33,6 +35,8 @@ public class MzsyReportCollectJob { private TaskDistributeService taskDistributeService; @Autowired private MzsyReportDataViewMapper reportDataViewMapper; + @Autowired + private MzsyShoumaReportDataViewMapper shoumaReportDataViewMapper; @XxlJob("MzsyReportCollectJob") public void reportCollect() { @@ -59,7 +63,7 @@ public class MzsyReportCollectJob { List mzsyReportDataViewList = reportDataViewMapper.findByPatJzhAndOtherCondition(jzh, extraCondition); int size = mzsyReportDataViewList.size(); - log.info("住院号:{},住院次数:{},记账号:{} 采集视图数据:{} 条!数据:{}", reportPatientTwoDto.getInpatientNo(), hospitalTwoDto.getAdmissTimes(), jzh, size,Func.toJson(mzsyReportDataViewList)); + log.info("住院号:{},住院次数:{},记账号:{} 采集视图数据:{} 条!数据:{}", reportPatientTwoDto.getInpatientNo(), hospitalTwoDto.getAdmissTimes(), jzh, size, Func.toJson(mzsyReportDataViewList)); if (size <= 0) { return; } @@ -73,7 +77,7 @@ public class MzsyReportCollectJob { reportDownDto.setCollectorid(collectorId); reportDownDto.setIp(""); reportDownDto.setPatient(patient); - int sort=0; + int sort = 0; for (MzsyReportDataView mzsyReportDataView : mzsyReportDataViewList) { ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); reportDownScanFileDto.setDownurl(mzsyReportDataView.getFfilePath()); @@ -103,6 +107,67 @@ public class MzsyReportCollectJob { } } + + @XxlJob("MzsyShouMaReportCollectJob") + public void shouMaReportCollect() { + // 1.获取任务和患者信息 2.查询视图信息 3.上报下载 + String jobParam = XxlJobHelper.getJobParam(); + JSONObject jobParamJsonObject = JSONObject.parseObject(jobParam); + String collectorId = jobParamJsonObject.getString("collectorId"); + String extraCondition = jobParamJsonObject.getString("extraCondition"); + String assortId = jobParamJsonObject.getString("assortId"); + if (Func.isBlank(collectorId) || Func.isBlank(assortId)) { + log.warn(">>>>>>>>>>>>>>>>>>>>>> 梅州三院 手麻报告视图采集,未配置采集器获取任务信息"); + return; + } + + CommonResult commonResult = taskDistributeService.getNoViewTaskByCollectorId(collectorId); + if (ResultCode.SUCCESS.getCode().equals(commonResult.getCode()) + && commonResult.getData() != null) { + ReportDownTwoDto downTwoDto = commonResult.getData(); + ReportTaskTwoDto task = downTwoDto.getTasks().get(0); + log.info(">>>>>>>>>>>>>>>>>>>>>> 梅州三院 手麻报告视图采集任务,获取了任务:{}", Func.toJson(task)); + + ReportHospitalTwoDto hospitalTwoDto = downTwoDto.getHospitals().get(0); + ReportPatientTwoDto reportPatientTwoDto = downTwoDto.getPatient(); + String jzh = downTwoDto.getJzh(); + String inpatientNo = reportPatientTwoDto.getInpatientNo(); + Integer admissTimes = hospitalTwoDto.getAdmissTimes(); + + List shoumaReportDataViewList = shoumaReportDataViewMapper.findByinpNoAndTimesAndOtherCondition(inpatientNo, String.valueOf(admissTimes), extraCondition); + int size = shoumaReportDataViewList.size(); + log.info("住院号:{},住院次数:{},记账号:{} 采集视图数据:{} 条!数据:{}", inpatientNo, admissTimes, jzh, size, Func.toJson(shoumaReportDataViewList)); + if (size <= 0) { + return; + } + + ReportDownPatientDto patient = new ReportDownPatientDto(); + patient.setPatientid(downTwoDto.getPatientId()); + + ReportDownDto reportDownDto = new ReportDownDto(); + reportDownDto.setCollectorid(collectorId); + reportDownDto.setIp(""); + reportDownDto.setPatient(patient); + int sort = 0; + for (MzsyShoumaReportDataView mzsyShouMaReportDataView : shoumaReportDataViewList) { + ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); + reportDownScanFileDto.setDownurl(mzsyShouMaReportDataView.getFilePath()); + reportDownScanFileDto.setFiletitle(mzsyShouMaReportDataView.getFileTitle()); + reportDownScanFileDto.setSerialnum(mzsyShouMaReportDataView.getFilePath()); + reportDownScanFileDto.setFilesource(1); + reportDownScanFileDto.setFiletype(1); + reportDownScanFileDto.setFilestoragetype(1); + reportDownScanFileDto.setTaskid(task.getTaskId()); + reportDownScanFileDto.setSort(++sort); + List scanFiles = Collections.singletonList(reportDownScanFileDto); + + reportDownDto.setAssortid(assortId); + reportDownDto.setScanfiles(scanFiles); + downPlatformService.report(reportDownDto); + } + } + } + public static void main(String[] args) { TableJsonRead tableJsonRead = new TableJsonRead(); JSONObject moduleAlisConfig = tableJsonRead.Read("data-config", "mzsy-module-alis", JSONObject.class); diff --git a/src/main/java/com/docus/server/mzsy/mapper/MzsyShoumaReportDataViewMapper.java b/src/main/java/com/docus/server/mzsy/mapper/MzsyShoumaReportDataViewMapper.java new file mode 100644 index 0000000..2e1d964 --- /dev/null +++ b/src/main/java/com/docus/server/mzsy/mapper/MzsyShoumaReportDataViewMapper.java @@ -0,0 +1,26 @@ +package com.docus.server.mzsy.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.docus.server.mzsy.entity.MzsyShoumaReportDataView; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author YongBin Wen + * @date 2024/8/16 14:42 + */ +@DS("mzsy-shouma") +@Mapper +public interface MzsyShoumaReportDataViewMapper { + /** + * 根据患者住院号和住院次数和额外条件查询手麻视图数据 + * + * @param inpatientNo 住院号 + * @param admissTimes 住院次数 + * @param extCondition 额外条件 + * @return 视图数据 + */ + List findByinpNoAndTimesAndOtherCondition(@Param("inpatientNo") String inpatientNo, @Param("admissTimes")String admissTimes, @Param("ext") String extCondition); +} diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml index 1857900..4e4040a 100644 --- a/src/main/resources/bootstrap.yml +++ b/src/main/resources/bootstrap.yml @@ -55,6 +55,28 @@ spring: test-on-borrow: false test-on-return: false validation-query: select 1 + mzsy-shouma: + url: jdbc:sqlserver://192.168.0.251:1433;DatabaseName=kbamis-mzsy + username: sa + password: hospital + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver + type: com.alibaba.druid.pool.DruidDataSource + # 初始化配置 + initial-size: 3 + # 最小连接数 + min-idle: 3 + # 最大连接数 + max-active: 10 + # 获取连接超 时时间 + max-wait: 5000 + # 连接有效性检测时间 + time-between-eviction-runs-millis: 90000 + # 最大空闲时间 + min-evictable-idle-time-millis: 1800000 + test-while-idle: true + test-on-borrow: false + test-on-return: false + validation-query: select 1 ydzyy-pacs: url: jdbc:sqlserver://10.10.100.105;DatabaseName=pacsdb username: wzhpacs diff --git a/src/main/resources/mapper/MzsyShoumaReportDataViewMapper.xml b/src/main/resources/mapper/MzsyShoumaReportDataViewMapper.xml new file mode 100644 index 0000000..036c350 --- /dev/null +++ b/src/main/resources/mapper/MzsyShoumaReportDataViewMapper.xml @@ -0,0 +1,25 @@ + + + + + + +