DROP SEQUENCE IF EXISTS "public"."tbl_address_id_seq";
CREATE SEQUENCE "public"."tbl_address_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;
SELECT setval('"public"."tbl_address_id_seq"', 1, true);
ALTER SEQUENCE "public"."tbl_address_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_enterprise_id_seq";
CREATE SEQUENCE "public"."tbl_enterprise_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;
SELECT setval('"public"."tbl_enterprise_id_seq"', 1, true);
ALTER SEQUENCE "public"."tbl_enterprise_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_social_org_id_seq";
CREATE SEQUENCE "public"."tbl_social_org_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;
SELECT setval('"public"."tbl_social_org_id_seq"', 1, true);
ALTER SEQUENCE "public"."tbl_social_org_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_person_id_seq";
CREATE SEQUENCE "public"."tbl_person_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;
SELECT setval('"public"."tbl_person_id_seq"', 1, true);
ALTER SEQUENCE "public"."tbl_person_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_person_address_relation_id_seq";
CREATE SEQUENCE "public"."tbl_person_address_relation_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;
SELECT setval('"public"."tbl_person_address_relation_id_seq"', 1, true);
ALTER SEQUENCE "public"."tbl_person_address_relation_id_seq" OWNER TO "postgres";


-- ----------------------------
-- Table structure for tbl_address
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_address";
CREATE TABLE "public"."tbl_address" (
"id" int4 NOT NULL DEFAULT nextval('tbl_address_id_seq'::regclass),
"oid" int4,
"source_address" varchar(255) COLLATE "pg_catalog"."default",
"lng" varchar(50) COLLATE "pg_catalog"."default",
"lat" varchar(50) COLLATE "pg_catalog"."default",
"city" varchar(100) COLLATE "pg_catalog"."default",
"county" varchar(100) COLLATE "pg_catalog"."default",
"town" varchar(100) COLLATE "pg_catalog"."default",
"community" varchar(100) COLLATE "pg_catalog"."default",
"grid" varchar(100) COLLATE "pg_catalog"."default",
"grid_code" varchar(100) COLLATE "pg_catalog"."default",
"natural_group" varchar(100) COLLATE "pg_catalog"."default",
"village" varchar(100) COLLATE "pg_catalog"."default",
"house_number" varchar(100) COLLATE "pg_catalog"."default",
"street" varchar(255) COLLATE "pg_catalog"."default",
"street_number" varchar(100) COLLATE "pg_catalog"."default",
"park" varchar(100) COLLATE "pg_catalog"."default",
"building" varchar(255) COLLATE "pg_catalog"."default",
"building_number" varchar(100) COLLATE "pg_catalog"."default",
"building_code" varchar(255) COLLATE "pg_catalog"."default",
"address_type" varchar(10) COLLATE "pg_catalog"."default",
"unit" varchar(100) COLLATE "pg_catalog"."default",
"unit_slot" varchar(100) COLLATE "pg_catalog"."default",
"floor" varchar(100) COLLATE "pg_catalog"."default",
"floor_slot" varchar(100) COLLATE "pg_catalog"."default",
"room" varchar(100) COLLATE "pg_catalog"."default",
"room_slot" varchar(100) COLLATE "pg_catalog"."default",
"address_code" varchar(100) COLLATE "pg_catalog"."default",
"flag_multi" int2,
"standard_address_code" varchar(100) COLLATE "pg_catalog"."default",
"register_situation" varchar(10) COLLATE "pg_catalog"."default",
"house_nature" varchar(10) COLLATE "pg_catalog"."default",
"house_type" varchar(10) COLLATE "pg_catalog"."default",
"house_use" varchar(10) COLLATE "pg_catalog"."default",
"house_use_situation" varchar(10) COLLATE "pg_catalog"."default",
"house_region" varchar(10) COLLATE "pg_catalog"."default",
"house_floor_class" varchar(10) COLLATE "pg_catalog"."default",
"house_manage_style" varchar(10) COLLATE "pg_catalog"."default",
"house_peril_grade" varchar(10) COLLATE "pg_catalog"."default",
"house_temporary_manage" varchar(10) COLLATE "pg_catalog"."default",
"address_tags" varchar(255) COLLATE "pg_catalog"."default",
"data_source" varchar(10) COLLATE "pg_catalog"."default",
"remark" text COLLATE "pg_catalog"."default",
"create_time" timestamp(6) DEFAULT now(),
"update_time" timestamp(6),
"del_flag" int2 DEFAULT 0,
"wkt" text COLLATE "pg_catalog"."default",
"park_code" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."tbl_address"."id" IS '主键id';
COMMENT ON COLUMN "public"."tbl_address"."oid" IS '组织id';
COMMENT ON COLUMN "public"."tbl_address"."source_address" IS '地址全称';
COMMENT ON COLUMN "public"."tbl_address"."lng" IS '经度';
COMMENT ON COLUMN "public"."tbl_address"."lat" IS '纬度';
COMMENT ON COLUMN "public"."tbl_address"."city" IS '城市';
COMMENT ON COLUMN "public"."tbl_address"."county" IS '区县';
COMMENT ON COLUMN "public"."tbl_address"."town" IS '镇街';
COMMENT ON COLUMN "public"."tbl_address"."community" IS '社区';
COMMENT ON COLUMN "public"."tbl_address"."grid" IS '网格';
COMMENT ON COLUMN "public"."tbl_address"."grid_code" IS '网格编码';
COMMENT ON COLUMN "public"."tbl_address"."natural_group" IS '自然组';
COMMENT ON COLUMN "public"."tbl_address"."village" IS '自然村';
COMMENT ON COLUMN "public"."tbl_address"."house_number" IS '门牌号';
COMMENT ON COLUMN "public"."tbl_address"."street" IS '街路巷';
COMMENT ON COLUMN "public"."tbl_address"."street_number" IS '街路号';
COMMENT ON COLUMN "public"."tbl_address"."park" IS '小区/园区';
COMMENT ON COLUMN "public"."tbl_address"."building" IS '建筑物(如：富邦星座商业楼)';
COMMENT ON COLUMN "public"."tbl_address"."building_number" IS '楼幢号';
COMMENT ON COLUMN "public"."tbl_address"."building_code" IS '楼幢编码';
COMMENT ON COLUMN "public"."tbl_address"."address_type" IS '地址类型-字典：ADDRESS_TYPE，1-楼幢;0-户室;2-小区/园区';
COMMENT ON COLUMN "public"."tbl_address"."unit" IS '单元';
COMMENT ON COLUMN "public"."tbl_address"."unit_slot" IS '单元索引';
COMMENT ON COLUMN "public"."tbl_address"."floor" IS '楼层';
COMMENT ON COLUMN "public"."tbl_address"."floor_slot" IS '楼层索引';
COMMENT ON COLUMN "public"."tbl_address"."room" IS '房间';
COMMENT ON COLUMN "public"."tbl_address"."room_slot" IS '房间索引';
COMMENT ON COLUMN "public"."tbl_address"."address_code" IS '地址编码';
COMMENT ON COLUMN "public"."tbl_address"."flag_multi" IS '是否多种地址0-否;1-是';
COMMENT ON COLUMN "public"."tbl_address"."standard_address_code" IS '标准地址编码';
COMMENT ON COLUMN "public"."tbl_address"."register_situation" IS '不动产登记情况-字典';
COMMENT ON COLUMN "public"."tbl_address"."house_nature" IS '房屋性质-字典(HOUSE_NATURE)';
COMMENT ON COLUMN "public"."tbl_address"."house_type" IS '房屋类型-字典(HOUSE_TYPE)';
COMMENT ON COLUMN "public"."tbl_address"."house_use" IS '房屋用途-字典(HOUSE_USE)';
COMMENT ON COLUMN "public"."tbl_address"."house_use_situation" IS '房屋使用情况-字典(HOUSE_USE_SITUATION)';
COMMENT ON COLUMN "public"."tbl_address"."house_region" IS '房屋所在区域-字典(HOUSE_REGION)';
COMMENT ON COLUMN "public"."tbl_address"."house_floor_class" IS '房屋层数分类-字典(HOUSE_FLOOR_CLASS)';
COMMENT ON COLUMN "public"."tbl_address"."house_manage_style" IS '房屋管理方式-字典(HOUSE_MANAGE_STYLE)';
COMMENT ON COLUMN "public"."tbl_address"."house_peril_grade" IS '房屋危险性鉴定等级-字典(HOUSE_PERIL_GRADE)';
COMMENT ON COLUMN "public"."tbl_address"."house_temporary_manage" IS '房屋临时管理属性-字典(HOUSE_TEMPORARY_MANAGE)';
COMMENT ON COLUMN "public"."tbl_address"."address_tags" IS '地址标签(重点场所用途)';
COMMENT ON COLUMN "public"."tbl_address"."data_source" IS '数据来源-字典';
COMMENT ON COLUMN "public"."tbl_address"."remark" IS '备注';
COMMENT ON COLUMN "public"."tbl_address"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_address"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."tbl_address"."del_flag" IS '删除标记,1-已删除,0:正常';
COMMENT ON COLUMN "public"."tbl_address"."wkt" IS '小区/园区、楼幢区域信息';
COMMENT ON COLUMN "public"."tbl_address"."park_code" IS '小区园区编码(15位网格编码+2位顺序码+1位校验码)';
COMMENT ON TABLE "public"."tbl_address" IS '地址房屋信息';

-- ----------------------------
-- Indexes structure for table tbl_address
-- ----------------------------
CREATE INDEX "INX_ADDRESS_CODE" ON "public"."tbl_address" USING btree (
"address_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "INX_BUILDING_CODE" ON "public"."tbl_address" USING btree (
"building_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "INX_PARK_CODE" ON "public"."tbl_address" USING btree (
"park_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Triggers structure for table tbl_address
-- ----------------------------
CREATE TRIGGER "auto_update_time" BEFORE INSERT OR UPDATE ON "public"."tbl_address"
    FOR EACH ROW
EXECUTE PROCEDURE "public"."auto_update_timestamp"();

-- ----------------------------
-- Primary Key structure for table tbl_address
-- ----------------------------
ALTER TABLE "public"."tbl_address" ADD CONSTRAINT "tbl_address_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_enterprise
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_enterprise";
CREATE TABLE "public"."tbl_enterprise" (
"id" int4 NOT NULL DEFAULT nextval('tbl_enterprise_id_seq'::regclass),
"credit_code" varchar(18) COLLATE "pg_catalog"."default" NOT NULL,
"name" varchar(255) COLLATE "pg_catalog"."default",
"enterprise_type" varchar(10) COLLATE "pg_catalog"."default",
"business_place" varchar(255) COLLATE "pg_catalog"."default",
"oid" int4,
"city" varchar(255) COLLATE "pg_catalog"."default",
"county" varchar(255) COLLATE "pg_catalog"."default",
"town" varchar(255) COLLATE "pg_catalog"."default",
"community" varchar(255) COLLATE "pg_catalog"."default",
"grid" varchar(255) COLLATE "pg_catalog"."default",
"grid_code" varchar(255) COLLATE "pg_catalog"."default",
"source_address" varchar(255) COLLATE "pg_catalog"."default",
"address_code" varchar(27) COLLATE "pg_catalog"."default",
"lng" varchar(50) COLLATE "pg_catalog"."default",
"lat" varchar(50) COLLATE "pg_catalog"."default",
"legal_person_name" varchar(100) COLLATE "pg_catalog"."default",
"legal_person_id_type" varchar(10) COLLATE "pg_catalog"."default",
"legal_person_id_card" varchar(50) COLLATE "pg_catalog"."default",
"legal_person_phone" varchar(50) COLLATE "pg_catalog"."default",
"individual_business_compose" varchar(10) COLLATE "pg_catalog"."default",
"business_scope" text COLLATE "pg_catalog"."default",
"registered_capital" varchar(255) COLLATE "pg_catalog"."default",
"registered_currency" varchar(255) COLLATE "pg_catalog"."default",
"establishment_date" date,
"business_start_date" date,
"business_end_date" date,
"registration_authority" varchar(10) COLLATE "pg_catalog"."default",
"business_status" varchar(10) COLLATE "pg_catalog"."default",
"approval_date" date,
"industry_type" varchar(3) COLLATE "pg_catalog"."default",
"flag_administrative_penalty" varchar(3) COLLATE "pg_catalog"."default",
"administrative_penalty_date" date,
"administrative_penalty_type" varchar(10) COLLATE "pg_catalog"."default",
"administrative_penalty_authority" varchar(10) COLLATE "pg_catalog"."default",
"flag_business_abnormal" varchar(3) COLLATE "pg_catalog"."default",
"business_abnormal_date" date,
"business_abnormal_behavior" varchar(10) COLLATE "pg_catalog"."default",
"flag_illegality_dishonesty" varchar(3) COLLATE "pg_catalog"."default",
"illegality_dishonesty_date" date,
"illegality_dishonesty_behavior" varchar(10) COLLATE "pg_catalog"."default",
"flag_wage_arrears" varchar(3) COLLATE "pg_catalog"."default",
"wage_arrears_date" date,
"flag_fire_safety" varchar(3) COLLATE "pg_catalog"."default",
"flag_contingency_management" varchar(3) COLLATE "pg_catalog"."default",
"flag_transportation" varchar(3) COLLATE "pg_catalog"."default",
"flag_production_safety" varchar(3) COLLATE "pg_catalog"."default",
"production_safety_date" date,
"casualties" varchar(255) COLLATE "pg_catalog"."default",
"enterprise_tags" varchar(255) COLLATE "pg_catalog"."default",
"remark" text COLLATE "pg_catalog"."default",
"del_flag" int2,
"create_time" timestamp(6) DEFAULT now(),
"update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."tbl_enterprise"."id" IS '主键id';
COMMENT ON COLUMN "public"."tbl_enterprise"."credit_code" IS '统一社会信用代码';
COMMENT ON COLUMN "public"."tbl_enterprise"."name" IS '企业名称';
COMMENT ON COLUMN "public"."tbl_enterprise"."enterprise_type" IS '企业类型(字典：ENTERPRISE_TYPE)';
COMMENT ON COLUMN "public"."tbl_enterprise"."business_place" IS '经营场所';
COMMENT ON COLUMN "public"."tbl_enterprise"."oid" IS '组织id';
COMMENT ON COLUMN "public"."tbl_enterprise"."city" IS '城市';
COMMENT ON COLUMN "public"."tbl_enterprise"."county" IS '区县';
COMMENT ON COLUMN "public"."tbl_enterprise"."town" IS '镇街';
COMMENT ON COLUMN "public"."tbl_enterprise"."community" IS '社区';
COMMENT ON COLUMN "public"."tbl_enterprise"."grid" IS '网格';
COMMENT ON COLUMN "public"."tbl_enterprise"."grid_code" IS '网格编码';
COMMENT ON COLUMN "public"."tbl_enterprise"."source_address" IS '统一地址';
COMMENT ON COLUMN "public"."tbl_enterprise"."address_code" IS '统一地址代码';
COMMENT ON COLUMN "public"."tbl_enterprise"."lng" IS '经度';
COMMENT ON COLUMN "public"."tbl_enterprise"."lat" IS '纬度';
COMMENT ON COLUMN "public"."tbl_enterprise"."legal_person_name" IS '法定代表人姓名';
COMMENT ON COLUMN "public"."tbl_enterprise"."legal_person_id_type" IS '法定代表人证件类型(字典：ID_TYPE）';
COMMENT ON COLUMN "public"."tbl_enterprise"."legal_person_id_card" IS '法定代表人证件号码';
COMMENT ON COLUMN "public"."tbl_enterprise"."legal_person_phone" IS '法定代表人联系方式';
COMMENT ON COLUMN "public"."tbl_enterprise"."individual_business_compose" IS '个体工商户组成形式(字典：INDIVIDUAL_BUSINESS_COMPOSE)';
COMMENT ON COLUMN "public"."tbl_enterprise"."business_scope" IS '经营范围';
COMMENT ON COLUMN "public"."tbl_enterprise"."registered_capital" IS '注册资本(万元)';
COMMENT ON COLUMN "public"."tbl_enterprise"."registered_currency" IS '注册资本币种';
COMMENT ON COLUMN "public"."tbl_enterprise"."establishment_date" IS '成立日期';
COMMENT ON COLUMN "public"."tbl_enterprise"."business_start_date" IS '经营起始日期';
COMMENT ON COLUMN "public"."tbl_enterprise"."business_end_date" IS '经营截至日期';
COMMENT ON COLUMN "public"."tbl_enterprise"."registration_authority" IS '登记机关(字典：ENTERPRISE_REGISTRATION_AUTHORITY)';
COMMENT ON COLUMN "public"."tbl_enterprise"."business_status" IS '经营状态(字典：BUSINESS_STATUS)';
COMMENT ON COLUMN "public"."tbl_enterprise"."approval_date" IS '核准日期';
COMMENT ON COLUMN "public"."tbl_enterprise"."industry_type" IS '行业类型(字典：INDUSTRY_TYPE)';
COMMENT ON COLUMN "public"."tbl_enterprise"."flag_administrative_penalty" IS '是否收到行政处罚决定';
COMMENT ON COLUMN "public"."tbl_enterprise"."administrative_penalty_date" IS '行政处罚日期';
COMMENT ON COLUMN "public"."tbl_enterprise"."administrative_penalty_type" IS '行政处罚种类(字典：ENTERPRISE_ADMINISTRATIVE_PENALTY_TYPE)';
COMMENT ON COLUMN "public"."tbl_enterprise"."administrative_penalty_authority" IS '行政处罚机关(字典：ENTERPRISE_ADMINISTRATIVE_PENALTY_AUTHORITY)';
COMMENT ON COLUMN "public"."tbl_enterprise"."flag_business_abnormal" IS '是否列入经营异常名录';
COMMENT ON COLUMN "public"."tbl_enterprise"."business_abnormal_date" IS '列入异常名录时间';
COMMENT ON COLUMN "public"."tbl_enterprise"."business_abnormal_behavior" IS '经营异常行为(字典：BUSINESS_ABNORMAL_BEHAVIOR)';
COMMENT ON COLUMN "public"."tbl_enterprise"."flag_illegality_dishonesty" IS '是否列入严重违法失信名单(黑名单)';
COMMENT ON COLUMN "public"."tbl_enterprise"."illegality_dishonesty_date" IS '列入严重违法失信名单日期';
COMMENT ON COLUMN "public"."tbl_enterprise"."illegality_dishonesty_behavior" IS '严重违法失信行为(字典：ILLEGALITY_DISHONESTY_BEHAVIOR)';
COMMENT ON COLUMN "public"."tbl_enterprise"."flag_wage_arrears" IS '是否列入拖欠农民工工资黑名单';
COMMENT ON COLUMN "public"."tbl_enterprise"."wage_arrears_date" IS '列入拖欠农民工工资黑名单日期';
COMMENT ON COLUMN "public"."tbl_enterprise"."flag_fire_safety" IS '是否为消防安全重点单位';
COMMENT ON COLUMN "public"."tbl_enterprise"."flag_contingency_management" IS '是否为应急管理重点单位';
COMMENT ON COLUMN "public"."tbl_enterprise"."flag_transportation" IS '是否为交通运输重点单位';
COMMENT ON COLUMN "public"."tbl_enterprise"."flag_production_safety" IS '是否发生生产安全事故';
COMMENT ON COLUMN "public"."tbl_enterprise"."production_safety_date" IS '生产安全发生日期';
COMMENT ON COLUMN "public"."tbl_enterprise"."casualties" IS '伤亡人数';
COMMENT ON COLUMN "public"."tbl_enterprise"."enterprise_tags" IS '企业标签(其他信息)';
COMMENT ON COLUMN "public"."tbl_enterprise"."remark" IS '备注';
COMMENT ON COLUMN "public"."tbl_enterprise"."del_flag" IS '删除标记,1:已删除,0:正常';
COMMENT ON COLUMN "public"."tbl_enterprise"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_enterprise"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."tbl_enterprise" IS '企业单位(经济组织)';

-- ----------------------------
-- Primary Key structure for table tbl_enterprise
-- ----------------------------
ALTER TABLE "public"."tbl_enterprise" ADD CONSTRAINT "tbl_enterprise_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_person
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_person";
CREATE TABLE "public"."tbl_person" (
"id" int4 NOT NULL DEFAULT nextval('tbl_person_id_seq'::regclass),
"name" varchar(100) COLLATE "pg_catalog"."default",
"used_name" varchar(100) COLLATE "pg_catalog"."default",
"sex" varchar(10) COLLATE "pg_catalog"."default",
"birthday" date,
"id_type" varchar(10) COLLATE "pg_catalog"."default",
"id_card" varchar(50) COLLATE "pg_catalog"."default",
"phone" varchar(50) COLLATE "pg_catalog"."default",
"nationality" varchar(10) COLLATE "pg_catalog"."default",
"native_place" varchar(100) COLLATE "pg_catalog"."default",
"nation" varchar(10) COLLATE "pg_catalog"."default",
"residence_code" varchar(100) COLLATE "pg_catalog"."default",
"residence_address" varchar(255) COLLATE "pg_catalog"."default",
"inhabited_code" varchar(100) COLLATE "pg_catalog"."default",
"inhabited_address" varchar(255) COLLATE "pg_catalog"."default",
"person_type" varchar(10) COLLATE "pg_catalog"."default",
"education" varchar(10) COLLATE "pg_catalog"."default",
"military_status" varchar(10) COLLATE "pg_catalog"."default",
"marital_status" varchar(10) COLLATE "pg_catalog"."default",
"politic_face" varchar(10) COLLATE "pg_catalog"."default",
"religious" varchar(10) COLLATE "pg_catalog"."default",
"age" int4,
"oid" int4,
"person_tags" varchar(255) COLLATE "pg_catalog"."default",
"remark" text COLLATE "pg_catalog"."default",
"create_time" timestamp(6) DEFAULT now(),
"update_time" timestamp(6),
"del_flag" int2 DEFAULT 0
)
;
COMMENT ON COLUMN "public"."tbl_person"."id" IS '主键id';
COMMENT ON COLUMN "public"."tbl_person"."name" IS '姓名';
COMMENT ON COLUMN "public"."tbl_person"."used_name" IS '曾用名';
COMMENT ON COLUMN "public"."tbl_person"."sex" IS '性别-字典(PERSON_SEX)';
COMMENT ON COLUMN "public"."tbl_person"."birthday" IS '出生日期';
COMMENT ON COLUMN "public"."tbl_person"."id_type" IS '证件类型-字典(ID_TYPE)';
COMMENT ON COLUMN "public"."tbl_person"."id_card" IS '证件号码';
COMMENT ON COLUMN "public"."tbl_person"."phone" IS '联系电话';
COMMENT ON COLUMN "public"."tbl_person"."nationality" IS '国籍-字典';
COMMENT ON COLUMN "public"."tbl_person"."native_place" IS '籍贯';
COMMENT ON COLUMN "public"."tbl_person"."nation" IS '民族-字典';
COMMENT ON COLUMN "public"."tbl_person"."residence_code" IS '户籍地编码';
COMMENT ON COLUMN "public"."tbl_person"."residence_address" IS '户籍地详址';
COMMENT ON COLUMN "public"."tbl_person"."inhabited_code" IS '现住地编码';
COMMENT ON COLUMN "public"."tbl_person"."inhabited_address" IS '现住地详址';
COMMENT ON COLUMN "public"."tbl_person"."person_type" IS '人口类型-字典(PERSON_TYPE)';
COMMENT ON COLUMN "public"."tbl_person"."education" IS '文化程度-字典(EDUCATION)';
COMMENT ON COLUMN "public"."tbl_person"."military_status" IS '兵役状况-字典(MILITARY_STATUS)';
COMMENT ON COLUMN "public"."tbl_person"."marital_status" IS '婚姻状况-字典(MARITAL_STATUS)';
COMMENT ON COLUMN "public"."tbl_person"."politic_face" IS '政治面貌-字典(POLITIC_FACE)';
COMMENT ON COLUMN "public"."tbl_person"."religious" IS '宗教信仰-字典(RELIGIOUS)';
COMMENT ON COLUMN "public"."tbl_person"."age" IS '年龄';
COMMENT ON COLUMN "public"."tbl_person"."oid" IS '组织id';
COMMENT ON COLUMN "public"."tbl_person"."person_tags" IS '人员标签(,逗号隔开)';
COMMENT ON COLUMN "public"."tbl_person"."remark" IS '备注';
COMMENT ON COLUMN "public"."tbl_person"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_person"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."tbl_person"."del_flag" IS '删除标记,1:已删除,0:正常';
COMMENT ON TABLE "public"."tbl_person" IS '人员信息';

-- ----------------------------
-- Triggers structure for table tbl_person
-- ----------------------------
CREATE TRIGGER "auto_update_time" BEFORE INSERT OR UPDATE ON "public"."tbl_person"
    FOR EACH ROW
EXECUTE PROCEDURE "public"."auto_update_timestamp"();

-- ----------------------------
-- Primary Key structure for table tbl_person
-- ----------------------------
ALTER TABLE "public"."tbl_person" ADD CONSTRAINT "tbl_person_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_person_address_relation
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_person_address_relation";
CREATE TABLE "public"."tbl_person_address_relation" (
"id" int4 NOT NULL DEFAULT nextval('tbl_person_address_relation_id_seq'::regclass),
"person_id" int4,
"address_id" int4,
"person_address_relation" varchar(10) COLLATE "pg_catalog"."default",
"householder_relation" varchar(10) COLLATE "pg_catalog"."default",
"flag_related" varchar(10) COLLATE "pg_catalog"."default" DEFAULT 1,
"create_time" timestamp(6) DEFAULT now(),
"update_time" timestamp(6),
"del_flag" int2 DEFAULT 0,
"id_type" varchar(10) COLLATE "pg_catalog"."default",
"id_card" varchar(50) COLLATE "pg_catalog"."default",
"address_code" varchar(100) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."tbl_person_address_relation"."id" IS '主键id';
COMMENT ON COLUMN "public"."tbl_person_address_relation"."person_id" IS '人员id';
COMMENT ON COLUMN "public"."tbl_person_address_relation"."address_id" IS '房屋id';
COMMENT ON COLUMN "public"."tbl_person_address_relation"."person_address_relation" IS '人房关系-字典(PERSON_ADDRESS_RELATION)';
COMMENT ON COLUMN "public"."tbl_person_address_relation"."householder_relation" IS '人和户主关系(HOUSEHOLDER_RELATION)';
COMMENT ON COLUMN "public"."tbl_person_address_relation"."flag_related" IS '是否关联：0-否;1-是';
COMMENT ON COLUMN "public"."tbl_person_address_relation"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_person_address_relation"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."tbl_person_address_relation"."del_flag" IS '删除标记,1-已删除,0:正常';
COMMENT ON COLUMN "public"."tbl_person_address_relation"."id_type" IS '证件类型-字典(ID_TYPE)';
COMMENT ON COLUMN "public"."tbl_person_address_relation"."id_card" IS '证件号码';
COMMENT ON COLUMN "public"."tbl_person_address_relation"."address_code" IS '地址编码';
COMMENT ON TABLE "public"."tbl_person_address_relation" IS '人员房屋关联表';

-- ----------------------------
-- Triggers structure for table tbl_person_address_relation
-- ----------------------------
CREATE TRIGGER "auto_update_time" BEFORE INSERT OR UPDATE ON "public"."tbl_person_address_relation"
    FOR EACH ROW
EXECUTE PROCEDURE "public"."auto_update_timestamp"();

-- ----------------------------
-- Primary Key structure for table tbl_person_address_relation
-- ----------------------------
ALTER TABLE "public"."tbl_person_address_relation" ADD CONSTRAINT "tbl_person_address_relation_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_social_org
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_social_org";
CREATE TABLE "public"."tbl_social_org" (
"id" int4 NOT NULL DEFAULT nextval('tbl_social_org_id_seq'::regclass),
"credit_code" varchar(18) COLLATE "pg_catalog"."default" NOT NULL,
"name" varchar(255) COLLATE "pg_catalog"."default",
"social_org_type" varchar(10) COLLATE "pg_catalog"."default",
"residence" varchar(255) COLLATE "pg_catalog"."default",
"city" varchar(255) COLLATE "pg_catalog"."default",
"county" varchar(255) COLLATE "pg_catalog"."default",
"town" varchar(255) COLLATE "pg_catalog"."default",
"community" varchar(255) COLLATE "pg_catalog"."default",
"grid" varchar(255) COLLATE "pg_catalog"."default",
"grid_code" varchar(50) COLLATE "pg_catalog"."default",
"source_address" varchar(255) COLLATE "pg_catalog"."default",
"address_code" varchar(27) COLLATE "pg_catalog"."default",
"lng" varchar(50) COLLATE "pg_catalog"."default",
"lat" varchar(50) COLLATE "pg_catalog"."default",
"legal_person_name" varchar(100) COLLATE "pg_catalog"."default",
"legal_person_id_type" varchar(10) COLLATE "pg_catalog"."default",
"legal_person_id_card" varchar(50) COLLATE "pg_catalog"."default",
"legal_person_phone" varchar(50) COLLATE "pg_catalog"."default",
"business_scope" text COLLATE "pg_catalog"."default",
"registered_capital" varchar(255) COLLATE "pg_catalog"."default",
"registered_currency" varchar(255) COLLATE "pg_catalog"."default",
"supervisory_unit" varchar(10) COLLATE "pg_catalog"."default",
"registration_authority" varchar(10) COLLATE "pg_catalog"."default",
"issuance_date" date,
"valid_period" varchar(50) COLLATE "pg_catalog"."default",
"status" varchar(10) COLLATE "pg_catalog"."default",
"flag_inspect_annually" varchar(3) COLLATE "pg_catalog"."default",
"flag_administrative_penalty" varchar(3) COLLATE "pg_catalog"."default",
"administrative_penalty_date" date,
"administrative_penalty_type" varchar(10) COLLATE "pg_catalog"."default",
"administrative_penalty_authority" varchar(10) COLLATE "pg_catalog"."default",
"flag_activity_abnormal" varchar(3) COLLATE "pg_catalog"."default",
"activity_abnormal_date" date,
"activity_abnormal_reason" varchar(10) COLLATE "pg_catalog"."default",
"flag_illegality_dishonesty" varchar(3) COLLATE "pg_catalog"."default",
"illegality_dishonesty_date" date,
"illegality_dishonesty_reason" varchar(10) COLLATE "pg_catalog"."default",
"flag_banning_no_social" varchar(3) COLLATE "pg_catalog"."default",
"banning_date" date,
"capital_source" varchar(10) COLLATE "pg_catalog"."default",
"flag_overseas_background" varchar(3) COLLATE "pg_catalog"."default",
"social_org_tags" varchar(255) COLLATE "pg_catalog"."default",
"remark" text COLLATE "pg_catalog"."default",
"del_flag" int2,
"create_time" timestamp(6) DEFAULT now(),
"update_time" timestamp(6),
"oid" int4,
"flag_illegal_society_org" varchar(3) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."tbl_social_org"."id" IS '主键id';
COMMENT ON COLUMN "public"."tbl_social_org"."credit_code" IS '统一社会信用代码';
COMMENT ON COLUMN "public"."tbl_social_org"."name" IS '社会组织名称';
COMMENT ON COLUMN "public"."tbl_social_org"."social_org_type" IS '社会组织类型(字典：SOCIAL_ORG_TYPE)';
COMMENT ON COLUMN "public"."tbl_social_org"."residence" IS '住所';
COMMENT ON COLUMN "public"."tbl_social_org"."city" IS '城市';
COMMENT ON COLUMN "public"."tbl_social_org"."county" IS '区县';
COMMENT ON COLUMN "public"."tbl_social_org"."town" IS '镇街';
COMMENT ON COLUMN "public"."tbl_social_org"."community" IS '社区';
COMMENT ON COLUMN "public"."tbl_social_org"."grid" IS '网格';
COMMENT ON COLUMN "public"."tbl_social_org"."grid_code" IS '网格编码';
COMMENT ON COLUMN "public"."tbl_social_org"."source_address" IS '统一地址';
COMMENT ON COLUMN "public"."tbl_social_org"."address_code" IS '统一地址代码';
COMMENT ON COLUMN "public"."tbl_social_org"."lng" IS '经度';
COMMENT ON COLUMN "public"."tbl_social_org"."lat" IS '纬度';
COMMENT ON COLUMN "public"."tbl_social_org"."legal_person_name" IS '法定代表人';
COMMENT ON COLUMN "public"."tbl_social_org"."legal_person_id_type" IS '法定代表人证件类型(字典：ID_TYPE)';
COMMENT ON COLUMN "public"."tbl_social_org"."legal_person_id_card" IS '法定代表人证件号码';
COMMENT ON COLUMN "public"."tbl_social_org"."legal_person_phone" IS '法定代表人联系方式';
COMMENT ON COLUMN "public"."tbl_social_org"."business_scope" IS '业务范围';
COMMENT ON COLUMN "public"."tbl_social_org"."registered_capital" IS '注册资金、开办资金(万元)';
COMMENT ON COLUMN "public"."tbl_social_org"."registered_currency" IS '注册资本币种';
COMMENT ON COLUMN "public"."tbl_social_org"."supervisory_unit" IS '业务主管单位(字典：SUPERVISORY_UNIT)';
COMMENT ON COLUMN "public"."tbl_social_org"."registration_authority" IS '登记机关(字典：SOCIAL_REGISTRATION_AUTHORITY)';
COMMENT ON COLUMN "public"."tbl_social_org"."issuance_date" IS '发证日期';
COMMENT ON COLUMN "public"."tbl_social_org"."valid_period" IS '有效期限(yyyy-MM-dd至yyyy-MM-dd)';
COMMENT ON COLUMN "public"."tbl_social_org"."status" IS '状态(字典：SOCIAL_ORG_STATUS)';
COMMENT ON COLUMN "public"."tbl_social_org"."flag_inspect_annually" IS '是否进行年检';
COMMENT ON COLUMN "public"."tbl_social_org"."flag_administrative_penalty" IS '是否收到行政处罚决定';
COMMENT ON COLUMN "public"."tbl_social_org"."administrative_penalty_date" IS '行政处罚日期';
COMMENT ON COLUMN "public"."tbl_social_org"."administrative_penalty_type" IS '行政处罚种类(字典：SOCIAL_ADMINISTRATIVE_PENALTY_TYPE)';
COMMENT ON COLUMN "public"."tbl_social_org"."administrative_penalty_authority" IS '行政处罚机关(字典：SOCIAL_ADMINISTRATIVE_PENALTY_AUTHORITY)';
COMMENT ON COLUMN "public"."tbl_social_org"."flag_activity_abnormal" IS '是否列入活动异常名录';
COMMENT ON COLUMN "public"."tbl_social_org"."activity_abnormal_date" IS '列入活动异常名录日期';
COMMENT ON COLUMN "public"."tbl_social_org"."activity_abnormal_reason" IS '列入活动异常名录事由(字典：ACTIVITY_ABNORMAL_REASON)';
COMMENT ON COLUMN "public"."tbl_social_org"."flag_illegality_dishonesty" IS '是否列入严重违法失信名单';
COMMENT ON COLUMN "public"."tbl_social_org"."illegality_dishonesty_date" IS '列入严重违法失信名单日期';
COMMENT ON COLUMN "public"."tbl_social_org"."illegality_dishonesty_reason" IS '列入严重违法失信名单事由(字典：ILLEGALITY_DISHONESTY_REASON)';
COMMENT ON COLUMN "public"."tbl_social_org"."flag_banning_no_social" IS '是否为已取缔非法社会组织';
COMMENT ON COLUMN "public"."tbl_social_org"."banning_date" IS '取缔日期';
COMMENT ON COLUMN "public"."tbl_social_org"."capital_source" IS '资金来源(字典：CAPITAL_SOURCE)';
COMMENT ON COLUMN "public"."tbl_social_org"."flag_overseas_background" IS '是否有境外背景';
COMMENT ON COLUMN "public"."tbl_social_org"."social_org_tags" IS '社会组织标签(其他信息)';
COMMENT ON COLUMN "public"."tbl_social_org"."remark" IS '备注';
COMMENT ON COLUMN "public"."tbl_social_org"."del_flag" IS '删除标记,1:已删除,0:正常';
COMMENT ON COLUMN "public"."tbl_social_org"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_social_org"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."tbl_social_org"."oid" IS '组织id';
COMMENT ON COLUMN "public"."tbl_social_org"."flag_illegal_society_org" IS '是否为涉嫌非法社会组织';
COMMENT ON TABLE "public"."tbl_social_org" IS '社会组织';

-- ----------------------------
-- Primary Key structure for table tbl_social_org
-- ----------------------------
ALTER TABLE "public"."tbl_social_org" ADD CONSTRAINT "tbl_social_org_pkey" PRIMARY KEY ("id");
