增加填写同步日志功能
This commit is contained in:
parent
0ef4ec268e
commit
6864c23124
@ -0,0 +1,43 @@
|
||||
package com.ruoyi.system.fantang.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 科室管理对象 ft_depart
|
||||
*
|
||||
* @author ft
|
||||
* @date 2020-11-24
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("ft_sync_log")
|
||||
public class FtSyncLogDao implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
|
||||
/** 同步时间 */
|
||||
@TableField(value = "created_at")
|
||||
private Date createAt;
|
||||
|
||||
@TableField("total_record")
|
||||
private Long totalRecord;
|
||||
|
||||
@TableField("sync_record")
|
||||
private Long SyncRecord;
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.ruoyi.system.fantang.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.system.fantang.domain.FtSyncLogDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface FtSyncLogDaoMapper extends BaseMapper<FtSyncLogDao> {
|
||||
|
||||
}
|
@ -3,12 +3,17 @@ package com.ruoyi.system.service.impl;
|
||||
import com.ruoyi.common.annotation.DataSource;
|
||||
import com.ruoyi.common.enums.DataSourceType;
|
||||
import com.ruoyi.system.fantang.domain.FtRemotePatientDao;
|
||||
import com.ruoyi.system.fantang.domain.FtSyncLogDao;
|
||||
import com.ruoyi.system.fantang.mapper.FtPatientDaoMapper;
|
||||
import com.ruoyi.system.fantang.mapper.FtSyncLogDaoMapper;
|
||||
import com.ruoyi.system.fantang.mapper.FtSyncPatientDaoMapper;
|
||||
import com.ruoyi.system.service.ISyncPatientService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@DataSource(value = DataSourceType.MASTER)
|
||||
@ -20,7 +25,11 @@ public class SyncPatientServiceImpl implements ISyncPatientService {
|
||||
@Autowired
|
||||
private FtPatientDaoMapper patientDaoMapper;
|
||||
|
||||
@Autowired
|
||||
private FtSyncLogDaoMapper syncLogDaoMapper;
|
||||
|
||||
// 从远程数据源插上病患数据
|
||||
@Transactional
|
||||
@Override
|
||||
public Integer insertToLocalSync(List<FtRemotePatientDao> remotePatientDaoList) {
|
||||
// 清空本地中间表数据,准备接收同步数据
|
||||
@ -35,8 +44,7 @@ public class SyncPatientServiceImpl implements ISyncPatientService {
|
||||
int ret = patientDaoMapper.initForSync();
|
||||
|
||||
// 更新住院号相同的记录,并标注flag=1
|
||||
ret = patientDaoMapper.syncEqualHospitalId();
|
||||
System.out.println(ret);
|
||||
int syncCount = patientDaoMapper.syncEqualHospitalId();
|
||||
|
||||
// 从中间表添加新增病患数据,并标注flag=2
|
||||
ret = patientDaoMapper.syncNewHospitalId();
|
||||
@ -48,6 +56,13 @@ public class SyncPatientServiceImpl implements ISyncPatientService {
|
||||
// 为新病患记录填入对应的科室id
|
||||
patientDaoMapper.updateDepartIDToNewPatient();
|
||||
|
||||
// 创建同步日志记录
|
||||
FtSyncLogDao syncLogDao = new FtSyncLogDao();
|
||||
syncLogDao.setCreateAt(new Date());
|
||||
syncLogDao.setTotalRecord((long) remotePatientDaoList.size());
|
||||
syncLogDao.setSyncRecord((long) syncCount);
|
||||
syncLogDaoMapper.insert(syncLogDao);
|
||||
|
||||
return remotePatientDaoList.size();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user