
--commomtable表新增字段
ALTER TABLE commomtable
    ADD cycle_no varchar(50) NULL,      -- 周期号（生殖科）
    visit_time datetime NULL,       -- 就诊日期（产前门诊）
    pro_no varchar(50) NULL,        -- 项目号（药学楼）
    pro_name varchar(255) NULL,     -- 项目名称（药学楼）
    applicant varchar(255) NULL,    -- 申办方（药学楼）
    file_type varchar(50) NULL,     -- 文件类型（药学楼）
    subject_no varchar(50) NULL,    -- 资料盒/受试者编号（药学楼）
    hemodialysis_date datetime NULL,-- 血透时间（血透）
    hemodialysis_id varchar(50) NULL,-- 血透id（血透）
    radiotherapy_no varchar(50) NULL,-- 放疗号（放疗）
    data_source varchar(50) NULL    -- 数据来源 1.生殖科 2.产前门诊 3.药学楼


-- 增加任务清单主表       hcy    2024-05-13

IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[Export_Task]') AND type IN ('U'))
	DROP TABLE [dbo].[Export_Task]
GO

CREATE TABLE [dbo].[Export_Task] (
  [task_id] int  IDENTITY(1,1) NOT NULL,
  [task_name] varchar(30) COLLATE Chinese_PRC_CI_AS  NULL,
  [state] int  NULL,
  [create_date] datetime2(0)  NULL
)
GO

ALTER TABLE [dbo].[Export_Task] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键task_id',
'SCHEMA', N'dbo',
'TABLE', N'Export_Task',
'COLUMN', N'task_id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'任务名称',
'SCHEMA', N'dbo',
'TABLE', N'Export_Task',
'COLUMN', N'task_name'
GO

EXEC sp_addextendedproperty
'MS_Description', N'0.无效 1.有效',
'SCHEMA', N'dbo',
'TABLE', N'Export_Task',
'COLUMN', N'state'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'Export_Task',
'COLUMN', N'create_date'
GO


-- ----------------------------
-- Auto increment value for Export_Task
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[Export_Task]', RESEED, 1)
GO


-- ----------------------------
-- Primary Key structure for table Export_Task
-- ----------------------------
ALTER TABLE [dbo].[Export_Task] ADD CONSTRAINT [PK_Export_Task_id] PRIMARY KEY CLUSTERED ([task_id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO



-- 增加任务清单明细表       hcy    2024-05-13

IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[Export_Task_Details]') AND type IN ('U'))
	DROP TABLE [dbo].[Export_Task_Details]
GO

CREATE TABLE [dbo].[Export_Task_Details] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [taskId] int  NULL,
  [inpNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [dischargeDateTime] datetime2(0)  NULL,
  [state] int  NULL
)
GO

ALTER TABLE [dbo].[Export_Task_Details] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键id',
'SCHEMA', N'dbo',
'TABLE', N'Export_Task_Details',
'COLUMN', N'id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'任务表id',
'SCHEMA', N'dbo',
'TABLE', N'Export_Task_Details',
'COLUMN', N'taskId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'病案号',
'SCHEMA', N'dbo',
'TABLE', N'Export_Task_Details',
'COLUMN', N'inpNo'
GO

EXEC sp_addextendedproperty
'MS_Description', N'出院日期',
'SCHEMA', N'dbo',
'TABLE', N'Export_Task_Details',
'COLUMN', N'dischargeDateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'0.未开始1.完成2.失败',
'SCHEMA', N'dbo',
'TABLE', N'Export_Task_Details',
'COLUMN', N'state'
GO


-- ----------------------------
-- Auto increment value for Export_Task_Details
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[Export_Task_Details]', RESEED, 1)
GO


-- ----------------------------
-- Primary Key structure for table Export_Task_Details
-- ----------------------------
ALTER TABLE [dbo].[Export_Task_Details] ADD CONSTRAINT [PK__Export_T__3213E83F1D7B6025] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- 增加导出分段字典表       hcy    2024-05-13

IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[export_zd_assort]') AND type IN ('U'))
	DROP TABLE [dbo].[export_zd_assort]
GO

CREATE TABLE [dbo].[export_zd_assort] (
  [assort_id] varchar(255) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [assort_name] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [assort_sort] int  NULL,
  [export_flag] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [gj_assort_name] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[export_zd_assort] SET (LOCK_ESCALATION = TABLE)
GO

-- 增加任务清单导入、费用清单菜单       hcy    2024-05-13

INSERT INTO `power_menu`(`menu_name`, `menu_icon`, `menu_url`, `menu_desc`, `method`, `function_type`, `method_type`, `sys_id`, `sys_flag`, `parent_id`, `sort`, `effective`, `create_date`, `creater`, `update_date`, `updater`, `remark`) VALUES ('常用查询-费用清单上传', NULL, '/commom/uploadCostList', '功能', 'uploadCostList', '', '文档类', 15, 'emr_record', 216, 13, 1, '2019-09-05', 'admin', '2024-04-23', 'admin', '');
INSERT INTO `power_menu`(`menu_name`, `menu_icon`, `menu_url`, `menu_desc`, `method`, `function_type`, `method_type`, `sys_id`, `sys_flag`, `parent_id`, `sort`, `effective`, `create_date`, `creater`, `update_date`, `updater`, `remark`) VALUES ('任务清单列表', 'fa fa-circle-o', '/exportTask/exportTaskList', '菜单', NULL, NULL, NULL, 15, 'emr_record', 211, 6, 1, '2024-04-28', 'admin', '2024-04-28', 'admin', '');
INSERT INTO `power_menu`(`menu_name`, `menu_icon`, `menu_url`, `menu_desc`, `method`, `function_type`, `method_type`, `sys_id`, `sys_flag`, `parent_id`, `sort`, `effective`, `create_date`, `creater`, `update_date`, `updater`, `remark`) VALUES ('任务清单-导入excel', NULL, '/exportTask/impExcelTask', '功能', 'impExcelTask', '', '文档类', 15, 'emr_record', 424, 1, 1, '2024-04-28', 'admin', '2024-04-28', 'admin', '');
INSERT INTO `power_menu`(`menu_name`, `menu_icon`, `menu_url`, `menu_desc`, `method`, `function_type`, `method_type`, `sys_id`, `sys_flag`, `parent_id`, `sort`, `effective`, `create_date`, `creater`, `update_date`, `updater`, `remark`) VALUES ('任务清单-导出pdf', NULL, '/exportTask/exportPdf', '功能', 'exportPdf', '', '文档类', 15, 'emr_record', 424, 2, 1, '2024-04-28', 'admin', '2024-04-28', 'admin', '');
INSERT INTO `power_menu`(`menu_name`, `menu_icon`, `menu_url`, `menu_desc`, `method`, `function_type`, `method_type`, `sys_id`, `sys_flag`, `parent_id`, `sort`, `effective`, `create_date`, `creater`, `update_date`, `updater`, `remark`) VALUES ('任务清单明细查询', 'fa fa-circle-o', '/exportTaskDetails/exportTaskDetailsList', '菜单', NULL, NULL, NULL, 15, 'emr_record', 211, 7, 1, '2024-05-03', 'admin', '2024-05-03', 'admin', '');
