/**Begin D:\\PDM_UPGRADE\PDM_UPGRADE\PDM1\HIES_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_DIAETPLCONF_L')
 CREATE TABLE T_HIES_DIAETPLCONF_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINSTRUCTION NVARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_DIAETPLFIELDCONF_L')
 CREATE TABLE T_HIES_DIAETPLFIELDCONF_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FENTITYDESCRIPTION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDIMPORTDESC NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_DIAETPLFIELDCONF')
 CREATE TABLE T_HIES_DIAETPLFIELDCONF (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPARENTENTRYID BIGINT DEFAULT 0 NOT NULL,
FFIELDNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FISIMPORT CHAR(1) DEFAULT '0' NOT NULL,
FISMUSTINPUT CHAR(1) DEFAULT '0' NOT NULL,
FISDOWNLOADCOND CHAR(1) DEFAULT '0' NOT NULL,
FISCONDGETDATA CHAR(1) DEFAULT '0' NOT NULL,
FISFIELD CHAR(1) DEFAULT '0' NOT NULL,
FCHILDENTITYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYDESCRIPTION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDIMPORTDESC NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_DIAETPLENTITY')
 CREATE TABLE T_HIES_DIAETPLENTITY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FRENTITYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYUNIQUEVAL VARCHAR(500) DEFAULT ' ' NOT NULL,
FRELATIONLEFTPROP VARCHAR(60) DEFAULT ' ' NOT NULL,
FRELATIONRIGHTPROP VARCHAR(60) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_DIAETPLCONF')
 CREATE TABLE T_HIES_DIAETPLCONF (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FENTITYTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FTMPLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FORGFIELD BIGINT DEFAULT 0 NOT NULL,
FALLOCATIONPOLICY VARCHAR(2) DEFAULT ' ' NOT NULL,
FIMPORTTYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FENABLEDOWNCOND VARCHAR(2) DEFAULT ' ' NOT NULL,
FPLUGIN VARCHAR(2000) DEFAULT ' ' NOT NULL,
FBASEINFOFORMAT VARCHAR(10) DEFAULT ' ' NOT NULL,
FENTITYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FINSTRUCTION NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FAPPLYSCOPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FMAINENTITYUNIQUEVAL VARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_DIAESYSPARAM')
 CREATE TABLE T_HIES_DIAESYSPARAM (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSETNULLPARAM VARCHAR(10) DEFAULT ' ' NOT NULL,
FMAXSHOWNUM VARCHAR(10) DEFAULT ' ' NOT NULL,
FIMPORTDISABLE CHAR(1) DEFAULT '0' NOT NULL,
FIMPTNAME VARCHAR(10) DEFAULT ' ' NOT NULL,
FEXPTNAME VARCHAR(10) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_DIAETPLORG')
 CREATE TABLE T_HIES_DIAETPLORG (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FADMINORGID BIGINT DEFAULT 0 NOT NULL,
FISINCLUDESUBORG CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_DIAETPLROLE')
 CREATE TABLE T_HIES_DIAETPLROLE (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FROLEID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_DIAETPLROLEORG')
 CREATE TABLE T_HIES_DIAETPLROLEORG (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FORGROLEID VARCHAR(50) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FISINCLUDESUBORG_ROLE CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_DIAETPLUSER')
 CREATE TABLE T_HIES_DIAETPLUSER (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FUSERID BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_TPLSHEETCONF')
 CREATE TABLE T_HIES_TPLSHEETCONF (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSHEETNAME VARCHAR(250) DEFAULT ' ' NOT NULL,
FSHEETREADROW INT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_TASKINFO')
 CREATE TABLE T_HIES_TASKINFO (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FTASKID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSERIALNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FOPRPAGE VARCHAR(2000) DEFAULT ' ' NOT NULL,
FOPRTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FOPRCATEGORY VARCHAR(50) DEFAULT ' ' NOT NULL,
FBUSINESSFIELD BIGINT DEFAULT 0 NOT NULL,
FENTITYTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FUSETPL BIGINT DEFAULT 0 NOT NULL,
FFILESIZE BIGINT DEFAULT 0 NOT NULL,
FPROGRESS INT DEFAULT 0 NOT NULL,
FMANUALINTFLAG VARCHAR(50) DEFAULT ' ' NOT NULL,
FINTTOR BIGINT DEFAULT 0 NOT NULL,
FINTREASON NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FSUCAMOUNT INT DEFAULT 0 NOT NULL,
FFAILAMOUNT INT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FTOTALAMOUNT INT DEFAULT 0 NOT NULL,
FTOTALCOST INT DEFAULT 0 NOT NULL,
FHANDLEMACHINE VARCHAR(255) DEFAULT ' ' NOT NULL,
FREQPARAM NCLOB,
FEXTPARAM NCLOB,
FUPLOADFILEURL VARCHAR(2000) DEFAULT ' ' NOT NULL,
FALLDATAFILEURL VARCHAR(2000) DEFAULT ' ' NOT NULL,
FERRDATAFILEURL VARCHAR(2000) DEFAULT ' ' NOT NULL,
FDOWNLOADFILEURL VARCHAR(2000) DEFAULT ' ' NOT NULL,
FRESULT VARCHAR(50) DEFAULT ' ' NOT NULL,
FSTIME DATETIME,
FETIME DATETIME,
FINTTIME DATETIME,
FPERFORMANCELOG NCLOB,
FSYSTEMERRLOG NCLOB,
FDATAVALIDLOG NCLOB,
FPLUGINRUNLOG NCLOB
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_TASKINFO_L')
 CREATE TABLE T_HIES_TASKINFO_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FINTREASON NVARCHAR(2000) DEFAULT ' ' NOT NULL
);
EXEC p_AlterColumn 'T_HIES_DIAETPLCONF', 'FBASEINFOFORMAT', 'VARCHAR(20)', 'NOT NULL', '0100', ''' ''';



EXEC p_AlterColumn 'T_HIES_DIAETPLFIELDCONF_L', 'FENTITYDESCRIPTION', 'NVARCHAR(2000)', 'NOT NULL', '0100', ''' ''';
EXEC p_AlterColumn 'T_HIES_DIAETPLFIELDCONF', 'FENTITYDESCRIPTION', 'NVARCHAR(2000)', 'NOT NULL', '0100', ''' ''';
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLCONF' AND KSQL_COL_NAME IN ('FTPLSCOPE'))
ALTER TABLE T_HIES_DIAETPLCONF ADD (FTPLSCOPE VARCHAR(20) DEFAULT '  ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLCONF' AND KSQL_COL_NAME IN ('FCUSTOMPAGE'))
ALTER TABLE T_HIES_DIAETPLCONF ADD (FCUSTOMPAGE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_DIAECONDFIELDCONF')
CREATE TABLE T_HIES_DIAECONDFIELDCONF (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FCONDNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FCONDENTITYNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FDOWNCONDITIONVAL VARCHAR(50) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_ENTITYENCRYPTCONF')
 CREATE TABLE T_HIES_ENTITYENCRYPTCONF (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FENTITYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPID VARCHAR(36) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_ENTITYENCRYPTCONF_L')
 CREATE TABLE T_HIES_ENTITYENCRYPTCONF_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAESYSPARAM' AND KSQL_COL_NAME IN ('FISIMPTFILLPENTRY'))
ALTER TABLE T_HIES_DIAESYSPARAM ADD (FISIMPTFILLPENTRY CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAESYSPARAM' AND KSQL_COL_NAME IN ('FISEXPTAUTOFILLPENTRY'))
ALTER TABLE T_HIES_DIAESYSPARAM ADD (FISEXPTAUTOFILLPENTRY CHAR(1) DEFAULT '0' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLCONF' AND KSQL_COL_NAME ='FFIELDSTYLE') 
 ALTER TABLE T_HIES_DIAETPLCONF ADD (FFIELDSTYLE NCLOB DEFAULT ' ' );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLCONF' AND KSQL_COL_NAME ='FFIELDMERGE') 
 ALTER TABLE T_HIES_DIAETPLCONF ADD (FFIELDMERGE VARCHAR(2000) DEFAULT ' ' NOT NULL );
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAESYSPARAM' AND KSQL_COL_NAME ='FGLOBALFIELDSTYLE') 
 ALTER TABLE T_HIES_DIAESYSPARAM ADD (FGLOBALFIELDSTYLE NCLOB DEFAULT ' ' );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_TASKINFO' AND KSQL_COL_NAME ='FSCHEDULESTATUS')
 ALTER TABLE T_HIES_TASKINFO ADD (FSCHEDULESTATUS VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_TASKINFO' AND KSQL_COL_NAME ='FRETRYNUM')
 ALTER TABLE T_HIES_TASKINFO ADD (FRETRYNUM INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_TASKINFO' AND KSQL_COL_NAME ='FLASTRETRYTIME')
 ALTER TABLE T_HIES_TASKINFO ADD (FLASTRETRYTIME DATETIME);
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_TASKINFO' AND KSQL_COL_NAME ='FAPPID')
 ALTER TABLE T_HIES_TASKINFO ADD (FAPPID VARCHAR(36) DEFAULT ' ' NOT NULL );


EXEC p_AlterColumn 'T_HIES_DIAECONDFIELDCONF', 'FDOWNCONDITIONVAL', 'VARCHAR(2000)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_IMPTEMPLATEUSERS')
CREATE TABLE T_HIES_IMPTEMPLATEUSERS (
                                         FPKID BIGINT DEFAULT 0 NOT NULL,
                                         FID BIGINT DEFAULT 0 NOT NULL,
                                         FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLCONF' AND KSQL_COL_NAME IN ('FMETAVERSION'))
ALTER TABLE T_HIES_DIAETPLCONF ADD (FMETAVERSION VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLCONF' AND KSQL_COL_NAME IN ('FSOURCE'))
ALTER TABLE T_HIES_DIAETPLCONF ADD (FSOURCE VARCHAR(20) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLCONF' AND KSQL_COL_NAME ='FTPLGENMODE')
 ALTER TABLE T_HIES_DIAETPLCONF ADD (FTPLGENMODE VARCHAR(20) DEFAULT 'sysgen' NOT NULL );
EXEC p_AlterColumn 'T_HIES_DIAETPLCONF', 'FMETAVERSION', 'VARCHAR(2000)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLFIELDCONF' AND KSQL_COL_NAME IN ('FIMPTATTR'))
ALTER TABLE T_HIES_DIAETPLFIELDCONF ADD (FIMPTATTR VARCHAR(20) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLFIELDCONF' AND KSQL_COL_NAME IN ('FEXPTATTR'))
ALTER TABLE T_HIES_DIAETPLFIELDCONF ADD (FEXPTATTR VARCHAR(500) DEFAULT ' ' NOT NULL );
EXEC p_AlterColumn 'T_HIES_DIAETPLFIELDCONF', 'FEXPTATTR', 'VARCHAR(500)', 'NOT NULL', '0100', ''' ''';

-- 新增 基础资料是否单独展示列
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLFIELDCONF' AND KSQL_COL_NAME ='FISSHEET')
ALTER TABLE T_HIES_DIAETPLFIELDCONF ADD (FISSHEET CHAR(1) DEFAULT ' ' NOT NULL );

-- 新增 字段默认值列
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLFIELDCONF' AND KSQL_COL_NAME IN ('FDEFVALPROP'))
ALTER TABLE T_HIES_DIAETPLFIELDCONF ADD (FDEFVALPROP VARCHAR(2000) DEFAULT ' ' NOT NULL );

-- 新增 是否自定义字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLFIELDCONF' AND KSQL_COL_NAME IN ('FISCUSFIELD'))
ALTER TABLE T_HIES_DIAETPLFIELDCONF ADD (FISCUSFIELD CHAR(1) DEFAULT '0' NOT NULL );

-- 新增 是否勾选
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLFIELDCONF' AND KSQL_COL_NAME IN ('FISCHECKED'))
ALTER TABLE T_HIES_DIAETPLFIELDCONF ADD (FISCHECKED CHAR(1) DEFAULT '0' NOT NULL );

-- 新增 字段名称
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLFIELDCONF' AND KSQL_COL_NAME IN ('FFIELDNAME'))
ALTER TABLE T_HIES_DIAETPLFIELDCONF ADD (FFIELDNAME VARCHAR(255) DEFAULT ' ' NOT NULL );

-- 修改 字段名称多语言
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLFIELDCONF_L' AND KSQL_COL_NAME IN ('FFIELDNAME'))
ALTER TABLE T_HIES_DIAETPLFIELDCONF_L ADD (FFIELDNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
EXEC p_AlterColumn 'T_HIES_DIAETPLFIELDCONF', 'FFIELDNAME', 'NVARCHAR(255)', 'NOT NULL', '1111', ''' ''';

-- 新增 自定义字段主键
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_DIAETPLFIELDCONF' AND KSQL_COL_NAME IN ('FCUSFIELDID'))
ALTER TABLE T_HIES_DIAETPLFIELDCONF ADD (FCUSFIELDID BIGINT DEFAULT 0 NOT NULL );
/**End D:\\PDM_UPGRADE\PDM_UPGRADE\PDM1\HIES_table.sql **/
