版本一
parent
b1acbca521
commit
4a9f97e3b5
@ -0,0 +1 @@
|
|||||||
|
lombok.var.flagUsage = ALLOW
|
@ -0,0 +1,132 @@
|
|||||||
|
<?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>demo</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>docus-mz-empcllect</name>
|
||||||
|
<description>电子病历采集</description>
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<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>jaxen</groupId>
|
||||||
|
<artifactId>jaxen</artifactId>
|
||||||
|
<version>1.1.1</version>
|
||||||
|
</dependency>
|
||||||
|
<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.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.16.14</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>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,16 @@
|
|||||||
|
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,40 @@
|
|||||||
|
//package com.docus.bgts.config;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//import com.docus.bgts.utils.FileUtils;
|
||||||
|
//import com.docus.bgts.utils.HttpUtils;
|
||||||
|
//import org.apache.logging.log4j.LogManager;
|
||||||
|
//import org.apache.logging.log4j.Logger;
|
||||||
|
//import org.springframework.beans.factory.annotation.Value;
|
||||||
|
//import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
|
//import java.net.URISyntaxException;
|
||||||
|
//import java.util.HashMap;
|
||||||
|
//import java.util.Map;
|
||||||
|
//
|
||||||
|
//@Component
|
||||||
|
//public class MyScheduling {
|
||||||
|
//
|
||||||
|
// @Value("${beat.url}")
|
||||||
|
// private String beatUrl;
|
||||||
|
//
|
||||||
|
// private Logger logger = LogManager.getLogger(MyScheduling.class);
|
||||||
|
//
|
||||||
|
// //10分钟执行一次
|
||||||
|
// @Scheduled(fixedRate = 1000 * 60 * 5)
|
||||||
|
// public void beat() {
|
||||||
|
// logger.info("------------心跳开始---------------");
|
||||||
|
// Map<String, String> params = new HashMap<>();
|
||||||
|
// params.put("code", String.valueOf(FileUtils.getJsonByName("collectorid")));
|
||||||
|
// try {
|
||||||
|
// HttpUtils.get(beatUrl, params);
|
||||||
|
// } catch (URISyntaxException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// logger.info("心跳推送出错,可能是住院服务没有开启");
|
||||||
|
// } finally {
|
||||||
|
// logger.info("-------------心跳结束---------------");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
@ -0,0 +1,66 @@
|
|||||||
|
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 lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.experimental.var;
|
||||||
|
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.util.Objects;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@EnableTransactionManagement
|
||||||
|
@MapperScan("com.docus.bgts.mapper")
|
||||||
|
@ConditionalOnClass(value = {PaginationInterceptor.class})
|
||||||
|
public class MybatisPlusConfig {
|
||||||
|
|
||||||
|
|
||||||
|
private final MybatisPlusProperties mybatisPlusProperties;
|
||||||
|
@Bean
|
||||||
|
public PaginationInterceptor paginationInterceptor() {
|
||||||
|
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
||||||
|
return paginationInterceptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void initMybatisConfig(){
|
||||||
|
mybatisPlusProperties.setMapperLocations(new String[]{"classpath*:/mapper/*Mapper.xml"});
|
||||||
|
mybatisPlusProperties.setTypeAliasesPackage("com.docus.bgts.entity");
|
||||||
|
|
||||||
|
MybatisConfiguration configuration = mybatisPlusProperties.getConfiguration();
|
||||||
|
if(Objects.isNull(configuration)){
|
||||||
|
configuration=new MybatisConfiguration();
|
||||||
|
}
|
||||||
|
configuration.setMapUnderscoreToCamelCase(true);
|
||||||
|
configuration.setCacheEnabled(true);
|
||||||
|
configuration.setLogImpl(NoLoggingImpl.class);
|
||||||
|
mybatisPlusProperties.setConfiguration(configuration);
|
||||||
|
|
||||||
|
var globalConfig = 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);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.docus.bgts.config;
|
||||||
|
|
||||||
|
import com.docus.bgts.handler.ITBasicWebService;
|
||||||
|
import com.docus.bgts.handler.TBasicWebService;
|
||||||
|
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
|
||||||
|
public class WebServiceConfig {
|
||||||
|
|
||||||
|
@Value("${system.code}")
|
||||||
|
private String systemCode;
|
||||||
|
@Value("${system.prop}")
|
||||||
|
private String systemProp;
|
||||||
|
|
||||||
|
//把实现类交给spring管理
|
||||||
|
@Bean
|
||||||
|
public ITBasicWebService tBasicWebService() {
|
||||||
|
return new TBasicWebService();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Endpoint endpoint() {
|
||||||
|
System.out.println("-----------------------web service服务已发布-------------------------");
|
||||||
|
// String address = "http://"+"0.0.0.0"+":" + Codes.EXTERNAL.getCode()+"/" + Codes.EXTERNAL.getMessage();
|
||||||
|
String address = "http://"+"0.0.0.0"+":" + systemProp+"/" + systemCode;
|
||||||
|
Endpoint publish = Endpoint.publish(address, tBasicWebService());
|
||||||
|
System.out.println(" "+address);
|
||||||
|
return publish;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.docus.bgts.entity;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("文件库中的省中医病案采集表")
|
||||||
|
public class AfInterfaceCollect implements Serializable {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
@ApiModelProperty(value = "任务流水号")
|
||||||
|
private String serialnum;
|
||||||
|
@ApiModelProperty(value = "记账号")
|
||||||
|
private String jzh;
|
||||||
|
@ApiModelProperty(value = "任务数")
|
||||||
|
private Integer taskCount;
|
||||||
|
@ApiModelProperty(value = "完成数")
|
||||||
|
private Integer completeCount;
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.docus.bgts.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("错误日志表")
|
||||||
|
public class MrReportError {
|
||||||
|
private Long id;
|
||||||
|
@ApiModelProperty("上报信息")
|
||||||
|
private String xml;
|
||||||
|
@ApiModelProperty("上报类型")
|
||||||
|
private Integer reportType;
|
||||||
|
@ApiModelProperty("上报时间")
|
||||||
|
private Date createTime;
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.docus.bgts.entity;
|
||||||
|
|
||||||
|
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 = "文件信息")
|
||||||
|
private List<ReportDownScanFileDto> scanfiles;
|
||||||
|
|
||||||
|
private ReportDownPatientDto patient;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "分类id")
|
||||||
|
private String assortid;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.docus.bgts.entity;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ReportDownPatientDto {
|
||||||
|
@ApiModelProperty(value = "记帐号")
|
||||||
|
private String jzh;
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.docus.bgts.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代码库
|
||||||
|
*/
|
||||||
|
public enum Codes {
|
||||||
|
//接口成功
|
||||||
|
SUCCESS("1", "成功"),
|
||||||
|
//接口失败
|
||||||
|
ERROR("0", "失败"),
|
||||||
|
//web service返回根节点
|
||||||
|
RESPONSE("100","Response"),
|
||||||
|
//web service返回二级节点
|
||||||
|
RET_INFO("101","Result"),
|
||||||
|
//web service 返回代码
|
||||||
|
RET_CODE("102","Code"),
|
||||||
|
//web service返回描述部分
|
||||||
|
RET_CON("103","Msg"),
|
||||||
|
//静态文件存放位置
|
||||||
|
JSON_ADDRESS("999","\\dataConfig\\homeQualitySet.json"),
|
||||||
|
//接收二级节点
|
||||||
|
MSG("201","Msg"),
|
||||||
|
//节点根
|
||||||
|
DIRECTORY("1000","directory"),
|
||||||
|
//上传接口地址
|
||||||
|
UPLOAD("0","uploadConnector"),
|
||||||
|
//患者主索引号
|
||||||
|
EMP_ID("0","indexFlag"),
|
||||||
|
//错误日志编号
|
||||||
|
ERROR_CODE("500","12"),
|
||||||
|
//接收三级节点
|
||||||
|
// PAT_INFO("202","PatInfo"),
|
||||||
|
//静态文件根元素名
|
||||||
|
SELECT_COLUMNS("10000","selectColumns")
|
||||||
|
;
|
||||||
|
//代码
|
||||||
|
private String code;
|
||||||
|
//描述
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
private Codes(String code, String messgae) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = messgae;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.docus.bgts.facade;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.docus.bgts.entity.AfCollectTask;
|
||||||
|
import com.docus.bgts.entity.ReportDownDto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 病案采集任务 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 曾文和
|
||||||
|
* @since 2021-05-07
|
||||||
|
*/
|
||||||
|
public interface IAfCollectTaskService extends IService<AfCollectTask> {
|
||||||
|
/**
|
||||||
|
* 获取病案id通过报告唯一单号
|
||||||
|
*/
|
||||||
|
String getpatientIdByEmpId(String empId);
|
||||||
|
|
||||||
|
void insert(ReportDownDto reportDownDto);
|
||||||
|
|
||||||
|
void updateInterfaceCollect(String collectSubId, int state);
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.docus.bgts.facade;
|
||||||
|
|
||||||
|
|
||||||
|
import com.docus.bgts.entity.MrReportError;
|
||||||
|
|
||||||
|
public interface IMrReportErrorService{
|
||||||
|
|
||||||
|
void insert(String xml);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.docus.bgts.handler;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.jws.WebMethod;
|
||||||
|
import javax.jws.WebService;
|
||||||
|
|
||||||
|
@WebService
|
||||||
|
public interface ITBasicWebService {
|
||||||
|
/**
|
||||||
|
* 检验报告推送
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@WebMethod
|
||||||
|
String pushSurveyReport(String xml);
|
||||||
|
|
||||||
|
@WebMethod
|
||||||
|
String EmrDocumentArchive(String xml);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,215 @@
|
|||||||
|
package com.docus.bgts.handler;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.docus.bgts.entity.ReportDownDto;
|
||||||
|
import com.docus.bgts.entity.ReportDownPatientDto;
|
||||||
|
import com.docus.bgts.entity.ReportDownScanFileDto;
|
||||||
|
import com.docus.bgts.enums.Codes;
|
||||||
|
import com.docus.bgts.facade.IAfCollectTaskService;
|
||||||
|
import com.docus.bgts.facade.IMrReportErrorService;
|
||||||
|
import com.docus.bgts.utils.FileUtils;
|
||||||
|
import com.docus.bgts.utils.HttpUtils;
|
||||||
|
import com.docus.bgts.utils.ResultUtils;
|
||||||
|
import com.docus.bgts.utils.XmlUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
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 javax.jws.WebService;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.StringReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@WebService
|
||||||
|
public class TBasicWebService implements ITBasicWebService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IAfCollectTaskService afCollectTaskService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IMrReportErrorService mrReportErrorService;
|
||||||
|
|
||||||
|
private Logger logger = LogManager.getLogger(TBasicWebService.class);
|
||||||
|
|
||||||
|
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) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (doc != null) {
|
||||||
|
element = doc.getRootElement();
|
||||||
|
}
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String pushSurveyReport(String xml) {
|
||||||
|
try {
|
||||||
|
logger.info("报告推送入参:" + xml);
|
||||||
|
// 1、创建document对象
|
||||||
|
// Document document = DocumentHelper.createDocument();
|
||||||
|
// Element rootElement = getElementFromString(xml);
|
||||||
|
// document.setRootElement(rootElement);
|
||||||
|
xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + xml;
|
||||||
|
//解析XML
|
||||||
|
XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(xml.getBytes("UTF-8")));
|
||||||
|
// 获取患者主索引号
|
||||||
|
String empId = String.valueOf(FileUtils.getJsonByName(Codes.EMP_ID.getMessage()));
|
||||||
|
Map<String, Object> headMap = new HashMap<>();
|
||||||
|
headMap.put("Content-Type", "application/json");
|
||||||
|
ReportDownDto reportDownDto;
|
||||||
|
//获取数据存在的节点节点
|
||||||
|
Element elementRoot = xmlUtils.getMsgElement();
|
||||||
|
//key
|
||||||
|
String serialnmnKey = String.valueOf(FileUtils.getJsonByName("serialnum"));
|
||||||
|
// String empId = String.valueOf(FileUtils.getJsonByName("indexFlag"));
|
||||||
|
String filetitleKey = String.valueOf(FileUtils.getJsonByName("filetitle"));
|
||||||
|
String downurlKey = String.valueOf(FileUtils.getJsonByName("downurl"));
|
||||||
|
|
||||||
|
ReportDownScanFileDto reportDownScanFileDto;
|
||||||
|
ReportDownPatientDto reportDownPatientDto;
|
||||||
|
//临时资料存储
|
||||||
|
String serialnum;
|
||||||
|
String filetitle;
|
||||||
|
String downurl;
|
||||||
|
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
|
||||||
|
// String collectorid = getCollectorid(elementList.get(0));
|
||||||
|
// String assortid = String.valueOf(FileUtils.getJsonByName("assortid"));
|
||||||
|
String assortid = getAssortid(elementRoot);
|
||||||
|
reportDownDto = new ReportDownDto();
|
||||||
|
reportDownDto.setCollectorid(collectorid);
|
||||||
|
reportDownDto.setAssortid(assortid);
|
||||||
|
//获取基本数据信息
|
||||||
|
List<ReportDownScanFileDto> reportDownDtoArr = new ArrayList<>();
|
||||||
|
reportDownPatientDto = new ReportDownPatientDto();
|
||||||
|
// String empIdText = elementList.get(0).element(empId).getText();
|
||||||
|
//获取jzh
|
||||||
|
String empIdText = getElementText(elementRoot, empId.split(","));
|
||||||
|
//获取采集流水号
|
||||||
|
serialnum = getElementText(elementRoot, serialnmnKey.split(","));
|
||||||
|
reportDownPatientDto.setJzh(empIdText);
|
||||||
|
logger.info("患者主索引号:" + empIdText);
|
||||||
|
reportDownDto.setPatient(reportDownPatientDto);
|
||||||
|
List<Element> elementList = xmlUtils.getJsonByName(elementRoot);
|
||||||
|
|
||||||
|
for (Element element : elementList) {
|
||||||
|
// serialnum = element.element(serialnmnKey).getText();
|
||||||
|
// filetitle = element.element(filetitleKey).getText();
|
||||||
|
filetitle = getElementText(element, filetitleKey.split(","));
|
||||||
|
// downurl = element.element(downurlKey).getText();
|
||||||
|
downurl = getElementText(element, downurlKey.split(","));
|
||||||
|
reportDownScanFileDto = new ReportDownScanFileDto();
|
||||||
|
reportDownScanFileDto.setDownurl(downurl);
|
||||||
|
reportDownScanFileDto.setFiletitle(filetitle);
|
||||||
|
reportDownScanFileDto.setSerialnum(serialnum);
|
||||||
|
reportDownScanFileDto.setFilesource(Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filesource"))));
|
||||||
|
reportDownScanFileDto.setFilestoragetype(Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filestoragetype"))));
|
||||||
|
//判断是否为base64
|
||||||
|
if (reportDownScanFileDto.getDownurl().length() > 200) {
|
||||||
|
reportDownScanFileDto.setFiletype(2);
|
||||||
|
}
|
||||||
|
reportDownDtoArr.add(reportDownScanFileDto);
|
||||||
|
}
|
||||||
|
if (reportDownDtoArr.size() <= 0) {
|
||||||
|
throw new RuntimeException("不存在必要的基本信息");
|
||||||
|
} else {
|
||||||
|
reportDownDto.setScanfiles(reportDownDtoArr);
|
||||||
|
}
|
||||||
|
//插入文件af_collect_task表数据
|
||||||
|
afCollectTaskService.insert(reportDownDto);
|
||||||
|
String post = "";
|
||||||
|
logger.info("--------执行上传功能----------");
|
||||||
|
Map params = JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class);
|
||||||
|
logger.info("上传参数:" + params);
|
||||||
|
post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, params);
|
||||||
|
// String post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), map, headMap);
|
||||||
|
if (StringUtils.isBlank(post)) {
|
||||||
|
logger.info("--------上传时出现错误,可能是文件服务没有启动----------");
|
||||||
|
throw new RuntimeException("上传时出现错误,可能是文件服务没有启动");
|
||||||
|
}
|
||||||
|
Map resMap = JSON.parseObject(post, Map.class);
|
||||||
|
if (String.valueOf(resMap.get("code")).equals("500")) {
|
||||||
|
throw new RuntimeException(String.valueOf(resMap.get("msg")));
|
||||||
|
} else {
|
||||||
|
return ResultUtils.success().asXML();
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
mrReportErrorService.insert(xml);
|
||||||
|
return ResultUtils.fail(e.getMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
mrReportErrorService.insert(xml);
|
||||||
|
return ResultUtils.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String EmrDocumentArchive(String xml) {
|
||||||
|
return pushSurveyReport(xml);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取key内容
|
||||||
|
*
|
||||||
|
* @param element
|
||||||
|
* @param args
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getElementText(Element element, String[] args) {
|
||||||
|
String resText = "";
|
||||||
|
Element byElement = (Element) element.clone();
|
||||||
|
String[] split;
|
||||||
|
for (String arg : args) {
|
||||||
|
split = arg.split("&");
|
||||||
|
if (split.length > 1) {
|
||||||
|
for (String spi : split) {
|
||||||
|
byElement = byElement.element(spi);
|
||||||
|
if (byElement != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
byElement = byElement.element(arg);
|
||||||
|
}
|
||||||
|
if (byElement != null) {
|
||||||
|
resText = byElement.getText();
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取系统id
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return assortId;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.docus.bgts.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.docus.bgts.entity.AfCollectTask;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 病案采集任务 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 曾文和
|
||||||
|
* @since 2021-05-07
|
||||||
|
*/
|
||||||
|
public interface AfCollectTaskMapper extends BaseMapper<AfCollectTask> {
|
||||||
|
/**
|
||||||
|
* 获取病案id通过报告唯一单号
|
||||||
|
* @param empId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getpatientIdByEmpId(@Param("jzh") String empId);
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.docus.bgts.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.docus.bgts.entity.AfInterfaceCollect;
|
||||||
|
|
||||||
|
public interface AfInterfaceCollectMapper extends BaseMapper<AfInterfaceCollect> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.docus.bgts.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.docus.bgts.entity.AfInterfaceCollectSub;
|
||||||
|
|
||||||
|
public interface AfInterfaceCollectSubMapper extends BaseMapper<AfInterfaceCollectSub> {
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.docus.bgts.mapper;
|
||||||
|
|
||||||
|
import com.docus.bgts.entity.MrReportError;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
public interface MrReportErrorMapper {
|
||||||
|
|
||||||
|
void save(@Param("mrReportError") MrReportError mrReportError);
|
||||||
|
}
|
@ -0,0 +1,119 @@
|
|||||||
|
package com.docus.bgts.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.docus.bgts.entity.*;
|
||||||
|
import com.docus.bgts.facade.IAfCollectTaskService;
|
||||||
|
import com.docus.bgts.mapper.AfCollectTaskMapper;
|
||||||
|
import com.docus.bgts.mapper.AfInterfaceCollectMapper;
|
||||||
|
import com.docus.bgts.mapper.AfInterfaceCollectSubMapper;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 病案采集任务 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 曾文和
|
||||||
|
* @since 2021-05-07
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AfCollectTaskServiceImpl extends ServiceImpl<AfCollectTaskMapper, AfCollectTask> implements IAfCollectTaskService {
|
||||||
|
|
||||||
|
private Logger log= LogManager.getLogger();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AfCollectTaskMapper afCollectTaskMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AfInterfaceCollectMapper afInterfaceCollectMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AfInterfaceCollectSubMapper afInterfaceCollectSubMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getpatientIdByEmpId(String empId) {
|
||||||
|
String patientId = afCollectTaskMapper.getpatientIdByEmpId(empId);
|
||||||
|
return patientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public void insert(ReportDownDto reportDownDto) {
|
||||||
|
log.info("新增任务表初始数据:"+reportDownDto);
|
||||||
|
AfCollectTask afCollectTask;
|
||||||
|
String patientId = getpatientIdByEmpId(reportDownDto.getPatient().getJzh());
|
||||||
|
if (StringUtils.isBlank(patientId)) {
|
||||||
|
throw new RuntimeException("操作的病案信息不存在");
|
||||||
|
}
|
||||||
|
Date date = new Date();
|
||||||
|
Integer save = null;
|
||||||
|
List<ReportDownScanFileDto> scanfiles = reportDownDto.getScanfiles();
|
||||||
|
for (ReportDownScanFileDto scanfile : scanfiles) {
|
||||||
|
// 判断任务是否已存在
|
||||||
|
afCollectTask = afCollectTaskMapper.selectOne(new QueryWrapper<AfCollectTask>().eq("C1", scanfile.getSerialnum()).eq("sysflag", reportDownDto.getCollectorid()));
|
||||||
|
if (afCollectTask == null) {
|
||||||
|
//不存在 新增
|
||||||
|
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 = afCollectTaskMapper.insert(afCollectTask);
|
||||||
|
} else {
|
||||||
|
//存在就修改
|
||||||
|
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 = afCollectTaskMapper.updateById(afCollectTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (save <= 0) {
|
||||||
|
log.info("任务表操作出错");
|
||||||
|
throw new RuntimeException("插入病案任务表数据出错");
|
||||||
|
}
|
||||||
|
scanfile.setTaskid(afCollectTask.getId());
|
||||||
|
}
|
||||||
|
reportDownDto.setScanfiles(scanfiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateInterfaceCollect(String collectSubId, int state) {
|
||||||
|
AfInterfaceCollectSub afInterfaceCollectSub = afInterfaceCollectSubMapper.selectById(collectSubId);
|
||||||
|
if (afInterfaceCollectSub == null) {
|
||||||
|
throw new RuntimeException("afInterfaceCollectSub表数据为空");
|
||||||
|
}
|
||||||
|
int i;
|
||||||
|
afInterfaceCollectSub.setState(state);
|
||||||
|
i = afInterfaceCollectSubMapper.updateById(afInterfaceCollectSub);
|
||||||
|
if (i <= 0) {
|
||||||
|
throw new RuntimeException("记录任务数时出错");
|
||||||
|
}
|
||||||
|
if (state == 1) {
|
||||||
|
AfInterfaceCollect afInterfaceCollect = afInterfaceCollectMapper.selectById(afInterfaceCollectSub.getAfInterfaceCollectId());
|
||||||
|
afInterfaceCollect.setCompleteCount(afInterfaceCollect.getCompleteCount() + 1);
|
||||||
|
i = afInterfaceCollectMapper.updateById(afInterfaceCollect);
|
||||||
|
if (i <= 0) {
|
||||||
|
throw new RuntimeException("记录任务数时出错");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.docus.bgts.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.docus.bgts.entity.MrReportError;
|
||||||
|
import com.docus.bgts.facade.IMrReportErrorService;
|
||||||
|
import com.docus.bgts.mapper.MrReportErrorMapper;
|
||||||
|
import com.docus.bgts.utils.FileUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class MrReportErrorServiceImpl implements IMrReportErrorService {
|
||||||
|
|
||||||
|
@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);
|
||||||
|
mrReportErrorMapper.save(mrReportError);
|
||||||
|
log.info("--------日志记录完成------");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.docus.bgts.utils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.docus.bgts.enums.Codes;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class FileUtils {
|
||||||
|
/**
|
||||||
|
* 获取jar包所在位置
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String currentPath() {
|
||||||
|
File dir = new File(".");
|
||||||
|
String currentpath = "";
|
||||||
|
try {
|
||||||
|
currentpath = dir.getCanonicalPath();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return currentpath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取静态文件中的内容
|
||||||
|
* @param name
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Object getJsonByName(String name){
|
||||||
|
//获取目录结构
|
||||||
|
String path = FileUtils.currentPath();
|
||||||
|
//解析json映射文件
|
||||||
|
String json = JsonUtils.readJsonFile(path + Codes.JSON_ADDRESS.getMessage());
|
||||||
|
Map jsonMap = JSON.parseObject(json, Map.class);
|
||||||
|
return jsonMap.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,84 @@
|
|||||||
|
package com.docus.bgts.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import com.docus.bgts.enums.Codes;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.dom4j.Document;
|
||||||
|
import org.dom4j.DocumentHelper;
|
||||||
|
import org.dom4j.Element;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回结果工具类
|
||||||
|
*/
|
||||||
|
public class ResultUtils {
|
||||||
|
/**
|
||||||
|
* 通过document对象返回节点对象
|
||||||
|
* @param response
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Element getElement(Document response){
|
||||||
|
Element element = response.getRootElement();
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功返回
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Document success(){
|
||||||
|
// 1、创建document对象
|
||||||
|
Document document= DocumentHelper.createDocument();
|
||||||
|
//2.创建根节点
|
||||||
|
Element response=document.addElement(Codes.RESPONSE.getMessage());
|
||||||
|
// 3、生成子节点及子节点内容
|
||||||
|
Element RetInfo = response.addElement(Codes.RET_INFO.getMessage());
|
||||||
|
//4.生成代码和描述节点
|
||||||
|
Element resCode = RetInfo.addElement(Codes.RET_CODE.getMessage());
|
||||||
|
Element retCon = RetInfo.addElement(Codes.RET_CON.getMessage());
|
||||||
|
//赋值
|
||||||
|
resCode.setText(String.valueOf(Codes.SUCCESS.getCode()));
|
||||||
|
retCon.setText(Codes.SUCCESS.getMessage());
|
||||||
|
return document;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败返回
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String fail(){
|
||||||
|
// 1、创建document对象
|
||||||
|
Document document= DocumentHelper.createDocument();
|
||||||
|
//2.创建根节点
|
||||||
|
Element response=document.addElement(Codes.RESPONSE.getMessage());
|
||||||
|
// 3、生成子节点及子节点内容
|
||||||
|
Element RetInfo = response.addElement(Codes.RET_INFO.getMessage());
|
||||||
|
//4.生成代码和描述节点
|
||||||
|
Element resCode = RetInfo.addElement(Codes.RET_CODE.getMessage());
|
||||||
|
Element retCon = RetInfo.addElement(Codes.RET_CON.getMessage());
|
||||||
|
//赋值
|
||||||
|
resCode.setText(String.valueOf(Codes.ERROR.getCode()));
|
||||||
|
retCon.setText(Codes.ERROR.getMessage());
|
||||||
|
return document.asXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败返回
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String fail(String message){
|
||||||
|
// 1、创建document对象
|
||||||
|
Document document= DocumentHelper.createDocument();
|
||||||
|
//2.创建根节点
|
||||||
|
Element response=document.addElement(Codes.RESPONSE.getMessage());
|
||||||
|
// 3、生成子节点及子节点内容
|
||||||
|
Element RetInfo = response.addElement(Codes.RET_INFO.getMessage());
|
||||||
|
//4.生成代码和描述节点
|
||||||
|
Element resCode = RetInfo.addElement(Codes.RET_CODE.getMessage());
|
||||||
|
Element retCon = RetInfo.addElement(Codes.RET_CON.getMessage());
|
||||||
|
//赋值
|
||||||
|
resCode.setText(String.valueOf(Codes.ERROR.getCode()));
|
||||||
|
retCon.setText(StringUtils.isNotBlank(message)?message: Codes.ERROR.getMessage());
|
||||||
|
return document.asXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,158 @@
|
|||||||
|
package com.docus.bgts.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.docus.bgts.enums.Codes;
|
||||||
|
import org.dom4j.Document;
|
||||||
|
import org.dom4j.DocumentException;
|
||||||
|
import org.dom4j.Element;
|
||||||
|
import org.dom4j.io.SAXReader;
|
||||||
|
import sun.rmi.runtime.Log;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class XmlUtils {
|
||||||
|
//定义解析器和文档对象
|
||||||
|
private SAXReader saxReader;
|
||||||
|
private Document document;
|
||||||
|
|
||||||
|
public XmlUtils(String path) {
|
||||||
|
//获取解析器
|
||||||
|
saxReader = new SAXReader();
|
||||||
|
try {
|
||||||
|
//获取文档对象
|
||||||
|
document = saxReader.read(path);
|
||||||
|
} catch (DocumentException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public XmlUtils(InputStream path) {
|
||||||
|
//获取解析器
|
||||||
|
saxReader = new SAXReader();
|
||||||
|
try {
|
||||||
|
//获取文档对象
|
||||||
|
document = saxReader.read(path);
|
||||||
|
} catch (DocumentException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态获取节点内容
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getElement(String name) {
|
||||||
|
//获取根节点
|
||||||
|
Element root = document.getRootElement();
|
||||||
|
Object directory = FileUtils.getJsonByName(Codes.DIRECTORY.getMessage());
|
||||||
|
Element current = root;
|
||||||
|
if (directory == null) {
|
||||||
|
throw new RuntimeException("没有定义目录结构");
|
||||||
|
}
|
||||||
|
List<String> directoryArr = (List<String>) directory;
|
||||||
|
for (String dire : directoryArr) {
|
||||||
|
current = current.element(dire);
|
||||||
|
}
|
||||||
|
return current.element(name) == null ? "" : current.element(name).getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据路径动态获取节点
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Element getElement(List<String> directory) {
|
||||||
|
//获取根节点
|
||||||
|
Element root = document.getRootElement();
|
||||||
|
|
||||||
|
Element current = root;
|
||||||
|
List<String> directoryArr = directory;
|
||||||
|
for (String dire : directoryArr) {
|
||||||
|
current = current.element(dire);
|
||||||
|
}
|
||||||
|
if (current == null) {
|
||||||
|
throw new RuntimeException("未找到对应节点");
|
||||||
|
}
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回存在的根节点
|
||||||
|
*/
|
||||||
|
public List<Element> getJsonByName(Element root) {
|
||||||
|
//获取目录结构
|
||||||
|
String path = FileUtils.currentPath();
|
||||||
|
//解析json映射文件
|
||||||
|
String json = JsonUtils.readJsonFile(path + Codes.JSON_ADDRESS.getMessage());
|
||||||
|
Map jsonMap = JSON.parseObject(json, Map.class);
|
||||||
|
//判断是否多条
|
||||||
|
List<String> basicArr = (List<String>) jsonMap.get("doubleBasic");
|
||||||
|
// List<String> directory = (List<String>) jsonMap.get("basicDirectory");
|
||||||
|
List<Element> elements = null;
|
||||||
|
// Element root = this.getElement(directory);
|
||||||
|
for (String basic : basicArr) {
|
||||||
|
elements = root.elements(basic);
|
||||||
|
if (elements != null && elements.size() > 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (elements == null || elements.size() == 0) {
|
||||||
|
//只有一条
|
||||||
|
// List<String> rootDirectory = (List<String>) jsonMap.get("directory");
|
||||||
|
// root = this.getElement(rootDirectory);
|
||||||
|
elements = new ArrayList<>();
|
||||||
|
elements.add(root);
|
||||||
|
}
|
||||||
|
|
||||||
|
return elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回数据存在的父节点
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Element getMsgElement(){
|
||||||
|
//获取目录结构
|
||||||
|
String path = FileUtils.currentPath();
|
||||||
|
//解析json映射文件
|
||||||
|
String json = JsonUtils.readJsonFile(path + Codes.JSON_ADDRESS.getMessage());
|
||||||
|
Map jsonMap = JSON.parseObject(json, Map.class);
|
||||||
|
List<String> directory = (List<String>) jsonMap.get("directory");
|
||||||
|
Element root = this.getElement(directory);
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据节点名称获取内容
|
||||||
|
*
|
||||||
|
* @param name 节点名称
|
||||||
|
* @return 节点内容
|
||||||
|
*/
|
||||||
|
public String getElementText(String name) {
|
||||||
|
//定位根节点
|
||||||
|
Element root = document.getRootElement();
|
||||||
|
//根据名称定位节点
|
||||||
|
Element msg = root.element(Codes.MSG.getMessage());
|
||||||
|
if (msg == null) {
|
||||||
|
throw new RuntimeException("没有" + Codes.MSG.getMessage() + "节点");
|
||||||
|
}
|
||||||
|
// Element patInfo = msg.element(Codes.PAT_INFO.getMessage());
|
||||||
|
// if(patInfo==null){
|
||||||
|
// throw new RuntimeException("没有"+Codes.PAT_INFO.getMessage()+"节点");
|
||||||
|
// }
|
||||||
|
Element element = msg.element(name);
|
||||||
|
if (element == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
//返回节点内容
|
||||||
|
return element.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
server:
|
||||||
|
port: 9701
|
||||||
|
# http
|
||||||
|
|
||||||
|
mybatis-plus:
|
||||||
|
configuration:
|
||||||
|
map-underscore-to-camel-case: true
|
||||||
|
call-setters-on-nulls: true
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
global-config:
|
||||||
|
db-config:
|
||||||
|
field-strategy: NOT_EMPTY
|
||||||
|
db-type: MYSQL
|
||||||
|
#beat:
|
||||||
|
# url: http://localhost:9399/beat
|
||||||
|
|
||||||
|
system:
|
||||||
|
code: "EmrDocAr"
|
||||||
|
prop: 9801
|
||||||
|
# web service
|
||||||
|
|
||||||
|
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
username: docus
|
||||||
|
password: docus702
|
||||||
|
url: jdbc:mysql://db.docus.cn:3306/docus_archivefile?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true
|
@ -0,0 +1,11 @@
|
|||||||
|
<?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.mapper.AfCollectTaskMapper">
|
||||||
|
<select id="getpatientIdByEmpId" resultType="string">
|
||||||
|
select patient_id
|
||||||
|
from docus_medicalrecord.t_basic
|
||||||
|
where jzh=#{jzh}
|
||||||
|
</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.mapper.MrReportErrorMapper">
|
||||||
|
|
||||||
|
<insert id="save" parameterType="com.docus.bgts.entity.MrReportError">
|
||||||
|
insert into docus_medicalrecord.mr_report_error(xml,report_type,create_time)
|
||||||
|
values(#{mrReportError.xml},#{mrReportError.reportType},#{mrReportError.createTime})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue