From 004b4b84edd31971308e4348cca5a8e80bf3620d Mon Sep 17 00:00:00 2001 From: wyb <1977763549@qq.com> Date: Mon, 17 Nov 2025 21:49:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=88=9D=E5=A7=8B=E5=8C=96=E5=B9=BF?= =?UTF-8?q?=E4=B8=9C=E7=9C=81=E4=B8=AD=E5=8C=BB=EF=BC=8C=E4=BD=8F=E9=99=A2?= =?UTF-8?q?=E7=94=B5=E5=AD=90=E7=97=85=E5=8E=86=E5=92=8C=E4=BD=8F=E9=99=A2?= =?UTF-8?q?=E6=8A=A4=E7=90=86=E6=8E=A8=E9=80=81=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 36 ++ dataConfig/EmrPushConf.json | 4 + dataConfig/NursingPushConf.json | 4 + dataConfig/homeQualitySet.json | 78 +++ pom.xml | 161 ++++++ .../java/com/docus/bgts/DemoApplication.java | 19 + .../com/docus/bgts/config/BaseException.java | 58 +++ .../com/docus/bgts/config/CommonResult.java | 45 ++ .../bgts/config/DocusServerUrlConfig.java | 20 + .../docus/bgts/config/EmptyWebService.java | 17 + .../docus/bgts/config/IEmptyWebService.java | 16 + .../com/docus/bgts/config/IErrorCode.java | 12 + .../docus/bgts/config/MybatisPlusConfig.java | 74 +++ .../com/docus/bgts/config/ResultCode.java | 34 ++ .../docus/bgts/config/ThreadPoolConfig.java | 27 + .../docus/bgts/config/WebServiceConfig.java | 53 ++ .../docus/bgts/emr/convert/EmrWsConvert.java | 82 +++ .../java/com/docus/bgts/emr/dto/EmrInfo.java | 49 ++ .../bgts/emr/dto/SystemCollectConfig.java | 41 ++ .../java/com/docus/bgts/emr/enums/Codes.java | 34 ++ .../docus/bgts/emr/handler/EmrWebService.java | 476 ++++++++++++++++++ .../bgts/emr/handler/IEmrWebService.java | 21 + .../nursing/convert/NursingWsConvert.java | 65 +++ .../docus/bgts/nursing/dto/NursingInfo.java | 35 ++ .../nursing/handler/INursingWebService.java | 21 + .../nursing/handler/NursingWebService.java | 450 +++++++++++++++++ .../docus/bgts/rpc/DownPlatformService.java | 23 + .../com/docus/bgts/rpc/dto/ReportDownDto.java | 30 ++ .../bgts/rpc/dto/ReportDownPatientDto.java | 20 + .../bgts/rpc/dto/ReportDownScanFileDto.java | 34 ++ .../rpc/impl/DownPlatformServiceImpl.java | 56 +++ .../java/com/docus/bgts/utils/FileUtils.java | 40 ++ .../java/com/docus/bgts/utils/HttpUtils.java | 191 +++++++ .../java/com/docus/bgts/utils/JsonUtils.java | 52 ++ .../com/docus/bgts/utils/TableJsonRead.java | 205 ++++++++ .../java/com/docus/bgts/utils/XmlUtil.java | 315 ++++++++++++ .../java/com/docus/bgts/utils/XmlUtils.java | 104 ++++ .../docus/bgts/wzh/entity/AfCollectTask.java | 56 +++ .../bgts/wzh/entity/AfInterfaceCollect.java | 30 ++ .../wzh/entity/AfInterfaceCollectSub.java | 33 ++ .../com/docus/bgts/wzh/entity/CanlcelDto.java | 18 + .../docus/bgts/wzh/entity/CqcSubmitState.java | 17 + .../docus/bgts/wzh/entity/MrReportError.java | 25 + .../com/docus/bgts/wzh/entity/TBasic.java | 173 +++++++ .../docus/bgts/wzh/entity/TBasicExtend.java | 45 ++ .../com/docus/bgts/wzh/entity/ZdAssort.java | 36 ++ .../wzh/facade/IAfCollectTaskService.java | 58 +++ .../wzh/facade/IMrReportErrorService.java | 10 + .../bgts/wzh/mapper/AfCollectTaskMapper.java | 49 ++ .../wzh/mapper/AfInterfaceCollectMapper.java | 12 + .../mapper/AfInterfaceCollectSubMapper.java | 12 + .../bgts/wzh/mapper/MrReportErrorMapper.java | 13 + .../bgts/wzh/mapper/TBasicExtendMapper.java | 17 + .../docus/bgts/wzh/mapper/TBasicMapper.java | 17 + .../bgts/wzh/mapper/TScanAssortMapper.java | 14 + .../wzh/service/AfCollectTaskServiceImpl.java | 401 +++++++++++++++ .../wzh/service/MrReportErrorServiceImpl.java | 35 ++ src/main/resources/application.yml | 34 ++ src/main/resources/logback-spring.xml | 51 ++ .../resources/mapper/AfCollectTaskMapper.xml | 112 +++++ .../resources/mapper/MrReportErrorMapper.xml | 12 + .../resources/mapper/TBasicExtendMapper.xml | 27 + src/main/resources/mapper/TBasicMapper.xml | 76 +++ .../resources/mapper/TScanAssortMapper.xml | 10 + 64 files changed, 4395 insertions(+) create mode 100644 .gitignore create mode 100644 dataConfig/EmrPushConf.json create mode 100644 dataConfig/NursingPushConf.json create mode 100644 dataConfig/homeQualitySet.json create mode 100644 pom.xml create mode 100644 src/main/java/com/docus/bgts/DemoApplication.java create mode 100644 src/main/java/com/docus/bgts/config/BaseException.java create mode 100644 src/main/java/com/docus/bgts/config/CommonResult.java create mode 100644 src/main/java/com/docus/bgts/config/DocusServerUrlConfig.java create mode 100644 src/main/java/com/docus/bgts/config/EmptyWebService.java create mode 100644 src/main/java/com/docus/bgts/config/IEmptyWebService.java create mode 100644 src/main/java/com/docus/bgts/config/IErrorCode.java create mode 100644 src/main/java/com/docus/bgts/config/MybatisPlusConfig.java create mode 100644 src/main/java/com/docus/bgts/config/ResultCode.java create mode 100644 src/main/java/com/docus/bgts/config/ThreadPoolConfig.java create mode 100644 src/main/java/com/docus/bgts/config/WebServiceConfig.java create mode 100644 src/main/java/com/docus/bgts/emr/convert/EmrWsConvert.java create mode 100644 src/main/java/com/docus/bgts/emr/dto/EmrInfo.java create mode 100644 src/main/java/com/docus/bgts/emr/dto/SystemCollectConfig.java create mode 100644 src/main/java/com/docus/bgts/emr/enums/Codes.java create mode 100644 src/main/java/com/docus/bgts/emr/handler/EmrWebService.java create mode 100644 src/main/java/com/docus/bgts/emr/handler/IEmrWebService.java create mode 100644 src/main/java/com/docus/bgts/nursing/convert/NursingWsConvert.java create mode 100644 src/main/java/com/docus/bgts/nursing/dto/NursingInfo.java create mode 100644 src/main/java/com/docus/bgts/nursing/handler/INursingWebService.java create mode 100644 src/main/java/com/docus/bgts/nursing/handler/NursingWebService.java create mode 100644 src/main/java/com/docus/bgts/rpc/DownPlatformService.java create mode 100644 src/main/java/com/docus/bgts/rpc/dto/ReportDownDto.java create mode 100644 src/main/java/com/docus/bgts/rpc/dto/ReportDownPatientDto.java create mode 100644 src/main/java/com/docus/bgts/rpc/dto/ReportDownScanFileDto.java create mode 100644 src/main/java/com/docus/bgts/rpc/impl/DownPlatformServiceImpl.java create mode 100644 src/main/java/com/docus/bgts/utils/FileUtils.java create mode 100644 src/main/java/com/docus/bgts/utils/HttpUtils.java create mode 100644 src/main/java/com/docus/bgts/utils/JsonUtils.java create mode 100644 src/main/java/com/docus/bgts/utils/TableJsonRead.java create mode 100644 src/main/java/com/docus/bgts/utils/XmlUtil.java create mode 100644 src/main/java/com/docus/bgts/utils/XmlUtils.java create mode 100644 src/main/java/com/docus/bgts/wzh/entity/AfCollectTask.java create mode 100644 src/main/java/com/docus/bgts/wzh/entity/AfInterfaceCollect.java create mode 100644 src/main/java/com/docus/bgts/wzh/entity/AfInterfaceCollectSub.java create mode 100644 src/main/java/com/docus/bgts/wzh/entity/CanlcelDto.java create mode 100644 src/main/java/com/docus/bgts/wzh/entity/CqcSubmitState.java create mode 100644 src/main/java/com/docus/bgts/wzh/entity/MrReportError.java create mode 100644 src/main/java/com/docus/bgts/wzh/entity/TBasic.java create mode 100644 src/main/java/com/docus/bgts/wzh/entity/TBasicExtend.java create mode 100644 src/main/java/com/docus/bgts/wzh/entity/ZdAssort.java create mode 100644 src/main/java/com/docus/bgts/wzh/facade/IAfCollectTaskService.java create mode 100644 src/main/java/com/docus/bgts/wzh/facade/IMrReportErrorService.java create mode 100644 src/main/java/com/docus/bgts/wzh/mapper/AfCollectTaskMapper.java create mode 100644 src/main/java/com/docus/bgts/wzh/mapper/AfInterfaceCollectMapper.java create mode 100644 src/main/java/com/docus/bgts/wzh/mapper/AfInterfaceCollectSubMapper.java create mode 100644 src/main/java/com/docus/bgts/wzh/mapper/MrReportErrorMapper.java create mode 100644 src/main/java/com/docus/bgts/wzh/mapper/TBasicExtendMapper.java create mode 100644 src/main/java/com/docus/bgts/wzh/mapper/TBasicMapper.java create mode 100644 src/main/java/com/docus/bgts/wzh/mapper/TScanAssortMapper.java create mode 100644 src/main/java/com/docus/bgts/wzh/service/AfCollectTaskServiceImpl.java create mode 100644 src/main/java/com/docus/bgts/wzh/service/MrReportErrorServiceImpl.java create mode 100644 src/main/resources/application.yml create mode 100644 src/main/resources/logback-spring.xml create mode 100644 src/main/resources/mapper/AfCollectTaskMapper.xml create mode 100644 src/main/resources/mapper/MrReportErrorMapper.xml create mode 100644 src/main/resources/mapper/TBasicExtendMapper.xml create mode 100644 src/main/resources/mapper/TBasicMapper.xml create mode 100644 src/main/resources/mapper/TScanAssortMapper.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..edc0d20 --- /dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +docus-services/docus-services-system1/ + +### IntelliJ IDEA ### +*.log +.idea +*.iws +*.iml +*.ipr +mvnw* +*.cmd +*.mvn +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ +logs* +rebel.xml \ No newline at end of file diff --git a/dataConfig/EmrPushConf.json b/dataConfig/EmrPushConf.json new file mode 100644 index 0000000..6704532 --- /dev/null +++ b/dataConfig/EmrPushConf.json @@ -0,0 +1,4 @@ +{ + "assortId": "xxxxId", + "collectorId": "22" +} \ No newline at end of file diff --git a/dataConfig/NursingPushConf.json b/dataConfig/NursingPushConf.json new file mode 100644 index 0000000..6a15e65 --- /dev/null +++ b/dataConfig/NursingPushConf.json @@ -0,0 +1,4 @@ +{ + "assortId": "hlxxxxId", + "collectorId": "1" +} \ No newline at end of file diff --git a/dataConfig/homeQualitySet.json b/dataConfig/homeQualitySet.json new file mode 100644 index 0000000..95ac36a --- /dev/null +++ b/dataConfig/homeQualitySet.json @@ -0,0 +1,78 @@ +{ + //----------响应标签------------- + //外部结构,多层,隔开 + "ResHead":"Response,RetInfo", + //响应代码 + "ResCode":"RetCode", + //响应消息 + "ResMsg":"RetCon", + //成功编码 + "successCode":"0", + //失败编码 + "errorCode":"1", + + //唯一键目录结构数组,最高层为前面,最后一层为数据采集层,根节点不填 + "directory":["Msg"], + //患者主索引号 + "indexFlag":"INHOSP_NO", + //采集流水号 + "serialnum":"IDNO", + //文件标题 + "filetitle":"FILENAME", + //排序时间 + "sortingTime":"MIN_TIME", + //医生提交时间 + "doctorSubmitTime": "SUBMIT_TIME", + //提交人姓名 + "submitName":"REC_SUB_NAME", + //下载地址,&代表多个选其一 + "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":[""], + //封存病历的上传接口 + "sealUpload":"http://192.9.100.171:9291/api/downplatform/sealReport", + //可能存在存储基本数据不同情况的标签 + "doubleBasic":["ITEM"], + //封存id + "sealId":"SEAL_ID", + //--------------采集操作判断撤销/新增--------------- + //是否开启采集操作判断撤销/新增 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/pom.xml b/pom.xml new file mode 100644 index 0000000..4c38c56 --- /dev/null +++ b/pom.xml @@ -0,0 +1,161 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.5.6 + + + com.docus + docus-gdszy-report + 0.0.1-SNAPSHOT + docus-gdszy-report + 广东省中医院报告服务 + + 1.8 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter + + + + org.dom4j + dom4j + 2.1.1 + + + + + com.alibaba + fastjson + 1.2.75 + + + mysql + mysql-connector-java + 8.0.15 + + + + org.projectlombok + lombok + 1.16.14 + + + com.docus + docus-tool-starter + 1.0-SNAPSHOT + + + com.spring4all + swagger-spring-boot-starter + 1.9.0.RELEASE + + + + org.apache.commons + commons-lang3 + 3.4 + + + com.baomidou + mybatis-plus-boot-starter + 3.3.0 + + + org.springframework.boot + spring-boot-starter-test + test + + + org.apache.httpcomponents + httpcore + 4.4.5 + + + org.apache.httpcomponents + httpclient + 4.5.2 + + + org.apache.httpcomponents + httpmime + 4.4 + + + + org.apache.axis + axis + 1.4 + + + + org.apache.axis + axis-jaxrpc + 1.4 + + + + commons-discovery + commons-discovery + 0.2 + + + + commons-logging + commons-logging + 1.1.1 + + + + wsdl4j + wsdl4j + 1.6.2 + + + org.apache.axis + axis + 1.4 + + + commons-discovery + commons-discovery + 0.2 + + + commons-logging + commons-logging + + + + + org.apache.axis + axis-jaxrpc + 1.4 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/src/main/java/com/docus/bgts/DemoApplication.java b/src/main/java/com/docus/bgts/DemoApplication.java new file mode 100644 index 0000000..cc06d66 --- /dev/null +++ b/src/main/java/com/docus/bgts/DemoApplication.java @@ -0,0 +1,19 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; + +@EnableScheduling +@SpringBootApplication +public class DemoApplication { + public static void main(String[] args) { + System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"); + SpringApplication.run(DemoApplication.class, args); + } +} diff --git a/src/main/java/com/docus/bgts/config/BaseException.java b/src/main/java/com/docus/bgts/config/BaseException.java new file mode 100644 index 0000000..4099f37 --- /dev/null +++ b/src/main/java/com/docus/bgts/config/BaseException.java @@ -0,0 +1,58 @@ +package com.docus.bgts.config; + + +/** + * @Description 自定义异常 + * @Author JacksonTu + * @Date 2018/12/10 13:59 + */ + + +public class BaseException extends RuntimeException implements IErrorCode { + + + + /** + * 异常编码 + */ + private String msgCode; + /** + * 异常信息 + */ + private String message; + + + + public BaseException(IErrorCode errorCode) { + super(errorCode.getMessage()); + this.msgCode = errorCode.getCode(); + this.message = errorCode.getMessage(); + } + + + public BaseException(IErrorCode errorCode,String msg) { + super(errorCode.getMessage()); + this.msgCode = errorCode.getCode(); + this.message = msg; + } + + + + + + public BaseException(String message) { + super(message); + this.msgCode = "Sys1001"; + this.message = message; + } + + + @Override + public String getCode() { + return this.msgCode; + } + @Override + public String getMessage(){ + return this.message; + } +} diff --git a/src/main/java/com/docus/bgts/config/CommonResult.java b/src/main/java/com/docus/bgts/config/CommonResult.java new file mode 100644 index 0000000..7473fcc --- /dev/null +++ b/src/main/java/com/docus/bgts/config/CommonResult.java @@ -0,0 +1,45 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.config; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@ApiModel("响应") +@Data +public class CommonResult { + @ApiModelProperty("响应码") + private Integer code; + @ApiModelProperty("业务异常错误码") + private String msgCode; + @ApiModelProperty("响应消息") + private String msg; + @ApiModelProperty("响应实体") + private T data; + + public CommonResult() { + } + + public CommonResult(Integer code, String msg) { + this.code = code; + this.msg = msg; + } + + public CommonResult(Integer code, String msgCode, String msg) { + this.code = code; + this.msg = msg; + } + + public CommonResult(final Integer code, final String msgCode, final String msg, final T data) { + this.code = code; + this.msgCode = msgCode; + this.msg = msg; + this.data = data; + } + + +} diff --git a/src/main/java/com/docus/bgts/config/DocusServerUrlConfig.java b/src/main/java/com/docus/bgts/config/DocusServerUrlConfig.java new file mode 100644 index 0000000..0a4b84c --- /dev/null +++ b/src/main/java/com/docus/bgts/config/DocusServerUrlConfig.java @@ -0,0 +1,20 @@ +package com.docus.bgts.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.downploadlatform-server}") + private String downloadPlatformServerUrl; + + +} diff --git a/src/main/java/com/docus/bgts/config/EmptyWebService.java b/src/main/java/com/docus/bgts/config/EmptyWebService.java new file mode 100644 index 0000000..ac04b67 --- /dev/null +++ b/src/main/java/com/docus/bgts/config/EmptyWebService.java @@ -0,0 +1,17 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.config; + +import org.springframework.stereotype.Service; + +import javax.jws.WebService; + +/** + * @author wyb + */ +@WebService +@Service +public class EmptyWebService implements IEmptyWebService {} diff --git a/src/main/java/com/docus/bgts/config/IEmptyWebService.java b/src/main/java/com/docus/bgts/config/IEmptyWebService.java new file mode 100644 index 0000000..c779368 --- /dev/null +++ b/src/main/java/com/docus/bgts/config/IEmptyWebService.java @@ -0,0 +1,16 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.config; + +import javax.jws.WebService; + +/** + * @author wyb + */ +@WebService +public interface IEmptyWebService { + +} diff --git a/src/main/java/com/docus/bgts/config/IErrorCode.java b/src/main/java/com/docus/bgts/config/IErrorCode.java new file mode 100644 index 0000000..e2aa14e --- /dev/null +++ b/src/main/java/com/docus/bgts/config/IErrorCode.java @@ -0,0 +1,12 @@ +package com.docus.bgts.config; + +/** + * @Description 封装API的错误码 + * @Author JacksonTu + * @Date 2020/3/28 16:26 + */ +public interface IErrorCode { + String getCode(); + + String getMessage(); +} diff --git a/src/main/java/com/docus/bgts/config/MybatisPlusConfig.java b/src/main/java/com/docus/bgts/config/MybatisPlusConfig.java new file mode 100644 index 0000000..2bea063 --- /dev/null +++ b/src/main/java/com/docus/bgts/config/MybatisPlusConfig.java @@ -0,0 +1,74 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.config; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties; +import com.baomidou.mybatisplus.core.MybatisConfiguration; +import com.baomidou.mybatisplus.core.config.GlobalConfig; +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import org.apache.ibatis.logging.nologging.NoLoggingImpl; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import javax.annotation.PostConstruct; +import java.beans.ConstructorProperties; +import java.util.Objects; + +@Configuration +@EnableTransactionManagement +@MapperScan({"com.docus.bgts.**.mapper"}) +@ConditionalOnClass({PaginationInterceptor.class}) +public class MybatisPlusConfig { + private final MybatisPlusProperties mybatisPlusProperties; + + @Bean + public PaginationInterceptor paginationInterceptor() { + PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); + return paginationInterceptor; + } + + @PostConstruct + public void initMybatisConfig() { + this.mybatisPlusProperties.setMapperLocations(new String[]{"classpath*:/mapper/*Mapper.xml"}); + this.mybatisPlusProperties.setTypeAliasesPackage("com.docus.bgts.wzh.entity"); + MybatisConfiguration configuration = this.mybatisPlusProperties.getConfiguration(); + if (Objects.isNull(configuration)) { + configuration = new MybatisConfiguration(); + } + + configuration.setMapUnderscoreToCamelCase(true); + configuration.setCacheEnabled(true); + configuration.setLogImpl(NoLoggingImpl.class); + this.mybatisPlusProperties.setConfiguration(configuration); + GlobalConfig globalConfig = this.mybatisPlusProperties.getGlobalConfig(); + if (Objects.isNull(globalConfig)) { + globalConfig = new GlobalConfig(); + } + + GlobalConfig.DbConfig dbConfig = globalConfig.getDbConfig(); + if (Objects.isNull(dbConfig)) { + dbConfig = new GlobalConfig.DbConfig(); + } + + configuration.setCallSettersOnNulls(true); + dbConfig.setIdType(IdType.ASSIGN_ID); + dbConfig.setTableUnderline(true); + dbConfig.setLogicDeleteValue("1"); + dbConfig.setLogicNotDeleteValue("0"); + dbConfig.setLogicDeleteField("def_flag"); + globalConfig.setDbConfig(dbConfig); + globalConfig.setBanner(false); + } + + @ConstructorProperties({"mybatisPlusProperties"}) + public MybatisPlusConfig(final MybatisPlusProperties mybatisPlusProperties) { + this.mybatisPlusProperties = mybatisPlusProperties; + } +} diff --git a/src/main/java/com/docus/bgts/config/ResultCode.java b/src/main/java/com/docus/bgts/config/ResultCode.java new file mode 100644 index 0000000..6492d01 --- /dev/null +++ b/src/main/java/com/docus/bgts/config/ResultCode.java @@ -0,0 +1,34 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.config; + +public enum ResultCode { + SUCCESS(0, "操作成功"), + FAILED(500, "操作失败"), + VALIDATE_FAILED(404, "参数检验失败"), + BASE_EXCEPTION(406, "业务异常"), + UNAUTHORIZED(401, "暂未登录或token已经过期"), + FORBIDDEN(403, "没有相关权限"), + PREVENT_REPLAY(405, "重复请求"), + NOT_EXIST(601, "数据不存在"), + NOT_ENABLE(600, "数据未启用"); + + private Integer code; + private String message; + + private ResultCode(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return this.code; + } + + public String getMessage() { + return this.message; + } +} diff --git a/src/main/java/com/docus/bgts/config/ThreadPoolConfig.java b/src/main/java/com/docus/bgts/config/ThreadPoolConfig.java new file mode 100644 index 0000000..23bee0f --- /dev/null +++ b/src/main/java/com/docus/bgts/config/ThreadPoolConfig.java @@ -0,0 +1,27 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +@Configuration +public class ThreadPoolConfig { + @Bean + public ThreadPoolExecutor threadPoolExecutor() { + return new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), + (int) ((double) Runtime.getRuntime().availableProcessors() * 2), + 60L, TimeUnit.SECONDS, + new LinkedBlockingQueue<>(200), + Executors.defaultThreadFactory(), + new ThreadPoolExecutor.CallerRunsPolicy()); + } +} diff --git a/src/main/java/com/docus/bgts/config/WebServiceConfig.java b/src/main/java/com/docus/bgts/config/WebServiceConfig.java new file mode 100644 index 0000000..416078e --- /dev/null +++ b/src/main/java/com/docus/bgts/config/WebServiceConfig.java @@ -0,0 +1,53 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.config; + +import com.docus.bgts.emr.handler.IEmrWebService; +import com.docus.bgts.nursing.handler.NursingWebService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.xml.ws.Endpoint; + +@Configuration +@Slf4j +public class WebServiceConfig { + @Value("${system.code}") + private String systemCode; + @Value("${system.prop}") + private String systemProp; + @Value("${system.type}") + private String systemType; + + @Autowired + private EmptyWebService emptyWebService; + @Autowired + private IEmrWebService emrWebService; + @Autowired + private NursingWebService nursingWebService; + + + @Bean + public Endpoint endpoint() { + String address = "http://0.0.0.0:" + this.systemProp + "/" + this.systemCode; + Object implementor = emptyWebService; + // 住院电子病历 + if ("emr".equalsIgnoreCase(systemType)) { + implementor = emrWebService; + } + // 住院护理 + if ("nursing".equalsIgnoreCase(systemType)) { + implementor = nursingWebService; + } + + Endpoint publish = Endpoint.publish(address, implementor); + log.info("WebService服务已发布,发布地址:{},发布处理类:{}", address, implementor.getClass().getName()); + return publish; + } +} diff --git a/src/main/java/com/docus/bgts/emr/convert/EmrWsConvert.java b/src/main/java/com/docus/bgts/emr/convert/EmrWsConvert.java new file mode 100644 index 0000000..340c2c8 --- /dev/null +++ b/src/main/java/com/docus/bgts/emr/convert/EmrWsConvert.java @@ -0,0 +1,82 @@ +package com.docus.bgts.emr.convert; + +import cn.hutool.core.util.StrUtil; +import com.docus.bgts.emr.dto.EmrInfo; +import com.docus.bgts.utils.XmlUtil; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.util.ArrayList; + +/** + * + * @author YongBin Wen + * @date 2025/11/17 星期一 16:12 + */ +public class EmrWsConvert { + public static EmrInfo convertEmrInfo(XmlUtil xmlUtil) { + String jzh; + String submitTime; + String inpatientNo; + Integer admissTimes = null; + String pathologicalDiagnosisFlag; + String chrgDocCode; + String chrgDocName; + String recSubCode; + String recSubName; + ArrayList reportItems = new ArrayList<>(); + + Node jzhNode = xmlUtil.getNode("/Request/Msg/INHOSP_NO"); + jzh = jzhNode.getTextContent(); + Node submitTimeNode = xmlUtil.getNode("/Request/Msg/SUBMIT_TIME"); + submitTime = submitTimeNode.getTextContent(); + Node inpatientNoNode = xmlUtil.getNode("/Request/Msg/INHOSP_INDEX_NO"); + inpatientNo = inpatientNoNode.getTextContent(); + Node admissTimesNode = xmlUtil.getNode("/Request/Msg/INHOSP_NUM"); + if (StrUtil.isNotBlank(admissTimesNode.getTextContent())) { + admissTimes = Integer.parseInt(admissTimesNode.getTextContent()); + } + Node pathologicalDiagnosisFlagNode = xmlUtil.getNode("/Request/Msg/PATHOLOGICAL_DIAGNOSIS_FLAG"); + pathologicalDiagnosisFlag = pathologicalDiagnosisFlagNode.getTextContent(); + Node chrgDocCodeNode = xmlUtil.getNode("/Request/Msg/CHRG_DOC_CODE"); + chrgDocCode = chrgDocCodeNode.getTextContent(); + Node chrgDocNameNode = xmlUtil.getNode("/Request/Msg/CHRG_DOC_NAME"); + chrgDocName = chrgDocNameNode.getTextContent(); + Node recSubCodeNode = xmlUtil.getNode("/Request/Msg/REC_SUB_CODE"); + recSubCode = recSubCodeNode.getTextContent(); + Node recSubNameNode = xmlUtil.getNode("/Request/Msg/REC_SUB_NAME"); + recSubName = recSubNameNode.getTextContent(); + + NodeList reportItemNodeList = xmlUtil.getNodeList("/Request/Msg/ITEM"); + int reportItemNodeListLength = reportItemNodeList.getLength(); + if (reportItemNodeListLength > 0) { + for (int i = 1; i <= reportItemNodeListLength; i++) { + Node idNoNode = xmlUtil.getNode("/Request/Msg/ITEM[" + i + "]/IDNO"); + Node pdfPathNode = xmlUtil.getNode("/Request/Msg/ITEM[" + i + "]/PDF_PATH"); + Node fileNameNode = xmlUtil.getNode("/Request/Msg/ITEM[" + i + "]/FILENAME"); + Node minTimeNode = xmlUtil.getNode("/Request/Msg/ITEM[" + i + "]/MIN_TIME"); + Node maxTimeNode = xmlUtil.getNode("/Request/Msg/ITEM[" + i + "]/MAX_TIME"); + EmrInfo.ReportItem item = new EmrInfo.ReportItem(); + item.setIdNo(idNoNode.getTextContent()); + item.setPdfPath(pdfPathNode.getTextContent()); + item.setFileName(fileNameNode.getTextContent()); + item.setMinTime(minTimeNode.getTextContent()); + item.setMaxTime(maxTimeNode.getTextContent()); + reportItems.add(item); + } + } + + EmrInfo emrInfo = new EmrInfo(); + emrInfo.setJzh(jzh); + emrInfo.setSubmitTime(submitTime); + emrInfo.setInpatientNo(inpatientNo); + emrInfo.setAdmissTimes(admissTimes); + emrInfo.setPathologicalDiagnosisFlag(pathologicalDiagnosisFlag); + emrInfo.setChrgDocCode(chrgDocCode); + emrInfo.setChrgDocName(chrgDocName); + emrInfo.setRecSubCode(recSubCode); + emrInfo.setRecSubName(recSubName); + emrInfo.setReportItemList(reportItems); + return emrInfo; + } +} diff --git a/src/main/java/com/docus/bgts/emr/dto/EmrInfo.java b/src/main/java/com/docus/bgts/emr/dto/EmrInfo.java new file mode 100644 index 0000000..bf773fb --- /dev/null +++ b/src/main/java/com/docus/bgts/emr/dto/EmrInfo.java @@ -0,0 +1,49 @@ +package com.docus.bgts.emr.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * + * @author YongBin Wen + * @date 2025/11/17 星期一 16:13 + */ +@Data +public class EmrInfo { + @ApiModelProperty(" 住院流水号") + private String jzh; + @ApiModelProperty(" 医生提交时间 yyyy-MM-dd HH:mm:ss") + private String submitTime; + @ApiModelProperty(" 住院号") + private String inpatientNo; + @ApiModelProperty(" 住院次数") + private Integer admissTimes; + @ApiModelProperty(" 病理诊断标识(Y=是/N=否/P=待回复)") + private String pathologicalDiagnosisFlag; + @ApiModelProperty(" 主管医生工号") + private String chrgDocCode; + @ApiModelProperty(" 主管医生姓名") + private String chrgDocName; + @ApiModelProperty(" 提交医生工号") + private String recSubCode; + @ApiModelProperty(" 提交医生姓名") + private String recSubName; + @ApiModelProperty(" pdf报告信息") + private List reportItemList; + + @Data + public static class ReportItem { + @ApiModelProperty(" pdf唯一id") + private String idNo; + @ApiModelProperty(" 文件路径") + private String pdfPath; + @ApiModelProperty(" 文件名") + private String fileName; + @ApiModelProperty(" 文档开始时间 yyyy-MM-dd HH:mm:ss") + private String minTime; + @ApiModelProperty(" 文档结束时间 yyyy-MM-dd HH:mm:ss") + private String maxTime; + } +} diff --git a/src/main/java/com/docus/bgts/emr/dto/SystemCollectConfig.java b/src/main/java/com/docus/bgts/emr/dto/SystemCollectConfig.java new file mode 100644 index 0000000..f58742b --- /dev/null +++ b/src/main/java/com/docus/bgts/emr/dto/SystemCollectConfig.java @@ -0,0 +1,41 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.emr.dto; + +import lombok.Data; + +import java.util.List; + +@Data +public class SystemCollectConfig { + private String sealCollectClassify; + private List sealCollectConfigs; + + + @Data + public static class CollectConfig { + private String desc; + private String url; + + public String getDesc() { + return this.desc; + } + } + + public static enum Classify { + SEAL_COLLECT("SEAL_COLLECT"); + + final String classify; + + private Classify(String classify) { + this.classify = classify; + } + + public String getClassify() { + return this.classify; + } + } +} diff --git a/src/main/java/com/docus/bgts/emr/enums/Codes.java b/src/main/java/com/docus/bgts/emr/enums/Codes.java new file mode 100644 index 0000000..3b49893 --- /dev/null +++ b/src/main/java/com/docus/bgts/emr/enums/Codes.java @@ -0,0 +1,34 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.emr.enums; + +public enum Codes { + JSON_ADDRESS("999", "\\dataConfig\\homeQualitySet.json"), + MSG("201", "Msg"), + DIRECTORY("1000", "directory"), + UPLOAD("0", "uploadConnector"), + SEALUPLOAD("0", "sealUpload"), + REPOAL("0", "repoalConnector"), + assortid("assortid", "assortidKey"), + collectorid("collectorid", "collectoridKey"), + EMP_ID("0", "indexFlag"); + + private String code; + private String message; + + private Codes(String code, String messgae) { + this.code = code; + this.message = messgae; + } + + public String getCode() { + return this.code; + } + + public String getMessage() { + return this.message; + } +} diff --git a/src/main/java/com/docus/bgts/emr/handler/EmrWebService.java b/src/main/java/com/docus/bgts/emr/handler/EmrWebService.java new file mode 100644 index 0000000..83758bd --- /dev/null +++ b/src/main/java/com/docus/bgts/emr/handler/EmrWebService.java @@ -0,0 +1,476 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.emr.handler; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.docus.bgts.config.BaseException; +import com.docus.bgts.config.CommonResult; +import com.docus.bgts.config.ResultCode; +import com.docus.bgts.emr.convert.EmrWsConvert; +import com.docus.bgts.emr.dto.EmrInfo; +import com.docus.bgts.emr.dto.SystemCollectConfig; +import com.docus.bgts.rpc.DownPlatformService; +import com.docus.bgts.rpc.dto.ReportDownDto; +import com.docus.bgts.rpc.dto.ReportDownPatientDto; +import com.docus.bgts.rpc.dto.ReportDownScanFileDto; +import com.docus.bgts.utils.FileUtils; +import com.docus.bgts.utils.HttpUtils; +import com.docus.bgts.utils.TableJsonRead; +import com.docus.bgts.utils.XmlUtil; +import com.docus.bgts.utils.XmlUtils; +import com.docus.bgts.wzh.entity.CanlcelDto; +import com.docus.bgts.wzh.entity.ZdAssort; +import com.docus.bgts.wzh.facade.IAfCollectTaskService; +import com.docus.bgts.wzh.mapper.TBasicExtendMapper; +import com.docus.bgts.wzh.mapper.TBasicMapper; +import com.docus.bgts.wzh.mapper.TScanAssortMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import sun.misc.BASE64Decoder; + +import javax.annotation.Resource; +import javax.jws.WebService; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.StringReader; +import java.io.UnsupportedEncodingException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @author wyb + */ +@WebService +@Service +@Slf4j +public class EmrWebService implements IEmrWebService { + @Autowired + IAfCollectTaskService afCollectTaskService; + @Autowired + DownPlatformService downPlatformService; + @Autowired + TBasicMapper tBasicMapper; + @Autowired + TBasicExtendMapper tBasicExtendMapper; + @Autowired + TScanAssortMapper tScanAssortMapper; + @Resource + private ThreadPoolExecutor threadPoolExecutor; + + @Override + public String pushSurveyReport(String xml) { + log.info("EmrWebService,pushSurveyReport,报告推送入参:{}", xml); + try { + XmlUtil xmlUtil = XmlUtil.of(xml); + EmrInfo emrInfo = EmrWsConvert.convertEmrInfo(xmlUtil); + List reportItemList = emrInfo.getReportItemList(); + if (CollUtil.isEmpty(reportItemList)) { + throw new BaseException("未解析文件数据!"); + } + + String patientId = this.afCollectTaskService.getpatientIdByJzh(emrInfo.getJzh()); + if (StrUtil.isBlank(patientId)) { + throw new BaseException("患者索引" + emrInfo.getJzh() + "无法匹配患者!"); + } + TableJsonRead tableJsonRead = new TableJsonRead(); + JSONObject config = tableJsonRead.Read("dataConfig", "EmrPushConf.json", JSONObject.class); + String collectorId = config.getString("collectorId"); + String assortId = config.getString("assortId"); + + List scanFileDtoList = new ArrayList(); + for (EmrInfo.ReportItem reportItem : reportItemList) { + ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); + reportDownScanFileDto.setDownurl(reportItem.getPdfPath()); + reportDownScanFileDto.setFiletitle(reportItem.getFileName()); + reportDownScanFileDto.setSerialnum(reportItem.getIdNo()); + reportDownScanFileDto.setSortdate(reportItem.getMinTime()); + reportDownScanFileDto.setFilesource(1); + reportDownScanFileDto.setFilestoragetype(1); + if (reportDownScanFileDto.getDownurl().length() > 200) { + reportDownScanFileDto.setFiletype(2); + } + scanFileDtoList.add(reportDownScanFileDto); + } + + ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto(); + reportDownPatientDto.setJzh(emrInfo.getJzh()); + reportDownPatientDto.setPatientid(patientId); + + ReportDownDto reportDownDto = new ReportDownDto(); + reportDownDto.setCollectorid(collectorId); + reportDownDto.setAssortid(assortId); + reportDownDto.setPatient(reportDownPatientDto); + reportDownDto.setScanfiles(scanFileDtoList); + + // 作废该来源的文件 + int cancelCount = this.afCollectTaskService.cancelTsaByPatientIdAndSource(patientId, collectorId); + log.info("作废患者 {} 份文件,主键:{},来源:{}", cancelCount, patientId, collectorId); + afCollectTaskService.insertTask(reportDownDto); + this.afCollectTaskService.updateDoctorSubmitTime(reportDownDto, emrInfo.getSubmitTime(), emrInfo.getRecSubName()); + this.afCollectTaskService.insertDoctorState(reportDownDto, emrInfo.getSubmitTime()); + + CommonResult commonResult = downPlatformService.report(reportDownDto); + if (commonResult.getCode().equals(ResultCode.FAILED.getCode())) { + throw new BaseException("执行文件上传时出现错误!"); + } + return success(); + } catch (BaseException bex) { + log.error("报告推送出错!错误原因:" + bex.getMessage(), bex); + return failed(bex.getMessage()); + } catch (Exception ex) { + log.error("报告推送出错!错误原因:" + ex.getMessage(), ex); + return failed("系统错误!"); + } + } + + @Override + public String outPatient(String xml) { + log.info("EmrWebService,outPatient,报告推送入参:{}", xml); + try { + XmlUtil xmlUtil = XmlUtil.of(xml); + EmrInfo emrInfo = EmrWsConvert.convertEmrInfo(xmlUtil); + List reportItemList = emrInfo.getReportItemList(); + if (CollUtil.isEmpty(reportItemList)) { + throw new BaseException("未解析文件数据!"); + } + + String patientId = this.afCollectTaskService.getpatientIdByJzh(emrInfo.getJzh()); + if (StrUtil.isBlank(patientId)) { + throw new BaseException("患者索引" + emrInfo.getJzh() + "无法匹配患者!"); + } + TableJsonRead tableJsonRead = new TableJsonRead(); + JSONObject config = tableJsonRead.Read("dataConfig", "EmrPushConf.json", JSONObject.class); + String collectorId = config.getString("collectorId"); + String assortId = config.getString("assortId"); + + List scanFileDtoList = new ArrayList(); + for (EmrInfo.ReportItem reportItem : reportItemList) { + ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); + reportDownScanFileDto.setDownurl(reportItem.getPdfPath()); + reportDownScanFileDto.setFiletitle(reportItem.getFileName()); + reportDownScanFileDto.setSerialnum(reportItem.getIdNo()); + reportDownScanFileDto.setSortdate(reportItem.getMinTime()); + reportDownScanFileDto.setFilesource(1); + reportDownScanFileDto.setFilestoragetype(1); + if (reportDownScanFileDto.getDownurl().length() > 200) { + reportDownScanFileDto.setFiletype(2); + } + scanFileDtoList.add(reportDownScanFileDto); + } + + ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto(); + reportDownPatientDto.setJzh(emrInfo.getJzh()); + reportDownPatientDto.setPatientid(patientId); + + ReportDownDto reportDownDto = new ReportDownDto(); + reportDownDto.setCollectorid(collectorId); + reportDownDto.setAssortid(assortId); + reportDownDto.setPatient(reportDownPatientDto); + reportDownDto.setScanfiles(scanFileDtoList); + + this.afCollectTaskService.insertTask(reportDownDto); + + CommonResult commonResult = downPlatformService.report(reportDownDto); + if (commonResult.getCode().equals(ResultCode.FAILED.getCode())) { + throw new BaseException("执行文件上传时出现错误!"); + } + return success(); + } catch (BaseException bex) { + log.error("报告推送出错!错误原因:" + bex.getMessage(), bex); + return failed(bex.getMessage()); + } catch (Exception ex) { + log.error("报告推送出错!错误原因:" + ex.getMessage(), ex); + return failed("系统错误!"); + } + } + + + private void sealCollect(String sealId) { + String systemCollectConfigFileName = "dataConfig" + File.separator + "SystemCollectConfig"; + + List sealCollectConfigs; + try { + String configJson = FileUtils.readJsonFromCurrentProject(systemCollectConfigFileName); + SystemCollectConfig systemCollectConfig = (SystemCollectConfig) JSON.parseObject(configJson, SystemCollectConfig.class); + String sealCollectClassify = systemCollectConfig.getSealCollectClassify(); + if (!SystemCollectConfig.Classify.SEAL_COLLECT.getClassify().equals(sealCollectClassify)) { + throw new RuntimeException("封存病案采集配置未配置!"); + } + + sealCollectConfigs = systemCollectConfig.getSealCollectConfigs(); + + for (SystemCollectConfig.CollectConfig config : sealCollectConfigs) { + if (StringUtils.isBlank(config.getDesc()) || StringUtils.isBlank(config.getUrl())) { + throw new RuntimeException("封存病案采集配置中描述和地址不能为空!"); + } + } + } catch (RuntimeException runtimeException) { + log.error(runtimeException.getMessage(), runtimeException); + return; + } catch (Exception ex) { + log.error("封存病案获取采集配置出现未知错误!", ex); + return; + } + + List> completableFutureList = new CopyOnWriteArrayList(); + + for (SystemCollectConfig.CollectConfig config : sealCollectConfigs) { + CompletableFuture completableFuture = CompletableFuture.runAsync(() -> this.sealCollect(sealId, config), this.threadPoolExecutor); + completableFutureList.add(completableFuture); + } + + if (!completableFutureList.isEmpty()) { + CompletableFuture allFutures = CompletableFuture.allOf((CompletableFuture[]) completableFutureList.toArray(new CompletableFuture[0])); + + try { + allFutures.get(); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + } + + private Element getElementFromString(String s) { + SAXReader builder = new SAXReader(); + Document doc = null; + Element element = null; + + try { + doc = builder.read(new StringReader(s)); + } catch (DocumentException e) { + e.printStackTrace(); + } + + if (doc != null) { + element = doc.getRootElement(); + } + + return element; + } + + private void sealCollect(String sealId, SystemCollectConfig.CollectConfig config) { + String url = config.getUrl() + "?sealId=" + sealId; + String desc = config.getDesc(); + + try { + log.info("{},采集地址:{}", desc, url); + String result = HttpUtils.get(url); + log.info("{},采集地址:{},采集结果:{}", new Object[]{desc, url, result}); + } catch (Exception ex) { + log.error(desc + ",采集地址:" + url + ",采集失败!", ex); + } + + } + + private CanlcelDto getCanlCelDtoByXml(String xml) throws UnsupportedEncodingException { + XmlUtils xmlUtils = null; + + try { + xmlUtils = new XmlUtils(new ByteArrayInputStream(xml.getBytes("UTF-8"))); + } catch (Exception e) { + e.printStackTrace(); + } + + List repealDirectory = (List) FileUtils.getJsonByName("repealDirectory"); + Element element = xmlUtils.getElement(repealDirectory); + String repealSerialnum = String.valueOf(FileUtils.getJsonByName("repealSerialnum")); + Element repealSerialnumElement = element.element(repealSerialnum); + CanlcelDto canlcelDto = new CanlcelDto(); + if (null != repealSerialnumElement && !StringUtils.isBlank(repealSerialnumElement.getText())) { + String serialnum = repealSerialnumElement.getText(); + log.info("当前流水号为:" + serialnum); + canlcelDto.setSerialnum(serialnum); + return canlcelDto; + } else { + throw new RuntimeException(repealSerialnum + "标签必须有值"); + } + } + + private String getElementText(Element element, String[] args) { + String resText = ""; + Element byElement = (Element) element.clone(); + Element byElement1 = null; + + for (String arg : args) { + String[] split = arg.split("&"); + if (split.length > 1) { + for (String spi : split) { + if (byElement1 == null) { + byElement1 = byElement.element(spi); + } else { + byElement1 = byElement1.element(spi); + } + + if (byElement1 != null && StringUtils.isNotBlank(byElement1.getText())) { + break; + } + + byElement1 = null; + } + } else if (byElement1 == null) { + byElement1 = byElement.element(arg); + } else { + byElement1 = byElement1.element(arg); + } + + if (byElement1 == null) { + break; + } + + resText = byElement1.getText(); + } + + if (StringUtils.isBlank(resText)) { + throw new RuntimeException(args[args.length - 1] + "的值不能为空"); + } else { + return resText; + } + } + + private String getElementTextCanBeEmpty(Element element, String[] args) { + String resText = ""; + Element byElement = (Element) element.clone(); + Element byElement1 = null; + + for (String arg : args) { + String[] split = arg.split("&"); + if (split.length > 1) { + for (String spi : split) { + if (byElement1 == null) { + byElement1 = byElement.element(spi); + } else { + byElement1 = byElement1.element(spi); + } + + if (byElement1 != null && StringUtils.isNotBlank(byElement1.getText())) { + break; + } + + byElement1 = null; + } + } else if (byElement1 == null) { + byElement1 = byElement.element(arg); + } else { + byElement1 = byElement1.element(arg); + } + + if (byElement1 == null) { + break; + } + + resText = byElement1.getText(); + } + + return resText; + } + + private String getAssortid(Element element) { + String assortId = String.valueOf(FileUtils.getJsonByName("assortid")); + if (StringUtils.isBlank(assortId)) { + String assortIdKey = String.valueOf(FileUtils.getJsonByName("assortidParamKey")); + if (StringUtils.isBlank(assortIdKey)) { + assortId = ""; + } else { + assortId = element.element(assortIdKey).getText(); + } + + String myAssortId = this.afCollectTaskService.getAssortIdByAssortId(assortId); + if (StringUtils.isBlank(myAssortId)) { + myAssortId = this.afCollectTaskService.getAssortIdByAssortName(assortId); + if (StringUtils.isBlank(myAssortId)) { + String uuid = UUID.randomUUID().toString().replaceAll("-", ""); + ZdAssort zdAssort = new ZdAssort(); + zdAssort.setAssortName(assortId); + zdAssort.setAssortId(uuid); + zdAssort.setEffective(1); + this.afCollectTaskService.insertZdAssort(zdAssort); + assortId = uuid; + } else { + assortId = myAssortId; + } + } else { + assortId = myAssortId; + } + } + + return assortId; + } + + public static void depdf() { + Path path = Paths.get("D:\\pdf.txt"); + Stream lines = null; + + try { + lines = Files.lines(path); + } catch (IOException e) { + e.printStackTrace(); + } + + String collect = (String) lines.collect(Collectors.joining(System.lineSeparator())); + String encodedBytes = collect; + BASE64Decoder decoder = new BASE64Decoder(); + byte[] decodedBytes = new byte[0]; + + try { + decodedBytes = decoder.decodeBuffer(encodedBytes); + } catch (IOException e) { + e.printStackTrace(); + } + + File file = new File("D:\\newfile.pdf"); + FileOutputStream fop = null; + + try { + fop = new FileOutputStream(file); + fop.write(decodedBytes); + fop.flush(); + fop.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + + public String success() { + return "\n" + + "\t\n" + + "\t\t0\n" + + "\t\t成功\n" + + "\t\n" + + ""; + } + + public String failed(String msg) { + return "\n" + + "\t\n" + + "\t\t1\n" + + "\t\t" + msg + "\n" + + "\t\n" + + ""; + } +} diff --git a/src/main/java/com/docus/bgts/emr/handler/IEmrWebService.java b/src/main/java/com/docus/bgts/emr/handler/IEmrWebService.java new file mode 100644 index 0000000..70c4864 --- /dev/null +++ b/src/main/java/com/docus/bgts/emr/handler/IEmrWebService.java @@ -0,0 +1,21 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.emr.handler; + +import javax.jws.WebMethod; +import javax.jws.WebService; + +/** + * @author wyb + */ +@WebService +public interface IEmrWebService { + @WebMethod + String pushSurveyReport(String xml); + + @WebMethod + String outPatient(String xml); +} diff --git a/src/main/java/com/docus/bgts/nursing/convert/NursingWsConvert.java b/src/main/java/com/docus/bgts/nursing/convert/NursingWsConvert.java new file mode 100644 index 0000000..f904a5c --- /dev/null +++ b/src/main/java/com/docus/bgts/nursing/convert/NursingWsConvert.java @@ -0,0 +1,65 @@ +package com.docus.bgts.nursing.convert; + +import cn.hutool.core.util.StrUtil; +import com.docus.bgts.nursing.dto.NursingInfo; +import com.docus.bgts.utils.XmlUtil; +import org.w3c.dom.Node; + +/** + * + * @author YongBin Wen + * @date 2025/11/17 星期一 21:11 + */ +public class NursingWsConvert { + public static NursingInfo convertNursingInfo(XmlUtil xmlUtil) { + String jzh; + String inpatientNo; + Integer admissTimes = null; + String submitTime; + String submitNurseCode; + String submitNurseName; + String idNo; + String fileName; + String pdfPath; + String uniqueFile; + String tableType; + Node idNoNode = xmlUtil.getNode("/Request/Msg/IDNO"); + idNo = idNoNode.getTextContent(); + Node jzhNode = xmlUtil.getNode("/Request/Msg/INHOSP_INDEX_NO"); + jzh = jzhNode.getTextContent(); + Node inpatientNoNode = xmlUtil.getNode("/Request/Msg/INHOSP_NO"); + inpatientNo = inpatientNoNode.getTextContent(); + Node admissTimesNode = xmlUtil.getNode("/Request/Msg/INHOSP_NUM"); + if (StrUtil.isNotBlank(admissTimesNode.getTextContent())) { + admissTimes = Integer.valueOf(admissTimesNode.getTextContent()); + } + Node tableTypeNode = xmlUtil.getNode("/Request/Msg/TABLE_TYPE"); + tableType = tableTypeNode.getTextContent(); + Node submitTimeNode = xmlUtil.getNode("/Request/Msg/SUBMIT_TIME"); + submitTime = submitTimeNode.getTextContent(); + Node pdfPathNode = xmlUtil.getNode("/Request/Msg/PDF_PATH"); + pdfPath = pdfPathNode.getTextContent(); + Node fileNameNode = xmlUtil.getNode("/Request/Msg/FILENAME"); + fileName = fileNameNode.getTextContent(); + Node uniqueFileNode = xmlUtil.getNode("/Request/Msg/UNIQUE_FILE"); + uniqueFile = uniqueFileNode.getTextContent(); + Node submitNurseCodeNode = xmlUtil.getNode("/Request/Msg/SUBMIT_NURSE_CODE"); + submitNurseCode = submitNurseCodeNode.getTextContent(); + Node submitNurseNameNode = xmlUtil.getNode("/Request/Msg/SUBMIT_NURSE_NAME"); + submitNurseName = submitNurseNameNode.getTextContent(); + + NursingInfo nursingInfo = new NursingInfo(); + nursingInfo.setJzh(jzh); + nursingInfo.setInpatientNo(inpatientNo); + nursingInfo.setAdmissTimes(admissTimes); + nursingInfo.setSubmitTime(submitTime); + nursingInfo.setSubmitNurseCode(submitNurseCode); + nursingInfo.setSubmitNurseName(submitNurseName); + nursingInfo.setIdNo(idNo); + nursingInfo.setFileName(fileName); + nursingInfo.setPdfPath(pdfPath); + nursingInfo.setUniqueFile(uniqueFile); + nursingInfo.setTableType(tableType); + return nursingInfo; + } +} diff --git a/src/main/java/com/docus/bgts/nursing/dto/NursingInfo.java b/src/main/java/com/docus/bgts/nursing/dto/NursingInfo.java new file mode 100644 index 0000000..55535e8 --- /dev/null +++ b/src/main/java/com/docus/bgts/nursing/dto/NursingInfo.java @@ -0,0 +1,35 @@ +package com.docus.bgts.nursing.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * + * @author YongBin Wen + * @date 2025/11/17 星期一 21:11 + */ +@Data +public class NursingInfo { + @ApiModelProperty(" 住院流水号") + private String jzh; + @ApiModelProperty(" 住院号") + private String inpatientNo; + @ApiModelProperty(" 住院次数") + private Integer admissTimes; + @ApiModelProperty("护理提交时间 yyyy-MM-dd HH:mm:ss") + private String submitTime; + @ApiModelProperty(" 提交护士工号") + private String submitNurseCode; + @ApiModelProperty(" 提交护士姓名") + private String submitNurseName; + @ApiModelProperty("文件id") + private String idNo; + @ApiModelProperty("文件名称") + private String fileName; + @ApiModelProperty("文件地址") + private String pdfPath; + @ApiModelProperty("待确认的字段") + private String uniqueFile; + @ApiModelProperty("待确认的字段") + private String tableType; +} diff --git a/src/main/java/com/docus/bgts/nursing/handler/INursingWebService.java b/src/main/java/com/docus/bgts/nursing/handler/INursingWebService.java new file mode 100644 index 0000000..17b570d --- /dev/null +++ b/src/main/java/com/docus/bgts/nursing/handler/INursingWebService.java @@ -0,0 +1,21 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.nursing.handler; + +import javax.jws.WebMethod; +import javax.jws.WebService; + +/** + * @author wyb + */ +@WebService +public interface INursingWebService { + @WebMethod + String pushSurveyReport(String xml); + + @WebMethod + String outPatient(String xml); +} diff --git a/src/main/java/com/docus/bgts/nursing/handler/NursingWebService.java b/src/main/java/com/docus/bgts/nursing/handler/NursingWebService.java new file mode 100644 index 0000000..1d8fce6 --- /dev/null +++ b/src/main/java/com/docus/bgts/nursing/handler/NursingWebService.java @@ -0,0 +1,450 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.nursing.handler; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.docus.bgts.config.BaseException; +import com.docus.bgts.config.CommonResult; +import com.docus.bgts.config.ResultCode; +import com.docus.bgts.emr.dto.SystemCollectConfig; +import com.docus.bgts.nursing.convert.NursingWsConvert; +import com.docus.bgts.nursing.dto.NursingInfo; +import com.docus.bgts.rpc.DownPlatformService; +import com.docus.bgts.rpc.dto.ReportDownDto; +import com.docus.bgts.rpc.dto.ReportDownPatientDto; +import com.docus.bgts.rpc.dto.ReportDownScanFileDto; +import com.docus.bgts.utils.FileUtils; +import com.docus.bgts.utils.HttpUtils; +import com.docus.bgts.utils.TableJsonRead; +import com.docus.bgts.utils.XmlUtil; +import com.docus.bgts.utils.XmlUtils; +import com.docus.bgts.wzh.entity.CanlcelDto; +import com.docus.bgts.wzh.entity.ZdAssort; +import com.docus.bgts.wzh.facade.IAfCollectTaskService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import sun.misc.BASE64Decoder; + +import javax.annotation.Resource; +import javax.jws.WebService; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.StringReader; +import java.io.UnsupportedEncodingException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Collections; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @author wyb + */ +@WebService +@Service +@Slf4j +public class NursingWebService implements INursingWebService { + + @Autowired + IAfCollectTaskService afCollectTaskService; + @Autowired + DownPlatformService downPlatformService; + @Resource + private ThreadPoolExecutor threadPoolExecutor; + + @Override + public String pushSurveyReport(String xml) { + log.info("NursingWebService,pushSurveyReport,报告推送入参:{}", xml); + try { + XmlUtil xmlUtil = XmlUtil.of(xml); + NursingInfo nursingInfo = NursingWsConvert.convertNursingInfo(xmlUtil); + + String patientId = this.afCollectTaskService.getpatientIdByJzh(nursingInfo.getJzh()); + if (StrUtil.isBlank(patientId)) { + throw new BaseException("患者索引" + nursingInfo.getJzh() + "无法匹配患者!"); + } + TableJsonRead tableJsonRead = new TableJsonRead(); + JSONObject config = tableJsonRead.Read("dataConfig", "NursingPushConf.json", JSONObject.class); + String collectorId = config.getString("collectorId"); + String assortId = config.getString("assortId"); + + ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); + reportDownScanFileDto.setDownurl(nursingInfo.getPdfPath()); + reportDownScanFileDto.setFiletitle(nursingInfo.getFileName()); + reportDownScanFileDto.setSerialnum(nursingInfo.getIdNo()); + reportDownScanFileDto.setFilesource(1); + reportDownScanFileDto.setFilestoragetype(1); + if (reportDownScanFileDto.getDownurl().length() > 200) { + reportDownScanFileDto.setFiletype(2); + } + List scanFileDtoList = Collections.singletonList(reportDownScanFileDto); + + ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto(); + reportDownPatientDto.setJzh(nursingInfo.getJzh()); + reportDownPatientDto.setPatientid(patientId); + + ReportDownDto reportDownDto = new ReportDownDto(); + reportDownDto.setCollectorid(collectorId); + reportDownDto.setAssortid(assortId); + reportDownDto.setPatient(reportDownPatientDto); + reportDownDto.setScanfiles(scanFileDtoList); + + afCollectTaskService.updateNurseSubmitTime(reportDownDto, nursingInfo.getSubmitTime(), nursingInfo.getSubmitNurseName()); + afCollectTaskService.insertNurseState(reportDownDto, nursingInfo.getSubmitTime()); + afCollectTaskService.insertTask(reportDownDto); + + + CommonResult commonResult = downPlatformService.report(reportDownDto); + if (commonResult.getCode().equals(ResultCode.FAILED.getCode())) { + throw new BaseException("执行文件上传时出现错误!"); + } + return success(); + } catch (BaseException bex) { + log.error("报告推送出错!错误原因:" + bex.getMessage(), bex); + return failed(bex.getMessage()); + } catch (Exception ex) { + log.error("报告推送出错!错误原因:" + ex.getMessage(), ex); + return failed("系统错误!"); + } + } + + @Override + public String outPatient(String xml) { + log.info("NursingWebService,outPatient,报告推送入参:{}", xml); + try { + XmlUtil xmlUtil = XmlUtil.of(xml); + NursingInfo nursingInfo = NursingWsConvert.convertNursingInfo(xmlUtil); + + + String patientId = this.afCollectTaskService.getpatientIdByJzh(nursingInfo.getJzh()); + if (StrUtil.isBlank(patientId)) { + throw new BaseException("患者索引" + nursingInfo.getJzh() + "无法匹配患者!"); + } + TableJsonRead tableJsonRead = new TableJsonRead(); + JSONObject config = tableJsonRead.Read("dataConfig", "NursingPushConf.json", JSONObject.class); + String collectorId = config.getString("collectorId"); + String assortId = config.getString("assortId"); + + ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); + reportDownScanFileDto.setDownurl(nursingInfo.getPdfPath()); + reportDownScanFileDto.setFiletitle(nursingInfo.getFileName()); + reportDownScanFileDto.setSerialnum(nursingInfo.getIdNo()); + reportDownScanFileDto.setFilesource(1); + reportDownScanFileDto.setFilestoragetype(1); + if (reportDownScanFileDto.getDownurl().length() > 200) { + reportDownScanFileDto.setFiletype(2); + } + List scanFileDtoList = Collections.singletonList(reportDownScanFileDto); + + ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto(); + reportDownPatientDto.setJzh(nursingInfo.getJzh()); + reportDownPatientDto.setPatientid(patientId); + + ReportDownDto reportDownDto = new ReportDownDto(); + reportDownDto.setCollectorid(collectorId); + reportDownDto.setAssortid(assortId); + reportDownDto.setPatient(reportDownPatientDto); + reportDownDto.setScanfiles(scanFileDtoList); + + this.afCollectTaskService.insertTask(reportDownDto); + + CommonResult commonResult = downPlatformService.report(reportDownDto); + if (commonResult.getCode().equals(ResultCode.FAILED.getCode())) { + throw new BaseException("执行文件上传时出现错误!"); + } + return success(); + } catch (BaseException bex) { + log.error("报告推送出错!错误原因:" + bex.getMessage(), bex); + return failed(bex.getMessage()); + } catch (Exception ex) { + log.error("报告推送出错!错误原因:" + ex.getMessage(), ex); + return failed("系统错误!"); + } + } + + + private void sealCollect(String sealId) { + String systemCollectConfigFileName = "dataConfig" + File.separator + "SystemCollectConfig"; + + List sealCollectConfigs; + try { + String configJson = FileUtils.readJsonFromCurrentProject(systemCollectConfigFileName); + SystemCollectConfig systemCollectConfig = (SystemCollectConfig) JSON.parseObject(configJson, SystemCollectConfig.class); + String sealCollectClassify = systemCollectConfig.getSealCollectClassify(); + if (!SystemCollectConfig.Classify.SEAL_COLLECT.getClassify().equals(sealCollectClassify)) { + throw new RuntimeException("封存病案采集配置未配置!"); + } + + sealCollectConfigs = systemCollectConfig.getSealCollectConfigs(); + + for (SystemCollectConfig.CollectConfig config : sealCollectConfigs) { + if (StringUtils.isBlank(config.getDesc()) || StringUtils.isBlank(config.getUrl())) { + throw new RuntimeException("封存病案采集配置中描述和地址不能为空!"); + } + } + } catch (RuntimeException runtimeException) { + log.error(runtimeException.getMessage(), runtimeException); + return; + } catch (Exception ex) { + log.error("封存病案获取采集配置出现未知错误!", ex); + return; + } + + List> completableFutureList = new CopyOnWriteArrayList(); + + for (SystemCollectConfig.CollectConfig config : sealCollectConfigs) { + CompletableFuture completableFuture = CompletableFuture.runAsync(() -> this.sealCollect(sealId, config), this.threadPoolExecutor); + completableFutureList.add(completableFuture); + } + + if (!completableFutureList.isEmpty()) { + CompletableFuture allFutures = CompletableFuture.allOf((CompletableFuture[]) completableFutureList.toArray(new CompletableFuture[0])); + + try { + allFutures.get(); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + } + + private Element getElementFromString(String s) { + SAXReader builder = new SAXReader(); + Document doc = null; + Element element = null; + + try { + doc = builder.read(new StringReader(s)); + } catch (DocumentException e) { + e.printStackTrace(); + } + + if (doc != null) { + element = doc.getRootElement(); + } + + return element; + } + + private void sealCollect(String sealId, SystemCollectConfig.CollectConfig config) { + String url = config.getUrl() + "?sealId=" + sealId; + String desc = config.getDesc(); + + try { + log.info("{},采集地址:{}", desc, url); + String result = HttpUtils.get(url); + log.info("{},采集地址:{},采集结果:{}", new Object[]{desc, url, result}); + } catch (Exception ex) { + log.error(desc + ",采集地址:" + url + ",采集失败!", ex); + } + + } + + private CanlcelDto getCanlCelDtoByXml(String xml) throws UnsupportedEncodingException { + XmlUtils xmlUtils = null; + + try { + xmlUtils = new XmlUtils(new ByteArrayInputStream(xml.getBytes("UTF-8"))); + } catch (Exception e) { + e.printStackTrace(); + } + + List repealDirectory = (List) FileUtils.getJsonByName("repealDirectory"); + Element element = xmlUtils.getElement(repealDirectory); + String repealSerialnum = String.valueOf(FileUtils.getJsonByName("repealSerialnum")); + Element repealSerialnumElement = element.element(repealSerialnum); + CanlcelDto canlcelDto = new CanlcelDto(); + if (null != repealSerialnumElement && !StringUtils.isBlank(repealSerialnumElement.getText())) { + String serialnum = repealSerialnumElement.getText(); + log.info("当前流水号为:" + serialnum); + canlcelDto.setSerialnum(serialnum); + return canlcelDto; + } else { + throw new RuntimeException(repealSerialnum + "标签必须有值"); + } + } + + private String getElementText(Element element, String[] args) { + String resText = ""; + Element byElement = (Element) element.clone(); + Element byElement1 = null; + + for (String arg : args) { + String[] split = arg.split("&"); + if (split.length > 1) { + for (String spi : split) { + if (byElement1 == null) { + byElement1 = byElement.element(spi); + } else { + byElement1 = byElement1.element(spi); + } + + if (byElement1 != null && StringUtils.isNotBlank(byElement1.getText())) { + break; + } + + byElement1 = null; + } + } else if (byElement1 == null) { + byElement1 = byElement.element(arg); + } else { + byElement1 = byElement1.element(arg); + } + + if (byElement1 == null) { + break; + } + + resText = byElement1.getText(); + } + + if (StringUtils.isBlank(resText)) { + throw new RuntimeException(args[args.length - 1] + "的值不能为空"); + } else { + return resText; + } + } + + private String getElementTextCanBeEmpty(Element element, String[] args) { + String resText = ""; + Element byElement = (Element) element.clone(); + Element byElement1 = null; + + for (String arg : args) { + String[] split = arg.split("&"); + if (split.length > 1) { + for (String spi : split) { + if (byElement1 == null) { + byElement1 = byElement.element(spi); + } else { + byElement1 = byElement1.element(spi); + } + + if (byElement1 != null && StringUtils.isNotBlank(byElement1.getText())) { + break; + } + + byElement1 = null; + } + } else if (byElement1 == null) { + byElement1 = byElement.element(arg); + } else { + byElement1 = byElement1.element(arg); + } + + if (byElement1 == null) { + break; + } + + resText = byElement1.getText(); + } + + return resText; + } + + private String getAssortid(Element element) { + String assortId = String.valueOf(FileUtils.getJsonByName("assortid")); + if (StringUtils.isBlank(assortId)) { + String assortIdKey = String.valueOf(FileUtils.getJsonByName("assortidParamKey")); + if (StringUtils.isBlank(assortIdKey)) { + assortId = ""; + } else { + assortId = element.element(assortIdKey).getText(); + } + + String myAssortId = this.afCollectTaskService.getAssortIdByAssortId(assortId); + if (StringUtils.isBlank(myAssortId)) { + myAssortId = this.afCollectTaskService.getAssortIdByAssortName(assortId); + if (StringUtils.isBlank(myAssortId)) { + String uuid = UUID.randomUUID().toString().replaceAll("-", ""); + ZdAssort zdAssort = new ZdAssort(); + zdAssort.setAssortName(assortId); + zdAssort.setAssortId(uuid); + zdAssort.setEffective(1); + this.afCollectTaskService.insertZdAssort(zdAssort); + assortId = uuid; + } else { + assortId = myAssortId; + } + } else { + assortId = myAssortId; + } + } + + return assortId; + } + + public static void depdf() { + Path path = Paths.get("D:\\pdf.txt"); + Stream lines = null; + + try { + lines = Files.lines(path); + } catch (IOException e) { + e.printStackTrace(); + } + + String collect = (String) lines.collect(Collectors.joining(System.lineSeparator())); + String encodedBytes = collect; + BASE64Decoder decoder = new BASE64Decoder(); + byte[] decodedBytes = new byte[0]; + + try { + decodedBytes = decoder.decodeBuffer(encodedBytes); + } catch (IOException e) { + e.printStackTrace(); + } + + File file = new File("D:\\newfile.pdf"); + FileOutputStream fop = null; + + try { + fop = new FileOutputStream(file); + fop.write(decodedBytes); + fop.flush(); + fop.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + + public String success() { + return "\n" + + "\t\n" + + "\t\t0\n" + + "\t\t成功\n" + + "\t\n" + + ""; + } + + public String failed(String msg) { + return "\n" + + "\t\n" + + "\t\t1\n" + + "\t\t" + msg + "\n" + + "\t\n" + + ""; + } +} diff --git a/src/main/java/com/docus/bgts/rpc/DownPlatformService.java b/src/main/java/com/docus/bgts/rpc/DownPlatformService.java new file mode 100644 index 0000000..70d575a --- /dev/null +++ b/src/main/java/com/docus/bgts/rpc/DownPlatformService.java @@ -0,0 +1,23 @@ +package com.docus.bgts.rpc; + + +import com.docus.bgts.config.CommonResult; +import com.docus.bgts.rpc.dto.ReportDownDto; + +/** + * 下载平台服务接口 + * + * @author jiashi + */ + +public interface DownPlatformService { + + + /** + * 下载服务文件上报 + * + * @param reportDownDto 下载服务上报参数 + * @return 结果 + */ + CommonResult report(ReportDownDto reportDownDto); +} diff --git a/src/main/java/com/docus/bgts/rpc/dto/ReportDownDto.java b/src/main/java/com/docus/bgts/rpc/dto/ReportDownDto.java new file mode 100644 index 0000000..5636098 --- /dev/null +++ b/src/main/java/com/docus/bgts/rpc/dto/ReportDownDto.java @@ -0,0 +1,30 @@ +package com.docus.bgts.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/bgts/rpc/dto/ReportDownPatientDto.java b/src/main/java/com/docus/bgts/rpc/dto/ReportDownPatientDto.java new file mode 100644 index 0000000..e2fbe19 --- /dev/null +++ b/src/main/java/com/docus/bgts/rpc/dto/ReportDownPatientDto.java @@ -0,0 +1,20 @@ +package com.docus.bgts.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; + + private String sealId; +} diff --git a/src/main/java/com/docus/bgts/rpc/dto/ReportDownScanFileDto.java b/src/main/java/com/docus/bgts/rpc/dto/ReportDownScanFileDto.java new file mode 100644 index 0000000..4550af6 --- /dev/null +++ b/src/main/java/com/docus/bgts/rpc/dto/ReportDownScanFileDto.java @@ -0,0 +1,34 @@ +package com.docus.bgts.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 serialnum; + + @ApiModelProperty(value = "排序日期") + private String sortdate; + + @ApiModelProperty(value = "是否作废 : 0:否 不作废,1:是 作废") + private int cancel=0; + + @ApiModelProperty(value = "文件排序") + private int sort=0; + + +} diff --git a/src/main/java/com/docus/bgts/rpc/impl/DownPlatformServiceImpl.java b/src/main/java/com/docus/bgts/rpc/impl/DownPlatformServiceImpl.java new file mode 100644 index 0000000..428a83f --- /dev/null +++ b/src/main/java/com/docus/bgts/rpc/impl/DownPlatformServiceImpl.java @@ -0,0 +1,56 @@ +package com.docus.bgts.rpc.impl; + +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; +import com.docus.bgts.config.CommonResult; +import com.docus.bgts.config.DocusServerUrlConfig; +import com.docus.bgts.rpc.DownPlatformService; +import com.docus.bgts.rpc.dto.ReportDownDto; +import com.docus.core.util.Func; +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); + String requestLogParam = requestParam; + if (reportDownDto.getScanfiles().get(0).getFiletype() == 2) { + String downurl = reportDownDto.getScanfiles().get(0).getDownurl(); + reportDownDto.getScanfiles().get(0).setDownurl("base64Str"); + requestLogParam = Func.toJson(reportDownDto); + reportDownDto.getScanfiles().get(0).setDownurl(downurl); + } + log.info("[{}]调用下载服务,地址:{} ,参数:{}", requestId, downUrl, requestLogParam); + 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/bgts/utils/FileUtils.java b/src/main/java/com/docus/bgts/utils/FileUtils.java new file mode 100644 index 0000000..f60a323 --- /dev/null +++ b/src/main/java/com/docus/bgts/utils/FileUtils.java @@ -0,0 +1,40 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.utils; + +import com.alibaba.fastjson.JSON; +import com.docus.bgts.emr.enums.Codes; +import java.io.File; +import java.io.IOException; +import java.util.Map; + +public class FileUtils { + public static String currentPath() { + File dir = new File("."); + String currentpath = ""; + + try { + currentpath = dir.getCanonicalPath(); + } catch (IOException e) { + e.printStackTrace(); + } + + return currentpath; + } + + public static Object getJsonByName(String name) { + String path = currentPath(); + String json = JsonUtils.readJsonFile(path + Codes.JSON_ADDRESS.getMessage()); + Map jsonMap = (Map)JSON.parseObject(json, Map.class); + return jsonMap.get(name); + } + + public static String readJsonFromCurrentProject(String fileName) { + String path = currentPath(); + String filePath = path + File.separator + fileName; + return JsonUtils.readJsonFile(filePath); + } +} diff --git a/src/main/java/com/docus/bgts/utils/HttpUtils.java b/src/main/java/com/docus/bgts/utils/HttpUtils.java new file mode 100644 index 0000000..5e5a761 --- /dev/null +++ b/src/main/java/com/docus/bgts/utils/HttpUtils.java @@ -0,0 +1,191 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.utils; + +import com.alibaba.fastjson.JSON; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.client.methods.RequestBuilder; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class HttpUtils { + private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); + private static PoolingHttpClientConnectionManager cm; + private static String EMPTY_STR = ""; + private static String UTF_8 = "UTF-8"; + + private static void init() { + if (cm == null) { + cm = new PoolingHttpClientConnectionManager(); + cm.setMaxTotal(50); + cm.setDefaultMaxPerRoute(5); + } + + } + + private static CloseableHttpClient getHttpClient() { + init(); + return HttpClients.custom().setConnectionManager(cm).build(); + } + + public static String get(String url) { + HttpGet httpGet = new HttpGet(url); + return getResult((HttpRequestBase)httpGet); + } + + public static String get(String url, Map params) throws URISyntaxException { + URIBuilder ub = new URIBuilder(); + ub.setPath(url); + ArrayList pairs = covertParams2NVPS(params); + ub.setParameters(pairs); + HttpGet httpGet = new HttpGet(ub.build()); + return getResult((HttpRequestBase)httpGet); + } + + public static String get(String url, Map headers, Map params) throws URISyntaxException { + URIBuilder ub = new URIBuilder(); + ub.setPath(url); + if (params != null) { + ArrayList pairs = covertParams2NVPS(params); + ub.setParameters(pairs); + } + + HttpGet httpGet = new HttpGet(ub.build()); + + for(Map.Entry param : headers.entrySet()) { + httpGet.addHeader((String)param.getKey(), String.valueOf(param.getValue())); + } + + return getResult((HttpRequestBase)httpGet); + } + + public static String post(String url) { + HttpPost httpPost = new HttpPost(url); + return getResult((HttpRequestBase)httpPost); + } + + public static String post(String url, Map params) throws UnsupportedEncodingException { + HttpPost httpPost = new HttpPost(url); + httpPost.setEntity(new UrlEncodedFormEntity(covertParams2NVPS(params), "utf-8")); + return getResult((HttpRequestBase)httpPost); + } + + public static String post(String url, Object params, Map head) throws UnsupportedEncodingException { + HttpPost httpPost = new HttpPost(url); + System.out.println(params); + httpPost.setEntity(new StringEntity(params.toString())); + if (params != null) { + for(Map.Entry param : head.entrySet()) { + httpPost.addHeader((String)param.getKey(), String.valueOf(param.getValue())); + } + } + + return getResult((HttpRequestBase)httpPost); + } + + private static ArrayList covertParams2NVPS(Map params) { + ArrayList pairs = new ArrayList(); + + for(Map.Entry param : params.entrySet()) { + if (param.getValue() != null) { + pairs.add(new BasicNameValuePair((String)param.getKey(), (String)param.getValue())); + } + } + + return pairs; + } + + public static String post(String url, Map headers, Map params) throws UnsupportedEncodingException { + HttpPost httpPost = new HttpPost(url); + System.out.println(params); + if (params != null) { + for(Map.Entry param : headers.entrySet()) { + httpPost.addHeader((String)param.getKey(), String.valueOf(param.getValue())); + } + } + + log.info("调用下载参数----" + JSON.toJSONString(params)); + httpPost.setEntity(new StringEntity(JSON.toJSONString(params), ContentType.APPLICATION_JSON)); + return getResult((HttpRequestBase)httpPost); + } + + public static String postSubmit(String url, Map headers, Map> params) throws UnsupportedEncodingException { + HttpPost httpPost = new HttpPost(url); + if (params != null) { + for(Map.Entry param : headers.entrySet()) { + httpPost.addHeader((String)param.getKey(), String.valueOf(param.getValue())); + } + } + + httpPost.setEntity(new StringEntity(JSON.toJSONString(params), ContentType.APPLICATION_JSON)); + return getResult((HttpRequestBase)httpPost); + } + + private static String getResult(HttpRequestBase request) { + CloseableHttpClient httpClient = getHttpClient(); + + try { + CloseableHttpResponse response = httpClient.execute(request); + HttpEntity entity = response.getEntity(); + if (entity != null) { + String result = EntityUtils.toString(entity, UTF_8); + response.close(); + return result; + } + } catch (ClientProtocolException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + ; + } + + return EMPTY_STR; + } + + private static String getResult(RequestBuilder requestBuilder) { + CloseableHttpClient httpClient = getHttpClient(); + + try { + CloseableHttpResponse response = httpClient.execute(requestBuilder.build()); + HttpEntity entity = response.getEntity(); + if (entity != null) { + String result = EntityUtils.toString(entity, UTF_8); + response.close(); + return result; + } + } catch (ClientProtocolException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + ; + } + + return EMPTY_STR; + } +} diff --git a/src/main/java/com/docus/bgts/utils/JsonUtils.java b/src/main/java/com/docus/bgts/utils/JsonUtils.java new file mode 100644 index 0000000..e294be8 --- /dev/null +++ b/src/main/java/com/docus/bgts/utils/JsonUtils.java @@ -0,0 +1,52 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.utils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; + +public class JsonUtils { + public static String readJsonFile(String fileName) { + String jsonStr = ""; + Reader reader = null; + FileReader fileReader = null; + + + try { + File jsonFile = new File(fileName); + fileReader = new FileReader(jsonFile); + reader = new InputStreamReader(new FileInputStream(jsonFile), "utf-8"); + int ch = 0; + StringBuffer sb = new StringBuffer(); + + while((ch = reader.read()) != -1) { + sb.append((char)ch); + } + + fileReader.close(); + reader.close(); + jsonStr = sb.toString(); + String var7 = jsonStr; + return var7; + } catch (IOException e) { + e.printStackTrace(); + return null; + } finally { + try { + reader.close(); + fileReader.close(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + } +} diff --git a/src/main/java/com/docus/bgts/utils/TableJsonRead.java b/src/main/java/com/docus/bgts/utils/TableJsonRead.java new file mode 100644 index 0000000..8771415 --- /dev/null +++ b/src/main/java/com/docus/bgts/utils/TableJsonRead.java @@ -0,0 +1,205 @@ +package com.docus.bgts.utils; + +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.util.StringUtils; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; + +public class TableJsonRead { + + /** + * 读取数据结构 + * @param path 路径后缀 + * @param fileName 文件名称 + * @return + */ + public T Read(String path,String fileName,Class clazz){ + String currentPath=CurrentPath(); + path = currentPath+"\\"+path; + StringBuilder sb = new StringBuilder(); + T dto =null; + File file = new File(path+"\\"+fileName); + try { + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + if (!file.exists()) { + try { + file.createNewFile(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + BufferedReader bufferedReader = null; + bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); + String line; + while (!StringUtils.isEmpty(line = bufferedReader.readLine())) { + sb.append(line); + } + if (sb.length() > 0) { + ObjectMapper objectMapper = new ObjectMapper(); + //dto = (T)JSONObject.parse(sb.toString()); + dto= objectMapper.readValue(sb.toString(), clazz); + //dto = objectMapper.convertValue(o, new TypeReference() { }); + } + bufferedReader.close(); + } + + return dto; + } + catch (Exception ex){ + ex.printStackTrace(); + return null; + } + } + + public T Read(File file,Class clazz) { + StringBuilder sb = new StringBuilder(); + T dto =null; + try { + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + if (!file.exists()) { + try { + file.createNewFile(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + BufferedReader bufferedReader = null; + bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); + String line; + while (!StringUtils.isEmpty(line = bufferedReader.readLine())) { + sb.append(line); + } + if (sb.length() > 0) { + ObjectMapper objectMapper = new ObjectMapper(); + //dto = (T)JSONObject.parse(sb.toString()); + dto= objectMapper.readValue(sb.toString(), clazz); + //dto = objectMapper.convertValue(o, new TypeReference() { }); + } + bufferedReader.close(); + } + + return dto; + } + catch (Exception ex){ + ex.printStackTrace(); + return null; + } + } + /** + * 取得当前jar路径 + * @return + */ + public static String CurrentPath(){ + File dir = new File("."); + String currentpath =""; + try { + currentpath = dir.getCanonicalPath(); + } catch (IOException e) { + e.printStackTrace(); + } + return currentpath; + } + + /** + * 取得当前jar路径 + * @return + */ + public static String currentPath(String dir){ + String path = CurrentPath() + File.separator + dir; + File file = new File(path); + if (!file.exists()) { + file.mkdirs(); + } + return path; + } + + public static void main(String[] args) { + TableJsonRead tableJsonRead = new TableJsonRead(); + JSONObject config = tableJsonRead.Read("dataConfig", "EmrPushConf.json", JSONObject.class); + System.out.println(config); + } + + /** + * 读取文件内容 + * @param path + * @param fileName + * @return + */ + public String ReadContent(String path,String fileName){ + String currentPath=CurrentPath(); + path = currentPath+"\\"+path; + StringBuilder sb = new StringBuilder(); + File file = new File(path+"\\"+fileName); + try { + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + if (!file.exists()) { + try { + file.createNewFile(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + BufferedReader bufferedReader = null; + bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); + String line; + while (!StringUtils.isEmpty(line = bufferedReader.readLine())) { + sb.append(line); + } + + bufferedReader.close(); + } + + return sb.toString(); + } + catch (Exception ex){ + ex.printStackTrace(); + return null; + } + } + + /** + * 保存json至文件 + * @param path 路径后缀 + * @param fileName 文件名称 + * @param data json信息 + * @return + */ + public void Save(String path,String fileName,String data){ + String currentPath=CurrentPath(); + path = currentPath+"\\"+path; + FileWriter fwriter = null; + try { + File file = new File(path); + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + fwriter = new FileWriter(path+"\\"+fileName); + fwriter.write(data); + } catch (IOException ex) { + ex.printStackTrace(); + } finally { + try { + fwriter.flush(); + fwriter.close(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + +} diff --git a/src/main/java/com/docus/bgts/utils/XmlUtil.java b/src/main/java/com/docus/bgts/utils/XmlUtil.java new file mode 100644 index 0000000..7231457 --- /dev/null +++ b/src/main/java/com/docus/bgts/utils/XmlUtil.java @@ -0,0 +1,315 @@ +/* + * 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.bgts.utils; + +import com.docus.core.util.Exceptions; +import com.docus.core.util.IoUtil; +import com.docus.core.util.StringUtil; +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); + } + + /** + * xml遇到的特殊字符替换 + */ + public static String specialCharacterSubstitution(String str){ + str = StringUtil.replace(str, "\u00A0", " "); + return str; + } + + /** + * 转换工具类 + * + * @param xmlStr xmlStr + * @return XmlUtil + */ + public static XmlUtil of(String xmlStr) { + xmlStr=specialCharacterSubstitution(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(); + } + +} diff --git a/src/main/java/com/docus/bgts/utils/XmlUtils.java b/src/main/java/com/docus/bgts/utils/XmlUtils.java new file mode 100644 index 0000000..3d5c287 --- /dev/null +++ b/src/main/java/com/docus/bgts/utils/XmlUtils.java @@ -0,0 +1,104 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.utils; + +import com.alibaba.fastjson.JSON; +import com.docus.bgts.emr.enums.Codes; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class XmlUtils { + private SAXReader saxReader = new SAXReader(); + private Document document; + + public Document getDocument() { + return this.document; + } + + public XmlUtils(String path) { + try { + this.document = this.saxReader.read(path); + } catch (DocumentException e) { + e.printStackTrace(); + } + + } + + public XmlUtils(InputStream path) { + try { + this.document = this.saxReader.read(path); + } catch (DocumentException e) { + e.printStackTrace(); + } + + } + + + + public Element getElement(List directory) { + Element root = this.document.getRootElement(); + Element current = root; + + for(String dire : directory) { + current = current.element(dire); + } + + if (current == null) { + throw new RuntimeException("未找到对应节点"); + } else { + return current; + } + } + + public List getJsonByName(Element root) { + String path = FileUtils.currentPath(); + String json = JsonUtils.readJsonFile(path + Codes.JSON_ADDRESS.getMessage()); + Map jsonMap = (Map)JSON.parseObject(json, Map.class); + List basicArr = (List)jsonMap.get("doubleBasic"); + List elements = null; + + for(String basic : basicArr) { + elements = root.elements(basic); + if (elements != null && elements.size() > 0) { + break; + } + } + + if (elements == null || elements.size() == 0) { + elements = new ArrayList(); + elements.add(root); + } + + return elements; + } + + public Element getMsgElement() { + String path = FileUtils.currentPath(); + String json = JsonUtils.readJsonFile(path + Codes.JSON_ADDRESS.getMessage()); + Map jsonMap = (Map)JSON.parseObject(json, Map.class); + List directory = (List)jsonMap.get("directory"); + Element root = this.getElement(directory); + return root; + } + + public String getElementText(String name) { + Element root = this.document.getRootElement(); + Element msg = root.element(Codes.MSG.getMessage()); + if (msg == null) { + throw new RuntimeException("没有" + Codes.MSG.getMessage() + "节点"); + } else { + Element element = msg.element(name); + return element == null ? null : element.getText(); + } + } +} diff --git a/src/main/java/com/docus/bgts/wzh/entity/AfCollectTask.java b/src/main/java/com/docus/bgts/wzh/entity/AfCollectTask.java new file mode 100644 index 0000000..12a92a3 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/entity/AfCollectTask.java @@ -0,0 +1,56 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@ApiModel( + value = "AfCollectTask对象", + description = "病案采集任务" +) +@Data +public class AfCollectTask implements Serializable { + private static final long serialVersionUID = 1L; + @ApiModelProperty("id 雪花算法") + @TableId( + value = "id", + type = IdType.ASSIGN_ID + ) + private Long id; + @ApiModelProperty("病案主键") + private String patientId; + @ApiModelProperty("af_archive_detail表id") + private Long afArchiveDetailId; + @ApiModelProperty("来源 1护理文书,2 电子病历,3 Pacs检查,4心电图,5手麻系统,6 Lis检验,7病案首页,8长临医嘱") + private String sysflag; + @ApiModelProperty("开始时间") + private Date startTime; + @ApiModelProperty("结束时间") + private Date endTime; + @ApiModelProperty("任务状态 0:未开始,1:完成,2:重新采集") + private String state; + @ApiModelProperty("同步时间") + private Date syncTime; + @ApiModelProperty("最新重新采集时间") + private Date recollectTime; + @ApiModelProperty("最新重新采集人") + private String recollectName; + @ApiModelProperty("备注") + private String remark; + @ApiModelProperty("报告唯一单号") + private String c1; + @ApiModelProperty("文件标题") + private String c2; + @ApiModelProperty("记账号") + private String c3; +} diff --git a/src/main/java/com/docus/bgts/wzh/entity/AfInterfaceCollect.java b/src/main/java/com/docus/bgts/wzh/entity/AfInterfaceCollect.java new file mode 100644 index 0000000..abce1b8 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/entity/AfInterfaceCollect.java @@ -0,0 +1,30 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@ApiModel("文件库中的省中医病案采集表") +@Data +public class AfInterfaceCollect implements Serializable { + private Long id; + @ApiModelProperty("任务流水号") + private String serialnum; + @ApiModelProperty("记账号") + private String jzh; + @ApiModelProperty("任务数") + private Integer taskCount; + @ApiModelProperty("完成数") + private Integer completeCount; + @ApiModelProperty("创建时间") + private Date createTime; + +} diff --git a/src/main/java/com/docus/bgts/wzh/entity/AfInterfaceCollectSub.java b/src/main/java/com/docus/bgts/wzh/entity/AfInterfaceCollectSub.java new file mode 100644 index 0000000..1f344a9 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/entity/AfInterfaceCollectSub.java @@ -0,0 +1,33 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@ApiModel("文件库中的省中医病案采集-子任务表") +@Data +public class AfInterfaceCollectSub implements Serializable { + private Long id; + @ApiModelProperty("af_interface_collect表id") + private Long afInterfaceCollectId; + @ApiModelProperty("采集器id") + private String collectsysCode; + @ApiModelProperty("子任务流水号 同一份文件子任务需一致") + private String serialnumSub; + @ApiModelProperty("记账号") + private String jzh; + @ApiModelProperty("分类名称") + private String assortName; + @ApiModelProperty("状态 0:未发起,1:成功,2:失败") + private Integer state; + @ApiModelProperty("请求信息") + private String requestMessage; + +} diff --git a/src/main/java/com/docus/bgts/wzh/entity/CanlcelDto.java b/src/main/java/com/docus/bgts/wzh/entity/CanlcelDto.java new file mode 100644 index 0000000..6964d9a --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/entity/CanlcelDto.java @@ -0,0 +1,18 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@ApiModel("撤销文件类") +@Data +public class CanlcelDto { + @ApiModelProperty("采集流水号") + private String serialnum; + +} diff --git a/src/main/java/com/docus/bgts/wzh/entity/CqcSubmitState.java b/src/main/java/com/docus/bgts/wzh/entity/CqcSubmitState.java new file mode 100644 index 0000000..f823fe9 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/entity/CqcSubmitState.java @@ -0,0 +1,17 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.entity; + +import lombok.Data; + +@Data +public class CqcSubmitState { + private static final long serialVersionUID = 1L; + private String patientId; + private Integer doctorState; + private Integer nurseState; + +} diff --git a/src/main/java/com/docus/bgts/wzh/entity/MrReportError.java b/src/main/java/com/docus/bgts/wzh/entity/MrReportError.java new file mode 100644 index 0000000..5688382 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/entity/MrReportError.java @@ -0,0 +1,25 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@ApiModel("错误日志表") +@Data +public class MrReportError { + private Long id; + @ApiModelProperty("上报信息") + private String xml; + @ApiModelProperty("上报类型") + private Integer reportType; + @ApiModelProperty("上报时间") + private Date createTime; + +} diff --git a/src/main/java/com/docus/bgts/wzh/entity/TBasic.java b/src/main/java/com/docus/bgts/wzh/entity/TBasic.java new file mode 100644 index 0000000..7d32d0b --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/entity/TBasic.java @@ -0,0 +1,173 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@ApiModel( + value = "TBasic对象", + description = "病案基本信息" +) +@Data +public class TBasic implements Serializable { + private static final long serialVersionUID = 1L; + @ApiModelProperty("病案主键") + @TableId( + value = "patient_id", + type = IdType.ASSIGN_ID + ) + private String patientId; + @ApiModelProperty("住院次数") + private Integer admissTimes; + @ApiModelProperty("病案号") + private String inpatientNo; + @ApiModelProperty("住院id号") + private String admissId; + @ApiModelProperty("患者姓名") + private String name; + @ApiModelProperty("盘号") + private String ph; + @ApiModelProperty("患者姓名首拼") + private String nameSpell; + @ApiModelProperty("性别") + private String sex; + @ApiModelProperty("年龄_岁") + private Integer age; + @ApiModelProperty("年龄_月") + private Integer ageMonth; + @ApiModelProperty("年龄_天") + private Integer ageDay; + @ApiModelProperty("身份证") + private String idCard; + @ApiModelProperty("手机号码") + private String telphone; + @ApiModelProperty("住院日期") + private Date admissDate; + @ApiModelProperty("住院科室") + private String admissDept; + @ApiModelProperty("住院科室名称") + private String admissDeptName; + @ApiModelProperty("出院日期") + private Date disDate; + @ApiModelProperty("出院科室") + private String disDept; + @ApiModelProperty("出院科室名称") + private String disDeptName; + @ApiModelProperty("实际住院天数") + private Integer admissDays; + @ApiModelProperty("主管医生") + private String attending; + @ApiModelProperty("主管医生名称") + private String attendingName; + @ApiModelProperty("主要诊断编码") + private String mainDiagCode; + @ApiModelProperty("主要诊断名称") + private String mainDiagName; + @ApiModelProperty("主要手术编码") + private String mainOperateCode; + @ApiModelProperty("主要手术名称") + private String mainOperateName; + @ApiModelProperty("是否死亡") + private Integer isDead; + @ApiModelProperty("是否作废(0:否,1:是)") + private Integer isCancel; + @ApiModelProperty("签收时间") + private Date signTime; + @ApiModelProperty("创建时间") + private Date createTime; + @ApiModelProperty("修改时间") + private Date updateTime; + @ApiModelProperty("是否归档 1:已归档,0:未归档") + private Integer isArchive; + @ApiModelProperty("归档时间") + private Date archiveTime; + @ApiModelProperty("1 归档采集(pdf),2 异地扫描(图片),3 现场扫描(pdf),4 其他来源") + private Integer fileSource; + @ApiModelProperty("完整性描述") + private String integrityDesc; + @ApiModelProperty("扫描生产软件-视频脑电图号") + private String bColumn1; + @ApiModelProperty("扫描生产软件-ep号") + private String bColumn2; + @ApiModelProperty("茂名流水号") + private String bColumn3; + @ApiModelProperty("扫描生产软件-门诊号") + private String bColumn4; + @ApiModelProperty("b_column5") + private String bColumn5; + @ApiModelProperty("b_column6") + private Integer bColumn6; + @ApiModelProperty("b_column7") + private Integer bColumn7; + @ApiModelProperty("b_column8") + private Integer bColumn8; + @ApiModelProperty("b_column9") + private Integer bColumn9; + @ApiModelProperty("b_column10") + private Integer bColumn10; + @ApiModelProperty("性别名称") + private String sexName; + @ApiModelProperty("记账号(省中医患者主索引id)") + private String jzh; + @ApiModelProperty("患者主索引号(省中医记账号)") + private String empId; + @ApiModelProperty("visit_type_code") + private String visitTypeCode; + @ApiModelProperty("visit_type_name") + private String visitTypeName; + @ApiModelProperty("tcm_diag_code") + private String tcmDiagCode; + @ApiModelProperty("tcm_diag_name") + private String tcmDiagName; + @ApiModelProperty("ward_palce") + private String wardPalce; + @ApiModelProperty("床号位") + private String bedNum; + @ApiModelProperty("接收时间,目前澄海人医 使用") + private Date receiveTime; + @ApiModelProperty("状态 1:封存,3:锁定") + private Integer state; + @ApiModelProperty("是否扫描 2否 1是") + private String scanSource; + @ApiModelProperty("暂缓审核配置id ,隔开") + private String cqcDeferAuditConfigId; + @ApiModelProperty("病案是否批注 0:没有批注 1:有批注") + private Integer commentStatus; + @ApiModelProperty("医生提交状态(0:未提交,1:已提交)") + private Integer doctorState; + @ApiModelProperty("护士提交状态") + private Integer nurseState; + @ApiModelProperty("纸质签收 0:未签收 1:已签收") + private Integer cqcSigninfo; + @ApiModelProperty("责任护士") + private String dutyNurse; + @ApiModelProperty("审核状态 0:否 1:是") + private Integer tagState; + @ApiModelProperty("是否手术") + private String isOper; + @ApiModelProperty("现住址") + private String homeAddr; + @ApiModelProperty("损伤中毒") + private String poisoningName; + @ApiModelProperty("病理诊断") + private String pathologyName; + @ApiModelProperty("其他诊断") + private String otherDiagName; + @ApiModelProperty("联系方式") + private String homeTel; + + public void setIsDead(String isDead) { + this.isDead = isDead != null && isDead.toLowerCase().equals("y") ? 1 : 0; + } + +} diff --git a/src/main/java/com/docus/bgts/wzh/entity/TBasicExtend.java b/src/main/java/com/docus/bgts/wzh/entity/TBasicExtend.java new file mode 100644 index 0000000..c444630 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/entity/TBasicExtend.java @@ -0,0 +1,45 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@ApiModel( + value = "TBasicExtend对象", + description = "病案基本信息扩展表" +) +@Data +public class TBasicExtend { + @ApiModelProperty("病案主键") + @TableId( + value = "patient_id", + type = IdType.ASSIGN_ID + ) + private String patientId; + @ApiModelProperty("报销政策代码") + private String claimPolicyCode; + @ApiModelProperty("报销政策名称") + private String claimPolicyName; + @ApiModelProperty("医保结算类型代码") + private String mioSettleTypeCode; + @ApiModelProperty("医保结算类型名称") + private String mioSettleTypeName; + @ApiModelProperty("医生提交时间") + private Date doctorSubmitTime; + @ApiModelProperty("护理提交时间") + private Date nurseSubmitTime; + @ApiModelProperty("责任护士") + private String dutyNurse; + @ApiModelProperty("预住院流水号") + private String preJzh; + +} diff --git a/src/main/java/com/docus/bgts/wzh/entity/ZdAssort.java b/src/main/java/com/docus/bgts/wzh/entity/ZdAssort.java new file mode 100644 index 0000000..4a66e7a --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/entity/ZdAssort.java @@ -0,0 +1,36 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@ApiModel( + value = "ZdAssort对象", + description = "病案分类" +) +@Data +public class ZdAssort implements Serializable { + private static final long serialVersionUID = 1L; + @ApiModelProperty("分类id") + private String assortId; + @ApiModelProperty("分类名称") + private String assortName; + @ApiModelProperty("分类排序") + private Integer assortSort; + @ApiModelProperty("是否启用 1是,0否") + private Integer effective; + @ApiModelProperty("是否校验 1是,0否") + private Integer isCheck; + @ApiModelProperty("代码分类") + private String assortCode; + @ApiModelProperty("等级") + private Integer level; + +} diff --git a/src/main/java/com/docus/bgts/wzh/facade/IAfCollectTaskService.java b/src/main/java/com/docus/bgts/wzh/facade/IAfCollectTaskService.java new file mode 100644 index 0000000..b929467 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/facade/IAfCollectTaskService.java @@ -0,0 +1,58 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.facade; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.docus.bgts.rpc.dto.ReportDownDto; +import com.docus.bgts.wzh.entity.AfCollectTask; +import com.docus.bgts.wzh.entity.CanlcelDto; +import com.docus.bgts.wzh.entity.TBasic; +import com.docus.bgts.wzh.entity.ZdAssort; + +import java.util.List; + +public interface IAfCollectTaskService extends IService { + String getpatientIdByJzh(String jzh); + + String getpatientIdBysealId(String sealId); + + String getNameByPatientId(String patientId); + + String getOutpatientIdByJzhel(String jzh); + + void insertTask(ReportDownDto reportDownDto); + + void insertSeal(ReportDownDto reportDownDto); + + void updateInterfaceCollect(String collectSubId, int state); + + List listJZHByDate(String date1, String date2); + + void invokeRepoalFile(CanlcelDto canlcelDto) throws Exception; + + String selectJzh(String inPatientNo, String examApplyDate); + + String getAssortIdByAssortId(String assortId); + + String getAssortIdByAssortName(String assortId); + + void insertZdAssort(ZdAssort zdAssort); + + int cancelTsaByPatientIdAndSource(String patientId, String assortId); + + + int updateNurseSubmitTime(ReportDownDto reportDownDto, String nurseSubmitTime, String nurseSubmitName); + + int updateDoctorSubmitTime(ReportDownDto reportDownDto, String doctorSubmitTime, String doctorSubmitName); + + void insertNurseState(ReportDownDto reportDownDto, String nurseSubmitTime); + + void insertDoctorState(ReportDownDto reportDownDto, String doctorSubmitTime); + + TBasic selectDisDateIsNull(String inPatientNo); + + String selectDisDateIsNullJzh(String inPatientNo, String examApplyDate); +} diff --git a/src/main/java/com/docus/bgts/wzh/facade/IMrReportErrorService.java b/src/main/java/com/docus/bgts/wzh/facade/IMrReportErrorService.java new file mode 100644 index 0000000..d3a9053 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/facade/IMrReportErrorService.java @@ -0,0 +1,10 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.facade; + +public interface IMrReportErrorService { + void insert(String xml); +} diff --git a/src/main/java/com/docus/bgts/wzh/mapper/AfCollectTaskMapper.java b/src/main/java/com/docus/bgts/wzh/mapper/AfCollectTaskMapper.java new file mode 100644 index 0000000..090cc15 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/mapper/AfCollectTaskMapper.java @@ -0,0 +1,49 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.docus.bgts.wzh.entity.AfCollectTask; +import com.docus.bgts.wzh.entity.CqcSubmitState; +import com.docus.bgts.wzh.entity.TBasic; +import com.docus.bgts.wzh.entity.ZdAssort; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface AfCollectTaskMapper extends BaseMapper { + List listJZHByDate(@Param("date1") String date1, @Param("date2") String date2); + + String getpatientIdByJzh(@Param("jzh") String jzh); + + String getPatientIdBysealId(@Param("sealId") String sealId); + + String selectJzh(@Param("inPatientNo") String inPatientNo, @Param("examApplyDate") String examApplyDate); + + TBasic selectDisDateIsNull(@Param("inPatientNo") String inPatientNo); + + String selectDisDateIsNullJzh(@Param("inPatientNo") String inPatientNo, @Param("examApplyDate") String examApplyDate); + + String getAssortIdByAssortId(@Param("assortId") String assortId); + + String getAssortIdByAssortName(@Param("assortName") String assortName); + + void insertZdAssort(@Param("zdAssort") ZdAssort zdAssort); + + + int cancelTsaByPatientIdAndSource(@Param("patientId") String patientId, @Param("source") String source); + + + int insertDoctorState(CqcSubmitState cqcSubmitState); + + int updateDoctorState(CqcSubmitState cqcSubmitState); + + CqcSubmitState selectByPatientId(String patientId); + + String selectPatientByjzh(String jzh); + + String selectNameByPatientId(String patientId); +} diff --git a/src/main/java/com/docus/bgts/wzh/mapper/AfInterfaceCollectMapper.java b/src/main/java/com/docus/bgts/wzh/mapper/AfInterfaceCollectMapper.java new file mode 100644 index 0000000..afb0595 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/mapper/AfInterfaceCollectMapper.java @@ -0,0 +1,12 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.docus.bgts.wzh.entity.AfInterfaceCollect; + +public interface AfInterfaceCollectMapper extends BaseMapper { +} diff --git a/src/main/java/com/docus/bgts/wzh/mapper/AfInterfaceCollectSubMapper.java b/src/main/java/com/docus/bgts/wzh/mapper/AfInterfaceCollectSubMapper.java new file mode 100644 index 0000000..cfb99f2 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/mapper/AfInterfaceCollectSubMapper.java @@ -0,0 +1,12 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.docus.bgts.wzh.entity.AfInterfaceCollectSub; + +public interface AfInterfaceCollectSubMapper extends BaseMapper { +} diff --git a/src/main/java/com/docus/bgts/wzh/mapper/MrReportErrorMapper.java b/src/main/java/com/docus/bgts/wzh/mapper/MrReportErrorMapper.java new file mode 100644 index 0000000..159c1a3 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/mapper/MrReportErrorMapper.java @@ -0,0 +1,13 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.mapper; + +import com.docus.bgts.wzh.entity.MrReportError; +import org.apache.ibatis.annotations.Param; + +public interface MrReportErrorMapper { + void save(@Param("mrReportError") MrReportError mrReportError); +} diff --git a/src/main/java/com/docus/bgts/wzh/mapper/TBasicExtendMapper.java b/src/main/java/com/docus/bgts/wzh/mapper/TBasicExtendMapper.java new file mode 100644 index 0000000..ac985e7 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/mapper/TBasicExtendMapper.java @@ -0,0 +1,17 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.docus.bgts.wzh.entity.TBasicExtend; + +public interface TBasicExtendMapper extends BaseMapper { + TBasicExtend selectByPatientId(String patientId); + + int updatenurseSubmitTime(TBasicExtend tBasicExtend); + + int updateDoctorSubmitTime(TBasicExtend tBasicExtend); +} diff --git a/src/main/java/com/docus/bgts/wzh/mapper/TBasicMapper.java b/src/main/java/com/docus/bgts/wzh/mapper/TBasicMapper.java new file mode 100644 index 0000000..681bad0 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/mapper/TBasicMapper.java @@ -0,0 +1,17 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.docus.bgts.wzh.entity.TBasic; + +public interface TBasicMapper extends BaseMapper { + TBasic selectByjzh(String jzh); + + TBasic selectByPatientId(String patientId); + + int update(TBasic tbasic); +} diff --git a/src/main/java/com/docus/bgts/wzh/mapper/TScanAssortMapper.java b/src/main/java/com/docus/bgts/wzh/mapper/TScanAssortMapper.java new file mode 100644 index 0000000..016404f --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/mapper/TScanAssortMapper.java @@ -0,0 +1,14 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.docus.bgts.wzh.entity.TBasic; +import org.apache.ibatis.annotations.Param; + +public interface TScanAssortMapper extends BaseMapper { + int updateByPatientId(@Param("patientId") String PatientId, @Param("PrePatientId") String PrePatientId); +} diff --git a/src/main/java/com/docus/bgts/wzh/service/AfCollectTaskServiceImpl.java b/src/main/java/com/docus/bgts/wzh/service/AfCollectTaskServiceImpl.java new file mode 100644 index 0000000..d61f431 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/service/AfCollectTaskServiceImpl.java @@ -0,0 +1,401 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.service; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.docus.bgts.emr.enums.Codes; +import com.docus.bgts.rpc.dto.ReportDownDto; +import com.docus.bgts.rpc.dto.ReportDownScanFileDto; +import com.docus.bgts.utils.FileUtils; +import com.docus.bgts.utils.HttpUtils; +import com.docus.bgts.wzh.entity.AfCollectTask; +import com.docus.bgts.wzh.entity.AfInterfaceCollect; +import com.docus.bgts.wzh.entity.AfInterfaceCollectSub; +import com.docus.bgts.wzh.entity.CanlcelDto; +import com.docus.bgts.wzh.entity.TBasic; +import com.docus.bgts.wzh.entity.TBasicExtend; +import com.docus.bgts.wzh.entity.ZdAssort; +import com.docus.bgts.wzh.facade.IAfCollectTaskService; +import com.docus.bgts.wzh.mapper.AfCollectTaskMapper; +import com.docus.bgts.wzh.mapper.AfInterfaceCollectMapper; +import com.docus.bgts.wzh.mapper.AfInterfaceCollectSubMapper; +import com.docus.bgts.wzh.mapper.TBasicExtendMapper; +import com.docus.bgts.wzh.mapper.TBasicMapper; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +@Service +public class AfCollectTaskServiceImpl extends ServiceImpl implements IAfCollectTaskService { + private final Logger log = LoggerFactory.getLogger(this.getClass()); + @Autowired + AfCollectTaskMapper afCollectTaskMapper; + @Autowired + AfInterfaceCollectMapper afInterfaceCollectMapper; + @Autowired + AfInterfaceCollectSubMapper afInterfaceCollectSubMapper; + @Autowired + TBasicExtendMapper tBasicExtendMapper; + @Autowired + TBasicMapper tBasicMapper; + + @Override + public String getpatientIdByJzh(String jzh) { + String patientId = this.afCollectTaskMapper.getpatientIdByJzh(jzh); + return patientId; + } + + @Override + public String getpatientIdBysealId(String sealId) { + return this.afCollectTaskMapper.getPatientIdBysealId(sealId); + } + + @Override + public String getNameByPatientId(String patientId) { + return this.afCollectTaskMapper.selectNameByPatientId(patientId); + } + + @Override + public String getOutpatientIdByJzhel(String jzh) { + return this.afCollectTaskMapper.selectPatientByjzh(jzh); + } + + @Override + @Transactional + public void insertTask(ReportDownDto reportDownDto) { + Date date = new Date(); + String collectorid = reportDownDto.getCollectorid(); + String patientId = reportDownDto.getPatient().getPatientid(); + List scanfiles = reportDownDto.getScanfiles(); + QueryWrapper patientTaskWrapper = new QueryWrapper().eq("patient_id", patientId).eq("sysflag", collectorid); + List collectTaskList = afCollectTaskMapper.selectList(patientTaskWrapper); + Map collectTaskMap = collectTaskList.stream() + .collect(Collectors.toMap(AfCollectTask::getC1, Function.identity())); + + for (ReportDownScanFileDto scanfile : scanfiles) { + AfCollectTask afCollectTask; + if (collectTaskMap.containsKey(scanfile.getSerialnum())) { + afCollectTask = collectTaskMap.get(scanfile.getSerialnum()); + afCollectTask.setState("0"); + afCollectTask.setSyncTime(date); + afCollectTask.setC1(scanfile.getSerialnum()); + afCollectTask.setC2(scanfile.getFiletitle()); + afCollectTaskMapper.updateById(afCollectTask); + } else { + afCollectTask = new AfCollectTask(); + afCollectTask.setPatientId(patientId); + afCollectTask.setSysflag(collectorid); + afCollectTask.setState("0"); + afCollectTask.setSyncTime(date); + afCollectTask.setC1(scanfile.getSerialnum()); + afCollectTask.setC2(scanfile.getFiletitle()); + afCollectTask.setC3(reportDownDto.getPatient().getJzh()); + afCollectTaskMapper.insert(afCollectTask); + } + scanfile.setTaskid(afCollectTask.getId()); + } + } + + @Override + public void insertSeal(ReportDownDto reportDownDto) { + if (((ReportDownScanFileDto) reportDownDto.getScanfiles().get(0)).getFiletype() == 1) { + this.log.info("新增封存任务表初始数据:" + reportDownDto); + } + + String patientId = this.getpatientIdBysealId(reportDownDto.getPatient().getSealId()); + if (StringUtils.isBlank(patientId)) { + throw new RuntimeException("操作的病案信息不存在"); + } else { + reportDownDto.getPatient().setPatientid(patientId); + Date date = new Date(); + Integer save = null; + List scanfiles = reportDownDto.getScanfiles(); + + for (ReportDownScanFileDto scanfile : scanfiles) { + long l = System.currentTimeMillis(); + AfCollectTask afCollectTask = (AfCollectTask) this.afCollectTaskMapper.selectOne((Wrapper) ((QueryWrapper) (new QueryWrapper()).eq("C1", scanfile.getSerialnum())).eq("sysflag", reportDownDto.getCollectorid())); + if (afCollectTask != null && afCollectTask.getId() != null) { + afCollectTask.setPatientId(patientId); + afCollectTask.setSysflag(reportDownDto.getCollectorid()); + afCollectTask.setState("0"); + afCollectTask.setSyncTime(date); + afCollectTask.setC1(scanfile.getSerialnum()); + afCollectTask.setC2(scanfile.getFiletitle()); + afCollectTask.setC3(reportDownDto.getPatient().getJzh()); + save = this.afCollectTaskMapper.updateById(afCollectTask); + } else { + afCollectTask = new AfCollectTask(); + afCollectTask.setPatientId(patientId); + afCollectTask.setSysflag(reportDownDto.getCollectorid()); + afCollectTask.setState("0"); + afCollectTask.setSyncTime(date); + afCollectTask.setC1(scanfile.getSerialnum()); + afCollectTask.setC2(scanfile.getFiletitle()); + afCollectTask.setC3(reportDownDto.getPatient().getJzh()); + save = this.afCollectTaskMapper.insert(afCollectTask); + } + + if (save <= 0) { + this.log.info("封存任务表操作出错"); + throw new RuntimeException("封存插入病案任务表数据出错"); + } + + if (afCollectTask.getId() == null) { + this.log.info("封存插入任务id为空!"); + throw new RuntimeException("封存插入任务id为空"); + } + + scanfile.setTaskid(afCollectTask.getId()); + } + + reportDownDto.setScanfiles(scanfiles); + } + } + + @Override + public void updateInterfaceCollect(String collectSubId, int state) { + AfInterfaceCollectSub afInterfaceCollectSub = (AfInterfaceCollectSub) this.afInterfaceCollectSubMapper.selectById(collectSubId); + if (afInterfaceCollectSub == null) { + throw new RuntimeException("afInterfaceCollectSub表数据为空"); + } else { + afInterfaceCollectSub.setState(state); + int i = this.afInterfaceCollectSubMapper.updateById(afInterfaceCollectSub); + if (i <= 0) { + throw new RuntimeException("记录任务数时出错"); + } else { + if (state == 1) { + AfInterfaceCollect afInterfaceCollect = (AfInterfaceCollect) this.afInterfaceCollectMapper.selectById(afInterfaceCollectSub.getAfInterfaceCollectId()); + afInterfaceCollect.setCompleteCount(afInterfaceCollect.getCompleteCount() + 1); + i = this.afInterfaceCollectMapper.updateById(afInterfaceCollect); + if (i <= 0) { + throw new RuntimeException("记录任务数时出错"); + } + } + + } + } + } + + @Override + public List listJZHByDate(String date1, String date2) { + return this.afCollectTaskMapper.listJZHByDate(date1, date2); + } + + @Override + public void invokeRepoalFile(CanlcelDto canlcelDto) throws Exception { + Map headMap = new HashMap(); + headMap.put("Content-Type", "application/json"); + this.log.info("开始文件撤回操作:" + canlcelDto); + String post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.REPOAL.getMessage())), headMap, (Map) JSON.parseObject(JSON.toJSONString(canlcelDto), Map.class)); + Map resMap = (Map) JSON.parseObject(post, Map.class); + if (String.valueOf(resMap.get("code")).equals("500")) { + this.log.error(String.valueOf(resMap.get("msg"))); + throw new RuntimeException(String.valueOf(resMap.get("msg"))); + } + } + + @Override + public String selectJzh(String inPatientNo, String examApplyDate) { + return this.afCollectTaskMapper.selectJzh(inPatientNo, examApplyDate); + } + + @Override + public String getAssortIdByAssortId(String assortId) { + return this.afCollectTaskMapper.getAssortIdByAssortId(assortId); + } + + @Override + public String getAssortIdByAssortName(String assortId) { + return this.afCollectTaskMapper.getAssortIdByAssortName(assortId); + } + + @Override + public void insertZdAssort(ZdAssort zdAssort) { + this.afCollectTaskMapper.insertZdAssort(zdAssort); + } + + @Override + public int cancelTsaByPatientIdAndSource(String patientId, String assortId) { + return this.afCollectTaskMapper.cancelTsaByPatientIdAndSource(patientId, assortId); + } + + @Override + public int updateNurseSubmitTime(ReportDownDto reportDownDto, String nurseSubmitTime, String nurseSubmitName) { + String patientId = this.getpatientIdByJzh(reportDownDto.getPatient().getJzh()); + TBasicExtend tBasicExtend = this.tBasicExtendMapper.selectByPatientId(patientId); + int update = 0; + + try { + if (null != tBasicExtend) { + tBasicExtend.setNurseSubmitTime(new Date()); + update = this.tBasicExtendMapper.updatenurseSubmitTime(tBasicExtend); + if (null != patientId && null != tBasicExtend.getNurseSubmitTime()) { + Map headMap = new HashMap(); + headMap.put("Content-Type", "application/json"); + Map> params = new HashMap(); + List list = new ArrayList(); + list.add("护士"); + list.add((new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(tBasicExtend.getNurseSubmitTime())); + params.put(patientId, list); + params = (Map) JSON.parseObject(JSON.toJSONString(params), Map.class); + String post = HttpUtils.postSubmit("http://192.9.100.171:9102/basic/tlog/saveLog?nodeCode=again_submit&userName=" + nurseSubmitName + "&name=" + nurseSubmitName, headMap, params); + Map resMap = (Map) JSON.parseObject(post, Map.class); + long l7 = System.currentTimeMillis(); + if (String.valueOf(resMap.get("code")).equals("500")) { + this.log.info("调用示踪接口出错!" + String.valueOf(resMap.get("msg"))); + } else { + this.log.info("调用示踪接口返回值为--" + resMap); + } + } + } else { + TBasicExtend tBasicExtend1 = new TBasicExtend(); + tBasicExtend1.setPatientId(patientId); + tBasicExtend1.setNurseSubmitTime((new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).parse(nurseSubmitTime)); + update = this.tBasicExtendMapper.insert(tBasicExtend1); + } + } catch (Exception e) { + e.printStackTrace(); + this.log.error(e.getMessage()); + } + + return update; + } + + @Override + public int updateDoctorSubmitTime(ReportDownDto reportDownDto, String doctorSubmitTime, String doctorSubmitName) { + String patientId = this.getpatientIdByJzh(reportDownDto.getPatient().getJzh()); + TBasicExtend tBasicExtend = this.tBasicExtendMapper.selectByPatientId(patientId); + int update = 0; + this.log.info("医生提交方法------"); + + try { + SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date submitTime = simple.parse(doctorSubmitTime); + if (null != tBasicExtend) { + tBasicExtend.setDoctorSubmitTime(submitTime); + update = this.tBasicExtendMapper.updateDoctorSubmitTime(tBasicExtend); + + try { + if (null != patientId && null != tBasicExtend.getDoctorSubmitTime()) { + Map headMap = new HashMap(); + headMap.put("Content-Type", "application/json"); + Map> params = new HashMap(); + List list = new ArrayList(); + list.add("医生"); + list.add((new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(tBasicExtend.getDoctorSubmitTime())); + params.put(patientId, list); + params = (Map) JSON.parseObject(JSON.toJSONString(params), Map.class); + long l = System.currentTimeMillis(); + String post = HttpUtils.postSubmit("http://192.9.100.171:9102/basic/tlog/saveLog?nodeCode=again_submit&userName=" + doctorSubmitName + "&name=" + doctorSubmitName, headMap, params); + long l1 = System.currentTimeMillis(); + this.log.info("调用示踪接口耗时{}", l1 - l); + Map resMap = (Map) JSON.parseObject(post, Map.class); + long l7 = System.currentTimeMillis(); + if (String.valueOf(resMap.get("code")).equals("500")) { + this.log.info("调用示踪接口出错!" + resMap); + throw new RuntimeException(String.valueOf(resMap.get("msg"))); + } + + this.log.info("调用示踪接口返回----" + resMap); + } else { + this.log.info("未调用示踪接口-----"); + } + } catch (Exception e) { + this.log.error(e.getMessage()); + } + } else { + TBasicExtend tBasicExtend1 = new TBasicExtend(); + tBasicExtend1.setPatientId(patientId); + tBasicExtend1.setDoctorSubmitTime(submitTime); + update = this.tBasicExtendMapper.insert(tBasicExtend1); + } + } catch (Exception e) { + e.printStackTrace(); + this.log.error(e.getMessage()); + } + + return update; + } + + @Override + public void insertNurseState(ReportDownDto reportDownDto, String nurseSubmitTime) { + TBasic tBasic = this.tBasicMapper.selectByjzh(reportDownDto.getPatient().getJzh()); + if (null == tBasic) { + throw new RuntimeException("操作的病案信息不存在"); + } else { + if (null != nurseSubmitTime && !"".equals(nurseSubmitTime)) { + tBasic.setNurseState(1); + int update = this.tBasicMapper.update(tBasic); + if (update > 0) { + this.log.info("护士提交状态修改成功!"); + } else { + this.log.info("护士提交状态修改失败!"); + } + } else { + tBasic.setNurseState(0); + int update = this.tBasicMapper.update(tBasic); + if (update > 0) { + this.log.info("护士提交状态修改成功!"); + } else { + this.log.info("护士提交状态修改失败!"); + } + } + + } + } + + @Override + public void insertDoctorState(ReportDownDto reportDownDto, String doctorSubmitTime) { + TBasic tBasic = this.tBasicMapper.selectByjzh(reportDownDto.getPatient().getJzh()); + if (null == tBasic) { + throw new RuntimeException("操作的病案信息不存在"); + } else { + if (null != doctorSubmitTime && !"".equals(doctorSubmitTime)) { + tBasic.setDoctorState(1); + int update = this.tBasicMapper.update(tBasic); + if (update > 0) { + this.log.info("医生提交状态修改成功!"); + } else { + this.log.info("医生提交状态修改失败!"); + } + } else { + tBasic.setDoctorState(0); + int update = this.tBasicMapper.update(tBasic); + if (update > 0) { + this.log.info("医生提交状态修改成功!"); + } else { + this.log.info("医生提交状态修改失败!"); + } + } + + } + } + + @Override + public TBasic selectDisDateIsNull(String inPatientNo) { + return this.afCollectTaskMapper.selectDisDateIsNull(inPatientNo); + } + + @Override + public String selectDisDateIsNullJzh(String inPatientNo, String examApplyDate) { + return this.afCollectTaskMapper.selectDisDateIsNullJzh(inPatientNo, examApplyDate); + } +} diff --git a/src/main/java/com/docus/bgts/wzh/service/MrReportErrorServiceImpl.java b/src/main/java/com/docus/bgts/wzh/service/MrReportErrorServiceImpl.java new file mode 100644 index 0000000..ce24b62 --- /dev/null +++ b/src/main/java/com/docus/bgts/wzh/service/MrReportErrorServiceImpl.java @@ -0,0 +1,35 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.docus.bgts.wzh.service; + +import com.docus.bgts.utils.FileUtils; +import com.docus.bgts.wzh.entity.MrReportError; +import com.docus.bgts.wzh.facade.IMrReportErrorService; +import com.docus.bgts.wzh.mapper.MrReportErrorMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; + +@Service +public class MrReportErrorServiceImpl implements IMrReportErrorService { + private static final Logger log = LoggerFactory.getLogger(MrReportErrorServiceImpl.class); + @Autowired + MrReportErrorMapper mrReportErrorMapper; + @Override + public void insert(String xml) { + log.info("------发送错误:并记录日志------"); + MrReportError mrReportError = new MrReportError(); + mrReportError.setXml(xml); + mrReportError.setCreateTime(new Date()); + Integer collectorid = Integer.valueOf(String.valueOf(FileUtils.getJsonByName("collectorid"))); + mrReportError.setReportType(collectorid); + this.mrReportErrorMapper.save(mrReportError); + log.info("--------日志记录完成------"); + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..bf1a00b --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,34 @@ +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: + # 发布的webserver类型 电子病历 EMR,护理 NURSING + type: "emr" + code: "empcllect" + prop: 9405 +# web service + +docus: + url: + # 报告上报地址 + downploadlatform-server: http://localhost:9291/ + +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=Asia/Shanghai&rewriteBatchedStatements=true&allowMultiQueries=true \ No newline at end of file diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..8eaaca4 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,51 @@ + + + + + + + + [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%contextName] [%thread] [%X{traceId}] %-5level %logger{36} - %msg%n + + UTF-8 + + + + + + + configLog/log.log + + + + + + log/demo.%d.%i.log + + 180 + + + 10MB + + + + + + [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%X{traceId}] [%L] [%-5p] %m%n + + utf-8 + + UTF-8 + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/AfCollectTaskMapper.xml b/src/main/resources/mapper/AfCollectTaskMapper.xml new file mode 100644 index 0000000..28d606e --- /dev/null +++ b/src/main/resources/mapper/AfCollectTaskMapper.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + insert into zd_assort(assort_id,assort_name,effective) values(#{zdAssort.assortId},#{zdAssort.assortName},#{zdAssort.effective}) + + + + + + + + update t_scan_assort + set is_del = 1 + where + patient_id= #{patientId} and source= #{source} + + + + insert into docus_medicalrecord.cqc_submit_state(patient_id,doctor_state,nurse_state) values(#{patientId},#{doctorState},#{nurseState}) + + + + update docus_medicalrecord.cqc_submit_state + + + doctor_state=#{doctorState}, + + + + nurse_state=#{nurseState}, + + + where patient_id=#{patientId} + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/MrReportErrorMapper.xml b/src/main/resources/mapper/MrReportErrorMapper.xml new file mode 100644 index 0000000..30716a3 --- /dev/null +++ b/src/main/resources/mapper/MrReportErrorMapper.xml @@ -0,0 +1,12 @@ + + + + + + insert into docus_medicalrecord.mr_report_error(xml,report_type,create_time) + values(#{mrReportError.xml},#{mrReportError.reportType},#{mrReportError.createTime}) + + + \ No newline at end of file diff --git a/src/main/resources/mapper/TBasicExtendMapper.xml b/src/main/resources/mapper/TBasicExtendMapper.xml new file mode 100644 index 0000000..1e66a18 --- /dev/null +++ b/src/main/resources/mapper/TBasicExtendMapper.xml @@ -0,0 +1,27 @@ + + + + + update docus_medicalrecord.t_basic_extend + set nurse_submit_time=#{nurseSubmitTime} + where patient_id=#{patientId} + + + update docus_medicalrecord.t_basic_extend + set doctor_submit_time=#{doctorSubmitTime} + where patient_id=#{patientId} + + + + insert into docus_medicalrecord.t_basic_extend (patient_id,claim_policy_code,claim_policy_name,mio_settle_type_code,mio_settle_type_name,doctor_submit_time,nurse_submit_time,duty_nurse) + values (#{patientId},#{claimPolicyCode},#{claimPolicyName},#{mioSettleTypeCode},#{mioSettleTypeName},#{doctorSubmitTime},#{nurseSubmitTime},#{dutyNurse}) + + \ No newline at end of file diff --git a/src/main/resources/mapper/TBasicMapper.xml b/src/main/resources/mapper/TBasicMapper.xml new file mode 100644 index 0000000..71a3bea --- /dev/null +++ b/src/main/resources/mapper/TBasicMapper.xml @@ -0,0 +1,76 @@ + + + + + update docus_medicalrecord.t_basic + + + IPAddress=#{pcmachine.ipaddress}, + + + LastOnline=#{pcmachine.lastonline}, + + + PCStatus=#{pcmachine.pcstatus} + + + IPAddress=#{pcmachine.ipaddress}, + + + LastOnline=#{pcmachine.lastonline}, + + + PCStatus=#{pcmachine.pcstatus} + + + IPAddress=#{pcmachine.ipaddress}, + + + LastOnline=#{pcmachine.lastonline}, + + + PCStatus=#{pcmachine.pcstatus} + + + IPAddress=#{pcmachine.ipaddress}, + + + LastOnline=#{pcmachine.lastonline}, + + + PCStatus=#{pcmachine.pcstatus} + + + IPAddress=#{pcmachine.ipaddress}, + + + LastOnline=#{pcmachine.lastonline}, + + + PCStatus=#{pcmachine.pcstatus} + + + where id=#{pcmachine.id} + + + + UPDATE docus_medicalrecord.t_basic + + doctor_state = #{doctorState}, + nurse_state = #{nurseState}, + + WHERE patient_id = #{patientId} + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/TScanAssortMapper.xml b/src/main/resources/mapper/TScanAssortMapper.xml new file mode 100644 index 0000000..34dda40 --- /dev/null +++ b/src/main/resources/mapper/TScanAssortMapper.xml @@ -0,0 +1,10 @@ + + + + +update docus_archivefile.t_scan_assort set patient_id=#{patientId},assort_id='Wiw213woq412awqe42' where patient_id=#{PrePatientId} + + + \ No newline at end of file