|
|
|
@ -210,89 +210,94 @@ public class ReportJob {
|
|
|
|
|
*/
|
|
|
|
|
@XxlJob("SdRyNurseInsertSugarCollectJob")
|
|
|
|
|
public void sdRyNurseInsertSugarCollectJob() {
|
|
|
|
|
String reportQueryNurseInsertSugarCollectorId = sdRyReportQueryConfig.getReportQueryNurseInsertSugarCollectorId();
|
|
|
|
|
ReportDownTwoDto reportDownTwoDto = taskDistributeService.getNoViewTaskByCollectorId(reportQueryNurseInsertSugarCollectorId);
|
|
|
|
|
if (reportDownTwoDto == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (isCancelTask(reportDownTwoDto, reportQueryNurseInsertSugarCollectorId)) {
|
|
|
|
|
log.warn("作废任务,{}", reportDownTwoDto);
|
|
|
|
|
taskDistributeService.cancel(reportDownTwoDto.getTasks().get(0).getTaskId());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
boolean babyTask = isBabyTask(reportDownTwoDto);
|
|
|
|
|
String patientId = reportDownTwoDto.getPatient().getPatientId();
|
|
|
|
|
String inpatientNo = reportDownTwoDto.getPatient().getInpatientNo();
|
|
|
|
|
Integer admissTimes = reportDownTwoDto.getHospitals().get(0).getAdmissTimes();
|
|
|
|
|
final String traceCode = "nurse_print_doc";
|
|
|
|
|
SdNurseInsertSugarRequest sdNurseInsertSugarRequest = new SdNurseInsertSugarRequest(inpatientNo, admissTimes.toString(), traceCode);
|
|
|
|
|
SdNurseInsertSugarResponse sdNurseInsertSugarResponse = shunDePeopleService.getNurseInsertSugarReport(sdNurseInsertSugarRequest);
|
|
|
|
|
List<SdNurseInsertSugarResponse.NisData> nurseInsertSugarReportList = sdNurseInsertSugarResponse.getData();
|
|
|
|
|
|
|
|
|
|
if (Func.isNotEmpty(nurseInsertSugarReportList)) {
|
|
|
|
|
Integer filesNumber = nurseInsertSugarReportList.get(0).getFILES_NUMBER();
|
|
|
|
|
Integer nurseFileCount = tBasicMapper.getNurseFileCount(patientId);
|
|
|
|
|
if (filesNumber == null) {
|
|
|
|
|
log.warn("{} ,{},接口未返回文件数量!", inpatientNo, admissTimes);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (nurseFileCount == null) {
|
|
|
|
|
log.warn("{} , {},未获取到护理提交的文件数量!", inpatientNo, admissTimes);
|
|
|
|
|
shunDePeopleBusinessService.nurseFileCountError(inpatientNo, admissTimes, "未获取到护理提交的文件数量!");
|
|
|
|
|
try {
|
|
|
|
|
String reportQueryNurseInsertSugarCollectorId = sdRyReportQueryConfig.getReportQueryNurseInsertSugarCollectorId();
|
|
|
|
|
ReportDownTwoDto reportDownTwoDto = taskDistributeService.getNoViewTaskByCollectorId(reportQueryNurseInsertSugarCollectorId);
|
|
|
|
|
if (reportDownTwoDto == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!filesNumber.equals(nurseFileCount)) {
|
|
|
|
|
log.warn("{} , {},护理提交的文件数量与接口返回的文件数量不匹配!", inpatientNo, admissTimes);
|
|
|
|
|
shunDePeopleBusinessService.nurseFileCountError(inpatientNo, admissTimes, "护理提交的文件数量与接口返回的文件数量不匹配");
|
|
|
|
|
if (isCancelTask(reportDownTwoDto, reportQueryNurseInsertSugarCollectorId)) {
|
|
|
|
|
log.warn("作废任务,{}", reportDownTwoDto);
|
|
|
|
|
taskDistributeService.cancel(reportDownTwoDto.getTasks().get(0).getTaskId());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 从配置获取需要过滤的文件名称
|
|
|
|
|
SdRyCollectNurseInsertSugarConfig config = SdRyCollectNurseInsertSugarConfig.getConfig();
|
|
|
|
|
List<String> fileRemoveByFormName = config.getFileRemoveByFormName();
|
|
|
|
|
List<SdNurseInsertSugarResponse.NisData> removeFiles = nurseInsertSugarReportList.stream()
|
|
|
|
|
.filter(item -> isCharacterContains(item.getForm_name(), fileRemoveByFormName))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
log.info("住院号:{},住院次数{},护理采集过滤文件: {} 共 {} 条", inpatientNo, admissTimes, fileRemoveByFormName, removeFiles.size());
|
|
|
|
|
tBasicMapper.saveNisRemoveFilesCount(patientId, removeFiles.size());
|
|
|
|
|
|
|
|
|
|
ReportDto reportDto;
|
|
|
|
|
int collectFileCount = 0;
|
|
|
|
|
for (SdNurseInsertSugarResponse.NisData nisReport : nurseInsertSugarReportList) {
|
|
|
|
|
// 从过滤配置中匹配,如果匹配则跳过本次循环
|
|
|
|
|
if (isCharacterContains(nisReport.getForm_name(), fileRemoveByFormName)) {
|
|
|
|
|
continue;
|
|
|
|
|
boolean babyTask = isBabyTask(reportDownTwoDto);
|
|
|
|
|
String patientId = reportDownTwoDto.getPatient().getPatientId();
|
|
|
|
|
String inpatientNo = reportDownTwoDto.getPatient().getInpatientNo();
|
|
|
|
|
Integer admissTimes = reportDownTwoDto.getHospitals().get(0).getAdmissTimes();
|
|
|
|
|
final String traceCode = "nurse_print_doc";
|
|
|
|
|
SdNurseInsertSugarRequest sdNurseInsertSugarRequest = new SdNurseInsertSugarRequest(inpatientNo, admissTimes.toString(), traceCode);
|
|
|
|
|
SdNurseInsertSugarResponse sdNurseInsertSugarResponse = shunDePeopleService.getNurseInsertSugarReport(sdNurseInsertSugarRequest);
|
|
|
|
|
List<SdNurseInsertSugarResponse.NisData> nurseInsertSugarReportList = sdNurseInsertSugarResponse.getData();
|
|
|
|
|
|
|
|
|
|
if (Func.isNotEmpty(nurseInsertSugarReportList)) {
|
|
|
|
|
Integer filesNumber = nurseInsertSugarReportList.get(0).getFILES_NUMBER();
|
|
|
|
|
Integer nurseFileCount = tBasicMapper.getNurseFileCount(patientId);
|
|
|
|
|
if (filesNumber == null) {
|
|
|
|
|
log.warn("{} ,{},接口未返回文件数量!", inpatientNo, admissTimes);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
reportDto = new ReportDto();
|
|
|
|
|
reportDto.setSysFlag(reportQueryNurseInsertSugarCollectorId);
|
|
|
|
|
reportDto.setTaskId(reportDownTwoDto.getTasks().get(0).getTaskId());
|
|
|
|
|
reportDto.setDownUrl(nisReport.getUrl());
|
|
|
|
|
reportDto.setFileTitle(nisReport.getForm_name());
|
|
|
|
|
reportDto.setSerialnum(nisReport.getForm_id());
|
|
|
|
|
reportDto.setAssortId(ZdAssortConfig.getZdAssortId(nisReport.getForm_name(), sdRyReportQueryConfig.getReportQueryNurseInsertSugarDefaultAssortType()));
|
|
|
|
|
reportDto.setAdmisstimes(admissTimes);
|
|
|
|
|
reportDto.setInpatientNo(inpatientNo);
|
|
|
|
|
reportDto.setPatientId(patientId);
|
|
|
|
|
reportDto.setDowntype(1);
|
|
|
|
|
reportDto.setFileSource("1");
|
|
|
|
|
reportDto.setFilestoragetype("1");
|
|
|
|
|
if (nurseFileCount == null) {
|
|
|
|
|
log.warn("{} , {},未获取到护理提交的文件数量!", inpatientNo, admissTimes);
|
|
|
|
|
shunDePeopleBusinessService.nurseFileCountError(inpatientNo, admissTimes, "未获取到护理提交的文件数量!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!filesNumber.equals(nurseFileCount)) {
|
|
|
|
|
log.warn("{} , {},护理提交的文件数量与接口返回的文件数量不匹配!", inpatientNo, admissTimes);
|
|
|
|
|
shunDePeopleBusinessService.nurseFileCountError(inpatientNo, admissTimes, "护理提交的文件数量与接口返回的文件数量不匹配");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 从配置获取需要过滤的文件名称
|
|
|
|
|
SdRyCollectNurseInsertSugarConfig config = SdRyCollectNurseInsertSugarConfig.getConfig();
|
|
|
|
|
List<String> fileRemoveByFormName = config.getFileRemoveByFormName();
|
|
|
|
|
List<SdNurseInsertSugarResponse.NisData> removeFiles = nurseInsertSugarReportList.stream()
|
|
|
|
|
.filter(item -> isCharacterContains(item.getForm_name(), fileRemoveByFormName))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
log.info("住院号:{},住院次数{},护理采集过滤文件: {} 共 {} 条", inpatientNo, admissTimes, fileRemoveByFormName, removeFiles.size());
|
|
|
|
|
tBasicMapper.saveNisRemoveFilesCount(patientId, removeFiles.size());
|
|
|
|
|
|
|
|
|
|
ReportDto reportDto;
|
|
|
|
|
int collectFileCount = 0;
|
|
|
|
|
for (SdNurseInsertSugarResponse.NisData nisReport : nurseInsertSugarReportList) {
|
|
|
|
|
// 从过滤配置中匹配,如果匹配则跳过本次循环
|
|
|
|
|
if (isCharacterContains(nisReport.getForm_name(), fileRemoveByFormName)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
reportDto = new ReportDto();
|
|
|
|
|
reportDto.setSysFlag(reportQueryNurseInsertSugarCollectorId);
|
|
|
|
|
reportDto.setTaskId(reportDownTwoDto.getTasks().get(0).getTaskId());
|
|
|
|
|
reportDto.setDownUrl(nisReport.getUrl());
|
|
|
|
|
reportDto.setFileTitle(nisReport.getForm_name());
|
|
|
|
|
reportDto.setSerialnum(nisReport.getForm_id());
|
|
|
|
|
reportDto.setAssortId(ZdAssortConfig.getZdAssortId(nisReport.getForm_name(), sdRyReportQueryConfig.getReportQueryNurseInsertSugarDefaultAssortType()));
|
|
|
|
|
reportDto.setAdmisstimes(admissTimes);
|
|
|
|
|
reportDto.setInpatientNo(inpatientNo);
|
|
|
|
|
reportDto.setPatientId(patientId);
|
|
|
|
|
reportDto.setDowntype(1);
|
|
|
|
|
reportDto.setFileSource("1");
|
|
|
|
|
reportDto.setFilestoragetype("1");
|
|
|
|
|
if (babyTask) {
|
|
|
|
|
// 婴儿任务,文件传到母亲病案,来源加后缀
|
|
|
|
|
PatientInfoDTO parent = reportDownTwoDto.getParent();
|
|
|
|
|
reportDto.setAdmisstimes(parent.getAdmissTimes());
|
|
|
|
|
reportDto.setInpatientNo(parent.getInpatientNo());
|
|
|
|
|
reportDto.setPatientId(parent.getPatientId());
|
|
|
|
|
reportDto.setSysFlag(reportQueryNurseInsertSugarCollectorId + SdRyReportQueryConfig.BABY_COLLECTOR_ID_SUFFIX);
|
|
|
|
|
}
|
|
|
|
|
reportService.report(reportDto);
|
|
|
|
|
collectFileCount++;
|
|
|
|
|
}
|
|
|
|
|
log.info("住院号:{},住院次数{},护理采集文件: {} 条", inpatientNo, admissTimes, collectFileCount);
|
|
|
|
|
if (babyTask) {
|
|
|
|
|
// 婴儿任务,文件传到母亲病案,来源加后缀
|
|
|
|
|
PatientInfoDTO parent = reportDownTwoDto.getParent();
|
|
|
|
|
reportDto.setAdmisstimes(parent.getAdmissTimes());
|
|
|
|
|
reportDto.setInpatientNo(parent.getInpatientNo());
|
|
|
|
|
reportDto.setPatientId(parent.getPatientId());
|
|
|
|
|
reportDto.setSysFlag(reportQueryNurseInsertSugarCollectorId + SdRyReportQueryConfig.BABY_COLLECTOR_ID_SUFFIX);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
reportService.report(reportDto);
|
|
|
|
|
collectFileCount++;
|
|
|
|
|
}
|
|
|
|
|
log.info("住院号:{},住院次数{},护理采集文件: {} 条", inpatientNo, admissTimes, collectFileCount);
|
|
|
|
|
if (babyTask) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sendNisDelayVerifyMessage(patientId);
|
|
|
|
|
sendNisDelayVerifyMessage(patientId);
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
log.error("移动护理采集出错了!"+ex.getMessage(),ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 保存延迟验证护理消息
|
|
|
|
|