init:初始化文件数据采集,顺德人医手麻采集开发

master
wyb 1 year ago
commit a83fc1c096

35
.gitignore vendored

@ -0,0 +1,35 @@
target/
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
docus-services/docus-services-system1/
### IntelliJ IDEA ###
*.log
.idea
*.iws
*.iml
*.ipr
mvnw*
*.cmd
*.mvn
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
logs*

@ -0,0 +1,73 @@
<assembly 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 http://maven.apache.org/xsd/assembly-1.0.0.xsd">
<id>exe</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<outputDirectory>/lib</outputDirectory>
<directory>${basedir}/target/lib</directory>
</fileSet>
<fileSet>
<outputDirectory>/config</outputDirectory>
<directory>${basedir}/target/resources</directory>
<fileMode>0755</fileMode>
<includes>
<include>*.xml</include>
<include>*.yml</include>
<include>*.properties</include>
</includes>
</fileSet>
<fileSet>
<outputDirectory>/dataConfig</outputDirectory>
<directory>${basedir}/target/dataConfig</directory>
<fileMode>0755</fileMode>
<includes>
<include>*.json</include>
</includes>
</fileSet>
<fileSet>
<outputDirectory>/</outputDirectory>
<directory>${basedir}/target/resources/bin</directory>
<fileMode>0755</fileMode>
<includes>
<include>*.bat</include>
</includes>
</fileSet>
<fileSet>
<outputDirectory>/</outputDirectory>
<directory>${basedir}/target/resources/bin</directory>
<fileMode>0755</fileMode>
<includes>
<include>*.xml</include>
</includes>
</fileSet>
<fileSet>
<outputDirectory>/</outputDirectory>
<directory>${basedir}</directory>
<fileMode>0755</fileMode>
<includes>
<include>*.exe</include>
</includes>
</fileSet>
<!-- 将项目启动jar打包到boot目录中 -->
<fileSet>
<directory>${basedir}/target</directory>
<outputDirectory>/</outputDirectory>
<fileMode>0755</fileMode>
<includes>
<include>${project.build.finalName}.jar</include>
</includes>
</fileSet>
</fileSets>
</assembly>

@ -0,0 +1,369 @@
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.docus</groupId>
<artifactId>docus-bom</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>docus-collect-file-data</artifactId>
<dependencies>
<dependency>
<groupId>com.docus</groupId>
<artifactId>docus-knife4j-starter</artifactId>
</dependency>
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.1</version>
</dependency>
<!--配置中心客户端-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<exclusions>
<exclusion>
<artifactId>checker-qual</artifactId>
<groupId>org.checkerframework</groupId>
</exclusion>
<exclusion>
<artifactId>error_prone_annotations</artifactId>
<groupId>com.google.errorprone</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--mybatis plus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
<!--nacos-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<exclusions>
<exclusion>
<artifactId>HdrHistogram</artifactId>
<groupId>org.hdrhistogram</groupId>
</exclusion>
<exclusion>
<artifactId>jsr305</artifactId>
<groupId>com.google.code.findbugs</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.16</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.16</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.4.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
</dependency>
<dependency>
<groupId>com.docus</groupId>
<artifactId>docus-base-starter</artifactId>
<exclusions>
<exclusion>
<artifactId>knife4j-spring-boot-autoconfigure</artifactId>
<groupId>com.github.xiaoymin</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.docus</groupId>
<artifactId>docus-tool-starter</artifactId>
</dependency>
<dependency>
<groupId>com.docus</groupId>
<artifactId>docus-shiro-starter</artifactId>
</dependency>
<dependency>
<groupId>com.docus</groupId>
<artifactId>docus-base-starter</artifactId>
<exclusions>
<exclusion>
<artifactId>springfox-core</artifactId>
<groupId>io.springfox</groupId>
</exclusion>
<exclusion>
<artifactId>springfox-schema</artifactId>
<groupId>io.springfox</groupId>
</exclusion>
<exclusion>
<artifactId>springfox-spi</artifactId>
<groupId>io.springfox</groupId>
</exclusion>
<exclusion>
<artifactId>knife4j-spring-boot-autoconfigure</artifactId>
<groupId>com.github.xiaoymin</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<!--&lt;!&ndash;添加feign依赖&ndash;&gt;-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!--sqlserver驱动-->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
<!-- oracle 驱动-->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4.0</version>
</dependency>
<!-- webservice cxf-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.3.4</version>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.1</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<!--打包时去除第三方依赖-->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.4</version>
<configuration>
<layout>ZIP</layout>
<includes>
<include>
<groupId>non-exists</groupId>
<artifactId>non-exists</artifactId>
</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!--拷贝第三方依赖文件到指定目录-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<!--target/lib是依赖jar包的输出目录根据自己喜好配置-->
<outputDirectory>target/lib</outputDirectory>
<excludeTransitive>false</excludeTransitive>
<stripVersion>false</stripVersion>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<!-- copy资源文件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<outputDirectory>${project.build.directory}/resources</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-bin</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>bin/*.xml</include>
<include>*.yml</include>
<include>bin/*.bat</include>
</includes>
</resource>
</resources>
<outputDirectory>${project.build.directory}/resources</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-data-config</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>../../dataConfig</directory>
<filtering>true</filtering>
</resource>
</resources>
<outputDirectory>${project.build.directory}/dataConfig</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- 打jar包时忽略配置文件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<excludes>
<exclude>**/*.yml</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<configuration>
<finalName>${project.artifactId}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>dev</id>
<properties>
<profile.name>prod</profile.name>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
</project>

@ -0,0 +1,34 @@
package com.docus.server;
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.cloud.openfeign.EnableFeignClients;
import java.util.Properties;
/**
* @author wyb
*/
@Slf4j
@SpringBootApplication(scanBasePackages ={"com.docus"})
@MapperScan("com.docus.server.**.mapper")
@EnableFeignClients(basePackages = {"com.docus"})
public class AppRunBootstrap {
public static void main(String[] args) {
Properties props = System.getProperties();
props.setProperty("org.apache.cxf.stax.allowInsecureParser", "1");
props.setProperty("UseSunHttpHandler", "true");
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
SpringApplication.run(AppRunBootstrap.class, args);
}
static void testMysql(){
}
}

@ -0,0 +1,20 @@
package com.docus.server.archive.dto;
import lombok.Data;
/**
*
* @author YongBin Wen
* @date 2024/7/12 14:52
*/
@Data
public class PatientInfoDto {
/**
*
*/
private String inpatientNo;
/**
*
*/
private Integer admissTimes;
}

@ -0,0 +1,12 @@
package com.docus.server.archive.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TBasicMapper {
}

@ -0,0 +1,22 @@
package com.docus.server.config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
* @author YongBin Wen
* @date 2024/3/29 14:00
*/
@Component
@Data
public class DocusServerUrlConfig {
@Value("${docus.url.viewcollect-server}")
private String viewCollectServerUrl;
@Value("${docus.url.downploadlatform-server}")
private String downloadPlatformServerUrl;
@Value("${docus.url.taskdistribute-server}")
private String taskDistributeServerUrl;
}

@ -0,0 +1,87 @@
package com.docus.server.config;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @ProjectName:
* @Description:
* @Param
* @Return
* @Author:
* @CreateDate: 2021/5/7 16:23
* @UpdateUser:
* @UpdateDate: 2021/5/7 16:23
* @UpdateRemark:
* @Version: 1.0
*/
@Configuration
public class XxlJobConfig {
private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
@Value("${xxl.job.admin.addresses}")
private String adminAddresses;
@Value("${xxl.job.accessToken}")
private String accessToken;
@Value("${xxl.job.executor.appname}")
private String appname;
@Value("${xxl.job.executor.address}")
private String address;
@Value("${xxl.job.executor.ip}")
private String ip;
@Value("${xxl.job.executor.port}")
private int port;
@Value("${xxl.job.executor.logpath}")
private String logPath;
@Value("${xxl.job.executor.logretentiondays}")
private int logRetentionDays;
@Bean
public XxlJobSpringExecutor xxlJobExecutor() {
logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppname(appname);
xxlJobSpringExecutor.setAddress(address);
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setLogPath(logPath);
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
return xxlJobSpringExecutor;
}
/**
* "spring-cloud-commons" "InetUtils" IP
*
* 1
* <dependency>
* <groupId>org.springframework.cloud</groupId>
* <artifactId>spring-cloud-commons</artifactId>
* <version>${version}</version>
* </dependency>
*
* 2
* spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
*
* 3IP
* String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
*//*
*/
}

@ -0,0 +1,23 @@
package com.docus.server.rpc;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.rpc.dto.ReportDownDto;
/**
*
*
* @author jiashi
*/
public interface DownPlatformService {
/**
*
*
* @param reportDownDto
* @return
*/
CommonResult report(ReportDownDto reportDownDto);
}

@ -0,0 +1,24 @@
package com.docus.server.rpc;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.rpc.dto.ReportDownTwoDto;
/**
*
*
* @author wyb
*/
public interface TaskDistributeService {
/**
* -
*
* @param collectorId
* @return
*/
CommonResult<ReportDownTwoDto> getNoViewTaskByCollectorId(String collectorId);
CommonResult<String> cancel(Long taskId);
}

@ -0,0 +1,37 @@
package com.docus.server.rpc.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
*
* @author WYBDEV
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@ApiModel(value = "患者信息")
public class PatientInfoDTO {
@ApiModelProperty(value = "病案主键")
private String patientId;
@ApiModelProperty(value = "住院号")
private String inpatientNo;
@ApiModelProperty(value = "住院次数")
private Integer admissTimes;
@ApiModelProperty(value = "入院日期 yyyy-MM-dd HH:mm:ss")
private String admissDate;
@ApiModelProperty(value = "入院科室名称")
private String admissDeptName;
@ApiModelProperty(value = "出院日期 yyyy-MM-dd HH:mm:ss")
private String disDate;
@ApiModelProperty(value = "出院科室名称")
private String disDeptName;
@ApiModelProperty(value = "记账号")
private String jzh;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "住院id")
private String admissId;
}

@ -0,0 +1,30 @@
package com.docus.server.rpc.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class ReportDownDto {
@ApiModelProperty(value = "采集器id")
private String collectorid;
@ApiModelProperty(value = "采集器ip")
private String ip;
@ApiModelProperty(value = "分类id")
private String assortid;
@ApiModelProperty(value = "患者信息")
private ReportDownPatientDto patient;
@ApiModelProperty(value = "文件信息")
private List<ReportDownScanFileDto> scanfiles;
@ApiModelProperty(value = "扫描用户代码")
private String scanusercode;
@ApiModelProperty(value = "扫描用户名称")
private String scanusername;
}

@ -0,0 +1,19 @@
package com.docus.server.rpc.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ReportDownPatientDto {
@ApiModelProperty(value = "记帐号")
private String jzh;
@ApiModelProperty(value = "住院次数,记帐号重复则加这个参数无则Null")
private Integer admisstimes;
@ApiModelProperty(value = "病案主键如有传则使用无则使用jzh")
private String patientid;
@ApiModelProperty(value = "病案号")
private String inpatientno;
@ApiModelProperty(value = "物理存储位置,有则传")
private String storagelocation;
}

@ -0,0 +1,32 @@
package com.docus.server.rpc.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ReportDownScanFileDto {
@ApiModelProperty(value = "任务id(如无效任务id则不更新任务表数据)")
private Long taskid;
@ApiModelProperty(value = "文件标题")
private String filetitle;
@ApiModelProperty(value = "采集类型(文件来源 1:采集器2扫描生产软件)")
private int filesource;
@ApiModelProperty(value = "下载类型(1:服务器本地2ftp服务器3共享文件夹)")
private int filestoragetype;
@ApiModelProperty(value = "文件类型(1:url,2:base64,3:url base64,4:共享文件5本地文件base64)")
private int filetype=1;
@ApiModelProperty(value = "下载地址")
private String downurl;
// @ApiModelProperty(value = "档案信息")
// private String recordid;
@ApiModelProperty(value = "采集流水号")
private String serialnum;
@ApiModelProperty(value = "排序日期")
private String sortdate;
@ApiModelProperty(value = "是否作废 0否 不作废1是 作废")
private int cancel=0;
}

@ -0,0 +1,29 @@
package com.docus.server.rpc.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ReportDownTwoDto {
@ApiModelProperty(value = "档案编号")
private String patientId;
@ApiModelProperty(value = "记账号")
private String jzh;
@ApiModelProperty(value = "档案类型")
private String recordType;
@ApiModelProperty(value = "档案时间")
private String createTime;
@ApiModelProperty(value = "患者信息")
private ReportPatientTwoDto patient =new ReportPatientTwoDto();
@ApiModelProperty(value = "住院信息")
private List<ReportHospitalTwoDto> hospitals = new ArrayList<>();
@ApiModelProperty(value = "任务信息")
private List<ReportTaskTwoDto> tasks = new ArrayList<>();
@ApiModelProperty(value = "母亲基础信息")
private PatientInfoDTO parent;
}

@ -0,0 +1,97 @@
package com.docus.server.rpc.dto;
import lombok.Data;
/**
*
*/
@Data
public class ReportDto {
/**
*
*/
private String inpatientNo;
/**
* /
*/
private String jzh;
/**
*
*/
private Integer admisstimes;
/**
*
*/
private String sysFlag;
/**
*
*/
private String downUrl;
/**
*
*/
private String fileTitle;
/**
* /id
*/
private String serialnum;
/**
* id
*/
private String assortId;
/**
* ( 1:2)
*/
private String fileSource;
/**
* 1:2ftp3
*/
private String filestoragetype;
/**
* id ,
*/
private Long taskId;
/**
*
*/
private String patientId;
/**
* 1:url2:base643:url base644:5base64
*/
private Integer downtype = 1;
/**
* id12+
*
*/
private String visitSn;
/**
* id
*/
private String patientSn;
/**
*
*/
private String reportSn;
/**
*
*/
private boolean mergeFileTitle;
public ReportDto() {
}
}

@ -0,0 +1,27 @@
package com.docus.server.rpc.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
*/
@Data
public class ReportHospitalTwoDto {
@ApiModelProperty(value = "患者id")
private String patientId;
@ApiModelProperty(value = "住院次数")
private Integer admissTimes;
@ApiModelProperty(value = "住院日期")
private String admissDate;
@ApiModelProperty(value = "出院日期")
private String disDate;
@ApiModelProperty(value = "出院科室名称")
private String disDeptName;
@ApiModelProperty(value = "出院科室名称")
private String admissDeptName;
@ApiModelProperty(value = "卡号")
private String admissId;
}

@ -0,0 +1,18 @@
package com.docus.server.rpc.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
*/
@Data
public class ReportPatientTwoDto {
@ApiModelProperty(value = "住院号/就诊号")
private String inpatientNo;
@ApiModelProperty(value = "患者姓名")
private String name;
@ApiModelProperty(value = "id号")
private String patientId;
}

@ -0,0 +1,19 @@
package com.docus.server.rpc.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
*/
@Data
public class ReportTaskTwoDto {
@ApiModelProperty(value = "采集器标识")
private String collectorId;
@ApiModelProperty(value = "任务id")
private Long taskId;
@ApiModelProperty(value = "患者id")
private String patientId;
}

@ -0,0 +1,51 @@
package com.docus.server.rpc.impl;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.docus.core.util.Func;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.config.DocusServerUrlConfig;
import com.docus.server.rpc.DownPlatformService;
import com.docus.server.rpc.dto.ReportDownDto;
import com.docus.server.rpc.dto.ReportDownScanFileDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
*
*
* @author jiashi
*/
@Component
@Slf4j
public class DownPlatformServiceImpl implements DownPlatformService {
@Resource
private DocusServerUrlConfig serverUrlConfig;
@Override
public CommonResult report(ReportDownDto reportDownDto) {
String downUrl = serverUrlConfig.getDownloadPlatformServerUrl() + "api/downplatform/report";
String requestId = Func.randomUUID();
String requestParam = Func.toJson(reportDownDto);
ReportDownScanFileDto report = reportDownDto.getScanfiles().get(0);
log.info("[{}]调用下载服务,地址:{} 参数taskid={}", requestId, downUrl, report.getTaskid());
String respBody = post(downUrl, requestParam);
log.info("[{}]调用下载服务成功,响应参数:{}", requestId, respBody);
return Func.readJson(respBody, CommonResult.class);
}
public String post(String url, String body) {
HttpRequest post = HttpUtil.createPost(url);
post.setConnectionTimeout(5 * 1000);
post.setReadTimeout(60 * 1000);
post.header("Content-Type", "application/json; charset=utf-8");
post.body(body);
HttpResponse response = post.execute();
return response.body();
}
}

@ -0,0 +1,48 @@
package com.docus.server.rpc.impl;
import cn.hutool.http.HttpUtil;
import com.docus.core.util.Func;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.config.DocusServerUrlConfig;
import com.docus.server.rpc.TaskDistributeService;
import com.docus.server.rpc.dto.ReportDownTwoDto;
import com.fasterxml.jackson.core.type.TypeReference;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
/**
*
*
* @author wyb
*/
@Component
@Slf4j
public class TaskDistributeServiceImpl implements TaskDistributeService {
@Resource
private DocusServerUrlConfig serverUrlConfig;
@Override
public CommonResult<ReportDownTwoDto> getNoViewTaskByCollectorId(String collectorId) {
String getTaskUrl = serverUrlConfig.getTaskDistributeServerUrl() + "api/noviewtask/GetTask?collectid=" + collectorId;
String result = HttpUtil.get(getTaskUrl);
return Func.readJson(result, new TypeReference<CommonResult<ReportDownTwoDto>>() {
});
}
@Override
public CommonResult<String> cancel(Long taskId) {
String taskCancelUrl = serverUrlConfig.getTaskDistributeServerUrl() + "api/collector/task/cancel";
Map<String, Object> param = new HashMap<>(1);
param.put("taskId", taskId);
log.info("任务作废 地址{},参数:{}", taskCancelUrl, param);
String resp = HttpUtil.post(taskCancelUrl, Func.toJson(param));
log.info("任务作废结果:{}", resp);
return Func.readJson(resp, new TypeReference<CommonResult<String>>() {
});
}
}

@ -0,0 +1,9 @@
package com.docus.server.sdry.collector;
/**
* @author YongBin Wen
* @date 2024/7/12 14:26
*/
public class CollectResult {
}

@ -0,0 +1,17 @@
package com.docus.server.sdry.collector;
import java.util.List;
/**
*
* @author YongBin Wen
* @date 2024/7/12 14:23
*/
public interface Collector<R extends CollectResult> {
/**
*
* @return
*/
List<R> collect();
}

@ -0,0 +1,38 @@
package com.docus.server.sdry.collector;
import lombok.Data;
import java.util.Date;
/**
* @author YongBin Wen
* @date 2024/7/12 14:26
*/
@Data
public class ShouMaCollectResult extends CollectResult {
/**
*
*/
private String fileNo;
/**
*
*/
private String inpatientNo;
/**
*
*/
private Integer admissTimes;
/**
*
*/
private String fileTitle;
/**
* http
*/
private String filePath;
/**
*
*/
private Date updateTime;
}

@ -0,0 +1,53 @@
package com.docus.server.sdry.collector;
import cn.hutool.core.util.StrUtil;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.exception.BaseException;
import com.docus.server.archive.dto.PatientInfoDto;
import com.docus.server.sdry.converter.ShouMaConverter;
import com.docus.server.sdry.entity.ShouMaView;
import com.docus.server.sdry.mapper.ShouMaViewMapper;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author YongBin Wen
* @date 2024/7/12 14:26
*/
public class ShouMaCollector implements Collector<ShouMaCollectResult> {
/**
* 访mapper
*/
private final ShouMaViewMapper shouMaViewMapper;
/**
*
*/
private final PatientInfoDto patientInfoDto;
/**
* 访
*/
private final String extraCondition;
public ShouMaCollector(ShouMaViewMapper shouMaViewMapper, PatientInfoDto patientInfoDto, String extraCondition) {
if (StrUtil.isBlank(patientInfoDto.getInpatientNo())) {
throw new BaseException("患者基础信息病案号不能为空!");
}
if (Func.isEmpty(patientInfoDto.getAdmissTimes())) {
throw new BaseException("患者基础信息住院次数不能为空!");
}
this.shouMaViewMapper = shouMaViewMapper;
this.patientInfoDto = patientInfoDto;
this.extraCondition = extraCondition;
}
@Override
public List<ShouMaCollectResult> collect() {
List<ShouMaView> patientShouMaViewDataList = shouMaViewMapper.getPatientShouMaView(patientInfoDto, extraCondition);
return patientShouMaViewDataList.stream().map(ShouMaConverter::convertResult).collect(Collectors.toList());
}
}

@ -0,0 +1,24 @@
package com.docus.server.sdry.converter;
import com.docus.server.sdry.collector.ShouMaCollectResult;
import com.docus.server.sdry.entity.ShouMaView;
/**
* @author YongBin Wen
* @date 2024/7/12 15:00
*/
public class ShouMaConverter {
public static ShouMaCollectResult convertResult(ShouMaView shouMaView) {
if (shouMaView == null) {
return null;
}
ShouMaCollectResult result = new ShouMaCollectResult();
result.setFileNo(shouMaView.getFID());
result.setInpatientNo(shouMaView.getFBIHID());
result.setAdmissTimes(shouMaView.getFBINCU());
result.setFileTitle(shouMaView.getPDESC());
result.setFilePath(shouMaView.getPDFPATH());
result.setUpdateTime(shouMaView.getFUPDATE());
return result;
}
}

@ -0,0 +1,40 @@
package com.docus.server.sdry.entity;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.Date;
/**
* @author YongBin Wen
* @date 2024/7/12 14:38
*/
@Data
@ApiModel("顺德人医提供的手麻视图数据")
public class ShouMaView {
/**
*
*/
private String FID;
/**
*
*/
private String FBIHID;
/**
*
*/
private Integer FBINCU;
/**
*
*/
private String PDESC;
/**
* http
*/
private String PDFPATH;
/**
*
*/
private Date FUPDATE;
}

@ -0,0 +1,98 @@
package com.docus.server.sdry.job;
import com.alibaba.fastjson.JSONObject;
import com.docus.core.util.Func;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.infrastructure.web.api.ResultCode;
import com.docus.server.archive.dto.PatientInfoDto;
import com.docus.server.archive.mapper.TBasicMapper;
import com.docus.server.rpc.DownPlatformService;
import com.docus.server.rpc.TaskDistributeService;
import com.docus.server.rpc.dto.*;
import com.docus.server.sdry.collector.ShouMaCollectResult;
import com.docus.server.sdry.collector.ShouMaCollector;
import com.docus.server.sdry.mapper.ShouMaViewMapper;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.List;
/**
* @author YongBin Wen
* @date 2024/7/12 15:22
*/
@Component
@Slf4j
public class CollectJob {
@Autowired
private DownPlatformService downPlatformService;
@Autowired
private TaskDistributeService taskDistributeService;
@Autowired
private TBasicMapper tBasicMapper;
@Autowired
private ShouMaViewMapper shouMaViewMapper;
@XxlJob("Sdry-ShouMa-Collect")
public void shouMaCollect() {
log.info(">>>>>>>>>>>>>>>>>>>>>> 顺德人医手麻视图采集任务开始!");
// 1.获取任务和患者信息 2.查询视图信息 3.上报下载
String jobParam = XxlJobHelper.getJobParam();
JSONObject jobParamJsonObject = JSONObject.parseObject(jobParam);
String assortId = jobParamJsonObject.getString("assortId");
String collectorId = jobParamJsonObject.getString("collectorId");
String extraCondition = jobParamJsonObject.getString("extraCondition");
if (Func.isBlank(assortId) || Func.isBlank(collectorId)) {
log.warn(">>>>>>>>>>>>>>>>>>>>>> 顺德人医手麻视图采集,未配置手麻采集器和采集文件分段");
return;
}
CommonResult<ReportDownTwoDto> commonResult = taskDistributeService.getNoViewTaskByCollectorId(collectorId);
if (ResultCode.SUCCESS.getCode().equals(commonResult.getCode())
&& commonResult.getData() != null) {
ReportDownTwoDto downTwoDto = commonResult.getData();
ReportTaskTwoDto task = downTwoDto.getTasks().get(0);
log.info("获取了任务:{}", Func.toJson(task));
ReportHospitalTwoDto hospitalTwoDto = downTwoDto.getHospitals().get(0);
ReportPatientTwoDto reportPatientTwoDto = downTwoDto.getPatient();
PatientInfoDto patientInfoDto = new PatientInfoDto();
patientInfoDto.setInpatientNo(reportPatientTwoDto.getInpatientNo());
patientInfoDto.setAdmissTimes(hospitalTwoDto.getAdmissTimes());
ShouMaCollector shouMaCollector = new ShouMaCollector(shouMaViewMapper, patientInfoDto, extraCondition);
List<ShouMaCollectResult> shouMaCollectResultList = shouMaCollector.collect();
int size = shouMaCollectResultList.size();
log.info("住院号:{},住院次数:{} 采集手麻数据:{} 条!", patientInfoDto.getInpatientNo(), patientInfoDto.getAdmissTimes(), size);
if (size <= 0) {
return;
}
ReportDownPatientDto patient = new ReportDownPatientDto();
patient.setPatientid(downTwoDto.getPatientId());
ReportDownDto reportDownDto = new ReportDownDto();
reportDownDto.setAssortid(assortId);
reportDownDto.setCollectorid(collectorId);
reportDownDto.setIp("");
reportDownDto.setPatient(patient);
for (ShouMaCollectResult result : shouMaCollectResultList) {
ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto();
reportDownScanFileDto.setDownurl(result.getFilePath());
reportDownScanFileDto.setFiletitle(result.getFileTitle());
reportDownScanFileDto.setSerialnum(result.getFileNo());
reportDownScanFileDto.setFilesource(1);
reportDownScanFileDto.setFiletype(1);
reportDownScanFileDto.setFilestoragetype(1);
reportDownScanFileDto.setTaskid(task.getTaskId());
List<ReportDownScanFileDto> scanFiles = Collections.singletonList(reportDownScanFileDto);
reportDownDto.setScanfiles(scanFiles);
downPlatformService.report(reportDownDto);
}
}
log.info(">>>>>>>>>>>>>>>>>>>>>> 顺德人医手麻视图采集任务结束!");
}
}

@ -0,0 +1,26 @@
package com.docus.server.sdry.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.docus.server.archive.dto.PatientInfoDto;
import com.docus.server.sdry.entity.ShouMaView;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author YongBin Wen
* @date 2024/7/12 14:37
*/
@DS("shouMa")
@Mapper
public interface ShouMaViewMapper {
/**
*
*
* @param patientInfoDto
* @param extraCondition sql
* @return
*/
List<ShouMaView> getPatientShouMaView(@Param("patient") PatientInfoDto patientInfoDto, @Param("ext") String extraCondition);
}

@ -0,0 +1,33 @@
@echo off
for /f "delims=" %%t in ('winsw.exe status') do set str=%%t
echo %str%
if %str%==Started (
echo "restart....."
winsw stop
PING 127.0.0.1 -n 10 -w 30000 >NUL
winsw start
)
if %str%==Stopped (
echo "start....."
winsw start
)
if %str%==NonExistent (
echo "deploy and start....."
winsw install
winsw start
echo c
)

@ -0,0 +1,21 @@
set java_opts=-Xms512m -Xmx512m
set key="java_opts"
rem 文件不存在,就跳过
if not exist java-ops.ini goto end
for /f "tokens=1,2 delims==" %%i in (java-ops.ini) do (
if "%%i"==%key% set java_opts=%%j)
echo java_opts is : %java_opts%
:end
rem 启动java
java %java_opts% -Dfile.encoding=utf-8 -jar -Dspring.profiles.active=@profile.name@ -Dloader.path=config,lib @project.build.finalName@.jar

@ -0,0 +1,13 @@
@echo off
for /f "delims=" %%t in ('winsw.exe status') do set str=%%t
echo %str%
if %str%==Started (
winsw stop
@echo wait program stop .....
PING 127.0.0.1 -n 30 -w 10000 >NUL
)

@ -0,0 +1,19 @@
@echo off
set deployDir=%1\docus-collect-file-data
if %deployDir%=="" set deployDir=d:\webroot\docus-collect-file-data
set curr_file=%cd%
cd /d %deployDir%
call stop.bat
cd %curr_file%
sc query docus-backup-sys |Find "RUNNING" && ping 127.0.0.1 -n 10 >nul
rd/s/q %deployDir%\lib
rd/s/q %deployDir%\dataConfig
rd/s/q %deployDir%\config
del /s/q %deployDir%\*.jar
xcopy /Y/E/I * %deployDir%
cd /d %deployDir%
call install.bat

@ -0,0 +1,8 @@
<service>
<id>docus-collect-file-data</id>
<name>生产-嘉时-文件数据采集服务</name>
<description>生产-嘉时-文件数据采集服务</description>
<startmode>Automatic</startmode>
<executable>%BASE%\start.bat</executable>
<log mode="none"></log>
</service>

@ -0,0 +1,111 @@
server:
port: 9010
spring:
application:
name: @artifactId@
profiles:
active: prod
datasource:
dynamic:
primary: master #设置默认的数据源默认值为master
strict: false #是否用严格模式,如果启用在味匹配到指定数据源时抛出异常
datasource:
master:
url: jdbc:log4jdbc:mysql://db.docus.cn:3306/docus_medicalrecord?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: docus
password: docus702
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
# 初始化配置
initial-size: 3
# 最小连接数
min-idle: 3
# 最大连接数
max-active: 15
# 获取连接超 时时间
max-wait: 5000
# 连接有效性检测时间
time-between-eviction-runs-millis: 90000
# 最大空闲时间
min-evictable-idle-time-millis: 1800000
test-while-idle: true
test-on-borrow: false
test-on-return: false
validation-query: select 1
shouMa:
url: jdbc:log4jdbc:mysql://192.168.8.108:3306/lancet-aims?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: wzh
password: wzh
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
# 初始化配置
initial-size: 3
# 最小连接数
min-idle: 3
# 最大连接数
max-active: 10
# 获取连接超 时时间
max-wait: 5000
# 连接有效性检测时间
time-between-eviction-runs-millis: 90000
# 最大空闲时间
min-evictable-idle-time-millis: 1800000
test-while-idle: true
test-on-borrow: false
test-on-return: false
validation-query: select 1 from dual
redis:
host: redis.docus.cn
password: JSdocus@702
cloud:
nacos:
discovery:
server-addr: nacos.docus.cn
namespace: 34acdf7a-9fc6-4bbd-8aea-9a47c8007ad5
config:
server-addr: ${spring.cloud.nacos.discovery.server-addr}
namespace: 34acdf7a-9fc6-4bbd-8aea-9a47c8007ad5
file-extension: yml
shared-configs:
- comm.${spring.cloud.nacos.config.file-extension}
docus:
sync-service-prefix: ZqDyRy
default-user-pwd: fd29cd53ec12616e5f36b77d4afffbff
url:
# 采集任务补偿地址
viewcollect-server: http://localhost:9295/
# 报告上报地址
downploadlatform-server: http://localhost:9291/
# 获取无视图模式采集任务地址
taskdistribute-server: http://localhost:9296/
dbtype: mysql
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
xxl:
job:
accessToken:
admin:
addresses: http://job.docus.cn:8180/xxl-job-admin
executor:
appname: docus-collect-file-data
address:
ip:
port: 19000
logretentiondays: 30
logpath: D:/xxl-job/docus-collect-file-data

@ -0,0 +1,2 @@
# If you use SLF4J. First, you need to tell log4jdbc-log4j2 that you want to use the SLF4J logger
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="true" scanPeriod="1 seconds">
<contextName>docus-collect-file-data</contextName>
<property name="log.path" value="logs/logback"/>
<appender name="console" 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>
</encoder>
</appender>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<!-- 指定日志输出格式 -->
<pattern>[%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%X{traceId}] [%L] [%-5p] %m%n</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 指定收集策略:滚动策略-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--指定生成日志保存地址 -->
<fileNamePattern>${log.path}%d.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>500MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<MaxHistory>30</MaxHistory>
</rollingPolicy>
</appender>
<springProfile name="dev">
<root level="debug">
<appender-ref ref="console"/>
</root>
</springProfile>
<springProfile name="test|prod">
<root level="INFO">
<appender-ref ref="file"/>
<appender-ref ref="console"/>
</root>
</springProfile>
<!-- 监控sql日志输出-->
<!-- 如想看到表格数据将OFF改为INFO -->
<logger name="jdbc.resultsettable" level="OFF" additivity="false">
<appender-ref ref="console"/>
</logger>
<!-- 包含 SQL 语句实际的执行时间 及sql语句与jdbc.sqlonly功能重复 -->
<logger name="jdbc.sqltiming" level="OFF" additivity="false">
<appender-ref ref="file"/>
</logger>
<!-- 仅仅记录 SQL 语句,会将占位符替换为实际的参数-->
<logger name="jdbc.sqlonly" level="OFF" additivity="false">
<appender-ref ref="console"/>
</logger>
<!-- 包含 ResultSet 的信息,输出篇幅较长 -->
<logger name="jdbc.resultset" level="OFF" additivity="false">
<appender-ref ref="console"/>
</logger>
<!-- 输出了 Connection 的 open、close 等信息 -->
<logger name="jdbc.connection" level="OFF" additivity="false">
<appender-ref ref="console"/>
</logger>
<!-- 除了 ResultSet 之外的所有JDBC调用信息篇幅较长 -->
<logger name="jdbc.audit" level="OFF" additivity="false">
<appender-ref ref="console"/>
</logger>
</configuration>

@ -0,0 +1,20 @@
<?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.server.sdry.mapper.ShouMaViewMapper">
<select id="getPatientShouMaView" resultType="com.docus.server.sdry.entity.ShouMaView">
SELECT FID,FBIHID,FBINCU,PDESC,PDFPATH,FUPDATE FROM(
select FID,FBIHID,FBINCU,PDESC,PDFPATH,FUPDATE from t_itf_dcsm_1 where FBIHID=#{patient.inpatientNo} and FBINCU=#{patient.admissTimes}
union all
select FID,FBIHID,FBINCU,PDESC,PDFPATH,FUPDATE from t_itf_dcsm_2 where FBIHID=#{patient.inpatientNo} and FBINCU=#{patient.admissTimes}
union all
select FID,FBIHID,FBINCU,PDESC,PDFPATH,FUPDATE from t_itf_dcsm_3 where FBIHID=#{patient.inpatientNo} and FBINCU=#{patient.admissTimes}
) T
WHERE 1=1
<if test="ext != null and ext != ''">
${ext}
</if>
</select>
</mapper>

@ -0,0 +1,7 @@
<?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.server.archive.mapper.TBasicMapper">
</mapper>

Binary file not shown.

@ -0,0 +1,2 @@
##2024-7-12 16:07:51 顺德人医开发手麻采集器视图采集
#### 调度采用XXL-JOBSdry-ShouMa-Collect配置参数有采集器类型collectorId文件分段assortId和额外的sql条件and开头extraCondition`{"assortId":"RC0ZZ3WI3FTMLNM7BWNXGN6D1KWNR6W1","collectorId":"5","extraCondition":" AND PDESC!='麻醉小结' AND PDESC!='手术器械清点单' AND PDESC!='麻醉知情同意书' AND PDESC!='手术安全核查单' AND PDESC!='复苏后交接记录' "}`
Loading…
Cancel
Save