feat:梅州三院视图报告采集

master
wyb 11 months ago
parent a83fc1c096
commit 061aeeb742

@ -0,0 +1,9 @@
{
"lis":"lis对应的分段",
"us":"us对应的分段",
"dx":"dx对应的分段",
"ct":"ct对应的分段",
"ecg":"ecg对应的分段",
"mect":"mect对应的分段",
"default":"默认文件分段"
}

@ -0,0 +1,39 @@
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 MzsyReportDataView {
@ApiModelProperty("住院号")
private String zyh;
@ApiModelProperty("住院次数")
private Integer zycs;
@ApiModelProperty("文件ID主键定义文件唯一")
private String ffileId;
@ApiModelProperty("文件名称")
private String ffileName;
@ApiModelProperty("申请时间")
private Date ffileAfTime;
@ApiModelProperty("报告时间")
private Date ffileTime;
@ApiModelProperty("文件路径 HTTP路径")
private String ffilePath;
@ApiModelProperty("记账号(住院流水号)匹配患者主键唯一值")
private String fpatJzh;
@ApiModelProperty("分检验检查心电等LIS、USDXCTECG")
private String fpatModule;
@ApiModelProperty("最后更新时间")
private Date updateTime;
}

@ -0,0 +1,111 @@
package com.docus.server.mzsy.job;
import com.alibaba.fastjson.JSONObject;
import com.docus.core.util.Func;
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.mapper.MzsyReportDataViewMapper;
import com.docus.server.rpc.DownPlatformService;
import com.docus.server.rpc.TaskDistributeService;
import com.docus.server.rpc.dto.*;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.List;
/**
* @author YongBin Wen
* @date 2024/8/16 14:45
*/
@Component
@Slf4j
public class MzsyReportCollectJob {
@Autowired
private DownPlatformService downPlatformService;
@Autowired
private TaskDistributeService taskDistributeService;
@Autowired
private MzsyReportDataViewMapper reportDataViewMapper;
@XxlJob("MzsyReportCollectJob")
public void reportCollect() {
// 1.获取任务和患者信息 2.查询视图信息 3.上报下载
String jobParam = XxlJobHelper.getJobParam();
JSONObject jobParamJsonObject = JSONObject.parseObject(jobParam);
String collectorId = jobParamJsonObject.getString("collectorId");
String extraCondition = jobParamJsonObject.getString("extraCondition");
if (Func.isBlank(collectorId)) {
log.warn(">>>>>>>>>>>>>>>>>>>>>> 梅州三院 检查、检验、心电等报告视图采集,未配置采集器获取任务信息");
return;
}
CommonResult<ReportDownTwoDto> 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();
List<MzsyReportDataView> mzsyReportDataViewList = reportDataViewMapper.findByPatJzhAndOtherCondition(jzh, extraCondition);
int size = mzsyReportDataViewList.size();
log.info("住院号:{},住院次数:{},记账号:{} 采集视图数据:{} 条!数据:{}", reportPatientTwoDto.getInpatientNo(), hospitalTwoDto.getAdmissTimes(), jzh, size,Func.toJson(mzsyReportDataViewList));
if (size <= 0) {
return;
}
TableJsonRead tableJsonRead = new TableJsonRead();
JSONObject moduleAlisConfig = tableJsonRead.Read("data-config", "mzsy-module-alis", JSONObject.class);
ReportDownPatientDto patient = new ReportDownPatientDto();
patient.setPatientid(downTwoDto.getPatientId());
ReportDownDto reportDownDto = new ReportDownDto();
reportDownDto.setCollectorid(collectorId);
reportDownDto.setIp("");
reportDownDto.setPatient(patient);
int sort=0;
for (MzsyReportDataView mzsyReportDataView : mzsyReportDataViewList) {
ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto();
reportDownScanFileDto.setDownurl(mzsyReportDataView.getFfilePath());
reportDownScanFileDto.setFiletitle(mzsyReportDataView.getFfileName());
reportDownScanFileDto.setSerialnum(mzsyReportDataView.getFfileId());
reportDownScanFileDto.setFilesource(1);
reportDownScanFileDto.setFiletype(1);
reportDownScanFileDto.setFilestoragetype(1);
reportDownScanFileDto.setTaskid(task.getTaskId());
reportDownScanFileDto.setSort(++sort);
List<ReportDownScanFileDto> scanFiles = Collections.singletonList(reportDownScanFileDto);
String assortId;
String fpatModule = mzsyReportDataView.getFpatModule();
if (Func.isBlank(fpatModule)) {
assortId = moduleAlisConfig.getString("default");
} else {
assortId = moduleAlisConfig.getString(fpatModule.toLowerCase().trim());
if (Func.isBlank(assortId)) {
assortId = moduleAlisConfig.getString("default");
}
}
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);
System.out.println(moduleAlisConfig);
}
}

@ -0,0 +1,25 @@
package com.docus.server.mzsy.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.docus.server.mzsy.entity.MzsyReportDataView;
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")
@Mapper
public interface MzsyReportDataViewMapper {
/**
*
*
* @param patJzh
* @param extCondition
* @return
*/
List<MzsyReportDataView> findByPatJzhAndOtherCondition(@Param("jzh") String patJzh, @Param("ext") String extCondition);
}

@ -28,5 +28,8 @@ public class ReportDownScanFileDto {
@ApiModelProperty(value = "是否作废 0否 不作废1是 作废")
private int cancel=0;
@ApiModelProperty(value = "文件排序")
private int sort=0;
}

@ -8,7 +8,6 @@ import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.config.DocusServerUrlConfig;
import com.docus.server.rpc.DownPlatformService;
import com.docus.server.rpc.dto.ReportDownDto;
import com.docus.server.rpc.dto.ReportDownScanFileDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@ -31,8 +30,7 @@ public class DownPlatformServiceImpl implements DownPlatformService {
String downUrl = serverUrlConfig.getDownloadPlatformServerUrl() + "api/downplatform/report";
String requestId = Func.randomUUID();
String requestParam = Func.toJson(reportDownDto);
ReportDownScanFileDto report = reportDownDto.getScanfiles().get(0);
log.info("[{}]调用下载服务,地址:{} 参数taskid={}", requestId, downUrl, report.getTaskid());
log.info("[{}]调用下载服务,地址:{} ,参数:{}", requestId, downUrl, requestParam);
String respBody = post(downUrl, requestParam);
log.info("[{}]调用下载服务成功,响应参数:{}", requestId, respBody);
return Func.readJson(respBody, CommonResult.class);

@ -33,11 +33,11 @@ spring:
test-on-borrow: false
test-on-return: false
validation-query: select 1
shouMa:
url: jdbc:log4jdbc:mysql://192.168.8.108:3306/lancet-aims?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: wzh
password: wzh
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
mzsy:
url: jdbc:sqlserver://192.168.0.109;DatabaseName=interface_xmjs
username: xmjs
password: xmjs
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
type: com.alibaba.druid.pool.DruidDataSource
# 初始化配置
initial-size: 3
@ -54,7 +54,7 @@ spring:
test-while-idle: true
test-on-borrow: false
test-on-return: false
validation-query: select 1 from dual
validation-query: select 1
redis:
host: redis.docus.cn
password: JSdocus@702

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.server.mzsy.mapper.MzsyReportDataViewMapper">
<select id="findByPatJzhAndOtherCondition" resultType="com.docus.server.mzsy.entity.MzsyReportDataView">
select
ZYH,
ZYCS,
FFILE_ID AS ffileId,
FFILE_NAME AS ffileName,
FFILE_AF_TIME AS ffileAfTime,
FFILE_TIME AS ffileTime,
FFILE_PATH AS ffilePath,
FPAT_JZH AS fpatJzh,
FPAT_MODULE AS fpatModule,
UPDATE_TIME AS updateTime
from dbo.V_REPORT_DATA
where FPAT_JZH=#{jzh}
<if test="ext != null and ext != ''">
${ext}
</if>
order by FPAT_MODULE asc,FFILE_AF_TIME asc
</select>
</mapper>
Loading…
Cancel
Save