-- 处方库表
CREATE TABLE IF NOT EXISTS `zyt_prescription_library` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `prescription_name` varchar(100) NOT NULL DEFAULT '' COMMENT '处方名称',
  `formula_type` varchar(20) NOT NULL DEFAULT '主方' COMMENT '处方类型：主方、辅方',
  `herbs` text COMMENT '药材列表JSON：[{name, dosage}]',
  `is_public` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否公开：0-仅自己可见 1-所有人可见',
  `creator_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建人ID',
  `creator_name` varchar(50) NOT NULL DEFAULT '' COMMENT '创建人姓名',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  `delete_time` int(10) unsigned DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`),
  KEY `idx_creator` (`creator_id`),
  KEY `idx_is_public` (`is_public`),
  KEY `idx_create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='处方库表';
