You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virtual-patient/docker/v3.0.0/step1.sql

94 lines
5.1 KiB
SQL

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

-- 创建详细问表
use virtual_patient;
create table vp_ask_template_question_similarity
(
id varchar(64) not null comment '主键'
primary key,
library_id varchar(64) not null comment '标准问题ID',
similarity_question varchar(255) not null comment '相似问题',
create_user_id varchar(64) null comment '创建人ID',
create_time datetime default CURRENT_TIMESTAMP null comment '创建时间',
update_user_id varchar(64) null comment '更新人ID',
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间'
) comment '相似问问题库' charset = utf8;
-- 病历表中增加字段
alter table vp_medical_rec
add medical_record_ai text null comment '完整的病例信息,以提交大模型进行问答';
-- 修改标准问表,移除默认回复
alter table vp_ask_template_question_library
drop column default_answer_code;
alter table vp_ask_template_question_library
drop column default_answer;
alter table vp_ask_template_question_library
drop column default_answer_resource_id;
-- 修改问题记录表结构
alter table vp_diagnosis_qa_record
add match_type int not null default 1 comment '匹配类型 1相似度匹配 2大模型回答' after process_id;
alter table vp_diagnosis_qa_record
modify question_library_id varchar(64) null comment '问题ID(如果走了相似问,则记录匹配到的问题ID)';
alter table vp_diagnosis_qa_record
drop column question_wav_id;
alter table vp_diagnosis_qa_record
drop column answer_type;
alter table vp_diagnosis_qa_record
drop column answer_wav_id;
create table vp_ask_circulation_detail
(
id varchar(64) not null comment '主键'
primary key,
process_id varchar(64) null comment '诊断进程ID',
medical_id varchar(64) null comment '病历ID',
record_id varchar(64) null comment '问话记录ID',
circulation_no int null comment '流转序号,消息每经过一次处理,就+1',
question varchar(255) null comment '问题内容',
answer varchar(255) null comment '回答内容',
success_info varchar(255) null comment '成功的记录信息',
success_type int null comment '成功回答的类型 1相似度 2大模型',
fail_info text null comment '失败记录信息',
similarity_info text null comment '相似度匹配信息的JSON',
match_item varchar(64) null comment '匹配到的类目名称',
match_question varchar(255) null comment '相似度匹配 匹配到的问题',
match_score double null comment '如走相似度匹配,记录得分',
match_library_id varchar(64) null comment '如相似度匹配的是标准问ID,则保存',
match_similarity_id varchar(64) null comment '如果匹配到详细问ID则记录',
ai_medical_context text null comment '走大模型时,大模型的病例内容',
remark varchar(255) null comment '备注',
create_user_id varchar(64) null comment '创建人ID',
create_time datetime default CURRENT_TIMESTAMP null comment '创建时间',
update_user_id varchar(64) null comment '更新人ID',
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新人时间'
) comment '问诊流程详细流转记录表' charset = utf8;
alter table vp_ask_template_question_library
change description standard_question varchar(255) null comment '中文注释 用户设置的问题 原本字段是description';
alter table vp_diagnosis_qa_record
add feedback_too_long int default 0 null comment '回答过于冗长,选中为1';
alter table vp_diagnosis_qa_record
add feedback_error int default 0 null comment '答非所问 选中为1';
alter table vp_diagnosis_qa_record
add feedback_too_short int default 0 null comment '回答过于简洁 选中为1';
alter table vp_diagnosis_qa_record
add feedback_type int not null default 1 comment '反馈类型(1合理 2不合理) 默认为合理';
alter table vp_process
add evaluate_level int null comment '评价级别 1可靠 2基本可靠 3仅供参考';
alter table vp_process
add evaluate_remark varchar(1024) null comment '评价备注内容';
alter table vp_medical_rec
add status integer default 1 null comment '上线状态 1未上线 2已经上线 状态为未上线且病历未出现在vp_process表中使用可以进行删除' after medical_record_ai;