-- ----------------------------- 2024-02-04 add by gaozq------------end
INSERT INTO t_core_schedule_task (ID,TASKNAME,SERVICENAME,METHODNAME,REMARK,CREATEDBYID,CREATEDBYNAME,CREATEDTIME,CREATEDBYORGID,CREATEDBYORGNAME,TYPE,IFEXECUTABLESERVICENAME,IFEXECUTABLEMETHODNAME) VALUES
('insertEquipMaintainTask','定时检查生成点检记录','com.sunwayworld.basemodule.trm.equipt.maintainitem.service.LimsEquipMaintainPlanItemService','insertEquipMaintainTask',NULL,NULL,NULL,NULL,NULL,NULL,'service',NULL,NULL);
-- ----------------------------- 2024-02-04 add by gaozq------------end
-- ----------------------------- 2024-02-01 add by zhangs--------------begin

-- 建表语句

CREATE TABLE IF NOT EXISTS `T_LIMS_TESTTYPE_ANALYTE`(
                                                        `ID` BIGINT NOT NULL COMMENT '主键',
                                                        `TESTTYPEID` BIGINT DEFAULT NULL COMMENT '检测项目类型ID',
                                                        `ANALYSTNAME` VARCHAR(120)  DEFAULT NULL COMMENT '分析项名称',
    PRIMARY KEY (`ID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='同名分析项';

-- 旧版审计跟踪，跟踪配置变更语句

INSERT INTO T_CORE_AT_CONFIG_LINE (ID,CONFIGID,COLUMNID,AUDITTRAIL,CREATEDBYID,CREATEDBYNAME,CREATEDTIME,CREATEDBYORGID,CREATEDBYORGNAME) VALUES (F_GET_SEQ_CORE(),'T_LIMS_TESTTYPE_ANALYTE','ID','1','zhangsheng','zhangsheng', NOW(),'L005','五行业');
INSERT INTO T_CORE_AT_CONFIG_LINE (ID,CONFIGID,COLUMNID,AUDITTRAIL,CREATEDBYID,CREATEDBYNAME,CREATEDTIME,CREATEDBYORGID,CREATEDBYORGNAME) VALUES (F_GET_SEQ_CORE(),'T_LIMS_TESTTYPE_ANALYTE','TESTTYPEID','1','zhangsheng','zhangsheng', NOW(),'L005','五行业');
INSERT INTO T_CORE_AT_CONFIG_LINE (ID,CONFIGID,COLUMNID,AUDITTRAIL,CREATEDBYID,CREATEDBYNAME,CREATEDTIME,CREATEDBYORGID,CREATEDBYORGNAME) VALUES (F_GET_SEQ_CORE(),'T_LIMS_TESTTYPE_ANALYTE','ANALYSTNAME','1','zhangsheng','zhangsheng', NOW(),'L005','五行业');
COMMIT;

INSERT INTO T_CORE_AT_CONFIG (ID, AUDITTRAIL, CREATEDBYID, CREATEDBYNAME, CREATEDTIME, CREATEDBYORGID, CREATEDBYORGNAME)
VALUES ('T_LIMS_TESTTYPE_ANALYTE', '1', 'zhangsheng', 'zhangsheng', NOW(), 'L005', '五行业');

-- 审计跟踪V2，跟踪配置变更语句

INSERT INTO T_CORE_AUDIT_CONFIG_COLUMN (ID,CONFIGID,`COLUMN`,AUDITABLE) VALUES (F_GET_SEQ_CORE(),'T_LIMS_TESTTYPE_ANALYTE','ID','1');
INSERT INTO T_CORE_AUDIT_CONFIG_COLUMN (ID,CONFIGID,`COLUMN`,AUDITABLE) VALUES (F_GET_SEQ_CORE(),'T_LIMS_TESTTYPE_ANALYTE','TESTTYPEID','1');
INSERT INTO T_CORE_AUDIT_CONFIG_COLUMN (ID,CONFIGID,`COLUMN`,AUDITABLE) VALUES (F_GET_SEQ_CORE(),'T_LIMS_TESTTYPE_ANALYTE','ANALYSTNAME','1');
COMMIT;

INSERT INTO T_CORE_AUDIT_CONFIG (ID, NAME, CATEGORY, AUDITABLE)
VALUES ('T_LIMS_TESTTYPE_ANALYTE', '同名分析项', 'service', '1');
CALL INSERTI18N('T_LIMS_TESTTYPE_ANALYTE.SERVICE_NAME', '同名分析项', '同名分析项', 'zh-CN', '同名分析项');
CALL INSERTI18N('T_LIMS_TESTTYPE_ANALYTE.ID', '同名分析项的主键', '主键', 'zh-CN', '主键');
CALL INSERTI18N('T_LIMS_TESTTYPE_ANALYTE.TESTTYPEID', '同名分析项的检测项目类型ID', '检测项目类型ID', 'zh-CN', '检测项目类型ID');
CALL INSERTI18N('T_LIMS_TESTTYPE_ANALYTE.ANALYSTNAME', '同名分析项的分析项名称', '分析项名称', 'zh-CN', '分析项名称');
CALL INSERTI18N('BASEMODULE.BASEDATA.TESTTYPES.MODAL.ADD', '新增', '新增', 'zh-CN', '新增');
CALL INSERTI18N('BASEMODULE.BASEDATA.TESTTYPES.TAB.BASE_INFO', '基本信息', '基本信息', 'zh-CN', '基本信息');
CALL INSERTI18N('BASEMODULE.BASEDATA.TESTTYPES.BUTTON.BUTTON', '按钮', '按钮', 'zh-CN', '按钮');
CALL INSERTI18N('BASEMODULE.BASEDATA.TESTTYPES.TIP.TIP', '提示框', '提示框', 'zh-CN', '提示框');
CALL INSERTI18N('BASEMODULE.BASEDATA.TESTTYPES.MODAL.MODAL', '对话框', '对话框', 'zh-CN', '对话框');


-- 创建菜单语句
INSERT INTO T_CORE_MENU (ID, MENUNAME, HREF, PARENTID, ORDERNO, ICON, MENUINITNAME)
VALUES ('20240222001', '同名分析项管理', '/secure/basemodule/basedata/testtype-analytes/page/edit-list', '91', '11', '068.svg', '同名分析项管理');

INSERT INTO T_CORE_TABLE (ID, AUDITABLE, ATTACHMENT)
VALUES ('T_LIMS_TESTTYPE_ANALYTE', '0', '0');


COMMIT;

-- ----------------------------- 2024-02-01 add by zhangs------------end


-- ----------------------------- 2024-02-27 add by zhangs--------------begin
INSERT INTO t_core_admin_choose_config (ID,NAME,TITLE,CATEGORY,URL,WIDTH) VALUES
(2024022709561,'检测项目分析项','分析项','tmAnalystChoose','/secure/basemodule/coredata/tm-analysts/page/choose-list','80%');
ALTER table t_lims_test ADD TESTTYPEID bigint NULL COMMENT '检测项目类型ID';

UPDATE t_lims_test o
INNER JOIN t_lims_test_type  p ON concat(p.FIRSTTYPE,'-',p.SECONDTYPE) = o.TESTTYPE
SET o.TESTTYPEID =p.id;

ALTER TABLE t_lims_testtype_analyte DROP COLUMN ANALYSTNAME;
ALTER TABLE t_lims_testtype_analyte ADD ANALYSTID bigint NULL COMMENT '静态分析项ID';
truncate table  T_LIMS_TESTTYPE_ANALYTE;
ALTER TABLE t_lims_testtype_analyte ADD GROUPNAME varchar(100) NULL COMMENT '组名称';
CALL INSERTI18N('T_LIMS_TESTTYPE_ANALYTE.GROUPNAME', '组名称', '组名称', 'zh-CN', '组名称');
-- ----------------------------- 2024-02-27 add by zhangs--------------end

-- ----------------------------- 2024-02-28 add by zhangs--------------begin
ALTER TABLE t_lims_order ADD HANGUPTESTSTEPID bigint NULL COMMENT '检测大纲ID';
ALTER TABLE t_lims_order ADD HANGUPTESTSTEPNUM bigint NULL COMMENT '挂测数量';

ALTER TABLE t_lims_order ADD HANGUPTESTSTEP2ID bigint NULL COMMENT '检测大纲2ID';
ALTER TABLE t_lims_order ADD HANGUPTESTSTEP2NUM bigint NULL COMMENT '挂测2数量';

ALTER TABLE t_lims_task ADD HANGUPTEST varchar(1) NULL COMMENT '扣电挂测的试验';
-- ----------------------------- 2024-02-28 add by zhangs--------------end

-- ----------------------------- 2024-02-29 add by zhangs--------------begin
CREATE INDEX t_lims_order_KDSTATUS_IDX USING BTREE ON t_lims_order (KDSTATUS);
CALL INSERTI18N('T_LIMS_TASK.HANGUPTEST', '挂测试验', '挂测试验', 'zh-CN', '挂测试验');
-- ----------------------------- 2024-02-29 add by zhangs--------------end