新增功能

This commit is contained in:
Your Name
2026-03-14 11:16:04 +08:00
parent eb283f008b
commit 4ddee40675
264 changed files with 5039 additions and 2813 deletions
@@ -0,0 +1,40 @@
-- 粉丝表
CREATE TABLE IF NOT EXISTS `zyt_fan` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '姓名',
`phone` varchar(20) NOT NULL DEFAULT '' COMMENT '手机号',
`id_card` varchar(18) NOT NULL DEFAULT '' COMMENT '身份证号码',
`age` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT '年龄',
`gender` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '性别: 0=未知 1=男 2=女',
`remark` varchar(500) NOT NULL DEFAULT '' COMMENT '备注',
`creator_id` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '创建人ID',
`creator_name` varchar(50) NOT NULL DEFAULT '' COMMENT '创建人名称',
`status` tinyint(1) unsigned NOT NULL DEFAULT 1 COMMENT '状态: 0=禁用 1=启用',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(10) unsigned DEFAULT NULL COMMENT '修改时间',
`delete_time` int(10) unsigned DEFAULT NULL COMMENT '删除时间',
PRIMARY KEY (`id`),
KEY `idx_phone` (`phone`),
KEY `idx_id_card` (`id_card`),
KEY `idx_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='粉丝表';
-- 粉丝回访记录表
CREATE TABLE IF NOT EXISTS `zyt_fan_visit_record` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`fan_id` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '关联粉丝ID',
`visit_type` tinyint(1) unsigned NOT NULL DEFAULT 1 COMMENT '回访类型: 1=电话 2=微信 3=短信 4=上门 5=其他',
`visit_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '回访时间',
`content` text COMMENT '回访内容',
`result` varchar(500) NOT NULL DEFAULT '' COMMENT '回访结果',
`next_visit_time` int(10) unsigned DEFAULT NULL COMMENT '下次回访时间',
`operator_id` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '操作人ID',
`operator_name` varchar(50) NOT NULL DEFAULT '' COMMENT '操作人名称',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(10) unsigned DEFAULT NULL COMMENT '修改时间',
`delete_time` int(10) unsigned DEFAULT NULL COMMENT '删除时间',
PRIMARY KEY (`id`),
KEY `idx_fan_id` (`fan_id`),
KEY `idx_visit_time` (`visit_time`),
KEY `idx_operator_id` (`operator_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='粉丝回访记录表';
@@ -0,0 +1,27 @@
-- 企业微信聊天记录表(关联诊单/患者,记录企业微信沟通内容)
CREATE TABLE IF NOT EXISTS `zyt_wechat_chat_record` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`diagnosis_id` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '关联诊单ID',
`patient_id` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '关联患者ID',
`staff_userid` varchar(64) NOT NULL DEFAULT '' COMMENT '企业微信成员UserId',
`staff_name` varchar(64) NOT NULL DEFAULT '' COMMENT '成员名称',
`external_userid` varchar(64) NOT NULL DEFAULT '' COMMENT '客户的企业微信external_userid',
`external_name` varchar(128) NOT NULL DEFAULT '' COMMENT '客户名称',
`msg_type` varchar(20) NOT NULL DEFAULT 'text' COMMENT '消息类型: text/image/file/link/note',
`content` text COMMENT '消息内容/摘要',
`media_url` varchar(500) NOT NULL DEFAULT '' COMMENT '媒体文件URL(图片/文件)',
`chat_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '聊天时间戳',
`direction` tinyint(1) NOT NULL DEFAULT 0 COMMENT '方向: 0=员工发出 1=客户发出',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(10) unsigned DEFAULT NULL COMMENT '修改时间',
`delete_time` int(10) unsigned DEFAULT NULL COMMENT '删除时间',
PRIMARY KEY (`id`),
KEY `idx_diagnosis_id` (`diagnosis_id`),
KEY `idx_patient_id` (`patient_id`),
KEY `idx_staff_userid` (`staff_userid`),
KEY `idx_chat_time` (`chat_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='企业微信聊天记录';
-- 给患者诊单表增加企业微信外部联系人ID(用于自动匹配)
ALTER TABLE `zyt_diagnosis`
ADD COLUMN `external_userid` varchar(64) DEFAULT '' COMMENT '企业微信外部联系人ID' AFTER `assistant_id`;