From a76fd21139acb71353d93b44ada6fb75497ea468 Mon Sep 17 00:00:00 2001 From: lzy Date: Wed, 9 Feb 2022 16:35:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9C=81=E4=B8=AD=E5=8C=BB=E4=BD=8F=E9=99=A2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dataConfig/homeQualitySet.json | 12 +- ...院电子病历采集-homeQualitySet.json | 69 ++++++ .../com/docus/bgts/config/MyScheduling.java | 222 +++++++++--------- .../docus/bgts/handler/TBasicWebService.java | 5 +- src/main/resources/application.yml | 4 +- ...cation-梅州人民医院电子病历.yml} | 0 ...住院电子病历采集-application.yml | 28 +++ src/main/resources/logback-spring.xml | 5 +- 8 files changed, 222 insertions(+), 123 deletions(-) create mode 100644 dataConfig/广东省中医院住院电子病历采集-homeQualitySet.json rename src/main/resources/config/{application-梅州入民医院电子病历.yml => application-梅州人民医院电子病历.yml} (100%) create mode 100644 src/main/resources/config/广东省中医院住院电子病历采集-application.yml diff --git a/dataConfig/homeQualitySet.json b/dataConfig/homeQualitySet.json index d69edc8..35a2908 100644 --- a/dataConfig/homeQualitySet.json +++ b/dataConfig/homeQualitySet.json @@ -12,15 +12,15 @@ "errorCode":"0", //唯一键目录结构数组,最高层为前面,最后一层为数据采集层,根节点不填 - "directory":[], + "directory":["Msg"], //患者主索引号 - "indexFlag":"VISITING_SERIAL_NUMBER", + "indexFlag":"INHOSP_NO", //采集流水号 - "serialnum":"UNIQUE_ID", + "serialnum":"IDNO", //文件标题 - "filetitle":"DOCUMENT_TITLE", + "filetitle":"FILENAME", //下载地址,&代表多个选其一 - "downurl":"BASE64&ORIGINAL_URL", + "downurl":"PDF_PATH", //分类id "assortid":"Wiw213woq412awqe41", //系统id @@ -36,7 +36,7 @@ //基本数据存放处,根节点不填,最后一层为基本信息存放标签与doubleBasic配合 "basicDirectory":[""], //可能存在存储基本数据不同情况的标签 - "doubleBasic":["TestItemInfo","BioTestInfo"], + "doubleBasic":["ITEM"], //--------------采集操作判断撤销/新增--------------- //是否开启采集操作判断撤销/新增 0:不开启,1:开启 默认不开启 diff --git a/dataConfig/广东省中医院住院电子病历采集-homeQualitySet.json b/dataConfig/广东省中医院住院电子病历采集-homeQualitySet.json new file mode 100644 index 0000000..35a2908 --- /dev/null +++ b/dataConfig/广东省中医院住院电子病历采集-homeQualitySet.json @@ -0,0 +1,69 @@ +{ + //----------响应标签------------- + //外部结构,多层,隔开 + "ResHead":"Response,Result", + //响应代码 + "ResCode":"Code", + //响应消息 + "ResMsg":"Msg", + //成功编码 + "successCode":"1", + //失败编码 + "errorCode":"0", + + //唯一键目录结构数组,最高层为前面,最后一层为数据采集层,根节点不填 + "directory":["Msg"], + //患者主索引号 + "indexFlag":"INHOSP_NO", + //采集流水号 + "serialnum":"IDNO", + //文件标题 + "filetitle":"FILENAME", + //下载地址,&代表多个选其一 + "downurl":"PDF_PATH", + //分类id + "assortid":"Wiw213woq412awqe41", + //系统id + "collectorid":"22", + //获取分类id参数 + "assortidParamKey":"DOCUMENT_TOPIC", + //采集类型(文件来源 1:采集器;2:扫描生产软件) + "filesource":1, + //下载类型(1:服务器本地;2:ftp服务器;3:共享文件夹) + "filestoragetype":1, + //上传接口 + "uploadConnector":"http://192.9.100.171:9291/api/downplatform/report", + //基本数据存放处,根节点不填,最后一层为基本信息存放标签与doubleBasic配合 + "basicDirectory":[""], + //可能存在存储基本数据不同情况的标签 + "doubleBasic":["ITEM"], + + //--------------采集操作判断撤销/新增--------------- + //是否开启采集操作判断撤销/新增 0:不开启,1:开启 默认不开启 + "isJudge":"0", + //判断标签存在目录,首个标签不填 + "judgeDirectory":[""], + //判定标签,值0-新增;1-撤回;2-修改 + "judgeIndex":"", + + + //--------撤销配置部分------------ + //采集流水号所在位置,根目录不填 + "repealDirectory":[""], + //采集流水号名 + "repealSerialnum":"UNIQUE_ID", + //撤销接口 + "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" + +} \ 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 39155eb..4251685 100644 --- a/src/main/java/com/docus/bgts/config/MyScheduling.java +++ b/src/main/java/com/docus/bgts/config/MyScheduling.java @@ -85,117 +85,117 @@ public class MyScheduling { } //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; - } +// @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, diff --git a/src/main/java/com/docus/bgts/handler/TBasicWebService.java b/src/main/java/com/docus/bgts/handler/TBasicWebService.java index d25ede9..adc6f10 100644 --- a/src/main/java/com/docus/bgts/handler/TBasicWebService.java +++ b/src/main/java/com/docus/bgts/handler/TBasicWebService.java @@ -117,8 +117,7 @@ public class TBasicWebService implements ITBasicWebService { reportDownPatientDto = new ReportDownPatientDto(); //获取jzh String empIdText = getElementText(elementRoot, empId.split(",")); - //获取采集流水号 - serialnum = getElementText(elementRoot, serialnmnKey.split(",")); + reportDownPatientDto.setJzh(empIdText); logger.info("患者主索引号:" + empIdText); reportDownDto.setPatient(reportDownPatientDto); @@ -128,6 +127,8 @@ public class TBasicWebService implements ITBasicWebService { filetitle = getElementText(element, filetitleKey.split(",")); downurl = getElementText(element, downurlKey.split(",")); downurl = handleDownUrl(downurl); + //获取采集流水号 + serialnum = getElementText(element, serialnmnKey.split(",")); reportDownScanFileDto = new ReportDownScanFileDto(); reportDownScanFileDto.setDownurl(downurl); reportDownScanFileDto.setFiletitle(filetitle); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 7045fe6..eee35fd 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -15,8 +15,8 @@ beat: url: http://localhost:9399/beat system: - code: "EmrDocAr" - prop: 9805 + code: "empcllect" + prop: 9405 # web service diff --git a/src/main/resources/config/application-梅州入民医院电子病历.yml b/src/main/resources/config/application-梅州人民医院电子病历.yml similarity index 100% rename from src/main/resources/config/application-梅州入民医院电子病历.yml rename to src/main/resources/config/application-梅州人民医院电子病历.yml diff --git a/src/main/resources/config/广东省中医院住院电子病历采集-application.yml b/src/main/resources/config/广东省中医院住院电子病历采集-application.yml new file mode 100644 index 0000000..eee35fd --- /dev/null +++ b/src/main/resources/config/广东省中医院住院电子病历采集-application.yml @@ -0,0 +1,28 @@ +server: + port: 9205 +# http + +mybatis-plus: + configuration: + map-underscore-to-camel-case: true + call-setters-on-nulls: true + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + global-config: + db-config: + field-strategy: NOT_EMPTY + db-type: MYSQL +beat: + url: http://localhost:9399/beat + +system: + code: "empcllect" + prop: 9405 +# web service + + +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + username: docus + password: docus702 + url: jdbc:mysql://db.docus.cn:3306/docus_archivefile?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true \ No newline at end of file diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 8d89969..d053ce9 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -5,7 +5,7 @@ - %d %p (%file:%line\)- %m%n + [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%contextName] [%thread] [%X{traceId}] %-5level %logger{36} - %msg%n UTF-8 @@ -31,8 +31,9 @@ - %d %p (%file:%line\)- %m%n + [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%X{traceId}] [%L] [%-5p] %m%n + utf-8 UTF-8