Compare commits

...

14 Commits

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

@ -0,0 +1 @@
{"lastExecuteDate":"2023-11-15"}

@ -9,7 +9,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>docus-webservice-gdszy</artifactId>
<artifactId>docus-collect-gdszy-patient-scan</artifactId>
<dependencies>
<dependency>
@ -47,10 +47,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.docus</groupId>
<artifactId>docus-mybatisplus-starter</artifactId>
</dependency>
<!--nacos-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
@ -99,6 +96,17 @@
<version>3.4.1</version>
<scope>compile</scope>
</dependency>
<!--mybatis plus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
@ -173,7 +181,12 @@
<scope>test</scope>
</dependency>
<!--sqlserver驱动-->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
</dependencies>
<build>
<resources>

@ -1,17 +1,13 @@
package com.docus.server;
import com.docus.core.util.SpringUtils;
import com.docus.server.collect.enums.DownWayEnum;
import com.docus.server.collect.service.FileReportService;
import com.docus.server.collect.service.dto.ReportFileInfoDTO;
import com.docus.infrastructure.core.utils.SpringUtil;
import com.docus.server.collect.job.PatScanFileSyncJob;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Properties;
/**
@ -31,39 +27,16 @@ public class CollectApplication {
props.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
SpringApplication.run(CollectApplication.class, args);
// testBase64Report();
// testCollectJob();
}
private static void testBase64Report() {
try {
String url=getBase64();
ReportFileInfoDTO dto = new ReportFileInfoDTO();
dto.setPatientId("20001099999");
dto.setSysFlag("icu");
dto.setSerialNum("0002353348_1229183645");
dto.setFileTitle("szy服务");
dto.setTaskId(2023060815440200002L);
dto.setDownUrl(url);
dto.setDownWayEnum(DownWayEnum.BASE64);
dto.setIp("szy-lis");
dto.setUserName("lis");
dto.setReportUserFullName("lis");
dto.setAssortId("list-assort");
FileReportService reportService = SpringUtils.getBean(FileReportService.class);
reportService.saveDownloadTaskAndReport(dto);
}catch (Exception ex){
ex.printStackTrace();
}
}
private static String getBase64() throws Exception {
FileReader reader = new FileReader("C:\\Users\\WYBDEV\\Desktop\\sb.txt");
BufferedReader bufferedReader = new BufferedReader(reader);
String base64 = bufferedReader.readLine();
bufferedReader.close();
reader.close();
return base64;
private static void testCollectJob() {
PatScanFileSyncJob bean = SpringUtil.getApplicationContext().getBean(PatScanFileSyncJob.class);
bean.patScanFileSyncByScanDateJob();
}
}

@ -0,0 +1,131 @@
package com.docus.server.collect.controller;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.exception.BaseException;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.collect.dto.PatientScanConditionDTO;
import com.docus.server.collect.entity.PatientScan;
import com.docus.server.collect.service.PatientScanService;
import com.docus.server.collect.service.PatientScanSynchronizer;
import com.docus.server.collect.service.dto.PatScanSyncResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
*
*
* @author wyb
*/
@Api("患者扫描控制")
@RestController
@RequestMapping("/gdszy/patscan")
@Slf4j
public class PatientScanController {
@Resource
private PatientScanService patientScanService;
@Resource
private PatientScanSynchronizer synchronizer;
@PostMapping("/get/byCondition")
@ApiOperation("根据条件,进行患者电子病历扫描数据查询,返回需要同步的数据!")
public CommonResult<List<PatientScan>> collectBybyCondition(@RequestBody List<PatientScanConditionDTO> patientScanConditionDTOList) {
if (Func.isEmpty(patientScanConditionDTOList)) {
return CommonResult.failed("请输入正确的请求参数!");
}
checkCondition(patientScanConditionDTOList);
for (PatientScanConditionDTO patientScanConditionDTO : patientScanConditionDTOList) {
patientScanConditionDTO.setDisDateTime(patientScanConditionDTO.getDisDate() + " 00:00:00");
}
return CommonResult.success(patientScanService.getScanDataByConditions(patientScanConditionDTOList));
}
private static void checkCondition(List<PatientScanConditionDTO> patientScanConditionDTOList) {
String pattern = "yyyy-MM-dd";
try {
for (PatientScanConditionDTO dto : patientScanConditionDTOList) {
Date date = Func.parseDate(dto.getDisDate(), pattern);
Objects.requireNonNull(date);
}
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
throw new BaseException("请正确填入出院日期,格式为 " + pattern);
}
}
public static void main(String[] args) {
PatientScanConditionDTO dto = new PatientScanConditionDTO();
System.out.println(dto);
checkCondition(Collections.singletonList(dto));
System.out.println(dto);
}
@PostMapping("/collect/collectByDisDate")
@ApiOperation("根据出院日期区间同步扫描患者数据 yyyy-MM-dd")
public CommonResult<PatScanSyncResult> collectByDisDate(@RequestParam String disDateStart, @RequestParam String disDateEnd) {
log.info("根据出院日期区间 {} —— {} 同步扫描患者数据接口。", disDateStart, disDateEnd);
LocalDate disDateStartDate = LocalDate.parse(disDateStart);
LocalDate disDateEndDate = LocalDate.parse(disDateEnd);
StringBuilder syncMsgStringBuilder = new StringBuilder();
int patientTotalCount = 0;
int successPatientCount = 0;
int fileCount = 0;
// 从开始时间一天一天的查询,直到超过了结束时间停止
while (!disDateStartDate.isAfter(disDateEndDate)) {
List<PatientScanConditionDTO> patientScanConditionDTOList = patientScanService.getScanPatientConditionByDisDate(disDateStartDate + " 00:00:00", disDateStartDate + " 23:59:59");
if (Func.isEmpty(patientScanConditionDTOList)) {
log.warn("出院时间:{} —— {} 没有可同步的扫描数据!", disDateStartDate + " 00:00:00", disDateStartDate + " 23:59:59");
disDateStartDate = disDateStartDate.plusDays(1);
continue;
}
for (PatientScanConditionDTO dto : patientScanConditionDTOList) {
String pattern = "yyyy-MM-dd";
String disDateTime = dto.getDisDateTime();
dto.setDisDate(disDateTime.substring(0, pattern.length()));
}
PatScanSyncResult scanSyncResult = synchronizer.sync("根据出院日期区间同步扫描患者数据接口", patientScanConditionDTOList);
patientTotalCount += scanSyncResult.getPatientTotalCount();
successPatientCount += scanSyncResult.getSuccessPatientCount();
fileCount += scanSyncResult.getFileCount();
syncMsgStringBuilder.append(scanSyncResult.getMsg());
disDateStartDate = disDateStartDate.plusDays(1);
}
PatScanSyncResult result = new PatScanSyncResult();
result.setPatientTotalCount(patientTotalCount);
result.setSuccessPatientCount(successPatientCount);
result.setFileCount(fileCount);
result.setMsg(syncMsgStringBuilder.toString());
return CommonResult.success(result);
}
@GetMapping("/collect/seal/collectBySealId")
@ApiOperation("根据封存id进行封存病案扫描视图采集")
@ApiImplicitParams({
@ApiImplicitParam(name = "sealId", value = "t_seal 的seal_id,封存id", required = true, dataTypeClass = String.class)
})
public CommonResult<PatScanSyncResult> collectByDisDate(@RequestParam("sealId") String sealId) {
String source = "根据封存id进行封存病案扫描视图采集";
log.info("{}封存id为:{}", source, sealId);
PatScanSyncResult result = synchronizer.syncSeal("source", sealId);
return CommonResult.success(result);
}
}

@ -1,6 +1,10 @@
package com.docus.server.collect.converter;
import com.docus.server.collect.entity.DownloadTask;
import com.docus.server.collect.entity.PatientScan;
import com.docus.server.collect.entity.TBasic;
import com.docus.server.collect.entity.TSeal;
import com.docus.server.collect.enums.DownWayEnum;
import com.docus.server.collect.enums.DownloadStateEnum;
import com.docus.server.collect.infrastructure.client.dto.ReportDownDto;
import com.docus.server.collect.infrastructure.client.dto.ReportDownPatientDto;
@ -20,6 +24,52 @@ import java.util.List;
@Slf4j
public class FileReportConverter {
/**
* ,id
* @param tBasic
* @param patientScan
* @return
*/
public ReportFileInfoDTO convertReportFileInfoDTO(TBasic tBasic, PatientScan patientScan) {
ReportFileInfoDTO fileInfoDTO = new ReportFileInfoDTO();
fileInfoDTO.setPatientId(tBasic.getPatientId());
fileInfoDTO.setInpatientNo(tBasic.getInpatientNo());
fileInfoDTO.setAdmisstimes(tBasic.getAdmissTimes());
fileInfoDTO.setJzh(tBasic.getJzh());
fileInfoDTO.setIp("gdszy-patsm-sync");
fileInfoDTO.setUserName("admin");
fileInfoDTO.setReportUserFullName("pat-sm");
fileInfoDTO.setSerialNum(patientScan.getId()+patientScan.getZdAssortName()+patientScan.getFileName());
fileInfoDTO.setAssortId(patientScan.getZdAssortId());
fileInfoDTO.setFileTitle(patientScan.getFileName().substring(0,patientScan.getFileName().indexOf(".")));
fileInfoDTO.setDownUrl(patientScan.getImagePath()+"/"+patientScan.getFileName());
fileInfoDTO.setDownWayEnum(DownWayEnum.SMB);
return fileInfoDTO;
}
/**
* -,id
* @param tSeal
* @param patientScan
* @return
*/
public ReportFileInfoDTO convertReportFileInfoDTO(TSeal tSeal, PatientScan patientScan) {
ReportFileInfoDTO fileInfoDTO = new ReportFileInfoDTO();
fileInfoDTO.setPatientId(tSeal.getPatientId());
fileInfoDTO.setInpatientNo(tSeal.getInpatientNo());
fileInfoDTO.setAdmisstimes(tSeal.getAdmissTimes());
fileInfoDTO.setJzh(tSeal.getJzh());
fileInfoDTO.setIp("gdszy-patsm-sync");
fileInfoDTO.setUserName("admin");
fileInfoDTO.setReportUserFullName("pat-sm");
fileInfoDTO.setSerialNum(patientScan.getId()+patientScan.getZdAssortName()+patientScan.getFileName());
fileInfoDTO.setAssortId(patientScan.getZdAssortId());
fileInfoDTO.setFileTitle(patientScan.getFileName().substring(0,patientScan.getFileName().indexOf(".")));
fileInfoDTO.setDownUrl(patientScan.getImagePath()+"/"+patientScan.getFileName());
fileInfoDTO.setDownWayEnum(DownWayEnum.SMB);
return fileInfoDTO;
}
/**
*

@ -0,0 +1,32 @@
package com.docus.server.collect.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
*
*
* @author wyb
*/
@Data
@ApiModel("患者扫描条件传输对象")
public class PatientScanConditionDTO {
@ApiModelProperty("住院号")
@NotBlank(message = "住院号不能为空!")
private String inpatientNo;
@ApiModelProperty("出院日期 yyyy-MM-dd")
@NotBlank(message = "出院日期不能为空!")
private String disDate;
@ApiModelProperty("病人姓名")
@NotBlank(message = "病人姓名不能为空!")
private String name;
@ApiModelProperty(value = "为出院日期的 00:00:00,只在后端查询中使用", hidden = true)
private String disDateTime;
}

@ -1,6 +1,5 @@
package com.docus.server.collect.dto;
import com.docus.server.collect.service.dto.ReportFileInfoDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -29,17 +28,19 @@ public class TBasicQrDto {
@ApiModelProperty(value = "记账号")
private String jzh;
@ApiModelProperty(value = "患者姓名")
private String name;
@ApiModelProperty(value = "省中医患者主索引号")
private String empId;
@ApiModelProperty(value = "是否忽略ph字段为1 则添加条件 ph is null")
private int ignorePh;
public TBasicQrDto() {
}
public TBasicQrDto(ReportFileInfoDTO fileInfoDTO) {
this.jzh = fileInfoDTO.getJzh();
this.patientId = fileInfoDTO.getPatientId();
this.inpatientNo = fileInfoDTO.getInpatientNo();
this.admissTimes = fileInfoDTO.getAdmisstimes();
;
}
}

@ -0,0 +1,112 @@
package com.docus.server.collect.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
*
* @author wyb
**/
@ApiModel(value = "DownloadTask对象", description = "文件生成下载任务")
@Data
@TableName("af_collect_task")
public class CollectTask implements Serializable {
@TableField("id")
@ApiModelProperty(value = "id 雪花算法")
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
@TableField("patient_id")
@ApiModelProperty(value = "病案主键")
private String patientId;
@TableField("sysflag")
@ApiModelProperty(value = "来源 1护理文书2 HIS电子病历3 Pacs检查4心电系统5手麻系统6 Lis检验7临床首页8长期医嘱 9临时医嘱10 省病案统计系统首页11 扫描首页;")
private String sysflag;
@TableField("start_time")
@ApiModelProperty(value = "开始时间")
private Date startTime;
@TableField("end_time")
@ApiModelProperty(value = "结束时间")
private Date endTime;
@TableField("state")
@ApiModelProperty(value = "任务状态 0未开始1:正在采集2采集错误3采集完成")
private String state;
@TableField("sync_time")
@ApiModelProperty(value = "同步时间")
private Date syncTime;
@TableField("recollect_time")
@ApiModelProperty(value = "最新重新采集时间")
private Date recollectTime;
@TableField("recollect_name")
@ApiModelProperty(value = "最新重新采集人")
private String recollectName;
@TableField("remark")
@ApiModelProperty(value = "备注")
private String remark;
@TableField("presult")
@ApiModelProperty(value = "presult")
private String presult;
@TableField("C1")
@ApiModelProperty(value = "报告唯一单号")
private String c1;
@TableField("C2")
@ApiModelProperty(value = "文件名称")
private String c2;
@TableField("C3")
@ApiModelProperty(value = "记账号")
private String c3;
@TableField("C4")
@ApiModelProperty(value = "c4")
private String c4;
@TableField("C5")
@ApiModelProperty(value = "c5")
private String c5;
@TableField("C6")
@ApiModelProperty(value = "c6")
private String c6;
@TableField("C7")
@ApiModelProperty(value = "c7")
private String c7;
@TableField("C8")
@ApiModelProperty(value = "c8")
private String c8;
@TableField("C9")
@ApiModelProperty(value = "c9")
private String c9;
@TableField("C10")
@ApiModelProperty(value = "c10")
private String c10;
}

@ -91,7 +91,7 @@ public class DownloadTask implements Serializable {
private String source;
@TableField("file_serial_num")
@ApiModelProperty(value = "来源或者采集器id")
@ApiModelProperty(value = "文件唯一流水号")
private String fileSerialNum;
@TableField("latest_report_user_name")

@ -0,0 +1,50 @@
package com.docus.server.collect.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* - pat_sm
* @author wyb
*/
@ApiModel(value = "患者扫描数据", description = "患者扫描数据")
@Data
public class PatientScan implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "患者主键")
private String id;
@ApiModelProperty(value = "住院号")
private String inpatientNo;
@ApiModelProperty(value = "住院次数")
private String admissTimes;
@ApiModelProperty(value = "病人姓名")
private String name;
@ApiModelProperty(value = "出院日期")
private String disDate;
@ApiModelProperty(value = "图像路径")
private String imagePath;
@ApiModelProperty(value = "文件名")
private String fileName;
@ApiModelProperty(value = "分段名称")
private String zdAssortName;
@ApiModelProperty(value = "分类id")
private String zdAssortId;
@ApiModelProperty(value = "扫描日期")
private String scanDate;
@ApiModelProperty(value = "扫描盘号")
private String ph;
}

@ -1,6 +1,5 @@
package com.docus.server.collect.entity;
import com.docus.server.collect.service.dto.ReportFileInfoDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -35,17 +34,5 @@ public class TBasic {
private String admissId;
@ApiModelProperty(value = "省中医患者主索引号")
private String empId;
// @ApiModelProperty(value = "省中医患者记账号")
// private String accountRegistration;
public TBasic() {
}
public TBasic(ReportFileInfoDTO fileInfoDTO) {
this.jzh = fileInfoDTO.getJzh();
this.patientId = fileInfoDTO.getPatientId();
this.inpatientNo = fileInfoDTO.getInpatientNo();
this.admissTimes = fileInfoDTO.getAdmisstimes();
;
}
}

@ -0,0 +1,66 @@
package com.docus.server.collect.entity;
import com.docus.server.collect.service.dto.ReportFileInfoDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author jiashi
* @since 2023-05-16
*/
@Data
@ApiModel(value="TSeal对象", description="在院封存")
public class TSeal implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "在院封存病案主键")
private String patientId;
@ApiModelProperty(value = "封存id")
private String sealId;
@ApiModelProperty(value = "住院号")
private String inpatientNo;
@ApiModelProperty(value = "住院就诊号")
private String jzh;
@ApiModelProperty(value = "患者姓名")
private String name;
@ApiModelProperty(value = "住院时间")
private Date admissDate;
@ApiModelProperty(value = "封存时间")
private Date sealDate;
@ApiModelProperty(value = "文件来源")
private Integer fileSource;
@ApiModelProperty(value = "就诊次数")
private Integer admissTimes;
@ApiModelProperty(value = "纸质是否签名 0否 1是")
private Integer signinfo;
@ApiModelProperty(value = "备注")
private String remark;
public TSeal() {
}
public TSeal(ReportFileInfoDTO dto) {
this.patientId=dto.getPatientId();
this.jzh = dto.getJzh();
this.inpatientNo = dto.getInpatientNo();
this.admissTimes = dto.getAdmisstimes();
}
}

@ -18,4 +18,8 @@ public interface DownloadPlatformService {
@ApiOperation("病案上报文件(通用)")
@RequestMapping(value = "/api/downplatform/report",method = RequestMethod.POST)
public CommonResult report(@RequestBody ReportDownDto resources);
@ApiOperation("封存病历上报文件(省中医使用)")
@RequestMapping(value = "/api/downplatform/sealReport",method = RequestMethod.POST)
public CommonResult sealReport(@RequestBody ReportDownDto resources);
}

@ -0,0 +1,26 @@
package com.docus.server.collect.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.server.collect.entity.CollectTask;
import com.docus.server.collect.service.dto.ReportFileInfoDTO;
/**
* dao
* @author wyb
*/
public interface CollectTaskDao extends IBaseDao<CollectTask> {
/**
* id
* @param reportFileInfoDTO
* @return id
*/
Long saveTask(ReportFileInfoDTO reportFileInfoDTO);
/**
* saveTask
* @param reportFileInfoDTO
* @return id
* @throws InterruptedException
*/
Long saveTaskUseLock(ReportFileInfoDTO reportFileInfoDTO) throws InterruptedException;
}

@ -2,9 +2,7 @@ package com.docus.server.collect.infrastructure.dao;
import com.docus.infrastructure.core.db.dao.IBaseDao;
import com.docus.server.collect.entity.DownloadTask;
import com.docus.server.collect.entity.TBasic;
import java.util.List;
import com.docus.server.collect.entity.TSeal;
/**
* -访
@ -12,13 +10,7 @@ import java.util.List;
* @author wyb
*/
public interface DownloadTaskDao extends IBaseDao<DownloadTask> {
/**
*
*
* @param tBasic
* @return
*/
List<TBasic> getBasicInfo(TBasic tBasic);
/**
@ -48,4 +40,19 @@ public interface DownloadTaskDao extends IBaseDao<DownloadTask> {
* @return idid
*/
Long getDownloadTaskIdFromDownFile(String patientId, String source, String serialNum);
/**
*
* @date 2024/1/10 16:52
* @author YongBin Wen
* @param seal
* @return com.docus.server.collect.entity.TSeal
*/
TSeal findSealByCondition(TSeal seal);
boolean existIdFromSanAssort(Long fileId);
boolean existIdFromDownfile(Long fileId);
boolean existIdFromDownloadTask(Long fileId);
}

@ -0,0 +1,84 @@
package com.docus.server.collect.infrastructure.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.infrastructure.redis.service.IdService;
import com.docus.infrastructure.redis.service.RedisLock;
import com.docus.server.collect.entity.CollectTask;
import com.docus.server.collect.infrastructure.dao.CollectTaskDao;
import com.docus.server.collect.infrastructure.mapper.CollectTaskMapper;
import com.docus.server.collect.service.dto.ReportFileInfoDTO;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.Date;
/**
* dao
*
* @author wyb
*/
@Repository
public class CollectTaskDaoImpl extends BaseDaoImpl<CollectTaskMapper, CollectTask> implements CollectTaskDao {
@Resource
private IdService idService;
@Resource
private RedisLock redisLock;
@Override
public Long saveTask(ReportFileInfoDTO reportFileInfoDTO) {
Date now = new Date();
LambdaQueryWrapper<CollectTask> queryCollectTaskWrapper = new LambdaQueryWrapper<>();
queryCollectTaskWrapper.eq(CollectTask::getC1, reportFileInfoDTO.getSerialNum());
queryCollectTaskWrapper.eq(CollectTask::getSysflag, reportFileInfoDTO.getSysFlag());
queryCollectTaskWrapper.eq(CollectTask::getPatientId, reportFileInfoDTO.getPatientId());
CollectTask collectTask = baseMapper.selectOne(queryCollectTaskWrapper);
// 更新或者新增
if (collectTask != null) {
collectTask.setState("0");
collectTask.setSyncTime(now);
collectTask.setC2(reportFileInfoDTO.getFileTitle());
baseMapper.updateById(collectTask);
} else {
collectTask = new CollectTask();
collectTask.setId(getNewTaskId());
collectTask.setPatientId(reportFileInfoDTO.getPatientId());
collectTask.setSysflag(reportFileInfoDTO.getSysFlag());
collectTask.setState("0");
collectTask.setSyncTime(now);
collectTask.setC1(reportFileInfoDTO.getSerialNum());
collectTask.setC2(reportFileInfoDTO.getFileTitle());
collectTask.setC3(reportFileInfoDTO.getJzh());
baseMapper.insert(collectTask);
}
return collectTask.getId();
}
private Long getNewTaskId() {
long id = idService.getDateSeq();
LambdaQueryWrapper<CollectTask> queryCollectTaskWrapper = new LambdaQueryWrapper<>();
while (true) {
queryCollectTaskWrapper.eq(CollectTask::getId, id);
CollectTask collectTask = baseMapper.selectOne(queryCollectTaskWrapper);
if (collectTask == null) {
return id;
}
queryCollectTaskWrapper.clear();
id = id + 16;
}
}
@Override
public Long saveTaskUseLock(ReportFileInfoDTO reportFileInfoDTO) throws InterruptedException {
String lockFlag = "docus:gdszy:downloadplatform:report:" + reportFileInfoDTO.getPatientId() + ":" + reportFileInfoDTO.getSysFlag();
try {
redisLock.tryLock(lockFlag, 10 * 1000, 10 * 1000);
return saveTask(reportFileInfoDTO);
} finally {
redisLock.unLock(lockFlag);
}
}
}

@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.db.dao.impl.BaseDaoImpl;
import com.docus.server.collect.entity.DownloadTask;
import com.docus.server.collect.entity.TBasic;
import com.docus.server.collect.entity.TSeal;
import com.docus.server.collect.infrastructure.dao.DownloadTaskDao;
import com.docus.server.collect.infrastructure.mapper.DownloadTaskMapper;
import org.springframework.stereotype.Repository;
@ -18,10 +18,6 @@ import java.util.List;
*/
@Repository
public class DownloadTaskDaoImpl extends BaseDaoImpl<DownloadTaskMapper, DownloadTask> implements DownloadTaskDao {
@Override
public List<TBasic> getBasicInfo(TBasic basic) {
return baseMapper.getBasicInfo(basic);
}
@Override
public Long getDownloadTaskIdFromDownloadTask(DownloadTask downloadTask) {
@ -31,6 +27,8 @@ public class DownloadTaskDaoImpl extends BaseDaoImpl<DownloadTaskMapper, Downloa
wrapper.eq(Func.isNotBlank(downloadTask.getJzh()), DownloadTask::getJzh, downloadTask.getJzh());
wrapper.eq(Func.isNotBlank(downloadTask.getInpatientNo()), DownloadTask::getInpatientNo, downloadTask.getInpatientNo());
wrapper.eq(Func.isNotEmpty(downloadTask.getAdmissions()), DownloadTask::getAdmissions, downloadTask.getAdmissions());
wrapper.eq(DownloadTask::getSource,downloadTask.getSource());
wrapper.eq(DownloadTask::getFileSerialNum,downloadTask.getFileSerialNum());
List<DownloadTask> downloadTasks = baseMapper.selectList(wrapper);
if (Func.isNotEmpty(downloadTasks) && downloadTasks.size() == 1) {
return downloadTasks.get(0).getId();
@ -47,4 +45,30 @@ public class DownloadTaskDaoImpl extends BaseDaoImpl<DownloadTaskMapper, Downloa
public Long getDownloadTaskIdFromDownFile(String patientId, String source, String serialNum) {
return baseMapper.getDownloadTaskIdFromDownFile(patientId, source, serialNum);
}
@Override
public TSeal findSealByCondition(TSeal seal) {
return baseMapper.findSealByCondition(seal);
}
@Override
public boolean existIdFromSanAssort(Long fileId) {
Long id = baseMapper.getFileIdFromSanAssort(fileId);
return id != null;
}
@Override
public boolean existIdFromDownfile(Long fileId) {
Long id = baseMapper.getFileIdFromDownfile(fileId);
return id != null;
}
@Override
public boolean existIdFromDownloadTask(Long fileId) {
LambdaQueryWrapper<DownloadTask> wrapper = new LambdaQueryWrapper<>();
wrapper.select(DownloadTask::getId);
wrapper.eq(DownloadTask::getId, fileId);
DownloadTask downloadTask = baseMapper.selectOne(wrapper);
return downloadTask != null;
}
}

@ -0,0 +1,14 @@
package com.docus.server.collect.infrastructure.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.docus.server.collect.entity.CollectTask;
import org.apache.ibatis.annotations.Mapper;
/**
* @author wyb
*/
@DS("archive-mysql")
@Mapper
public interface CollectTaskMapper extends BaseMapper<CollectTask> {
}

@ -1,40 +1,15 @@
package com.docus.server.collect.infrastructure.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.docus.server.collect.dto.TBasicQrDto;
import com.docus.server.collect.entity.DownloadTask;
import com.docus.server.collect.entity.TBasic;
import com.docus.server.collect.entity.TSeal;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@DS("archive-mysql")
@Mapper
public interface DownloadTaskMapper extends BaseMapper<DownloadTask> {
/**
* from `docus_medicalrecord`.`t_basic`
*
* @param tBasic
* @return
*/
List<TBasic> getBasicInfo(@Param("basic") TBasic tBasic);
/**
*
* @param qrDto
* @return
*/
int countBasicInfo(@Param("dto") TBasicQrDto qrDto);
/**
*
* @param qrDto
* @param offset
* @param size
* @return
*/
List<TBasic> pageBasicInfo(@Param("dto") TBasicQrDto qrDto,@Param("offset") long offset,@Param("size") long size);
/**
* idid
* @param patientId
@ -51,4 +26,19 @@ public interface DownloadTaskMapper extends BaseMapper<DownloadTask> {
* @return idid
*/
Long getDownloadTaskIdFromDownFile(@Param("patientId") String patientId, @Param("source") String source, @Param("serialNum") String serialNum);
/**
*
*
* @param seal
* @return com.docus.server.collect.entity.TSeal
* @date 2024/1/10 16:52
* @author YongBin Wen
*/
TSeal findSealByCondition(@Param("seal") TSeal seal);
Long getFileIdFromDownfile(@Param("fileId") Long fileId);
Long getFileIdFromSanAssort(@Param("fileId") Long fileId);
}

@ -0,0 +1,34 @@
package com.docus.server.collect.infrastructure.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.docus.server.collect.dto.TBasicQrDto;
import com.docus.server.collect.entity.TBasic;
import com.docus.server.collect.entity.TSeal;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author wyb
*/
@DS("archive-mysql")
@Mapper
public interface PatientBasicMapper {
/**
* from `docus_medicalrecord`.`t_basic`
*
* @param dto
* @return
*/
List<TBasic> getBasicInfo(@Param("dto") TBasicQrDto dto);
/**
* idid
* @date 2024/1/15 10:41
* @author YongBin Wen
* @param sealId id
* @return
*/
TSeal getBySealId(@Param("sealId") String sealId);
}

@ -0,0 +1,43 @@
package com.docus.server.collect.infrastructure.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.docus.server.collect.dto.PatientScanConditionDTO;
import com.docus.server.collect.entity.PatientScan;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* mapper
* @author wyb
*/
@DS("scan-sqlserver")
@Mapper
public interface PatientScanMapper {
/**
*
* @param patientScanConditionDto
* @return
*/
List<PatientScan> getScanData(@Param("dto") PatientScanConditionDTO patientScanConditionDto);
/**
*
* @param scanStartTime
* @param scanEndTime
* @return
*/
List<PatientScanConditionDTO> getScanPatientConditionByScanDate(@Param("start")String scanStartTime, @Param("end") String scanEndTime);
/**
*
* @param scanStartTime
* @param scanEndTime
* @return
*/
List<PatientScanConditionDTO> getScanPatientConditionByDisDate(@Param("start")String scanStartTime, @Param("end") String scanEndTime);
}

@ -0,0 +1,125 @@
package com.docus.server.collect.job;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.utils.TableJsonRead;
import com.docus.server.collect.dto.PatientScanConditionDTO;
import com.docus.server.collect.service.PatientScanSynchronizer;
import com.docus.server.collect.service.PatientScanService;
import com.docus.server.collect.service.dto.PatScanSyncResult;
import com.xxl.job.core.context.XxlJobHelper;
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.ArrayList;
import java.util.List;
import java.util.Optional;
/**
*
*
* @author wyb
*/
@Component
@Slf4j
public class PatScanFileSyncJob {
@Resource
private PatientScanService patientScanService;
@Resource
private PatientScanSynchronizer patientScanSynchronizer;
@XxlJob("PatScanFileSyncByScanDateJob")
public void patScanFileSyncByScanDateJob() {
final String taskName = "电子病历扫描视图同步,根据扫描时间同步Job";
log.info("============================= {}采集开始!=============================", taskName);
try {
patScanFileSyncByScanDate();
} catch (Exception ex) {
log.error(taskName + "============================= 采集出现错误!============================= ", ex);
}
log.info("============================= {}采集结束!=============================", taskName);
}
private void patScanFileSyncByScanDate() {
String delayDayParam = XxlJobHelper.getJobParam();
int delayDay = 1;
try {
if (Func.isNotBlank(delayDayParam)) {
delayDay = Integer.parseInt(delayDayParam);
}
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
LocalDate jobStartDate = LocalDate.now();
QueryConfig config = QueryConfig.getQueryConfig();
LocalDate dateStartCondition;
if (config == null) {
config = new QueryConfig();
dateStartCondition = jobStartDate.plusDays(-delayDay);
} else {
dateStartCondition = LocalDate.parse(config.getLastExecuteDate()).plusDays(-delayDay);
}
config.setLastExecuteDate(dateStartCondition.toString());
LocalDate lastExecuteDate = dateStartCondition;
// 一天一天的执行,查询一天的住院号和住院次数,单个患者进行采集上传
// 执行的时间如果大于job的当天则结束
do {
if (lastExecuteDate.isAfter(jobStartDate)) {
break;
}
String startTime = lastExecuteDate + " 00:00:00";
String endTime = lastExecuteDate + " 23:59:59";
List<PatientScanConditionDTO> patientScanConditionDTOList = patientScanService.getScanPatientConditionByScanDate(startTime, endTime);
patientScanConditionDTOList = Optional.ofNullable(patientScanConditionDTOList).orElse(new ArrayList<>());
for (PatientScanConditionDTO dto : patientScanConditionDTOList) {
String pattern="yyyy-MM-dd";
String disDateTime = dto.getDisDateTime();
dto.setDisDate(disDateTime.substring(0,pattern.length()));
}
PatScanSyncResult patScanSyncResult = patientScanSynchronizer.sync("电子病历扫描视图同步,根据扫描时间同步Job", patientScanConditionDTOList);
log.info("电子病历扫描视图同步,根据扫描时间同步Job,{} —— {},同步结果为:{}",startTime,endTime,Func.toJson(patScanSyncResult));
lastExecuteDate = lastExecuteDate.plusDays(1);
config.setLastExecuteDate(lastExecuteDate.toString());
config.refresh();
} while (!lastExecuteDate.isAfter(jobStartDate));
config.setLastExecuteDate(jobStartDate.toString());
config.refresh();
}
public static class QueryConfig {
private String lastExecuteDate;
public String getLastExecuteDate() {
return lastExecuteDate;
}
public void setLastExecuteDate(String lastExecuteDate) {
this.lastExecuteDate = lastExecuteDate;
}
public static QueryConfig getQueryConfig() {
TableJsonRead tableJsonRead = new TableJsonRead();
return tableJsonRead.Read("docus", "PatScanFileSyncByScanDateJobQuery.json", QueryConfig.class);
}
public void refresh() {
TableJsonRead tableJsonRead = new TableJsonRead();
tableJsonRead.Save("docus", "PatScanFileSyncByScanDateJobQuery.json", Func.toJson(this));
}
}
}

@ -15,6 +15,14 @@ public interface FileReportService {
*/
void saveDownloadTaskAndReport(ReportFileInfoDTO fileInfoDTO);
/**
*
* | t_seal
* @param fileInfoDTO
*/
void saveDownloadTaskAndSealReport(ReportFileInfoDTO fileInfoDTO);
/**
* idid
* patientIdpatientId

@ -0,0 +1,43 @@
package com.docus.server.collect.service;
import com.docus.server.collect.dto.PatientScanConditionDTO;
import com.docus.server.collect.entity.PatientScan;
import java.util.List;
/**
* @author wyb
*/
public interface PatientScanService {
/**
* -,
* @param patientScanConditionDTOList
* @return
*/
List<PatientScan> getScanDataByConditions(List<PatientScanConditionDTO> patientScanConditionDTOList);
/**
* -
* @param patientScanConditionDto
* @return
*/
List<PatientScan> getScanDataByConditions(PatientScanConditionDTO patientScanConditionDto);
/**
*
* @param startTime
* @param endTime
* @return
*/
List<PatientScanConditionDTO> getScanPatientConditionByScanDate(String startTime, String endTime);
/**
*
* @param startTime
* @param endTime
* @return
*/
List<PatientScanConditionDTO> getScanPatientConditionByDisDate(String startTime, String endTime);
}

@ -0,0 +1,193 @@
package com.docus.server.collect.service;
import com.docus.core.util.Func;
import com.docus.server.collect.converter.FileReportConverter;
import com.docus.server.collect.dto.PatientScanConditionDTO;
import com.docus.server.collect.dto.TBasicQrDto;
import com.docus.server.collect.entity.PatientScan;
import com.docus.server.collect.entity.TBasic;
import com.docus.server.collect.entity.TSeal;
import com.docus.server.collect.infrastructure.dao.CollectTaskDao;
import com.docus.server.collect.infrastructure.mapper.PatientBasicMapper;
import com.docus.server.collect.service.dto.PatScanSyncResult;
import com.docus.server.collect.service.dto.ReportFileInfoDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
*
*
* @author wyb
*/
@Component
@Slf4j
public class PatientScanSynchronizer {
@Resource
private PatientBasicMapper patientBasicMapper;
@Resource
private FileReportService fileReportService;
@Resource
private CollectTaskDao collectTaskDao;
@Resource
private FileReportConverter fileReportConverter;
@Resource
private PatientScanService patientScanService;
@Value("${docus.sync.patsmGSys}")
private String patmGSys;
/**
*
*
* @param source
* @param patientScanConditionDTOList
* @return
*/
public PatScanSyncResult sync(String source, List<PatientScanConditionDTO> patientScanConditionDTOList) {
StringBuilder syncMsgStringBuilder = new StringBuilder();
int patientTotalCount = patientScanConditionDTOList.size();
int successPatientCount = 0;
int fileCount = 0;
for (PatientScanConditionDTO condition : patientScanConditionDTOList) {
List<TBasic> basicList = getBasicInfo(condition);
if (Func.isEmpty(basicList)) {
log.warn("{},住院号:{},出院日期:{},患者姓名:{} 查询基础数据没有数据,请检查!", source, condition.getInpatientNo(), condition.getDisDate(), condition.getName());
syncMsgStringBuilder.append(source)
.append(",住院号:").append(condition.getInpatientNo())
.append(",出院日期:").append(condition.getDisDate())
.append(",患者姓名:").append(condition.getName())
.append(" 查询基础数据没有数据,请检查!");
continue;
}
if (basicList.size() > 1) {
log.warn("{},住院号:{},出院日期:{},患者姓名:{} 查询基础数据有多条数据,请检查!", source, condition.getInpatientNo(), condition.getDisDate(), condition.getName());
syncMsgStringBuilder.append(source)
.append(",住院号:").append(condition.getInpatientNo())
.append(",出院日期:").append(condition.getDisDate())
.append(",患者姓名:").append(condition.getName())
.append(" 查询基础数据有多条数据,请检查!");
continue;
}
List<PatientScan> patientScanList = patientScanService.getScanDataByConditions(condition);
log.info("{},住院号:{},出院日期:{},患者姓名:{} 采集视图数据:{} 条!", source, condition.getInpatientNo(), condition.getDisDate(), condition.getName(), patientScanList.size());
saveCollectTaskAndReport(basicList.get(0), patientScanList);
log.info("{},住院号:{},出院日期:{},患者姓名:{} 采集视图数据:{} 条,执行成功!", source, condition.getInpatientNo(), condition.getDisDate(), condition.getName(), patientScanList.size());
fileCount += patientScanList.size();
successPatientCount++;
}
PatScanSyncResult result = new PatScanSyncResult();
result.setPatientTotalCount(patientTotalCount);
result.setSuccessPatientCount(successPatientCount);
result.setFileCount(fileCount);
result.setMsg(syncMsgStringBuilder.toString());
return result;
}
/**
* -
*
* @param source /
* @param sealId id
* @return
*/
public PatScanSyncResult syncSeal(String source, String sealId) {
PatScanSyncResult result = new PatScanSyncResult();
result.setPatientTotalCount(1);
result.setSuccessPatientCount(0);
result.setFileCount(0);
TSeal seal = patientBasicMapper.getBySealId(sealId);
if (Objects.isNull(seal)) {
String resultMsg = source + "封存id:" + sealId + " 没有找到封存病案信息,请检查!";
result.setMsg(resultMsg);
return result;
}
String jzh = seal.getJzh();
TBasicQrDto basicQrDto = new TBasicQrDto();
basicQrDto.setJzh(jzh);
List<TBasic> tBasicList = patientBasicMapper.getBasicInfo(basicQrDto);
if (Func.isEmpty(tBasicList)) {
String resultMsg = source + "封存id:" + sealId + "jzh:" + jzh + " 没有找到基础病案信息,无法获取出院时间,请检查!";
result.setMsg(resultMsg);
return result;
}
if (tBasicList.size() > 1) {
String resultMsg = source + "封存id:" + sealId + "jzh:" + jzh + " 找到多条基础病案信息,无法获取出院时间,请检查!";
result.setMsg(resultMsg);
return result;
}
TBasic tBasic = tBasicList.get(0);
String basicDisDate = tBasic.getDisDate();
if (Func.isBlank(basicDisDate)) {
String resultMsg = source + "封存id:" + sealId + "jzh:" + jzh + " 获取基础病案信息,无法获取出院时间,请检查!";
result.setMsg(resultMsg);
return result;
}
String disDate;
String dateTimePattern = "yyyy-MM-dd HH:mm:ss";
try {
Date parse = Func.parseDate(basicDisDate, dateTimePattern);
disDate = Func.formatDate(parse);
} catch (Exception ex) {
String resultMsg = source + "封存id:" + sealId + "jzh:" + jzh + " 出院时间:" + basicDisDate + "解析失败,请检查!";
result.setMsg(resultMsg);
return result;
}
PatientScanConditionDTO condition = new PatientScanConditionDTO();
condition.setDisDate(disDate);
condition.setDisDateTime(disDate + " 00:00:00");
condition.setName(seal.getName());
condition.setInpatientNo(seal.getInpatientNo());
List<PatientScan> patientScanList = patientScanService.getScanDataByConditions(condition);
log.info("{}封存id:{},住院号:{},出院日期:{},患者姓名:{} 采集视图数据:{} 条!", source, sealId, condition.getInpatientNo(), condition.getDisDateTime(), condition.getName(), patientScanList.size());
saveCollectTaskAndSealReport(seal, patientScanList);
log.info("{}封存id{},住院号:{},出院日期:{},患者姓名:{} , 采集视图数据:{} 条,执行成功!", source, sealId, condition.getInpatientNo(), condition.getDisDateTime(), condition.getName(), patientScanList.size());
result.setFileCount(patientScanList.size());
result.setSuccessPatientCount(1);
return result;
}
private void saveCollectTaskAndReport(TBasic tBasic, List<PatientScan> patientScanList) {
for (PatientScan patientScan : patientScanList) {
// 转换后的对象缺失的补充
ReportFileInfoDTO reportFileInfoDTO = fileReportConverter.convertReportFileInfoDTO(tBasic, patientScan);
reportFileInfoDTO.setSysFlag(patmGSys);
Long taskId = collectTaskDao.saveTask(reportFileInfoDTO);
reportFileInfoDTO.setTaskId(taskId);
fileReportService.saveDownloadTaskAndReport(reportFileInfoDTO);
}
}
private void saveCollectTaskAndSealReport(TSeal tSeal, List<PatientScan> patientScanList) {
for (PatientScan patientScan : patientScanList) {
// 转换后的对象缺失的补充
ReportFileInfoDTO reportFileInfoDTO = fileReportConverter.convertReportFileInfoDTO(tSeal, patientScan);
reportFileInfoDTO.setSysFlag(patmGSys);
Long taskId = collectTaskDao.saveTask(reportFileInfoDTO);
reportFileInfoDTO.setTaskId(taskId);
fileReportService.saveDownloadTaskAndSealReport(reportFileInfoDTO);
}
}
private List<TBasic> getBasicInfo(PatientScanConditionDTO patientScanConditionDTO) {
String disDate = patientScanConditionDTO.getDisDate();
TBasicQrDto basicQrDto = new TBasicQrDto();
basicQrDto.setInpatientNo(patientScanConditionDTO.getInpatientNo());
basicQrDto.setName(patientScanConditionDTO.getName());
basicQrDto.setDisDateStart(disDate + " 00:00:00");
basicQrDto.setDisDateEnd(disDate + " 23:59:59");
basicQrDto.setIgnorePh(1);
return patientBasicMapper.getBasicInfo(basicQrDto);
}
}

@ -0,0 +1,14 @@
package com.docus.server.collect.service.dto;
import lombok.Data;
/**
* @author wyb
*/
@Data
public class PatScanSyncResult {
private int patientTotalCount;
private int successPatientCount;
private int fileCount;
private String msg;
}

@ -5,9 +5,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
*
* ,,,
@ -42,39 +39,33 @@ public class ReportFileInfoDTO {
*
*/
@ApiModelProperty("采集来源系统")
@NotBlank
private String sysFlag;
/**
*
*/
@ApiModelProperty("下载地址")
@NotBlank
private String downUrl;
/**
*
*/
@ApiModelProperty("下载地址类型")
@NotNull
private DownWayEnum downWayEnum;
/**
*
*/
@ApiModelProperty("文件名")
@NotBlank
private String fileTitle;
/**
* /id
*/
@ApiModelProperty("采集流水号/文件唯一id")
@NotBlank
private String serialNum;
/**
* id
*/
@ApiModelProperty("文件分类id")
@NotBlank
private String assortId;

@ -4,11 +4,17 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.docus.core.util.Func;
import com.docus.infrastructure.redis.service.IdService;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.infrastructure.web.api.ResultCode;
import com.docus.server.collect.converter.FileReportConverter;
import com.docus.server.collect.dto.TBasicQrDto;
import com.docus.server.collect.entity.DownloadTask;
import com.docus.server.collect.entity.TBasic;
import com.docus.server.collect.entity.TSeal;
import com.docus.server.collect.infrastructure.client.DownloadPlatformService;
import com.docus.server.collect.infrastructure.client.dto.ReportDownDto;
import com.docus.server.collect.infrastructure.dao.DownloadTaskDao;
import com.docus.server.collect.infrastructure.mapper.PatientBasicMapper;
import com.docus.server.collect.service.FileReportService;
import com.docus.server.collect.service.dto.ReportFileInfoDTO;
import lombok.extern.slf4j.Slf4j;
@ -16,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ThreadPoolExecutor;
/**
@ -32,6 +37,8 @@ public class FileReportServiceImpl implements FileReportService {
@Autowired
private DownloadTaskDao downloadTaskDao;
@Autowired
private PatientBasicMapper patientBasicMapper;
@Autowired
private FileReportConverter fileReportConverter;
@Autowired
@ -42,9 +49,10 @@ public class FileReportServiceImpl implements FileReportService {
@Override
public void saveDownloadTaskAndReport(ReportFileInfoDTO fileInfoDTO) {
TBasic basic = new TBasic(fileInfoDTO);
TBasicQrDto basicQrDto = convertTbasicQrDto(fileInfoDTO);
// 查询基础数据,更新新的病案信息
List<TBasic> tBasics = downloadTaskDao.getBasicInfo(basic);
List<TBasic> tBasics = patientBasicMapper.getBasicInfo(basicQrDto);
// 如果找到患者基础数据并且刚好为1条
if (CollUtil.isNotEmpty(tBasics) && tBasics.size() == 1) {
TBasic tBasic = tBasics.get(0);
@ -55,26 +63,80 @@ public class FileReportServiceImpl implements FileReportService {
}
// 转换下载任务对象
DownloadTask downloadTask = fileReportConverter.convertDownloadTask(fileInfoDTO, 0);
// 为什么不保存呢因为总出现文件id重复所有文件id交给下载服务生成
// 查询旧的下载任务id,更新/保存任务信息
Long downloadTaskId = Optional.ofNullable(getDownloadTaskId(downloadTask)).orElse(idService.getDateSeq());
downloadTask.setId(downloadTaskId);
downloadTaskDao.saveOrUpdate(downloadTask);
// Long downloadTaskId = Optional.ofNullable(getDownloadTaskId(downloadTask)).orElse(getNewFileId());
// downloadTask.setId(downloadTaskId);
// downloadTaskDao.saveOrUpdate(downloadTask);
report(downloadTask);
}
/**
* idid
*/
private Long getNewFileId() {
Long fileId = idService.getDateSeq();
while (true) {
boolean existIdFromSanAssort = downloadTaskDao.existIdFromSanAssort(fileId);
boolean existIdFromDownfile = downloadTaskDao.existIdFromDownfile(fileId);
boolean existIdFromDownloadTask = downloadTaskDao.existIdFromDownloadTask(fileId);
if (!existIdFromSanAssort && !existIdFromDownfile && !existIdFromDownloadTask) {
return fileId;
}
fileId = fileId + 16;
}
}
@Override
public void saveDownloadTaskAndSealReport(ReportFileInfoDTO fileInfoDTO) {
TSeal sealCondition = new TSeal(fileInfoDTO);
// 查询基础数据,更新新的病案信息
TSeal seal = downloadTaskDao.findSealByCondition(sealCondition);
// 如果找到患者基础数据并且刚好为1条
fileInfoDTO.setPatientId(seal.getPatientId());
fileInfoDTO.setInpatientNo(seal.getInpatientNo());
fileInfoDTO.setAdmisstimes(seal.getAdmissTimes());
fileInfoDTO.setJzh(seal.getJzh());
// 转换下载任务对象
DownloadTask downloadTask = fileReportConverter.convertDownloadTask(fileInfoDTO, 2);
// 为什么不保存呢因为总出现文件id重复所有文件id交给下载服务生成
// 查询旧的下载任务id,更新/保存任务信息
// Long downloadTaskId = Optional.ofNullable(getDownloadTaskId(downloadTask)).orElse(getNewFileId());
// downloadTask.setId(downloadTaskId);
// downloadTaskDao.saveOrUpdate(downloadTask);
reportSeal(downloadTask);
}
private TBasicQrDto convertTbasicQrDto(ReportFileInfoDTO fileInfoDTO) {
String patientId = fileInfoDTO.getPatientId();
String jzh = fileInfoDTO.getJzh();
String inpatientNo = fileInfoDTO.getInpatientNo();
Integer admisstimes = fileInfoDTO.getAdmisstimes();
TBasicQrDto dto = new TBasicQrDto();
dto.setPatientId(patientId);
dto.setJzh(jzh);
dto.setInpatientNo(inpatientNo);
dto.setAdmissTimes(admisstimes);
return dto;
}
@Override
public Long getDownloadTaskId(DownloadTask downloadTask) {
String patientId = downloadTask.getPatientId();
if(StrUtil.isNotBlank(patientId)){
if (StrUtil.isNotBlank(patientId)) {
String serialNum = downloadTask.getFileSerialNum();
String source = downloadTask.getSource();
// 从文件表获取
Long downloadTaskId = downloadTaskDao.getDownloadTaskIdFromSanAssort(patientId,source,serialNum);
Long downloadTaskId = downloadTaskDao.getDownloadTaskIdFromSanAssort(patientId, source, serialNum);
if (Func.isNotEmpty(downloadTaskId)) {
return downloadTaskId;
}
// 从下载记录表获取
downloadTaskId = downloadTaskDao.getDownloadTaskIdFromDownFile(patientId,source,serialNum);
downloadTaskId = downloadTaskDao.getDownloadTaskIdFromDownFile(patientId, source, serialNum);
if (Func.isNotEmpty(downloadTaskId)) {
return downloadTaskId;
}
@ -89,10 +151,38 @@ public class FileReportServiceImpl implements FileReportService {
* @param downloadTask
*/
private void report(DownloadTask downloadTask) {
threadPoolExecutor.execute(() -> {
if (downloadTask.getBasicDataType().equals(0)) {
downloadPlatformService.report(fileReportConverter.convertDownloadPlatformParam(downloadTask));
ReportDownDto reportDownDto = fileReportConverter.convertDownloadPlatformParam(downloadTask);
try {
CommonResult commonResult = downloadPlatformService.report(reportDownDto);
if (commonResult.getCode().equals(ResultCode.SUCCESS.getCode())) {
log.info("{},文件上报成功!返回信息:{}", Func.toJson(reportDownDto.getPatient()), Func.toJson(commonResult));
} else {
log.error("文件上报失败!返回信息:{},上报信息:{}", Func.toJson(commonResult), Func.toJson(reportDownDto));
}
} catch (Exception ex) {
log.error("文件上报下载服务出错啦!数据为:" + Func.toJson(reportDownDto), ex);
}
}
}
/**
*
*
* @param downloadTask
*/
private void reportSeal(DownloadTask downloadTask) {
if (downloadTask.getBasicDataType().equals(2)) {
ReportDownDto reportDownDto = fileReportConverter.convertDownloadPlatformParam(downloadTask);
String paramJson = Func.toJson(reportDownDto);
try {
log.info("封存病案上报文件,参数:{}", paramJson);
CommonResult result = downloadPlatformService.sealReport(reportDownDto);
log.info("封存病案上报文件,返回结果:{}", Func.toJson(result));
} catch (Exception ex) {
log.error("封存病案上报文件发生未知错误,参数:" + paramJson, ex);
}
}
});
}
}

@ -0,0 +1,72 @@
package com.docus.server.collect.service.impl;
import com.docus.server.collect.dto.PatientScanConditionDTO;
import com.docus.server.collect.entity.PatientScan;
import com.docus.server.collect.infrastructure.mapper.PatientScanMapper;
import com.docus.server.collect.service.PatientScanService;
import groovy.util.logging.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* @author wyb
*/
@Service
@Slf4j
public class PatientScanServiceImpl implements PatientScanService {
@Resource
private PatientScanMapper patientScanMapper;
@Override
public List<PatientScan> getScanDataByConditions(List<PatientScanConditionDTO> patientScanConditionDTOList) {
List<PatientScanConditionDTO> distinctPatientScanConditionDTOList = distinctCondition(patientScanConditionDTOList);
List<PatientScan> list = new LinkedList<>();
for (PatientScanConditionDTO patientScanConditionDTO : distinctPatientScanConditionDTOList) {
List<PatientScan> patientScanList = getScanDataByConditions(patientScanConditionDTO);
list.addAll(patientScanList);
}
return list;
}
@Override
public List<PatientScan> getScanDataByConditions(PatientScanConditionDTO patientScanConditionDto) {
return patientScanMapper.getScanData(patientScanConditionDto);
}
@Override
public List<PatientScanConditionDTO> getScanPatientConditionByScanDate(String startTime, String endTime) {
return patientScanMapper.getScanPatientConditionByScanDate(startTime,endTime);
}
@Override
public List<PatientScanConditionDTO> getScanPatientConditionByDisDate(String startTime, String endTime) {
return patientScanMapper.getScanPatientConditionByDisDate(startTime,endTime);
}
/**
*
*
* @param patientScanConditionDTOList
* @return
*/
private List<PatientScanConditionDTO> distinctCondition(List<PatientScanConditionDTO> patientScanConditionDTOList) {
Map<String, String> duplicateValidators = new HashMap<>();
LinkedList<PatientScanConditionDTO> list = new LinkedList<>();
for (PatientScanConditionDTO dto : patientScanConditionDTOList) {
String key = dto.getInpatientNo() + "valid" + dto.getDisDate()+"valid"+dto.getName();
// 病案号和住院次数生成key根据哈希map的特性去重
if (duplicateValidators.containsKey(key)) {
continue;
}
duplicateValidators.put(key, null);
list.add(dto);
}
return list;
}
}

@ -1,7 +1,7 @@
@echo off
set deployDir=%1\docus-webservice-gdszy
if %deployDir%=="" set deployDir=d:\webroot\docus-webservice-gdszy
set deployDir=%1\docus-collect-gdszy-patient-scan
if %deployDir%=="" set deployDir=d:\webroot\docus-collect-gdszy-patient-scan
set curr_file=%cd%
cd /d %deployDir%

@ -1,7 +1,7 @@
<service>
<id>docus-webservice-gdszy</id>
<name>生产-嘉时病案采集-广东省中医</name>
<description>生产-嘉时病案采集-广东省中医</description>
<id>docus-collect-gdszy-patient-scan</id>
<name>生产-嘉时病案采集-广东省中医-扫描视图同步</name>
<description>生产-嘉时病案采集-广东省中医-扫描视图同步</description>
<startmode>Automatic</startmode>
<executable>%BASE%\start.bat</executable>
<log mode="none"></log>

@ -4,27 +4,56 @@ spring:
application:
name: @artifactId@
datasource:
url: jdbc:log4jdbc:mysql://db.docus.cn:3306/docus_archivefile?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
dynamic:
primary: archive-mysql
#是否用严格模式,如果启用在味匹配到指定数据源时抛出异常
strict: false
datasource:
# 多数据源
archive-mysql:
url: jdbc:log4jdbc:mysql://db.docus.cn:3306/docus_archivefile?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
scan-sqlserver:
url: jdbc:sqlserver://192.168.16.103\DOCUS;DatabaseName=zj_power
username: sa
password: docus702
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
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
redis:
host: redis.docus.cn
@ -49,6 +78,9 @@ docus:
url:
# 下载平台服务地址
downloadPlatform: http://192.168.16.85:9291
sync:
# 电子病历视图扫描文件同步采集器id定义
patsmGSys: 25
mybatis-plus:
configuration:
@ -65,9 +97,9 @@ xxl:
admin:
addresses: http://job.docus.cn:8180/xxl-job-admin
executor:
appname: docus-collect-gdszy
appname: docus-collect-gdszy-patient-scan
address:
ip:
port: 19311
logretentiondays: 30
logpath: D:/xxl-job/docus-collect-gdszy
logpath: D:/xxl-job/docus-collect-gdszy-patient-scan

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.server.collect.infrastructure.mapper.DownloadTaskMapper">
<select id="getDownloadTaskIdFromSanAssort" resultType="java.lang.Long">
SELECT
`id`
FROM
`docus_archivefile`.`t_scan_assort`
where
`patient_id` = #{patientId}
and `source`= #{source}
and `file_column_1`= #{serialNum}
</select>
<select id="getDownloadTaskIdFromDownFile" resultType="java.lang.Long">
SELECT
`t_scan_assort_id`
FROM
`docus_archivefile`.`af_downfile`
WHERE
`patient_id` = #{patientId}
and `collectorid` = #{source}
and `serialnum` = #{serialNum}
order by `create_time` desc limit 1
</select>
<select id="findSealByCondition" resultType="com.docus.server.collect.entity.TSeal">
SELECT *
FROM
`docus_medicalrecord`.`t_seal`
where
1=1
<if test="seal.sealId != null and seal.sealId != ''">
AND seal_id=#{seal.sealId}
</if>
<if test="seal.patientId != null and seal.patientId != ''">
AND patient_id=#{seal.patientId}
</if>
</select>
<select id="getFileIdFromDownfile" resultType="java.lang.Long">
select `t_scan_assort_id` from `docus_archivefile`.`af_downfile` where `t_scan_assort_id`=#{fileId} LIMIT 1
</select>
<select id="getFileIdFromSanAssort" resultType="java.lang.Long">
select id from `docus_archivefile`.`t_scan_assort` where id=#{fileId}
</select>
</mapper>

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.server.collect.infrastructure.mapper.PatientBasicMapper">
<sql id="basicInfoColumns">
patient_id
as patientId,
admiss_times as admissTimes,
inpatient_no as inpatientNo,
admiss_id as admissId,
admiss_date as admissDate,
dis_date as disDate,
admiss_dept_name as admissDeptName,
dis_dept_name as disDeptName ,
jzh,
name,
emp_id as empId
</sql>
<select id="getBasicInfo" resultType="com.docus.server.collect.entity.TBasic">
select
<include refid="basicInfoColumns"></include>
FROM
`docus_medicalrecord`.`t_basic`
WHERE
is_cancel=0
<if test="dto.patientId != null and dto.patientId != ''">
and `patient_id` = #{dto.patientId}
</if>
<if test="dto.jzh != null and dto.jzh != ''">
and `jzh` = #{dto.jzh}
</if>
<if test="dto.empId != null and dto.empId != ''">
and `emp_id` = #{dto.empId}
</if>
<if test="dto.inpatientNo != null and dto.inpatientNo != ''">
and `inpatient_no` = #{dto.inpatientNo}
</if>
<if test="dto.admisstimes != null">
and `admiss_times` = #{dto.admissTimes}
</if>
<if test="dto.disDateStart != null and dto.disDateStart != ''">
and `dis_date` between #{dto.disDateStart} and #{dto.disDateEnd}
</if>
<if test="dto.name != null and dto.name != ''">
and `name` = #{dto.name}
</if>
<if test="dto.ignorePh==1">
and ph is null
</if>
limit 2
</select>
<select id="getBySealId" resultType="com.docus.server.collect.entity.TSeal">
SELECT *
FROM
`docus_medicalrecord`.`t_seal`
where
seal_id=#{sealId}
</select>
</mapper>

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.server.collect.infrastructure.mapper.PatientScanMapper">
<sql id="patSmViewField">
主键 as id,
住院号 as inpatientNo,
次数 as admissTimes,
病人姓名 as name,
出院日期 as disDate,
图像路径 as imagePath,
文件名 as fileName,
分段名称 as zdAssortName,
分类id as zdAssortId,
扫描日期 as scanDate,
扫描盘号 as ph
</sql>
<select id="getScanData" resultType="com.docus.server.collect.entity.PatientScan">
select
<include refid="patSmViewField"></include>
from pat_sm
where
住院号=#{dto.inpatientNo}
and 病人姓名=#{dto.name}
and 出院日期=#{dto.disDateTime}
and 扫描盘号 like 'G%'
</select>
<select id="getScanPatientConditionByScanDate" resultType="com.docus.server.collect.dto.PatientScanConditionDTO">
select 住院号 as inpatientNo,
出院日期 as disDateTime,
病人姓名 as name
from pat_sm
where 扫描日期 between #{start} and #{end}
and 扫描盘号 like 'G%'
group by 住院号, 出院日期,病人姓名
</select>
<select id="getScanPatientConditionByDisDate" resultType="com.docus.server.collect.dto.PatientScanConditionDTO">
select 住院号 as inpatientNo,
出院日期 as disDateTime,
病人姓名 as name
from pat_sm
where 出院日期 between #{start} and #{end}
and 扫描盘号 like 'G%'
group by 住院号, 出院日期,病人姓名
</select>
</mapper>

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.server.collect.infrastructure.mapper.DownloadTaskMapper">
<sql id="basicInfoColumns">
patient_id as patientId,
admiss_times as admissTimes,
inpatient_no as inpatientNo,
admiss_id as admissId,
admiss_date as admissDate,
dis_date as disDate,
admiss_dept_name as admissDeptName,
dis_dept_name as disDeptName ,
jzh,
name,
emp_id as empId
</sql>
<select id="getBasicInfo" resultType="com.docus.server.collect.entity.TBasic">
select
<include refid="basicInfoColumns"></include>
FROM
`docus_medicalrecord`.`t_basic`
WHERE
is_cancel=0
<if test="basic.patientId != null and basic.patientId != ''">
and `patient_id` = #{basic.patientId}
</if>
<if test="basic.jzh != null and basic.jzh != ''">
and `jzh` = #{basic.jzh}
</if>
<if test="basic.empId != null and basic.empId != ''">
and `emp_id` = #{basic.empId}
</if>
<if test="basic.inpatientNo != null and basic.inpatientNo != ''">
and `inpatient_no` = #{basic.inpatientNo}
</if>
<if test="basic.admisstimes != null">
and `admiss_times` = #{basic.admissTimes}
</if>
limit 2
</select>
<select id="countBasicInfo" resultType="java.lang.Integer">
select
count(1)
from `docus_medicalrecord`.`t_basic`
WHERE
is_cancel=0
<if test="dto.patientId != null and dto.patientId != ''">
and `patient_id` = #{dto.patientId}
</if>
<if test="dto.jzh != null and dto.jzh != ''">
and `jzh` = #{dto.jzh}
</if>
<if test="dto.empId != null and dto.empId != ''">
and `emp_id` = #{dto.empId}
</if>
<if test="dto.inpatientNo != null and dto.inpatientNo != ''">
and `inpatient_no` = #{dto.inpatientNo}
</if>
<if test="dto.admisstimes != null">
and `admiss_times` = #{dto.admissTimes}
</if>
<if test="dto.admisstimes != null">
and `dis_date` between #{dto.disDateStart} AND #{dto.disDateEnd}
</if>
</select>
<select id="pageBasicInfo" resultType="com.docus.server.collect.entity.TBasic">
select
<include refid="basicInfoColumns"></include>
from `docus_medicalrecord`.`t_basic`
WHERE
is_cancel=0
<if test="dto.patientId != null and dto.patientId != ''">
and `patient_id` = #{dto.patientId}
</if>
<if test="dto.jzh != null and dto.jzh != ''">
and `jzh` = #{dto.jzh}
</if>
<if test="dto.empId != null and dto.empId != ''">
and `emp_id` = #{dto.empId}
</if>
<if test="dto.inpatientNo != null and dto.inpatientNo != ''">
and `inpatient_no` = #{dto.inpatientNo}
</if>
<if test="dto.admisstimes != null">
and `admiss_times` = #{dto.admissTimes}
</if>
<if test="dto.admisstimes != null">
and `dis_date` between #{dto.disDateStart} AND #{dto.disDateEnd}
</if>
<if test="dto.admisstimes != null">
and `dis_date` between #{dto.disDateStart} AND #{dto.disDateEnd}
</if>
LIMIT ${offset},${size}
</select>
<select id="getDownloadTaskIdFromSanAssort" resultType="java.lang.Long">
SELECT
`id`
FROM
`docus_archivefile`.`t_scan_assort`
where
`patient_id` = #{patientId}
and `source`= #{source}
and `file_column_1`= #{serialNum}
</select>
<select id="getDownloadTaskIdFromDownFile" resultType="java.lang.Long">
SELECT
`t_scan_assort_id`
FROM
`docus_archivefile`.`af_downfile`
WHERE
`patient_id` = #{patientId}
and `collectorid` = #{source}
and `serialnum` = #{serialNum}
order by `create_time` desc limit 1
</select>
</mapper>

Binary file not shown.
Loading…
Cancel
Save