/*
 Navicat Premium Data Transfer

 Source Server         : 智慧法务
 Source Server Type    : PostgreSQL
 Source Server Version : 170005
 Source Host           : nas.7bm.co:54302
 Source Catalog        : docauditai
 Source Schema         : public

 Target Server Type    : PostgreSQL
 Target Server Version : 170005
 File Encoding         : 65001

 Date: 09/07/2025 16:21:17
*/


-- ----------------------------
-- Table structure for evaluation_points
-- ----------------------------
DROP TABLE IF EXISTS "public"."evaluation_points";
CREATE TABLE "public"."evaluation_points" (
  "id" int4 NOT NULL DEFAULT nextval('evaluation_points_id_seq'::regclass),
  "code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "evaluation_point_groups_id" int4,
  "risk" varchar(10) COLLATE "pg_catalog"."default" NOT NULL,
  "description" text COLLATE "pg_catalog"."default",
  "is_enabled" bool DEFAULT true,
  "references_laws" jsonb NOT NULL,
  "extraction_config" jsonb NOT NULL,
  "evaluation_config" jsonb NOT NULL,
  "pass_message" text COLLATE "pg_catalog"."default",
  "fail_message" text COLLATE "pg_catalog"."default",
  "suggestion_message" text COLLATE "pg_catalog"."default",
  "suggestion_message_type" varchar(20) COLLATE "pg_catalog"."default" DEFAULT 'warning'::character varying,
  "post_action" varchar(50) COLLATE "pg_catalog"."default",
  "action_config" text COLLATE "pg_catalog"."default",
  "created_at" timestamptz(6) DEFAULT now(),
  "updated_at" timestamptz(6) DEFAULT now(),
  "evaluation_point_groups_pid" int4,
  "score" numeric(5,2) DEFAULT 0.00
)
;
COMMENT ON COLUMN "public"."evaluation_points"."id" IS '主键，自增';
COMMENT ON COLUMN "public"."evaluation_points"."code" IS '评查点编码，唯一且非空';
COMMENT ON COLUMN "public"."evaluation_points"."name" IS '评查点名称，非空';
COMMENT ON COLUMN "public"."evaluation_points"."evaluation_point_groups_id" IS '所属分组ID，外键引用evaluation_point_groups表';
COMMENT ON COLUMN "public"."evaluation_points"."risk" IS '风险等级，非空（高/中/低）';
COMMENT ON COLUMN "public"."evaluation_points"."description" IS '评查点描述，可为空';
COMMENT ON COLUMN "public"."evaluation_points"."is_enabled" IS '是否启用，默认true';
COMMENT ON COLUMN "public"."evaluation_points"."references_laws" IS '引用法典，JSONB格式，非空';
COMMENT ON COLUMN "public"."evaluation_points"."extraction_config" IS '抽取配置，JSONB格式，非空';
COMMENT ON COLUMN "public"."evaluation_points"."evaluation_config" IS '评查设置，JSONB格式，非空';
COMMENT ON COLUMN "public"."evaluation_points"."pass_message" IS '通过提示，可为空';
COMMENT ON COLUMN "public"."evaluation_points"."fail_message" IS '不通过提示，可为空';
COMMENT ON COLUMN "public"."evaluation_points"."suggestion_message" IS '建议信息，可为空';
COMMENT ON COLUMN "public"."evaluation_points"."suggestion_message_type" IS '建议信息类型，默认warning（info/warning/error）';
COMMENT ON COLUMN "public"."evaluation_points"."post_action" IS '评查后动作类型，可为空（none/manual/replace）';
COMMENT ON COLUMN "public"."evaluation_points"."action_config" IS '动作配置，可为空';
COMMENT ON COLUMN "public"."evaluation_points"."created_at" IS '创建时间，带时区，默认当前时间';
COMMENT ON COLUMN "public"."evaluation_points"."updated_at" IS '更新时间，带时区，默认当前时间';
COMMENT ON COLUMN "public"."evaluation_points"."evaluation_point_groups_pid" IS '所属分组PID，外键引用evaluation_point_groups表';
COMMENT ON COLUMN "public"."evaluation_points"."score" IS '评查点得分';
COMMENT ON TABLE "public"."evaluation_points" IS '评查点表';

-- ----------------------------
-- Triggers structure for table evaluation_points
-- ----------------------------
CREATE TRIGGER "update_evaluation_points_updated_at" BEFORE UPDATE ON "public"."evaluation_points"
FOR EACH ROW
EXECUTE PROCEDURE "public"."update_updated_at_column"();

-- ----------------------------
-- Uniques structure for table evaluation_points
-- ----------------------------
ALTER TABLE "public"."evaluation_points" ADD CONSTRAINT "evaluation_points_code_key" UNIQUE ("code");

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