Files
hzdyjs/docs/设计文档/database/心理咨询预约/xljk_consultation_data_model.sql
T

100 lines
5.7 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 心理健康系统-心理咨询预约模块数据模型(xljk_consultation)
-- 所有业务表均包含以下基础字段,顺序和类型完全一致:
-- id, tenant_id, create_dept, create_by, create_time, update_by, update_time, deleted
-- 1. 咨询师表
CREATE TABLE `xljk_consultation_counselor` (
`id` bigint(20) NOT NULL COMMENT '主键ID',
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`deleted` tinyint(1) DEFAULT 0 COMMENT '删除标志(0代表存在 1代表删除)',
`name` varchar(50) NOT NULL COMMENT '咨询师姓名',
`work_no` varchar(20) NOT NULL COMMENT '工号',
`title` varchar(50) DEFAULT NULL COMMENT '职称',
`specialty` varchar(255) DEFAULT NULL COMMENT '专长领域',
`introduction` text DEFAULT NULL COMMENT '简介',
`status` char(1) NOT NULL DEFAULT '0' COMMENT '状态(0正常 1停用)',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='心理咨询预约-咨询师表';
-- 2. 预约时段表
CREATE TABLE `xljk_consultation_schedule` (
`id` bigint(20) NOT NULL COMMENT '主键ID',
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`deleted` tinyint(1) DEFAULT 0 COMMENT '删除标志(0代表存在 1代表删除)',
`counselor_id` bigint(20) NOT NULL COMMENT '咨询师ID',
`schedule_date` date NOT NULL COMMENT '排班日期',
`time_slot` char(1) NOT NULL COMMENT '时段类型(0上午 1下午)',
`start_time` varchar(5) NOT NULL COMMENT '开始时间(HH:mm)',
`end_time` varchar(5) NOT NULL COMMENT '结束时间(HH:mm)',
`status` char(1) NOT NULL DEFAULT '0' COMMENT '状态(0正常 1停用)',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='心理咨询预约-预约时段表';
-- 3. 预约记录表
CREATE TABLE `xljk_consultation_appointment` (
`id` bigint(20) NOT NULL COMMENT '主键ID',
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`deleted` tinyint(1) DEFAULT 0 COMMENT '删除标志(0代表存在 1代表删除)',
`student_id` bigint(20) NOT NULL COMMENT '学生ID',
`counselor_id` bigint(20) NOT NULL COMMENT '咨询师ID',
`schedule_id` bigint(20) NOT NULL COMMENT '预约时段ID',
`appointment_date` date NOT NULL COMMENT '预约日期',
`appointment_time` varchar(20) NOT NULL COMMENT '预约时间段',
`reason` varchar(500) DEFAULT NULL COMMENT '咨询原因',
`status` char(1) NOT NULL DEFAULT '0' COMMENT '状态(0待咨询 1已完成 2已取消 3未到访)',
`actual_visit_time` datetime DEFAULT NULL COMMENT '实际到访时间',
`communication_duration` int DEFAULT NULL COMMENT '沟通时长(分钟)',
`consultation_content` text DEFAULT NULL COMMENT '咨询内容',
`counselor_suggestion` text DEFAULT NULL COMMENT '咨询师建议',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='心理咨询预约-预约记录表';
-- 4. 咨询记录表
CREATE TABLE `xljk_consultation_record` (
`id` bigint(20) NOT NULL COMMENT '主键ID',
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`deleted` tinyint(1) DEFAULT 0 COMMENT '删除标志(0代表存在 1代表删除)',
`appointment_id` bigint(20) NOT NULL COMMENT '预约记录ID',
`visit_status` char(1) NOT NULL DEFAULT '0' COMMENT '到访情况(0正常到访 1未到访)',
`duration` int(11) DEFAULT 0 COMMENT '沟通时长(分钟)',
`content` text DEFAULT NULL COMMENT '咨询内容',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='心理咨询预约-咨询记录表';
-- 5. 未到访记录表
CREATE TABLE `xljk_consultation_no_show` (
`id` bigint(20) NOT NULL COMMENT '主键ID',
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`deleted` tinyint(1) DEFAULT 0 COMMENT '删除标志(0代表存在 1代表删除)',
`student_id` bigint(20) NOT NULL COMMENT '学生ID',
`appointment_id` bigint(20) NOT NULL COMMENT '预约记录ID',
`no_show_date` date NOT NULL COMMENT '未到访日期',
`expire_date` date NOT NULL COMMENT '限制到期日',
`status` char(1) NOT NULL DEFAULT '0' COMMENT '状态(0生效中 1已过期 2已解除)',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='心理咨询预约-未到访记录表';