From 4bf82a503ac13e0ae58cd80306241dca292c632b Mon Sep 17 00:00:00 2001 From: wyb <1977763549@qq.com> Date: Mon, 4 Sep 2023 11:04:30 +0800 Subject: [PATCH] =?UTF-8?q?lis=E6=8A=A5=E5=91=8A=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collect/collector/LisSystemCollector.java | 195 +++++++++++++++++- .../collect/controller/CollectController.java | 20 +- .../docus/server/collect/entity/TBasic.java | 1 - src/main/resources/bootstrap.yml | 2 + 4 files changed, 211 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/docus/server/collect/collector/LisSystemCollector.java b/src/main/java/com/docus/server/collect/collector/LisSystemCollector.java index b178926..bd3b3c9 100644 --- a/src/main/java/com/docus/server/collect/collector/LisSystemCollector.java +++ b/src/main/java/com/docus/server/collect/collector/LisSystemCollector.java @@ -2,15 +2,21 @@ package com.docus.server.collect.collector; import com.docus.core.util.Func; import com.docus.server.collect.entity.TBasic; +import com.docus.server.collect.enums.DownWayEnum; import com.docus.server.collect.service.FileReportService; import com.docus.server.collect.service.dto.ReportFileInfoDTO; import com.docus.server.collect.util.JaxWsDynamicClientUtil; +import com.docus.server.collect.util.XmlUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; /** * 检验报告采集 @@ -21,6 +27,10 @@ import java.time.LocalDateTime; public class LisSystemCollector{ @Value("${docus.report.lis.url}") private String url; + @Value("${docus.report.lis.assortId}") + private String assortId; + @Value("${docus.report.lis.sysFlag}") + private String sysFlag; @Value("${docus.report.lis.method}") private String method; @Value("${docus.report.lis.namespaceUri:}") @@ -37,8 +47,21 @@ public class LisSystemCollector{ */ public void collect(TBasic basic, String beginDateTime, String endDateTime){ String collectData = collectData(basic, beginDateTime, endDateTime); - ReportFileInfoDTO reportFileInfoDTO = LisSystemCollectConverter.convert(collectData); - fileReportService.saveDownloadTaskAndReport(reportFileInfoDTO); + List reportFileInfoDTOList = LisSystemCollectConverter.convert(collectData); + for (ReportFileInfoDTO reportFileInfoDTO : reportFileInfoDTOList) { + if(!isBelongToPatient(reportFileInfoDTO,basic)){ + continue; + } + reportFileInfoDTO.setPatientId(basic.getPatientId()); + reportFileInfoDTO.setAssortId(assortId); + reportFileInfoDTO.setSysFlag(sysFlag); + fileReportService.saveDownloadTaskAndReport(reportFileInfoDTO); + } + } + + private boolean isBelongToPatient(ReportFileInfoDTO reportFileInfoDTO, TBasic basic) { + // todo 验证报告是否属于患者,暂时描述说查询条件是患者唯一,不需要实现 + return true; } public String collectData(TBasic basic,String beginDateTime,String endDateTime){ @@ -118,11 +141,173 @@ public class LisSystemCollector{ * @param lisSystemCollectData 验系统报告采集数据 * @return 文件上报信息 */ - public static ReportFileInfoDTO convert(String lisSystemCollectData) { - //todo 转换未实现 2023年9月1日15:49:45 2023-9-4 - return null; + public static List convert(String lisSystemCollectData) { + XmlUtil xmlUtil = XmlUtil.of(lisSystemCollectData); + List list= new ArrayList<>(); + NodeList reportInfoNodeList = xmlUtil.getNodeList("/Response/MsgInfo/Msg/ReportInfo"); + if(reportInfoNodeList!=null && reportInfoNodeList.getLength()>0){ + int length = reportInfoNodeList.getLength(); + for (int i = 0; i < length; i++) { + Node item = reportInfoNodeList.item(i); + NodeList childNodes = item.getChildNodes(); + int childNodesLength = childNodes.getLength(); + String fileTitle=null; + String serialNum=null; + String downUrl=null; + for (int j = 0; j < childNodesLength; j++) { + Node childNodeItem = childNodes.item(j); + if ("SAMPLE_TYPE_NAME".equals(childNodeItem.getNodeName())) { + fileTitle=childNodeItem.getTextContent(); + } +// if ("TEST_CATEG_NAME".equals(childNodeItem.getNodeName())) { +// fileTitle=childNodeItem.getTextContent(); +// } + if ("SAMPLE_NO".equals(childNodeItem.getNodeName())) { + serialNum=childNodeItem.getTextContent(); + } + if ("REPORT_PDF_URL".equals(childNodeItem.getNodeName())) { + downUrl=childNodeItem.getTextContent(); + } + } + + ReportFileInfoDTO fileInfoDTO = new ReportFileInfoDTO(); + fileInfoDTO.setFileTitle(fileTitle); + fileInfoDTO.setSerialNum(serialNum); + fileInfoDTO.setDownUrl(downUrl); + fileInfoDTO.setDownWayEnum(DownWayEnum.HTTP); + fileInfoDTO.setIp("docus-collect-gdszy"); + fileInfoDTO.setUserName("LIS采集服务"); + fileInfoDTO.setReportUserFullName("LIS采集服务"); + fileInfoDTO.setTaskId(-1L); + list.add(fileInfoDTO); + } + } + return list; } } + public static void main(String[] args) { + String data="\n" + + " \n" + + " 0\n" + + " 成功\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 44A003\n" + + " 广东省中医院\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " L560966\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " L560966\n" + + " 70120410\n" + + " L560966\n" + + " 等等\n" + + " 84岁\n" + + " 1\n" + + " \n" + + " IN\n" + + " 住院\n" + + " \n" + + " \n" + + " 20190928G0140001\n" + + " \n" + + " \n" + + " 100026912200\n" + + " httt://nbplus/diaomao.pdf\n" + + " \n" + + " LIS5149\n" + + " 离子4项\n" + + " LIS2860\n" + + " 静脉血\n" + + " A001\n" + + " \n" + + " \n" + + " 966\n" + + " 测试科\n" + + " 966\n" + + " 测试科\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 2019-09-29 01:10:46\n" + + " 2019-09-28 22:17:29\n" + + " 2019-09-28 22:23:55\n" + + " 2019-09-28 22:23:56\n" + + " 2019-09-28 22:27:15\n" + + " 3515\n" + + " 韩光\n" + + " 3333\n" + + " 吴晓宾\n" + + " 3333\n" + + " 吴晓宾\n" + + " C93.100||慢性单核细胞白血病\n" + + " \n" + + " \n" + + " 20190928G0140002\n" + + " 1121|3232\n" + + " 100026912300\n" + + " \n" + + " \n" + + " LIS5080\n" + + " 肝功2项\n" + + " LIS2860\n" + + " 静脉血\n" + + " A001\n" + + " \n" + + " \n" + + " 966\n" + + " 测试科\n" + + " 966\n" + + " 测试科\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 2019-09-29 10:01:55\n" + + " 2019-09-28 22:17:41\n" + + " 2019-09-28 22:24:12\n" + + " 2019-09-28 22:24:12\n" + + " 2019-09-28 22:27:08\n" + + " 3515\n" + + " 韩光\n" + + " 3333\n" + + " 吴晓宾\n" + + " 3333\n" + + " 吴晓宾\n" + + " C93.100||慢性单核细胞白血病\n" + + " \n" + + " \n" + + " \n" + + "\n"; + System.out.println(LisSystemCollectConverter.convert(data)); + + } } diff --git a/src/main/java/com/docus/server/collect/controller/CollectController.java b/src/main/java/com/docus/server/collect/controller/CollectController.java index f1e7ee7..f7f977c 100644 --- a/src/main/java/com/docus/server/collect/controller/CollectController.java +++ b/src/main/java/com/docus/server/collect/controller/CollectController.java @@ -1,13 +1,18 @@ package com.docus.server.collect.controller; +import com.docus.core.util.Func; import com.docus.infrastructure.web.api.CommonResult; import com.docus.server.collect.collector.LisSystemCollector; +import com.docus.server.collect.entity.TBasic; import com.docus.server.collect.feign.api.GdSzyCollectServiceApi; +import com.docus.server.collect.infrastructure.dao.DownloadTaskDao; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * @author WYBDEV */ @@ -17,10 +22,23 @@ import org.springframework.web.bind.annotation.RestController; public class CollectController implements GdSzyCollectServiceApi { @Autowired private LisSystemCollector lisSystemCollector; + @Autowired + private DownloadTaskDao downloadTaskDao; @Override public CommonResult lisSystemCollect() { - lisSystemCollector.collect(null, null, null); + TBasic basic = new TBasic(); + List basicInfo = downloadTaskDao.getBasicInfo(basic); + if(Func.isEmpty(basicInfo) || basicInfo.size()>1){ + log.error("采集失败,基础数据匹配失败!"); + return CommonResult.failed("采集失败,基础数据匹配失败!"); + } + TBasic tBasic = basicInfo.get(0); + if(Func.isBlank(tBasic.getAdmissDate()) || Func.isBlank(tBasic.getDisDate())){ + log.error("采集失败,患者住院或者出院时间为空!"); + return CommonResult.failed("采集失败,患者住院或者出院时间为空!"); + } + lisSystemCollector.collect(tBasic, tBasic.getAdmissDate(), tBasic.getDisDate()); return CommonResult.success("采集完成!"); } } diff --git a/src/main/java/com/docus/server/collect/entity/TBasic.java b/src/main/java/com/docus/server/collect/entity/TBasic.java index 1a7b6f9..c508eec 100644 --- a/src/main/java/com/docus/server/collect/entity/TBasic.java +++ b/src/main/java/com/docus/server/collect/entity/TBasic.java @@ -44,6 +44,5 @@ public class TBasic { this.patientId = fileInfoDTO.getPatientId(); this.inpatientNo = fileInfoDTO.getInpatientNo(); this.admissTimes = fileInfoDTO.getAdmisstimes(); - ; } } diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml index 86f96cf..5ce9c2c 100644 --- a/src/main/resources/bootstrap.yml +++ b/src/main/resources/bootstrap.yml @@ -51,6 +51,8 @@ docus: downloadPlatform: http://192.168.16.85:9291 report: lis: + assortId: lis-zdAssortId + sysFlag: lis url: http://192.168.198.101:7827/Ewell_WS_S51?wsdl method: OperationA namespaceUri: