From d5d95978e85b94275d22be222f4764c08cbf618d Mon Sep 17 00:00:00 2001 From: linjj <850658129@qq.com> Date: Mon, 14 Apr 2025 12:48:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=82=E5=B8=B8=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=9C=BA=E5=88=B6=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E4=BF=9D=E5=AD=98=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceImpl/SubordinateServiceImpl.java | 67 ++++++++-------- src/main/resources/logback-spring.xml | 77 ++++++++----------- 2 files changed, 71 insertions(+), 73 deletions(-) diff --git a/src/main/java/com/example/service/serviceImpl/SubordinateServiceImpl.java b/src/main/java/com/example/service/serviceImpl/SubordinateServiceImpl.java index 8b9204e..6bf655a 100644 --- a/src/main/java/com/example/service/serviceImpl/SubordinateServiceImpl.java +++ b/src/main/java/com/example/service/serviceImpl/SubordinateServiceImpl.java @@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; import java.io.File; import java.io.FileOutputStream; @@ -55,40 +56,51 @@ public class SubordinateServiceImpl implements SubordinateService { return CommonResult.success("当前没有需要补偿的数据"); } for (MessageSubordinateVo messageSubordinate : list) { + //判断消息中是否包含甲亢核医学PET-CT门诊不包含直接跳过不需要采集 + if (!messageSubordinate.getContentJson().contains("甲亢核医学PET-CT门诊")) { + log.info("消息id为:" + messageSubordinate.getId() + "不包含甲亢核医学PET-CT门诊"); + //不是甲亢核医学PET-CT门诊的报告将状态改为5 + messageSubordinateDao.updateStatus(4, messageSubordinate.getId()); + continue; + } //解析json返回患者基础信息 MessageDto messageDto = parseMessage(messageSubordinate); if (messageDto == null) { - //不存在数据时,将该记录状态改为4 - messageSubordinateDao.updateStatus(4, messageSubordinate.getMessageId()); + //解释json信息失败将状态改为4 + messageSubordinateDao.updateStatus(4, messageSubordinate.getId()); continue; } //采集失败将状态该为2,成功将状态改为1 - if (!compensate(messageDto)){ - log.info("采集失败:"+messageSubordinate.getMessageId()); - messageSubordinateDao.updateStatus(2, messageSubordinate.getMessageId()); - }else { - log.info("采集成功:"+messageSubordinate.getMessageId()); - messageSubordinateDao.updateStatus(1, messageSubordinate.getMessageId()); + if (!compensate(messageDto)) { + log.info("采集失败:" + messageSubordinate.getId()); + messageSubordinateDao.updateStatus(2, messageSubordinate.getId()); + } else { + log.info("采集成功:" + messageSubordinate.getId()); + messageSubordinateDao.updateStatus(1, messageSubordinate.getId()); } } return CommonResult.success("采集完成"); } private Boolean compensate(MessageDto messageDto) { - //获取下载地址 - String reportAddress = messageDto.getReportAddress(); - //查询该患者主键id - List ids = archiveMasterDao.getMasterIdByInpNoAndVisitId(messageDto.getInpNo(), messageDto.getVisitId()); - if (CollectionUtils.isEmpty(ids)) { - return false; - } - //根据患者id查询文件表该文件的保存路径 - List pdfPaths = archiveDetailDao.getPdfPath(ids.get(0), messageDto.getApplyId()); - //删除原地址文件 - if (!delPdf(pdfPaths)) { - return false; - } - if (!DownloadFile(reportAddress, pdfPaths.get(0))) { + try { + //获取下载地址 + String reportAddress = messageDto.getReportAddress(); + //查询该患者主键id + List ids = archiveMasterDao.getMasterIdByInpNoAndVisitId(messageDto.getInpNo(), messageDto.getVisitId()); + if (CollectionUtils.isEmpty(ids)) { + return false; + } + //根据患者id查询文件表该文件的保存路径 + List pdfPaths = archiveDetailDao.getPdfPath(ids.get(0), messageDto.getApplyId()); + //删除原地址文件 + if (!delPdf(pdfPaths)) { + log.info("删除源文件失败:" + pdfPaths.get(0)); + } + if (!DownloadFile(reportAddress, pdfPaths.get(0))) { + return false; + } + } catch (Exception e) { return false; } return true; @@ -102,9 +114,9 @@ public class SubordinateServiceImpl implements SubordinateService { * @Return java.lang.Boolean */ private Boolean delPdf(List pdfPaths) { - //删除原地址文件 - File file = new File(pdfPaths.get(0)); try { + //删除原地址文件 + File file = new File(pdfPaths.get(0)); file.delete(); // 删除照片 } catch (Exception e) { log.error("删除图像失败地址:" + pdfPaths.get(0) + e.getMessage(), e); @@ -123,11 +135,6 @@ public class SubordinateServiceImpl implements SubordinateService { private MessageDto parseMessage(MessageSubordinateVo messageSubordinate) { MessageDto messageDto = null; String id = messageSubordinate.getId(); - //判断消息中是否包含甲亢核医学PET-CT门诊不包含直接跳过不需要采集 - if (!messageSubordinate.getContentJson().contains("甲亢核医学PET-CT门诊")) { - log.info("消息id为:" + id + "不包含甲亢核医学PET-CT门诊"); - return messageDto; - } // 解析内容 MessageLog messageLog = JSON.parseObject(messageSubordinate.getContentJson(), MessageLog.class); if (messageLog == null) { @@ -137,7 +144,7 @@ public class SubordinateServiceImpl implements SubordinateService { //获取患者基本信息 String outJson = messageLog.getOutJson(); if (outJson == null) { - log.info("消息id为:" + id + "outJson"); + log.info("消息id为:" + id + "outJson为空"); return messageDto; } messageDto = JSON.parseObject(outJson, MessageDto.class); diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index a3af570..23dca8b 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -1,51 +1,42 @@ - - - - - - + + + logback + + + - [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%contextName] [%thread] [%X{traceId}] %-5level %logger{36} - %msg%n - - UTF-8 + %d{HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n - - - - - D:\tool_zj\tool.log - - + + + + true - - - log/demo.%d.%i.log - - 15 - - - 10MB - + + D:/jsWorking/tool_zj/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log + - - - - [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%X{traceId}] [%L] [%-5p] %m%n - - utf-8 - - UTF-8 - + + + %d{yyyy-MM-dd HH:mm:ss} -%msg%n + + - + + + + + + + + - + + - - - - - - - \ No newline at end of file + + +