1 Star 0 Fork 0

smartsteps/docsify

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

历史数据迁移2.4

  • 本文档说明历史数据从2.2升级到2.3和2.4的历史数据操作说明

1.备份数据备份和还原

备份数据库:
mysqldump -p3306 -uroot -p --add-drop-table YHDB > /home/yahua/yhdb.sql
数据库密码:Yahua3585668yh

2.老人基本信息表迁移, 老人信息基本表pi_oldman_info废弃,使用新的老人信息基本表pi_oldman_base

先清理数据
delete from pi_oldman_base where oldmanId in (select oldmanId from pi_oldman_info)
再进行更新
insert into pi_oldman_base (  
  oldmanId,  
    orgId,  
    oldmanNum,  
    oldmanHeadUrl,  
    oldmanName,  
    oldmanSex,  
    oldmanIdcard,  
    oldmanStatus,  
    oldmanNation,  
    oldmanBirth,  
    oldmanAgent, 
	oldmanExtraInfo,
	oldmanHealthInfo, 
    isDelete,  
    createTime,  
    createUser,  
    updateTime,  
    updateUser,  
    remark  
 ) select   
 oldmanId,  
 orgId,  
 oldmanNum,  
 oldmanHeadUrl,  
 oldmanName,  
 oldmanSex,  
 oldmanIdcard,  
 oldmanStatus,  
 oldmanNation,  
 oldmanBirth,  
 oldmanAgent,
 '[]' as oldmanExtraInfo,
 '[]' as oldmanHealthInfo, 	 
 (case isDelete 
	   when 1 then 0
		 when 0 then 1
		 else isDelete
		 end
		 )
	  as isDelete,   
 createTime,  
 createUser,  
 updateTime,  
 updateUser,  
 remark  
   
 from pi_oldman_info 

3.更新长者居住信息表 pi_oldman_live_record

delete from pi_oldman_live_record where oldmanId in (select oldmanId from pi_oldman_info)

1.把所有的居住信息表导入居住表
insert into pi_oldman_live_record  select * from pi_live_record
2.把所有的试住开始数据导入居住表

insert into pi_oldman_live_record
select   
tryid as liveRecordId,  
orgid,  
oldmanId,  
startTime as operatorTime,  
41 as operatorStatus, 			
isDelete,  
createTime,  
createUser,  
updateTime,  
updateUser,  
remark from pi_try_record where startTime is true

3.把所有的试住结束数据导入到居住表

insert into pi_oldman_live_record
select   
md5(UUID())  as liveRecordId,  
orgid,  
oldmanId,  
endTime as operatorTime,  
42 as operatorStatus, 
			
isDelete,  
createTime,  
createUser,  
updateTime,  
updateUser,  
remark from pi_try_record where endTime is true

4.更新长者信息居住表 pi_oldman_live

delete from pi_oldman_live where oldmanId in (select oldmanId from pi_oldman_info)
1.把pi_oldman_info 中的 1:在住、2.待住、3.试住 信息插入到 pi_oldman_live 居住信息表
insert into pi_oldman_live(oldmanId,orgId,signContractTime,liveInTime,liveOutTime,quitCause,
billingStartTime,bedAmt,levelId,levelAmt,isDelete,createTime,createUser,updateTime,updateUser,remark)
select 
a.oldmanId,
a.orgId,
a.signContractTime,
a.liveInTime ,
a.newLiveOutTime as liveOutTime,
a.retreatCasuse as quitCause,
a.billingTimeStart as billingStartTime,

a.bedAmt ,
a.levelId ,
a.levelAmt ,
(case a.isDelete 
	   when 1 then 0
		 when 0 then 1
		 else a.isDelete
		 end
		 )
	  as isDelete,

a.createTime ,
a.createUser ,
a.updateTime ,
a.updateUser ,
a.remark 
from pi_oldman_info as a
where a. oldmanStatus=1 or a. oldmanStatus=2 or a. oldmanStatus=4 


2.更新试住信息到 pi_oldman_live

update pi_oldman_live as a inner join (select startTime,endTime,oldmanId from pi_try_record) as b  on a.oldmanId=b.oldmanId set a.tryStartTime=b.startTime,tryEndTime=b.endTime
 
3.更新 pi_oldman_checkin 位置房间数据到 pi_oldman_live 长者信息表中
update pi_oldman_live as a inner join (
select oldmanId,
( case when  houseId is not null and trim(houseId)!=''  then houseId 
       when  floorId is not null and trim(floorId)!=''  then  floorId
       when  unitId is not null and trim(unitId)!=''  then  unitId
       when  buildingId is not null and trim(buildingId)!=''  then  buildingId
       when  areaId is not null and trim(areaId)!=''  then  areaId
             else ''
    end

)  AS locationId,
roomId ,
bedId from pi_oldman_checkin
 ) as c on a.oldmanId=c.oldmanId set a.locationId=c.locationId,a.roomId=c.roomId,a.bedId=c.bedId
 
 3.如果护理级别已经删除,则设置为null
update pi_oldman_live set levelId=null where levelId in (select levelId from pi_nursing_level where isDelete=0);

空文件

简介

取消

发行版

暂无发行版

贡献者 (1)

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/iotcom/docsify.git
git@gitee.com:iotcom/docsify.git
iotcom
docsify
docsify
master

搜索帮助