完善远程病患同步逻辑
This commit is contained in:
parent
63d72d7f51
commit
820bb00831
@ -26,5 +26,8 @@ public interface FtPatientDaoMapper extends BaseMapper<FtPatientDao> {
|
|||||||
@Update("update ft_patient set off_flag = 1 where sync_flag = 0")
|
@Update("update ft_patient set off_flag = 1 where sync_flag = 0")
|
||||||
public int updateOffHospitalFlag();
|
public int updateOffHospitalFlag();
|
||||||
|
|
||||||
|
@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();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public class SyncPatientServiceImpl implements ISyncPatientService {
|
|||||||
// 从远程数据源插上病患数据
|
// 从远程数据源插上病患数据
|
||||||
@Override
|
@Override
|
||||||
public Integer insertToLocalSync(List<FtRemotePatientDao> remotePatientDaoList) {
|
public Integer insertToLocalSync(List<FtRemotePatientDao> remotePatientDaoList) {
|
||||||
// 情况本地中间表数据
|
// 清空本地中间表数据,准备接收同步数据
|
||||||
syncPatientDaoMapper.delete(null);
|
syncPatientDaoMapper.delete(null);
|
||||||
|
|
||||||
// 遍历数据源,逐条插入本地中间表
|
// 遍历数据源,逐条插入本地中间表
|
||||||
@ -34,20 +34,19 @@ public class SyncPatientServiceImpl implements ISyncPatientService {
|
|||||||
// 初始化本地病患表准备同步,将标志位置“0”
|
// 初始化本地病患表准备同步,将标志位置“0”
|
||||||
int ret = patientDaoMapper.initForSync();
|
int ret = patientDaoMapper.initForSync();
|
||||||
|
|
||||||
// 更新住院号相同的记录,并标注
|
// 更新住院号相同的记录,并标注flag=1
|
||||||
ret = patientDaoMapper.syncEqualHospitalId();
|
ret = patientDaoMapper.syncEqualHospitalId();
|
||||||
System.out.println(ret);
|
System.out.println(ret);
|
||||||
|
|
||||||
// 从中间表添加新增病患数据
|
// 从中间表添加新增病患数据,并标注flag=2
|
||||||
ret = patientDaoMapper.syncNewHospitalId();
|
ret = patientDaoMapper.syncNewHospitalId();
|
||||||
System.out.println(ret);
|
System.out.println(ret);
|
||||||
|
|
||||||
// 将没有同步的病患数据设置为出院状态
|
// 将没有同步的病患数据设置为出院状态, off_flag=1
|
||||||
patientDaoMapper.updateOffHospitalFlag();
|
patientDaoMapper.updateOffHospitalFlag();
|
||||||
|
|
||||||
|
// 为新病患记录填入对应的科室id
|
||||||
|
patientDaoMapper.updateDepartIDToNewPatient();
|
||||||
|
|
||||||
|
|
||||||
return remotePatientDaoList.size();
|
return remotePatientDaoList.size();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user