diff --git a/src/main/java/com/docus/server/mzzyy/job/MzZyyReportCollectJob.java b/src/main/java/com/docus/server/mzzyy/job/MzZyyReportCollectJob.java index 935cfd0..eef2e59 100644 --- a/src/main/java/com/docus/server/mzzyy/job/MzZyyReportCollectJob.java +++ b/src/main/java/com/docus/server/mzzyy/job/MzZyyReportCollectJob.java @@ -257,58 +257,63 @@ public class MzZyyReportCollectJob { @XxlJob("MzZyyXinDianCollectJob") public void xinDianCollectJob() { log.info(">>>>>>>>>>>>>>>>>>>>>> 梅州中医院心电视图采集任务开始!"); - // 1.获取任务和患者信息 2.查询视图信息 3.上报下载 - String jobParam = XxlJobHelper.getJobParam(); - JSONObject jobParamJsonObject = JSONObject.parseObject(jobParam); - String assortId = jobParamJsonObject.getString("assortId"); - String collectorId = jobParamJsonObject.getString("collectorId"); - String extraCondition = jobParamJsonObject.getString("extraCondition"); - if (Func.isBlank(assortId) || Func.isBlank(collectorId)) { - log.warn(">>>>>>>>>>>>>>>>>>>>>> 梅州中医院心电视图采集任务,未配置心电采集器和采集文件分段"); - return; - } - CommonResult commonResult = taskDistributeService.getNoViewTaskByCollectorId(collectorId); - if (ResultCode.SUCCESS.getCode().equals(commonResult.getCode()) - && commonResult.getData() != null) { - ReportDownTwoDto downTwoDto = commonResult.getData(); - ReportTaskTwoDto task = downTwoDto.getTasks().get(0); - log.info("获取了任务:{}", Func.toJson(task)); - - String patientId = downTwoDto.getPatientId(); - String jzh = downTwoDto.getJzh(); - - List xinDianViews = xinDianViewMapper.getPatientXinDianView(jzh, extraCondition); - int size = xinDianViews.size(); - log.info("记账号:{} 采集心电数据:{} 条!", jzh, size); - if (size <= 0) { - determineAndCancelTask(patientId, collectorId); + try { + // 1.获取任务和患者信息 2.查询视图信息 3.上报下载 + String jobParam = XxlJobHelper.getJobParam(); + JSONObject jobParamJsonObject = JSONObject.parseObject(jobParam); + String assortId = jobParamJsonObject.getString("assortId"); + String collectorId = jobParamJsonObject.getString("collectorId"); + String extraCondition = jobParamJsonObject.getString("extraCondition"); + if (Func.isBlank(assortId) || Func.isBlank(collectorId)) { + log.warn(">>>>>>>>>>>>>>>>>>>>>> 梅州中医院心电视图采集任务,未配置心电采集器和采集文件分段"); return; } - tBasicMapper.invalidFileBySource(patientId, collectorId); + CommonResult commonResult = taskDistributeService.getNoViewTaskByCollectorId(collectorId); + if (ResultCode.SUCCESS.getCode().equals(commonResult.getCode()) + && commonResult.getData() != null) { + ReportDownTwoDto downTwoDto = commonResult.getData(); + ReportTaskTwoDto task = downTwoDto.getTasks().get(0); + log.info("梅州中医院心电视图采集,获取了任务:{}", Func.toJson(task)); + + String patientId = downTwoDto.getPatientId(); + String jzh = downTwoDto.getJzh(); + + List xinDianViews = xinDianViewMapper.getPatientXinDianView(jzh, extraCondition); + int size = xinDianViews.size(); + log.info("梅州中医院心电视图采集,记账号:{} 采集心电数据:{} 条!", jzh, size); + if (size <= 0) { + determineAndCancelTask(patientId, collectorId); + return; + } + tBasicMapper.invalidFileBySource(patientId, collectorId); - ReportDownPatientDto patient = new ReportDownPatientDto(); - patient.setPatientid(patientId); + ReportDownPatientDto patient = new ReportDownPatientDto(); + patient.setPatientid(patientId); - ReportDownDto reportDownDto = new ReportDownDto(); - reportDownDto.setAssortid(assortId); - reportDownDto.setCollectorid(collectorId); - reportDownDto.setIp(""); - reportDownDto.setPatient(patient); - - for (MzZyyXinDianView result : xinDianViews) { - ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); - reportDownScanFileDto.setDownurl(result.getBgdz()); - reportDownScanFileDto.setFiletitle(result.getBgmc()); - reportDownScanFileDto.setSerialnum(result.getBgid()); - reportDownScanFileDto.setFilesource(1); - reportDownScanFileDto.setFiletype(1); - reportDownScanFileDto.setFilestoragetype(1); - reportDownScanFileDto.setTaskid(task.getTaskId()); - List scanFiles = Collections.singletonList(reportDownScanFileDto); - reportDownDto.setScanfiles(scanFiles); - downPlatformService.report(reportDownDto); + ReportDownDto reportDownDto = new ReportDownDto(); + reportDownDto.setAssortid(assortId); + reportDownDto.setCollectorid(collectorId); + reportDownDto.setIp(""); + reportDownDto.setPatient(patient); + + for (MzZyyXinDianView result : xinDianViews) { + ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); + reportDownScanFileDto.setDownurl(result.getBgdz()); + reportDownScanFileDto.setFiletitle(result.getBgmc()); + reportDownScanFileDto.setSerialnum(result.getBgid()); + reportDownScanFileDto.setFilesource(1); + reportDownScanFileDto.setFiletype(1); + reportDownScanFileDto.setFilestoragetype(1); + reportDownScanFileDto.setTaskid(task.getTaskId()); + List scanFiles = Collections.singletonList(reportDownScanFileDto); + reportDownDto.setScanfiles(scanFiles); + downPlatformService.report(reportDownDto); + } } + } catch (Exception ex) { + log.error(">>>>>>>>>>>>>>>>>>>>>> 梅州中医院心电视图采集任务出错了!" + ex.getMessage(), ex); } + log.info(">>>>>>>>>>>>>>>>>>>>>> 梅州中医院心电视图采集任务结束!"); } diff --git a/src/main/resources/mapper/MzZyyXinDianViewMapper.xml b/src/main/resources/mapper/MzZyyXinDianViewMapper.xml index 34f4f31..ee3936c 100644 --- a/src/main/resources/mapper/MzZyyXinDianViewMapper.xml +++ b/src/main/resources/mapper/MzZyyXinDianViewMapper.xml @@ -2,16 +2,16 @@ - + - SELECT JZH as jzh, BGID as bgid, BGMC as bgmc, BGDZ as bgdz FROM dbo.V_JSWZH_XD - WHERE 1=1 + WHERE 1=1 AND JZH = #{jzh} ${ext}