代码拉取完成,页面将自动刷新
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);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。