--增加分类 GO IF not EXISTS(SELECT * FROM SYS_ScriptCategories WHERE id=3) insert into SYS_ScriptCategories(ID,Code,Name,ComponentID,xRowNum,ParentID,xLevel,Description) Values(3, 'SC3', '相关管理', Null, 0, 0, 0, Null) else print 'SYS_ScriptCategories.id=3 已经存在.' GO --删除旧记录 delete from SYS_Scripts where id=16780 --删除脚本内容 GO GO IF not EXISTS(SELECT * FROM SYS_Scripts WHERE id=16780) insert into SYS_Scripts(ID,CategoryID,Code,Name,Description,xType,DatasourceID,DisplayNames,xRowNum,xText,UpdateDate,UpdateUser,UpdateMode) Values(16780, 3, 'Sql_公共查询提取参数', Null, '公共查询提取参数', 1, 0, '', 1, 'declare @ProductID int,@ProgramID int, @UserID int, @BCKID int,@hostid int set @ProductID = %d set @ProgramID = %d set @UserID = %d set @BCKID = %d set @hostid = %d select a.ID,a.DefValue,a.ParamNo,a.Name,cast(-1 as int) UserParaID,a.Value from sys_parameters a where a.ProductID = @ProductID AND a.ProgramID = @ProgramID and a.Privilege = 0 union all SELECT a.ID,a.DefValue,a.ParamNo,a.Name ,UserParaID = CASE WHEN b.ID IS NULL THEN -1 ELSE b.ID END ,Value = CASE WHEN b.Value IS NULL THEN a.Value ELSE b.Value end FROM Sys_Parameters a left JOIN Sys_UserParameters b ON a.ID= b.ParamID and b.UserID = @UserID WHERE a.ProductID = @ProductID AND a.ProgramID = @ProgramID AND a.Privilege = 1 union all SELECT a.ID,a.DefValue,a.ParamNo,a.Name ,UserParaID = CASE WHEN b.ID IS NULL THEN -1 ELSE b.ID END ,Value = CASE WHEN b.Value IS NULL THEN a.Value ELSE b.Value end FROM Sys_Parameters a left JOIN Sys_UserParameters b ON a.ID= b.ParamID and b.UserID = @BCKID WHERE a.ProductID = @ProductID AND a.ProgramID = @ProgramID AND a.Privilege = 3 union all SELECT a.ID,a.DefValue,a.ParamNo,a.Name ,UserParaID = CASE WHEN b.ID IS NULL THEN -1 ELSE b.ID END ,Value = CASE WHEN b.Value IS NULL THEN a.Value ELSE b.Value end FROM Sys_Parameters a left JOIN Sys_UserParameters b ON a.ID= b.ParamID and b.UserID = @hostid WHERE a.ProductID = @ProductID AND a.ProgramID = @ProgramID AND a.Privilege = 2 Order By a.ParamNo', '2015-04-23 14:48:08', '(8058)高瑜', 0) else print 'SYS_Scripts.id=16780 已经存在.' GO --删除旧记录 delete from SYS_Scripts where id=16989 --删除脚本内容 GO GO IF not EXISTS(SELECT * FROM SYS_Scripts WHERE id=16989) insert into SYS_Scripts(ID,CategoryID,Code,Name,Description,xType,DatasourceID,DisplayNames,xRowNum,xText,UpdateDate,UpdateUser,UpdateMode) Values(16989, 3, 'Sql_出院诊断诊断分类', Null, '出院诊断,病案首页诊断分类', 1, 0, Null, 1, 'declare @vao10 tinyint set @vao10=%d select * from ( select 0 VAO10,1 fid,''主要诊断'' fname union all select 0 VAO10,2 fid,''其他诊断'' fname union all select 1 VAO10,1 fid,''主病'' fname union all select 1 VAO10,2 fid,''主证'' fname) s where s.VAO10=@vao10', '2017-01-05 17:02:05', '(8031)潘渭宏', 0) else print 'SYS_Scripts.id=16989 已经存在.' GO --删除旧记录 delete from SYS_Scripts where id=17072 --删除脚本内容 GO GO IF not EXISTS(SELECT * FROM SYS_Scripts WHERE id=17072) insert into SYS_Scripts(ID,CategoryID,Code,Name,Description,xType,DatasourceID,DisplayNames,xRowNum,xText,UpdateDate,UpdateUser,UpdateMode) Values(17072, 3, 'Sql_药品发药摆药方式', Null, '药品发药摆药方式', 1, 0, Null, 1, 'select 0 fid,''无'' fname union all select 1,''科室批量摆药'' union all select 2,''个人摆药'' ', '2017-04-17 14:49:40', '(8058)高瑜', 0) else print 'SYS_Scripts.id=17072 已经存在.' GO