曹永思

导航

C-B-T-I-添加量表数据

Sql模板

set @hid='eec28119-78e4-4023-8f2a-98ce070f91ff';
set @gid='aa2e97fg-7bad-49c2-a993-164222b164cc';set @gaugeName='Yale-Brown强迫症状量表';set @Remark='Yale-Brown强迫症状量表';set @ScoreMultiple=1;set @now=NOW(); 

DELETE FROM `tb_gauge` WHERE GaugeGuid=@gid;DELETE FROM `tb_gauge_question` WHERE GaugeGuid=@gid;
INSERT INTO `tb_gauge` VALUES (@gid, @hid, @gaugeName, @Remark, @ScoreMultiple, '0', @now, @now);

set @qnum='001'; set @qid=CONCAT(@qnum,right(@gid,33));
INSERT INTO `tb_gauge_question` (QuestionGuid,HospitalGuid,GaugeGuid,ItemNum,ItemName) VALUES (@qid, @hid, @gid, @qnum, CONCAT(CONCAT(CAST(@qnum AS signed),'.'),N'一天之中,强迫性意念占据你多少时间?'));
set @qnum='002';set @qid=CONCAT(@qnum,right(@gid,33));
INSERT INTO `tb_gauge_question` (QuestionGuid,HospitalGuid,GaugeGuid,ItemNum,ItemName) VALUES (@qid, @hid, @gid, @qnum, CONCAT(CONCAT(CAST(@qnum AS signed),'.'),N'强迫性意念,对你日常生活或工作的影响程度?'));
set @qnum='003';  set @qid=CONCAT(@qnum,right(@gid,33));
INSERT INTO `tb_gauge_question` (QuestionGuid,HospitalGuid,GaugeGuid,ItemNum,ItemName) VALUES (@qid, @hid, @gid, @qnum, CONCAT(CONCAT(CAST(@qnum AS signed),'.'),N'强迫性意念发生时,对你造成多大的困扰?'));
set @qnum='004';  set @qid=CONCAT(@qnum,right(@gid,33));
INSERT INTO `tb_gauge_question` (QuestionGuid,HospitalGuid,GaugeGuid,ItemNum,ItemName) VALUES (@qid, @hid, @gid, @qnum, CONCAT(CONCAT(CAST(@qnum AS signed),'.'),N'强迫性意念发生时,你会花多少力气去抗拒它?'));
set @qnum='005';  set @qid=CONCAT(@qnum,right(@gid,33));
INSERT INTO `tb_gauge_question` (QuestionGuid,HospitalGuid,GaugeGuid,ItemNum,ItemName) VALUES (@qid, @hid, @gid, @qnum, CONCAT(CONCAT(CAST(@qnum AS signed),'.'),N'5.你可以控制你的强迫性意念?'));
set @qnum='006';  set @qid=CONCAT(@qnum,right(@gid,33));
INSERT INTO `tb_gauge_question` (QuestionGuid,HospitalGuid,GaugeGuid,ItemNum,ItemName) VALUES (@qid, @hid, @gid, @qnum, CONCAT(CONCAT(CAST(@qnum AS signed),'.'),N'一天之中,强迫行为占据你多少时间?'));
set @qnum='007';  set @qid=CONCAT(@qnum,right(@gid,33));
INSERT INTO `tb_gauge_question` (QuestionGuid,HospitalGuid,GaugeGuid,ItemNum,ItemName) VALUES (@qid, @hid, @gid, @qnum, CONCAT(CONCAT(CAST(@qnum AS signed),'.'),N'强迫行为,对你日常生活或工作的影响程度?'));
set @qnum='008';  set @qid=CONCAT(@qnum,right(@gid,33));
INSERT INTO `tb_gauge_question` (QuestionGuid,HospitalGuid,GaugeGuid,ItemNum,ItemName) VALUES (@qid, @hid, @gid, @qnum, CONCAT(CONCAT(CAST(@qnum AS signed),'.'),N'强迫行为发生时,对你造成多大的困扰?'));
set @qnum='009';  set @qid=CONCAT(@qnum,right(@gid,33));
INSERT INTO `tb_gauge_question` (QuestionGuid,HospitalGuid,GaugeGuid,ItemNum,ItemName) VALUES (@qid, @hid, @gid, @qnum, CONCAT(CONCAT(CAST(@qnum AS signed),'.'),N'当强迫行为发生时,你会花多少力气去抗拒它?'));
set @qnum='010';  set @qid=CONCAT(@qnum,right(@gid,33));
INSERT INTO `tb_gauge_question` (QuestionGuid,HospitalGuid,GaugeGuid,ItemNum,ItemName) VALUES (@qid, @hid, @gid, @qnum, CONCAT(CONCAT(CAST(@qnum AS signed),'.'),N'你可以控制你的强迫行为吗?'));

  
 /*SELECT * from `tb_gauge_question` WHERE QuestionGuid=@qid; */ 
set @qnum='001';  set @qid=CONCAT(@qnum,right(@gid,33));DELETE FROM `tb_gauge_answer` WHERE QuestionGuid=@qid;

set @anum='001';set @aid=CONCAT(left(@qid,33),@anum); 
INSERT INTO `tb_gauge_answer` (AnswerGuid,HospitalGuid,QuestionGuid,itemNum,itemName,itmeValue) VALUES (@aid, @hid, @qid, @anum, N'0小时',0);
set @anum='002';set @aid=CONCAT(left(@qid,33),@anum); 
INSERT INTO `tb_gauge_answer` (AnswerGuid,HospitalGuid,QuestionGuid,itemNum,itemName,itmeValue) VALUES (@aid, @hid, @qid, @anum, N'0-1小时',1);
set @anum='003';set @aid=CONCAT(left(@qid,33),@anum); 
INSERT INTO `tb_gauge_answer` (AnswerGuid,HospitalGuid,QuestionGuid,itemNum,itemName,itmeValue) VALUES (@aid, @hid, @qid, @anum, N'1-3小时',2);
set @anum='004';set @aid=CONCAT(left(@qid,33),@anum); 
INSERT INTO `tb_gauge_answer` (AnswerGuid,HospitalGuid,QuestionGuid,itemNum,itemName,itmeValue) VALUES (@aid, @hid, @qid, @anum, N'3-8小时',3);
set @anum='005';set @aid=CONCAT(left(@qid,33),@anum); 
INSERT INTO `tb_gauge_answer` (AnswerGuid,HospitalGuid,QuestionGuid,itemNum,itemName,itmeValue) VALUES (@aid, @hid, @qid, @anum, N'8小时以上',4);


set @qnum='002';  set @qid=CONCAT(@qnum,right(@gid,33));DELETE FROM `tb_gauge_answer` WHERE QuestionGuid=@qid;
set @anum='001';set @aid=CONCAT(left(@qid,33),@anum); 
INSERT INTO `tb_gauge_answer` (AnswerGuid,HospitalGuid,QuestionGuid,itemNum,itemName,itmeValue) VALUES (@aid, @hid, @qid, @anum, N'没有影响',0);
set @anum='002';set @aid=CONCAT(left(@qid,33),@anum); 
INSERT INTO `tb_gauge_answer` (AnswerGuid,HospitalGuid,QuestionGuid,itemNum,itemName,itmeValue) VALUES (@aid, @hid, @qid, @anum, N'轻微影响',1);
set @anum='003';set @aid=CONCAT(left(@qid,33),@anum); 
INSERT INTO `tb_gauge_answer` (AnswerGuid,HospitalGuid,QuestionGuid,itemNum,itemName,itmeValue) VALUES (@aid, @hid, @qid, @anum, N'中度影响',2);
set @anum='004';set @aid=CONCAT(left(@qid,33),@anum); 
INSERT INTO `tb_gauge_answer` (AnswerGuid,HospitalGuid,QuestionGuid,itemNum,itemName,itmeValue) VALUES (@aid, @hid, @qid, @anum, N'严重影响',3);
set @anum='005';set @aid=CONCAT(left(@qid,33),@anum); 
INSERT INTO `tb_gauge_answer` (AnswerGuid,HospitalGuid,QuestionGuid,itemNum,itemName,itmeValue) VALUES (@aid, @hid, @qid, @anum, N'完全无法工作/从事日常生活',4);

 
 /* SELECT * from `tb_gauge_question` WHERE QuestionGuid=@qid;  */

 

posted on 2023-11-07 17:57  曹永思  阅读(14)  评论(0编辑  收藏  举报