SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for ow_owner
-- ----------------------------
DROP TABLE IF EXISTS ow_owner;
CREATE TABLE ow_owner  (
  owner_id          bigint(20) NOT NULL DEFAULT 0 COMMENT '业主ID',
  user_id           bigint(20) NOT NULL DEFAULT 0 COMMENT '用户关联ID',
  linkman           varchar(10) NOT NULL DEFAULT '' COMMENT '联系人名称',
  phone             varchar(20) NOT NULL DEFAULT '' COMMENT '联系人电话',
  housing_estate    bigint(20) NOT NULL DEFAULT 0 COMMENT '小区,下拉选ID',
  addr              varchar(100)  NOT NULL DEFAULT '' COMMENT '详细地址',
  user_create       bigint(20) NOT NULL DEFAULT 0 COMMENT '新增人',
  time_create       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增时间',
  user_update       bigint(20) NOT NULL DEFAULT 0 COMMENT '修改人',
  time_update       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (owner_id) USING BTREE
) ENGINE = InnoDB default charset=utf8mb4 comment = '业委会';
-- ----------------------------
-- Table structure for re_health_sign
-- ----------------------------
DROP TABLE IF EXISTS re_health_sign;
CREATE TABLE re_health_sign  (
  sign_id           bigint(20) NOT NULL DEFAULT 0 COMMENT '签到ID',
  resident_id       bigint(20) NOT NULL DEFAULT 0 COMMENT '居民ID',
  sign_date         date NOT NULL DEFAULT '2200-01-01' COMMENT '签到时间',
  health_type       int(11) NOT NULL DEFAULT 0 COMMENT '家庭健康状态:1健康,2生病',
  health_count      int(11) NOT NULL DEFAULT 0 COMMENT '健康人数',
  doubt_count       int(11) NOT NULL DEFAULT 0 COMMENT '疑似人数',
  illness_content   varchar(100)  NOT NULL DEFAULT '' COMMENT '病情内容',
  user_create       bigint(20) NOT NULL DEFAULT 0 COMMENT '新增人',
  time_create       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增时间',
  user_update       bigint(20) NOT NULL DEFAULT 0 COMMENT '修改人',
  time_update       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (sign_id) USING BTREE,
  INDEX resident_id(resident_id) USING BTREE
) ENGINE = InnoDB default charset=utf8mb4 comment = '健康签到表';

-- ----------------------------
-- Table structure for re_help
-- ----------------------------
DROP TABLE IF EXISTS re_help;
CREATE TABLE re_help  (
  help_id bigint(20) NOT NULL DEFAULT 0 COMMENT '求助ID',
  resident_id       bigint(20) NOT NULL DEFAULT 0 COMMENT '居民ID',
  help_to           int(11) NOT NULL DEFAULT 0 COMMENT '求助对象:1社区,2商店',
  help_theme        varchar(100)  NOT NULL DEFAULT '' COMMENT '求助主题',
  help_content      varchar(100)  NOT NULL DEFAULT '' COMMENT '求助内容',
  is_file           int(1) NOT NULL DEFAULT 0 COMMENT '是否有附件:1是 去附件表查;2否',
  help_status       int(11) NOT NULL DEFAULT 0 COMMENT '求助状态:1已解决,2解决中,3未解决',
  user_create       bigint(20) NOT NULL DEFAULT 0 COMMENT '新增人',
  time_create       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增时间',
  user_update       bigint(20) NOT NULL DEFAULT 0 COMMENT '修改人',
  time_update       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (help_id) USING BTREE
) ENGINE = InnoDB default charset=utf8mb4 comment = '家庭求助表';

-- ----------------------------
-- Table structure for re_help_reply
-- ----------------------------
DROP TABLE IF EXISTS re_help_reply;
CREATE TABLE re_help_reply  (
  reply_id          bigint(20) NOT NULL DEFAULT 0 COMMENT '回复ID',
  help_id           bigint(20) NOT NULL DEFAULT 0 COMMENT '求助ID',
  user_id           bigint(20) NOT NULL DEFAULT 0 COMMENT '用户ID',
  reply_content     varchar(100)  NOT NULL DEFAULT '' COMMENT '回复内容',
  user_create       bigint(20) NOT NULL DEFAULT 0 COMMENT '新增人',
  time_create       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增时间',
  user_update       bigint(20) NOT NULL DEFAULT 0 COMMENT '修改人',
  time_update       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (reply_id) USING BTREE
) ENGINE = InnoDB default charset=utf8mb4 comment = '家庭求助回复表';

-- ----------------------------
-- Table structure for re_resident
-- ----------------------------
DROP TABLE IF EXISTS re_resident;
CREATE TABLE re_resident  (
  resident_id       bigint(20) NOT NULL DEFAULT 0 COMMENT '居民ID',
  housing_estate    bigint(20) NOT NULL DEFAULT 0 COMMENT '小区,下拉选ID',
  ridgepole         int(11) NOT NULL DEFAULT 0 COMMENT '栋',
  unit              int(11) NOT NULL DEFAULT 0 COMMENT '单元',
  doorplate         varchar(20)  NOT NULL DEFAULT '' COMMENT '门牌',
  user_id           bigint(20) NOT NULL DEFAULT 0 COMMENT '用户关联ID',
  linkman           varchar(10)  NOT NULL DEFAULT '' COMMENT '联系人名称',
  phone             varchar(20)  NOT NULL DEFAULT '' COMMENT '联系人电话',
  young             int(11) NOT NULL DEFAULT 0 COMMENT '家庭年前人数',
  middle            int(11) NOT NULL DEFAULT 0 COMMENT '家庭中年人数',
  old               int(11) NOT NULL DEFAULT 0 COMMENT '家庭老年人数',
  remark            varchar(100)  NOT NULL DEFAULT '' COMMENT '备注',
  user_create       bigint(20) NOT NULL DEFAULT 0 COMMENT '新增人',
  time_create       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增时间',
  user_update       bigint(20) NOT NULL DEFAULT 0 COMMENT '修改人',
  time_update       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (resident_id) USING BTREE
) ENGINE = InnoDB default charset=utf8mb4 comment = '居民表';

-- ----------------------------
-- Table structure for sh_shop
-- ----------------------------
DROP TABLE IF EXISTS sh_shop;
CREATE TABLE sh_shop  (
  shop_id           bigint(20) NOT NULL DEFAULT 0 COMMENT '商店ID',
  user_id           bigint(20) NOT NULL DEFAULT 0 COMMENT '用户关联ID',
  shop_type         int(11) NOT NULL DEFAULT 0 COMMENT '商店类型:1药店,2商超,3菜场',
  shop_name         varchar(50)  NOT NULL DEFAULT '' COMMENT '商店名称',
  linkman           varchar(10)  NOT NULL DEFAULT '' COMMENT '联系人名称',
  phone             varchar(20)  NOT NULL DEFAULT '' COMMENT '商店电话',
  housing_estate    bigint(20) NOT NULL DEFAULT 0 COMMENT '小区,下拉选ID',
  addr              varchar(100)  NOT NULL DEFAULT '' COMMENT '商店地址',
  start_date        varchar(10)  NOT NULL DEFAULT '' COMMENT '营业开始日期',
  end_date          varchar(10)  NOT NULL DEFAULT '' COMMENT '营业结束日期',
  message           varchar(100)  NOT NULL DEFAULT '' COMMENT '每日消息',
  status            int(11) NOT NULL DEFAULT 0 COMMENT '状态:1正常,0草稿,-1删除',
  user_create       bigint(20) NOT NULL DEFAULT 0 COMMENT '新增人',
  time_create       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增时间',
  user_update       bigint(20) NOT NULL DEFAULT 0 COMMENT '修改人',
  time_update       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (shop_id) USING BTREE
) ENGINE = InnoDB default charset=utf8mb4 comment = '商店信息';

-- ----------------------------
-- Table structure for sh_shop_mat
-- ----------------------------
DROP TABLE IF EXISTS sh_shop_mat;
CREATE TABLE sh_shop_mat  (
  mat_id            bigint(20) NOT NULL DEFAULT 0 COMMENT '物资ID',
  shop_id           bigint(20) NOT NULL DEFAULT 0 COMMENT '商店ID',
  inventory_type    int(11) NOT NULL DEFAULT 0 COMMENT '库存类型:1充裕,2少量,3售罄',
  status            int(11) NOT NULL DEFAULT 0 COMMENT '状态:1正常,0草稿,-1删除',
  description       varchar(100)  NOT NULL DEFAULT '' COMMENT '物资描述',
  user_create       bigint(20) NOT NULL DEFAULT 0 COMMENT '新增人',
  time_create       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增时间',
  user_update       bigint(20) NOT NULL DEFAULT 0 COMMENT '修改人',
  time_update       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (mat_id) USING BTREE
) ENGINE = InnoDB default charset=utf8mb4 comment = '商店物资信息';

-- ----------------------------
-- Table structure for sys_file
-- ----------------------------
DROP TABLE IF EXISTS sys_file;
CREATE TABLE sys_file  (
  file_id           bigint(20) NOT NULL DEFAULT 0 COMMENT '文件ID',
  file_name         varchar(100)  NOT NULL DEFAULT '' COMMENT '原始文件名称',
  module_id         int(11) NOT NULL DEFAULT 0 COMMENT '模块ID:1商家证照,',
  busi_id           bigint(20) NOT NULL DEFAULT 0 COMMENT '业务ID',
  file_ext          varchar(20)  NOT NULL DEFAULT '' COMMENT '扩展名',
  file_url          varchar(200)  NOT NULL DEFAULT '' COMMENT '下载地址：相对url，无域名',
  user_id           bigint(20) NOT NULL DEFAULT 0 COMMENT '上传人',
  time_create       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增时间',
  time_update       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (file_id) USING BTREE
) ENGINE = InnoDB default charset=utf8mb4 comment = '附件上传表';
