初始化

master
linjj 1 year ago
commit ae38b5d217

@ -0,0 +1,186 @@
<?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.3.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>springbootDemo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>springbootDemo</name>
<description>springbootDemo</description>
<properties>
<java.version>1.8</java.version>
<skipTests>true</skipTests>
<mybatisPlus.version>3.4.1</mybatisPlus.version>
<alibabadruid.version>1.2.1</alibabadruid.version>
<knife4j.version>2.0.9</knife4j.version>
<fastjson.version>2.0.11</fastjson.version>
<commons-pool2.version>2.6.0</commons-pool2.version>
<itext.version>2.1.7</itext.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--swagger2-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!--mybatis-plus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatisPlus.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>${mybatisPlus.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!--druid监控-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${alibabadruid.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>
<!-- swaggerui相关依赖 -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
<!-- Jackson Json处理工具包 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- spring2.X集成redis所需common-pool2-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>${commons-pool2.version}</version>
</dependency>
<dependency>
<groupId>org.ofdrw</groupId>
<artifactId>ofdrw-full</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.24</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>org.eclipse.birt.runtime.3_7_1</groupId>
<artifactId>com.lowagie.text</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.10</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>wsjz-releases</id>
<name>Releases Repository</name>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>wsjz-snapshots</id>
<name>Snapshot Repository</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,34 @@
package com.example;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @ClassName QuartzConfig
* @Description
* @Author linjj
* @Date 2023/8/14 15:47
* @Version 1.0
*/
@Configuration
public class QuartzConfig {
@Bean
public JobDetail teatQuartzDetail(){
return JobBuilder.newJob(TestQuartz.class).withIdentity("testQuartz").storeDurably().build();
}
@Bean
public Trigger testQuartzTrigger(){
return TriggerBuilder.newTrigger().forJob(teatQuartzDetail())
.withIdentity("testQuartz")
.withSchedule(CronScheduleBuilder.cronSchedule("0 0 1 * * ?"))
.build();
}
}

@ -0,0 +1,27 @@
package com.example;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.util.FileSystemUtils;
import java.io.File;
/**
* @author
*/
@SpringBootApplication
@MapperScan("com.example.duplicate.infrastructure.dao")
public class SpringbootDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootDemoApplication.class, args);
}
}

@ -0,0 +1,38 @@
package com.example;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.quartz.QuartzJobBean;
import java.io.File;
public class TestQuartz extends QuartzJobBean {
@Value("${waterPicPath}")
private String waterPicPath;
@Value("${waterPicPathFlag}")
private String waterPicPathFlag;
@Override
protected void executeInternal(JobExecutionContext jobExecutionContext) {
if (waterPicPathFlag == "0") {
return;
}
String filePath = waterPicPath;
File file = new File(filePath);
if (file.isDirectory()) {
for (File f : file.listFiles()) {
f.delete();
}
}
}
}

@ -0,0 +1,7 @@
package com.example.duplicate.common;
public class CommonUtil {
public static final String USERKEY = "hj:mr:user";
public static final int DEFAULTPAGESIZE = 1000;
}

@ -0,0 +1,41 @@
package com.example.duplicate.common;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author
* @description: XXX
* @createTime 2023/5/9 15:25
*/
@Data
@ApiModel("响应")
public class ResultBody <T>{
@ApiModelProperty("响应码")
private Integer code;
@ApiModelProperty("响应消息")
private String msg;
@ApiModelProperty("响应实体")
private T data;
private ResultBody(Integer code, String msg,T data) {
this.code = code;
this.msg = msg;
this.data = data;
}
private ResultBody(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public static <T> ResultBody<T> success(T data) {
ResultBody result = new ResultBody(200, "success",data);
return result;
}
public static <T> ResultBody<T> failed(String msg) {
ResultBody result = new ResultBody(500,msg);
return result;
}
}

@ -0,0 +1,64 @@
package com.example.duplicate.config;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import javax.sql.DataSource;
/**
* @ClassName RecordConfig
* @Description Pacs
* @Author linjj
* @Date 2023/8/2 16:48
* @Version 1.0
*/
@Configuration
// 指定主数据库扫描对应的Mapper文件生成代理对象
@MapperScan(basePackages ="com.example.duplicate.infrastructure.configOneDao" ,sqlSessionFactoryRef = "configOneSqlSessionFactory")
public class ConfigOne {
// mapper.xml所在地址
private static final String MAPPER_LOCATION = "classpath*:mapper/*.xml";
/**
* Primary
*
*/
@Bean(name = "configOneDataSource")
// 读取spring.datasource.master前缀的配置文件映射成对应的配置对象
@ConfigurationProperties(prefix = "spring.datasource.db1")
public DataSource dataSource() {
DataSource build = DataSourceBuilder.create().build();
return build;
}
/**
* Primary
*/
@Bean(name = "configOneTransactionManager")
public PlatformTransactionManager dataSourceTransactionManager(@Qualifier("configOneDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
/**
* sessionPrimary
*/
@Bean(name = "configOneSqlSessionFactory")
public SqlSessionFactory sqlSessionFactory(@Qualifier("configOneDataSource") DataSource dataSource) throws Exception {
final SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource);
sessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(ConfigOne.MAPPER_LOCATION));
return sessionFactoryBean.getObject();
}
}

@ -0,0 +1,70 @@
package com.example.duplicate.config;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import javax.sql.DataSource;
/**
* @ClassName RecordConfig
* @Description
* @Author linjj
* @Date 2023/8/2 16:48
* @Version 1.0
*/
@Configuration
// 指定主数据库扫描对应的Mapper文件生成代理对象
@MapperScan(basePackages ="com.example.duplicate.infrastructure.configTwoDao" ,sqlSessionFactoryRef = "configTwoSqlSessionFactory")
public class ConfigTwo {
// mapper.xml所在地址
private static final String MAPPER_LOCATION = "classpath*:mapper2/*.xml";
/**
* Primary
*
*/
@Primary
@Bean(name = "configTwoDataSource")
// 读取spring.datasource.master前缀的配置文件映射成对应的配置对象
@ConfigurationProperties(prefix = "spring.datasource.db2")
public DataSource dataSource() {
DataSource build = DataSourceBuilder.create().build();
return build;
}
/**
* Primary
*/
@Bean(name = "configTwoTransactionManager")
@Primary
public PlatformTransactionManager dataSourceTransactionManager(@Qualifier("configTwoDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
/**
* sessionPrimary
*/
@Bean(name = "configTwoSqlSessionFactory")
@Primary
public SqlSessionFactory sqlSessionFactory(@Qualifier("configTwoDataSource") DataSource dataSource) throws Exception {
final SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource);
sessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(ConfigTwo.MAPPER_LOCATION));
return sessionFactoryBean.getObject();
}
}

@ -0,0 +1,72 @@
package com.example.duplicate.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.ResourceUtils;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* @ClassName SwaggerConfig
* @Description swagger
* @Author linjj
* @Date 2023/11/13 10:02
* @Version 1.0
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig extends WebMvcConfigurationSupport {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
//是否开启 (true 开启 false隐藏。生产环境建议隐藏)
//.enable(false)
.select()
//扫描的路径包,设置basePackage会将包下的所有被@Api标记类的所有方法作为api
.apis(RequestHandlerSelectors.basePackage("com.example.duplicate.controller"))
//指定路径处理PathSelectors.any()代表所有的路径
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
// .title("明阳HR集成AD接口")
// .description("使用RestFul风格, 创建人:白领说事")
// .version("1.0")
// .build();
//设置文档标题(API名称)
.title("接口测试")
//文档描述
.description("接口说明")
// //服务条款URL
// .termsOfServiceUrl("http://localhost:8089/")
//版本号
.version("1.0.0")
.build();
}
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
// 解决静态资源无法访问
registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
// 解决swagger无法访问
registry.addResourceHandler("/swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
// 解决swagger的js文件无法访问
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}

@ -0,0 +1,73 @@
package com.example.duplicate.controller;
import com.alibaba.fastjson.JSON;
import com.example.duplicate.common.ResultBody;
import com.example.duplicate.service.DuplicateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @ClassName DuplicateController
* @Description
* @Author linjj
* @Date 2023/5/12 11:22
* @Version 1.0
*/
@RestController
@RequestMapping("/duplicate")
@Api(value="测试",tags = "对外接口")
public class DuplicateController {
@Autowired
DuplicateService duplicateService;
@RequestMapping(value = "getFilePath", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value="微信接口")
public ResultBody getFilePath(String inpatientNo, Integer admissTimes) {
if (StringUtils.isEmpty(inpatientNo)) {
return ResultBody.failed("住院号不得为空");
}
if (null == admissTimes) {
return ResultBody.failed("住院次数不得为空");
}
return ResultBody.success(duplicateService.getFilePath(inpatientNo, admissTimes));
}
/**
* @description:
* @params: startRange
* @params: endRange
* @return: String
* @author linjj
* @date: 2023/4/14 9:32
*/
@RequestMapping(value = "SeniorExamine", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value="文件质检接口")
public String SeniorExamine(String startRange, String endRange) {
if (StringUtils.isEmpty(startRange) && StringUtils.isEmpty(endRange)) {
return "开始范围,结束范围不能全部为空";
}
if (StringUtils.isNotEmpty(startRange) && StringUtils.isNotEmpty(endRange)) {
if (startRange.compareTo(endRange) > 0) {
return "开始范围不能小于结束范围";
}
}
String s = duplicateService.SeniorExamine(startRange, endRange);
return JSON.toJSONString(s);
}
}

@ -0,0 +1,39 @@
package com.example.duplicate.controller;
import com.example.duplicate.common.ResultBody;
import com.example.duplicate.service.LzRmService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName LzRmController
* @Description
* @Author linjj
* @Date 2023/11/10 15:38
* @Version 1.0
*/
@RestController
@RequestMapping("/LzRm")
@Api(value = "连州人民接口", tags = "连州人民相关接口", description = "连州人民相关接口")
public class LzRmController {
@Autowired
private LzRmService lzRmService;
@ResponseBody
@RequestMapping(value = "splitFile", method = RequestMethod.POST)
@ApiOperation(value = "拆分影像信息", notes = "拆分影像信息")
public ResultBody LzRmSplit(){
int i = lzRmService.LzRmSplit();
if (i==1){
return ResultBody.success("完成");
}
return ResultBody.success("失败");
}
}

@ -0,0 +1,85 @@
package com.example.duplicate.controller;
import com.example.duplicate.controller.vo.CommomtableCopyVo;
import com.example.duplicate.infrastructure.configOneDao.CommomtableMapper;
import com.example.duplicate.service.MessageLogService;
import com.example.duplicate.service.MessageLogTwoService;
import com.example.duplicate.service.MessageSubordinateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @ClassName ZJYYController
* @Description
* @Author linjj
* @Date 2023/10/13 13:49
* @Version 1.0
*/
@RestController
@Api(value = "湛江医院接口", tags = "湛江医院相关接口", description = "湛江医院相关接口")
@RequestMapping("/ZJYY")
@Slf4j
public class ZJYYController {
@Autowired
MessageSubordinateService messageSubordinateService;
@Autowired
MessageLogService messageLogService;
@Autowired
MessageLogTwoService messageLogTwoService;
@Autowired
CommomtableMapper commomtableMapper;
@RequestMapping(value = "delMessage" , method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "删除messageSubordinate内容" , notes = "删除messageSubordinate内容")
public int delMessage() {
return messageSubordinateService.delMessage();
}
@RequestMapping(value = "delMessageLog" , method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "删除messageLog内容" , notes = "删除messageLog内容")
public int delMessageLog() {
return messageLogService.delMessageLog();
}
@RequestMapping(value = "addMessageLog" , method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "移动messageLog内容" , notes = "移动messageLog内容")
public int addMessageLog(){
return messageLogTwoService.addMessageLog();
}
@RequestMapping(value = "addMessage" , method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "移动messageScanning表数据" , notes = "移动messageScanning表数据")
public int addMessage(){
return messageSubordinateService.addMessage();
}
@RequestMapping(value = "com" , method = RequestMethod.POST)
@ResponseBody
public String com(String mid){
List<CommomtableCopyVo> com = commomtableMapper.com();
for (CommomtableCopyVo list:com){
StringBuffer sb=new StringBuffer();
sb.append("(inp_no =' "+list.getInpatientNo()+" 'and visit_id = '"+list.getAdmissTimes()+" ' ) or");
log.info(sb.toString());
}
return"";
}
}

@ -0,0 +1,32 @@
package com.example.duplicate.controller.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
* @ClassName addArchiveDetail
* @Description
* @Author linjj
* @Date 2023/11/13 15:57
* @Version 1.0
*/
@Data
public class AddArchiveDetail {
private static final long serialVersionUID = 1L;
@TableId(value = "ID", type = IdType.ASSIGN_UUID)
private String ID;
private String PDFPATH;
private String MasterID;
private String UpLoadDateTime;
private String AssortID;
private String Source;
private String flag;
private String Sys;
private String splitName;
}

@ -0,0 +1,45 @@
package com.example.duplicate.controller.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
* @ClassName AddArchiveMasterVo
* @Description Archive_Master
* @Author linjj
* @Date 2023/11/13 14:48
* @Version 1.0
*/
@Data
public class AddArchiveMasterVo {
private String ID;
private String patientId;
private String inpNo;
private String visitId;
private String name;
private String deptName;
private String dischargeDateTime;
private String ArchiveState;
private String admissionDateTime;
private String LockInfo;
private String DISCHARGEDISPOSITION;
private String splitName;
}

@ -0,0 +1,36 @@
package com.example.duplicate.controller.vo;
import lombok.Data;
/**
* @ClassName addLzRmCommVo
* @Description commomtableVo
* @Author linjj
* @Date 2023/11/17 9:14
* @Version 1.0
*/
@Data
public class AddLzRmCommVo {
private String patientId;
private String admissId;
private String admissTimes;
private String inpatientNo;
private String name;
private String disDate;
private String disDeptName;
private String ph;
private String gdh;
private String splitName;
}

@ -0,0 +1,50 @@
package com.example.duplicate.controller.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @ClassName MessageLog
* @Description
* @Author linjj
* @Date 2023/10/13 15:15
* @Version 1.0
*/
@Data
@TableName("message_log")
public class AddMessageLogVo {
@TableField("id")
private String id;
@TableField("create_time")
private String createTime;
@TableField("end_time")
private String endTime;
@TableField("execution_time")
private int executionTime;
@TableField("input_content")
private String inputContent;
@TableField("interface_name")
private String interfaceName;
@TableField("out_content")
private String outContent;
@TableField("out_json")
private String outJson;
@TableField("remark")
private String remark;
@TableField("result")
private int result;
@TableField("type")
private String type;
@TableField("xml_create_time")
private String xmlCreateTime;
@TableField("xml_execution_time")
private int xml_execution_time;
@TableField("master_id")
private String masterId;
@TableField("webservice_info")
private String webserviceInfo;
@TableField("discharge_date_time")
private String dischargeDateTime;
}

@ -0,0 +1,16 @@
package com.example.duplicate.controller.vo;
import lombok.Data;
/**
* @ClassName ArchiveMasterVo
* @Description
* @Author linjj
* @Date 2023/10/17 10:15
* @Version 1.0
*/
@Data
public class ArchiveMasterVo {
private String id;
}

@ -0,0 +1,28 @@
package com.example.duplicate.controller.vo;
import lombok.Data;
/**
* @ClassName CommomtableCopy
* @Author linjj
* @Date 2023/11/10 16:01
* @Version 1.0
*/
@Data
public class CommomtableCopyVo {
private String id;
private String name;
private String inpatientNo;
private String admissTimes;
private String disDate;
private String pageNumber;
private String inpatientNoPast;
private String disDept;
private String ph;
private String phString;
private int spilStatic;
}

@ -0,0 +1,32 @@
package com.example.duplicate.controller.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* @ClassName commomtableVo
* @Description commomtable
* @Author linjj
* @Date 2023/5/12 15:57
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="commomtable表对象", description="查询路径返回参数实体")
public class CommomtableVo {
@ApiModelProperty(value = "文件保存目录地址")
private String filePath;
@ApiModelProperty(value = "图片类型")
private String assortName;
@ApiModelProperty(value = "文件类型id")
private String assortId;
}

@ -0,0 +1,30 @@
package com.example.duplicate.controller.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* @ClassName commomtableVo
* @Description
* @Author linjj
* @Date 2023/5/12 15:57
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class DuplicateVo {
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "文件分类")
private String assortName;
@ApiModelProperty(value = "页数")
private String pageCount;
@ApiModelProperty(value = "路径")
private String pdfUrl;
}

@ -0,0 +1,24 @@
package com.example.duplicate.controller.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @ClassName fliePath
* @Description
* @Author linjj
* @Date 2023/6/6 15:45
* @Version 1.0
*/
@Data
@TableName("fliePath")
public class FliePath {
@TableField("ph")
private String patientId;
@TableField("fliePath")
private String fliePath;
}

@ -0,0 +1,82 @@
package com.example.duplicate.controller.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @ClassName MessageLog
* @Description
* @Author linjj
* @Date 2023/10/13 15:15
* @Version 1.0
*/
@Data
public class MessageLog {
// @TableField("id")
// private String id;
// @TableField("create_time")
// private String createTime;
// @TableField("end_time")
// private String endTime;
// @TableField("execution_time")
// private int executionTime;
// @TableField("input_content")
// private String inputContent;
// @TableField("interface_name")
// private String interfaceName;
// @TableField("out_content")
// private String outContent;
// @TableField("out_json")
// private String outJson;
// @TableField("remark")
// private String remark;
// @TableField("result")
// private int result;
// @TableField("type")
// private String type;
// @TableField("xml_create_time")
// private String xmlCreateTime;
// @TableField("xml_execution_time")
// private int xmlExecutionTime;
// @TableField("master_id")
// private String masterId;
// @TableField("webservice_info")
// private String webserviceInfo;
// @TableField(exist = false)
// private String dischargeDateTime;
private String id;
private String createTime;
private String endTime;
private int executionTime;
private String inputContent;
private String interfaceName;
private String outContent;
private String outJson;
private String remark;
private int result;
private String type;
private String xmlCreateTime;
private int xmlExecutionTime;
private String masterId;
private String webserviceInfo;
private String dischargeDateTime;
}

@ -0,0 +1,15 @@
package com.example.duplicate.controller.vo;
import lombok.Data;
/**
* @ClassName MessageLogVo
* @Description
* @Author linjj
* @Date 2023/10/13 15:25
* @Version 1.0
*/
@Data
public class MessageLogVo {
private String id;
}

@ -0,0 +1,45 @@
package com.example.duplicate.controller.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @ClassName MessageSubordinate
* @Description
* @Author linjj
* @Date 2023/10/13 15:00
* @Version 1.0
*/
@Data
public class MessageSubordinate {
// @TableField("id")
// private String id;
// @TableField("content_json")
// private String contentJson;
// @TableField("message_id")
// private String messageId;
// @TableField("patient_main")
// private String patientMain;
// @TableField("status")
// private int status;
// @TableField("remark")
// private String remark;
// @TableField("runs")
// private int runs;
private String id;
private String contentJson;
private String messageId;
private String patientMain;
private int status;
private String remark;
private int runs;
private String dischargeDateTime;
}

@ -0,0 +1,14 @@
package com.example.duplicate.controller.vo;
import lombok.Data;
/**
* @ClassName MessageSubordinateVo
* @Author linjj
* @Date 2023/10/13 14:03
* @Version 1.0
*/
@Data
public class MessageSubordinateVo {
private String id;
}

@ -0,0 +1,30 @@
package com.example.duplicate.controller.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* @ClassName commomtableVo
* @Description commomtable
* @Author linjj
* @Date 2023/5/12 15:57
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="commomtable表对象", description="查询路径返回参数实体")
public class PageCountVo {
@ApiModelProperty(value = "文件类型")
private String assortName;
@ApiModelProperty(value = "文件数量")
private String pageCount;
}

@ -0,0 +1,16 @@
package com.example.duplicate.controller.vo;
import lombok.Data;
/**
* @ClassName phVo
* @Description
* @Author linjj
* @Date 2023/6/5 16:21
* @Version 1.0
*/
@Data
public class PhVo {
private String ph;
}

@ -0,0 +1,21 @@
package com.example.duplicate.controller.vo;
import lombok.Data;
/**
* @ClassName TscanAssort
* @Description
* @Author linjj
* @Date 2023/6/6 13:43
* @Version 1.0
*/
@Data
public class TscanAssort {
private String patientId;
private String assortId;
private String scanPage;
private Integer source;
private Integer isDel;
}

@ -0,0 +1,33 @@
package com.example.duplicate.controller.vo;
import lombok.Data;
/**
* @ClassName ZdAssortVo
* @Author linjj
* @Date 2023/11/13 9:31
* @Version 1.0
*/
@Data
public class ZdAssortVo {
private String assortId;
private String assortName;
private String assortSort;
private String printFlag;
private String patientId;
private String DISCHARGEDISPOSITION;
private String PDFPATH;
private String flag;
private String Sys;
private String UpLoadDateTime;
}

@ -0,0 +1,17 @@
package com.example.duplicate.infrastructure.configOneDao;
import com.example.duplicate.controller.vo.AddArchiveDetail;
import org.apache.ibatis.annotations.Mapper;
/**
* @InterfaceName ArchiveDetailMapper
* @Description
* @Author linjj
* @Date 2023/11/13 16:04
* @Version 1.0
*/
@Mapper
public interface ArchiveDetailMapper {
int addArchiveDetail(AddArchiveDetail addArchiveDetail);
}

@ -0,0 +1,29 @@
package com.example.duplicate.infrastructure.configOneDao;
import com.example.duplicate.controller.vo.AddArchiveMasterVo;
import com.example.duplicate.controller.vo.ArchiveMasterVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @InterfaceName ArchiveMasterMapper
* @Author linjj
* @Date 2023/10/16 19:36
* @Version 1.0
*/
@Mapper
public interface ArchiveMasterMapper {
List<ArchiveMasterVo> getMasterId(String dateTime);
int masterIdNum(String dateTime);
int add(@Param("idList") List<String> idList);
int addArchiveMaster(AddArchiveMasterVo addArchiveMasterVo);
}

@ -0,0 +1,35 @@
package com.example.duplicate.infrastructure.configOneDao;
import com.example.duplicate.controller.vo.AddLzRmCommVo;
import com.example.duplicate.controller.vo.CommomtableCopyVo;
import com.example.duplicate.controller.vo.CommomtableVo;
import com.example.duplicate.controller.vo.PageCountVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @InterfaceName CommomtableMapper
* @Description Mapper
* @Author linjj
* @Date 2023/5/12 16:30
* @Version 1.0
*/
@Mapper
public interface CommomtableMapper {
List<String> getCommomtable(@Param("inpatientNo")String inpatientNo, @Param("admissTimes")Integer admissTimes,@Param("assortId") String assortId);
List<CommomtableVo> getZdAssort(@Param("inpatientNo")String inpatientNo, @Param("admissTimes")Integer admissTimes);
PageCountVo getPageCount(@Param("inpatientNo")String inpatientNo, @Param("admissTimes")Integer admissTimes, @Param("assortId") String assortId);
int addAddLzRmComm(AddLzRmCommVo addLzRmCommVo);
List<CommomtableCopyVo>com();
}

@ -0,0 +1,28 @@
package com.example.duplicate.infrastructure.configOneDao;
import com.example.duplicate.controller.vo.CommomtableCopyVo;
import com.example.duplicate.controller.vo.ZdAssortVo;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;
import java.util.List;
/**
* @InterfaceName LzRmMapper
* @Description
* @Author linjj
* @Date 2023/11/10 15:59
* @Version 1.0
*/
@Mapper
public interface LzRmMapper {
List<CommomtableCopyVo> getCommomtableCopyInfo();
int updateSynchronousTime(@Param("spilStatic") int spilStatic,@Param("inpatientNoPast") String inpatientNoPast,@Param("phString") String phString,@Param("pageNumber") String pageNumber);
List<ZdAssortVo> getZdAssortInfo(@Param("inpNo") String inpNo, @Param("LockInfo") String LockInfo,@Param("assortName")String assortName);
}

@ -0,0 +1,33 @@
package com.example.duplicate.infrastructure.configOneDao;
import com.example.duplicate.controller.vo.MessageLog;
import com.example.duplicate.controller.vo.MessageLogVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @ClassName MessageLogMapper
* @Description
* @Author linjj
* @Date 2023/10/13 13:58
* @Version 1.0
*/
@Mapper
public interface MessageLogMapper {
int getMessageLogNum(String dateTime);
List<MessageLogVo>getAllByIds(String dateTime);
String getSynchronousTime();
int updateSynchronousTime(String dischargeDateTime);
List<MessageLog>getAllBy(String synchronousTime);
int del(@Param(value = "messageLogIds")String messageLogIds);
List<MessageLog>getAllByMasterId(@Param(value = "masterIds")String masterIds);
}

@ -0,0 +1,38 @@
package com.example.duplicate.infrastructure.configOneDao;
import com.example.duplicate.controller.vo.MessageSubordinate;
import com.example.duplicate.controller.vo.MessageSubordinateVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @ClassName messageSubordinateMapper
* @Description
* @Author linjj
* @Date 2023/10/13 13:58
* @Version 1.0
*/
@Mapper
public interface MessageSubordinateMapper {
int getMessageNum(String dateTime);
List<MessageSubordinateVo>getAllByIds();
int del(@Param(value = "messageLogIds")String messageLogIds);
String getSynchronousTime();
int updateSynchronousTime(String dischargeDateTime);
List<MessageSubordinate>getAllByTime(String synchronousTime);
List<MessageSubordinate>getAllByMessageLogId(@Param(value = "messageLogIds")String messageLogIds);
}

@ -0,0 +1,14 @@
package com.example.duplicate.infrastructure.configOneDao;
import com.example.duplicate.controller.vo.AddArchiveDetail;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface MidMapper {
List<String> getMid();
}

@ -0,0 +1,37 @@
package com.example.duplicate.infrastructure.configOneDao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.duplicate.controller.vo.FliePath;
import com.example.duplicate.controller.vo.PhVo;
import com.example.duplicate.controller.vo.TscanAssort;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @ClassName QualityMapper
* @Description
* @Author linjj
* @Date 2023/4/13 15:29
* @Version 1.0
*/
@Mapper
public interface QualityMapper extends BaseMapper<FliePath> {
Integer getPhNum(@Param("startRange")String startRange, @Param("endRange")String endRange);
Integer getFileNum(@Param("startRange")String startRange, @Param("endRange")String endRange);
List<String> getFliePath(@Param("ph")String ph);
List<String> getFliePaths(@Param("phs")List<String> phs);
List<String>getPh(@Param("startRange")String startRange, @Param("endRange")String endRange);
List<FliePath>getPhAndFliePath(@Param("startRange")String startRange, @Param("endRange")String endRange);
int addPh(@Param("list")List<PhVo>list);
int addFliePath(@Param("ph")String ph,@Param("fliePath")String fliePath);
int addTscanAssort(TscanAssort tscanAssort);
}

@ -0,0 +1,23 @@
package com.example.duplicate.infrastructure.configTwoDao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.duplicate.controller.vo.MessageLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @ClassName MessageLogMapper
* @Description
* @Author linjj
* @Date 2023/10/13 13:58
* @Version 1.0
*/
@Mapper
public interface MessageLogTwoMapper {
int addAll(@Param("list")List<MessageLog> list);
}

@ -0,0 +1,24 @@
package com.example.duplicate.infrastructure.configTwoDao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.duplicate.controller.vo.MessageLog;
import com.example.duplicate.controller.vo.MessageSubordinate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @ClassName MessageLogMapper
* @Description
* @Author linjj
* @Date 2023/10/13 13:58
* @Version 1.0
*/
@Mapper
public interface MessageSubordinateTwoMapper {
int addAll(@Param("list")List<MessageSubordinate> list);
}

@ -0,0 +1,22 @@
package com.example.duplicate.service;
import com.example.duplicate.controller.vo.DuplicateVo;
import java.util.List;
/**
* @InterfaceName DuplicateService
* @Description 174
* @Author linjj
* @Date 2023/5/12 15:55
* @Version 1.0
*/
public interface DuplicateService {
List<DuplicateVo> getFilePath(String inpatientNo, Integer admissTimes);
String SeniorExamine(String startRange,String endRange);
}

@ -0,0 +1,13 @@
package com.example.duplicate.service;
/**
* @InterfaceName LzRmService
* @Description
* @Author linjj
* @Date 2023/11/10 15:42
* @Version 1.0
*/
public interface LzRmService {
int LzRmSplit();
}

@ -0,0 +1,15 @@
package com.example.duplicate.service;
/**
* @ClassName MessageLogService
* @Description MessageLog
* @Author linjj
* @Date 2023/10/13 15:19
* @Version 1.0
*/
public interface MessageLogService {
int delMessageLog();
}

@ -0,0 +1,13 @@
package com.example.duplicate.service;
/**
* @ClassName MessageLogService
* @Description MessageLog
* @Author linjj
* @Date 2023/10/13 15:19
* @Version 1.0
*/
public interface MessageLogTwoService {
int addMessageLog();
}

@ -0,0 +1,20 @@
package com.example.duplicate.service;
/**
* @ClassName ZJYYService
* @Description
* @Author linjj
* @Date 2023/10/13 13:49
* @Version 1.0
*/
public interface MessageSubordinateService {
int delMessage();
int addMessage();
}

@ -0,0 +1,183 @@
package com.example.duplicate.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.duplicate.controller.vo.*;
import com.example.duplicate.infrastructure.configOneDao.CommomtableMapper;
import com.example.duplicate.infrastructure.configOneDao.QualityMapper;
import com.example.duplicate.service.DuplicateService;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.pdf.PdfWriter;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.swing.*;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* @ClassName DuplicateServiceImpl
* @Description 174
* @Author linjj
* @Date 2023/5/12 15:55
* @Version 1.0
*/
@Service
public class DuplicateServiceImpl extends ServiceImpl<QualityMapper, FliePath> implements DuplicateService {
@Autowired
CommomtableMapper commomtableMapper;
@Value("${waterPicPath}")
private String waterPicPath;
@Value("${EMR_RECORD_JSP}")
private String EMRRECORDJSP;
@Autowired
QualityMapper qualityMapper;
@Override
public List<DuplicateVo> getFilePath(String inpatientNo, Integer admissTimes) {
//定义返回数据集合
List<DuplicateVo> list = new ArrayList<>();
//根据住院号住院次数查询分段
List<CommomtableVo> zdAssort = commomtableMapper.getZdAssort(inpatientNo, admissTimes);
//根据分段查询路径
for (CommomtableVo assortIdList : zdAssort) {
String assortId = assortIdList.getAssortId();
//查询对应分类文件路径
List<String> commomtable = commomtableMapper.getCommomtable(inpatientNo, admissTimes, assortId);
//获取该分类标题、页数
PageCountVo pageCount = commomtableMapper.getPageCount(inpatientNo, admissTimes, assortId);
String join = StringUtils.join(commomtable, ",");
List<String> imageUrllist = Arrays.asList(join.split(","));
//使用yyyyMMddHHmmssSSS格式作为文件名
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String newDate = format.format(date);
imageToPdf(imageUrllist, waterPicPath, newDate);
String outSrc = EMRRECORDJSP + newDate + ".pdf";
DuplicateVo duplicateVo = new DuplicateVo();
duplicateVo.setTitle(pageCount.getAssortName());
duplicateVo.setAssortName(pageCount.getAssortName());
duplicateVo.setPageCount(pageCount.getPageCount());
duplicateVo.setPdfUrl(outSrc);
list.add(duplicateVo);
}
return list;
}
/**
* imageUrllist
* mOutputPdfFileNamepdf
*
* @param imageUrllist
* @param waterPicPath
* @return
*/
public static File imageToPdf(List<String> imageUrllist, String waterPicPath, String newDate) {
if (!new File(waterPicPath).isDirectory()) {
new File(waterPicPath).mkdirs();
}
Document document = new Document(PageSize.A4, 0, 0, 0, 0); //创建文档容器
try {
PdfWriter.getInstance(document, new FileOutputStream(waterPicPath + "\\" + newDate + ".pdf"));
document.open();
for (int i = 0; i < imageUrllist.size(); i++) {
document.newPage();
// doc.add(new Paragraph("简单使用iText"));
Image png1 = Image.getInstance(imageUrllist.get(i));
float heigth = png1.getHeight();
float width = png1.getWidth();
int percent = getPercent2(heigth, width);
png1.setAlignment(Image.MIDDLE);
png1.scalePercent(percent + 3);// 表示是原来图像的比例;
document.add(png1);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (DocumentException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
document.close();
}
File mOutputPdfFile = new File(waterPicPath);
if (!mOutputPdfFile.exists()) {
mOutputPdfFile.deleteOnExit();
return null;
}
return mOutputPdfFile;
}
private static int getPercent2(float h, float w) {
int p = 0;
float p2 = 0.0f;
p2 = 530 / w * 100;
p = Math.round(p2);
return p;
}
private String selectRootByNotWater(String srcPath) {
//获取盘符
String str = srcPath.substring(0, 1).toUpperCase();
switch (str) {
case "C":
return "reloadC\\";
case "D":
return "reloadD\\";
case "E":
return "reloadE\\";
case "F":
return "reloadF\\";
case "G":
return "reloadG\\";
case "H":
return "reloadH\\";
case "I":
return "reloadI\\";
case "J":
return "reloadJ\\";
case "K":
return "reloadK\\";
default:
;
}
return null;
}
@Override
public String SeniorExamine(String startRange, String endRange) {
//获取时间段内的病例
//查600w条
List<FliePath> fliePaths = qualityMapper.getPhAndFliePath(startRange, endRange);
//将600w根据patientId进行分组key=10w个
Map<String, List<FliePath>> collect = fliePaths.stream().collect(Collectors.groupingBy(FliePath::getPatientId));
//保存错误信息
List<FliePath> errors = new ArrayList<>();
for (String k : collect.keySet()) {
List<FliePath> v = collect.get(k);//总共600w图片路径
v.forEach(p -> {
ImageIcon imageIcon = new ImageIcon(p.getFliePath());
//获取图片宽度无法获取图片损坏
if (imageIcon.getIconHeight() == -1) {
errors.add(p);//损坏的图片路径存放
}
});
}
super.saveBatch(errors, 1);
return "完成";
}
}

@ -0,0 +1,193 @@
package com.example.duplicate.service.impl;
import com.example.duplicate.controller.vo.*;
import com.example.duplicate.infrastructure.configOneDao.ArchiveDetailMapper;
import com.example.duplicate.infrastructure.configOneDao.ArchiveMasterMapper;
import com.example.duplicate.infrastructure.configOneDao.CommomtableMapper;
import com.example.duplicate.infrastructure.configOneDao.LzRmMapper;
import com.example.duplicate.service.LzRmService;
import lombok.extern.slf4j.Slf4j;
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 javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @ClassName LzRmServiceImpl
* @Description
* @Author linjj
* @Date 2023/11/10 15:42
* @Version 1.0
*/
@Service
@Slf4j
public class LzRmServiceImpl implements LzRmService {
@Resource
private LzRmMapper lzRmMapper;
@Resource
private ArchiveMasterMapper archiveMasterMapper;
@Resource
private ArchiveDetailMapper archiveDetailMapper;
@Resource
private CommomtableMapper commomtableMapper;
private static SimpleDateFormat inSDF = new SimpleDateFormat("yyyy.mm.dd");
private static SimpleDateFormat outSDF = new SimpleDateFormat("yyyy-mm-dd");
@Override
public int LzRmSplit() {
//新增状态
int addStatic = 0;
//查询需要处理记录
List<CommomtableCopyVo> CommomtableCopyList = lzRmMapper.getCommomtableCopyInfo();
//根据住院号盘号查询影像信息
for (CommomtableCopyVo list : CommomtableCopyList) {
String LockInfo = list.getPh();
String phString = list.getPhString();
String pageNumber = list.getPageNumber();
String inpatientNoPast = String.format("%010d", Integer.parseInt(list.getInpatientNoPast()));
//页码不存在跳出当前循环
if (StringUtils.isBlank(pageNumber)) {
log.info("-------旧住院号:" + inpatientNoPast + "盘号:" + LockInfo + "新住院号:" + list.getInpatientNo() + "的病案页码为空-----------------");
lzRmMapper.updateSynchronousTime(2,list.getInpatientNoPast(), phString, pageNumber);
continue;
}
//截取第一个数
String assortName = intercept(list.getPageNumber());
List<ZdAssortVo> zdAssorList = lzRmMapper.getZdAssortInfo(inpatientNoPast, LockInfo, assortName);
if (zdAssorList.isEmpty()) {
log.info("----------------旧住院号:" + inpatientNoPast + "盘号:" + LockInfo + "页码:" + assortName + "的病案不存在---------------------");
lzRmMapper.updateSynchronousTime(3,list.getInpatientNoPast(), phString, pageNumber);
continue;
}
//插入一条数据到Archive_Master表跟Archive_Detail表
addStatic = add(list, zdAssorList);
//修改状态
lzRmMapper.updateSynchronousTime(1,list.getInpatientNoPast(), phString, pageNumber);
}
return addStatic;
}
/**
* @description: Archive_Master
* @params: commomtableCopyVo
* @params: zdAssorList
* @return: addArchiveMasterVo
* @author linjj
* @date: 2023/11/13 14:58
*/
private int add(CommomtableCopyVo commomtableCopyVo, List<ZdAssortVo> zdAssorList) {
//新增文件表状态
int addDetailStatic = 0;
//新增comm表状态
int addAddLzRmCommStatic = 0;
//使用时间生成一个id
SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmssSSS");
//获取今天日期
String id = fmt.format(new Date());
//转换不规则时间字符串
String s = formatDate(commomtableCopyVo.getDisDate());
ZdAssortVo zdAssortVo = zdAssorList.get(0);
AddArchiveMasterVo addArchiveMasterVo = new AddArchiveMasterVo();
addArchiveMasterVo.setID(id);
addArchiveMasterVo.setPatientId(commomtableCopyVo.getInpatientNo());
addArchiveMasterVo.setInpNo(commomtableCopyVo.getInpatientNo());
addArchiveMasterVo.setVisitId(commomtableCopyVo.getAdmissTimes());
addArchiveMasterVo.setName(commomtableCopyVo.getName());
addArchiveMasterVo.setDeptName(commomtableCopyVo.getDisDept());
addArchiveMasterVo.setDischargeDateTime(s);
addArchiveMasterVo.setArchiveState("缩微");
addArchiveMasterVo.setAdmissionDateTime(s);
addArchiveMasterVo.setLockInfo(commomtableCopyVo.getPh());
addArchiveMasterVo.setDISCHARGEDISPOSITION(zdAssortVo.getDISCHARGEDISPOSITION());
addArchiveMasterVo.setSplitName("Ljj");
int i = archiveMasterMapper.addArchiveMaster(addArchiveMasterVo);
//插入文件表数据
if (i == 1) {
AddArchiveDetail addArchiveDetail = new AddArchiveDetail();
//使用时间生成一个id
SimpleDateFormat detailFmt = new SimpleDateFormat("yyyyMMddHHmmssSSS");
//获取今天日期
String detailId = detailFmt.format(new Date());
addArchiveDetail.setID(detailId);
addArchiveDetail.setPDFPATH(zdAssortVo.getPDFPATH());
addArchiveDetail.setMasterID(id);
addArchiveDetail.setUpLoadDateTime(zdAssortVo.getUpLoadDateTime());
addArchiveDetail.setAssortID(zdAssortVo.getAssortId());
addArchiveDetail.setSource("缩微");
addArchiveDetail.setFlag(zdAssortVo.getFlag());
addArchiveDetail.setSys(zdAssortVo.getSys());
addArchiveDetail.setSplitName("Ljj");
addDetailStatic = archiveDetailMapper.addArchiveDetail(addArchiveDetail);
//向commomtable表增加数据
if (addDetailStatic == 1) {
AddLzRmCommVo addLzRmCommVo = new AddLzRmCommVo();
addLzRmCommVo.setPatientId(id);
addLzRmCommVo.setAdmissId(commomtableCopyVo.getInpatientNo());
addLzRmCommVo.setAdmissTimes(commomtableCopyVo.getAdmissTimes());
addLzRmCommVo.setInpatientNo(commomtableCopyVo.getInpatientNo());
addLzRmCommVo.setName(commomtableCopyVo.getName());
addLzRmCommVo.setDisDate(s);
addLzRmCommVo.setDisDeptName(commomtableCopyVo.getDisDept());
addLzRmCommVo.setPh(commomtableCopyVo.getPh());
addLzRmCommVo.setGdh(commomtableCopyVo.getPh());
addLzRmCommVo.setSplitName("Ljj");
addAddLzRmCommStatic = commomtableMapper.addAddLzRmComm(addLzRmCommVo);
}
}
return addAddLzRmCommStatic;
}
/**
* @description:
* @params: pageNumber
* @return: assortName
* @author linjj
* @date: 2023/11/13 14:57
*/
private String intercept(String pageNumber) {
//如果包含--就截取--前
if (pageNumber.contains("--")) {
pageNumber = pageNumber.substring(0, pageNumber.indexOf("--"));
return pageNumber;
}
//如果包含-就截取-前
if (pageNumber.contains("-")) {
pageNumber = pageNumber.substring(0, pageNumber.indexOf("-"));
return pageNumber;
}
return pageNumber;
}
/**
* @description:
* @params: inDate
* @return: outDate
* @author linjj
* @date: 2023/11/13 15:13
*/
public static String formatDate(String inDate) {
String outDate = "";
if (inDate != null) {
try {
Date date = inSDF.parse(inDate);
outDate = outSDF.format(date);
} catch (ParseException ex) {
}
}
return outDate;
}
}

@ -0,0 +1,47 @@
package com.example.duplicate.service.impl;
import com.example.duplicate.controller.vo.MessageLogVo;
import com.example.duplicate.infrastructure.configOneDao.MessageLogMapper;
import com.example.duplicate.service.MessageLogService;
import com.example.utils.ListUtilsNew;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName MessageLogServiceImpl
* @Description
* @Author linjj
* @Date 2023/10/13 15:19
* @Version 1.0
*/
@Service
public class MessageLogServiceImpl implements MessageLogService {
@Autowired
MessageLogMapper messageLogMapper;
@Value("${ZJ_DATE_TIME_LOG}")
private String dateTime;
@Override
public int delMessageLog() {
//查询需要删除数据条数
int messageLogNum = messageLogMapper.getMessageLogNum(dateTime);
//需要次数
double num = ((double) messageLogNum) / 100;
int circulateNum= (int) Math.ceil(num);
for (int i=0;i<circulateNum;i++){
//查询需要删除数据的id每次查100条
List<MessageLogVo> list = messageLogMapper.getAllByIds(dateTime);
//id集合
List<String> idList = ListUtilsNew.distinctSelect(list, MessageLogVo::getId);
//转成逗号拼接
String ids = String.join(",", idList);
messageLogMapper.del(ids);
}
return 1;
}
}

@ -0,0 +1,52 @@
package com.example.duplicate.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.duplicate.controller.vo.MessageLog;
import com.example.duplicate.infrastructure.configOneDao.MessageLogMapper;
import com.example.duplicate.infrastructure.configTwoDao.MessageLogTwoMapper;
import com.example.duplicate.service.MessageLogTwoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName MessageLogServiceImpl
* @Description
* @Author linjj
* @Date 2023/10/13 15:19
* @Version 1.0
*/
@Service
public class MessageLogTwoServiceImpl implements MessageLogTwoService {
@Autowired
private MessageLogMapper messageLogMapper;
@Autowired
private MessageLogTwoMapper messageLogTwoMapper;
@Value("${ZJ_DATE_TIME_LOG}")
private String dateTime;
@Override
public int addMessageLog() {
//查询需要移动数据条数
int messageLogNum = messageLogMapper.getMessageLogNum(dateTime);
//需要次数
double num = ((double) messageLogNum) / 100;
int circulateNum= (int) Math.ceil(num);
for (int i=0;i<circulateNum;i++){
//查询同步时间
String synchronousTime = messageLogMapper.getSynchronousTime();
//查询需要同步的数据每次查100条
List<MessageLog> allBy = messageLogMapper.getAllBy(synchronousTime);
//插入新数据库
messageLogTwoMapper.addAll(allBy);
//记录更新时间
String dischargeDateTime = allBy.get(allBy.size() - 1).getDischargeDateTime();
messageLogMapper.updateSynchronousTime(dischargeDateTime);
}
return 1;
}
}

@ -0,0 +1,143 @@
package com.example.duplicate.service.impl;
import com.example.duplicate.controller.vo.ArchiveMasterVo;
import com.example.duplicate.controller.vo.MessageLog;
import com.example.duplicate.controller.vo.MessageSubordinate;
import com.example.duplicate.controller.vo.MessageSubordinateVo;
import com.example.duplicate.infrastructure.configOneDao.ArchiveMasterMapper;
import com.example.duplicate.infrastructure.configOneDao.MessageLogMapper;
import com.example.duplicate.infrastructure.configOneDao.MessageSubordinateMapper;
import com.example.duplicate.infrastructure.configTwoDao.MessageLogTwoMapper;
import com.example.duplicate.infrastructure.configTwoDao.MessageSubordinateTwoMapper;
import com.example.duplicate.service.MessageSubordinateService;
import com.example.utils.ListUtilsNew;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName ZJYYServiceImpl
* @Description
* @Author linjj
* @Date 2023/10/13 13:50
* @Version 1.0
*/
@Service
@Slf4j
public class MessageSubordinateServiceImpl implements MessageSubordinateService {
static final Logger logger = LoggerFactory.getLogger(MessageSubordinateServiceImpl.class);
@Value("${ZJ_DATE_TIME_MESSAGE}")
private String dateTime;
@Autowired
MessageSubordinateMapper messageSubordinateMapper;
@Autowired
MessageSubordinateTwoMapper messageSubordinateTwoMapper;
@Autowired
ArchiveMasterMapper archiveMasterMapper;
@Autowired
MessageLogMapper messageLogMapper;
@Autowired
MessageLogTwoMapper messageLogTwoMapper;
@Override
public int delMessage() {
//查询需要删除数据条数
int messageNum = messageSubordinateMapper.getMessageNum(dateTime);
//需要次数
double num = ((double) messageNum) / 100;
int circulateNum = (int) Math.ceil(num);
for (int i = 0; i < circulateNum; i++) {
//查询需要删除数据的id每次查100条
List<MessageSubordinateVo> list = messageSubordinateMapper.getAllByIds();
//id集合
List<String> idList = ListUtilsNew.distinctSelect(list, MessageSubordinateVo::getId);
//转成逗号拼接
String ids = String.join(",", idList);
messageSubordinateMapper.del(ids);
}
return 1;
}
@Override
public int addMessage() {
//查询一共有多少份病历需要同步
int masterIdNum = archiveMasterMapper.masterIdNum(dateTime);
//需要次数
double num = ((double) masterIdNum) / 100;
//少数往前进1确保不丢失数据
int circulateNum = (int) Math.ceil(num);
for (int i = 0; i < circulateNum; i++) {
//每次查询100份病历
List<ArchiveMasterVo> masterId = archiveMasterMapper.getMasterId(dateTime);
if (masterId.size() == 0) {
return 0;
}
//masterId集合
List<String> idList = ListUtilsNew.distinctSelect(masterId, ArchiveMasterVo::getId);
//转成逗号拼接
String masterIds = String.join(",", idList);
//根据masterId查询message_log表
List<MessageLog> messageLogList = messageLogMapper.getAllByMasterId(masterIds);
//获取message_log表id集合
List<String> messageLogId = ListUtilsNew.distinctSelect(messageLogList, MessageLog::getId);
//如果档次100条记录没有messageLogId那么保存记录后结束本次循环
if (messageLogId.size() == 0) {
//保存处理过的masterId
archiveMasterMapper.add(idList);
continue;
}
//根据message_log表id操作message_subordinate表
messageSubordinate(messageLogId);
//操作完message_subordinate表操作message_log表
messageLog(messageLogList);
//保存处理过的masterId
archiveMasterMapper.add(idList);
}
return 0;
}
private void messageSubordinate(List<String> messageLogId) {
//分批次
List<List<String>> newList = ListUtils.partition(messageLogId, 100);
for (List<String> messageList : newList) {
//转成字符串类型逗号拼接
String messageLogIds = String.join(",", messageList);
//查询100条
List<MessageSubordinate> list = messageSubordinateMapper.getAllByMessageLogId(messageLogIds);
if (list.size()==0){
continue;
}
//往新表插入
messageSubordinateTwoMapper.addAll(list);
//新表插入完成删除旧表
messageSubordinateMapper.del(messageLogIds);
}
}
private void messageLog(List<MessageLog> messageLogList) {
List<List<MessageLog>> newList = ListUtils.partition(messageLogList, 100);
for (List<MessageLog> messageList : newList) {
//往新表中拆入数据
messageLogTwoMapper.addAll(messageList);
//获取这100条message_log表id集合
List<String> ids = ListUtilsNew.distinctSelect(messageList, MessageLog::getId);
//移除旧表数据
String messageLogIds = String.join(",", ids);
messageLogMapper.del(messageLogIds);
}
}
}

@ -0,0 +1,12 @@
package com.example.utils;
/**
* @InterfaceName FieldSelector
* @Description
* @Author linjj
* @Date 2023/6/29 16:41
* @Version 1.0
*/
public interface FieldSelector<Type, FieldType> {
FieldType select(Type type);
}

@ -0,0 +1,73 @@
package com.example.utils;
import org.springframework.util.CollectionUtils;
import java.util.*;
public final class ListUtilsNew {
public static <T, K> Map<K, T> toMap(List<T> list, FieldSelector<T, K> selector) {
if (CollectionUtils.isEmpty(list)) return Collections.emptyMap();
Map<K, T> map = new HashMap<>(list.size());
for (T t : list) {
K key = selector.select(t);
if (key != null) map.put(key, t);
}
return map;
}
public static <T, K> Map<K, List<T>> groupBy(List<T> list, FieldSelector<T, K> selector) {
if (CollectionUtils.isEmpty(list)) return Collections.emptyMap();
Map<K, List<T>> map = new HashMap<>();
for (T t : list) {
K key = selector.select(t);
if (key == null) continue;
if (!map.containsKey(key)) {
map.put(key, new ArrayList<T>());
}
map.get(key).add(t);
}
return map;
}
public static <T, K> List<K> select(List<T> list, FieldSelector<T, K> selector) {
if (CollectionUtils.isEmpty(list)) return Collections.emptyList();
List<K> filedList = new ArrayList<>(list.size());
for (T t : list) {
K key = selector.select(t);
if (key != null) filedList.add(key);
}
return filedList;
}
public static <T, K> List<K> distinctSelect(List<T> list, FieldSelector<T, K> selector) {
if (CollectionUtils.isEmpty(list)) return Collections.emptyList();
Set<K> filedSet = new HashSet<>();
for (T t : list) {
K key = selector.select(t);
if (key != null) filedSet.add(key);
}
return new ArrayList<>(filedSet);
}
@SafeVarargs
public static <T> List<T> unionWithoutDuplicate(List<T>... values) {
if (null == values || values.length <= 0) return Collections.emptyList();
Set<T> unionFiledSet = new HashSet<>();
for (List<T> value : values) {
if (!CollectionUtils.isEmpty(value)) {
unionFiledSet.addAll(value);
}
}
return new ArrayList<>(unionFiledSet);
}
public static <T, K> List<T> skipDuplicateKey(List<T> list, FieldSelector<T, K> selector) {
if (CollectionUtils.isEmpty(list)) return Collections.emptyList();
List<T> filedList = new ArrayList<>(list.size());
Map<K, T> map = toMap(list, selector);
for (K key : map.keySet()) {
filedList.add(map.get(key));
}
return filedList;
}
}

@ -0,0 +1,21 @@
package com.example.utils;
import java.security.MessageDigest;
public class Md5Util {
public static String encrypt(String dataStr) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(dataStr.getBytes("UTF8"));
byte[] s = m.digest();
StringBuilder result = new StringBuilder();
for (int i = 0; i < s.length; i++) {
result.append(Integer.toHexString((0x000000FF & s[i]) | 0xFFFFFF00).substring(6));
}
return result.toString();
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
}

@ -0,0 +1,139 @@
package com.example.utils;
public class SnowflakeIdWorker {
/**
* (2015-01-01)
*/
private final long twepoch = 1420041600000L;
/**
* id
*/
private final long workerIdBits = 5L;
/**
* id
*/
private final long datacenterIdBits = 5L;
/**
* id31 ()
*/
private final long maxWorkerId = -1L ^ (-1L << workerIdBits);
/**
* id31
*/
private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
/**
* id
*/
private final long sequenceBits = 12L;
/**
* ID12
*/
private final long workerIdShift = sequenceBits;
/**
* id17(12+5)
*/
private final long datacenterIdShift = sequenceBits + workerIdBits;
/**
* 22(5+5+12)
*/
private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
/**
* 4095 (0b111111111111=0xfff=4095)
*/
private final long sequenceMask = -1L ^ (-1L << sequenceBits);
/**
* ID(0~31)
*/
private long workerId;
/**
* ID(0~31)
*/
private long datacenterId;
/**
* (0~4095)
*/
private long sequence = 0L;
/**
* ID
*/
private long lastTimestamp = -1L;
/**
*
* @param workerId ID (0~31)
* @param datacenterId ID (0~31)
*/
public SnowflakeIdWorker(long workerId, long datacenterId) {
if (workerId > maxWorkerId || workerId < 0) {
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
if (datacenterId > maxDatacenterId || datacenterId < 0) {
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
}
this.workerId = workerId;
this.datacenterId = datacenterId;
}
/**
* ID (线)
* @return SnowflakeId
*/
public synchronized long nextId() {
long timestamp = timeGen();
// 如果当前时间小于上一次ID生成的时间戳说明系统时钟回退过这个时候应当抛出异常
if (timestamp < lastTimestamp) {
throw new RuntimeException(
String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
// 如果是同一时间生成的,则进行毫秒内序列
if (lastTimestamp == timestamp) {
sequence = (sequence + 1) & sequenceMask;
// 毫秒内序列溢出
if (sequence == 0) {
//阻塞到下一个毫秒,获得新的时间戳
timestamp = tilNextMillis(lastTimestamp);
}
}
// 时间戳改变,毫秒内序列重置
else {
sequence = 0L;
}
// 上次生成ID的时间截
lastTimestamp = timestamp;
// 移位并通过或运算拼到一起组成64位的ID
return ((timestamp - twepoch) << timestampLeftShift) //
| (datacenterId << datacenterIdShift) //
| (workerId << workerIdShift) //
| sequence;
}
/**
*
* @param lastTimestamp ID
* @return
*/
protected long tilNextMillis(long lastTimestamp) {
long timestamp = timeGen();
while (timestamp <= lastTimestamp) {
timestamp = timeGen();
}
return timestamp;
}
/**
*
* @return ()
*/
protected long timeGen() {
return System.currentTimeMillis();
}
public static void main(String[] args) throws InterruptedException {
SnowflakeIdWorker idWorker = new SnowflakeIdWorker(0, 0);
for (int i = 0; i < 10; i++) {
long id = idWorker.nextId();
Thread.sleep(1);
System.out.println(id);
}
}
}

@ -0,0 +1,81 @@
server:
port: 3391
spring:
datasource:
# db1: #数据源1
# jdbc-url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=DB_PrivilegeManagement_LZRMYY
# username: sa
# password: docus@904
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# type: com.alibaba.druid.pool.DruidDataSource
# db2: #数据源2
# jdbc-url: jdbc:sqlserver://10.6.1.125:1433;DatabaseName=beifen
# username: sa
# password: Sql@2012
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# type: com.alibaba.druid.pool.DruidDataSource
db1: #数据源1
jdbc-url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=yd_record
username: sa
password: admin123
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
type: com.alibaba.druid.pool.DruidDataSource
db2: #数据源2
jdbc-url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=qf_record
username: sa
password: admin123
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
type: com.alibaba.druid.pool.DruidDataSource
#加快springboot初始化延缓初始化加载
main:
lazy-initialization: true
#加快springboot初始化关闭jmx监控
jmx:
enabled: false
# redis:
# # Redis 服务器地址
# host: localhost
# # 连接端口号
# port: 6379
# # 数据库索引0 - 15
# database: 0
# # 连接超时时间(毫秒)
# timeout: 10000
# # lettuce 参数
# lettuce:
# pool:
# # 最大连接数(使用负值表示没有限制) 默认为 8
# max-active: 10
# # 最大阻塞等待时间(使用负值表示没有限制) 默认为 -1 ms
# max-wait: -1
# # 最大空闲连接 默认为 8
# max-idle: 5
# # 最小空闲连接 默认为 0
# min-idle: 0
application:
name: service-swagger
mybatis:
mapper-locations: classpath:mapper*/*.xml
type-aliases-package: com.example.entity
# 控制台打印sql语句
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
logging:
config: classpath:logback-spring.xml
level:
com.example.mapper: debug
waterPicPath: D:/jiashi/reload/
#厦门174医院清空文件及开发0.关闭 1.开启
waterPicPathFlag: 0
EMR_RECORD_JSP: http://192.0.21.8:8887/
ZJ_DATE_TIME_LOG : 2022-12-31 23:59:59
ZJ_DATE_TIME_MESSAGE : 2022-12-31 23:59:59

@ -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>D:\logs\springbootDemo.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>
<!-- 每产生一个日志文件该日志文件的保存期限为15天 -->
<maxHistory>15</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.example" level="INFO">
<appender-ref ref="demolog" />
</logger>
</configuration>

@ -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.example.duplicate.infrastructure.configOneDao.ArchiveDetailMapper">
<insert id="addArchiveDetail">
insert into Archive_Detail (ID, PDF_PATH, MasterID, UpLoadDateTime, AssortID, Source, flag,
Sys, splitName)
values (#{ID}, #{PDFPATH}, #{MasterID}, #{UpLoadDateTime}, #{AssortID}, #{Source}, #{flag}, #{Sys},#{splitName})
</insert>
</mapper>

@ -0,0 +1,31 @@
<?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.example.duplicate.infrastructure.configOneDao.ArchiveMasterMapper">
<insert id="add">
insert into master_id (masterId)
values
<foreach collection="idList" item="item" separator=",">(#{item})
</foreach>
</insert>
<insert id="addArchiveMaster">
insert into Archive_Master (ID, patient_id, inp_no, visit_id, name, dept_name, discharge_date_time,
ArchiveState, admission_date_time, LockInfo,
DISCHARGE_DISPOSITION,split_name)
values (#{ID}, #{patientId}, #{inpNo}, #{visitId}, #{name}, #{deptName}, #{dischargeDateTime}, #{ArchiveState},
#{admissionDateTime}, #{LockInfo}, #{DISCHARGEDISPOSITION}, #{splitName})
</insert>
<select id="masterIdNum" resultType="java.lang.Integer">
<![CDATA[
SELECT COUNT(ID) FROM Archive_Master WHERE discharge_date_time<=#{dateTime}
]]>
</select>
<select id="getMasterId" resultType="com.example.duplicate.controller.vo.ArchiveMasterVo">
<![CDATA[
SELECT TOP 100 id FROM Archive_Master m WHERE discharge_date_time<=#{dateTime} and NOT EXISTS(SELECT masterId FROM master_id a WHERE masterId=m.ID )
]]>
</select>
</mapper>

@ -0,0 +1,53 @@
<?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.example.duplicate.infrastructure.configOneDao.CommomtableMapper">
<insert id="addAddLzRmComm">
insert into CommonTable (patient_id, admiss_id, admiss_times, inpatient_no, name, dis_date, dis_dept_name,
ph, gdh,splitName)
values (#{patientId}, #{admissId}, #{admissTimes}, #{inpatientNo}, #{name}, #{disDate}, #{disDeptName}, #{ph},#{gdh},#{splitName})
</insert>
<select id="getZdAssort" resultType="com.example.duplicate.controller.vo.CommomtableVo">
SELECT
t.assort_id
FROM
commomtable c
LEFT JOIN t_scan_assort t ON c.patient_id= t.patient_id
LEFT JOIN zd_assort z ON z.assort_id= t.assort_id
WHERE
c.inpatient_no = #{inpatientNo}
AND c.admiss_times= #{admissTimes}
GROUP BY t.assort_id,assort_sort
ORDER BY assort_sort
</select>
<select id="getCommomtable" resultType="java.lang.String">
SELECT
( c.file_path+ '\' + t.scan_page )filePath
FROM
commomtable c
LEFT JOIN t_scan_assort t ON c.patient_id= t.patient_id
LEFT JOIN zd_assort z ON t.assort_id= z.assort_id
WHERE
c.inpatient_no = #{inpatientNo}
AND c.admiss_times= #{admissTimes}
AND t.assort_id= #{assortId}
</select>
<select id="getPageCount" resultType="com.example.duplicate.controller.vo.PageCountVo">
SELECT
COUNT(file_path) as pageCount,z.assort_name
FROM
commomtable c
LEFT JOIN t_scan_assort t ON c.patient_id= t.patient_id
LEFT JOIN zd_assort z ON t.assort_id= z.assort_id
WHERE
c.inpatient_no = #{inpatientNo}
AND c.admiss_times= #{admissTimes}
AND t.assort_id= #{assortId}
GROUP BY z.assort_id,z.assort_name
</select>
<select id="com" resultType="com.example.duplicate.controller.vo.CommomtableCopyVo">
select * from com
</select>
</mapper>

@ -0,0 +1,45 @@
<?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.example.duplicate.infrastructure.configOneDao.LzRmMapper">
<update id="updateSynchronousTime">
update commomtable_copy
set spilStatic=#{spilStatic}
where inpatientNoPast = #{inpatientNoPast}
and ph = #{phString}
and pageNumber=#{pageNumber}
</update>
<select id="getCommomtableCopyInfo" resultType="com.example.duplicate.controller.vo.CommomtableCopyVo">
SELECT
id,
name,
inpatientNo,
admissTimes,
disDate,
pageNumber,
inpatientNoPast,
disDept,
'00' + ph ph,
ph phString,
spilStatic
FROM
commomtable_copy
WHERE
spilStatic = 0
ORDER BY
id
</select>
<select id="getZdAssortInfo" resultType="com.example.duplicate.controller.vo.ZdAssortVo">
SELECT
zd.assort_id as assortId,zd.assort_name as assortName,zd.assort_sort as assortSort,zd.print_flag as printFlag,zd.parent_id as parentId,
ad.PDF_PATH as PDFPATH,am.DISCHARGE_DISPOSITION as DISCHARGEDISPOSITION,ad.UpLoadDateTime,ad.flag,ad.Sys
FROM
archive_master am
INNER JOIN archive_detail ad ON ad.MasterID = am.ID
AND inp_no = #{inpNo}
AND am.LockInfo= #{LockInfo}
LEFT JOIN zd_assort zd ON zd.assort_id= ad.AssortID
WHERE assort_name=#{assortName}
</select>
</mapper>

@ -0,0 +1,74 @@
<?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.example.duplicate.infrastructure.configOneDao.MessageLogMapper">
<resultMap id="BaseResultMap" type="com.example.duplicate.controller.vo.MessageLog">
<id column="id" property="id" />
<result column="create_time" property="createTime" />
<result column="end_time" property="endTime" />
<result column="execution_time" property="executionTime" />
<result column="input_content" property="inputContent" />
<result column="interface_name" property="interfaceName" />
<result column="out_content" property="outContent" />
<result column="out_json" property="outJson" />
<result column="remark" property="remark" />
<result column="result" property="result" />
<result column="type" property="type" />
<result column="xml_create_time" property="xmlCreateTime" />
<result column="xml_execution_time" property="xmlExecutionTime" />
<result column="master_id" property="masterId" />
<result column="webservice_info" property="webserviceInfo" />
<result column="discharge_date_time" property="dischargeDateTime" />
</resultMap>
<update id="updateSynchronousTime">
update synchronous_time set addTime=#{dischargeDateTime}
</update>
<delete id="del">
delete from message_log where id in
<foreach item="item" collection="messageLogIds.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<select id="getAllByIds" resultType="com.example.duplicate.controller.vo.MessageLogVo">
<![CDATA[
SELECT TOP 100
m.id
FROM message_log m
INNER JOIN Archive_Master a ON m.master_id = a.id
WHERE a.discharge_date_time <= #{dateTime}
order by a.discharge_date_time desc
]]>
</select>
<select id="getMessageLogNum" resultType="java.lang.Integer">
<![CDATA[
SELECT COUNT(m.id)
FROM message_log m
INNER JOIN Archive_Master a ON m.master_id = a.id
WHERE a.discharge_date_time <= #{dateTime}
]]>
</select>
<select id="getSynchronousTime" resultType="java.lang.String">
SELECT addTime FROM synchronous_time
</select>
<select id="getAllBy" resultMap="BaseResultMap">
<![CDATA[
SELECT TOP 100
m.*,a.discharge_date_time
FROM message_log m
INNER JOIN Archive_Master a ON m.master_id = a.id
WHERE a.discharge_date_time < #{synchronousTime}
order by a.discharge_date_time desc
]]>
</select>
<select id="getAllByMasterId" resultMap="BaseResultMap">
SELECT * FROM message_log WHERE master_id in
<foreach item="item" collection="masterIds.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

@ -0,0 +1,72 @@
<?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.example.duplicate.infrastructure.configOneDao.MessageSubordinateMapper">
<resultMap id="BaseResultMap" type="com.example.duplicate.controller.vo.MessageSubordinate">
<id column="id" property="id" />
<result column="content_json" property="contentJson" />
<result column="message_id" property="messageId" />
<result column="patient_main" property="patientMain" />
<result column="status" property="status" />
<result column="remark" property="remark" />
<result column="runs" property="runs" />
<result column="discharge_date_time" property="dischargeDateTime" />
</resultMap>
<update id="updateSynchronousTime">
update synchronous_time1 set addTime=#{dischargeDateTime}
</update>
<delete id="del">
delete from message_subordinate where message_id in
<foreach item="item" collection="messageLogIds.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<select id="getMessageNum" resultType="java.lang.Integer">
<![CDATA[
SELECT COUNT(m.id)
FROM message_subordinate m
INNER JOIN message_log b on b.id = m.message_id
INNER JOIN Archive_Master a ON b.master_id = a.id
WHERE a.discharge_date_time <= #{dateTime}
]]>
</select>
<select id="getAllByIds" resultType="com.example.duplicate.controller.vo.MessageSubordinateVo">
<![CDATA[
SELECT TOP 100
m.id
FROM message_subordinate m
INNER JOIN message_log b on b.id = m.message_id
INNER JOIN Archive_Master a ON b.master_id = a.id
WHERE a.discharge_date_time <= '2022-12-31 23:59:59'
order by a.discharge_date_time desc
]]>
</select>
<select id="getSynchronousTime" resultType="java.lang.String">
select addTime from synchronous_time1
</select>
<select id="getAllByTime" resultMap="BaseResultMap">
<![CDATA[
SELECT TOP 100
m.*,a.discharge_date_time
FROM message_subordinate m
INNER JOIN message_log b on b.id = m.message_id
INNER JOIN Archive_Master a ON b.master_id = a.id
WHERE a.discharge_date_time <= #{synchronousTime}
order by a.discharge_date_time desc
]]>
</select>
<select id="getAllByMessageLogId" resultMap="BaseResultMap">
SELECT * FROM message_subordinate WHERE message_id in
<foreach item="item" collection="messageLogIds.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</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.example.duplicate.infrastructure.configOneDao.MidMapper">
<select id="getMid" resultType="java.lang.String">
SELECT
mid
FROM mid
</select>
</mapper>

@ -0,0 +1,108 @@
<?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.example.duplicate.infrastructure.configOneDao.QualityMapper" >
<insert id="addPh" parameterType="java.util.List">
insert into ph (ph
)
values <foreach collection="list" item="item" separator=",">(#{item.ph}
)</foreach>
</insert>
<insert id="addFliePath">
insert into fliePath (ph,fliePath
)
values (#{ph},#{fliePath}
)
</insert>
<insert id="addTscanAssort">
insert into t_scan_assort (patient_id,assort_id,scan_page,source,is_del
)
values (#{patientId},#{assortId},#{scanPage},#{source},#{isDel}
)
</insert>
<select id="getPhNum" resultType="java.lang.Integer">
SELECT COUNT(distinct ph) FROM commomtable
<where> 1=1
<if test="startRange != null and startRange != ''">
and ph >= #{startRange,jdbcType=NVARCHAR}
</if>
<if test="endRange != null and endRange != ''">
and ph &lt;= #{endRange,jdbcType=NVARCHAR}
</if>
</where>
</select>
<select id="getFileNum" resultType="java.lang.Integer">
SELECT
COUNT(t.patient_id)
FROM
commomtable c
LEFT JOIN t_scan_assort t on c.patient_id=t.patient_id
<where> t.is_del!=1
<!-- <if test="startRange != null and startRange != '' and endRange != null and endRange != ''">-->
<!-- and ph >= #{startRange,jdbcType=NVARCHAR}-->
<!-- </if>-->
<!-- <if test="startRange != null and startRange != '' and endRange != null and endRange != ''">-->
<!-- and ph &lt;= #{endRange,jdbcType=NVARCHAR}-->
<!-- </if>-->
<!-- <if test="startRange != null and startRange != '' and endRange = null and endRange = ''">-->
<!-- and ph = #{startRange,jdbcType=NVARCHAR}-->
<!-- </if>-->
<!-- <if test="startRange = null and startRange = '' and endRange != null and endRange != ''">-->
<!-- and ph = #{endRange,jdbcType=NVARCHAR}-->
<!-- </if>-->
<if test="startRange != null and startRange != '' ">
and ph >= #{startRange,jdbcType=NVARCHAR}
</if>
<if test="endRange != null and endRange != ''">
and ph &lt;= #{endRange,jdbcType=NVARCHAR}
</if>
</where>
</select>
<select id="getFliePath" resultType="java.lang.String">
SELECT
c.file_path+'\'+t.scan_page as fliePath
FROM
commomtable c
inner JOIN t_scan_assort t on c.patient_id=t.patient_id
where t.is_del!=1 and c.patient_id=#{ph,jdbcType=NVARCHAR}
</select>
<select id="getFliePaths" resultType="java.lang.String">
SELECT
c.file_path+'\'+t.scan_page as fliePath
FROM
commomtable c
inner JOIN t_scan_assort t on c.patient_id=t.patient_id
where t.is_del!=1 and c.patient_id in
<foreach item="item" collection="phs" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getPh" resultType="java.lang.String">
SELECT patient_id FROM commomtable
<where> 1=1
<if test="startRange != null and startRange != '' ">
and dis_date >= #{startRange,jdbcType=NVARCHAR}
</if>
<if test="endRange != null and endRange != ''">
and dis_date &lt;= #{endRange,jdbcType=NVARCHAR}
</if>
</where>
</select>
<select id="getPhAndFliePath" resultType="com.example.duplicate.controller.vo.FliePath">
SELECT
c.patient_id,c.file_path+'\'+t.scan_page as fliePath
FROM
commomtable c
inner JOIN t_scan_assort t on c.patient_id=t.patient_id
<where> 1=1
<if test="startRange != null and startRange != '' ">
and dis_date >= #{startRange,jdbcType=NVARCHAR}
</if>
<if test="endRange != null and endRange != ''">
and dis_date &lt;= #{endRange,jdbcType=NVARCHAR}
</if>
</where>
</select>
</mapper>

@ -0,0 +1,18 @@
<?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.example.duplicate.infrastructure.configTwoDao.MessageLogTwoMapper">
<insert id="addAll">
insert into message_log (id,create_time,end_time,execution_time,input_content,
interface_name,out_content,out_json,remark,result,type,xml_create_time,xml_execution_time,
master_id,webservice_info)
values
<foreach collection="list" item="item" separator=",">(#{item.id},#{item.createTime},#{item.endTime},
#{item.executionTime},#{item.inputContent},#{item.interfaceName},#{item.outContent},
#{item.outJson},#{item.remark},#{item.result},#{item.type},#{item.xmlCreateTime},#{item.xmlExecutionTime},
#{item.masterId},#{item.webserviceInfo}
)
</foreach>
</insert>
</mapper>

@ -0,0 +1,16 @@
<?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.example.duplicate.infrastructure.configTwoDao.MessageSubordinateTwoMapper">
<insert id="addAll">
insert into message_subordinate (id,content_json,message_id,patient_main,status,remark,runs)
values
<foreach collection="list" item="item" separator=",">(#{item.id},#{item.contentJson},#{item.messageId},
#{item.patientMain},#{item.status},#{item.remark},#{item.runs}
)
</foreach>
</insert>
</mapper>

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
-->
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
<id>mr-file</id>
<classpath>
<dir name="E:/ideaObject/mr/mr-file/target/classes">
</dir>
</classpath>
</application>

@ -0,0 +1,141 @@
package com.example;
import com.example.duplicate.infrastructure.configOneDao.MidMapper;
import com.example.duplicate.infrastructure.configOneDao.QualityMapper;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ofdrw.converter.ofdconverter.ImageConverter;
import org.ofdrw.layout.OFDDoc;
import org.ofdrw.layout.PageLayout;
import org.ofdrw.layout.element.Img;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = com.example.SpringbootDemoApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Slf4j
public class DemoApplicationTests {
private static SimpleDateFormat inSDF = new SimpleDateFormat("yyyy.mm.dd");
private static SimpleDateFormat outSDF = new SimpleDateFormat("yyyy-mm-dd");
@Autowired
QualityMapper qualityMapper;
@Autowired
MidMapper midMapper;
@Test
public void getPic() {
List<String> mid = midMapper.getMid();
String curl = " curl -X POST http://10.36.116.108:3391/makeUp/makeUpPacsByMasterId -d";
String param = "masterId=";
for (String masterId:mid){
log.info(curl+" "+param+masterId);
}
}
@Test
public void ImageConverterTest() throws IOException {
String directoryPath = "D:\\tmp1\\004624"; // 替换为你的目录路径
List<Path> imagePaths = findImageFiles(directoryPath);
for (int i=0;i<imagePaths.size();i++){
try(ImageConverter converter= new ImageConverter(Paths.get("D:\\tmp1\\ofd\\"+i+".ofd"))) {
BufferedImage bufferedImage = ImageIO.read(imagePaths.get(i).toFile());
double imageHeight = bufferedImage.getHeight();
double imageWidth = bufferedImage.getWidth();
double scale = PageLayout.A4().getWidth() / imageWidth;
double height = imageHeight * scale;
PageLayout pageLayout=new PageLayout(PageLayout.A4().getWidth(),height);
converter.setPageSize(pageLayout);
converter.append(imagePaths.get(i),PageLayout.A4().getWidth(), height);
}
}
}
public static List<Path> findImageFiles(String directoryPath) {
List<String> jpgPath = new ArrayList<>();
List<Path> imgPaths=new ArrayList<>();
File directory = new File(directoryPath);
// 遍历目录
File[] files = directory.listFiles((dir, name) -> name.toLowerCase().matches(".*\\.(jpg)$"));
if (files != null) {
for (File file : files) {
if (file.isFile()) {
jpgPath.add(file.getAbsolutePath());
}
}
}
for (String path:jpgPath){
imgPaths.add(Paths.get(path));
}
return imgPaths;
}
@Test
public void intercept() {
String pageNumber = "66";
//如果包含--就截取--前
if (pageNumber.contains("--")) {
pageNumber = pageNumber.substring(0, pageNumber.indexOf("--"));
}
//如果包含--就截取-前
if (pageNumber.contains("-")) {
pageNumber = pageNumber.substring(0, pageNumber.indexOf("-"));
}
System.out.println("pageNumber:" + pageNumber);
}
@Test
public void intercept1() {
String a = "0000000002";
String s = String.format("%010d", Integer.parseInt(a));
System.out.println("s:" + s);
}
public static String bytesToHexString(byte[] src) {
StringBuilder stringBuilder = new StringBuilder();
if (src == null || src.length <= 0) {
return null;
}
for (int i = 0; i < src.length; i++) {
int v = src[i] & 0xFF;
String hv = Integer.toHexString(v);
if (hv.length() < 2) {
stringBuilder.append(0);
}
stringBuilder.append(hv);
}
return stringBuilder.toString();
}
}
Loading…
Cancel
Save