From b335b041a37719d2fe9caa4027d6749aa991d521 Mon Sep 17 00:00:00 2001 From: lzy Date: Wed, 16 Feb 2022 14:13:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=92=A4=E5=9B=9E=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dataConfig/homeQualitySet.json | 41 +- .../com/docus/bgts/config/MyScheduling.java | 430 +++++++++--------- .../docus/bgts/handler/TBasicWebService.java | 12 +- .../service/AfCollectTaskServiceImpl.java | 1 + src/main/resources/application.yml | 6 +- 5 files changed, 240 insertions(+), 250 deletions(-) diff --git a/dataConfig/homeQualitySet.json b/dataConfig/homeQualitySet.json index 030edd7..89f0196 100644 --- a/dataConfig/homeQualitySet.json +++ b/dataConfig/homeQualitySet.json @@ -14,19 +14,17 @@ //唯一键目录结构数组,最高层为前面,最后一层为数据采集层,根节点不填 "directory":["Msg"], //患者主索引号 - "indexFlag":"INHOSP_NO", + "indexFlag":"PatInfo,INHOSP_NO", //采集流水号 - "serialnum":"IDNO", + "serialnum":"ReportInfo,UPDATE_REPORT_NO", //文件标题 - "filetitle":"FILENAME", + "filetitle":"ExamInfo,EXAM_SUBCLASS", //下载地址,&代表多个选其一 - "downurl":"PDF_PATH", + "downurl":"ReportInfo,REPORT_URL", //分类id - "assortid":"Wiw213woq412awqe41", + "assortid":"63E20FC9AAB74C5FB6446083EBA5607D", //系统id - "collectorid":"22", - //获取分类id参数 - "assortidParamKey":"DOCUMENT_TOPIC", + "collectorid":"12", //采集类型(文件来源 1:采集器;2:扫描生产软件) "filesource":1, //下载类型(1:服务器本地;2:ftp服务器;3:共享文件夹) @@ -34,36 +32,25 @@ //上传接口 "uploadConnector":"http://192.9.100.171:9291/api/downplatform/report", //基本数据存放处,根节点不填,最后一层为基本信息存放标签与doubleBasic配合 - "basicDirectory":[""], + "basicDirectory":["Msg","ReportInfo"], //可能存在存储基本数据不同情况的标签 - "doubleBasic":["ITEM"], + "doubleBasic":["TestItemInfo","BioTestInfo"], //--------------采集操作判断撤销/新增--------------- //是否开启采集操作判断撤销/新增 0:不开启,1:开启 默认不开启 - "isJudge":"0", + "isJudge":"1", //判断标签存在目录,首个标签不填 - "judgeDirectory":[""], + "judgeDirectory":["Msg","ReportInfo"], //判定标签,值0-新增;1-撤回;2-修改 - "judgeIndex":"", + "judgeIndex":"REPORT_STATUS_FLAG", //--------撤销配置部分------------ //采集流水号所在位置,根目录不填 - "repealDirectory":[""], + "repealDirectory":["Msg","ReportInfo"], //采集流水号名 - "repealSerialnum":"UNIQUE_ID", + "repealSerialnum":"REPORT_STATUS_FLAG", //撤销接口 - "repoalConnector":"http://192.9.100.171:9291/api/down/cancel", - - //---------住院接口配置部分----------- - "zyUrl":"http://192.9.100.32:9022/ktin/api/webservice/ChasWebService?wsdl", -// "zyUrl":"http://localhost:9000/services/api?wsdl", - "zyMethod":"ChasMessageServer", -// "zyMethod":"getPdfId", - "zyNamespance":"http://webservice.http.plugins.api.his.karrytech.com/", -// "zyNamespance":"http://server.webservice.example.com", - "zyDirectory":["PDF_DETAIL_INFO"], - "pdfUrl":"http://192.9.100.32:9022/ktin/api/flow/flow-mra-getpdffile?PDF_ID=", - "zysj":"2022-01-28" + "repoalConnector":"http://192.9.100.171:9291/api/down/cancel" } \ No newline at end of file diff --git a/src/main/java/com/docus/bgts/config/MyScheduling.java b/src/main/java/com/docus/bgts/config/MyScheduling.java index 5714c2e..f8a2bb1 100644 --- a/src/main/java/com/docus/bgts/config/MyScheduling.java +++ b/src/main/java/com/docus/bgts/config/MyScheduling.java @@ -1,223 +1,223 @@ -package com.docus.bgts.config; - - - -import com.docus.bgts.facade.IAfCollectTaskService; -import com.docus.bgts.facade.IMrReportErrorService; -import com.docus.bgts.utils.FileUtils; -import com.docus.bgts.utils.HttpUtils; - -import lombok.extern.slf4j.Slf4j; -import org.apache.axis.client.Call; -import org.apache.axis.encoding.XMLType; -import org.apache.axis.utils.ByteArrayOutputStream; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import javax.xml.namespace.QName; -import javax.xml.rpc.ParameterMode; - -import java.io.PrintStream; -import java.net.URISyntaxException; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.*; - -@Slf4j -@Component -public class MyScheduling { - - public static Date oneDate; - public static String namespance = ""; - private static String methodName = ""; - private static String url; - private static String pdfUrl; - - static { - url = String.valueOf(FileUtils.getJsonByName("zyUrl")); - methodName = String.valueOf(FileUtils.getJsonByName("zyMethod")); - pdfUrl = String.valueOf(FileUtils.getJsonByName("pdfUrl")); - namespance = String.valueOf(FileUtils.getJsonByName("zyNamespance")); - SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); - try { - oneDate = fmt.parse(String.valueOf(FileUtils.getJsonByName("zysj"))); - } catch (ParseException e) { - e.printStackTrace(); - } - } - - @Autowired - private IMrReportErrorService mrReportErrorService; - - @Autowired - private IAfCollectTaskService afCollectTaskService; - - @Value("${beat.url}") - private String beatUrl; - - - private final Logger logger = LoggerFactory.getLogger(getClass()); - - //10分钟执行一次 - @Scheduled(fixedRate = 1000 * 60 * 5) - public void beat() { - logger.info("------------心跳开始---------------"); - Map params = new HashMap<>(); - params.put("code", String.valueOf(FileUtils.getJsonByName("collectorid"))); - try { - HttpUtils.get(beatUrl, params); - } catch (URISyntaxException e) { - e.printStackTrace(); - logger.info("心跳推送出错,可能是住院服务没有开启"); - } finally { - logger.info("-------------心跳结束---------------"); - } - } - - //10分钟执行一次 -// @Scheduled(fixedRate = 1000 * 60 * 60 * 5) -// public void ruyuan() { -// log.info("----------开始采集------------"); -// SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); -// String format = fmt.format(oneDate); -// log.info("-----采集时间:开始时间:"+ format); -// Date twoDate = new Date(); -// String format1 = fmt.format(twoDate); -// log.info("-----采集时间:结束时间:"+ format1); -// -// //获取jzh列表 -// List jzhs = afCollectTaskService.listJZHByDate(format, format1); -// int size = jzhs.size(); -// log.info("-------本次采集数:" + size); -// if(size==0){ -// oneDate=twoDate; -// log.info("------------采集结束-----------------"); -// return; +//package com.docus.bgts.config; +// +// +// +//import com.docus.bgts.facade.IAfCollectTaskService; +//import com.docus.bgts.facade.IMrReportErrorService; +//import com.docus.bgts.utils.FileUtils; +//import com.docus.bgts.utils.HttpUtils; +// +//import lombok.extern.slf4j.Slf4j; +//import org.apache.axis.client.Call; +//import org.apache.axis.encoding.XMLType; +//import org.apache.axis.utils.ByteArrayOutputStream; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.scheduling.annotation.Scheduled; +//import org.springframework.stereotype.Component; +// +//import javax.xml.namespace.QName; +//import javax.xml.rpc.ParameterMode; +// +//import java.io.PrintStream; +//import java.net.URISyntaxException; +//import java.text.ParseException; +//import java.text.SimpleDateFormat; +//import java.util.*; +// +//@Slf4j +//@Component +//public class MyScheduling { +// +// public static Date oneDate; +// public static String namespance = ""; +// private static String methodName = ""; +// private static String url; +// private static String pdfUrl; +// +// static { +// url = String.valueOf(FileUtils.getJsonByName("zyUrl")); +// methodName = String.valueOf(FileUtils.getJsonByName("zyMethod")); +// pdfUrl = String.valueOf(FileUtils.getJsonByName("pdfUrl")); +// namespance = String.valueOf(FileUtils.getJsonByName("zyNamespance")); +// SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); +// try { +// oneDate = fmt.parse(String.valueOf(FileUtils.getJsonByName("zysj"))); +// } catch (ParseException e) { +// e.printStackTrace(); // } -// Object[] params; -// List keys = new ArrayList<>(); -// keys.add("action"); -// keys.add("message"); -// XmlUtils xmlUtils; -// List zyDirectory = (List) FileUtils.getJsonByName("zyDirectory"); -// String assortid = String.valueOf(FileUtils.getJsonByName("assortid")); -// String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); -// String filesource = String.valueOf(FileUtils.getJsonByName("filesource")); -// String filestoragetype = String.valueOf(FileUtils.getJsonByName("filestoragetype")); -// String res; -// Element element; -// Map headMap = new HashMap<>(); -// headMap.put("Content-Type", "application/json"); -// for (String jzh : jzhs) { +// } +// +// @Autowired +// private IMrReportErrorService mrReportErrorService; +// +// @Autowired +// private IAfCollectTaskService afCollectTaskService; +// +// @Value("${beat.url}") +// private String beatUrl; +// +// +// private final Logger logger = LoggerFactory.getLogger(getClass()); +// +// //10分钟执行一次 +// @Scheduled(fixedRate = 1000 * 60 * 5) +// public void beat() { +// logger.info("------------心跳开始---------------"); +// Map params = new HashMap<>(); +// params.put("code", String.valueOf(FileUtils.getJsonByName("collectorid"))); +// try { +// HttpUtils.get(beatUrl, params); +// } catch (URISyntaxException e) { +// e.printStackTrace(); +// logger.info("心跳推送出错,可能是住院服务没有开启"); +// } finally { +// logger.info("-------------心跳结束---------------"); +// } +// } +// +// //10分钟执行一次 +//// @Scheduled(fixedRate = 1000 * 60 * 60 * 5) +//// public void ruyuan() { +//// log.info("----------开始采集------------"); +//// SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +//// String format = fmt.format(oneDate); +//// log.info("-----采集时间:开始时间:"+ format); +//// Date twoDate = new Date(); +//// String format1 = fmt.format(twoDate); +//// log.info("-----采集时间:结束时间:"+ format1); +//// +//// //获取jzh列表 +//// List jzhs = afCollectTaskService.listJZHByDate(format, format1); +//// int size = jzhs.size(); +//// log.info("-------本次采集数:" + size); +//// if(size==0){ +//// oneDate=twoDate; +//// log.info("------------采集结束-----------------"); +//// return; +//// } +//// Object[] params; +//// List keys = new ArrayList<>(); +//// keys.add("action"); +//// keys.add("message"); +//// XmlUtils xmlUtils; +//// List zyDirectory = (List) FileUtils.getJsonByName("zyDirectory"); +//// String assortid = String.valueOf(FileUtils.getJsonByName("assortid")); +//// String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); +//// String filesource = String.valueOf(FileUtils.getJsonByName("filesource")); +//// String filestoragetype = String.valueOf(FileUtils.getJsonByName("filestoragetype")); +//// String res; +//// Element element; +//// Map headMap = new HashMap<>(); +//// headMap.put("Content-Type", "application/json"); +//// for (String jzh : jzhs) { +//// try { +//// params = new Object[]{"flow-mra-queryencounterpdf", "\n" + +//// "\n" + +//// "" + jzh + "\n" + +//// "\n" + +//// ""}; +//// res = requestFunctionWebService(params, url, methodName, namespance, keys); +//// log.info("返回值:" + res); +//// xmlUtils = new XmlUtils(new ByteArrayInputStream(res.getBytes("UTF-8"))); +//// element = xmlUtils.getElement(zyDirectory); +//// List items = element.elements("ITEM"); +//// if (items == null || items.size() <= 0) { +//// throw new RuntimeException("查询到的信息不存在"); +//// } +//// ReportDownDto reportDownDto = new ReportDownDto(); +//// reportDownDto.setCollectorid(collectorid); +//// reportDownDto.setAssortid(assortid); +//// +//// ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto(); +//// reportDownPatientDto.setJzh(jzh); +//// reportDownDto.setPatient(reportDownPatientDto); +//// List scanFileDtos = new ArrayList<>(); +//// ReportDownScanFileDto reportDownScanFileDto; +//// +//// for (Element item : items) { +//// Element pdfId = item.element("PDF_ID"); +//// if (pdfId != null && StringUtils.isNotBlank(pdfId.getText())) { +//// //采集流水号 +//// String pdfIdText = pdfId.getText(); +//// //文件标题 +//// String fileTitle = item.element("MED_REC_CAT_NAME").getText(); +//// //url地址 +//// String pdf = pdfUrl + pdfIdText; +//// +//// reportDownScanFileDto = new ReportDownScanFileDto(); +//// reportDownScanFileDto.setFiletitle(fileTitle); +//// reportDownScanFileDto.setFilesource(Integer.parseInt(filesource)); +//// reportDownScanFileDto.setFilestoragetype(Integer.parseInt(filestoragetype)); +//// reportDownScanFileDto.setSerialnum(pdfIdText); +//// reportDownScanFileDto.setDownurl(pdf); +//// scanFileDtos.add(reportDownScanFileDto); +//// } else { +//// log.info("记账号:", jzh + "不存在pdfId"); +//// size--; +//// throw new RuntimeException("记账号:" + jzh + "不存在pdfId"); +//// } +//// } +//// log.info("文件信息:" + scanFileDtos); +//// reportDownDto.setScanfiles(scanFileDtos); +//// afCollectTaskService.insert(reportDownDto); +//// String post = ""; +//// logger.info("--------执行上传功能----------"); +//// Map paramMap = JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class); +//// logger.info("上传参数:" + paramMap); +//// post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, paramMap); +////// String post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), map, headMap); +//// if (StringUtils.isBlank(post)) { +//// logger.info("--------上传时出现错误,可能是文件服务没有启动----------"); +//// throw new RuntimeException("上传时出现错误,可能是文件服务没有启动"); +//// } +//// Map resMap = JSON.parseObject(post, Map.class); +//// if (String.valueOf(resMap.get("code")).equals("500")) { +//// throw new RuntimeException(String.valueOf(resMap.get("msg"))); +//// } else { +//// logger.info("----------执行成功,当前最后更新日期" + twoDate + "-----------"); +//// } +//// +//// } catch (Exception e) { +//// log.info(e.getMessage()); +//// e.printStackTrace(); +//// size--; +//// mrReportErrorService.insert(jzh); +//// } +//// } +//// log.info("-------本次成功采集数:" + size); +////// oneDate = twoDate; +//// } +// +// private String requestFunctionWebService(Object[] params, +// String url, +// String methodName, +// String namespance, +// List parameterNames) { +// String result = ""; +// if (null != params) { // try { -// params = new Object[]{"flow-mra-queryencounterpdf", "\n" + -// "\n" + -// "" + jzh + "\n" + -// "\n" + -// ""}; -// res = requestFunctionWebService(params, url, methodName, namespance, keys); -// log.info("返回值:" + res); -// xmlUtils = new XmlUtils(new ByteArrayInputStream(res.getBytes("UTF-8"))); -// element = xmlUtils.getElement(zyDirectory); -// List items = element.elements("ITEM"); -// if (items == null || items.size() <= 0) { -// throw new RuntimeException("查询到的信息不存在"); -// } -// ReportDownDto reportDownDto = new ReportDownDto(); -// reportDownDto.setCollectorid(collectorid); -// reportDownDto.setAssortid(assortid); -// -// ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto(); -// reportDownPatientDto.setJzh(jzh); -// reportDownDto.setPatient(reportDownPatientDto); -// List scanFileDtos = new ArrayList<>(); -// ReportDownScanFileDto reportDownScanFileDto; -// -// for (Element item : items) { -// Element pdfId = item.element("PDF_ID"); -// if (pdfId != null && StringUtils.isNotBlank(pdfId.getText())) { -// //采集流水号 -// String pdfIdText = pdfId.getText(); -// //文件标题 -// String fileTitle = item.element("MED_REC_CAT_NAME").getText(); -// //url地址 -// String pdf = pdfUrl + pdfIdText; -// -// reportDownScanFileDto = new ReportDownScanFileDto(); -// reportDownScanFileDto.setFiletitle(fileTitle); -// reportDownScanFileDto.setFilesource(Integer.parseInt(filesource)); -// reportDownScanFileDto.setFilestoragetype(Integer.parseInt(filestoragetype)); -// reportDownScanFileDto.setSerialnum(pdfIdText); -// reportDownScanFileDto.setDownurl(pdf); -// scanFileDtos.add(reportDownScanFileDto); -// } else { -// log.info("记账号:", jzh + "不存在pdfId"); -// size--; -// throw new RuntimeException("记账号:" + jzh + "不存在pdfId"); -// } -// } -// log.info("文件信息:" + scanFileDtos); -// reportDownDto.setScanfiles(scanFileDtos); -// afCollectTaskService.insert(reportDownDto); -// String post = ""; -// logger.info("--------执行上传功能----------"); -// Map paramMap = JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class); -// logger.info("上传参数:" + paramMap); -// post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, paramMap); -//// String post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), map, headMap); -// if (StringUtils.isBlank(post)) { -// logger.info("--------上传时出现错误,可能是文件服务没有启动----------"); -// throw new RuntimeException("上传时出现错误,可能是文件服务没有启动"); +// org.apache.axis.client.Service service = new org.apache.axis.client.Service(); +// Call call = (Call) service.createCall(); +// call.setTargetEndpointAddress(url); +// call.setOperationName(new QName(namespance, methodName)); +// for (int i = 0; i < parameterNames.size(); i++) { +// call.addParameter(parameterNames.get(i), XMLType.XSD_STRING, ParameterMode.IN);//接口的参数 // } -// Map resMap = JSON.parseObject(post, Map.class); -// if (String.valueOf(resMap.get("code")).equals("500")) { -// throw new RuntimeException(String.valueOf(resMap.get("msg"))); -// } else { -// logger.info("----------执行成功,当前最后更新日期" + twoDate + "-----------"); -// } -// +// call.setReturnType(XMLType.XSD_STRING);//设置返回类型 +// result = (String) call.invoke(params); // } catch (Exception e) { -// log.info(e.getMessage()); // e.printStackTrace(); -// size--; -// mrReportErrorService.insert(jzh); +// //方法名 +// ByteArrayOutputStream baos = new ByteArrayOutputStream(); +// e.printStackTrace(new PrintStream(baos)); +// String exception = baos.toString(); +// log.error("requestFunctionWebService请求接口异常:" + exception); // } // } -// log.info("-------本次成功采集数:" + size); -//// oneDate = twoDate; +// return result; // } - - private String requestFunctionWebService(Object[] params, - String url, - String methodName, - String namespance, - List parameterNames) { - String result = ""; - if (null != params) { - try { - org.apache.axis.client.Service service = new org.apache.axis.client.Service(); - Call call = (Call) service.createCall(); - call.setTargetEndpointAddress(url); - call.setOperationName(new QName(namespance, methodName)); - for (int i = 0; i < parameterNames.size(); i++) { - call.addParameter(parameterNames.get(i), XMLType.XSD_STRING, ParameterMode.IN);//接口的参数 - } - call.setReturnType(XMLType.XSD_STRING);//设置返回类型 - result = (String) call.invoke(params); - } catch (Exception e) { - e.printStackTrace(); - //方法名 - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - e.printStackTrace(new PrintStream(baos)); - String exception = baos.toString(); - log.error("requestFunctionWebService请求接口异常:" + exception); - } - } - return result; - } - -} +// +//} diff --git a/src/main/java/com/docus/bgts/handler/TBasicWebService.java b/src/main/java/com/docus/bgts/handler/TBasicWebService.java index c230a60..9c0cb58 100644 --- a/src/main/java/com/docus/bgts/handler/TBasicWebService.java +++ b/src/main/java/com/docus/bgts/handler/TBasicWebService.java @@ -88,14 +88,16 @@ public class TBasicWebService implements ITBasicWebService { CanlcelDto canlcelDto = new CanlcelDto(); String serialnum = String.valueOf(FileUtils.getJsonByName("serialnum")); - Element serialnumElement = elementRoot.element(serialnum); - if (serialnumElement != null || StringUtils.isBlank(serialnumElement.getText())) { - throw new RuntimeException("撤回操作时:" + serialnum + "标签不能为空!"); - } - canlcelDto.setSerialnum(serialnumElement.getText()); +// Element serialnumElement = elementRoot.element(serialnum); + String serialnumElement = getElementText(elementRoot, serialnum.split(","));; +// if (serialnumElement != null || StringUtils.isBlank(serialnumElement.getText())) { +// throw new RuntimeException("撤回操作时:" + serialnum + "标签不能为空!"); +// } + canlcelDto.setSerialnum(serialnumElement); //调用上传服务撤销功能 afCollectTaskService.invokeRepoalFile(canlcelDto); logger.info("----------当前操作完成--------------"); + return ResultUtils.success().asXML(); } } diff --git a/src/main/java/com/docus/bgts/service/AfCollectTaskServiceImpl.java b/src/main/java/com/docus/bgts/service/AfCollectTaskServiceImpl.java index f4c798d..83f7931 100644 --- a/src/main/java/com/docus/bgts/service/AfCollectTaskServiceImpl.java +++ b/src/main/java/com/docus/bgts/service/AfCollectTaskServiceImpl.java @@ -137,6 +137,7 @@ public class AfCollectTaskServiceImpl extends ServiceImpl