diff --git a/pom.xml b/pom.xml
index ecd2609..9b51677 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,75 +6,82 @@
org.springframework.boot
spring-boot-starter-parent
2.1.1.RELEASE
-
- com.shibofu.spring
- ECG
+
+ com.example
+ LZ-scan
0.0.1-SNAPSHOT
jar
demo
Demo project for Spring Boot
-
1.8
-
-
-
-
- net.java.dev.jna
- jna
- 5.13.0
-
-
-
- net.java.dev.jna
- jna-platform
- 5.13.0
-
-
-
+
+
+ net.java.dev.jna
+ jna
+ 5.13.0
+
+
+ net.java.dev.jna
+ jna-platform
+ 5.13.0
+
+
+
+ com.oracle.database.jdbc
+ ojdbc6
+ 11.2.0.4
+
+
+
+ io.springfox
+ springfox-swagger2
+ 2.9.2
+
+
+
+ io.springfox
+ springfox-swagger-ui
+ 2.9.2
+
+
+
+ org.apache.pdfbox
+ pdfbox
+ 2.0.27
+
+
+ org.apache.commons
+ commons-collections4
+ 4.4
+
org.springframework.boot
spring-boot-starter-web
-
org.springframework.boot
spring-boot-starter-test
test
-
-
-
com.baomidou
mybatis-plus-boot-starter
3.3.1
-
-
-
- mysql
- mysql-connector-java
- runtime
-
-
-
-
org.projectlombok
lombok
true
-
org.springframework.boot
spring-boot-starter-quartz
-
-
+
com.microsoft.sqlserver
sqljdbc4
@@ -92,16 +99,12 @@
org.springframework.boot
spring-boot-test
-
-
commons-io
commons-io
2.6
-
-
@@ -110,6 +113,4 @@
-
-
diff --git a/src/main/java/com/shibofu/spring/MainApplication.java b/src/main/java/com/example/MainApplication.java
similarity index 92%
rename from src/main/java/com/shibofu/spring/MainApplication.java
rename to src/main/java/com/example/MainApplication.java
index 0345364..244a6b2 100644
--- a/src/main/java/com/shibofu/spring/MainApplication.java
+++ b/src/main/java/com/example/MainApplication.java
@@ -1,4 +1,4 @@
-package com.shibofu.spring;
+package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/src/main/java/com/shibofu/spring/config/DataSource2Config.java b/src/main/java/com/example/config/DataSource2Config.java
similarity index 90%
rename from src/main/java/com/shibofu/spring/config/DataSource2Config.java
rename to src/main/java/com/example/config/DataSource2Config.java
index e1724df..5c4120e 100644
--- a/src/main/java/com/shibofu/spring/config/DataSource2Config.java
+++ b/src/main/java/com/example/config/DataSource2Config.java
@@ -1,4 +1,4 @@
-package com.shibofu.spring.config;
+package com.example.config;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
@@ -14,12 +14,9 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
-/**
- * @author potter.fu
- * @date 2018-12-07 15:30
- */
+
@Configuration
-@MapperScan(basePackages = "com.shibofu.spring.db2.dao", sqlSessionTemplateRef = "db2SqlSessionTemplate")
+@MapperScan(basePackages = "com.example.db2.dao", sqlSessionTemplateRef = "db2SqlSessionTemplate")
public class DataSource2Config {
@Bean(name = "db2DataSource")
diff --git a/src/main/java/com/example/config/SwaggerConfig.java b/src/main/java/com/example/config/SwaggerConfig.java
new file mode 100644
index 0000000..85a5ff6
--- /dev/null
+++ b/src/main/java/com/example/config/SwaggerConfig.java
@@ -0,0 +1,40 @@
+package com.example.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+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 2024/12/10 21:18
+ * @Version 1.0
+ */
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig {
+ @Bean
+ public Docket api() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .select()
+ .apis(RequestHandlerSelectors.any())
+ .paths(PathSelectors.any())
+ .build()
+ .apiInfo(apiInfo());
+ }
+
+ private ApiInfo apiInfo() {
+ return new ApiInfoBuilder()
+ .title("连州人医API文档")
+ .description("连州人医接口文档")
+ .version("1.0.0")
+ .build();
+ }
+}
diff --git a/src/main/java/com/example/controller/ArchiveController.java b/src/main/java/com/example/controller/ArchiveController.java
new file mode 100644
index 0000000..38d2a4d
--- /dev/null
+++ b/src/main/java/com/example/controller/ArchiveController.java
@@ -0,0 +1,33 @@
+package com.example.controller;
+
+import com.example.service.ArchiveService;
+import com.example.util.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @ClassName ArchiveController
+ * @Description 归档接口
+ * @Author linjj
+ * @Date 2024/12/13 13:21
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("/archive")
+@Api(tags = "归档测试接口", description = "Example API Description")
+public class ArchiveController {
+ @Autowired
+ private ArchiveService archiveService;
+
+ @GetMapping("/archivePdf")
+ @ApiOperation(value = "pdf归档测试接口")
+ public CommonResult> archivePdf() {
+ archiveService.archive();
+ return CommonResult.success("执行完成");
+ }
+}
diff --git a/src/main/java/com/example/controller/QualityController.java b/src/main/java/com/example/controller/QualityController.java
new file mode 100644
index 0000000..729662f
--- /dev/null
+++ b/src/main/java/com/example/controller/QualityController.java
@@ -0,0 +1,32 @@
+package com.example.controller;
+
+import com.example.service.QualityService;
+import com.example.util.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @ClassName QualityController
+ * @Description 质检接口
+ * @Author linjj
+ * @Date 2025/1/14 16:32
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("/quality")
+@Api(tags = "质检测试接口", description = "Example API Description")
+public class QualityController {
+
+ @Autowired
+ private QualityService qualityService;
+ @GetMapping("/qualityPdf")
+ @ApiOperation(value = "pdf质检测试接口")
+ public CommonResult> qualityPdf() {
+ qualityService.Quality();
+ return CommonResult.success("执行完成");
+ }
+}
diff --git a/src/main/java/com/example/db1/dao/ArchiveDetailDao.java b/src/main/java/com/example/db1/dao/ArchiveDetailDao.java
new file mode 100644
index 0000000..78a7ca3
--- /dev/null
+++ b/src/main/java/com/example/db1/dao/ArchiveDetailDao.java
@@ -0,0 +1,24 @@
+package com.example.db1.dao;
+
+import com.example.dto.AddDetailDto;
+import com.example.vo.ArchiveDetailVo;
+import lombok.Data;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @InterfaceName ArchiveDetailrDao
+ * @Description 文件表接口
+ * @Author linjj
+ * @Date 2024/12/12 16:33
+ * @Version 1.0
+ */
+@Mapper
+public interface ArchiveDetailDao {
+
+ boolean addArchiveDetail(@Param("list") List list);
+
+ List getPdfPath(String masterId);
+}
diff --git a/src/main/java/com/example/db1/dao/ArchiveMasterDao.java b/src/main/java/com/example/db1/dao/ArchiveMasterDao.java
new file mode 100644
index 0000000..2f4229c
--- /dev/null
+++ b/src/main/java/com/example/db1/dao/ArchiveMasterDao.java
@@ -0,0 +1,45 @@
+package com.example.db1.dao;
+
+import com.example.dto.AddMasterDto;
+import com.example.dto.GetMasterIdDto;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @InterfaceName ArchiveMasterDao
+ * @Description 归档系统基础信息接口
+ * @Author linjj
+ * @Date 2024/12/11 15:17
+ * @Version 1.0
+ */
+@Mapper
+public interface ArchiveMasterDao {
+ /**
+ * @description: 根据患者id,住院号,姓名获取主键id
+ * @params: GetMasterIdDto
+ * @return: id
+ * @author linjj
+ * @date: 2024/12/11 15:19
+ */
+ List getMasterId(GetMasterIdDto getMasterIdDto);
+
+ /**
+ * @description: 新增一个患者基础信息
+ * @params: AddMasterDto
+ * @return: int
+ * @author linjj
+ * @date: 2024/12/11 16:48
+ */
+ Boolean addArchiveMaster(AddMasterDto dto);
+ /**
+ * @description: 根据id删除对应记录
+ * @params: id
+ * @return: Boolean
+ * @author linjj
+ * @date: 2024/12/12 16:10
+ */
+ Boolean delMasterById(@Param("id") String id);
+}
+
diff --git a/src/main/java/com/example/db1/dao/CommonTableDao.java b/src/main/java/com/example/db1/dao/CommonTableDao.java
new file mode 100644
index 0000000..2448a16
--- /dev/null
+++ b/src/main/java/com/example/db1/dao/CommonTableDao.java
@@ -0,0 +1,52 @@
+package com.example.db1.dao;
+
+import com.example.dto.AddCommonTableDto;
+import com.example.dto.UpIsPdfDto;
+import com.example.vo.QualityVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @InterfaceName CommonTableDao
+ * @Description CommonTable表接口
+ * @Author linjj
+ * @Date 2024/12/13 16:31
+ * @Version 1.0
+ */
+@Mapper
+public interface CommonTableDao {
+
+ /**
+ * @description: 新增CommonTable表接口
+ * @params: AddCommonTable
+ * @return: Boolean
+ * @author linjj
+ * @date: 2024/12/13 16:32
+ */
+ Boolean addCommonTable(AddCommonTableDto addCommonTableDto);
+ /**
+ * @description: 根据id删除接口
+ * @params: id
+ * @return: Boolean
+ * @author linjj
+ * @date: 2024/12/13 16:35
+ */
+ Boolean delCommonTableById(String id);
+ /**
+ * @description: 查询需要质检数据
+ * @author linjj
+ * @date: 2025/1/14 15:36
+ */
+ List getCommonTableId();
+ /**
+ * @description: 批量更新isPDF字段的方法
+ * @params: UpIsPdfDto
+ * @return: Boolean
+ * @author linjj
+ * @date: 2025/1/14 16:22
+ */
+ Boolean updateIsPDFByIds(@Param("list") List list);
+}
+
diff --git a/src/main/java/com/example/db2/dao/MedicalDao.java b/src/main/java/com/example/db2/dao/MedicalDao.java
new file mode 100644
index 0000000..d398558
--- /dev/null
+++ b/src/main/java/com/example/db2/dao/MedicalDao.java
@@ -0,0 +1,27 @@
+package com.example.db2.dao;
+
+import com.example.dto.GetMedicalDto;
+import com.example.vo.ArchiveMasterVo;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @InterfaceName ArchiveMasterDao
+ * @Description 患者信息接口
+ * @Author linjj
+ * @Date 2024/12/11 14:05
+ * @Version 1.0
+ */
+@Mapper
+public interface MedicalDao {
+
+ /**
+ * @description: 获取视图中患者信息接口
+ * @params: GetMedicalDto
+ * @return: ArchiveMasterVo
+ * @author linjj
+ * @date: 2024/12/11 14:08
+ */
+ List GetMedicalInfo(GetMedicalDto getMedicalDto);
+}
diff --git a/src/main/java/com/example/dto/AddCommonTableDto.java b/src/main/java/com/example/dto/AddCommonTableDto.java
new file mode 100644
index 0000000..7316169
--- /dev/null
+++ b/src/main/java/com/example/dto/AddCommonTableDto.java
@@ -0,0 +1,50 @@
+package com.example.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @ClassName AddCommonTable
+ * @Description CommonTable
+ * @Author linjj
+ * @Date 2024/12/13 16:18
+ * @Version 1.0
+ */
+@Data
+public class AddCommonTableDto {
+
+ @ApiModelProperty(value = "patientId")
+ private String patientId;
+ @ApiModelProperty(value = "*病案ID号")
+ private String admissId;
+ @ApiModelProperty(value = "*住院次数")
+ private String admissTimes;
+ @ApiModelProperty(value = "*病案号")
+ private String inpatientNo;
+ @ApiModelProperty(value = "患者姓名")
+ private String name;
+ @ApiModelProperty(value = "患者性别")
+ private String sex;
+ @ApiModelProperty(value = "*入院日期")
+ private String admissDate;
+ @ApiModelProperty(value = "出院日期")
+ private String disDate;
+ @ApiModelProperty(value = "出院科室")
+ private String disDept;
+ @ApiModelProperty(value = "*主治医师")
+ private String attending;
+ @ApiModelProperty(value = "*住院医师")
+ private String admissDoctor;
+ @ApiModelProperty(value = "出院科室名称")
+ private String disDeptName;
+ @ApiModelProperty(value = "身份证号")
+ private String idCard;
+ @ApiModelProperty(value = "标识")
+ private String splitName;
+ @ApiModelProperty(value = "盘号")
+ private String ph;
+ @ApiModelProperty(value = "光点号")
+ private String gdh;
+
+
+}
diff --git a/src/main/java/com/example/dto/AddDetailDto.java b/src/main/java/com/example/dto/AddDetailDto.java
new file mode 100644
index 0000000..3df2051
--- /dev/null
+++ b/src/main/java/com/example/dto/AddDetailDto.java
@@ -0,0 +1,51 @@
+package com.example.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @ClassName AddDetailDto
+ * @Description 保存文件表实体类
+ * @Author linjj
+ * @Date 2024/12/12 13:04
+ * @Version 1.0
+ */
+@Data
+public class AddDetailDto {
+ @ApiModelProperty(value = "文件id")
+ private String ID;
+
+ @ApiModelProperty(value = "文件路径")
+ private String PDF_PATH;
+
+ @ApiModelProperty(value = "MasterID")
+ private String MasterID;
+
+ @ApiModelProperty(value = "更新时间")
+ private Date UpLoadDateTime;
+
+ @ApiModelProperty(value = "分段id")
+ private String AssortID;
+
+ @ApiModelProperty(value = "来源")
+ private String Source;
+
+ @ApiModelProperty(value = "分段信息")
+ private String SubAssort;
+
+ @ApiModelProperty(value = "文件名")
+ private String Title;
+
+ @ApiModelProperty(value = "标识")
+ private String flag;
+
+ @ApiModelProperty(value = "标识")
+ private String Sys;
+
+ @ApiModelProperty(value = "标识")
+ private String splitName;
+
+
+}
diff --git a/src/main/java/com/example/dto/AddMasterDto.java b/src/main/java/com/example/dto/AddMasterDto.java
new file mode 100644
index 0000000..d781618
--- /dev/null
+++ b/src/main/java/com/example/dto/AddMasterDto.java
@@ -0,0 +1,50 @@
+package com.example.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * @ClassName AddArchiveMasterDto
+ * @Description 新增归档患者基础信息实体类
+ * @Author linjj
+ * @Date 2024/12/11 15:28
+ * @Version 1.0
+ */
+@Data
+public class AddMasterDto {
+ @ApiModelProperty(value = "主键id")
+ private String id;
+ @ApiModelProperty(value = "病人id")
+ private String patientId;
+ @ApiModelProperty(value = "住院号")
+ private String inpNo;
+ @ApiModelProperty(value = "住院次数")
+ private String visitId;
+ @ApiModelProperty(value = "姓名")
+ private String name;
+ @ApiModelProperty(value = "性别")
+ private String sex;
+ @ApiModelProperty(value = "出院科室")
+ private String deptName;
+ @ApiModelProperty(value = "出院时间")
+ private String dischargeDateTime;
+ @ApiModelProperty(value = "归档状态")
+ private String ArchiveState;
+ @ApiModelProperty(value = "住院时间")
+ private String admissionDateTime;
+ @ApiModelProperty(value = "住院科室")
+ private String deptAdmissionTo;
+ @ApiModelProperty(value = "确认开始时间")
+ private Date checkDatetime;
+ @ApiModelProperty(value = "确认开始结束时间")
+ private Date checkedDatetime;
+ @ApiModelProperty(value = "主治医生")
+ private String DOCTOR_IN_CHARGE;
+ @ApiModelProperty(value = "身份证号")
+ private String ID_NO;
+ @ApiModelProperty(value = "标识")
+ private String splitName;
+
+
+}
diff --git a/src/main/java/com/example/dto/GetMasterIdDto.java b/src/main/java/com/example/dto/GetMasterIdDto.java
new file mode 100644
index 0000000..05937cb
--- /dev/null
+++ b/src/main/java/com/example/dto/GetMasterIdDto.java
@@ -0,0 +1,25 @@
+package com.example.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @ClassName GetMasterDto
+ * @Description 获取ArchiveMasterId dto
+ * @Author linjj
+ * @Date 2024/12/11 15:10
+ * @Version 1.0
+ */
+@Data
+public class GetMasterIdDto {
+
+ @ApiModelProperty(value = "病人id")
+ private String patientId;
+
+ @ApiModelProperty(value = "姓名")
+ private String name;
+
+ @ApiModelProperty(value = "住院号")
+ private String inpNo;
+
+}
diff --git a/src/main/java/com/example/dto/GetMedicalDto.java b/src/main/java/com/example/dto/GetMedicalDto.java
new file mode 100644
index 0000000..c10db72
--- /dev/null
+++ b/src/main/java/com/example/dto/GetMedicalDto.java
@@ -0,0 +1,24 @@
+package com.example.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @ClassName GetMedicalDto
+ * @Description 获取患者信息所需参数
+ * @Author linjj
+ * @Date 2024/12/11 14:09
+ * @Version 1.0
+ */
+@Data
+public class GetMedicalDto {
+
+ @ApiModelProperty(value = "病人id")
+ private String SICK_ID;
+
+ @ApiModelProperty(value = "姓名")
+ private String NAME;
+
+ @ApiModelProperty(value = "住院号")
+ private String RESIDENCE_NO;
+}
diff --git a/src/main/java/com/example/dto/UpIsPdfDto.java b/src/main/java/com/example/dto/UpIsPdfDto.java
new file mode 100644
index 0000000..1f0a5ab
--- /dev/null
+++ b/src/main/java/com/example/dto/UpIsPdfDto.java
@@ -0,0 +1,18 @@
+package com.example.dto;
+
+import lombok.Data;
+
+/**
+ * @ClassName UpIsPdfDto
+ * @Description 修改CommonTable isPdf标识
+ * @Author linjj
+ * @Date 2025/1/14 16:04
+ * @Version 1.0
+ */
+@Data
+public class UpIsPdfDto {
+
+ private String patientId;
+
+ private int isPdf;
+}
diff --git a/src/main/java/com/example/quartz/ArchiveQuartz.java b/src/main/java/com/example/quartz/ArchiveQuartz.java
new file mode 100644
index 0000000..a4c247e
--- /dev/null
+++ b/src/main/java/com/example/quartz/ArchiveQuartz.java
@@ -0,0 +1,28 @@
+package com.example.quartz;
+
+
+
+import com.example.service.ArchiveService;
+import org.quartz.JobExecutionContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.quartz.QuartzJobBean;
+
+import javax.annotation.Resource;
+
+/**
+ * @description: 定时任务采集
+ * @author linjj
+ * @date: 2024/12/13 9:22
+ */
+public class ArchiveQuartz extends QuartzJobBean {
+
+
+ @Resource
+ private ArchiveService archiveService;
+
+
+ @Override
+ protected void executeInternal(JobExecutionContext jobExecutionContext) {
+ archiveService.archive();
+ }
+}
diff --git a/src/main/java/com/shibofu/spring/quartz/QuartzConfig.java b/src/main/java/com/example/quartz/QuartzConfig.java
similarity index 80%
rename from src/main/java/com/shibofu/spring/quartz/QuartzConfig.java
rename to src/main/java/com/example/quartz/QuartzConfig.java
index b46cacc..f9a5476 100644
--- a/src/main/java/com/shibofu/spring/quartz/QuartzConfig.java
+++ b/src/main/java/com/example/quartz/QuartzConfig.java
@@ -1,4 +1,4 @@
-package com.shibofu.spring.quartz;
+package com.example.quartz;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Value;
@@ -7,9 +7,8 @@ import org.springframework.context.annotation.Configuration;
/**
* @ClassName QuartzConfig
- * @Description
* @Author linjj
- * @Date 2023/8/14 15:47
+ * @Date 2024/12/13 15:47
* @Version 1.0
*/
@Configuration
@@ -22,7 +21,7 @@ public class QuartzConfig {
@Bean
public JobDetail teatQuartzDetail() {
- return JobBuilder.newJob(ECGQuartz.class).withIdentity("ECGQuartz").storeDurably().build();
+ return JobBuilder.newJob(ArchiveQuartz.class).withIdentity("ArchiveQuartz").storeDurably().build();
}
diff --git a/src/main/java/com/example/service/ArchiveService.java b/src/main/java/com/example/service/ArchiveService.java
new file mode 100644
index 0000000..f9af888
--- /dev/null
+++ b/src/main/java/com/example/service/ArchiveService.java
@@ -0,0 +1,19 @@
+package com.example.service;
+
+/**
+ * @InterfaceName ArchiveService
+ * @Description 连州归档接口
+ * @Author linjj
+ * @Date 2024/12/13 13:14
+ * @Version 1.0
+ */
+public interface ArchiveService {
+
+
+ /**
+ * @description: 归档接口
+ * @author linjj
+ * @date: 2025/1/14 15:34
+ */
+ boolean archive();
+}
diff --git a/src/main/java/com/example/service/QualityService.java b/src/main/java/com/example/service/QualityService.java
new file mode 100644
index 0000000..932c5d3
--- /dev/null
+++ b/src/main/java/com/example/service/QualityService.java
@@ -0,0 +1,18 @@
+package com.example.service;
+
+/**
+ * @InterfaceName QualityService
+ * @Description 质检接口
+ * @Author linjj
+ * @Date 2025/1/14 15:30
+ * @Version 1.0
+ */
+public interface QualityService {
+
+ /**
+ * @description: 质检接口
+ * @author linjj
+ * @date: 2025/1/14 15:34
+ */
+ Boolean Quality();
+}
diff --git a/src/main/java/com/example/serviceImpl/ArchiveServiceImpl.java b/src/main/java/com/example/serviceImpl/ArchiveServiceImpl.java
new file mode 100644
index 0000000..c1d9b26
--- /dev/null
+++ b/src/main/java/com/example/serviceImpl/ArchiveServiceImpl.java
@@ -0,0 +1,346 @@
+package com.example.serviceImpl;
+
+import com.example.db1.dao.ArchiveDetailDao;
+import com.example.db1.dao.ArchiveMasterDao;
+import com.example.db1.dao.CommonTableDao;
+import com.example.db1.dao.ZdAssortDao;
+import com.example.db2.dao.MedicalDao;
+import com.example.dto.*;
+import com.example.service.ArchiveService;
+import com.example.vo.ArchiveMasterVo;
+import com.example.vo.GetZdAssortVo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.io.File;
+import java.nio.file.*;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @ClassName ArchiveServiceImpl
+ * @Description 连州归档业务层
+ * @Author linjj
+ * @Date 2024/12/13 13:15
+ * @Version 1.0
+ */
+@Service
+@Slf4j
+public class ArchiveServiceImpl implements ArchiveService {
+
+ @Value("${emr_pdf_files}")
+ private String emr_pdf_files;
+
+ @Value("${save_pdf_files}")
+ private String save_pdf_files;
+ @Autowired
+ private MedicalDao medicalDao;
+ @Autowired
+ private ArchiveMasterDao archiveMasterDao;
+ @Autowired
+ private ZdAssortDao zdAssortDao;
+ @Autowired
+ private ArchiveDetailDao archiveDetailDao;
+ @Autowired
+ private CommonTableDao commonTableDao;
+
+
+ @Override
+ public boolean archive() {
+ //获取最早的文件名
+ String fileName = getEarlyFileName();
+ //若返回空说明没有文件直接return
+ if (fileName == null) return false;
+ //-----------------------判断该病案是否上传完成代码---------------------------------
+ //将文件姓名解析 使用下划线 "_" 分割字符串
+ String[] parts = fileName.split("_");
+ GetMedicalDto getMedicalDto = new GetMedicalDto();
+ getMedicalDto.setNAME(parts[0]);
+ getMedicalDto.setSICK_ID(parts[1]);
+ getMedicalDto.setRESIDENCE_NO(parts[2]);
+ //存储患者基本信息
+ AddMasterDto addMasterDto = new AddMasterDto();
+ //查询该患者在视图中完成状态是否为1
+ List archiveMasterVos = medicalDao.GetMedicalInfo(getMedicalDto);
+ if (archiveMasterVos.isEmpty()) {
+ log.info("该病案还未上传完成:" + fileName);
+ return false;
+ }
+ //判断该病案是否存在归档数据库存在更新不存在新增,捕获到异常返回false直接return
+ if (!updateMedical(fileName, getMedicalDto, archiveMasterVos, addMasterDto)) return false;
+ //-----------------------将文件复制代码(将本次查询出来最早的文件备份后操作)---------------------------------
+ Path sourcePath = Paths.get(emr_pdf_files + File.separatorChar + fileName); // 源目录路径
+ Path targetPath = Paths.get(save_pdf_files + File.separatorChar + fileName); // 目标目录路径
+ try {
+ copyDirectory(sourcePath, targetPath); // 调用复制目录的方法
+ log.info("该病历图像已经复制完成:" + fileName);
+ } catch (Exception e) {
+ log.error("复制源文件到目标路径下失败,异常处理" + e, e.getMessage());
+ return false;
+ }
+ //将新地址插入数据库
+ addArchiveDetail(fileName, addMasterDto);
+ return true;
+ }
+
+ /**
+ * @description: 将新地址插入数据库
+ * @params: fileName
+ * @params: addMasterDto
+ * @author linjj
+ * @date: 2024/12/12 16:43
+ */
+ private void addArchiveDetail(String fileName, AddMasterDto addMasterDto) {
+ // 创建File对象新地址
+ File newFile = new File(save_pdf_files + File.separatorChar + fileName);
+ // 获取目录下的所有文件(包括子目录中的文件)
+ File[] newFiles = newFile.listFiles();
+ //保存文件的数据
+ List addDetailDtos = new ArrayList();
+ if (newFiles.length == 0) {
+ log.info("新地址目录为空异常处理:" + fileName);
+ return;
+ }
+ for (File file : newFiles) {
+ //组织数据
+ AddDetailDto addDetailDto = new AddDetailDto();
+ addDetailDto.setPDF_PATH(file.getPath());
+ addDetailDto.setMasterID(addMasterDto.getId());
+ addDetailDto.setUpLoadDateTime(new Date());
+ List zdAssort = zdAssortDao.getZdAssort();
+ String newFileName = file.getName();
+ //将文件姓名解析 使用下划线 "_" 分割字符串
+ String[] newParts = newFileName.split("_");
+ // 调用方法查找name为"Item2"的id
+ String assortId = assortIdByName(zdAssort, newParts[0]);
+ if (StringUtils.isEmpty(assortId)) {
+ assortId = "C7C73CD034B440F6B33A79E382A5610F";
+ }
+ addDetailDto.setAssortID(assortId);
+ addDetailDto.setSource("后台");
+ addDetailDto.setSubAssort(newParts[0]);
+ addDetailDto.setTitle(newParts[0]);
+ addDetailDto.setFlag("0");
+ addDetailDto.setSys("2");
+ addDetailDto.setSplitName("guiDang");
+ addDetailDtos.add(addDetailDto);
+ }
+ if (archiveDetailDao.addArchiveDetail(addDetailDtos)) {
+ log.info("加入文件表完成:" + fileName);
+ } else {
+ log.info("加入文件表失败异常处理:" + fileName);
+ }
+ }
+
+ /**
+ * @description: 根据分段名称获取
+ * @params: zdAssortDto
+ * @params: name
+ * @return: assortId
+ * @author linjj
+ * @date: 2024/12/12 16:25
+ */
+ public static String assortIdByName(List zdAssortDto, String name) {
+ return zdAssortDto.stream()
+ .filter(item -> item.getAssortName().equals(name))
+ .map(GetZdAssortVo::getAssortId)
+ .findFirst()
+ .orElse(null);
+ }
+
+
+ /**
+ * @description: 判断该病案是否存在归档数据库存在更新不存在新增
+ * @params: fileName
+ * @params: getMedicalDto
+ * @params: ArchiveMasterVo
+ * @return: boolean
+ * @author linjj
+ * @date: 2024/12/12 12:07
+ */
+ private boolean updateMedical(String fileName, GetMedicalDto getMedicalDto, List archiveMasterVos, AddMasterDto addMasterDto) {
+ //判断是否存在该患者信息基础表
+ try {
+ GetMasterIdDto getMasterIdDto = new GetMasterIdDto();
+
+ //使用时间生成一个id
+ SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ //获取今天日期
+ String id = fmt.format(new Date());
+ getMasterIdDto.setName(getMedicalDto.getNAME());
+ getMasterIdDto.setPatientId(getMedicalDto.getSICK_ID());
+ getMasterIdDto.setInpNo(getMedicalDto.getRESIDENCE_NO());
+ List masterIds = archiveMasterDao.getMasterId(getMasterIdDto);
+ //不存在新增
+ if (masterIds.isEmpty()) {
+ //组织需要保存归档基础信息表的数据,不存在时使用当前时间为患者id
+ addMasterDto.setId(id);
+ addMasterDto.setPatientId(archiveMasterVos.get(0).getSICK_ID());
+ addMasterDto.setInpNo(archiveMasterVos.get(0).getRESIDENCE_NO());
+ addMasterDto.setVisitId(archiveMasterVos.get(0).getVISIT_NUMBER());
+ addMasterDto.setName(archiveMasterVos.get(0).getNAME());
+ addMasterDto.setSex(archiveMasterVos.get(0).getSEX());
+ addMasterDto.setDeptName(archiveMasterVos.get(0).getDEPT_CODE());
+ addMasterDto.setDischargeDateTime(archiveMasterVos.get(0).getDISCHARGE_TIME());
+ addMasterDto.setArchiveState("已归档");
+ addMasterDto.setAdmissionDateTime(archiveMasterVos.get(0).getADMISSION_TIME());
+ addMasterDto.setDeptAdmissionTo(archiveMasterVos.get(0).getADMISSION_DEPT_CODE());
+ addMasterDto.setCheckDatetime(new Date());
+ addMasterDto.setCheckedDatetime(new Date());
+ addMasterDto.setDOCTOR_IN_CHARGE(archiveMasterVos.get(0).getDOCTOR());
+ addMasterDto.setID_NO(archiveMasterVos.get(0).getID_CARD_NO());
+ addMasterDto.setSplitName("guiDang");
+ if (archiveMasterDao.addArchiveMaster(addMasterDto)) {
+ log.info("同步基础信息成功:" + fileName);
+ }
+ //不存是时同样在CommonTable插入新数据
+ AddCommonTableDto addCommonTableDto =new AddCommonTableDto();
+ addCommonTableDto.setPatientId(id);
+ addCommonTableDto.setAdmissId(archiveMasterVos.get(0).getSICK_ID());
+ addCommonTableDto.setAdmissTimes(archiveMasterVos.get(0).getVISIT_NUMBER());
+ addCommonTableDto.setInpatientNo(archiveMasterVos.get(0).getRESIDENCE_NO());
+ addCommonTableDto.setName(archiveMasterVos.get(0).getNAME());
+ addCommonTableDto.setSex(archiveMasterVos.get(0).getSEX());
+ addCommonTableDto.setAdmissDate(archiveMasterVos.get(0).getADMISSION_TIME());
+ addCommonTableDto.setDisDate(archiveMasterVos.get(0).getDISCHARGE_TIME());
+ addCommonTableDto.setDisDept(archiveMasterVos.get(0).getDEPT_CODE());
+ addCommonTableDto.setAttending(archiveMasterVos.get(0).getDOCTOR());
+ addCommonTableDto.setDisDeptName(archiveMasterVos.get(0).getDETP_NAME());
+ addCommonTableDto.setIdCard(archiveMasterVos.get(0).getID_CARD_NO());
+ addCommonTableDto.setAdmissDoctor(archiveMasterVos.get(0).getDOCTOR());
+ addCommonTableDto.setSplitName("guiDang");
+ addCommonTableDto.setPh("-");
+ addCommonTableDto.setGdh("-");
+ if (commonTableDao.addCommonTable(addCommonTableDto)) {
+ log.info("同步基础信息到CommonTable表成功:" + fileName);
+ }
+ //存在时先删除后使用原masterIds赋值
+ } else {
+ addMasterDto.setId(masterIds.get(0));
+ addMasterDto.setPatientId(archiveMasterVos.get(0).getSICK_ID());
+ addMasterDto.setInpNo(archiveMasterVos.get(0).getRESIDENCE_NO());
+ addMasterDto.setVisitId(archiveMasterVos.get(0).getVISIT_NUMBER());
+ addMasterDto.setName(archiveMasterVos.get(0).getNAME());
+ addMasterDto.setSex(archiveMasterVos.get(0).getSEX());
+ addMasterDto.setDeptName(archiveMasterVos.get(0).getDEPT_CODE());
+ addMasterDto.setDischargeDateTime(archiveMasterVos.get(0).getDISCHARGE_TIME());
+ addMasterDto.setArchiveState("已归档");
+ addMasterDto.setAdmissionDateTime(archiveMasterVos.get(0).getADMISSION_TIME());
+ addMasterDto.setDeptAdmissionTo(archiveMasterVos.get(0).getADMISSION_DEPT_CODE());
+ addMasterDto.setCheckDatetime(new Date());
+ addMasterDto.setCheckedDatetime(new Date());
+ addMasterDto.setDOCTOR_IN_CHARGE(archiveMasterVos.get(0).getDOCTOR());
+ addMasterDto.setID_NO(archiveMasterVos.get(0).getID_CARD_NO());
+ addMasterDto.setSplitName("guiDang");
+ if (archiveMasterDao.delMasterById(masterIds.get(0))) {
+ if (archiveMasterDao.addArchiveMaster(addMasterDto)) {
+ log.info("同步基础信息成功:" + fileName);
+ }
+ }
+ //存在时同样删除CommonTable数据
+ AddCommonTableDto addCommonTableDto =new AddCommonTableDto();
+ addCommonTableDto.setPatientId(masterIds.get(0));
+ addCommonTableDto.setAdmissId(archiveMasterVos.get(0).getSICK_ID());
+ addCommonTableDto.setAdmissTimes(archiveMasterVos.get(0).getVISIT_NUMBER());
+ addCommonTableDto.setInpatientNo(archiveMasterVos.get(0).getRESIDENCE_NO());
+ addCommonTableDto.setName(archiveMasterVos.get(0).getNAME());
+ addCommonTableDto.setSex(archiveMasterVos.get(0).getSEX());
+ addCommonTableDto.setAdmissDate(archiveMasterVos.get(0).getADMISSION_TIME());
+ addCommonTableDto.setDisDate(archiveMasterVos.get(0).getDISCHARGE_TIME());
+ addCommonTableDto.setDisDept(archiveMasterVos.get(0).getDEPT_CODE());
+ addCommonTableDto.setAttending(archiveMasterVos.get(0).getDOCTOR());
+ addCommonTableDto.setDisDeptName(archiveMasterVos.get(0).getDETP_NAME());
+ addCommonTableDto.setIdCard(archiveMasterVos.get(0).getID_CARD_NO());
+ addCommonTableDto.setAdmissDoctor(archiveMasterVos.get(0).getDOCTOR());
+ addCommonTableDto.setSplitName("guiDang");
+ addCommonTableDto.setPh("-");
+ addCommonTableDto.setGdh("-");
+ if (commonTableDao.delCommonTableById(masterIds.get(0))){
+ if (commonTableDao.addCommonTable(addCommonTableDto)) {
+ log.info("同步基础信息到CommonTable表成功:" + fileName);
+ }
+ }
+ }
+ } catch (Exception e) {
+ log.info("同步基础信息失败请异常处理:" + fileName + "异常信息:" + e, e.getMessage());
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @description: 获取最早的文件名
+ * @return: fileName
+ * @author linjj
+ * @date: 2024/12/12 11:36
+ */
+ private String getEarlyFileName() {
+ // 创建File对象,代表指定的目录
+ File directory = new File(emr_pdf_files);
+ // 确保目录存在
+ if (!directory.isDirectory()) {
+ System.out.println("目录不存在");
+ log.info("目录不存在");
+ return null;
+ }
+ // 获取目录下所有文件和文件夹
+ File[] files = directory.listFiles(file -> file.isDirectory());
+ if (files.length == 0) {
+ log.info("文件夹为空");
+ return null;
+ }
+ // 初始化最早文件夹和最早时间戳
+ File oldestFile = null;
+ long oldestTime = Long.MAX_VALUE;
+ // 遍历所有文件夹
+ for (File folder : files) {
+ // 获取文件夹的最后修改时间
+ long lastModified = folder.lastModified();
+ // 如果当前文件夹的修改时间更早,则更新最早文件夹和时间戳
+ if (lastModified < oldestTime) {
+ oldestTime = lastModified;
+ oldestFile = folder;
+ }
+ }
+ // 输出创建时间最早的文件信息
+ if (oldestFile == null) {
+ log.info("没有找到复合条件的文件信息");
+ return null;
+ }
+ //最早的文件名
+ String fileName = oldestFile.getName();
+ log.info("当前操作文件夹信息为:" + fileName);
+ return fileName;
+ }
+
+ /**
+ * @description: 复制目录方法
+ * @params: source
+ * @params: target
+ * @author linjj
+ * @date: 2024/12/12 16:06
+ */
+ public static void copyDirectory(Path source, Path target) throws Exception {
+ // 如果目标目录不存在,则创建它
+ if (!Files.exists(target)) {
+ Files.createDirectories(target);
+ }
+ // 使用DirectoryStream遍历源目录中的所有文件和子目录
+ try (DirectoryStream directoryStream = Files.newDirectoryStream(source)) {
+ for (Path path : directoryStream) {
+ Path targetPath = target.resolve(source.relativize(path));
+ //存在相同文件时REPLACE_EXISTING会替换掉相同的文件夹
+ Files.copy(path, targetPath, StandardCopyOption.REPLACE_EXISTING);
+ //在复制完成后删除对应的源文件
+ Files.delete(path); // 删除源文件
+ }
+ //复制成功后将源地址文件删除
+ Files.delete(source);
+ }
+ }
+}
diff --git a/src/main/java/com/example/serviceImpl/QualityServiceImpl.java b/src/main/java/com/example/serviceImpl/QualityServiceImpl.java
new file mode 100644
index 0000000..8100a7d
--- /dev/null
+++ b/src/main/java/com/example/serviceImpl/QualityServiceImpl.java
@@ -0,0 +1,137 @@
+package com.example.serviceImpl;
+
+import com.example.db1.dao.ArchiveDetailDao;
+import com.example.db1.dao.CommonTableDao;
+import com.example.dto.UpIsPdfDto;
+import com.example.service.QualityService;
+import com.example.util.ListUtil;
+import com.example.vo.ArchiveDetailVo;
+import com.example.vo.QualityVo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.ListUtils;
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.text.PDFTextStripper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.management.remote.rmi._RMIConnection_Stub;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName QualityServiceImpl
+ * @Description 连州质检业务层
+ * @Author linjj
+ * @Date 2025/1/14 15:30
+ * @Version 1.0
+ */
+@Service
+@Slf4j
+public class QualityServiceImpl implements QualityService {
+
+ @Autowired
+ private CommonTableDao commonTableDao;
+ @Autowired
+ private ArchiveDetailDao archiveDetailDao;
+
+ @Override
+ public Boolean Quality() {
+ try {
+ //查询所有需要质检的主键id
+ List commonTableList = commonTableDao.getCommonTableId();
+ //masterIds集合
+ List masterIdList = ListUtil.distinctSelect(commonTableList, QualityVo::getPatientId);
+ //每次取出100条
+ List> batchList = ListUtils.partition(masterIdList, 100);
+ //记录CommonTable表中isPdf字段,1代表没有内容,0表示有内容
+ List isPdfs = new ArrayList<>();
+ //循环执行所有批次
+ for (List masterIds : batchList) {
+ //循环执行本次批次中所有的masterId
+ for (String masterId : masterIds) {
+ log.info("开始质检的id为:" + masterId);
+ UpIsPdfDto upIsPdfDto = new UpIsPdfDto();
+ //查询是否存在图像
+ List pdfPaths = archiveDetailDao.getPdfPath(masterId);
+ //如果大于100条记录属于问题病案
+ if (pdfPaths.size() > 100) {
+ //记录CommonTable表中isPdf字段,1代表没有内容,0表示有内容
+ upIsPdfDto.setPatientId(masterId);
+ upIsPdfDto.setIsPdf(1);
+ isPdfs.add(upIsPdfDto);
+ log.info("病案主键id为:" + masterId + "文件里超过100条记录");
+ } else if (!pdfPaths.isEmpty() && pdfPaths.size() < 100) {
+ //查询所有文件是否可以正常使用返回false为pdf存在问题
+ if (!isPDFValid(pdfPaths)) {
+ //记录CommonTable表中isPdf字段,1代表没有内容,0表示有内容
+ upIsPdfDto.setPatientId(masterId);
+ upIsPdfDto.setIsPdf(1);
+ isPdfs.add(upIsPdfDto);
+ log.info("病案主键id为:" + masterId + "没有文件图像异常");
+ } else {
+ //记录CommonTable表中isPdf字段,1代表没有内容,0表示有内容
+ upIsPdfDto.setPatientId(masterId);
+ upIsPdfDto.setIsPdf(0);
+ isPdfs.add(upIsPdfDto);
+ }
+ } else if (pdfPaths.isEmpty()) {
+ //记录CommonTable表中isPdf字段,1代表没有内容,0表示有内容
+ upIsPdfDto.setPatientId(masterId);
+ upIsPdfDto.setIsPdf(1);
+ isPdfs.add(upIsPdfDto);
+ log.info("病案主键id为:" + masterId + "没有文件图像信息");
+ }
+
+ }
+ //修改CommonTable表中isPdf字段
+ commonTableDao.updateIsPDFByIds(isPdfs);
+ log.info("执行完成:" + masterIds.size() + "条数据");
+ //清空isPdfs中数据
+ isPdfs.clear();
+ }
+ log.info("质检完成");
+ } catch (Exception e) {
+ log.error("系统异常处理" + e, e.getMessage());
+ }
+ return true;
+ }
+
+
+ /**
+ * @description: 质检方法
+ * @params: filePath
+ * @return: boolean
+ * @author linjj
+ * @date: 2025/1/14 16:12
+ */
+ public boolean isPDFValid(List filePaths) {
+ for (String filePath : filePaths) {
+ File file = new File(filePath);
+ if (!file.exists()) {
+ return false;
+ }
+ try (PDDocument document = PDDocument.load(file)) {
+ // 检查PDF文件的页数
+ int numberOfPages = document.getNumberOfPages();
+ if (numberOfPages <= 0) {
+ return false;
+ }
+
+ // 尝试读取每一页的内容
+ PDFTextStripper pdfTextStripper = new PDFTextStripper();
+ for (int i = 0; i < numberOfPages; i++) {
+ String text = pdfTextStripper.getText(document);
+ if (text == null || text.isEmpty()) {
+ return false;
+ }
+ }
+ } catch (Exception e) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/src/main/java/com/example/text/test.java b/src/main/java/com/example/text/test.java
new file mode 100644
index 0000000..5b5cb85
--- /dev/null
+++ b/src/main/java/com/example/text/test.java
@@ -0,0 +1,303 @@
+package com.example.text;
+
+import com.example.MainApplication;
+import com.example.db1.dao.ArchiveDetailDao;
+import com.example.db1.dao.ArchiveMasterDao;
+import com.example.db1.dao.ZdAssortDao;
+import com.example.db2.dao.MedicalDao;
+import com.example.dto.*;
+import com.example.vo.ArchiveMasterVo;
+import com.example.vo.GetZdAssortVo;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.util.StringUtils;
+
+import java.io.File;
+import java.nio.file.*;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * @ClassName test
+ * @Description 测试类
+ * @Author linjj
+ * @Date 2024/1/18 9:54
+ * @Version 1.0
+ */
+@SpringBootTest(classes = MainApplication.class)
+@RunWith(SpringRunner.class)
+@Slf4j
+public class test {
+
+ @Value("${emr_pdf_files}")
+ private String emr_pdf_files;
+
+ @Value("${save_pdf_files}")
+ private String save_pdf_files;
+ @Autowired
+ private MedicalDao medicalDao;
+ @Autowired
+ private ArchiveMasterDao archiveMasterDao;
+ @Autowired
+ private ZdAssortDao zdAssortDao;
+ @Autowired
+ private ArchiveDetailDao archiveDetailDao;
+
+ @Test
+ public void testDemo() {
+ //获取最早的文件名
+ String fileName = getEarlyFileName();
+ //若返回空说明没有文件直接return
+ if (fileName == null) return;
+ //-----------------------判断该病案是否上传完成代码---------------------------------
+ //将文件姓名解析 使用下划线 "_" 分割字符串
+ String[] parts = fileName.split("_");
+ GetMedicalDto getMedicalDto = new GetMedicalDto();
+ getMedicalDto.setNAME(parts[0]);
+ getMedicalDto.setSICK_ID(parts[1]);
+ getMedicalDto.setRESIDENCE_NO(parts[2]);
+ //存储患者基本信息
+ AddMasterDto addMasterDto = new AddMasterDto();
+ //查询该患者在视图中完成状态是否为1
+ List archiveMasterVos = medicalDao.GetMedicalInfo(getMedicalDto);
+ if (archiveMasterVos.isEmpty()) {
+ log.info("该病案还未上传完成:" + fileName);
+ return;
+ }
+ //判断该病案是否存在归档数据库存在更新不存在新增,捕获到异常返回false直接return
+ if (!updateMedical(fileName, getMedicalDto, archiveMasterVos, addMasterDto)) return;
+ //-----------------------将文件复制代码(将本次查询出来最早的文件备份后操作)---------------------------------
+ Path sourcePath = Paths.get(emr_pdf_files + File.separatorChar + fileName); // 源目录路径
+ Path targetPath = Paths.get(save_pdf_files + File.separatorChar + fileName); // 目标目录路径
+ try {
+ copyDirectory(sourcePath, targetPath); // 调用复制目录的方法
+ log.info("该病历图像已经复制完成:" + fileName);
+ } catch (Exception e) {
+ log.error("复制源文件到目标路径下失败,异常处理" + e, e.getMessage());
+ return;
+ }
+ //将新地址插入数据库
+ addArchiveDetail(fileName, addMasterDto);
+ }
+
+ /**
+ * @description: 将新地址插入数据库
+ * @params: fileName
+ * @params: addMasterDto
+ * @author linjj
+ * @date: 2024/12/12 16:43
+ */
+ private void addArchiveDetail(String fileName, AddMasterDto addMasterDto) {
+ // 创建File对象新地址
+ File newFile = new File(save_pdf_files + File.separatorChar + fileName);
+ // 获取目录下的所有文件(包括子目录中的文件)
+ File[] newFiles = newFile.listFiles();
+ //保存文件的数据
+ List addDetailDtos = new ArrayList();
+ if (newFiles.length == 0) {
+ log.info("新地址目录为空异常处理:" + fileName);
+ return;
+ }
+ for (File file : newFiles) {
+ //组织数据
+ AddDetailDto addDetailDto = new AddDetailDto();
+ addDetailDto.setPDF_PATH(file.getPath());
+ addDetailDto.setMasterID(addMasterDto.getId());
+ addDetailDto.setUpLoadDateTime(new Date());
+ List zdAssort = zdAssortDao.getZdAssort();
+ String newFileName = file.getName();
+ //将文件姓名解析 使用下划线 "_" 分割字符串
+ String[] newParts = newFileName.split("_");
+ // 调用方法查找name为"Item2"的id
+ String assortId = assortIdByName(zdAssort, newParts[0]);
+ if (StringUtils.isEmpty(assortId)) {
+ assortId = "其他";
+ }
+ addDetailDto.setAssortID(assortId);
+ addDetailDto.setSource("后台");
+ addDetailDto.setSubAssort(newParts[0]);
+ addDetailDto.setTitle(newParts[0]);
+ addDetailDto.setFlag("0");
+ addDetailDto.setSys("2");
+ addDetailDto.setSplitName("guiDang");
+ addDetailDtos.add(addDetailDto);
+ }
+ if (archiveDetailDao.addArchiveDetail(addDetailDtos)) {
+ log.info("加入文件表完成:" + fileName);
+ } else {
+ log.info("加入文件表失败异常处理:" + fileName);
+ }
+ }
+
+ /**
+ * @description: 根据分段名称获取
+ * @params: zdAssortDto
+ * @params: name
+ * @return: assortId
+ * @author linjj
+ * @date: 2024/12/12 16:25
+ */
+ public static String assortIdByName(List zdAssortDto, String name) {
+ return zdAssortDto.stream()
+ .filter(item -> item.getAssortName().equals(name))
+ .map(GetZdAssortVo::getAssortId)
+ .findFirst()
+ .orElse(null);
+ }
+
+
+ /**
+ * @description: 判断该病案是否存在归档数据库存在更新不存在新增
+ * @params: fileName
+ * @params: getMedicalDto
+ * @params: ArchiveMasterVo
+ * @return: boolean
+ * @author linjj
+ * @date: 2024/12/12 12:07
+ */
+ private boolean updateMedical(String fileName, GetMedicalDto getMedicalDto, List archiveMasterVos, AddMasterDto addMasterDto) {
+ //判断是否存在该患者信息基础表
+ try {
+ GetMasterIdDto getMasterIdDto = new GetMasterIdDto();
+
+ //使用时间生成一个id
+ SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ //获取今天日期
+ String id = fmt.format(new Date());
+ getMasterIdDto.setName(getMedicalDto.getNAME());
+ getMasterIdDto.setPatientId(getMedicalDto.getSICK_ID());
+ getMasterIdDto.setInpNo(getMedicalDto.getRESIDENCE_NO());
+ List masterIds = archiveMasterDao.getMasterId(getMasterIdDto);
+ //不存在新增
+ if (masterIds.isEmpty()) {
+ //组织需要保存归档基础信息表的数据,不存在时使用当前时间为患者id
+ addMasterDto.setId(id);
+ addMasterDto.setPatientId(archiveMasterVos.get(0).getSICK_ID());
+ addMasterDto.setInpNo(archiveMasterVos.get(0).getRESIDENCE_NO());
+ addMasterDto.setVisitId(archiveMasterVos.get(0).getVISIT_NUMBER());
+ addMasterDto.setName(archiveMasterVos.get(0).getNAME());
+ addMasterDto.setSex(archiveMasterVos.get(0).getSEX());
+ addMasterDto.setDeptName(archiveMasterVos.get(0).getDEPT_CODE());
+ addMasterDto.setDischargeDateTime(archiveMasterVos.get(0).getDISCHARGE_TIME());
+ addMasterDto.setArchiveState("已归档");
+ addMasterDto.setAdmissionDateTime(archiveMasterVos.get(0).getADMISSION_TIME());
+ addMasterDto.setDeptAdmissionTo(archiveMasterVos.get(0).getADMISSION_DEPT_CODE());
+ addMasterDto.setCheckDatetime(new Date());
+ addMasterDto.setCheckedDatetime(new Date());
+ addMasterDto.setDOCTOR_IN_CHARGE(archiveMasterVos.get(0).getDOCTOR());
+ addMasterDto.setID_NO(archiveMasterVos.get(0).getID_CARD_NO());
+ addMasterDto.setSplitName("guiDang");
+ if (archiveMasterDao.addArchiveMaster(addMasterDto)) {
+ log.info("同步基础信息成功:" + fileName);
+ }
+ //存在时先删除后使用原masterIds赋值
+ } else {
+ addMasterDto.setId(masterIds.get(0));
+ addMasterDto.setPatientId(archiveMasterVos.get(0).getSICK_ID());
+ addMasterDto.setInpNo(archiveMasterVos.get(0).getRESIDENCE_NO());
+ addMasterDto.setVisitId(archiveMasterVos.get(0).getVISIT_NUMBER());
+ addMasterDto.setName(archiveMasterVos.get(0).getNAME());
+ addMasterDto.setSex(archiveMasterVos.get(0).getSEX());
+ addMasterDto.setDeptName(archiveMasterVos.get(0).getDEPT_CODE());
+ addMasterDto.setDischargeDateTime(archiveMasterVos.get(0).getDISCHARGE_TIME());
+ addMasterDto.setArchiveState("已归档");
+ addMasterDto.setAdmissionDateTime(archiveMasterVos.get(0).getADMISSION_TIME());
+ addMasterDto.setDeptAdmissionTo(archiveMasterVos.get(0).getADMISSION_DEPT_CODE());
+ addMasterDto.setCheckDatetime(new Date());
+ addMasterDto.setCheckedDatetime(new Date());
+ addMasterDto.setDOCTOR_IN_CHARGE(archiveMasterVos.get(0).getDOCTOR());
+ addMasterDto.setID_NO(archiveMasterVos.get(0).getID_CARD_NO());
+ addMasterDto.setSplitName("guiDang");
+ if (archiveMasterDao.delMasterById(masterIds.get(0))) {
+ if (archiveMasterDao.addArchiveMaster(addMasterDto)) {
+ log.info("同步基础信息成功:" + fileName);
+ }
+ }
+ }
+ } catch (Exception e) {
+ log.info("同步基础信息失败请异常处理:" + fileName + "异常信息:" + e, e.getMessage());
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @description: 获取最早的文件名
+ * @return: fileName
+ * @author linjj
+ * @date: 2024/12/12 11:36
+ */
+ private String getEarlyFileName() {
+ // 创建File对象,代表指定的目录
+ File directory = new File(emr_pdf_files);
+ // 确保目录存在
+ if (!directory.isDirectory()) {
+ System.out.println("目录不存在");
+ log.info("目录不存在");
+ return null;
+ }
+ // 获取目录下所有文件和文件夹
+ File[] files = directory.listFiles(file -> file.isDirectory());
+ if (files.length == 0) {
+ log.info("文件夹为空");
+ return null;
+ }
+ // 初始化最早文件夹和最早时间戳
+ File oldestFile = null;
+ long oldestTime = Long.MAX_VALUE;
+ // 遍历所有文件夹
+ for (File folder : files) {
+ // 获取文件夹的最后修改时间
+ long lastModified = folder.lastModified();
+ // 如果当前文件夹的修改时间更早,则更新最早文件夹和时间戳
+ if (lastModified < oldestTime) {
+ oldestTime = lastModified;
+ oldestFile = folder;
+ }
+ }
+ // 输出创建时间最早的文件信息
+ if (oldestFile == null) {
+ log.info("没有找到复合条件的文件信息");
+ return null;
+ }
+ //最早的文件名
+ String fileName = oldestFile.getName();
+ log.info("当前操作文件夹信息为:" + fileName);
+ return fileName;
+ }
+
+ /**
+ * @description: 复制目录方法
+ * @params: source
+ * @params: target
+ * @author linjj
+ * @date: 2024/12/12 16:06
+ */
+ public static void copyDirectory(Path source, Path target) throws Exception {
+ // 如果目标目录不存在,则创建它
+ if (!Files.exists(target)) {
+ Files.createDirectories(target);
+ }
+ // 使用DirectoryStream遍历源目录中的所有文件和子目录
+ try (DirectoryStream directoryStream = Files.newDirectoryStream(source)) {
+ for (Path path : directoryStream) {
+ Path targetPath = target.resolve(source.relativize(path));
+ //存在相同文件时REPLACE_EXISTING会替换掉相同的文件夹
+ Files.copy(path, targetPath, StandardCopyOption.REPLACE_EXISTING);
+ //在复制完成后删除对应的源文件
+ Files.delete(path); // 删除源文件
+ }
+ //复制成功后将源地址文件删除
+ Files.delete(source);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/shibofu/spring/util/BusinessException.java b/src/main/java/com/example/util/BusinessException.java
similarity index 94%
rename from src/main/java/com/shibofu/spring/util/BusinessException.java
rename to src/main/java/com/example/util/BusinessException.java
index 3ddf868..b5dc39e 100644
--- a/src/main/java/com/shibofu/spring/util/BusinessException.java
+++ b/src/main/java/com/example/util/BusinessException.java
@@ -1,4 +1,4 @@
-package com.shibofu.spring.util;
+package com.example.util;
diff --git a/src/main/java/com/example/util/CommonResult.java b/src/main/java/com/example/util/CommonResult.java
new file mode 100644
index 0000000..c1cb0aa
--- /dev/null
+++ b/src/main/java/com/example/util/CommonResult.java
@@ -0,0 +1,152 @@
+package com.example.util;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ *
+ * @author docus
+ * @date 2020/3/28 16:23
+ */
+@Data
+@ApiModel("响应")
+@AllArgsConstructor
+@NoArgsConstructor
+public class CommonResult {
+ @ApiModelProperty("响应码")
+ private Integer code;
+ @ApiModelProperty("响应消息")
+ private String msg;
+ @ApiModelProperty("响应实体")
+ private T data;
+
+ public CommonResult(Integer code, String msg) {
+ this.code = code;
+ this.msg = msg;
+ }
+
+ /**
+ * 成功返回结果
+ *
+ * @param data 获取的数据
+ * @param
+ * @return
+ */
+ public static CommonResult success(T data) {
+ return new CommonResult(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data);
+ }
+
+ /**
+ * 成功返回结果
+ *
+ * @param data 获取的数据
+ * @param message 提示信息
+ * @param
+ * @return
+ */
+ public static CommonResult success(T data, String message) {
+ return new CommonResult(ResultCode.SUCCESS.getCode(), message, data);
+ }
+
+ /**
+ * 失败返回结果
+ *
+ * @param errorCode 错误码
+ * @param
+ * @return
+ */
+ public static CommonResult failed(IErrorCode errorCode) {
+ return new CommonResult(errorCode.getCode(), errorCode.getMessage(), null);
+ }
+
+ /**
+ * 失败返回结果
+ *
+ * @param errorCode 错误码
+ * @param message 提示信息
+ * @param
+ * @return
+ */
+ public static CommonResult failed(IErrorCode errorCode, String message) {
+ return new CommonResult(errorCode.getCode(), message, null);
+ }
+
+ /**
+ * 失败返回结果
+ *
+ * @param message 提示信息
+ * @param
+ * @return
+ */
+ public static CommonResult failed(String message) {
+ return new CommonResult(ResultCode.FAILED.getCode(), message, null);
+ }
+
+
+ /**
+ * 失败返回结果
+ *
+ * @param
+ * @return
+ */
+ public static CommonResult failed() {
+ return failed(ResultCode.FAILED);
+ }
+
+ /**
+ * 参数验证失败返回结果
+ *
+ * @param
+ * @return
+ */
+ public static CommonResult validateFailed() {
+ return failed(ResultCode.VALIDATE_FAILED);
+ }
+
+ /**
+ * 提示信息
+ *
+ * @param message 提示信息
+ * @param
+ * @return
+ */
+ public static CommonResult validateFailed(String message) {
+ return new CommonResult(ResultCode.VALIDATE_FAILED.getCode(), message, null);
+ }
+
+ /**
+ * 未登录返回结果
+ *
+ * @param data 获取的数据
+ * @param
+ * @return
+ */
+ public static CommonResult unauthorized(T data) {
+ return new CommonResult(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getMessage(), data);
+ }
+
+ /**
+ * 重防及重复请求
+ *
+ * @param data 获取的数据
+ * @param
+ * @return
+ */
+ public static CommonResult preventreplay(T data) {
+ return new CommonResult(ResultCode.PREVENT_REPLAY.getCode(), ResultCode.PREVENT_REPLAY.getMessage(), data);
+ }
+
+ /**
+ * 未授权返回结果
+ *
+ * @param data 获取的数据
+ * @param
+ * @return
+ */
+ public static CommonResult forbidden(T data) {
+ return new CommonResult(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getMessage(), data);
+ }
+}
diff --git a/src/main/java/com/shibofu/spring/util/ExceptionCode.java b/src/main/java/com/example/util/ExceptionCode.java
similarity index 92%
rename from src/main/java/com/shibofu/spring/util/ExceptionCode.java
rename to src/main/java/com/example/util/ExceptionCode.java
index ce7a2a2..343a4ab 100644
--- a/src/main/java/com/shibofu/spring/util/ExceptionCode.java
+++ b/src/main/java/com/example/util/ExceptionCode.java
@@ -1,4 +1,4 @@
-package com.shibofu.spring.util;
+package com.example.util;
public enum ExceptionCode {
diff --git a/src/main/java/com/example/util/FieldSelector.java b/src/main/java/com/example/util/FieldSelector.java
new file mode 100644
index 0000000..192fa19
--- /dev/null
+++ b/src/main/java/com/example/util/FieldSelector.java
@@ -0,0 +1,12 @@
+package com.example.util;
+
+/**
+ * @InterfaceName FieldSelector
+ * @Description
+ * @Author linjj
+ * @Date 2023/6/29 16:41
+ * @Version 1.0
+ */
+public interface FieldSelector {
+ FieldType select(Type type);
+}
diff --git a/src/main/java/com/example/util/IErrorCode.java b/src/main/java/com/example/util/IErrorCode.java
new file mode 100644
index 0000000..62543f7
--- /dev/null
+++ b/src/main/java/com/example/util/IErrorCode.java
@@ -0,0 +1,12 @@
+package com.example.util;
+
+/**
+ * @Description 封装API的错误码
+ * @Author JacksonTu
+ * @Date 2020/3/28 16:26
+ */
+public interface IErrorCode {
+ Integer getCode();
+
+ String getMessage();
+}
diff --git a/src/main/java/com/shibofu/spring/util/JsonResult.java b/src/main/java/com/example/util/JsonResult.java
similarity index 96%
rename from src/main/java/com/shibofu/spring/util/JsonResult.java
rename to src/main/java/com/example/util/JsonResult.java
index 09d6fd7..2f1223b 100644
--- a/src/main/java/com/shibofu/spring/util/JsonResult.java
+++ b/src/main/java/com/example/util/JsonResult.java
@@ -1,4 +1,4 @@
-package com.shibofu.spring.util;
+package com.example.util;
import java.io.Serializable;
import java.util.HashMap;
diff --git a/src/main/java/com/example/util/ListUtil.java b/src/main/java/com/example/util/ListUtil.java
new file mode 100644
index 0000000..b796d3a
--- /dev/null
+++ b/src/main/java/com/example/util/ListUtil.java
@@ -0,0 +1,73 @@
+package com.example.util;
+
+import org.springframework.util.CollectionUtils;
+
+import java.util.*;
+
+public final class ListUtil {
+ public static Map toMap(List list, FieldSelector selector) {
+ if (CollectionUtils.isEmpty(list)) return Collections.emptyMap();
+ Map 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 Map> groupBy(List list, FieldSelector selector) {
+ if (CollectionUtils.isEmpty(list)) return Collections.emptyMap();
+ Map> 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());
+ }
+ map.get(key).add(t);
+ }
+ return map;
+ }
+
+ public static List select(List list, FieldSelector selector) {
+ if (CollectionUtils.isEmpty(list)) return Collections.emptyList();
+ List filedList = new ArrayList<>(list.size());
+ for (T t : list) {
+ K key = selector.select(t);
+ if (key != null) filedList.add(key);
+ }
+ return filedList;
+ }
+
+ public static List distinctSelect(List list, FieldSelector selector) {
+ if (CollectionUtils.isEmpty(list)) return Collections.emptyList();
+ Set 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 List unionWithoutDuplicate(List... values) {
+ if (null == values || values.length <= 0) return Collections.emptyList();
+ Set unionFiledSet = new HashSet<>();
+ for (List value : values) {
+ if (!CollectionUtils.isEmpty(value)) {
+ unionFiledSet.addAll(value);
+ }
+ }
+ return new ArrayList<>(unionFiledSet);
+ }
+
+ public static List skipDuplicateKey(List list, FieldSelector selector) {
+ if (CollectionUtils.isEmpty(list)) return Collections.emptyList();
+ List filedList = new ArrayList<>(list.size());
+ Map map = toMap(list, selector);
+ for (K key : map.keySet()) {
+ filedList.add(map.get(key));
+ }
+ return filedList;
+ }
+}
diff --git a/src/main/java/com/shibofu/spring/util/Msg.java b/src/main/java/com/example/util/Msg.java
similarity index 97%
rename from src/main/java/com/shibofu/spring/util/Msg.java
rename to src/main/java/com/example/util/Msg.java
index 8478f0e..6f898fc 100644
--- a/src/main/java/com/shibofu/spring/util/Msg.java
+++ b/src/main/java/com/example/util/Msg.java
@@ -1,7 +1,7 @@
/**
*
*/
-package com.shibofu.spring.util;
+package com.example.util;
import java.util.HashMap;
import java.util.Map;
diff --git a/src/main/java/com/example/util/ResultCode.java b/src/main/java/com/example/util/ResultCode.java
new file mode 100644
index 0000000..f12a66a
--- /dev/null
+++ b/src/main/java/com/example/util/ResultCode.java
@@ -0,0 +1,42 @@
+package com.example.util;
+
+
+/**
+ * @Description 枚举一些常用API操作码
+ * @Author JacksonTu
+ * @Date 2020/3/28 16:26
+ */
+public enum ResultCode implements IErrorCode {
+
+ SUCCESS(0, "操作成功"),
+ FAILED(500, "操作失败"),
+ VALIDATE_FAILED(404, "参数检验失败"),
+ UNAUTHORIZED(401, "暂未登录或token已经过期"),
+ FORBIDDEN(403, "没有相关权限"),
+ PREVENT_REPLAY(405,"重复请求"),
+ NOT_EXIST(601,"数据不存在"),
+ NOT_ENABLE(600,"数据未启用");
+
+
+
+
+ private Integer code;
+ private String message;
+
+ private ResultCode(Integer code, String message) {
+ this.code = code;
+ this.message = message;
+ }
+
+ @Override
+ public Integer getCode() {
+ return code;
+ }
+
+ @Override
+ public String getMessage() {
+ return message;
+ }
+
+
+}
diff --git a/src/main/java/com/shibofu/spring/vo/ArchiveDetailVo.java b/src/main/java/com/example/vo/ArchiveDetailVo.java
similarity index 87%
rename from src/main/java/com/shibofu/spring/vo/ArchiveDetailVo.java
rename to src/main/java/com/example/vo/ArchiveDetailVo.java
index 63f20d3..d2d03b0 100644
--- a/src/main/java/com/shibofu/spring/vo/ArchiveDetailVo.java
+++ b/src/main/java/com/example/vo/ArchiveDetailVo.java
@@ -1,4 +1,4 @@
-package com.shibofu.spring.vo;
+package com.example.vo;
import lombok.Data;
diff --git a/src/main/java/com/example/vo/ArchiveMasterVo.java b/src/main/java/com/example/vo/ArchiveMasterVo.java
new file mode 100644
index 0000000..62bb20d
--- /dev/null
+++ b/src/main/java/com/example/vo/ArchiveMasterVo.java
@@ -0,0 +1,44 @@
+package com.example.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @ClassName ArchiveMasterVo
+ * @Description 患者基础信息
+ * @Author linjj
+ * @Date 2024/12/11 13:57
+ * @Version 1.0
+ */
+@Data
+public class ArchiveMasterVo {
+
+ @ApiModelProperty(value = "病人id")
+ private String SICK_ID;
+ @ApiModelProperty(value = "住院号")
+ private String RESIDENCE_NO;
+ @ApiModelProperty(value = "住院次数")
+ private String VISIT_NUMBER;
+ @ApiModelProperty(value = "姓名")
+ private String NAME;
+ @ApiModelProperty(value = "性别")
+ private String SEX;
+ @ApiModelProperty(value = "入院时间")
+ private String ADMISSION_TIME;
+ @ApiModelProperty(value = "出院时间")
+ private String DISCHARGE_TIME;
+ @ApiModelProperty(value = "出院科室")
+ private String DETP_NAME;
+ @ApiModelProperty(value = "出院科室编码")
+ private String DEPT_CODE;
+ @ApiModelProperty(value = "入院科室编码")
+ private String ADMISSION_DEPT_CODE;
+ @ApiModelProperty(value = "身份证号")
+ private String ID_CARD_NO;
+
+ @ApiModelProperty(value = "主管医生")
+ private String DOCTOR;
+
+ @ApiModelProperty(value = "状态")
+ private String STATUS;
+}
diff --git a/src/main/java/com/example/vo/GetZdAssortVo.java b/src/main/java/com/example/vo/GetZdAssortVo.java
new file mode 100644
index 0000000..44760f8
--- /dev/null
+++ b/src/main/java/com/example/vo/GetZdAssortVo.java
@@ -0,0 +1,20 @@
+package com.example.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @ClassName GetZdAssortVo
+ * @Description 获取分段id
+ * @Author linjj
+ * @Date 2024/12/12 16:52
+ * @Version 1.0
+ */
+@Data
+public class GetZdAssortVo {
+ @ApiModelProperty(value = "分段名称")
+ private String assortName;
+
+ @ApiModelProperty(value = "分段Id")
+ private String assortId;
+}
diff --git a/src/main/java/com/example/vo/QualityVo.java b/src/main/java/com/example/vo/QualityVo.java
new file mode 100644
index 0000000..ccf5f73
--- /dev/null
+++ b/src/main/java/com/example/vo/QualityVo.java
@@ -0,0 +1,16 @@
+package com.example.vo;
+
+import lombok.Data;
+
+/**
+ * @ClassName QualityVo
+ * @Description 质检查询返回
+ * @Author linjj
+ * @Date 2025/1/14 15:44
+ * @Version 1.0
+ */
+@Data
+public class QualityVo {
+
+ private String patientId;
+}
diff --git a/src/main/java/com/shibofu/spring/controller/MoneyController.java b/src/main/java/com/shibofu/spring/controller/MoneyController.java
deleted file mode 100644
index 30085cd..0000000
--- a/src/main/java/com/shibofu/spring/controller/MoneyController.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.shibofu.spring.controller;
-
-import com.shibofu.spring.db1.service.ECGPollingService;
-import com.shibofu.spring.db1.serviceImpl.ECGPollingServiceImpl;
-import com.shibofu.spring.util.Msg;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author potter.fu
- * @date 2018-12-07 15:38
- */
-@RestController
-@RequestMapping("/makeUp")
-public class MoneyController {
- @Autowired
- private ECGPollingService ecgPollingService;
-
-
- @GetMapping("/makeUpECG")
- public Msg makeUpByNeed() {
- Msg msg = ecgPollingService.ECGDayPolling();
- return msg;
- }
-
- @GetMapping("/makeUpECGByPatientId")
- public Msg makeUpECGByPatientId(String patientId) {
- Msg msg = ecgPollingService.ECGDayPollingByPatientId(patientId);
- return msg;
- }
-
- @GetMapping("/makeUpTime")
- public Msg makeUp() {
- return ecgPollingService.makeUp();
- }
-
-
-}
diff --git a/src/main/java/com/shibofu/spring/db1/dao/ArchiveDetailDao.java b/src/main/java/com/shibofu/spring/db1/dao/ArchiveDetailDao.java
deleted file mode 100644
index 8cd401a..0000000
--- a/src/main/java/com/shibofu/spring/db1/dao/ArchiveDetailDao.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.shibofu.spring.db1.dao;
-
-import com.shibofu.spring.dto.ArchiveDetailDto;
-import com.shibofu.spring.vo.ArchiveDetailVo;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @InterfaceName ArchiveDetailDao
- * @Description 操作文件表接口
- * @Author linjj
- * @Date 2024/1/19 9:01
- * @Version 1.0
- */
-@Mapper
-public interface ArchiveDetailDao {
-
- boolean addArchiveDetail(@Param("list") List list);
-
- List getArchiveDetailBySourceAndMid(@Param("source")String source,@Param("mid")String mid);
-
- boolean delDetailBySourceAndMid(@Param("source")String source,@Param("mid")String mid);
-
-}
diff --git a/src/main/java/com/shibofu/spring/db1/dao/ArchiveMasterDao.java b/src/main/java/com/shibofu/spring/db1/dao/ArchiveMasterDao.java
deleted file mode 100644
index 0c77d19..0000000
--- a/src/main/java/com/shibofu/spring/db1/dao/ArchiveMasterDao.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.shibofu.spring.db1.dao;
-
-import com.shibofu.spring.vo.ArchiveMasterVo;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.List;
-
-/**
- * @InterfaceName ArchiveMasterDao
- * @Description
- * @Author linjj
- * @Date 2024/1/18 9:47
- * @Version 1.0
- */
-@Mapper
-public interface ArchiveMasterDao {
- //查询24小时内出院病历
- List PollingECG();
- //根据记帐号查询病历
- List PollingECGByPatientId(String patientId);
- //整年心电数据补偿
- List makeUp();
-
-}
diff --git a/src/main/java/com/shibofu/spring/db1/service/ECGPollingService.java b/src/main/java/com/shibofu/spring/db1/service/ECGPollingService.java
deleted file mode 100644
index a06a29d..0000000
--- a/src/main/java/com/shibofu/spring/db1/service/ECGPollingService.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.shibofu.spring.db1.service;
-
-import com.shibofu.spring.util.Msg;
-
-/**
- * @InterfaceName ECGPollingService
- * @Description 心电接口
- * @Author linjj
- * @Date 2024/7/8 8:55
- * @Version 1.0
- */
-public interface ECGPollingService {
-
-
- /**
- * @description: 定时查询每天出院患者
- * @author linjj
- * @date: 2024/1/18 9:29
- */
- Msg ECGDayPolling() ;
-
- Msg ECGDayPollingByPatientId(String patientId);
-
- Msg makeUp();
-}
diff --git a/src/main/java/com/shibofu/spring/db1/serviceImpl/ECGPollingServiceImpl.java b/src/main/java/com/shibofu/spring/db1/serviceImpl/ECGPollingServiceImpl.java
deleted file mode 100644
index b210595..0000000
--- a/src/main/java/com/shibofu/spring/db1/serviceImpl/ECGPollingServiceImpl.java
+++ /dev/null
@@ -1,233 +0,0 @@
-package com.shibofu.spring.db1.serviceImpl;
-
-import com.shibofu.spring.db1.dao.ArchiveDetailDao;
-import com.shibofu.spring.db1.dao.ArchiveMasterDao;
-import com.shibofu.spring.db1.service.ECGPollingService;
-import com.shibofu.spring.db2.dao.ECGDao;
-import com.shibofu.spring.dto.ArchiveDetailDto;
-import com.shibofu.spring.util.Msg;
-import com.shibofu.spring.vo.ArchiveDetailVo;
-import com.shibofu.spring.vo.ArchiveMasterVo;
-import com.shibofu.spring.vo.ECGVo;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @ClassName ECGPollingServiceImpl
- * @Description 心电接口
- * @Author linjj
- * @Date 2024/7/8 8:55
- * @Version 1.0
- */
-@Service
-@Slf4j
-public class ECGPollingServiceImpl implements ECGPollingService {
-
- @Autowired
- private ArchiveMasterDao archiveMasterDao;
- @Autowired
- private ECGDao ecgDao;
- @Value("${savePath}")
- private String savePath;
- @Autowired
- private ArchiveDetailDao archiveDetailDao;
-
- @Override
- public Msg ECGDayPolling() {
- //查询当前时间24小时内需要采集数据
- List archiveMasters = archiveMasterDao.PollingECG();
- if (CollectionUtils.isEmpty(archiveMasters)) {
- log.info("当前时间段查询不到心跳数据");
- return Msg.success("当前时间段查询不到心跳数据");
- }
- log.info("--------------------------------------------当前时间段心电需要采集:" + archiveMasters.size() + "个患者--------------------------------------------");
- //循环所有患者采集
- for (ArchiveMasterVo list : archiveMasters) {
- log.info("---------------------开始采集记帐号为:" + list.getPatientId() + "的患者---------------------");
- List ecgs = ecgDao.getECG(list.getPatientId());
- if (CollectionUtils.isEmpty(ecgs)) {
- log.info("记帐号为:" + list.getPatientId() + "的患者没有心电数据");
- continue;
- }
- //获取需要插入archiveDetai表数据
- ArrayList archiveDetailList = getArchiveDetailDtos(list, ecgs);
- if (CollectionUtils.isEmpty(archiveDetailList)) {
- log.info("记帐号为:" + list.getPatientId()+"没有保存文件表数据");
- continue;
- }
- //更新文件表
- updateArchiveDetail(list, archiveDetailList);
- }
- log.info("--------------------------------------------此时间段采集完成--------------------------------------------");
- return Msg.success("此时间段采集完成");
- }
-
- @Override
- public Msg ECGDayPollingByPatientId(String patientId){
- List archiveMasters = archiveMasterDao.PollingECGByPatientId(patientId);
- if (CollectionUtils.isEmpty(archiveMasters)) {
- log.info("当前时间段查询不到心跳数据");
- return Msg.success("当前时间段查询不到心跳数据");
- }
- log.info("--------------------------------------------心电按需:" + archiveMasters.size() + "个患者--------------------------------------------");
- //循环所有患者采集
- for (ArchiveMasterVo list : archiveMasters) {
- log.info("---------------------开始采集记帐号为:" + list.getPatientId() + "的患者---------------------");
- List ecgs = ecgDao.getECG(list.getPatientId());
- if (CollectionUtils.isEmpty(ecgs)) {
- log.info("记帐号为:" + list.getPatientId() + "的患者没有心电数据");
- continue;
- }
- //获取需要插入archiveDetai表数据
- ArrayList archiveDetailList = getArchiveDetailDtos(list, ecgs);
- if (CollectionUtils.isEmpty(archiveDetailList)) {
- log.info("记帐号为:" + list.getPatientId()+"没有保存文件表数据");
- continue;
- }
- //更新文件表
- updateArchiveDetail(list, archiveDetailList);
- }
- log.info("--------------------------------------------心电按需采集完成--------------------------------------------");
- return Msg.success("心电按需采集完成");
- }
-
- @Override
- public Msg makeUp() {
- List archiveMasters = archiveMasterDao.makeUp();
- if (CollectionUtils.isEmpty(archiveMasters)) {
- log.info("当前时间段查询不到心跳数据");
- return Msg.success("当前时间段查询不到心跳数据");
- }
- log.info("--------------------------------------------心电补偿:" + archiveMasters.size() + "个患者--------------------------------------------");
- //循环所有患者采集
- for (ArchiveMasterVo list : archiveMasters) {
- log.info("---------------------开始采集记帐号为:" + list.getPatientId() + "的患者---------------------");
- List ecgs = ecgDao.getECG(list.getPatientId());
- if (CollectionUtils.isEmpty(ecgs)) {
- log.info("记帐号为:" + list.getPatientId() + "的患者没有心电数据");
- continue;
- }
- //获取需要插入archiveDetai表数据
- ArrayList archiveDetailList = getArchiveDetailDtos(list, ecgs);
- if (CollectionUtils.isEmpty(archiveDetailList)) {
- log.info("记帐号为:" + list.getPatientId()+"没有保存文件表数据");
- continue;
- }
- //更新文件表
- updateArchiveDetail(list, archiveDetailList);
- }
- log.info("--------------------------------------------心电补偿采集完成--------------------------------------------");
- return Msg.success("心电补偿采集完成");
- }
- //更新文件表数据
- private void updateArchiveDetail(ArchiveMasterVo list, ArrayList archiveDetailList) {
- //判断是否存在数据,存在删除并且删除原文件
- List ecgList = archiveDetailDao.getArchiveDetailBySourceAndMid("ECG", list.getId());
- if (!CollectionUtils.isEmpty(ecgList)) {
- archiveDetailDao.delDetailBySourceAndMid("ECG", list.getId());
- //删除原文件数据
- deleteFliepath(ecgList);
- }
- if (archiveDetailDao.addArchiveDetail(archiveDetailList)){
- log.info("记帐号为:" + list.getPatientId()+"采集了"+ archiveDetailList.size()+"张图像");
- }
- }
-
- private ArrayList getArchiveDetailDtos(ArchiveMasterVo list, List ecgs) {
- ArrayList archiveDetailList = null;
- try {
- String filePathdir;
- //文件保存目录
- filePathdir = savePath + File.separatorChar + list.getPatientId();
- // 本地磁盘的路径
- Path localPath = Paths.get(filePathdir);
- //确保目录存在
- if (createDirectory(localPath)) return null;
- //保存文件表集合
- archiveDetailList = new ArrayList<>();
- //患者所有心电记录采集到本地磁盘
- for (ECGVo ecg : ecgs) {
- String newPath;
- String pPath = ecg.getPPath();
- //使用yyyyMMddHHmmssSSS格式作为文件名
- Date date = new Date();
- SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
- String newDate = format.format(date);
- String savaPath = filePathdir + File.separatorChar + newDate + ".PDF";
- if (pPath.contains("E:\\ecgdata\\ECG")) {
- newPath = pPath.replace("E:\\ecgdata\\ECG", "Z:");
- } else {
- newPath = pPath.replace("E:\\ECGDATA\\ECG", "Z:");
- }
- // 构建网络文件的完整路径
- Path networkFilePath = Paths.get(newPath);
- // 从网络磁盘拷贝文件到本地磁盘
- try {
- Files.copy(networkFilePath, Paths.get(savaPath));
- } catch (Exception e) {
- log.error("记帐号为:" + list.getPatientId() + "的病历文件名为:" + networkFilePath.getFileName() + "的文件拷贝失败", e);
- continue;
- }
- if (new File(savaPath).exists()) {
- //组织保存文件表数据
- ArchiveDetailDto archiveDetailDto = new ArchiveDetailDto();
- archiveDetailDto.setMasterId(list.getId());
- archiveDetailDto.setUploadDateTime(new Date());
- archiveDetailDto.setAssortId("DA342ED81CEE4A8EA827424626F3F577");
- archiveDetailDto.setSource("ECG");
- archiveDetailDto.setFlag("0");
- archiveDetailDto.setSys("ECG");
- archiveDetailDto.setTitle("心电图报告");
- archiveDetailDto.setPdfPath(savaPath);
- archiveDetailList.add(archiveDetailDto);
- }else {
- log.error("记帐号为:" + list.getPatientId() + "的病历文件名为:" + networkFilePath.getFileName() + "为损坏文件");
- }
-
- }
- } catch (Exception e) {
- log.error("记帐号为:" + list.getPatientId() + "的病历异常处理");
- return null;
- }
- return archiveDetailList;
- }
-
-
- private void deleteFliepath(List ecgList) {
- for (ArchiveDetailVo list : ecgList) {
- File file = new File(list.getPdfPath());
- try {
- file.delete(); // 删除照片
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- private static boolean createDirectory(Path localPath) {
- try {
- if (!Files.exists(localPath)) {
- Files.createDirectories(localPath);
- }
- } catch (IOException e) {
- log.error(e.getMessage());
- return true;
- }
- return false;
- }
-}
diff --git a/src/main/java/com/shibofu/spring/db2/dao/ECGDao.java b/src/main/java/com/shibofu/spring/db2/dao/ECGDao.java
deleted file mode 100644
index afc5da8..0000000
--- a/src/main/java/com/shibofu/spring/db2/dao/ECGDao.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.shibofu.spring.db2.dao;
-
-import com.shibofu.spring.vo.ECGVo;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @ClassName ECGDao
- * @Description 心跳接口
- * @Author linjj
- * @Date 2024/7/8 9:05
- * @Version 1.0
- */
-@Mapper
-public interface ECGDao {
-
- List getECG(@Param("patientID") String patientID);
-}
diff --git a/src/main/java/com/shibofu/spring/db2/service/MoneyService.java b/src/main/java/com/shibofu/spring/db2/service/MoneyService.java
deleted file mode 100644
index 257164a..0000000
--- a/src/main/java/com/shibofu/spring/db2/service/MoneyService.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.shibofu.spring.db2.service;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * @author potter.fu
- * @date 2018-12-07 15:34
- */
-@Service
-public class MoneyService {
-
-
-
-}
diff --git a/src/main/java/com/shibofu/spring/dto/ArchiveDetailDto.java b/src/main/java/com/shibofu/spring/dto/ArchiveDetailDto.java
deleted file mode 100644
index c101078..0000000
--- a/src/main/java/com/shibofu/spring/dto/ArchiveDetailDto.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.shibofu.spring.dto;
-
-import lombok.Data;
-
-import java.util.Date;
-
-/**
- * @ClassName ArchiveDetailDto
- * @Description 保存文件表记录dto
- * @Author linjj
- * @Date 2024/1/18 17:29
- * @Version 1.0
- */
-@Data
-public class ArchiveDetailDto {
- //文件id
- private String id;
- //文件路径
- private String pdfPath;
- //病案id
- private String masterId;
- //生成时间
- private Date uploadDateTime;
- //分段id
- private String assortId;
- //来源
- private String source;
- //来源id
- private String subAssort;
- //文件名
- private String title;
- private String flag;
- private String sys;
-}
diff --git a/src/main/java/com/shibofu/spring/dto/ArchiveMasterDto.java b/src/main/java/com/shibofu/spring/dto/ArchiveMasterDto.java
deleted file mode 100644
index 78102d7..0000000
--- a/src/main/java/com/shibofu/spring/dto/ArchiveMasterDto.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.shibofu.spring.dto;
-
-import lombok.Data;
-
-/**
- * @ClassName ArchiveMasterVo
- * @Description
- * @Author linjj
- * @Date 2024/1/18 9:33
- * @Version 1.0
- */
-@Data
-public class ArchiveMasterDto {
- //病案id
- private String id;
- //患者姓名
- private String name;
- //住院次数
- private String visitId;
- //住院号
- private String inpNo;
- //入院时间
- private String admissionDateTime;
- //出院时间
- private String dischargeDateTime;
-}
diff --git a/src/main/java/com/shibofu/spring/quartz/ECGQuartz.java b/src/main/java/com/shibofu/spring/quartz/ECGQuartz.java
deleted file mode 100644
index cc94b29..0000000
--- a/src/main/java/com/shibofu/spring/quartz/ECGQuartz.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.shibofu.spring.quartz;
-
-
-
-import com.shibofu.spring.db1.service.ECGPollingService;
-import org.quartz.JobExecutionContext;
-import org.springframework.scheduling.quartz.QuartzJobBean;
-
-import javax.annotation.Resource;
-
-/**
- * @description: pacs定时任务采集
- * @author linjj
- * @date: 2024/1/18 9:22
- */
-public class ECGQuartz extends QuartzJobBean {
-
-
-
- @Resource
- private ECGPollingService ecgPollingService;
-
- @Override
- protected void executeInternal(JobExecutionContext jobExecutionContext) {
- //每天轮询查询昨天数据进来采集
- ecgPollingService.ECGDayPolling();
- }
-}
diff --git a/src/main/java/com/shibofu/spring/text/test.java b/src/main/java/com/shibofu/spring/text/test.java
deleted file mode 100644
index f6d3a95..0000000
--- a/src/main/java/com/shibofu/spring/text/test.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.shibofu.spring.text;
-
-import com.shibofu.spring.MainApplication;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-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.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import java.io.File;
-
-
-/**
- * @ClassName test
- * @Description 测试类
- * @Author linjj
- * @Date 2024/1/18 9:54
- * @Version 1.0
- */
-@SpringBootTest(classes = MainApplication.class)
-@RunWith(SpringRunner.class)
-@Slf4j
-public class test {
-
- @Value("${savePath}")
- private String savePath;
-
- private final static Logger logger = LoggerFactory.getLogger(test.class);
-
-
- @Test
- public void testDemo() {
- String newPath;
- String path = "E:\\ecgdata\\ECG\\2024-02-28\\1.2.826.0.1.3680043.2.377.114.21.20240228005228255.141737_1.PDF";
- if (path.contains("E:\\ecgdata\\ECG")) {
- newPath = path.replace("E:\\ecgdata\\ECG", "Z:");
- } else {
- newPath = path.replace("E:\\ECGDATA\\ECG", "Z:");
- }
-
- System.out.println("newPath" + newPath);
-
-
- }
-}
diff --git a/src/main/java/com/shibofu/spring/vo/ArchiveMasterVo.java b/src/main/java/com/shibofu/spring/vo/ArchiveMasterVo.java
deleted file mode 100644
index 80a885e..0000000
--- a/src/main/java/com/shibofu/spring/vo/ArchiveMasterVo.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.shibofu.spring.vo;
-
-import lombok.Data;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-/**
- * @ClassName ArchiveMasterVo
- * @Description
- * @Author linjj
- * @Date 2024/1/18 9:33
- * @Version 1.0
- */
-@Data
-public class ArchiveMasterVo {
-
- //病案id
- private String id;
- //患者姓名
- private String name;
- //住院次数
- private String visitId;
- //住院号
- private String inpNo;
- //入院时间
- private String admissionDateTime;
- //出院时间
- private String dischargeDateTime;
- //记帐号
- private String patientId;
-}
diff --git a/src/main/java/com/shibofu/spring/vo/ECGVo.java b/src/main/java/com/shibofu/spring/vo/ECGVo.java
deleted file mode 100644
index 2eed692..0000000
--- a/src/main/java/com/shibofu/spring/vo/ECGVo.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.shibofu.spring.vo;
-
-import lombok.Data;
-
-/**
- * @ClassName ECGVo
- * @Description 心跳返回实体类
- * @Author linjj
- * @Date 2024/7/8 9:09
- * @Version 1.0
- */
-@Data
-public class ECGVo {
- private String patientId;
-
- private String WriteDateTime;
-
- private String PPath;
-}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index eee5c82..2f0d267 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,27 +1,24 @@
server.port=3397
#sqlserver
-#spring.datasource.hikari.db1.jdbc-url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=yd_record
+#spring.datasource.hikari.db1.jdbc-url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=lz_record
#spring.datasource.hikari.db1.username=sa
#spring.datasource.hikari.db1.password=admin123
#spring.datasource.hikari.db1.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
-###sqlserver
-#spring.datasource.hikari.db2.jdbc-url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=qf_record
-#spring.datasource.hikari.db2.username=sa
-#spring.datasource.hikari.db2.password=admin123
-#spring.datasource.hikari.db2.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
-
-
-#sqlserver
-spring.datasource.hikari.db1.jdbc-url=jdbc:sqlserver://10.36.116.108:1433;DatabaseName=emr_record
+spring.datasource.hikari.db1.jdbc-url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=DB_PrivilegeManagement_LZRMYY
spring.datasource.hikari.db1.username=sa
-spring.datasource.hikari.db1.password=xjgs+docus911
+spring.datasource.hikari.db1.password=docus@904
spring.datasource.hikari.db1.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
-#ECG
-spring.datasource.hikari.db2.jdbc-url=jdbc:sqlserver://192.168.10.50:1433;DatabaseName=medexmemrsECG
-spring.datasource.hikari.db2.username=sa
-spring.datasource.hikari.db2.password=MedExSQLServerAdmin
-spring.datasource.hikari.db2.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
+#Oracle JDBC
+#spring.datasource.hikari.db2.jdbc-url=jdbc:oracle:thin:@127.0.0.1:1521:ORCL
+#spring.datasource.hikari.db2.username=system
+#spring.datasource.hikari.db2.password=lin589288
+#spring.datasource.hikari.db2.driver-class-name=oracle.jdbc.driver.OracleDriver
+spring.datasource.hikari.db2.jdbc-url=jdbc:oracle:thin:@//10.120.120.9:1521/lzrmyy
+spring.datasource.hikari.db2.username=jsgdxx
+spring.datasource.hikari.db2.password=JS!@2024
+spring.datasource.hikari.db2.driver-class-name=oracle.jdbc.driver.OracleDriver
+
# MyBatis-Plus ??
mybatis-plus.mapper-locations=classpath:mapper/db1/*.xml,classpath:mapper/db2/*.xml
-mybatis-plus.type-aliases-package=com.shibofu.spring.vo
+mybatis-plus.type-aliases-package=com.example.vo
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 6704c2f..e95f00d 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,4 +1,8 @@
-#文件保存路径
-savePath: F:\ECG\reload
-#定时补偿任务时间
-quartzTime: 0 0 3 * * ?
+#院方保存路径
+emr_pdf_files: F:\emr_pdf_files
+#归档文件保存路径
+save_pdf_files: F:\jiaShi_emr_pdf_files
+#定时任务时间
+#quartzTime: 0 0 3 * * ?
+
+quartzTime: 0/15 * * * * ?
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
index da608b4..b95f0db 100644
--- a/src/main/resources/logback.xml
+++ b/src/main/resources/logback.xml
@@ -14,7 +14,7 @@
true
- ECGLog/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log
+ Lz-scan/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log
diff --git a/src/main/resources/mapper/db1/ArchiveDetailDao.xml b/src/main/resources/mapper/db1/ArchiveDetailDao.xml
new file mode 100644
index 0000000..5b43796
--- /dev/null
+++ b/src/main/resources/mapper/db1/ArchiveDetailDao.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+ insert into
+ archive_detail(ID,PDF_PATH,MasterID,UpLoadDateTime,AssortID,Source,SubAssort,Title,flag,Sys,splitName
+ )
+ values
+
+ (replace(newid(), '-', ''),#{item.PDF_PATH},#{item.MasterID},#{item.UpLoadDateTime},#{item.AssortID},#{item.Source},
+ #{item.SubAssort},#{item.Title},#{item.flag},#{item.Sys},#{item.splitName})
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/db1/ArchiveDetailrMapper.xml b/src/main/resources/mapper/db1/ArchiveDetailrMapper.xml
deleted file mode 100644
index ef44ef3..0000000
--- a/src/main/resources/mapper/db1/ArchiveDetailrMapper.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
- insert into
- archive_detail(id,PDF_PATH,MasterID,UpLoadDateTime,AssortID,Source,Title,flag,Sys
- )
- values
-
- (replace(newid(), '-', ''),#{item.pdfPath},#{item.masterId},#{item.uploadDateTime},#{item.assortId},#{item.source},
- #{item.title},#{item.flag},#{item.sys})
-
-
-
- delete from archive_detail where MasterID=#{mid} and Source=#{source}
-
-
-
-
\ No newline at end of file
diff --git a/src/main/resources/mapper/db1/ArchiveMasterMapper.xml b/src/main/resources/mapper/db1/ArchiveMasterMapper.xml
index cde0ff1..f48f0e2 100644
--- a/src/main/resources/mapper/db1/ArchiveMasterMapper.xml
+++ b/src/main/resources/mapper/db1/ArchiveMasterMapper.xml
@@ -2,52 +2,21 @@
-
+
+
+ insert into Archive_Master (ID, patient_id, inp_no, visit_id, name, sex, dept_name,
+ discharge_date_time, ArchiveState,admission_date_time,dept_admission_to,
+ check_datetime,checked_datetime,DOCTOR_IN_CHARGE,ID_NO,split_name)
+ values (#{id}, #{patientId}, #{inpNo}, #{visitId}, #{name}, #{sex}, #{deptName},
+ #{dischargeDateTime},#{ArchiveState},#{admissionDateTime},#{deptAdmissionTo},#{checkDatetime},
+ #{checkedDatetime},#{DOCTOR_IN_CHARGE},#{ID_NO},#{splitName})
+
+
+ DELETE FROM Archive_Master WHERE ID=#{id};
+
-
-
-
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/db1/CommonTableMapper.xml b/src/main/resources/mapper/db1/CommonTableMapper.xml
new file mode 100644
index 0000000..67a521a
--- /dev/null
+++ b/src/main/resources/mapper/db1/CommonTableMapper.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+ insert into CommonTable (patient_id, admiss_id, admiss_times, inpatient_no, name, sex, id_card,
+ admiss_date, dis_date,dis_dept,attending,
+ dis_dept_name,admiss_doctor,splitName,ph,gdh)
+ values (#{patientId}, #{admissId}, #{admissTimes}, #{inpatientNo}, #{name}, #{sex}, #{idCard},
+ #{admissDate},#{disDate},#{disDept},#{attending},#{disDeptName},#{admissDoctor},#{splitName},#{ph},#{gdh})
+
+
+
+ UPDATE CommonTable
+ SET isPdf = #{dto.isPdf}
+ WHERE patient_id = #{dto.patientId}
+
+
+
+ DELETE FROM CommonTable WHERE patient_id=#{id};
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/db1/ZdAssortMapper.xml b/src/main/resources/mapper/db1/ZdAssortMapper.xml
new file mode 100644
index 0000000..2ea9ab2
--- /dev/null
+++ b/src/main/resources/mapper/db1/ZdAssortMapper.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/db2/ECGMapper.xml b/src/main/resources/mapper/db2/ECGMapper.xml
deleted file mode 100644
index d2b31c9..0000000
--- a/src/main/resources/mapper/db2/ECGMapper.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/resources/mapper/db2/MedicalDao.xml b/src/main/resources/mapper/db2/MedicalDao.xml
new file mode 100644
index 0000000..4a05f3d
--- /dev/null
+++ b/src/main/resources/mapper/db2/MedicalDao.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file