From 8fa2ecfd81678e22fd7b4fad41baa23a932bfbd8 Mon Sep 17 00:00:00 2001 From: wyb <1977763549@qq.com> Date: Fri, 29 Mar 2024 14:54:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=9B=E5=B1=B1=E4=B8=89=E9=99=A2?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0lis=E6=8A=A5=E5=91=8Awebservice?= =?UTF-8?q?=E9=87=87=E9=9B=86=EF=BC=8C=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=9C=89=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 14 + .../com/docus/server/AppRunBootstrap.java | 6 + .../archive/config/DocusServerUrlConfig.java | 22 + .../job/LisPatientReportCollectJob.java | 105 +++ .../archive/rpc/DownPlatformService.java | 22 + .../archive/rpc/TaskDistributeService.java | 24 + .../archive/rpc/dto/PatientInfoDTO.java | 37 + .../server/archive/rpc/dto/ReportDownDto.java | 30 + .../archive/rpc/dto/ReportDownPatientDto.java | 19 + .../rpc/dto/ReportDownScanFileDto.java | 32 + .../archive/rpc/dto/ReportDownTwoDto.java | 29 + .../server/archive/rpc/dto/ReportDto.java | 97 ++ .../archive/rpc/dto/ReportHospitalTwoDto.java | 27 + .../archive/rpc/dto/ReportPatientTwoDto.java | 18 + .../archive/rpc/dto/ReportTaskTwoDto.java | 19 + .../rpc/impl/DownPlatformServiceImpl.java | 49 + .../rpc/impl/TaskDistributeServiceImpl.java | 48 + .../archive/rpc/request/CqcAuditRequest.java | 29 + .../archive/rpc/vo/SdRyBloodReportVO.java | 27 + .../archive/utils/JaxWsDynamicClientUtil.java | 69 ++ .../docus/server/archive/utils/XmlUtil.java | 857 ++++++++++++++++++ .../server/fsy/api/LisReportService.java | 30 + .../fsy/api/dto/LisPatientListRequest.java | 27 + .../fsy/api/dto/LisPatientListResponse.java | 41 + .../fsy/api/dto/LisPatientReportRequest.java | 19 + .../fsy/api/dto/LisPatientReportResponse.java | 19 + .../fsy/converter/LisReportConverter.java | 160 ++++ .../service/impl/LisReportServiceImpl.java | 45 + src/main/resources/bootstrap.yml | 14 +- 29 files changed, 1931 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/docus/server/archive/config/DocusServerUrlConfig.java create mode 100644 src/main/java/com/docus/server/archive/job/LisPatientReportCollectJob.java create mode 100644 src/main/java/com/docus/server/archive/rpc/DownPlatformService.java create mode 100644 src/main/java/com/docus/server/archive/rpc/TaskDistributeService.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/PatientInfoDTO.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportDownDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportDownPatientDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportDownScanFileDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportDownTwoDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportHospitalTwoDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportPatientTwoDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/dto/ReportTaskTwoDto.java create mode 100644 src/main/java/com/docus/server/archive/rpc/impl/DownPlatformServiceImpl.java create mode 100644 src/main/java/com/docus/server/archive/rpc/impl/TaskDistributeServiceImpl.java create mode 100644 src/main/java/com/docus/server/archive/rpc/request/CqcAuditRequest.java create mode 100644 src/main/java/com/docus/server/archive/rpc/vo/SdRyBloodReportVO.java create mode 100644 src/main/java/com/docus/server/archive/utils/JaxWsDynamicClientUtil.java create mode 100644 src/main/java/com/docus/server/archive/utils/XmlUtil.java create mode 100644 src/main/java/com/docus/server/fsy/api/LisReportService.java create mode 100644 src/main/java/com/docus/server/fsy/api/dto/LisPatientListRequest.java create mode 100644 src/main/java/com/docus/server/fsy/api/dto/LisPatientListResponse.java create mode 100644 src/main/java/com/docus/server/fsy/api/dto/LisPatientReportRequest.java create mode 100644 src/main/java/com/docus/server/fsy/api/dto/LisPatientReportResponse.java create mode 100644 src/main/java/com/docus/server/fsy/converter/LisReportConverter.java create mode 100644 src/main/java/com/docus/server/fsy/service/impl/LisReportServiceImpl.java diff --git a/pom.xml b/pom.xml index 1dc2ca9..09cfc99 100644 --- a/pom.xml +++ b/pom.xml @@ -184,6 +184,20 @@ 11.2.0.4.0 + + + + org.apache.cxf + cxf-spring-boot-starter-jaxws + 3.3.4 + + + + org.dom4j + dom4j + 2.1.1 + + diff --git a/src/main/java/com/docus/server/AppRunBootstrap.java b/src/main/java/com/docus/server/AppRunBootstrap.java index 25e74a4..f97ece1 100644 --- a/src/main/java/com/docus/server/AppRunBootstrap.java +++ b/src/main/java/com/docus/server/AppRunBootstrap.java @@ -14,6 +14,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients; import java.util.Arrays; import java.util.Date; +import java.util.Properties; /** @@ -25,6 +26,11 @@ import java.util.Date; @EnableFeignClients(basePackages = {"com.docus"}) public class AppRunBootstrap { public static void main(String[] args) { + Properties props = System.getProperties(); + props.setProperty("org.apache.cxf.stax.allowInsecureParser", "1"); + props.setProperty("UseSunHttpHandler", "true"); + System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"); + SpringApplication.run(AppRunBootstrap.class, args); } diff --git a/src/main/java/com/docus/server/archive/config/DocusServerUrlConfig.java b/src/main/java/com/docus/server/archive/config/DocusServerUrlConfig.java new file mode 100644 index 0000000..f427c38 --- /dev/null +++ b/src/main/java/com/docus/server/archive/config/DocusServerUrlConfig.java @@ -0,0 +1,22 @@ +package com.docus.server.archive.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * @author YongBin Wen + * @date 2024/3/29 14:00 + */ +@Component +@Data +public class DocusServerUrlConfig { + @Value("${docus.url.viewcollect-server}") + private String viewCollectServerUrl; + + @Value("${docus.url.downploadlatform-server}") + private String downloadPlatformServerUrl; + + @Value("${docus.url.taskdistribute-server}") + private String taskDistributeServerUrl; +} diff --git a/src/main/java/com/docus/server/archive/job/LisPatientReportCollectJob.java b/src/main/java/com/docus/server/archive/job/LisPatientReportCollectJob.java new file mode 100644 index 0000000..f41d2e6 --- /dev/null +++ b/src/main/java/com/docus/server/archive/job/LisPatientReportCollectJob.java @@ -0,0 +1,105 @@ +package com.docus.server.archive.job; + +import com.docus.core.util.Func; +import com.docus.infrastructure.web.api.CommonResult; +import com.docus.infrastructure.web.api.ResultCode; +import com.docus.server.archive.rpc.DownPlatformService; +import com.docus.server.archive.rpc.TaskDistributeService; +import com.docus.server.archive.rpc.dto.ReportDownDto; +import com.docus.server.archive.rpc.dto.ReportDownTwoDto; +import com.docus.server.archive.rpc.dto.ReportHospitalTwoDto; +import com.docus.server.archive.rpc.dto.ReportPatientTwoDto; +import com.docus.server.fsy.api.LisReportService; +import com.docus.server.fsy.api.dto.LisPatientListRequest; +import com.docus.server.fsy.api.dto.LisPatientListResponse; +import com.docus.server.fsy.api.dto.LisPatientReportRequest; +import com.docus.server.fsy.api.dto.LisPatientReportResponse; +import com.docus.server.fsy.converter.LisReportConverter; +import com.xxl.job.core.handler.annotation.XxlJob; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Objects; + +/** + * @author YongBin Wen + * @date 2024/3/27 16:23 + */ +@Component +@Slf4j +public class LisPatientReportCollectJob { + @Value("${fsy.lis.assortid}") + private String lisAssortId; + @Value("${fsy.lis.sysflag}") + private String lisCollectorId; + + @Resource + private LisReportService lisReportService; + @Resource + private DownPlatformService downPlatformService; + @Resource + private TaskDistributeService taskDistributeService; + + + /** + * 佛山三院Lis检验报告采集job + * + * @date 2024/3/27 16:27 + * @author YongBin Wen + */ + @XxlJob("FoShanSyLisPatientReportCollectJob") + public void foShanSyLisPatientReportCollectJob() { + log.info("====================> 佛山三院Lis检验报告采集任务开始 ==================="); + try { + while (true) { + CommonResult taskResult = taskDistributeService.getNoViewTaskByCollectorId(lisCollectorId); + if (Objects.isNull(taskResult) || taskResult.getCode().equals(ResultCode.FAILED.getCode())) { + break; + } + // 获取采集任务 + ReportDownTwoDto reportDownTwoDto = taskResult.getData(); + Long taskId = reportDownTwoDto.getTasks().get(0).getTaskId(); + log.info("佛山三院Lis检验报告采集任务,成功获取采集任务,任务id:{}", taskId); + ReportPatientTwoDto patientTwoDto = reportDownTwoDto.getPatient(); + ReportHospitalTwoDto hospitalTwoDto = reportDownTwoDto.getHospitals().get(0); + String admissDate = hospitalTwoDto.getAdmissDate(); + String disDate = hospitalTwoDto.getDisDate(); + if (Func.isBlank(admissDate) || Func.isBlank(disDate)) { + log.info("佛山三院Lis检验报告采集任务,采集任务id:{} 入院时间或者出院时间为空,不进行采集!", taskId); + continue; + } + // 获取患者的lis检验报告列表 + LisPatientListRequest lisPatientListRequest = new LisPatientListRequest(); + lisPatientListRequest.setPidInNo(patientTwoDto.getInpatientNo()); + lisPatientListRequest.setPidAddmissTimes(hospitalTwoDto.getAdmissTimes()); + lisPatientListRequest.setStartDate(admissDate); + lisPatientListRequest.setEndDate(disDate); + LisPatientListResponse patientListResponse = lisReportService.getPatientList(lisPatientListRequest); + List patientList = patientListResponse.getPatientList(); + if (Func.isEmpty(patientList)) { + log.info("佛山三院Lis检验报告采集任务,采集任务id:{} 未查询到List患者文件数据", taskId); + continue; + } + // 文件列表查询每个文件,进行上报下载服务 + for (LisPatientListResponse.Patient patient : patientList) { + LisPatientReportRequest lisPatientReportRequest = new LisPatientReportRequest(); + lisPatientReportRequest.setRepId(patient.getRepId()); + lisPatientReportRequest.setCustomReportSuffix(""); + LisPatientReportResponse lisReportServicePatientReport = lisReportService.getPatientReport(lisPatientReportRequest); + ReportDownDto reportDownDto = LisReportConverter.convertDownloadPlatform(reportDownTwoDto, patient, lisReportServicePatientReport); + reportDownDto.setCollectorid(lisCollectorId); + reportDownDto.setAssortid(lisAssortId); + downPlatformService.report(reportDownDto); + } + } + } catch (Exception ex) { + log.error("====================> 佛山三院Lis检验报告采集任务出现异常_" + ex.getMessage(), ex); + } + log.info("====================> 佛山三院Lis检验报告采集任务结束 ==================="); + } + + +} diff --git a/src/main/java/com/docus/server/archive/rpc/DownPlatformService.java b/src/main/java/com/docus/server/archive/rpc/DownPlatformService.java new file mode 100644 index 0000000..a87fabf --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/DownPlatformService.java @@ -0,0 +1,22 @@ +package com.docus.server.archive.rpc; + +import com.docus.infrastructure.web.api.CommonResult; +import com.docus.server.archive.rpc.dto.ReportDownDto; + +/** + * 下载平台服务接口 + * + * @author jiashi + */ + +public interface DownPlatformService { + + + /** + * 下载服务文件上报 + * + * @param reportDownDto 下载服务上报参数 + * @return 结果 + */ + CommonResult report(ReportDownDto reportDownDto); +} diff --git a/src/main/java/com/docus/server/archive/rpc/TaskDistributeService.java b/src/main/java/com/docus/server/archive/rpc/TaskDistributeService.java new file mode 100644 index 0000000..a5f78cf --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/TaskDistributeService.java @@ -0,0 +1,24 @@ +package com.docus.server.archive.rpc; + +import com.docus.infrastructure.web.api.CommonResult; +import com.docus.server.archive.rpc.dto.ReportDownTwoDto; + +/** + * 无视图任务服务 + * + * @author wyb + */ + +public interface TaskDistributeService { + + + /** + * 无视图-根据采集器类型获取任务信息 + * + * @param collectorId 采集器类型 + * @return 任务信息 + */ + CommonResult getNoViewTaskByCollectorId(String collectorId); + + CommonResult cancel(Long taskId); +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/PatientInfoDTO.java b/src/main/java/com/docus/server/archive/rpc/dto/PatientInfoDTO.java new file mode 100644 index 0000000..fb39a19 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/PatientInfoDTO.java @@ -0,0 +1,37 @@ +package com.docus.server.archive.rpc.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 患者基础信息 + * + * @author WYBDEV + */ +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +@ApiModel(value = "患者信息") +public class PatientInfoDTO { + @ApiModelProperty(value = "病案主键") + private String patientId; + @ApiModelProperty(value = "住院号") + private String inpatientNo; + @ApiModelProperty(value = "住院次数") + private Integer admissTimes; + @ApiModelProperty(value = "入院日期 yyyy-MM-dd HH:mm:ss") + private String admissDate; + @ApiModelProperty(value = "入院科室名称") + private String admissDeptName; + @ApiModelProperty(value = "出院日期 yyyy-MM-dd HH:mm:ss") + private String disDate; + @ApiModelProperty(value = "出院科室名称") + private String disDeptName; + @ApiModelProperty(value = "记账号") + private String jzh; + @ApiModelProperty(value = "姓名") + private String name; + @ApiModelProperty(value = "住院id") + private String admissId; +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportDownDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownDto.java new file mode 100644 index 0000000..b2a390f --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownDto.java @@ -0,0 +1,30 @@ +package com.docus.server.archive.rpc.dto; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class ReportDownDto { + @ApiModelProperty(value = "采集器id") + private String collectorid; + + @ApiModelProperty(value = "采集器ip") + private String ip; + + @ApiModelProperty(value = "分类id") + private String assortid; + + @ApiModelProperty(value = "患者信息") + private ReportDownPatientDto patient; + + @ApiModelProperty(value = "文件信息") + private List scanfiles; + + @ApiModelProperty(value = "扫描用户代码") + private String scanusercode; + @ApiModelProperty(value = "扫描用户名称") + private String scanusername; +} \ No newline at end of file diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportDownPatientDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownPatientDto.java new file mode 100644 index 0000000..acab171 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownPatientDto.java @@ -0,0 +1,19 @@ +package com.docus.server.archive.rpc.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ReportDownPatientDto { + @ApiModelProperty(value = "记帐号") + private String jzh; + @ApiModelProperty(value = "住院次数,记帐号重复则加这个参数,无则Null") + private Integer admisstimes; + @ApiModelProperty(value = "病案主键,如有传则使用,无则使用jzh") + private String patientid; + @ApiModelProperty(value = "病案号") + private String inpatientno; + + @ApiModelProperty(value = "物理存储位置,有则传") + private String storagelocation; +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportDownScanFileDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownScanFileDto.java new file mode 100644 index 0000000..badffd9 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownScanFileDto.java @@ -0,0 +1,32 @@ +package com.docus.server.archive.rpc.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ReportDownScanFileDto { + @ApiModelProperty(value = "任务id(如无效任务id,则不更新任务表数据)") + private Long taskid; + @ApiModelProperty(value = "文件标题") + private String filetitle; + @ApiModelProperty(value = "采集类型(文件来源 1:采集器;2:扫描生产软件)") + private int filesource; + @ApiModelProperty(value = "下载类型(1:服务器本地;2:ftp服务器;3:共享文件夹)") + private int filestoragetype; + @ApiModelProperty(value = "文件类型(1:url,2:base64,3:url base64,4:共享文件,5:本地文件base64)") + private int filetype=1; + @ApiModelProperty(value = "下载地址") + private String downurl; + // @ApiModelProperty(value = "档案信息") +// private String recordid; + @ApiModelProperty(value = "采集流水号") + private String serialnum; + + @ApiModelProperty(value = "排序日期") + private String sortdate; + + @ApiModelProperty(value = "是否作废 : 0:否 不作废,1:是 作废") + private int cancel=0; + + +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportDownTwoDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownTwoDto.java new file mode 100644 index 0000000..9e61e29 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportDownTwoDto.java @@ -0,0 +1,29 @@ +package com.docus.server.archive.rpc.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class ReportDownTwoDto { + @ApiModelProperty(value = "档案编号") + private String patientId; + @ApiModelProperty(value = "记账号") + private String jzh; + @ApiModelProperty(value = "档案类型") + private String recordType; + @ApiModelProperty(value = "档案时间") + private String createTime; + @ApiModelProperty(value = "患者信息") + private ReportPatientTwoDto patient =new ReportPatientTwoDto(); + @ApiModelProperty(value = "住院信息") + private List hospitals = new ArrayList<>(); + @ApiModelProperty(value = "任务信息") + private List tasks = new ArrayList<>(); + @ApiModelProperty(value = "母亲基础信息") + private PatientInfoDTO parent; +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportDto.java new file mode 100644 index 0000000..0746218 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportDto.java @@ -0,0 +1,97 @@ +package com.docus.server.archive.rpc.dto; + + +import lombok.Data; + +/** + * 报告推送信息 + */ +@Data +public class ReportDto { + /** + * 住院号 + */ + private String inpatientNo; + /** + * 记账号/住院流水号 + */ + private String jzh; + /** + * 住院次数 + */ + private Integer admisstimes; + /** + * 采集来源系统 + */ + private String sysFlag; + /** + * 下载地址 + */ + private String downUrl; + /** + * 文件名 + */ + private String fileTitle; + /** + * 采集流水号/文件唯一id + */ + private String serialnum; + + /** + * 文件分类id + */ + private String assortId; + + /** + * 采集类型(文件来源 1:采集器;2:扫描生产软件) + */ + private String fileSource; + + /** + * 文件保存位置类型 1:服务器本地;2:ftp服务器;3:共享文件夹 + */ + private String filestoragetype; + + /** + * 下载对应任务id ,接收处理 + */ + private Long taskId; + + /** + * 业务病案主键 + */ + private String patientId; + + /** + * 下载路径类型 1:url,2:base64,3:url base64,4:共享文件,5:本地文件base64 + */ + private Integer downtype = 1; + + /** + * 患者本次就诊唯一键:患者id【12位】+就诊次 + * 数 + */ + private String visitSn; + + /** + * 患者id + */ + private String patientSn; + + + /** + * 检查报告单号,用于顺德人医推送 报告信息和报告地址的关联 + */ + private String reportSn; + + /** + * 如果多次上传是否合并文件标题 + */ + private boolean mergeFileTitle; + + + + public ReportDto() { + } + +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportHospitalTwoDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportHospitalTwoDto.java new file mode 100644 index 0000000..43f5871 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportHospitalTwoDto.java @@ -0,0 +1,27 @@ +package com.docus.server.archive.rpc.dto; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * + */ +@Data +public class ReportHospitalTwoDto { + + @ApiModelProperty(value = "患者id") + private String patientId; + @ApiModelProperty(value = "住院次数") + private Integer admissTimes; + @ApiModelProperty(value = "住院日期") + private String admissDate; + @ApiModelProperty(value = "出院日期") + private String disDate; + @ApiModelProperty(value = "出院科室名称") + private String disDeptName; + @ApiModelProperty(value = "出院科室名称") + private String admissDeptName; + @ApiModelProperty(value = "卡号") + private String admissId; +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportPatientTwoDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportPatientTwoDto.java new file mode 100644 index 0000000..708b1db --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportPatientTwoDto.java @@ -0,0 +1,18 @@ +package com.docus.server.archive.rpc.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 上报打印 患者信息 + */ +@Data +public class ReportPatientTwoDto { + + @ApiModelProperty(value = "住院号/就诊号") + private String inpatientNo; + @ApiModelProperty(value = "患者姓名") + private String name; + @ApiModelProperty(value = "id号") + private String patientId; +} diff --git a/src/main/java/com/docus/server/archive/rpc/dto/ReportTaskTwoDto.java b/src/main/java/com/docus/server/archive/rpc/dto/ReportTaskTwoDto.java new file mode 100644 index 0000000..fa837fa --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/dto/ReportTaskTwoDto.java @@ -0,0 +1,19 @@ +package com.docus.server.archive.rpc.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * + */ +@Data +public class ReportTaskTwoDto { + @ApiModelProperty(value = "采集器标识") + private String collectorId; + @ApiModelProperty(value = "任务id") + private Long taskId; + @ApiModelProperty(value = "患者id") + private String patientId; + +} diff --git a/src/main/java/com/docus/server/archive/rpc/impl/DownPlatformServiceImpl.java b/src/main/java/com/docus/server/archive/rpc/impl/DownPlatformServiceImpl.java new file mode 100644 index 0000000..7215379 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/impl/DownPlatformServiceImpl.java @@ -0,0 +1,49 @@ +package com.docus.server.archive.rpc.impl; + +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; +import com.docus.core.util.Func; +import com.docus.infrastructure.web.api.CommonResult; +import com.docus.server.archive.config.DocusServerUrlConfig; +import com.docus.server.archive.rpc.DownPlatformService; +import com.docus.server.archive.rpc.dto.ReportDownDto; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * 下载平台服务接口 + * + * @author jiashi + */ +@Component +@Slf4j +public class DownPlatformServiceImpl implements DownPlatformService { + + @Resource + private DocusServerUrlConfig serverUrlConfig; + + @Override + public CommonResult report(ReportDownDto reportDownDto) { + String downUrl = serverUrlConfig.getDownloadPlatformServerUrl() + "api/downplatform/report"; + String requestId = Func.randomUUID(); + String requestParam = Func.toJson(reportDownDto); + log.info("[{}]调用下载服务,地址:{} ,参数:{}", requestId, downUrl, requestParam); + String respBody = post(downUrl, requestParam); + log.info("[{}]调用下载服务成功,响应参数:{}", requestId, respBody); + return Func.readJson(respBody, CommonResult.class); + } + + public String post(String url, String body) { + HttpRequest post = HttpUtil.createPost(url); + post.setConnectionTimeout(5 * 1000); + post.setReadTimeout(60 * 1000); + post.header("Content-Type", "application/json; charset=utf-8"); + post.body(body); + HttpResponse response = post.execute(); + return response.body(); + + } +} diff --git a/src/main/java/com/docus/server/archive/rpc/impl/TaskDistributeServiceImpl.java b/src/main/java/com/docus/server/archive/rpc/impl/TaskDistributeServiceImpl.java new file mode 100644 index 0000000..cfe851e --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/impl/TaskDistributeServiceImpl.java @@ -0,0 +1,48 @@ +package com.docus.server.archive.rpc.impl; + +import cn.hutool.http.HttpUtil; +import com.docus.core.util.Func; +import com.docus.infrastructure.web.api.CommonResult; +import com.docus.server.archive.config.DocusServerUrlConfig; +import com.docus.server.archive.rpc.TaskDistributeService; +import com.docus.server.archive.rpc.dto.ReportDownTwoDto; +import com.fasterxml.jackson.core.type.TypeReference; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + +/** + * 无视图任务服务 + * + * @author wyb + */ +@Component +@Slf4j +public class TaskDistributeServiceImpl implements TaskDistributeService { + @Resource + private DocusServerUrlConfig serverUrlConfig; + + @Override + public CommonResult getNoViewTaskByCollectorId(String collectorId) { + String getTaskUrl = serverUrlConfig.getTaskDistributeServerUrl() + "api/noviewtask/GetTask?collectid=" + collectorId; + String result = HttpUtil.get(getTaskUrl); + return Func.readJson(result, new TypeReference>() { + }); + } + + + @Override + public CommonResult cancel(Long taskId) { + String taskCancelUrl = serverUrlConfig.getTaskDistributeServerUrl() + "api/collector/task/cancel"; + Map param = new HashMap<>(1); + param.put("taskId", taskId); + log.info("任务作废 地址{},参数:{}", taskCancelUrl, param); + String resp = HttpUtil.post(taskCancelUrl, Func.toJson(param)); + log.info("任务作废结果:{}", resp); + return Func.readJson(resp, new TypeReference>() { + }); + } +} diff --git a/src/main/java/com/docus/server/archive/rpc/request/CqcAuditRequest.java b/src/main/java/com/docus/server/archive/rpc/request/CqcAuditRequest.java new file mode 100644 index 0000000..e07af34 --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/request/CqcAuditRequest.java @@ -0,0 +1,29 @@ +package com.docus.server.archive.rpc.request; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @BelongsProject: docus_medicalrecord_starter + * @BelongsPackage: com.docus.services.clinicqualitycontrol.dto + * @Author: jiashi + * @CreateTime: 2023-08-21 09:07 + * @Description: TODO + * @Version: 1.0 + */ +@Data +@ApiModel("自动质控请求参数") +public class CqcAuditRequest { + @ApiModelProperty(value = "病案主键") + private String patientId; + + @ApiModelProperty(value = "类型 1护士质控,2护士质控员质控") + private String type; + + @ApiModelProperty(value = "操作人工号") + private String userName; + + @ApiModelProperty(value = "操作人姓名") + private String name; +} diff --git a/src/main/java/com/docus/server/archive/rpc/vo/SdRyBloodReportVO.java b/src/main/java/com/docus/server/archive/rpc/vo/SdRyBloodReportVO.java new file mode 100644 index 0000000..4cf14fe --- /dev/null +++ b/src/main/java/com/docus/server/archive/rpc/vo/SdRyBloodReportVO.java @@ -0,0 +1,27 @@ +package com.docus.server.archive.rpc.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 顺德人医输血报告单 视图 + * + * @author WYBDEV + */ +@Data +@ApiModel("顺德人医血液报告单查询结果") +public class SdRyBloodReportVO { + @ApiModelProperty("文件id") + private String fileId; + @ApiModelProperty("住院号") + private String inpatientNo; + @ApiModelProperty("住院次数") + private Integer admissions; + @ApiModelProperty("保存文件名") + private String fileName; + @ApiModelProperty("文件描述标题") + private String fileDesc; + @ApiModelProperty("文件下载地址") + private String fileUrl; +} diff --git a/src/main/java/com/docus/server/archive/utils/JaxWsDynamicClientUtil.java b/src/main/java/com/docus/server/archive/utils/JaxWsDynamicClientUtil.java new file mode 100644 index 0000000..6189c6d --- /dev/null +++ b/src/main/java/com/docus/server/archive/utils/JaxWsDynamicClientUtil.java @@ -0,0 +1,69 @@ +package com.docus.server.archive.utils; + +import org.apache.cxf.endpoint.Client; +import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; +import org.apache.cxf.transport.http.HTTPConduit; +import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.xml.namespace.QName; +import java.util.Arrays; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * 使用JaxWsDynamicClientFactory 调用 webservice + * + * @author wyb + */ +public class JaxWsDynamicClientUtil { + + private static final JaxWsDynamicClientFactory CLIENT_FACTORY = JaxWsDynamicClientFactory.newInstance(); + private static final Map CLIENT_MAP = new ConcurrentHashMap<>(); + private static final Logger logger = LoggerFactory.getLogger(JaxWsDynamicClientUtil.class); + + public static String send(String wsdlUrl, String namespaceUri, String operationName, Object[] params) { + logger.info("wsdlUrl:" + wsdlUrl + " ,namespaceUri: " + namespaceUri + " ,operationName:" + operationName + ",param:" + Arrays.toString(params)); + try { + Client client = getClient(wsdlUrl); + Object[] result; + if (namespaceUri == null || namespaceUri.isEmpty()) { + result = client.invoke(operationName, params); + } else { + QName qName = new QName(namespaceUri, operationName); + result = client.invoke(qName, params); + } + logger.error("wsdlUrl:" + wsdlUrl + ",namespaceUri: " + namespaceUri + " ,operationName:" + operationName + ",param:" + Arrays.toString(params) + " 调用成功!_"+result); + if (result == null || result[0] == null) { + return null; + } + return String.valueOf(result[0]); + } catch (Exception ex) { + logger.error("wsdlUrl:" + wsdlUrl + ",namespaceUri: " + namespaceUri + " ,operationName:" + operationName + ",param:" + Arrays.toString(params) + " 调用失败了!_"+ex.getMessage(), ex); + return null; + } + } + + public static Client getClient(String wsdlUrl) { + if (CLIENT_MAP.get(wsdlUrl) == null) { + synchronized (JaxWsDynamicClientUtil.class) { + if (CLIENT_MAP.get(wsdlUrl) == null) { + Client client = CLIENT_FACTORY.createClient(wsdlUrl); + setClientParam(client); + CLIENT_MAP.put(wsdlUrl, client); + } + } + } + return CLIENT_MAP.get(wsdlUrl); + } + + private static void setClientParam(Client client) { + HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); + httpClientPolicy.setConnectionTimeout(30 * 1000); + httpClientPolicy.setAllowChunking(false); + httpClientPolicy.setReceiveTimeout(30 * 1000); + HTTPConduit clientConduit = (HTTPConduit) client.getConduit(); + clientConduit.setClient(httpClientPolicy); + } +} diff --git a/src/main/java/com/docus/server/archive/utils/XmlUtil.java b/src/main/java/com/docus/server/archive/utils/XmlUtil.java new file mode 100644 index 0000000..01d528b --- /dev/null +++ b/src/main/java/com/docus/server/archive/utils/XmlUtil.java @@ -0,0 +1,857 @@ +/* + * Copyright (c) 2018-2028, DreamLu All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: DreamLu 卢春梦 (596392912@qq.com) + */ +package com.docus.server.archive.utils; + +import com.docus.core.util.Exceptions; +import com.docus.core.util.IoUtil; +import org.springframework.lang.Nullable; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringReader; +import java.util.HashMap; +import java.util.Map; + +/** + * xpath解析xml + * + *
+ *     文档地址:
+ *     http://www.w3school.com.cn/xpath/index.asp
+ * 
+ * + * @author L.cm + */ +public class XmlUtil { + private final XPath path; + private final Document doc; + + private XmlUtil(InputSource inputSource) throws ParserConfigurationException, SAXException, IOException { + DocumentBuilderFactory dbf = getDocumentBuilderFactory(); + DocumentBuilder db = dbf.newDocumentBuilder(); + doc = db.parse(inputSource); + path = getXPathFactory().newXPath(); + } + + /** + * 创建工具类 + * + * @param inputSource inputSource + * @return XmlUtil + */ + private static XmlUtil create(InputSource inputSource) { + try { + return new XmlUtil(inputSource); + } catch (ParserConfigurationException | SAXException | IOException e) { + throw Exceptions.unchecked(e); + } + } + + /** + * 转换工具类 + * + * @param inputStream inputStream + * @return XmlUtil + */ + public static XmlUtil of(InputStream inputStream) { + InputSource inputSource = new InputSource(inputStream); + return create(inputSource); + } + + /** + * 转换工具类 + * + * @param xmlStr xmlStr + * @return XmlUtil + */ + public static XmlUtil of(String xmlStr) { + StringReader sr = new StringReader(xmlStr.trim()); + InputSource inputSource = new InputSource(sr); + XmlUtil xmlUtil = create(inputSource); + IoUtil.closeQuietly(sr); + return xmlUtil; + } + + /** + * 转换路径 + * + * @param expression 表达式 + * @param item 实体 + * @param returnType 返回类型 + * @return Object + */ + private Object evalXPath(String expression, @Nullable Object item, QName returnType) { + item = null == item ? doc : item; + try { + return path.evaluate(expression, item, returnType); + } catch (XPathExpressionException e) { + throw Exceptions.unchecked(e); + } + } + + /** + * 获取String + * + * @param expression 路径 + * @return {String} + */ + public String getString(String expression) { + return (String) evalXPath(expression, null, XPathConstants.STRING); + } + + /** + * 获取Boolean + * + * @param expression 路径 + * @return {String} + */ + public Boolean getBoolean(String expression) { + return (Boolean) evalXPath(expression, null, XPathConstants.BOOLEAN); + } + + /** + * 获取Number + * + * @param expression 路径 + * @return {Number} + */ + public Number getNumber(String expression) { + return (Number) evalXPath(expression, null, XPathConstants.NUMBER); + } + + /** + * 获取某个节点 + * + * @param expression 路径 + * @return {Node} + */ + public Node getNode(String expression) { + return (Node) evalXPath(expression, null, XPathConstants.NODE); + } + + /** + * 获取子节点 + * + * @param expression 路径 + * @return NodeList + */ + public NodeList getNodeList(String expression) { + return (NodeList) evalXPath(expression, null, XPathConstants.NODESET); + } + + + /** + * 获取String + * + * @param node 节点 + * @param expression 相对于node的路径 + * @return {String} + */ + public String getString(Object node, String expression) { + return (String) evalXPath(expression, node, XPathConstants.STRING); + } + + /** + * 获取 + * + * @param node 节点 + * @param expression 相对于node的路径 + * @return {String} + */ + public Boolean getBoolean(Object node, String expression) { + return (Boolean) evalXPath(expression, node, XPathConstants.BOOLEAN); + } + + /** + * 获取 + * + * @param node 节点 + * @param expression 相对于node的路径 + * @return {Number} + */ + public Number getNumber(Object node, String expression) { + return (Number) evalXPath(expression, node, XPathConstants.NUMBER); + } + + /** + * 获取某个节点 + * + * @param node 节点 + * @param expression 路径 + * @return {Node} + */ + public Node getNode(Object node, String expression) { + return (Node) evalXPath(expression, node, XPathConstants.NODE); + } + + /** + * 获取子节点 + * + * @param node 节点 + * @param expression 相对于node的路径 + * @return NodeList + */ + public NodeList getNodeList(Object node, String expression) { + return (NodeList) evalXPath(expression, node, XPathConstants.NODESET); + } + + /** + * 针对没有嵌套节点的简单处理 + * + * @return map集合 + */ + public Map toMap() { + Element root = doc.getDocumentElement(); + Map params = new HashMap<>(16); + + // 将节点封装成map形式 + NodeList list = root.getChildNodes(); + for (int i = 0; i < list.getLength(); i++) { + Node node = list.item(i); + if (node instanceof Element) { + params.put(node.getNodeName(), node.getTextContent()); + } + } + return params; + } + + private static volatile boolean preventedXXE = false; + + private static DocumentBuilderFactory getDocumentBuilderFactory() throws ParserConfigurationException { + DocumentBuilderFactory dbf = XmlHelperHolder.documentBuilderFactory; + if (!preventedXXE) { + synchronized (XmlUtil.class) { + if (!preventedXXE) { + preventXXE(dbf); + } + } + } + return dbf; + } + + /** + * preventXXE + * + * @param dbf + * @throws ParserConfigurationException + */ + private static void preventXXE(DocumentBuilderFactory dbf) throws ParserConfigurationException { + // This is the PRIMARY defense. If DTDs (doctypes) are disallowed, almost all XML entity attacks are prevented + // Xerces 2 only - http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); + + // If you can't completely disable DTDs, then at least do the following: + // Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-general-entities + // Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-general-entities + + // JDK7+ - http://xml.org/sax/features/external-general-entities + dbf.setFeature("http://xml.org/sax/features/external-general-entities", false); + + // Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-parameter-entities + // Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-parameter-entities + + // JDK7+ - http://xml.org/sax/features/external-parameter-entities + dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + + // Disable external DTDs as well + dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); + + // and these as well, per Timothy Morgan's 2014 paper: "XML Schema, DTD, and Entity Attacks" + dbf.setXIncludeAware(false); + dbf.setExpandEntityReferences(false); + preventedXXE = true; + } + + private static XPathFactory getXPathFactory() { + return XmlHelperHolder.xPathFactory; + } + + /** + * 内部类单例 + */ + private static class XmlHelperHolder { + private static DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + private static XPathFactory xPathFactory = XPathFactory.newInstance(); + } + private static String str; + static { + str=" \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 59 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 205室 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 耳鼻咽喉头颈外科 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 2号楼16楼西区 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 南方医科大学顺德医院 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 突发特发性听觉丧失 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 常规 \n" + + " \n" + + " \n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 治愈 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 张存良 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 耳鼻咽喉头颈外科 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 突发特发性听觉丧失 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 文本 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 乳房病类 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 治愈 \n" + + " \n" + + " O \n" + + " \n" + + " 0 \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 01 \n" + + " \n" + + " 出院医嘱 \n" + + " \n" + + "
\n"; + } + + public static void main(String[] args) { + XmlUtil a=XmlUtil.of(str); + Node node=null; + //id-消息流水号 + node = a.getNode("/PRPA_HIP0032/id/@extension"); + String serialId = node.toString(); + System.out.println(serialId); + //住院流水号 + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/item/@extension"); + String jzh = node.toString(); + System.out.println(jzh); + //住院号标识 + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/id/item/@extension"); + String inpatientNo = node.toString(); + System.out.println(inpatientNo); + //住院次数[] + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/lengthOfStayQuantity[@unit='次']/@value"); + String admissTimes=node.toString(); + System.out.println(admissTimes); + //姓名 + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/subject/patient/patientPerson/name/item/part/@value"); + String name = node.toString(); + System.out.println(name); + //入院日期时间 + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/effectiveTime/low/@value"); + String admissDate = node.toString(); + System.out.println(admissDate); + //出院日期时间 + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/effectiveTime/high/@value"); + String disDate = node.toString(); + System.out.println(disDate); + //入院诊断科室名称[] + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/component[@displayName='入院诊断']/section/entry[@displayName='入院诊断-西医条目']/observation/performer/assignedEntity/representedOrganization/name"); + String admissDeptName = node.getTextContent(); + System.out.println(admissDeptName); + //出院诊断科室名称[] + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/component[@displayName='出院诊断']/section/entry[@displayName='出院诊断-西医条目']/observation/performer/assignedEntity/representedOrganization/name"); + String disDeptName = node.getTextContent(); + System.out.println(disDeptName); + //主治医师[] + node = a.getNode("/PRPA_HIP0032/controlActProcess/subject/encounterEvent/authenticator[@displayName='主治医师']/assignedEntity/assignedPerson/name"); + String attendingName = node.getTextContent(); + System.out.println(attendingName); + } +} diff --git a/src/main/java/com/docus/server/fsy/api/LisReportService.java b/src/main/java/com/docus/server/fsy/api/LisReportService.java new file mode 100644 index 0000000..40611f8 --- /dev/null +++ b/src/main/java/com/docus/server/fsy/api/LisReportService.java @@ -0,0 +1,30 @@ +package com.docus.server.fsy.api; + +import com.docus.server.fsy.api.dto.LisPatientListRequest; +import com.docus.server.fsy.api.dto.LisPatientListResponse; +import com.docus.server.fsy.api.dto.LisPatientReportRequest; +import com.docus.server.fsy.api.dto.LisPatientReportResponse; + +/** + * @author YongBin Wen + * @date 2024/3/29 10:20 + */ +public interface LisReportService { + + /** + * 获取检验列表 + * + * @param request 参数 + * @return 检验列表 + */ + LisPatientListResponse getPatientList(LisPatientListRequest request); + + + /** + * 获取PDF报告 + * + * @param request 参数 + * @return 报告信息 + */ + LisPatientReportResponse getPatientReport(LisPatientReportRequest request); +} diff --git a/src/main/java/com/docus/server/fsy/api/dto/LisPatientListRequest.java b/src/main/java/com/docus/server/fsy/api/dto/LisPatientListRequest.java new file mode 100644 index 0000000..95e2342 --- /dev/null +++ b/src/main/java/com/docus/server/fsy/api/dto/LisPatientListRequest.java @@ -0,0 +1,27 @@ +package com.docus.server.fsy.api.dto; + +import lombok.Data; + +/** + * @author YongBin Wen + * @date 2024/3/29 10:26 + */ +@Data +public class LisPatientListRequest { + /** + * 门诊、住院号 + */ + private String pidInNo; + /** + * 住院次数 + */ + private Integer pidAddmissTimes; + /** + * 时间范围:开始时间 + */ + private String startDate; + /** + * 时间范围:结束时间 + */ + private String endDate; +} diff --git a/src/main/java/com/docus/server/fsy/api/dto/LisPatientListResponse.java b/src/main/java/com/docus/server/fsy/api/dto/LisPatientListResponse.java new file mode 100644 index 0000000..e0106fa --- /dev/null +++ b/src/main/java/com/docus/server/fsy/api/dto/LisPatientListResponse.java @@ -0,0 +1,41 @@ +package com.docus.server.fsy.api.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @author YongBin Wen + * @date 2024/3/29 10:26 + */ +@Data +public class LisPatientListResponse { + /** + * 检验患者列表 + */ + List patientList; + + @Data + public static class Patient { + /** + * 住院号 + */ + private String pidInNo; + /** + * 住院次数 + */ + private String pidAddmissTimes; + /** + * 报告单号 + */ + private String repId; + /** + * 检查项目 + */ + private String pidComName; + /** + * 检测日期 + */ + private String repInDate; + } +} diff --git a/src/main/java/com/docus/server/fsy/api/dto/LisPatientReportRequest.java b/src/main/java/com/docus/server/fsy/api/dto/LisPatientReportRequest.java new file mode 100644 index 0000000..6530f0b --- /dev/null +++ b/src/main/java/com/docus/server/fsy/api/dto/LisPatientReportRequest.java @@ -0,0 +1,19 @@ +package com.docus.server.fsy.api.dto; + +import lombok.Data; + +/** + * @author YongBin Wen + * @date 2024/3/29 10:22 + */ +@Data +public class LisPatientReportRequest { + /** + * 报告单号 + */ + private String repId; + /** + * 中英文报告(中文传空,获取英文报告传参英文) + */ + private String customReportSuffix; +} diff --git a/src/main/java/com/docus/server/fsy/api/dto/LisPatientReportResponse.java b/src/main/java/com/docus/server/fsy/api/dto/LisPatientReportResponse.java new file mode 100644 index 0000000..5a00cf2 --- /dev/null +++ b/src/main/java/com/docus/server/fsy/api/dto/LisPatientReportResponse.java @@ -0,0 +1,19 @@ +package com.docus.server.fsy.api.dto; + +import lombok.Data; + +/** + * @author YongBin Wen + * @date 2024/3/29 10:22 + */ +@Data +public class LisPatientReportResponse { + /** + * 报告单号 + */ + private String repId; + /** + * PDF,base64 + */ + private String patientReport; +} diff --git a/src/main/java/com/docus/server/fsy/converter/LisReportConverter.java b/src/main/java/com/docus/server/fsy/converter/LisReportConverter.java new file mode 100644 index 0000000..9c5bf9a --- /dev/null +++ b/src/main/java/com/docus/server/fsy/converter/LisReportConverter.java @@ -0,0 +1,160 @@ +package com.docus.server.fsy.converter; + +import com.docus.core.util.Func; +import com.docus.server.archive.rpc.dto.ReportDownDto; +import com.docus.server.archive.rpc.dto.ReportDownPatientDto; +import com.docus.server.archive.rpc.dto.ReportDownScanFileDto; +import com.docus.server.archive.rpc.dto.ReportDownTwoDto; +import com.docus.server.archive.utils.XmlUtil; +import com.docus.server.fsy.api.dto.LisPatientListRequest; +import com.docus.server.fsy.api.dto.LisPatientListResponse; +import com.docus.server.fsy.api.dto.LisPatientReportRequest; +import com.docus.server.fsy.api.dto.LisPatientReportResponse; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * @author YongBin Wen + * @date 2024/3/29 10:24 + */ +public class LisReportConverter { + /** + * test-pass + */ + public static String convertWsParam(LisPatientListRequest request) { + String pidInNo = Func.isBlank(request.getPidInNo()) ? "" : request.getPidInNo(); + String pidAddmissTimes = Objects.isNull(request.getPidAddmissTimes()) ? "" : request.getPidAddmissTimes().toString(); + String startDate = Func.isBlank(request.getStartDate()) ? "" : request.getStartDate(); + String endDate = Func.isBlank(request.getEndDate()) ? "" : request.getEndDate(); + + return "\n" + + " " + pidInNo + "\n" + + " " + pidAddmissTimes + "\n" + + " " + startDate + "\n" + + " " + endDate + "\n" + + ""; + } + + /** + * test-pass + */ + public static String convertWsParam(LisPatientReportRequest request) { + String repId = Func.isBlank(request.getRepId()) ? "" : request.getRepId(); + String customReportSuffix = Func.isBlank(request.getCustomReportSuffix()) ? "" : request.getCustomReportSuffix(); + + return "\n" + + " " + repId + "\n" + + " " + customReportSuffix + "\n" + + ""; + } + + /** + * test-pass + */ + public static LisPatientListResponse convertWsPatientListResponse(String result) { + if (Func.isBlank(result)) { + return null; + } + XmlUtil xmlUtil = XmlUtil.of(result); + if (wsIsFailed(xmlUtil)) { + return null; + } + ArrayList patients = new ArrayList<>(); + NodeList pidReportMainNodeList = xmlUtil.getNodeList("/Response/Result/PidReportMain"); + int mainNodeListLength = pidReportMainNodeList.getLength(); + for (int i = 0; i < mainNodeListLength; i++) { + Node pidReportMainNode = pidReportMainNodeList.item(i); + NodeList childNodes = pidReportMainNode.getChildNodes(); + int childNodesLength = childNodes.getLength(); + LisPatientListResponse.Patient patient = new LisPatientListResponse.Patient(); + for (int j = 0; j < childNodesLength; j++) { + Node node = childNodes.item(j); + if ("PidInNo".equals(node.getNodeName())) { + patient.setPidInNo(node.getTextContent()); + continue; + } + if ("PidAddmissTimes".equals(node.getNodeName())) { + patient.setPidAddmissTimes(node.getTextContent()); + continue; + } + if ("RepId".equals(node.getNodeName())) { + patient.setRepId(node.getTextContent()); + continue; + } + if ("PidComName".equals(node.getNodeName())) { + patient.setPidComName(node.getTextContent()); + continue; + } + if ("RepInDate".equals(node.getNodeName())) { + patient.setRepInDate(node.getTextContent()); + } + } + patients.add(patient); + } + + LisPatientListResponse response = new LisPatientListResponse(); + response.setPatientList(patients); + return response; + } + + /** + * test-pass + */ + public static LisPatientReportResponse convertWsPatientReportResponse(String result) { + if (Func.isBlank(result)) { + return null; + } + XmlUtil xmlUtil = XmlUtil.of(result); + if (wsIsFailed(xmlUtil)) { + return null; + } + Node repIdNode = xmlUtil.getNode("/Response/Result/Patient/RepId"); + Node patientReportNode = xmlUtil.getNode("/Response/Result/Patient/PatientReport"); + LisPatientReportResponse response = new LisPatientReportResponse(); + response.setRepId(repIdNode.getTextContent()); + response.setPatientReport(patientReportNode.getTextContent()); + return response; + } + + /** + * test-pass + */ + public static boolean wsIsFailed(XmlUtil xmlUtil) { + Node resultCodeNode = xmlUtil.getNode("/Response/ResultCode"); + String failedCode = "1"; + return resultCodeNode == null || failedCode.equals(resultCodeNode.getTextContent()); + } + + /** + * 根据任务信息,获得的患者报告信息转换上报下载服务参数 + */ + public static ReportDownDto convertDownloadPlatform(ReportDownTwoDto reportDownTwoDto, LisPatientListResponse.Patient patient, LisPatientReportResponse reportResponse) { + ReportDownScanFileDto scanFileDto = new ReportDownScanFileDto(); + scanFileDto.setTaskid(reportDownTwoDto.getTasks().get(0).getTaskId()); + scanFileDto.setFiletitle(patient.getPidComName()); + scanFileDto.setFilesource(1); + scanFileDto.setFilestoragetype(1); + scanFileDto.setFiletype(2); + scanFileDto.setDownurl(reportResponse.getPatientReport()); + scanFileDto.setSerialnum(reportResponse.getRepId()); + + + List scanfiles = new ArrayList<>(); + scanfiles.add(scanFileDto); + + ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto(); + reportDownPatientDto.setPatientid(reportDownTwoDto.getPatientId()); + + ReportDownDto reportDownDto = new ReportDownDto(); + reportDownDto.setIp("ws-java"); + reportDownDto.setScanusercode("ws-java"); + reportDownDto.setScanusername("ws-java-"); + reportDownDto.setPatient(reportDownPatientDto); + reportDownDto.setScanfiles(scanfiles); + return reportDownDto; + } +} diff --git a/src/main/java/com/docus/server/fsy/service/impl/LisReportServiceImpl.java b/src/main/java/com/docus/server/fsy/service/impl/LisReportServiceImpl.java new file mode 100644 index 0000000..6c0f425 --- /dev/null +++ b/src/main/java/com/docus/server/fsy/service/impl/LisReportServiceImpl.java @@ -0,0 +1,45 @@ +package com.docus.server.fsy.service.impl; + +import com.docus.server.archive.utils.JaxWsDynamicClientUtil; +import com.docus.server.fsy.api.LisReportService; +import com.docus.server.fsy.api.dto.LisPatientListRequest; +import com.docus.server.fsy.api.dto.LisPatientListResponse; +import com.docus.server.fsy.api.dto.LisPatientReportRequest; +import com.docus.server.fsy.api.dto.LisPatientReportResponse; +import com.docus.server.fsy.converter.LisReportConverter; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +/** + * @author YongBin Wen + * @date 2024/3/29 10:20 + */ +@Service +@Slf4j +public class LisReportServiceImpl implements LisReportService { + @Value("${fsy.lis.ws-url}") + private String lisUrl; + + @Override + public LisPatientListResponse getPatientList(LisPatientListRequest request) { + final String method="GetPatientList"; + Object[] params = new Object[2]; + params[0]=method; + params[1]=LisReportConverter.convertWsParam(request);; + String result = JaxWsDynamicClientUtil.send(lisUrl, null, "DCLInterface", params); + return LisReportConverter.convertWsPatientListResponse(result); + } + + @Override + public LisPatientReportResponse getPatientReport(LisPatientReportRequest request) { + final String method="GetPatientReport"; + Object[] params = new Object[2]; + params[0]=method; + params[1]= LisReportConverter.convertWsParam(request); + String result = JaxWsDynamicClientUtil.send(lisUrl, null, "DCLInterface", params); + return LisReportConverter.convertWsPatientReportResponse(result); + } + + +} diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml index 22d35b9..57a690d 100644 --- a/src/main/resources/bootstrap.yml +++ b/src/main/resources/bootstrap.yml @@ -70,14 +70,20 @@ spring: shared-configs: - comm.${spring.cloud.nacos.config.file-extension} +fsy: + lis: + ws-url: http://10.100.23.96:8095/DCLService.asmx + sysflag: 6 + assortid: 1213131 docus: url: # 采集任务补偿地址 - compensate-task-url: http://localhost:9295/ - # 下载地址 - down-url: http://localhost:9291/api/downplatform/report - medicalrecord: http://192.168.16.85:9102 + viewcollect-server: http://localhost:9295/ + # 报告上报地址 + downploadlatform-server: http://localhost:9291/ + # 获取无视图模式采集任务地址 + taskdistribute-server: http://localhost:9296/ dbtype: mysql