D_Insert.sql 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. --添加病种重复病例除外设置
  2. --pip与各病种重复
  3. if not exists(select * from D_RepeatReportSetting where ReportClass =9 and RepeatReportClass>10)
  4. BEGIN
  5. --甲状腺癌(手术治疗)·TC
  6. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  7. VALUES (9, 15, N'06.2、06.3、06.4、06.5', NULL, 1)
  8. --房间隔缺损手术·ASD
  9. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  10. VALUES (9, 30, N'35.61', NULL, 1)
  11. --室间隔缺损手术·VSD
  12. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  13. VALUES (9, 31, N'35.62', NULL, 1)
  14. --甲状腺结节(手术治疗)·TN
  15. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  16. VALUES (9,37, N'06.2、06.3、06.4、06.5', NULL, 1)
  17. --复杂性视网膜脱离(手术治疗)·RD
  18. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  19. VALUES (9, 38, N'13.19、13.3、13.41、13.42、13.43、13.59、13.64、13.65、13.69、13.70、13.71、13.72、13.8、13.90', NULL, 1)
  20. --原发性急性闭角型青光眼(手术治疗)·PACG
  21. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  22. VALUES (9, 39, N'13.19、13.3、13.41、13.59、13.70、13.71、13.90', NULL, 1)
  23. --发育性髋关节发育不良·DDH
  24. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  25. VALUES (9, 52, N'76.94、79.8', NULL, 1)
  26. END
  27. --DVT与各病种重复
  28. if not exists(select * from D_RepeatReportSetting where ReportClass =12 and RepeatReportClass>7)
  29. BEGIN
  30. --二尖瓣置换术·MVR
  31. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  32. VALUES (12, 24, N'35.0、35.2', NULL, 1)
  33. --主动脉瓣置换术·AVR
  34. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  35. VALUES (12, 29, N'35.0、35.2', NULL, 1)
  36. --胃癌(手术治疗)·GC
  37. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  38. VALUES (12, 33, N'43.6、43.7、43.8、43.9', NULL, 1)
  39. --子宫肌瘤(手术治疗)·UM
  40. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  41. VALUES (12, 34, N'68.2', NULL, 1)
  42. --宫颈癌(手术治疗)·CC
  43. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  44. VALUES (12, 42, N'68.3、68.4、68.5、68.6、68.7', NULL, 1)
  45. --结肠癌(手术治疗)·CoC
  46. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  47. VALUES (12, 43, N'45.7', NULL, 1)
  48. END
  49. --VTE与各病种重复
  50. if not exists(select * from D_RepeatReportSetting where ReportClass =36 and RepeatReportClass=16)
  51. BEGIN
  52. --肺癌(手术治疗)·LC
  53. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  54. VALUES (36, 16, NULL, N'C34.0、C34.1、C34.2、C34.3、C34.8、C34.9', 1)
  55. --脑膜瘤(初发手术治疗)·MEN
  56. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  57. VALUES (36, 25, NULL, N'C70.0、C70.9', 1)
  58. --胶质瘤(初发,手术治疗)·GLI
  59. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  60. VALUES (36, 27, NULL, N'C71.0、C71.1、C71.2、C71.3、C71.4、C71.5、C71.6、C71.7、C71.8、C71.9', 1)
  61. --垂体腺瘤(初发,手术治疗)·PA
  62. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  63. VALUES (36, 28, NULL, N'C75.1', 1)
  64. --胃癌(手术治疗)·GC
  65. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  66. VALUES (36, 33, NULL, N'C16.0、C16.1、C16.2、C16.3、C16.4、C16.5、C16.6、C16.8、C16.9', 1)
  67. --舌鳞状细胞癌(手术治疗)·TSCC
  68. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  69. VALUES (36, 40, NULL, N'C01.x、C02.0、C02.1、C02.2、C02.3、C02.4、C02.8、C02.9', 1)
  70. --宫颈癌(手术治疗)·CC
  71. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  72. VALUES (36, 42, NULL, N'C53.0、C53.1、C53.8、C53.9', 1)
  73. --结肠癌(手术治疗)·CoC
  74. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  75. VALUES (36, 43, NULL, N'C18.0、C18.1、C18.2、C18.3、C18.4、C18.5、C18.6、C18.7、C18.8、C18.9', 1)
  76. --儿童急性淋巴细胞白血病(初始诱导化疗)·ALL
  77. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  78. VALUES (36, 48, NULL, N'C91.0', 1)
  79. --儿童急性早幼粒细胞白血病(初始化疗)·APL
  80. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  81. VALUES (36, 49, NULL, N'C92.4', 1)
  82. END
  83. --HF与各病种重复
  84. if not exists(select * from D_RepeatReportSetting where ReportClass =2)
  85. BEGIN
  86. --急性心肌梗死(ST 段抬高型,首次住院)·STEMI
  87. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  88. VALUES (2, 1, NULL, N'I21.0、I21.1、I21.2、I21.3', 1)
  89. END
  90. --CS与各病种重复
  91. if not exists(select * from D_RepeatReportSetting where ReportClass =10)
  92. BEGIN
  93. --感染分娩母婴阻断·HBV
  94. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  95. VALUES (10, 50, N'74.0、74.1、74.2、74.4、74.99', N'Z37', 1)
  96. END
  97. --AVR与各病种重复
  98. if not exists(select * from D_RepeatReportSetting where ReportClass =29)
  99. BEGIN
  100. --二尖瓣置换术·MVR
  101. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  102. VALUES (29, 24, N'35.0、35.2',NULL, 1)
  103. END
  104. --VTE与pip
  105. if not exists(select * from D_RepeatReportSetting where ReportClass =36 and RepeatReportClass=9)
  106. BEGIN
  107. --pip
  108. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  109. VALUES (36, 9, N'06.2~06.5、80.6、13.0~13.9、17.11~17.13、17.21~17.24、53.00~53.17、85.2~85.4、38.1、81.1、01.24、80.50~80.59、03.53、21.72、76.72~76.79、79.31~79.39、76.94、79.8、78.5~78.6、83.13~83.14、62.0~62.9、64.0~64.4、35.62、35.61、74.0、74.1、74.2、74.4、74.99', NULL, 1)
  110. END
  111. --reportleak 添加RepeatReportClass
  112. if not exists(select * from syscolumns where id=object_id('Report_Leak') and name='RepeatReportClass')
  113. BEGIN
  114. EXEC dbo.sp_executesql @statement = N'alter table Report_Leak add RepeatReportClass nvarchar(max) NULL'
  115. END
  116. --[Q_Quanxian]表添加分析图表权限
  117. if not exists (select * from [Q_Quanxian] where ID = 25)
  118. begin
  119. SET IDENTITY_INSERT [dbo].[Q_Quanxian] ON
  120. INSERT [dbo].[Q_Quanxian] ([Id], [QuanxianName], [Sort]) VALUES (25, N'分析图表', 25)
  121. SET IDENTITY_INSERT [dbo].[Q_Quanxian] OFF
  122. end
  123. --科室表增加根目录字段
  124. if not exists(select * from syscolumns where id=object_id('Report_UserDept') and name='FullPath')
  125. BEGIN
  126. EXEC dbo.sp_executesql @statement = N'alter table Report_UserDept add ParentPath nvarchar(max) NULL'
  127. EXEC dbo.sp_executesql @statement = N'alter table Report_UserDept add FullPath nvarchar(max) NULL'
  128. EXEC dbo.sp_executesql @statement = N'alter table Report_UserDept add FullName nvarchar(max) NULL'
  129. END
  130. --pip与BC
  131. if not exists(select * from D_RepeatReportSetting where ReportClass =9 and RepeatReportClass=17)
  132. BEGIN
  133. --乳腺癌(手术治疗)·BC
  134. INSERT [dbo].[D_RepeatReportSetting] ([ReportClass], [RepeatReportClass], [Icd9Code], [Icd10Code], [Enabled])
  135. VALUES (9, 17, N'85.2、85.3、85.4', NULL, 1)
  136. END
  137. --系统属性设置:对接失败数据是否自动退回填报员设置
  138. set Identity_insert [dbo].[Report_DistributeDept] ON
  139. if not exists (select * from [Report_DistributeDept] where ID = 27)
  140. INSERT [dbo].[Report_DistributeDept] ([ID] ,[DistributeDeptName] ,[IsStart] ,[HasValue]) VALUES (27, N'对接失败数据是否自动退回填报员', 0, NULL)
  141. set Identity_insert [dbo].[Report_DistributeDept] OFF
  142. --增加 D_MedicalRecord 扩展属性字段
  143. if not exists(select * from syscolumns where id=object_id('D_MedicalRecord') and name='ExtFields')
  144. BEGIN
  145. EXEC dbo.sp_executesql @statement = N'alter table D_MedicalRecord add ExtFields nvarchar(max) NULL'
  146. END
  147. --漏报表提取率相关字段
  148. if not exists(select * from syscolumns where id=object_id('Report_Leak') and name='filedNum')
  149. BEGIN
  150. EXEC dbo.sp_executesql @statement = N'alter table Report_Leak add FiledNum int NULL'
  151. EXEC dbo.sp_executesql @statement = N'alter table Report_Leak add NoFilledNum int NULL'
  152. EXEC dbo.sp_executesql @statement = N'alter table Report_Leak add FiledRate float NULL'
  153. END
  154. --增加 DataBaseAutoBak 分钟字段
  155. if not exists(select * from syscolumns where id=object_id('DataBaseAutoBak') and name='AutoDbBakAtMinute')
  156. BEGIN
  157. EXEC dbo.sp_executesql @statement = N'alter table DataBaseAutoBak add AutoDbBakAtMinute int default 0'
  158. END
  159. --添加回收站权限
  160. if not exists (select * from [Q_Quanxian] where ID = 27)
  161. begin
  162. SET IDENTITY_INSERT [dbo].[Q_Quanxian] ON
  163. INSERT [dbo].[Q_Quanxian] ([Id], [QuanxianName], [Sort]) VALUES (27, N'回收站', 27)
  164. SET IDENTITY_INSERT [dbo].[Q_Quanxian] OFF
  165. end
  166. --D_MedicalRecord 卫健委对接code
  167. if not exists(select * from syscolumns where id=object_id('D_MedicalRecord') and name='Ncis_JoinCode')
  168. BEGIN
  169. EXEC dbo.sp_executesql @statement = N'alter table D_MedicalRecord add Ncis_JoinCode int NULL'
  170. END
  171. --系统属性设置:账号禁用设置
  172. set Identity_insert [dbo].[Report_DistributeDept] ON
  173. if not exists (select * from [Report_DistributeDept] where ID = 28)
  174. INSERT [dbo].[Report_DistributeDept] ([ID] ,[DistributeDeptName] ,[IsStart] ,[HasValue]) VALUES (28, N'账号禁用设置', 0, '5')
  175. set Identity_insert [dbo].[Report_DistributeDept] OFF
  176. --增加 Q_UserProfile LoginDate:登录时间 UserLoginFailNum:登录失败次数
  177. if not exists(select * from syscolumns where id=object_id('Q_UserProfile') and name='LoginDate')
  178. BEGIN
  179. EXEC dbo.sp_executesql @statement = N'alter table Q_UserProfile add LoginDate datetime NULL'
  180. EXEC dbo.sp_executesql @statement = N'alter table Q_UserProfile add UserLoginFailNum int NULL'
  181. END
  182. --增加Report_LeakLog LeakId的索引
  183. if not exists( select * from sysindexes where id=object_id('Report_LeakLog') and name='NonClusteredIndex-LeakID')
  184. begin
  185. CREATE NONCLUSTERED INDEX [NonClusteredIndex-LeakID] ON [dbo].[Report_LeakLog]
  186. (
  187. [LeakId] ASC
  188. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  189. end
  190. --系统属性设置:是否启用时间粘贴设置
  191. set Identity_insert [dbo].[Report_DistributeDept] ON
  192. if not exists (select * from [Report_DistributeDept] where ID = 29)
  193. INSERT [dbo].[Report_DistributeDept] ([ID] ,[DistributeDeptName] ,[IsStart] ,[HasValue]) VALUES (29, N'时间粘贴设置', 0, NULL)
  194. set Identity_insert [dbo].[Report_DistributeDept] OFF
  195. --系统属性设置:数据抽取是否覆盖已填写项
  196. set Identity_insert [dbo].[Report_DistributeDept] ON
  197. if not exists (select * from [Report_DistributeDept] where ID = 30)
  198. INSERT [dbo].[Report_DistributeDept] ([ID] ,[DistributeDeptName] ,[IsStart] ,[HasValue]) VALUES (30, N'数据抽取是否覆盖已填写项', 0, NULL)
  199. set Identity_insert [dbo].[Report_DistributeDept] OFF
  200. --自动抽取应上报数据任务
  201. if not exists (select * from [DataBaseAutoBak] where ID = 7)
  202. exec dbo.sp_executesql @statement = N'
  203. SET IDENTITY_INSERT [dbo].[DataBaseAutoBak] ON
  204. INSERT [dbo].[DataBaseAutoBak] ([Id], [AutoDbBakEnabled], [AutoDbBakEveryDay], [AutoDbBakAtHour],[AutoDbBakAtMinute]) VALUES (7, 0, 1, 0, 0)
  205. SET IDENTITY_INSERT [dbo].[DataBaseAutoBak] OFF
  206. '