|
|
|
@ -17,6 +17,8 @@ import com.docus.server.report.entity.AfJobTime;
|
|
|
|
|
import com.docus.server.report.entity.AfReportRecord;
|
|
|
|
|
import com.docus.server.report.mapper.AfJobTimeMapper;
|
|
|
|
|
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.util.IdUtil;
|
|
|
|
|
import com.docus.server.report.util.XmlUtil;
|
|
|
|
@ -31,10 +33,7 @@ import java.time.Instant;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.ZoneId;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
import java.util.concurrent.locks.Lock;
|
|
|
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
|
|
@ -60,11 +59,62 @@ public class ReportJob {
|
|
|
|
|
private IdService idService;
|
|
|
|
|
@Resource
|
|
|
|
|
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")
|
|
|
|
|
@Deprecated
|
|
|
|
|
public void sdRyLisReportQueryJob() {
|
|
|
|
|
// 顺德人医 Lis 检验报告查询
|
|
|
|
|
final String jobType = "SdRyLisReport";
|
|
|
|
@ -102,24 +152,11 @@ public class ReportJob {
|
|
|
|
|
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")
|
|
|
|
|
@Deprecated
|
|
|
|
|
public void sdRyInspectReportQueryJob() {
|
|
|
|
|
// 顺德人医 检查报告查询
|
|
|
|
|
final String jobType = "SdRyInspectReport";
|
|
|
|
@ -156,6 +193,37 @@ public class ReportJob {
|
|
|
|
|
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) {
|
|
|
|
|
for (TBasic tBasic : basicList) {
|
|
|
|
|
List<ReportDto> reportDtoList = getInspectReportList(tBasic);
|
|
|
|
@ -238,13 +306,13 @@ public class ReportJob {
|
|
|
|
|
String orgCode = "4560886379";
|
|
|
|
|
Date admissDate = tBasic.getAdmissDate();
|
|
|
|
|
Date disDate = tBasic.getDisDate();
|
|
|
|
|
if (admissDate == null || disDate==null) {
|
|
|
|
|
if (admissDate == null || disDate == null) {
|
|
|
|
|
throw new BaseException("patientId:" + tBasic.getPatientId() + "的入院时间为空");
|
|
|
|
|
}
|
|
|
|
|
ZoneId zoneId = ZoneId.systemDefault();
|
|
|
|
|
Instant adminssDateInstant = admissDate.toInstant();
|
|
|
|
|
Instant disDateInstant = disDate.toInstant();
|
|
|
|
|
sdRyReportPatientId="m"+sdRyReportPatientId;
|
|
|
|
|
sdRyReportPatientId = "m" + sdRyReportPatientId;
|
|
|
|
|
// 开始时间去入院前三天
|
|
|
|
|
LocalDate admissLocalDate = adminssDateInstant.atZone(zoneId).toLocalDate();
|
|
|
|
|
LocalDate startTimeLocalDate = admissLocalDate.plusDays(-3);
|
|
|
|
@ -474,13 +542,13 @@ public class ReportJob {
|
|
|
|
|
String orgCode = "4560886379";
|
|
|
|
|
Date admissDate = tBasic.getAdmissDate();
|
|
|
|
|
Date disDate = tBasic.getDisDate();
|
|
|
|
|
if (admissDate == null || disDate==null) {
|
|
|
|
|
if (admissDate == null || disDate == null) {
|
|
|
|
|
throw new BaseException("patientId:" + tBasic.getPatientId() + "的入院时间为空");
|
|
|
|
|
}
|
|
|
|
|
ZoneId zoneId = ZoneId.systemDefault();
|
|
|
|
|
Instant adminssDateInstant = admissDate.toInstant();
|
|
|
|
|
Instant disDateInstant = disDate.toInstant();
|
|
|
|
|
sdRyReportPatientId="m"+sdRyReportPatientId;
|
|
|
|
|
sdRyReportPatientId = "m" + sdRyReportPatientId;
|
|
|
|
|
// 开始时间去入院前三天
|
|
|
|
|
LocalDate admissLocalDate = adminssDateInstant.atZone(zoneId).toLocalDate();
|
|
|
|
|
LocalDate startTimeLocalDate = admissLocalDate.plusDays(-3);
|
|
|
|
|