不同数据源切换同步远程病患到本地
This commit is contained in:
parent
c91b0f55e5
commit
a2798f7a1f
@ -34,6 +34,14 @@
|
|||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-system</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-system</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package com.ruoyi.quartz.task;
|
package com.ruoyi.quartz.task;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.annotation.DataSource;
|
||||||
|
import com.ruoyi.common.enums.DataSourceType;
|
||||||
|
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 org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -8,20 +13,17 @@ import org.springframework.stereotype.Component;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@DataSource(value = DataSourceType.SLAVE)
|
||||||
@Component("SyncPatient")
|
@Component("SyncPatient")
|
||||||
public class ftSyncPatient
|
public class ftSyncPatient {
|
||||||
{
|
@Autowired
|
||||||
public void ryParams(String params)
|
private FtRemotePatientDaoMapper ftRemotePatientDaoMapper;
|
||||||
{
|
|
||||||
System.out.println("执行有参方法:" + params);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ryNoParams()
|
@Autowired
|
||||||
{
|
private SyncPatientServiceImpl syncPatientService;
|
||||||
System.out.println("执行无参方法");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ftGetRemotePatient() {
|
public void ftGetRemotePatient() {
|
||||||
|
System.out.println("执行同步远程病患数据");
|
||||||
|
syncPatientService.insertToLocalSync(ftRemotePatientDaoMapper.selectList(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ private static final long serialVersionUID=1L;
|
|||||||
|
|
||||||
// 科室名称
|
// 科室名称
|
||||||
@TableField("depart_name")
|
@TableField("depart_name")
|
||||||
private String depart_name;
|
private String departName;
|
||||||
|
|
||||||
// 床号
|
// 床号
|
||||||
@TableField("bed_id")
|
@TableField("bed_id")
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.ruoyi.system.fantang.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程病患数据实体类
|
||||||
|
*
|
||||||
|
* @author 陈智兴
|
||||||
|
* @date 2020-11-24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("ft_sync")
|
||||||
|
public class FtSyncPatientDao implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
|
||||||
|
/** 住院号 */
|
||||||
|
@TableField(value = "hospital_id")
|
||||||
|
private String hospitalid;
|
||||||
|
|
||||||
|
/** 姓名 */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
// 科室名称
|
||||||
|
@TableField("depart_name")
|
||||||
|
private String departName;
|
||||||
|
|
||||||
|
// 床号
|
||||||
|
@TableField("bed_id")
|
||||||
|
private String bedId;
|
||||||
|
|
||||||
|
}
|
@ -2,6 +2,7 @@ package com.ruoyi.system.fantang.mapper;
|
|||||||
|
|
||||||
import com.ruoyi.system.fantang.domain.FtFoodDao;
|
import com.ruoyi.system.fantang.domain.FtFoodDao;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 食品管理Mapper接口
|
* 食品管理Mapper接口
|
||||||
@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
* @author ft
|
* @author ft
|
||||||
* @date 2020-11-24
|
* @date 2020-11-24
|
||||||
*/
|
*/
|
||||||
|
@Repository
|
||||||
public interface FtFoodDaoMapper extends BaseMapper<FtFoodDao> {
|
public interface FtFoodDaoMapper extends BaseMapper<FtFoodDao> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,10 @@ package com.ruoyi.system.fantang.mapper;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.ruoyi.system.fantang.domain.FtRemotePatientDao;
|
import com.ruoyi.system.fantang.domain.FtRemotePatientDao;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|
||||||
public interface ftRemotePatientDaoMapper extends BaseMapper<FtRemotePatientDao> {
|
@Repository
|
||||||
|
public interface FtRemotePatientDaoMapper extends BaseMapper<FtRemotePatientDao> {
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.ruoyi.system.fantang.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.system.fantang.domain.FtRemotePatientDao;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface FtSyncPatientDaoMapper extends BaseMapper<FtRemotePatientDao> {
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.ruoyi.system.fantang.domain.FtRemotePatientDao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程病患数据同步服务层接口
|
||||||
|
*/
|
||||||
|
public interface ISyncPatientService {
|
||||||
|
public Integer insertToLocalSync(List<FtRemotePatientDao> remotePatientDaoList);
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
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.mapper.FtSyncPatientDaoMapper;
|
||||||
|
import com.ruoyi.system.service.ISyncPatientService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@DataSource(value = DataSourceType.MASTER)
|
||||||
|
@Service
|
||||||
|
public class SyncPatientServiceImpl implements ISyncPatientService {
|
||||||
|
@Autowired
|
||||||
|
private FtSyncPatientDaoMapper syncPatientDaoMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer insertToLocalSync(List<FtRemotePatientDao> remotePatientDaoList) {
|
||||||
|
for (FtRemotePatientDao dao : remotePatientDaoList) {
|
||||||
|
syncPatientDaoMapper.insert(dao);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user