2022年2022年旧版数据导入新版数据方法 .pdf

上传人:Che****ry 文档编号:34251266 上传时间:2022-08-15 格式:PDF 页数:6 大小:48.01KB
返回 下载 相关 举报
2022年2022年旧版数据导入新版数据方法 .pdf_第1页
第1页 / 共6页
2022年2022年旧版数据导入新版数据方法 .pdf_第2页
第2页 / 共6页
点击查看更多>>
资源描述

《2022年2022年旧版数据导入新版数据方法 .pdf》由会员分享,可在线阅读,更多相关《2022年2022年旧版数据导入新版数据方法 .pdf(6页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、旧版数据导入新版数据方法.txt铁饭碗的真实含义不是在一个地方吃一辈子饭,而是一辈子到哪儿都有饭吃。就算是一坨屎,也有遇见屎壳郎的那天。所以你大可不必为今天的自己有太多担忧。 2010.01.17 龙岗数据转新版数据旧数据库类型A 旧数据库类型B 先备份新旧数据库,然后升级1. DEPART - tbDepartment 31 - 0 其它不变改表与 DOCTORUSER关联,因此要修正DOCTORUSER.DEPARTID SQL 语句如下旧数据库类型A: DELETE FROM MedImgMgrSysLG.dbo.tbDepartment; DELETE FROM EndoscopeLG

2、.dbo.DEPART WHERE DEPARTID=-1; UPDATE EndoscopeLG.dbo.DEPART SET DEPARTID=0 WHERE DEPARTID=31; UPDATE EndoscopeLG.dbo.DOCTORUSER SET DEPARTID=0 WHERE DEPARTID=31; INSERT MedImgMgrSysLG.dbo.tbDepartment(DepartmentID, DepartmentName) SELECT DEPARTID, DEPARTDESC FROM EndoscopeLG.dbo.DEPART; 2. DOCTORUS

3、ER - tbDoctor (1)LEVELCODE - AuthCode 255 - 1023 1 - 1 2 - 563 (2)LOGINPWD - LoginPasswd (3)WORKID - WorkID DOCTORUSER.WorkID = tbDoctor.WORKID + 1000 ? (4) HIRESTATUS - HireStatus DOCTORUSER.Status = tbDoctor.HIRESTATUS - 1 (5) SEX - Sex 0 - 1 1 - 2 2 - 0 (6) DUTYID - DutyID DOCTORUSER.DutyID = tbD

4、octor.DUTYID - 1 (7) CNNAME - LoginName, NameCN DOCTORUSER.LoginName = tbDoctor.CNNAME DOCTORUSER.NameCN = tbDoctor.CNNAME 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 6 页 - - - - - - - - - (8) DEPARTID - DepartmentID DOCTORUSER.DepartmentID = tbDoctor.DEPART

5、ID SQL 语句如下旧数据库类型A: 首先修改LEVELCODE 类型由 tinyint改为 int ,然后执行UPDATE EndoscopeLG.dbo.DOCTORUSER SET LEVELCODE=1023 WHERE LEVELCODE=255; UPDATE EndoscopeLG.dbo.DOCTORUSER SET LEVELCODE=563 WHERE LEVELCODE=2; UPDATE EndoscopeLG.dbo.DOCTORUSER SET SEX=SEX+1; UPDATE EndoscopeLG.dbo.DOCTORUSER SET SEX=0 WHERE

6、 SEX=3; UPDATE EndoscopeLG.dbo.DOCTORUSER SET HIRESTATUS=HIRESTATUS; UPDATE EndoscopeLG.dbo.DOCTORUSER SET DUTYID=DUTYID-1; INSERT MedImgMgrSysLG.dbo.tbDoctor(WorkID, DepartmentID, LoginName, LoginPasswd, AuthCode, HireStatus, DutyID, Sex) SELECT WORKID, DEPARTID, CNNAME, ISNULL(LOGINPWD,), LEVELCOD

7、E, ISNULL(HIRESTATUS, 0), DUTYID, SEX FROM EndoscopeLG.dbo.DOCTORUSER; 3. tbPatientInformation - PATIENTE, PATIENTSELF (1) MedicalID - PATIENTSELF.MEDICCAREID (2) InHospitalID - PATIENTSELF.INHOSPITAL (3) OutPatientID - IF (PATIENTSELF.INHOSTPITAL = NULL) IDPATIENTSELF.SICKBEDID ELSE NULL (4) CheckI

8、D - 该表的 CheckID 根据旧版数据库的版本情况,由两种可能 1 图片按 PATIENTSELF.ENDSCPID 存放的要对同一机台号的同一天的病例进行处理,生成RECORDCDNO 然后同 2 处理 2 图片按 PATIENTSELF.RECORDCDNO存放的CheckID - PATIENTSELF.RECORDCDNO (5) InstrumentID - PATIENTSELF.INSTRUMENTID (6) PatientName - PATIENTSELF.PATIENTNAME (7) Sex - PATIENTSELF.SEX 0 - 1 名师资料总结 - - -

9、精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 6 页 - - - - - - - - - 1 - 2 2 - 0 (8) Age - PATIENTSELF.AGE AgeType - PATIENTSELF.AGE IF PATIENTSELF.AGE 200 THEN tbPatientInformation.Age = PATIENTSELF.AGE tbPatientInformation.AgeType = 0 IF PATIENTSELF.AGE 200 AND PATIENTSE

10、LF.AGE 300 THEN tbPatientInformation.Age = PATIENTSELF.AGE - 300 tbPatientInformation.AgeType = 2 (9) Address - PATIENTSELF.ADDRESS (10) Phone - PATIENTSELF.PHONE (11) AskDepartment - PATIENTSELF.ASKDEPT (12) AskDoctor - PATIENTSELF.ASKDR (13) CheckDoctor - PATIENTSELF.CHECKDR (14) CheckDepartment -

11、 NULL (15) CheckTime - PATIENTSELF.CHECKTIME (16) ReportDoctor - PATIENTSELF.REPORTDR (17) ReportDepartment - NULL (18) ReportTime - PATIENTSELF.REPORTTIME (19) ImageCount - PATIENTSELF.IMAGECOUNT (20) CheckStatus - PATIENTSELF.CHECKSTATUS (21) CheckDesc - PATIENTSELF.CHECKDESC (22) DiagDesc - PATIE

12、NTSELF.DIAGNOSEDESC (23) PatientType - 0 (24) Fee - PATIENTE.FEE (25) AskAdvice - PATIENTE.ASKADVICE (26) CheckPos - PATIENTE.CHECKPARTDESC (27) BedID - IF (PATIENTSELF.INHOSTPITAL != NULL) IDPATIENTSELF.SICKBEDID ELSE NULL (28) OrganCount - (30) Positive - 对于有阳性的数据表特殊处理SQL 语句如下旧数据库类型A:( 龙岗 78M数据库 )

13、 修改 PATIENTSELF 表,将 PATIENTE中的部分字段FEE 、ASKADVICE 、CHECKPARTDESC加入其中修改 PATIENTSELF 表,加入AGETYPE 字段,类型int 修改 PATIENTSELF 表,加入OUTPAITENTID 字段,类型varchar 20 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 6 页 - - - - - - - - - 修改 PATIENTSELF 表,加入ASKDATE 字段,类型varchar 2

14、0 修改 PATIENTSELF 表,加入CHECKDAYID 字段,类型int 选中旧数据库UPDATE PATIENTSELF SET PATIENTSELF.FEE=PATIENTE.FEE, PATIENTSELF.ASKADVICE=PATIENTE.ASKADVICE, PATIENTSELF.CHECKPARTDESC=PATIENTE.CHECKPARTDESC FROM PATIENTSELF, PATIENTE WHERE PATIENTSELF.ENDSCPID=PATIENTE.ENDSCPID AND PATIENTSELF.INSTRUMENTID=PATIENTE

15、.INSTRUMENTID; / 清除错误的数据DELETE FROM PATIENTSELF WHERE ASKTIME IS NULL; UPDATE PATIENTSELF SET AGETYPE=0 WHERE AGE200 AND AGE300; UPDATE PATIENTSELF SET SEX=SEX+1; UPDATE PATIENTSELF SET SEX=0 WHERE SEX=3; UPDATE PATIENTSELF SET OUTPAITENTID=SICKBEDID, SICKBEDID=NULL WHERE INHOSPITAL IS NULL; UPDATE

16、PATIENTSELF SET OUTPAITENTID=SICKBEDID, SICKBEDID= WHERE INHOSPITAL=; UPDATE PATIENTSELF SET ASKDATE=LTRIM(STR(DATEPART(year, ASKTIME)+RIGHT(CAST(POWER(10,2) AS varchar)+DATEPART(month, ASKTIME),2)+RIGHT(CAST(POWER(10,2) AS varchar)+DATEPART(day, ASKTIME),2); DROP PROCEDURE UPDATECHECKDAYID; CREATE

17、PROCEDURE UPDATECHECKDAYID INSTRUID INT AS DECLARE dayid int DECLARE patientid int-临时变量,用来保存游标值DECLARE askdate varchar(20) DECLARE oldaskdate varchar(20) set dayid=1 set oldaskdate= BEGIN TRAN - 申明事务- 申明游标为 patientid DECLARE order_cursor CURSOR FOR SELECT PATIENTID, ASKDATE FROM PATIENTSELF WHERE IN

18、STRUMENTID=INSTRUID ORDER BY ASKDATE - 打开游标open order_cursor 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 6 页 - - - - - - - - - FETCH NEXT FROM order_cursor INTO patientid, askdate WHILE FETCH_STATUS = 0 - 返回被 FETCH 语句执行的最后游标的状态,而不是任何当前被连接打开的游标的状态。begin if as

19、kdate=oldaskdate begin set dayid=dayid+1 end else begin set dayid=1 set oldaskdate=askdate end -执行 sql 操作 UPDATE PATIENTSELF SET CHECKDAYID=dayid WHERE PATIENTID=patientid FETCH NEXT FROM order_cursor INTO patientid, askdate end COMMIT TRAN -提交CLOSE order_cursor-关闭游标DEALLOCATE order_cursor-释放游标GO 针对

20、每一个机台号,执行EXEC UPDATECHECKDAYID INSTRUID = 1 EXEC UPDATECHECKDAYID INSTRUID = 2 EXEC UPDATECHECKDAYID INSTRUID = 3 EXEC UPDATECHECKDAYID INSTRUID = 4 EXEC UPDATECHECKDAYID INSTRUID = 5 EXEC UPDATECHECKDAYID INSTRUID = 6 EXEC UPDATECHECKDAYID INSTRUID = 7 . UPDATE PATIENTSELF SET RECORDCDNO=ASKDATE+RI

21、GHT(CAST(POWER(10,3) AS varchar)+CHECKDAYID,3); INSERT MedImgMgrSysLG.dbo.tbPatientInformation(MedicalID, InHospitalID, OutPatientID, CheckID, InstrumentID, PatientName, Sex, Age, AgeType, Address, Phone, AskDepartment, AskDoctor, CheckDoctor, CheckTime, ReportDoctor, ReportTime, ImageCount, CheckSt

22、atus, CheckDesc, DiagDesc, PatientType, Fee, AskAdvice, CheckPos, BedID) SELECT MEDICCAREID, INHOSPITAL, OUTPAITENTID, RECORDCDNO, INSTRUMENTID, PATIENTNAME, SEX, AGE, AGETYPE, ADDRESS, PHONE, ASKDEPT, ASKDR, CHECKDR, CHECKTIME, REPORTDR, REPORTTIME, IMAGECOUNT, CHECKSTATUS, CHECKDESC, DIAGNOSEDESC,

23、 0, FEE, ASKADVICE, CHECKPARTDESC, SICKBEDID FROM EndoscopeLG.dbo.PATIENTSELF; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 6 页 - - - - - - - - - 旧数据库类型B:( 龙岗 20M数据库 ) 4. tbPatientImage - PATIENTIMAGE 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 6 页 - - - - - - - - -

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁