feat:顺德人医移动护理采集报错日志打印

广东省中医_gdszy
wyb 1 year ago
parent 3a6801300b
commit 90f76c7d3f

@ -46,9 +46,10 @@ public class TaskDistributeServiceImpl implements TaskDistributeService {
}
public static void main(String[] args) {
String path="111.jpg";
String fh=".jpg";
System.out.println(path.endsWith(fh));
String result="{\"createTime\":\"2024-01-30 08:41:32\",\"hospitals\":[{\"admissTimes\":3,\"disDate\":\"2024-02-01 00:00:00\",\"disDeptName\":\"\",\"patientId\":\"2024013008413200003\",\"wardCode\":\"B060201\",\"wardName\":\"6号楼2楼病区\"}],\"jzh\":\"311618\",\"outPatientNoList\":[\"000997515200\",\"000870572900\",\"000870360700\",\"001041083100\"],\"patient\":{\"inpatientNo\":\"10073479\",\"name\":\"张玖昌\",\"patientId\":\"2024013008413200003\"},\"patientId\":\"2024013008413200003\",\"recordType\":\"1\",\"tasks\":[{\"collectorId\":\"22\",\"patientId\":\"2024013008413200003\",\"taskId\":913954351203971072}]}";
ReportDownTwoDto reportDownTwoDtoCommonResult = Func.readJson(result, new TypeReference<ReportDownTwoDto>() {
});
System.out.println(reportDownTwoDtoCommonResult);
}
@Override
public CommonResult<String> cancel(Long taskId) {

@ -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);
}
}
/**
*

Loading…
Cancel
Save