扫描文件同步
parent
2f040453ee
commit
4f33626843
@ -0,0 +1 @@
|
||||
{"lastExecuteDate":"2023-11-15"}
|
@ -0,0 +1,70 @@
|
||||
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(idService.getDateSeq());
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?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>
|
||||
|
||||
|
||||
</mapper>
|
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.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.ignorePh==1">
|
||||
and ph is null
|
||||
</if>
|
||||
limit 2
|
||||
</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>
|
Loading…
Reference in New Issue