feat:初始化广东省中医,住院电子病历和住院护理推送服务

master
wyb 4 weeks ago
commit 004b4b84ed

36
.gitignore vendored

@ -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

@ -0,0 +1,4 @@
{
"assortId": "xxxxId",
"collectorId": "22"
}

@ -0,0 +1,4 @@
{
"assortId": "hlxxxxId",
"collectorId": "1"
}

@ -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:2ftp3)
"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",
//--------------/---------------
/// 01
"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"
}

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.docus</groupId>
<artifactId>docus-gdszy-report</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>docus-gdszy-report</name>
<description>广东省中医院报告服务</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jaxen/jaxen -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.75</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.15</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.14</version>
</dependency>
<dependency>
<groupId>com.docus</groupId>
<artifactId>docus-tool-starter</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.spring4all</groupId>
<artifactId>swagger-spring-boot-starter</artifactId>
<version>1.9.0.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.axis/axis-jaxrpc -->
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-discovery/commons-discovery -->
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/wsdl4j/wsdl4j -->
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

@ -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);
}
}

@ -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;
}
}

@ -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<T> {
@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;
}
}

@ -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;
}

@ -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 {}

@ -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 {
}

@ -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();
}

@ -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;
}
}

@ -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;
}
}

@ -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());
}
}

@ -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;
}
}

@ -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<EmrInfo.ReportItem> 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;
}
}

@ -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<ReportItem> 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;
}
}

@ -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<CollectConfig> 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;
}
}
}

@ -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;
}
}

@ -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<EmrInfo.ReportItem> 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<ReportDownScanFileDto> 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<EmrInfo.ReportItem> 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<ReportDownScanFileDto> 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<SystemCollectConfig.CollectConfig> 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<CompletableFuture<Void>> completableFutureList = new CopyOnWriteArrayList();
for (SystemCollectConfig.CollectConfig config : sealCollectConfigs) {
CompletableFuture<Void> completableFuture = CompletableFuture.runAsync(() -> this.sealCollect(sealId, config), this.threadPoolExecutor);
completableFutureList.add(completableFuture);
}
if (!completableFutureList.isEmpty()) {
CompletableFuture<Void> 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<String> 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<String> 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 "<Response>\n" +
"\t<RetInfo>\n" +
"\t\t<RetCode>0</RetCode>\n" +
"\t\t<RetCon>成功</RetCon>\n" +
"\t</RetInfo>\n" +
"</Response>";
}
public String failed(String msg) {
return "<Response>\n" +
"\t<RetInfo>\n" +
"\t\t<RetCode>1</RetCode>\n" +
"\t\t<RetCon>" + msg + "</RetCon>\n" +
"\t</RetInfo>\n" +
"</Response>";
}
}

@ -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);
}

@ -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;
}
}

@ -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;
}

@ -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);
}

@ -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<ReportDownScanFileDto> 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<ReportDownScanFileDto> 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<SystemCollectConfig.CollectConfig> 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<CompletableFuture<Void>> completableFutureList = new CopyOnWriteArrayList();
for (SystemCollectConfig.CollectConfig config : sealCollectConfigs) {
CompletableFuture<Void> completableFuture = CompletableFuture.runAsync(() -> this.sealCollect(sealId, config), this.threadPoolExecutor);
completableFutureList.add(completableFuture);
}
if (!completableFutureList.isEmpty()) {
CompletableFuture<Void> 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<String> 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<String> 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 "<Response>\n" +
"\t<RetInfo>\n" +
"\t\t<RetCode>0</RetCode>\n" +
"\t\t<RetCon>成功</RetCon>\n" +
"\t</RetInfo>\n" +
"</Response>";
}
public String failed(String msg) {
return "<Response>\n" +
"\t<RetInfo>\n" +
"\t\t<RetCode>1</RetCode>\n" +
"\t\t<RetCon>" + msg + "</RetCon>\n" +
"\t</RetInfo>\n" +
"</Response>";
}
}

@ -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);
}

@ -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<ReportDownScanFileDto> scanfiles;
@ApiModelProperty(value = "扫描用户代码")
private String scanusercode;
@ApiModelProperty(value = "扫描用户名称")
private String scanusername;
}

@ -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;
}

@ -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:服务器本地2ftp服务器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;
}

@ -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();
}
}

@ -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);
}
}

@ -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<String, String> params) throws URISyntaxException {
URIBuilder ub = new URIBuilder();
ub.setPath(url);
ArrayList<NameValuePair> pairs = covertParams2NVPS(params);
ub.setParameters(pairs);
HttpGet httpGet = new HttpGet(ub.build());
return getResult((HttpRequestBase)httpGet);
}
public static String get(String url, Map<String, Object> headers, Map<String, String> params) throws URISyntaxException {
URIBuilder ub = new URIBuilder();
ub.setPath(url);
if (params != null) {
ArrayList<NameValuePair> pairs = covertParams2NVPS(params);
ub.setParameters(pairs);
}
HttpGet httpGet = new HttpGet(ub.build());
for(Map.Entry<String, Object> 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<String, String> 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<String, Object> head) throws UnsupportedEncodingException {
HttpPost httpPost = new HttpPost(url);
System.out.println(params);
httpPost.setEntity(new StringEntity(params.toString()));
if (params != null) {
for(Map.Entry<String, Object> param : head.entrySet()) {
httpPost.addHeader((String)param.getKey(), String.valueOf(param.getValue()));
}
}
return getResult((HttpRequestBase)httpPost);
}
private static ArrayList<NameValuePair> covertParams2NVPS(Map<String, String> params) {
ArrayList<NameValuePair> pairs = new ArrayList();
for(Map.Entry<String, String> 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<String, Object> headers, Map<String, Object> params) throws UnsupportedEncodingException {
HttpPost httpPost = new HttpPost(url);
System.out.println(params);
if (params != null) {
for(Map.Entry<String, Object> 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<String, Object> headers, Map<String, List<String>> params) throws UnsupportedEncodingException {
HttpPost httpPost = new HttpPost(url);
if (params != null) {
for(Map.Entry<String, Object> 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;
}
}

@ -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();
}
}
}
}

@ -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> T Read(String path,String fileName,Class<T> 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<T>() { });
}
bufferedReader.close();
}
return dto;
}
catch (Exception ex){
ex.printStackTrace();
return null;
}
}
public <T> T Read(File file,Class<T> 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<T>() { });
}
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();
}
}
}
}

@ -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;
/**
* xpathxml
*
* <pre>
*
* http://www.w3school.com.cn/xpath/index.asp
* </pre>
*
* @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<String, String> toMap() {
Element root = doc.getDocumentElement();
Map<String, String> 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();
}
}

@ -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<String> 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<Element> 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<String> basicArr = (List)jsonMap.get("doubleBasic");
List<Element> 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<String> 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();
}
}
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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("是否作废(01是)")
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 归档采集pdf2 异地扫描图片3 现场扫描pdf4 其他来源")
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;
}
}

@ -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;
}

@ -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;
}

@ -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<AfCollectTask> {
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<String> 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);
}

@ -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);
}

@ -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<AfCollectTask> {
List<String> 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);
}

@ -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<AfInterfaceCollect> {
}

@ -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<AfInterfaceCollectSub> {
}

@ -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);
}

@ -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> {
TBasicExtend selectByPatientId(String patientId);
int updatenurseSubmitTime(TBasicExtend tBasicExtend);
int updateDoctorSubmitTime(TBasicExtend tBasicExtend);
}

@ -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> {
TBasic selectByjzh(String jzh);
TBasic selectByPatientId(String patientId);
int update(TBasic tbasic);
}

@ -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<TBasic> {
int updateByPatientId(@Param("patientId") String PatientId, @Param("PrePatientId") String PrePatientId);
}

@ -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<AfCollectTaskMapper, AfCollectTask> 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<ReportDownScanFileDto> scanfiles = reportDownDto.getScanfiles();
QueryWrapper<AfCollectTask> patientTaskWrapper = new QueryWrapper<AfCollectTask>().eq("patient_id", patientId).eq("sysflag", collectorid);
List<AfCollectTask> collectTaskList = afCollectTaskMapper.selectList(patientTaskWrapper);
Map<String, AfCollectTask> 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<ReportDownScanFileDto> 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<String> listJZHByDate(String date1, String date2) {
return this.afCollectTaskMapper.listJZHByDate(date1, date2);
}
@Override
public void invokeRepoalFile(CanlcelDto canlcelDto) throws Exception {
Map<String, Object> 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<String, Object> headMap = new HashMap();
headMap.put("Content-Type", "application/json");
Map<String, List<String>> params = new HashMap();
List<String> 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<String, Object> headMap = new HashMap();
headMap.put("Content-Type", "application/json");
Map<String, List<String>> params = new HashMap();
List<String> 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);
}
}

@ -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("--------日志记录完成------");
}
}

@ -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

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,%i索引【从数字0开始递增】,,, -->
<!-- appender是configuration的子节点是负责写日志的组件。 -->
<!-- ConsoleAppender把日志输出到控制台 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>[%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%contextName] [%thread] [%X{traceId}] %-5level %logger{36} - %msg%n</pattern>
<!-- 控制台也要使用UTF-8不要使用GBK否则会中文乱码 -->
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- RollingFileAppender滚动记录文件先将日志记录到指定文件当符合某个条件时将日志记录到其他文件 -->
<!-- 以下的大概意思是1.先按日期存日志日期变了将前一天的日志文件名重命名为XXX%日期%索引新的日志仍然是demo.log -->
<!-- 2.如果日期没有发生变化但是当前日志的文件大小超过1KB时对当前日志进行分割 重命名-->
<appender name="demolog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>configLog/log.log</File>
<!-- rollingPolicy:当发生滚动时,决定 RollingFileAppender 的行为,涉及文件移动和重命名。 -->
<!-- TimeBasedRollingPolicy 最常用的滚动策略,它根据时间来制定滚动策略,既负责滚动也负责出发滚动 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 活动文件的名字会根据fileNamePattern的值每隔一段时间改变一次 -->
<!-- 文件名log/demo.2017-12-05.0.log -->
<fileNamePattern>log/demo.%d.%i.log</fileNamePattern>
<!-- 每产生一个日志文件该日志文件的保存期限为180天 -->
<maxHistory>180</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- maxFileSize:这是活动文件的大小默认值是10MB测试时可改成1KB看效果 -->
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<!-- pattern节点用来设置日志的输入格式 -->
<pattern>
[%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%X{traceId}] [%L] [%-5p] %m%n
</pattern>
<charset>utf-8</charset>
<!-- 记录日志的编码:此处设置字符集 - -->
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 控制台输出日志级别 -->
<root level="info">
<appender-ref ref="STDOUT" />
</root>
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
<!-- com.liyan为根包也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG -->
<!-- 级别依次为【从高到低】FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
<logger name="com.docus.bgts" level="INFO">
<appender-ref ref="demolog" />
</logger>
</configuration>

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.bgts.wzh.mapper.AfCollectTaskMapper">
<select id="listJZHByDate" resultType="string">
select jzh
from docus_medicalrecord.t_basic a
where
a.create_time >=#{date1}
and a.create_time &lt;=#{date2}
and a.jzh is not null
and a.is_archive=0
and a.dis_dept in ('1211','1252')
and jzh not in
(select C3 from af_collect_task where sysflag=22 and state=3)
order by create_time asc
</select>
<select id="selectDisDateIsNull" resultType="com.docus.bgts.wzh.entity.TBasic">
select *
from docus_medicalrecord.t_basic
where inpatient_no=#{inPatientNo}
and dis_date is null
</select>
<select id="selectDisDateIsNullJzh" resultType="string">
select t.jzh
from(
select admiss_date,dis_date,jzh
from docus_medicalrecord.t_basic
where inpatient_no=#{inPatientNo} and dis_date is null and ph is null
) t
where date_sub(t.admiss_date, interval 6 hour) &lt;= #{examApplyDate}
</select>
<select id="selectJzh" resultType="string">
select t.jzh
from(
select admiss_date,dis_date,jzh,ph
from docus_medicalrecord.t_basic
where inpatient_no=#{inPatientNo}
) t
where date_sub(t.admiss_date, interval 6 hour) &lt;= #{examApplyDate}
and date_add(t.dis_date, interval 6 hour) &gt;= #{examApplyDate}
and t.ph is null
</select>
<select id="getpatientIdByJzh" resultType="string">
select patient_id
from docus_medicalrecord.t_basic
where jzh=#{jzh}
</select>
<select id="getAssortIdByAssortId" resultType="string">
select assort_id from zd_assort where assort_id=#{assortId}
</select>
<select id="getAssortIdByAssortName" resultType="string">
select assort_id from zd_assort where assort_name=#{assortName}
</select>
<insert id="insertZdAssort">
insert into zd_assort(assort_id,assort_name,effective) values(#{zdAssort.assortId},#{zdAssort.assortName},#{zdAssort.effective})
</insert>
<update id="cancelTsaByPatientIdAndSource">
update t_scan_assort
set is_del = 1
where
patient_id= #{patientId} and source= #{source}
</update>
<insert id="insertDoctorState">
insert into docus_medicalrecord.cqc_submit_state(patient_id,doctor_state,nurse_state) values(#{patientId},#{doctorState},#{nurseState})
</insert>
<update id="updateDoctorState">
update docus_medicalrecord.cqc_submit_state
<set>
<if test="doctorState!=null">
doctor_state=#{doctorState},
</if>
<if test="nurseState!=null">
nurse_state=#{nurseState},
</if>
</set>
where patient_id=#{patientId}
</update>
<select id="selectByPatientId" resultType="com.docus.bgts.wzh.entity.CqcSubmitState">
select * from docus_medicalrecord.cqc_submit_state
where patient_id=#{patientId}
</select>
<select id="selectPatientByjzh" resultType="java.lang.String">
select patient_id
from docus_medicalrecord.t_basic_out
where jzh=#{jzh}
</select>
<select id="selectNameByPatientId" resultType="java.lang.String">
select creater_name from docus_medicalrecord.cqc_back_info_log where patient_id=#{patientId} and create_time in
(select max(create_time) from docus_medicalrecord.cqc_back_info_log where patient_id=#{patientId})
</select>
<select id="getPatientIdBysealId" resultType="java.lang.String">
select patient_id from docus_medicalrecord.t_seal where seal_id=#{sealId}
</select>
</mapper>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.bgts.wzh.mapper.MrReportErrorMapper">
<insert id="save" parameterType="com.docus.bgts.wzh.entity.MrReportError">
insert into docus_medicalrecord.mr_report_error(xml,report_type,create_time)
values(#{mrReportError.xml},#{mrReportError.reportType},#{mrReportError.createTime})
</insert>
</mapper>

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.bgts.wzh.mapper.TBasicExtendMapper">
<update id="updatenurseSubmitTime">
update docus_medicalrecord.t_basic_extend
set nurse_submit_time=#{nurseSubmitTime}
where patient_id=#{patientId}
</update>
<update id="updateDoctorSubmitTime">
update docus_medicalrecord.t_basic_extend
set doctor_submit_time=#{doctorSubmitTime}
where patient_id=#{patientId}
</update>
<select id="selectByPatientId" resultType="com.docus.bgts.wzh.entity.TBasicExtend">
select *
from
docus_medicalrecord.t_basic_extend
where patient_id=#{patientId}
</select>
<insert id="insert" parameterType="com.docus.bgts.wzh.entity.TBasicExtend">
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})
</insert>
</mapper>

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.bgts.wzh.mapper.TBasicMapper">
<update id="updateDisDate">
update docus_medicalrecord.t_basic
<set>
<if test="tBasic.admiss_times != null">
IPAddress=#{pcmachine.ipaddress},
</if>
<if test="pcmachine.lastonline != null">
LastOnline=#{pcmachine.lastonline},
</if>
<if test="pcmachine.pcstatus != null">
PCStatus=#{pcmachine.pcstatus}
</if>
<if test="pcmachine.ipaddress != null">
IPAddress=#{pcmachine.ipaddress},
</if>
<if test="pcmachine.lastonline != null">
LastOnline=#{pcmachine.lastonline},
</if>
<if test="pcmachine.pcstatus != null">
PCStatus=#{pcmachine.pcstatus}
</if>
<if test="pcmachine.ipaddress != null">
IPAddress=#{pcmachine.ipaddress},
</if>
<if test="pcmachine.lastonline != null">
LastOnline=#{pcmachine.lastonline},
</if>
<if test="pcmachine.pcstatus != null">
PCStatus=#{pcmachine.pcstatus}
</if>
<if test="pcmachine.ipaddress != null">
IPAddress=#{pcmachine.ipaddress},
</if>
<if test="pcmachine.lastonline != null">
LastOnline=#{pcmachine.lastonline},
</if>
<if test="pcmachine.pcstatus != null">
PCStatus=#{pcmachine.pcstatus}
</if>
<if test="pcmachine.ipaddress != null">
IPAddress=#{pcmachine.ipaddress},
</if>
<if test="pcmachine.lastonline != null">
LastOnline=#{pcmachine.lastonline},
</if>
<if test="pcmachine.pcstatus != null">
PCStatus=#{pcmachine.pcstatus}
</if>
</set>
where id=#{pcmachine.id}
</update>
<update id="update" parameterType="com.docus.bgts.wzh.entity.TBasic">
UPDATE docus_medicalrecord.t_basic
<set>
<if test="null != doctorState and '' != doctorState">doctor_state = #{doctorState},</if>
<if test="null != nurseState and '' != nurseState">nurse_state = #{nurseState},</if>
</set>
WHERE patient_id = #{patientId}
</update>
<select id="selectByjzh" resultType="com.docus.bgts.wzh.entity.TBasic">
SELECT *
FROM docus_medicalrecord.t_basic
WHERE jzh = #{jzh}
</select>
<select id="selectByPatientId" resultType="com.docus.bgts.wzh.entity.TBasic">
SELECT *
FROM docus_medicalrecord.t_basic
WHERE patient_id = #{patientId}
</select>
</mapper>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.bgts.wzh.mapper.TScanAssortMapper">
<update id="updateByPatientId">
update docus_archivefile.t_scan_assort set patient_id=#{patientId},assort_id='Wiw213woq412awqe42' where patient_id=#{PrePatientId}
</update>
</mapper>
Loading…
Cancel
Save