CREATE TABLE TB_JC_KSDZB (
    YLJGDM VARCHAR(22) NOT NULL,
    HISKSDM CHAR(20) NOT NULL,
    HISKSMC CHAR(20) NOT NULL,
    BAKSDM CHAR(20),
    BAKSMC CHAR(20),
    CBZXDM CHAR(20) NOT NULL,
    CBZXMC CHAR(20) NOT NULL,
    HSDYDM CHAR(20) NOT NULL,
    HSDYMC CHAR(20) NOT NULL,
    HISKSLX CHAR(10) NOT NULL,
    HISKSNWKBS CHAR(10) NOT NULL,
    HISKSBQBS CHAR(10) NOT NULL,
    TYBS INTEGER NOT NULL,
    TBRQ TIMESTAMP NOT NULL,
    XGBZ CHAR(1) NOT NULL,
    YLYL1 VARCHAR(128),
    YLYL2 VARCHAR(128),
    PRIMARY KEY (YLJGDM, HISKSDM)
);

-- 为表添加注释
COMMENT ON TABLE TB_JC_KSDZB IS '科室对照表';

-- 为字段添加注释
COMMENT ON COLUMN TB_JC_KSDZB.YLJGDM IS '医疗机构代码，复合主键';
COMMENT ON COLUMN TB_JC_KSDZB.HISKSDM IS 'HIS科室代码，主键、唯一';
COMMENT ON COLUMN TB_JC_KSDZB.HISKSMC IS 'HIS科室名称';
COMMENT ON COLUMN TB_JC_KSDZB.BAKSDM IS '病案科室代码，应与"病案明细表"里的科室ID对应';
COMMENT ON COLUMN TB_JC_KSDZB.BAKSMC IS '病案科室名称';
COMMENT ON COLUMN TB_JC_KSDZB.CBZXDM IS '成本中心代码，与HIS科室对应';
COMMENT ON COLUMN TB_JC_KSDZB.CBZXMC IS '成本中心名称';
COMMENT ON COLUMN TB_JC_KSDZB.HSDYDM IS '核算单元代码，字符类型避免丢失前导0';
COMMENT ON COLUMN TB_JC_KSDZB.HSDYMC IS '核算单元名称';
COMMENT ON COLUMN TB_JC_KSDZB.HISKSLX IS 'HIS科室类型，可取值：临床/医技/其它';
COMMENT ON COLUMN TB_JC_KSDZB.HISKSNWKBS IS 'HIS科室内外科标识，可取值：内科/外科';
COMMENT ON COLUMN TB_JC_KSDZB.HISKSBQBS IS 'HIS科室病区标识，可取值：病区/非病区';
COMMENT ON COLUMN TB_JC_KSDZB.TYBS IS '停用标识，科室是否停用标识：0-正在使用；1-已停用';
COMMENT ON COLUMN TB_JC_KSDZB.TBRQ IS '数据上传时间';
COMMENT ON COLUMN TB_JC_KSDZB.XGBZ IS '修改标志：0-正常；1-撤销';
COMMENT ON COLUMN TB_JC_KSDZB.YLYL1 IS '预留字段一';
COMMENT ON COLUMN TB_JC_KSDZB.YLYL2 IS '预留字段二';