消费任务 的job

3.2.4.44
wyb 2 years ago
parent 8bb640f7df
commit b24065634c

@ -15,4 +15,6 @@ import org.springframework.stereotype.Component;
public class ApplicationBusinessConfig { public class ApplicationBusinessConfig {
@Value("${docus.report.downurl:}") @Value("${docus.report.downurl:}")
private String downUrl; private String downUrl;
@Value("${docus.task.getTaskUrl:}")
private String getTaskUrl;
} }

@ -32,6 +32,9 @@ public class SdRyReportQueryConfig {
private String reportQueryLisAccessKey; private String reportQueryLisAccessKey;
@Value("${sdry.report-query-url.lis.interval:1000}") @Value("${sdry.report-query-url.lis.interval:1000}")
private int reportQueryLisInterval; private int reportQueryLisInterval;
@Value("${sdry.report-query-url.lis.collectorId}")
private String reportQueryLisCollectorId;
@Value("${sdry.report-query-url.inspect.url:}") @Value("${sdry.report-query-url.inspect.url:}")
private String reportQueryInspectUrl; private String reportQueryInspectUrl;
@ -43,4 +46,6 @@ public class SdRyReportQueryConfig {
private String reportQueryInspectAccessKey; private String reportQueryInspectAccessKey;
@Value("${sdry.report-query-url.inspect.interval:1000}") @Value("${sdry.report-query-url.inspect.interval:1000}")
private int reportQueryInspectInterval; private int reportQueryInspectInterval;
@Value("${sdry.report-query-url.inspect.collectorId}")
private String reportQueryInspectCollectorId;
} }

@ -6,6 +6,7 @@ import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.collection.entity.TBasic; import com.docus.server.collection.entity.TBasic;
import com.docus.server.collection.mapper.TBasicMapper; import com.docus.server.collection.mapper.TBasicMapper;
import com.docus.server.report.job.ReportJob; import com.docus.server.report.job.ReportJob;
import com.docus.server.report.noviwtask.NoViewTaskService;
import com.docus.server.report.service.ReportService; import com.docus.server.report.service.ReportService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -31,21 +32,28 @@ public class ReportDownController {
private TBasicMapper tBasicMapper; private TBasicMapper tBasicMapper;
@Resource @Resource
ReportJob reportJob; ReportJob reportJob;
@Resource
private NoViewTaskService noViewTaskService;
@ApiOperation(value = "report lis job 测试") @ApiOperation(value = "获取任务测试")
@PostMapping("/lisreportJobTest") @PostMapping("/getTaskTest")
public CommonResult<String> LisreportJobTest(){ public CommonResult<Object> getTaskTest(@RequestParam("collectorId") String collectorId){
reportJob.sdRyLisReportQueryJob(); return CommonResult.success(noViewTaskService.getTaskByCollectorId(collectorId));
return CommonResult.success("成功");
} }
@ApiOperation(value = "report inspect job 测试") @ApiOperation(value = " lis 检验 采集 job 测试")
@PostMapping("/inspectReportJobTest") @GetMapping("/sdRyLisCollectJob")
public CommonResult<String> inspectReportJobTest(){ public CommonResult<String> sdRyLisCollectJob(){
reportJob.sdRyInspectReportQueryJob(); reportJob.sdRyLisCollectJob();
return CommonResult.success("成功"); return CommonResult.success("成功");
} }
@ApiOperation(value = " inspect 检查 采集 job 测试")
@GetMapping("/sdRyInspectCollectJob")
public CommonResult<String> sdRyInspectCollectJob(){
reportJob.sdRyInspectCollectJob();
return CommonResult.success("成功");
}
@ApiOperation(value = " inspectReport 根据病案主键补偿") @ApiOperation(value = " inspectReport 根据病案主键补偿")
@PostMapping("/inspectReportMakeup") @PostMapping("/inspectReportMakeup")
@ -76,7 +84,7 @@ public class ReportDownController {
} }
@ApiOperation(value = "根据任务id补偿报告下载") @ApiOperation(value = "根据任务id补偿报告下载(接收推送的报告)")
@PostMapping("/makeupReportByTaskIds") @PostMapping("/makeupReportByTaskIds")
public CommonResult<String> makeupReportByTaskIds(@RequestBody List<Long> taskIds){ public CommonResult<String> makeupReportByTaskIds(@RequestBody List<Long> taskIds){
if (Func.isEmpty(taskIds)) { if (Func.isEmpty(taskIds)) {
@ -92,7 +100,23 @@ public class ReportDownController {
} }
@ApiOperation(value = "inspect检查报告测试地址")
@ApiOperation(value = "report lis job 测试",hidden = true)
@PostMapping("/lisreportJobTest")
public CommonResult<String> LisreportJobTest(){
reportJob.sdRyLisReportQueryJob();
return CommonResult.success("成功");
}
@ApiOperation(value = "report inspect job 测试",hidden = true)
@PostMapping("/inspectReportJobTest")
public CommonResult<String> inspectReportJobTest(){
reportJob.sdRyInspectReportQueryJob();
return CommonResult.success("成功");
}
@ApiOperation(value = "inspect检查报告测试地址",hidden = true)
@PostMapping("/inspectTest/query") @PostMapping("/inspectTest/query")
public JSONObject inspectTest(@RequestParam("uuid") String uuid, public JSONObject inspectTest(@RequestParam("uuid") String uuid,
@RequestParam("action") String action, @RequestParam("action") String action,
@ -262,7 +286,7 @@ public class ReportDownController {
} }
@ApiOperation(value = "inspect检查报告测试地址") @ApiOperation(value = "inspect检查报告测试地址 ",hidden = true)
@PostMapping("/inspectTestNoResult/query") @PostMapping("/inspectTestNoResult/query")
public JSONObject inspectTestNoResult(@RequestParam("uuid") String uuid, public JSONObject inspectTestNoResult(@RequestParam("uuid") String uuid,
@RequestParam("action") String action, @RequestParam("action") String action,
@ -290,7 +314,7 @@ public class ReportDownController {
@ApiOperation(value = "lis检验报告测试地址") @ApiOperation(value = "lis检验报告测试地址" ,hidden = true)
@PostMapping("/lisTest/query") @PostMapping("/lisTest/query")
public JSONObject lisTest(@RequestParam("uuid") String uuid, public JSONObject lisTest(@RequestParam("uuid") String uuid,
@RequestParam("action") String action, @RequestParam("action") String action,
@ -420,7 +444,7 @@ public class ReportDownController {
@ApiOperation(value = "lis检验报告测试地址") @ApiOperation(value = "lis检验报告测试地址",hidden = true)
@PostMapping("/lisTestNoResult/query") @PostMapping("/lisTestNoResult/query")
public JSONObject lisTestNoResult(@RequestParam("uuid") String uuid, public JSONObject lisTestNoResult(@RequestParam("uuid") String uuid,
@RequestParam("action") String action, @RequestParam("action") String action,

@ -17,6 +17,8 @@ import com.docus.server.report.entity.AfJobTime;
import com.docus.server.report.entity.AfReportRecord; import com.docus.server.report.entity.AfReportRecord;
import com.docus.server.report.mapper.AfJobTimeMapper; import com.docus.server.report.mapper.AfJobTimeMapper;
import com.docus.server.report.mapper.AfReportRecordMapper; import com.docus.server.report.mapper.AfReportRecordMapper;
import com.docus.server.report.noviwtask.NoViewTaskService;
import com.docus.server.report.noviwtask.dto.ReportDownTwoDto;
import com.docus.server.report.service.ReportService; import com.docus.server.report.service.ReportService;
import com.docus.server.report.util.IdUtil; import com.docus.server.report.util.IdUtil;
import com.docus.server.report.util.XmlUtil; import com.docus.server.report.util.XmlUtil;
@ -31,10 +33,7 @@ import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
@ -60,11 +59,62 @@ public class ReportJob {
private IdService idService; private IdService idService;
@Resource @Resource
private SdRyReportQueryConfig sdRyReportQueryConfig; private SdRyReportQueryConfig sdRyReportQueryConfig;
@Resource
private NoViewTaskService noViewTaskService;
@XxlJob("SdRyLisCollectJob")
public void sdRyLisCollectJob() {
String reportQueryLisCollectorId = sdRyReportQueryConfig.getReportQueryLisCollectorId();
ReportDownTwoDto reportDownTwoDto = noViewTaskService.getTaskByCollectorId(reportQueryLisCollectorId);
if (reportDownTwoDto == null) {
return;
}
String patientId = reportDownTwoDto.getPatient().getPatientId();
List<TBasic> basicList = tBasicMapper.selectBasicListByPatientIds(Collections.singletonList(patientId));
if (basicList.isEmpty()) {
log.warn("patientId {} 未找到基础数据!", patientId);
}
List<ReportDto> reportDtoList = collectLisReport(basicList.get(0));
reportDtoList.forEach(reportDto -> {
reportDto.setSysFlag(reportQueryLisCollectorId);
reportDto.setTaskId(reportDownTwoDto.getTasks().get(0).getTaskId());
reportService.report(reportDto);
});
}
/**
*
*/
@XxlJob("SdRyInspectCollectJob")
public void sdRyInspectCollectJob() {
String reportQueryInspectCollectorId = sdRyReportQueryConfig.getReportQueryInspectCollectorId();
ReportDownTwoDto reportDownTwoDto = noViewTaskService.getTaskByCollectorId(reportQueryInspectCollectorId);
if (reportDownTwoDto == null) {
return;
}
String patientId = reportDownTwoDto.getPatient().getPatientId();
List<TBasic> basicList = tBasicMapper.selectBasicListByPatientIds(Collections.singletonList(patientId));
if (basicList.isEmpty()) {
log.warn("patientId {} 未找到基础数据!", patientId);
}
List<ReportDto> reportDtoList = collectInspectReport(basicList.get(0));
reportDtoList.forEach(reportDto -> {
reportDto.setSysFlag(reportQueryInspectCollectorId);
reportDto.setTaskId(reportDownTwoDto.getTasks().get(0).getTaskId());
reportService.report(reportDto);
});
}
/** /**
* Lis 3 * Lis {@link com.docus.server.report.job.ReportJob#sdRyLisCollectJob }
*/ */
@XxlJob("SdRyLisReportQueryJob") @XxlJob("SdRyLisReportQueryJob")
@Deprecated
public void sdRyLisReportQueryJob() { public void sdRyLisReportQueryJob() {
// 顺德人医 Lis 检验报告查询 // 顺德人医 Lis 检验报告查询
final String jobType = "SdRyLisReport"; final String jobType = "SdRyLisReport";
@ -102,24 +152,11 @@ public class ReportJob {
log.info("LIS检验报告报告查询 任务结束了,本次查询出院时间段 {} - {}", "", ""); log.info("LIS检验报告报告查询 任务结束了,本次查询出院时间段 {} - {}", "", "");
} }
public void queryLisReport(List<TBasic> basicList) {
for (TBasic tBasic : basicList) {
List<ReportDto> reportDtoList = getLisReportList(tBasic);
if (reportDtoList.isEmpty()) {
log.warn("病案主键 patientId {} 未查询 LIS 检验报告!", tBasic.getPatientId());
continue;
}
reportDtoList.forEach(reportDto -> {
reportService.report(reportDto);
});
}
}
/** /**
* 3 * , {@link com.docus.server.report.job.ReportJob#SdRyInspectCollectJob }
*/ */
@XxlJob("SdRyInspectReportQueryJob") @XxlJob("SdRyInspectReportQueryJob")
@Deprecated
public void sdRyInspectReportQueryJob() { public void sdRyInspectReportQueryJob() {
// 顺德人医 检查报告查询 // 顺德人医 检查报告查询
final String jobType = "SdRyInspectReport"; final String jobType = "SdRyInspectReport";
@ -156,6 +193,37 @@ public class ReportJob {
log.info("检查报告报告查询 任务结束了,本次查询出院时间段 {} - {}", "", ""); log.info("检查报告报告查询 任务结束了,本次查询出院时间段 {} - {}", "", "");
} }
public List<ReportDto> collectLisReport(TBasic tBasic) {
List<ReportDto> reportDtoList = getLisReportList(tBasic);
if (reportDtoList.isEmpty()) {
log.warn("病案主键 patientId {} 未查询 LIS 检验报告!", tBasic.getPatientId());
}
return reportDtoList;
}
public List<ReportDto> collectInspectReport(TBasic basic) {
List<ReportDto> reportDtoList = getInspectReportList(basic);
if (reportDtoList.isEmpty()) {
log.warn("病案主键 patientId {} 未查询 检查报告!", basic.getPatientId());
}
return reportDtoList;
}
public void queryLisReport(List<TBasic> basicList) {
for (TBasic tBasic : basicList) {
List<ReportDto> reportDtoList = getLisReportList(tBasic);
if (reportDtoList.isEmpty()) {
log.warn("病案主键 patientId {} 未查询 LIS 检验报告!", tBasic.getPatientId());
continue;
}
reportDtoList.forEach(reportDto -> {
reportService.report(reportDto);
});
}
}
public void queryInspectReport(List<TBasic> basicList) { public void queryInspectReport(List<TBasic> basicList) {
for (TBasic tBasic : basicList) { for (TBasic tBasic : basicList) {
List<ReportDto> reportDtoList = getInspectReportList(tBasic); List<ReportDto> reportDtoList = getInspectReportList(tBasic);
@ -238,13 +306,13 @@ public class ReportJob {
String orgCode = "4560886379"; String orgCode = "4560886379";
Date admissDate = tBasic.getAdmissDate(); Date admissDate = tBasic.getAdmissDate();
Date disDate = tBasic.getDisDate(); Date disDate = tBasic.getDisDate();
if (admissDate == null || disDate==null) { if (admissDate == null || disDate == null) {
throw new BaseException("patientId" + tBasic.getPatientId() + "的入院时间为空"); throw new BaseException("patientId" + tBasic.getPatientId() + "的入院时间为空");
} }
ZoneId zoneId = ZoneId.systemDefault(); ZoneId zoneId = ZoneId.systemDefault();
Instant adminssDateInstant = admissDate.toInstant(); Instant adminssDateInstant = admissDate.toInstant();
Instant disDateInstant = disDate.toInstant(); Instant disDateInstant = disDate.toInstant();
sdRyReportPatientId="m"+sdRyReportPatientId; sdRyReportPatientId = "m" + sdRyReportPatientId;
// 开始时间去入院前三天 // 开始时间去入院前三天
LocalDate admissLocalDate = adminssDateInstant.atZone(zoneId).toLocalDate(); LocalDate admissLocalDate = adminssDateInstant.atZone(zoneId).toLocalDate();
LocalDate startTimeLocalDate = admissLocalDate.plusDays(-3); LocalDate startTimeLocalDate = admissLocalDate.plusDays(-3);
@ -474,13 +542,13 @@ public class ReportJob {
String orgCode = "4560886379"; String orgCode = "4560886379";
Date admissDate = tBasic.getAdmissDate(); Date admissDate = tBasic.getAdmissDate();
Date disDate = tBasic.getDisDate(); Date disDate = tBasic.getDisDate();
if (admissDate == null || disDate==null) { if (admissDate == null || disDate == null) {
throw new BaseException("patientId" + tBasic.getPatientId() + "的入院时间为空"); throw new BaseException("patientId" + tBasic.getPatientId() + "的入院时间为空");
} }
ZoneId zoneId = ZoneId.systemDefault(); ZoneId zoneId = ZoneId.systemDefault();
Instant adminssDateInstant = admissDate.toInstant(); Instant adminssDateInstant = admissDate.toInstant();
Instant disDateInstant = disDate.toInstant(); Instant disDateInstant = disDate.toInstant();
sdRyReportPatientId="m"+sdRyReportPatientId; sdRyReportPatientId = "m" + sdRyReportPatientId;
// 开始时间去入院前三天 // 开始时间去入院前三天
LocalDate admissLocalDate = adminssDateInstant.atZone(zoneId).toLocalDate(); LocalDate admissLocalDate = adminssDateInstant.atZone(zoneId).toLocalDate();
LocalDate startTimeLocalDate = admissLocalDate.plusDays(-3); LocalDate startTimeLocalDate = admissLocalDate.plusDays(-3);

@ -0,0 +1,41 @@
package com.docus.server.report.noviwtask;
import cn.hutool.http.HttpUtil;
import com.docus.core.util.Func;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.infrastructure.web.api.ResultCode;
import com.docus.server.report.config.ApplicationBusinessConfig;
import com.docus.server.report.noviwtask.dto.ReportDownTwoDto;
import com.fasterxml.jackson.core.type.TypeReference;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
*
* @author wyb
*/
@Component
@Slf4j
public class NoViewTaskService {
@Resource
private ApplicationBusinessConfig applicationBusinessConfig;
public ReportDownTwoDto getTaskByCollectorId(String collectorId){
String getTaskUrl = applicationBusinessConfig.getGetTaskUrl();
if(Func.isBlank(getTaskUrl)){
log.warn("获取任务信息地址未配置!");
return null;
}
getTaskUrl = applicationBusinessConfig.getGetTaskUrl() + "?collectid=" + collectorId;
String result = HttpUtil.get(getTaskUrl);
CommonResult<ReportDownTwoDto> reportDownTwoDtoCommonResult = Func.readJson(result, new TypeReference<CommonResult<ReportDownTwoDto>>() {
});
if(reportDownTwoDtoCommonResult==null || reportDownTwoDtoCommonResult.getCode().equals(ResultCode.FAILED.getCode()) || reportDownTwoDtoCommonResult.getData()==null){
log.warn("未查询到任务数据!");
return null;
}
return reportDownTwoDtoCommonResult.getData();
}
}

@ -0,0 +1,27 @@
package com.docus.server.report.noviwtask.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ReportDownTwoDto {
@ApiModelProperty(value = "档案编号")
private String patientId;
@ApiModelProperty(value = "记账号")
private String jzh;
@ApiModelProperty(value = "档案类型")
private String recordType;
@ApiModelProperty(value = "档案时间")
private String createTime;
@ApiModelProperty(value = "患者信息")
private ReportPatientTwoDto patient =new ReportPatientTwoDto();
@ApiModelProperty(value = "住院信息")
private List<ReportHospitalTwoDto> hospitals = new ArrayList<>();
@ApiModelProperty(value = "任务信息")
private List<ReportTaskTwoDto> tasks = new ArrayList<>();
}

@ -0,0 +1,25 @@
package com.docus.server.report.noviwtask.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
*/
@Data
public class ReportHospitalTwoDto {
@ApiModelProperty(value = "患者id")
private String patientId;
@ApiModelProperty(value = "住院次数")
private Integer admissTimes;
@ApiModelProperty(value = "住院日期")
private String admissDate;
@ApiModelProperty(value = "出院日期")
private String disDate;
@ApiModelProperty(value = "出院科室名称")
private String disDeptName;
@ApiModelProperty(value = "卡号")
private String admissId;
}

@ -0,0 +1,18 @@
package com.docus.server.report.noviwtask.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
*/
@Data
public class ReportPatientTwoDto {
@ApiModelProperty(value = "住院号/就诊号")
private String inpatientNo;
@ApiModelProperty(value = "患者姓名")
private String name;
@ApiModelProperty(value = "id号")
private String patientId;
}

@ -0,0 +1,19 @@
package com.docus.server.report.noviwtask.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
*/
@Data
public class ReportTaskTwoDto {
@ApiModelProperty(value = "采集器标识")
private String collectorId;
@ApiModelProperty(value = "任务id")
private Long taskId;
@ApiModelProperty(value = "患者id")
private String patientId;
}

@ -55,15 +55,17 @@ sdry:
report-query-url: report-query-url:
# lis检验报告地址 和文件分段 # lis检验报告地址 和文件分段
lis: lis:
url: http://127.0.0.1:9311/report/makeup/lisTest
assortId: lis assortId: lis
collectorId: 4
url: http://127.0.0.1:9311/report/makeup/lisTest
action: lisac action: lisac
accessKey: lisaskey accessKey: lisaskey
interval: 1000 interval: 1000
# 检查报告地址 # 检查报告地址
inspect: inspect:
url: http://127.0.0.1:9311/report/makeup/inspectTest
assortId: inspect assortId: inspect
collectorId: 3
url: http://127.0.0.1:9311/report/makeup/inspectTest
action: inspectac action: inspectac
accessKey: inspectaskey accessKey: inspectaskey
interval: 1000 interval: 1000
@ -78,6 +80,8 @@ docus:
defpwd: fd29cd53ec12616e5f36b77d4afffbff defpwd: fd29cd53ec12616e5f36b77d4afffbff
report: report:
downurl: http://localhost:9291/api/downplatform/report downurl: http://localhost:9291/api/downplatform/report
task:
getTaskUrl: http://localhost:9296/api/noviewtask/GetTask
mybatis-plus: mybatis-plus:
configuration: configuration:
map-underscore-to-camel-case: true map-underscore-to-camel-case: true

Loading…
Cancel
Save