Merge remote-tracking branch 'origin/master' into master

# Conflicts:
#	ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtPatientDaoMapper.java
#	ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SyncPatientServiceImpl.java
This commit is contained in:
ryoeiken 2020-12-28 16:49:18 +08:00
commit 046aba1a2f
5 changed files with 17 additions and 15 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,7 +39,7 @@ 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_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 )")
@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();

View File

@ -28,7 +28,9 @@ public class FtOrderDaoServiceImpl extends ServiceImpl<FtOrderDaoMapper, FtOrder
FtStaffStopMealsDaoMapper staffStopMealsDaoMapper;
public void GenerateStaffTomorrowOrder() {
this.baseMapper.GenerateStaffTomorrowOrder();
int week = DateUtil.thisDayOfWeek();
if (week < 6)
this.baseMapper.GenerateStaffTomorrowOrder();
}

View File

@ -33,12 +33,10 @@ public class FtStaffDemandDaoServiceImpl extends ServiceImpl<FtStaffDemandDaoMap
@Override
public AjaxResult setDemandMode(Long id, Integer type, Boolean demandMode) {
FtStaffDemandDao dao = new FtStaffDemandDao();
dao.setId(id);
FtStaffDemandDao dao = this.baseMapper.selectById(id);
dao.setDemandMode(demandMode);
QueryWrapper<FtStaffDemandDao> wrapper = new QueryWrapper<>();
wrapper.eq("type", type);
int ret = this.baseMapper.update(dao, wrapper);
int ret = this.baseMapper.updateById(dao);
if (ret == 0)
return AjaxResult.error("更新订餐状态失败");
return AjaxResult.success();

View File

@ -45,25 +45,22 @@ public class SyncPatientServiceImpl implements ISyncPatientService {
@Transactional
@Override
public Integer insertToLocalSync(List<FtRemotePatientDao> remotePatientDaoList) {
System.out.println("开始同步................");
System.out.println("开始同步..................");
StringBuilder syncMessage = new StringBuilder();
syncMessage.append("同步信息:");
// 清空本地中间表数据准备接收同步数据
syncPatientDaoMapper.clearAll();
syncPatientDaoMapper.delete(null);
// 遍历数据源逐条插入本地中间表
for (FtRemotePatientDao dao : remotePatientDaoList) {
syncPatientDaoMapper.insert(dao);
}
// 为记录填入对应的科室id
patientDaoMapper.updateDepartIDToNewPatient();
System.out.println("完成遍历数据源,逐条插入本地中间表..");
// 为新记录填入对应的科室id
patientDaoMapper.updateDepartIDToPatient();
// 初始化本地病患表准备同步将标志位置0
int ret = patientDaoMapper.initForSync();
syncMessage.append(String.format("本地初始化记录:%d 条", ret));
System.out.println("完成 初始化本地病患表准备同步将标志位置“0”..");
// 自动同步住院号相同姓名科室床号相同
// 同步逻辑1更新住院号科室床号姓名全部相同的记录并标注flag=1