
CREATE TABLE sys_ward (
  ward_id BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
  tenant_id varchar(20) default '000000' null comment '租户编号',
  ward_name VARCHAR(100) NOT NULL COMMENT '病区名称',
  dept_id VARCHAR(300) NOT NULL COMMENT '科室ID',
  status CHAR(1) DEFAULT '0' COMMENT '状态（0正常 1停用）',
  del_flag char default '0' null comment '删除标志（0代表存在 1代表删除）',
  create_dept   bigint null comment '创建部门',
  create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
  create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  update_by VARCHAR(64) DEFAULT '' COMMENT '更新者',
  update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='病区管理表';


CREATE TABLE sys_hospital (
  hospital_id BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
  tenant_id varchar(20) default '000000' null comment '租户编号',
  hospital_name VARCHAR(200) NOT NULL COMMENT '医院名称',
  hospital_logo VARCHAR(300) COMMENT '医院logo',
  hospital_level char(2) COMMENT '医院等级',
  phone VARCHAR(20) COMMENT '联系电话',
  bed_space VARCHAR(100)  COMMENT '住院床位',
  region VARCHAR(300) COMMENT '所属地区',
  description VARCHAR(1000) COMMENT '医院描述',
  status CHAR(1) DEFAULT '0' COMMENT '状态（0正常 1停用）',
  del_flag char default '0' null comment '删除标志（0代表存在 1代表删除）',
  create_dept  bigint null comment '创建部门',
  create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
  create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  update_by VARCHAR(64) DEFAULT '' COMMENT '更新者',
  update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医院管理表';


CREATE TABLE sys_disease_label (
   label_id BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
   tenant_id varchar(20) default '000000' null comment '租户编号',
   label_name VARCHAR(100) NOT NULL COMMENT '疾病/部位名称',
   label_code VARCHAR(50) NOT NULL COMMENT '疾病/部位编码',
   category CHAR(1) COMMENT '所属分类',
   status CHAR(1) DEFAULT '0' COMMENT '状态（0正常 1停用）',
   del_flag char default '0' null comment '删除标志（0代表存在 1代表删除）',
   create_dept  bigint null comment '创建部门',
   create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
   create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   update_by VARCHAR(64) DEFAULT '' COMMENT '更新者',
   update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='疾病/部位标签表';


CREATE TABLE sys_food_category (
   food_category_id  BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
   tenant_id varchar(20) default '000000' null comment '租户编号',
   name          VARCHAR(300) NOT NULL COMMENT '分类名称',
   parent_id     BIGINT DEFAULT 0 COMMENT '上级分类ID',
   type          INT DEFAULT 2 COMMENT '类型',
   is_default    INT DEFAULT 0 COMMENT '是默认',
   sort          INT DEFAULT 0 COMMENT '排序',
   status CHAR(1) DEFAULT '0' COMMENT '状态（0正常 1停用）',
   del_flag char default '0' null comment '删除标志（0代表存在 1代表删除）',
   create_dept  bigint null comment '创建部门',
   create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
   create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   update_by VARCHAR(64) DEFAULT '' COMMENT '更新者',
   update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='食材分类表';

INSERT INTO sys_food_category (name, parent_id, create_by, update_by) VALUES ('调料类', 0, '1', '1');
INSERT INTO sys_food_category (name, parent_id, create_by, update_by) VALUES ('油脂类', 0, '1', '1');
INSERT INTO sys_food_category (name, parent_id, create_by, update_by) VALUES ('奶及奶制品', 0, '1', '1');
INSERT INTO sys_food_category (name, parent_id, create_by, update_by) VALUES ('大豆及坚果类', 0, '1', '1');
INSERT INTO sys_food_category (name, parent_id, create_by, update_by) VALUES ('禽畜肉类', 0, '1', '1');
INSERT INTO sys_food_category (name, parent_id, create_by, update_by) VALUES ('水产类', 0, '1', '1');
INSERT INTO sys_food_category (name, parent_id, create_by, update_by) VALUES ('蛋类', 0, '1', '1');
INSERT INTO sys_food_category (name, parent_id, create_by, update_by) VALUES ('蔬菜类', 0, '1', '1');
INSERT INTO sys_food_category (name, parent_id, create_by, update_by) VALUES ('水果类', 0, '1', '1');
INSERT INTO sys_food_category (name, parent_id, create_by, update_by) VALUES ('谷类', 0, '1', '1');
INSERT INTO sys_food_category (name, parent_id, create_by, update_by) VALUES ('全谷物和杂豆', 0, '1', '1');
INSERT INTO sys_food_category (name, parent_id, create_by, update_by) VALUES ('薯类', 0, '1', '1');
INSERT INTO sys_food_category (name, parent_id, create_by, update_by) VALUES ('水', 0, '1', '1');
