临时修改

This commit is contained in:
czx 2020-12-25 17:59:09 +08:00
parent 0704a2a51c
commit f257ee2f6c
3 changed files with 12 additions and 1 deletions

View File

@ -2,12 +2,15 @@ package com.ruoyi.quartz.task;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.system.fantang.domain.FtRemotePatientDao;
import com.ruoyi.system.fantang.mapper.FtFoodDaoMapper;
import com.ruoyi.system.fantang.mapper.FtRemotePatientDaoMapper;
import com.ruoyi.system.service.impl.SyncPatientServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 定时任务调度测试
*
@ -24,6 +27,8 @@ public class ftSyncPatientTask {
public void ftGetRemotePatient() {
System.out.println("执行同步远程病患数据");
// List<FtRemotePatientDao> list = ftRemotePatientDaoMapper.selectList(null);
// System.out.println(list);
syncPatientService.insertToLocalSync(ftRemotePatientDaoMapper.selectList(null));
}
}

View File

@ -21,7 +21,7 @@ public interface FtPatientDaoMapper extends BaseMapper<FtPatientDao> {
@Update("update ft_patient set sync_flag = 0 where off_flag = 0")
public int initForSync();
@Update("update ft_patient a, ft_sync b set a.name= b.name, a.bed_id = b.bed_id, a.sync_flag = 1 where a.hospital_id = b.hospital_id and a.name = b.name and a.bed_id = b.bed_id and a.depart_name = b.depart_name")
@Update("update ft_patient a, ft_sync b set a.name= b.name, a.bed_id = b.bed_id, a.sync_flag = 1 where a.hospital_id = b.hospital_id and a.name = b.name and a.bed_id = b.bed_id and a.depart_id = b.depart_id")
public int syncEqual();
@Update("update ft_patient a, ft_sync b set a.name= b.name, a.bed_id = b.bed_id, a.sync_flag = 1 where a.hospital_id = b.hospital_id and a.name = b.name")
@ -39,6 +39,9 @@ public interface FtPatientDaoMapper extends BaseMapper<FtPatientDao> {
@Update("update ft_patient a inner join ft_sync b on a.hospital_id = b.hospital_id and a.sync_flag = 2 set a.depart_id = (select depart_id from ft_depart c where b.depart_name = c.depart_name )")
public int updateDepartIDToNewPatient();
@Update("update ft_sync, ft_depart set ft_sync.depart_id = ft_depart.depart_id where ft_sync.depart_name = ft_depart.depart_name")
public int updateDepartIDToPatient();
@Select("select a.hospital_id, a.name, a.depart_name, a.bed_id, b.depart_id, c.hospital_id as old_hospital_id, c.name as old_name, a.depart_name as old_depart_name, c.bed_id as old_bed_id, c.depart_id as old_depart_id, c.patient_id as patient_id from ft_sync a LEFT JOIN ft_depart b on a.depart_name = b.depart_name LEFT JOIN ft_patient c on a.hospital_id = c.hospital_id where b.depart_id = c.depart_id and a.bed_id = c.bed_id and a.name != c.name")
List<ftSyncConflictVo> syncConflictOnlyHospitalEqual();

View File

@ -45,6 +45,7 @@ public class SyncPatientServiceImpl implements ISyncPatientService {
@Transactional
@Override
public Integer insertToLocalSync(List<FtRemotePatientDao> remotePatientDaoList) {
System.out.println("开始同步..................");
StringBuilder syncMessage = new StringBuilder();
syncMessage.append("同步信息:");
// 清空本地中间表数据准备接收同步数据
@ -54,6 +55,8 @@ public class SyncPatientServiceImpl implements ISyncPatientService {
for (FtRemotePatientDao dao : remotePatientDaoList) {
syncPatientDaoMapper.insert(dao);
}
// 为新记录填入对应的科室id
patientDaoMapper.updateDepartIDToPatient();
// 初始化本地病患表准备同步将标志位置0
int ret = patientDaoMapper.initForSync();