commit 173b598e9accfe9b4428f5761a44860754805ef1
Author: wyb <1977763549@qq.com>
Date: Tue Apr 9 15:00:14 2024 +0800
feat:农垦同步转科信息
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6a8a1e4
--- /dev/null
+++ b/.gitignore
@@ -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*
\ No newline at end of file
diff --git a/assembly.xml b/assembly.xml
new file mode 100644
index 0000000..b6fb827
--- /dev/null
+++ b/assembly.xml
@@ -0,0 +1,73 @@
+
+
+ exe
+
+ dir
+
+ false
+
+
+
+
+ /lib
+ ${basedir}/target/lib
+
+
+
+ /config
+ ${basedir}/target/resources
+ 0755
+
+ *.xml
+ *.yml
+ *.properties
+
+
+
+
+ /dataConfig
+ ${basedir}/target/dataConfig
+ 0755
+
+ *.json
+
+
+
+
+ /
+ ${basedir}/target/resources/bin
+ 0755
+
+ *.bat
+
+
+
+
+ /
+ ${basedir}/target/resources/bin
+ 0755
+
+ *.xml
+
+
+
+
+ /
+ ${basedir}
+ 0755
+
+ *.exe
+
+
+
+
+ ${basedir}/target
+ /
+ 0755
+
+ ${project.build.finalName}.jar
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..ccd74a2
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,369 @@
+
+
+
+ com.docus
+ docus-bom
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ docus-collect-nkzxyy
+
+
+
+ com.docus
+ docus-knife4j-starter
+
+
+
+ com.belerweb
+ pinyin4j
+ 2.5.1
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-config
+
+
+ checker-qual
+ org.checkerframework
+
+
+ error_prone_annotations
+ com.google.errorprone
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ 3.4.0
+
+
+ com.baomidou
+ dynamic-datasource-spring-boot-starter
+ 3.4.0
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+ HdrHistogram
+ org.hdrhistogram
+
+
+ jsr305
+ com.google.code.findbugs
+
+
+
+
+ mysql
+ mysql-connector-java
+ 8.0.28
+
+
+ org.projectlombok
+ lombok
+ 1.18.16
+ compile
+
+
+ org.projectlombok
+ lombok
+ 1.18.16
+ compile
+
+
+ org.bgee.log4jdbc-log4j2
+ log4jdbc-log4j2-jdbc4.1
+
+
+ com.alibaba
+ druid
+ 1.2.4
+ compile
+
+
+ com.baomidou
+ mybatis-plus-generator
+ 3.4.1
+ compile
+
+
+ org.apache.velocity
+ velocity-engine-core
+ 2.0
+
+
+ com.xuxueli
+ xxl-job-core
+
+
+ com.docus
+ docus-base-starter
+
+
+ knife4j-spring-boot-autoconfigure
+ com.github.xiaoymin
+
+
+
+
+
+ com.docus
+ docus-tool-starter
+
+
+
+ com.docus
+ docus-shiro-starter
+
+
+
+ com.docus
+ docus-base-starter
+
+
+ springfox-core
+ io.springfox
+
+
+ springfox-schema
+ io.springfox
+
+
+ springfox-spi
+ io.springfox
+
+
+ knife4j-spring-boot-autoconfigure
+ com.github.xiaoymin
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-netflix-hystrix
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-openfeign
+
+
+ junit
+ junit
+ test
+
+
+
+
+ com.microsoft.sqlserver
+ sqljdbc4
+ 4.0
+
+
+
+
+ com.oracle
+ ojdbc6
+ 11.2.0.4.0
+
+
+
+
+
+ org.apache.cxf
+ cxf-spring-boot-starter-jaxws
+ 3.3.4
+
+
+
+ org.dom4j
+ dom4j
+ 2.1.1
+
+
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ 2.4.4
+
+ ZIP
+
+
+ non-exists
+ non-exists
+
+
+
+
+
+
+ repackage
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy-dependencies
+ package
+
+ copy-dependencies
+
+
+
+ target/lib
+ false
+ false
+ runtime
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 3.2.0
+
+
+ copy-resources
+ package
+
+ copy-resources
+
+
+
+
+ src/main/resources
+
+ **/*.*
+
+
+
+ ${project.build.directory}/resources
+
+
+
+ copy-bin
+ package
+
+ copy-resources
+
+
+
+
+ src/main/resources
+ true
+
+ bin/*.xml
+ *.yml
+ bin/*.bat
+
+
+
+ ${project.build.directory}/resources
+
+
+
+ copy-data-config
+ package
+
+ copy-resources
+
+
+
+
+ ../../dataConfig
+ true
+
+
+ ${project.build.directory}/dataConfig
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.2.0
+
+
+ **/*.yml
+
+
+
+
+
+ maven-assembly-plugin
+
+
+
+ ${project.artifactId}
+ false
+
+ assembly.xml
+
+
+ make-assembly
+ package
+
+ single
+
+
+
+
+
+
+
+
+
+
+ dev
+
+ prod
+
+
+ true
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/docus/server/AppRunBootstrap.java b/src/main/java/com/docus/server/AppRunBootstrap.java
new file mode 100644
index 0000000..7927986
--- /dev/null
+++ b/src/main/java/com/docus/server/AppRunBootstrap.java
@@ -0,0 +1,29 @@
+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);
+ }
+
+}
diff --git a/src/main/java/com/docus/server/XxlJobConfig.java b/src/main/java/com/docus/server/XxlJobConfig.java
new file mode 100644
index 0000000..d9edbfa
--- /dev/null
+++ b/src/main/java/com/docus/server/XxlJobConfig.java
@@ -0,0 +1,87 @@
+package com.docus.server;
+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、引入依赖:
+ *
+ * org.springframework.cloud
+ * spring-cloud-commons
+ * ${version}
+ *
+ *
+ * 2、配置文件,或者容器启动变量
+ * spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
+ *
+ * 3、获取IP
+ * String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
+ *//*
+
+*/
+}
diff --git a/src/main/java/com/docus/server/archive/entity/TBasic.java b/src/main/java/com/docus/server/archive/entity/TBasic.java
new file mode 100644
index 0000000..593c0da
--- /dev/null
+++ b/src/main/java/com/docus/server/archive/entity/TBasic.java
@@ -0,0 +1,68 @@
+package com.docus.server.archive.entity;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *
+ * 病案基本信息
+ *
+ *
+ * @author jiashi
+ * @since 2021-04-14
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value = "TBasic对象", description = "病案基本信息")
+public class TBasic implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "病案主键")
+ private String patientId;
+
+ @ApiModelProperty(value = "记账号")
+ private String jzh;
+
+ @ApiModelProperty(value = "病案号")
+ private String inpatientNo;
+
+ @ApiModelProperty(value = "住院次数")
+ private Integer admissTimes;
+
+ @ApiModelProperty(value = "患者姓名")
+ private String name;
+
+
+ @ApiModelProperty(value = "住院日期")
+ private Date admissDate;
+
+ @ApiModelProperty(value = "住院科室")
+ private String admissDept;
+
+ @ApiModelProperty(value = "住院科室名称")
+ private String admissDeptName;
+
+
+ @ApiModelProperty(value = "主管医生工号")
+ private String attending;
+
+ @ApiModelProperty(value = "主管医生姓名")
+ private String attendingName;
+
+
+ @ApiModelProperty(value = "出院日期")
+ private Date disDate;
+
+ @ApiModelProperty(value = "出院科室")
+ private String disDept;
+
+ @ApiModelProperty(value = "出院科室名称")
+ private String disDeptName;
+
+}
diff --git a/src/main/java/com/docus/server/archive/entity/TBasicZkInfo.java b/src/main/java/com/docus/server/archive/entity/TBasicZkInfo.java
new file mode 100644
index 0000000..bd1941e
--- /dev/null
+++ b/src/main/java/com/docus/server/archive/entity/TBasicZkInfo.java
@@ -0,0 +1,47 @@
+package com.docus.server.archive.entity;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 转科信息
+ *
+ * @author YongBin Wen
+ * @date 2024/4/9 13:53
+ */
+@Data
+public class TBasicZkInfo {
+ /**
+ * 主键
+ **/
+ private Long id;
+ /**
+ * 病案主键
+ **/
+ private String patientId;
+ /**
+ * 转出科室编号
+ **/
+ private String outDeptCode;
+ /**
+ * 转出科室名称
+ **/
+ private String outDeptName;
+ /**
+ * 转出日期
+ **/
+ private Date outDate;
+ /**
+ * 转入科室编号
+ **/
+ private String inDeptCode;
+ /**
+ * 转入科室名称
+ **/
+ private String inDeptName;
+ /**
+ * 数据创建时间
+ **/
+ private Date createTime;
+}
diff --git a/src/main/java/com/docus/server/archive/job/SyncZkInfoJob.java b/src/main/java/com/docus/server/archive/job/SyncZkInfoJob.java
new file mode 100644
index 0000000..1c37b4f
--- /dev/null
+++ b/src/main/java/com/docus/server/archive/job/SyncZkInfoJob.java
@@ -0,0 +1,114 @@
+package com.docus.server.archive.job;
+
+import com.docus.core.util.Func;
+import com.docus.infrastructure.core.utils.TableJsonRead;
+import com.docus.server.archive.service.ZkInfoSyncService;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.util.Objects;
+
+/**
+ * @author YongBin Wen
+ * @date 2024/4/9 14:07
+ */
+@Component
+@Slf4j
+public class SyncZkInfoJob {
+
+ @Resource
+ private ZkInfoSyncService zkInfoSyncService;
+
+ /**
+ * 农垦转科信息同步,默认同步当天和前面一天的和所有出院的
+ *
+ * @date 2024/3/27 16:27
+ * @author YongBin Wen
+ */
+ @XxlJob("NkZkInfoSyncJob")
+ public void nkZkInfoSyncJob() {
+ log.info("====================> 农垦转科信息同步任务开始 ===================");
+ try {
+ nkZkInfoSync();
+ } catch (Exception e) {
+ log.error("====================> 农垦转科信息同步任务出错啦!===================" + e.getMessage(), e);
+ return;
+ }
+ log.info("====================> 农垦转科信息同步任务结束 ===================");
+ }
+
+ private void nkZkInfoSync() {
+ String jobConfigPath = "data-config\\job-config";
+ String jobConfigName = "NkZkInfoSyncJob.json";
+ TableJsonRead jsonReader = new TableJsonRead();
+ NkZkInfoSyncJobConfig syncJobConfig = jsonReader.Read(jobConfigPath, jobConfigName, NkZkInfoSyncJobConfig.class);
+ syncJobConfig = NkZkInfoSyncJobConfig.checkAndInit(syncJobConfig);
+ Integer pageSize = syncJobConfig.getPageSize();
+ Integer pageNumber = syncJobConfig.getPageNumber();
+ String startDate = syncJobConfig.getStartDate();
+ LocalDate runLocalDate = LocalDate.now();
+ String runJobDate = runLocalDate.toString();
+
+ while (true) {
+ int syncCount = zkInfoSyncService.syncZkInfo(startDate + " 00:00:00", runJobDate + " 23:59:59", pageNumber, pageSize);
+ if (syncCount < pageSize) {
+ break;
+ }
+ pageNumber += 1;
+ }
+ // 下次同步则开始多同步一天,防止时间差引起同步缺漏
+ String nexRunStartDate = runLocalDate.plusDays(-1).toString();
+ syncJobConfig.setPageNumber(1);
+ syncJobConfig.setStartDate(nexRunStartDate);
+ jsonReader.Save(jobConfigPath, jobConfigName, Func.toJson(syncJobConfig));
+ }
+
+ private static class NkZkInfoSyncJobConfig {
+ private String startDate;
+ private Integer pageNumber;
+ private Integer pageSize;
+
+ public static NkZkInfoSyncJobConfig checkAndInit(NkZkInfoSyncJobConfig jobConfig) {
+ if (Objects.isNull(jobConfig)) {
+ jobConfig = new NkZkInfoSyncJobConfig();
+ }
+ if (Objects.isNull(jobConfig.getPageNumber()) || jobConfig.getPageNumber() <= 0) {
+ jobConfig.setPageNumber(1);
+ }
+ if (Objects.isNull(jobConfig.getPageSize()) || jobConfig.getPageSize() <= 0) {
+ jobConfig.setPageSize(100);
+ }
+ if (Objects.isNull(jobConfig.getStartDate())) {
+ jobConfig.setStartDate(LocalDate.now().toString());
+ }
+ return jobConfig;
+ }
+
+ public String getStartDate() {
+ return startDate;
+ }
+
+ public void setStartDate(String startDate) {
+ this.startDate = startDate;
+ }
+
+ public Integer getPageNumber() {
+ return pageNumber;
+ }
+
+ public void setPageNumber(Integer pageNumber) {
+ this.pageNumber = pageNumber;
+ }
+
+ public Integer getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(Integer pageSize) {
+ this.pageSize = pageSize;
+ }
+ }
+}
diff --git a/src/main/java/com/docus/server/archive/mapper/TBasicMapper.java b/src/main/java/com/docus/server/archive/mapper/TBasicMapper.java
new file mode 100644
index 0000000..aed0c29
--- /dev/null
+++ b/src/main/java/com/docus/server/archive/mapper/TBasicMapper.java
@@ -0,0 +1,15 @@
+package com.docus.server.archive.mapper;
+
+
+import com.docus.server.archive.entity.TBasic;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface TBasicMapper {
+
+
+ List getByDisDate(@Param("disDateStart") String disDateStart, @Param("disDateEnd") String disDateEnd, @Param("offset") int offset, @Param("size") int size);
+}
diff --git a/src/main/java/com/docus/server/archive/mapper/TBasicZkInfoMapper.java b/src/main/java/com/docus/server/archive/mapper/TBasicZkInfoMapper.java
new file mode 100644
index 0000000..5faaf2b
--- /dev/null
+++ b/src/main/java/com/docus/server/archive/mapper/TBasicZkInfoMapper.java
@@ -0,0 +1,23 @@
+package com.docus.server.archive.mapper;
+
+import com.docus.server.archive.entity.TBasicZkInfo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 转科信息
+ *
+ * @author YongBin Wen
+ * @date 2024/4/9 13:53
+ */
+@Mapper
+public interface TBasicZkInfoMapper {
+
+ int deleteByPatientIds(@Param("patientIds") List patientIds);
+
+ int saveBatch(@Param("zkInfos") List zkInfos);
+
+ List existsZkInfoPatientIds(@Param("patientIds") List patientIds);
+}
diff --git a/src/main/java/com/docus/server/archive/service/ZkInfoSyncService.java b/src/main/java/com/docus/server/archive/service/ZkInfoSyncService.java
new file mode 100644
index 0000000..9b04992
--- /dev/null
+++ b/src/main/java/com/docus/server/archive/service/ZkInfoSyncService.java
@@ -0,0 +1,9 @@
+package com.docus.server.archive.service;
+
+/**
+ * @author YongBin Wen
+ * @date 2024/4/9 14:16
+ */
+public interface ZkInfoSyncService {
+ int syncZkInfo(String disDateStart, String disDateEnd, Integer pageNumber, Integer pageSize);
+}
diff --git a/src/main/java/com/docus/server/archive/service/impl/ZkInfoSyncServiceImpl.java b/src/main/java/com/docus/server/archive/service/impl/ZkInfoSyncServiceImpl.java
new file mode 100644
index 0000000..dedb9a2
--- /dev/null
+++ b/src/main/java/com/docus/server/archive/service/impl/ZkInfoSyncServiceImpl.java
@@ -0,0 +1,79 @@
+package com.docus.server.archive.service.impl;
+
+import com.docus.core.util.Func;
+import com.docus.infrastructure.redis.service.IdService;
+import com.docus.server.archive.entity.TBasic;
+import com.docus.server.archive.entity.TBasicZkInfo;
+import com.docus.server.archive.mapper.TBasicMapper;
+import com.docus.server.archive.mapper.TBasicZkInfoMapper;
+import com.docus.server.archive.service.ZkInfoSyncService;
+import com.docus.server.his.entity.VJswzhZkxx;
+import com.docus.server.his.mapper.VJswzhZkxxMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author YongBin Wen
+ * @date 2024/4/9 14:16
+ */
+@Service
+@Slf4j
+public class ZkInfoSyncServiceImpl implements ZkInfoSyncService {
+ @Resource
+ private VJswzhZkxxMapper vJswzhZkxxMapper;
+ @Resource
+ private TBasicMapper tBasicMapper;
+ @Resource
+ private TBasicZkInfoMapper tBasicZkInfoMapper;
+ @Resource
+ private IdService idService;
+
+ @Override
+ public int syncZkInfo(String disDateStart, String disDateEnd, Integer pageNumber, Integer pageSize) {
+ Date nowDate = new Date();
+ int offset = (pageNumber - 1) * pageSize;
+ List basicList = tBasicMapper.getByDisDate(disDateStart, disDateEnd, offset, pageSize);
+ if (Func.isEmpty(basicList)) {
+ return 0;
+ }
+ int querySize = basicList.size();
+ basicList = basicList.stream().filter(e -> Func.isNotBlank(e.getJzh())).collect(Collectors.toList());
+ if (Func.isEmpty(basicList)) {
+ return querySize;
+ }
+ List jzhs = basicList.stream().map(TBasic::getJzh).collect(Collectors.toList());
+ List patientIds = basicList.stream().map(TBasic::getPatientId).collect(Collectors.toList());
+ Map basicJzhPidMap = basicList.stream().collect(Collectors.toMap(TBasic::getJzh, TBasic::getPatientId));
+ List zkxxList = vJswzhZkxxMapper.getZkInfoByJzhs(jzhs);
+ if (Func.isNotEmpty(zkxxList)) {
+ List zkInfos = new ArrayList<>();
+ for (VJswzhZkxx vJswzhZkxx : zkxxList) {
+ TBasicZkInfo zkInfo = new TBasicZkInfo();
+ zkInfo.setId(idService.getDateSeq());
+ zkInfo.setPatientId(basicJzhPidMap.get(vJswzhZkxx.getJzh()));
+ zkInfo.setOutDeptCode(vJswzhZkxx.getZcbq());
+ zkInfo.setOutDeptName(vJswzhZkxx.getZcks());
+ zkInfo.setInDeptCode(vJswzhZkxx.getZrbq());
+ zkInfo.setInDeptName(vJswzhZkxx.getZrks());
+ zkInfo.setOutDate(vJswzhZkxx.getZcrq());
+ zkInfo.setCreateTime(nowDate);
+ zkInfos.add(zkInfo);
+ }
+ // 根据病案主键查询已经同步的转科信息,未同步的插入
+ List existsZkInfoPatientIds = tBasicZkInfoMapper.existsZkInfoPatientIds(patientIds);
+ zkInfos = zkInfos.stream().filter(zk -> !existsZkInfoPatientIds.contains(zk.getPatientId())).collect(Collectors.toList());
+ if (Func.isNotEmpty(zkInfos)) {
+ tBasicZkInfoMapper.saveBatch(zkInfos);
+ }
+ log.info("出院日期范围:{} - {} ,页码:{} size:{},查询:{}基础数据,本次新增转科信息数据:{} 条", disDateStart, disDateEnd, pageNumber, pageSize, basicList.size(), zkInfos.size());
+ }
+ return querySize;
+ }
+}
diff --git a/src/main/java/com/docus/server/his/entity/VJswzhZkxx.java b/src/main/java/com/docus/server/his/entity/VJswzhZkxx.java
new file mode 100644
index 0000000..4e57cd3
--- /dev/null
+++ b/src/main/java/com/docus/server/his/entity/VJswzhZkxx.java
@@ -0,0 +1,39 @@
+package com.docus.server.his.entity;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 嘉时无纸化转科信息视图
+ *
+ * @author YongBin Wen
+ * @date 2024/4/9 13:46
+ */
+@Data
+public class VJswzhZkxx {
+ /**
+ * 记账号
+ */
+ private String jzh;
+ /**
+ * 转出病区编号
+ */
+ private String zcbq;
+ /**
+ * 转出科室名称
+ */
+ private String zcks;
+ /**
+ * 转出时间
+ */
+ private Date zcrq;
+ /**
+ * 转入病区编号
+ */
+ private String zrbq;
+ /**
+ * 转入科室名称
+ */
+ private String zrks;
+}
diff --git a/src/main/java/com/docus/server/his/mapper/VJswzhZkxxMapper.java b/src/main/java/com/docus/server/his/mapper/VJswzhZkxxMapper.java
new file mode 100644
index 0000000..ef7b755
--- /dev/null
+++ b/src/main/java/com/docus/server/his/mapper/VJswzhZkxxMapper.java
@@ -0,0 +1,19 @@
+package com.docus.server.his.mapper;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.docus.server.his.entity.VJswzhZkxx;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 嘉时无纸化转科信息视图
+ * @author YongBin Wen
+ * @date 2024/4/9 13:46
+ */
+@DS("his")
+@Mapper
+public interface VJswzhZkxxMapper {
+ List getZkInfoByJzhs(@Param("jzhs") List jzhs);
+}
diff --git a/src/main/resources/bin/install.bat b/src/main/resources/bin/install.bat
new file mode 100644
index 0000000..7a651bc
--- /dev/null
+++ b/src/main/resources/bin/install.bat
@@ -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
+)
+
+
+
+
+
diff --git a/src/main/resources/bin/start.bat b/src/main/resources/bin/start.bat
new file mode 100644
index 0000000..58c25cb
--- /dev/null
+++ b/src/main/resources/bin/start.bat
@@ -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
+
+
+
+
+
diff --git a/src/main/resources/bin/stop.bat b/src/main/resources/bin/stop.bat
new file mode 100644
index 0000000..98468a0
--- /dev/null
+++ b/src/main/resources/bin/stop.bat
@@ -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
+)
+
diff --git a/src/main/resources/bin/update.bat b/src/main/resources/bin/update.bat
new file mode 100644
index 0000000..cb65ef0
--- /dev/null
+++ b/src/main/resources/bin/update.bat
@@ -0,0 +1,19 @@
+@echo off
+
+set deployDir=%1\docus-collect-nkzxyy
+if %deployDir%=="" set deployDir=d:\webroot\docus-collect-nkzxyy
+
+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
+
diff --git a/src/main/resources/bin/winsw.xml b/src/main/resources/bin/winsw.xml
new file mode 100644
index 0000000..b574359
--- /dev/null
+++ b/src/main/resources/bin/winsw.xml
@@ -0,0 +1,8 @@
+
+ docus-collect-nkzxyy
+ 生产-嘉时-佛山三院采集服务
+ 生产-嘉时-佛山三院采集服务
+ Automatic
+ %BASE%\start.bat
+
+
\ No newline at end of file
diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml
new file mode 100644
index 0000000..55e7ed8
--- /dev/null
+++ b/src/main/resources/bootstrap.yml
@@ -0,0 +1,113 @@
+server:
+ port: 9314
+
+spring:
+ application:
+ name: @artifactId@
+ profiles:
+ active: test
+ 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
+ his:
+ url: jdbc:oracle:thin:@//192.168.0.40:1521/his
+ username: his_wzh
+ password: His@2022Wzh
+ driver-class-name: oracle.jdbc.driver.OracleDriver
+ 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 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}
+
+fsy:
+ lis:
+ ws-url: http://10.100.23.96:8095/DCLService.asmx
+ sysflag: 6
+ assortid: 1213131
+
+docus:
+ 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-nkzxyy
+ address:
+ ip:
+ port: 19314
+ logretentiondays: 30
+ logpath: D:/xxl-job/docus-collect-nkzxyy
+
+
diff --git a/src/main/resources/log4jdbc.log4j2.properties b/src/main/resources/log4jdbc.log4j2.properties
new file mode 100644
index 0000000..5cb6f99
--- /dev/null
+++ b/src/main/resources/log4jdbc.log4j2.properties
@@ -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
\ No newline at end of file
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
new file mode 100644
index 0000000..147de27
--- /dev/null
+++ b/src/main/resources/logback.xml
@@ -0,0 +1,77 @@
+
+
+ docus-collect-nkzxyy
+
+
+
+
+ [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%contextName] [%thread] [%X{traceId}] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+ [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%X{traceId}] [%L] [%-5p] %m%n
+ utf-8
+
+
+
+
+ ${log.path}%d.%i.log
+
+ 500MB
+
+ 30
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/mapper/TBasicMapper.xml b/src/main/resources/mapper/TBasicMapper.xml
new file mode 100644
index 0000000..a35f7fe
--- /dev/null
+++ b/src/main/resources/mapper/TBasicMapper.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
diff --git a/src/main/resources/mapper/TBasicZkInfoMapper.xml b/src/main/resources/mapper/TBasicZkInfoMapper.xml
new file mode 100644
index 0000000..928005b
--- /dev/null
+++ b/src/main/resources/mapper/TBasicZkInfoMapper.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+ INSERT INTO `docus_medicalrecord`.`t_basic_zk_info`
+ (`id`, `patient_id`, `out_dept_code`, `out_dept_name`, `out_date`, `in_dept_code`, `in_dept_name`, `create_time`) VALUES
+
+ (
+ #{zkInfo.id},#{zkInfo.patientId},#{zkInfo.outDeptCode},#{zkInfo.outDate},#{zkInfo.outDate},
+ #{zkInfo.inDeptCode},#{zkInfo.inDeptName},#{zkInfo.createTime}
+ )
+
+
+
+
+ delete from docus_medicalrecord.t_basic_zk_info
+ where patient_id in
+ #{patientId}
+
+
+
+
diff --git a/src/main/resources/mapper/VJswzhZkxxMapper.xml b/src/main/resources/mapper/VJswzhZkxxMapper.xml
new file mode 100644
index 0000000..eb1533a
--- /dev/null
+++ b/src/main/resources/mapper/VJswzhZkxxMapper.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
diff --git a/winsw.exe b/winsw.exe
new file mode 100644
index 0000000..ba27e3f
Binary files /dev/null and b/winsw.exe differ