|
@@ -286,6 +286,8 @@ export default {
|
|
|
timeoutDes: "",
|
|
|
//获取下一题问题的编号
|
|
|
preQuestion: "",
|
|
|
+ oNum: 1,
|
|
|
+ currentId: "",
|
|
|
};
|
|
|
},
|
|
|
created() {},
|
|
@@ -299,7 +301,6 @@ export default {
|
|
|
scrollview.addEventListener("scroll", this.handleScroll, true);
|
|
|
|
|
|
//先调用接口知道是否出来弹窗
|
|
|
-
|
|
|
this.selectPage();
|
|
|
|
|
|
//判断是否是第一次进来,如果查询记录为空,则是第一次进来--则需要调用出初始化语句
|
|
@@ -341,7 +342,12 @@ export default {
|
|
|
userName: sessionStorage.getItem("name"),
|
|
|
questionNo: val.questionNo,
|
|
|
type: this.interveneId,
|
|
|
+ num: this.oNum,
|
|
|
};
|
|
|
+ if (val.content && val.content.includes("测评结果")) {
|
|
|
+ let result = sessionStorage.getItem("testResults");
|
|
|
+ data.content = val.content + result;
|
|
|
+ }
|
|
|
console.log(data);
|
|
|
// this.$message.success("保存成功");
|
|
|
this.$http.post(`/intelligent/save`, data, (res) => {
|
|
@@ -386,6 +392,7 @@ export default {
|
|
|
if (res.data.intelligentDialogueEntities.content.length > 0) {
|
|
|
that.currenRecordTotol =
|
|
|
res.data.intelligentDialogueEntities.content.length;
|
|
|
+ this.oNum = res.data.intelligentDialogueEntities.content[0].num;
|
|
|
//判断当前是第几页
|
|
|
//如果是第一个
|
|
|
for (
|
|
@@ -446,11 +453,12 @@ export default {
|
|
|
contant1.scrollTop = 2;
|
|
|
});
|
|
|
console.log(this.chatContents);
|
|
|
+ } else {
|
|
|
+ this.oNum = 1;
|
|
|
}
|
|
|
|
|
|
//如满足条件//应还有一个参数--用来表示是否需要显示提示几天不见的话语
|
|
|
if (that.isTimeout) {
|
|
|
- debugger;
|
|
|
that.chatContents.push({
|
|
|
//是问题还是答案
|
|
|
from: 1,
|
|
@@ -573,6 +581,7 @@ export default {
|
|
|
userName: sessionStorage.getItem("name"),
|
|
|
label: this.interveneId,
|
|
|
identifier: sessionStorage.getItem("num"),
|
|
|
+ num: this.oNum,
|
|
|
},
|
|
|
(res) => {
|
|
|
if (res.data.code == 200) {
|
|
@@ -671,9 +680,10 @@ export default {
|
|
|
}
|
|
|
|
|
|
this.$http.get(
|
|
|
- `chat/getQuestion/${this.interveneId}`,
|
|
|
+ `chat/getQuestion/${that.interveneId}`,
|
|
|
{
|
|
|
id: id,
|
|
|
+ num: this.oNum,
|
|
|
},
|
|
|
(res) => {
|
|
|
if (res.code == "200") {
|
|
@@ -684,11 +694,22 @@ export default {
|
|
|
}
|
|
|
let result = res.data;
|
|
|
if (result == null) {
|
|
|
- //将结束对话
|
|
|
- // console.log(this.chatContents)
|
|
|
- // this.saveChat();
|
|
|
+ this.oNum = this.oNum < 5 ? ++this.oNum : 1;
|
|
|
+ this.getQuestion(1, true);
|
|
|
return;
|
|
|
}
|
|
|
+ if (result.num) {
|
|
|
+ that.oNum = result.num;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (result.question && result.question.includes("测评结果")) {
|
|
|
+ let str = sessionStorage.getItem("testResults");
|
|
|
+ result.question = str;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (result.id) {
|
|
|
+ that.currentId = result.id;
|
|
|
+ }
|
|
|
// 将本次问题加入对话
|
|
|
this.chatContents.push({
|
|
|
//是问题还是答案
|
|
@@ -833,6 +854,8 @@ export default {
|
|
|
// 下一题为量表,查询量表内容
|
|
|
this.flag = result.nextQuestionNo.split("-")[1];
|
|
|
this.getScaleInfo(this.flag);
|
|
|
+ // this.flag = "20210617121646";
|
|
|
+ // this.getScaleInfo("20210617121646");
|
|
|
} else {
|
|
|
// 下一题非量表,继续查询下一题
|
|
|
this.getQuestion(result.nextQuestionNo, true);
|
|
@@ -848,45 +871,51 @@ export default {
|
|
|
},
|
|
|
// 获取答案
|
|
|
getAnswer(id) {
|
|
|
- this.$http.get(`chat/getAnswer/${id}/${this.interveneId}`, {}, (res) => {
|
|
|
- if (res.code == "200") {
|
|
|
- if (res.data.length > 0) {
|
|
|
- let result = res.data;
|
|
|
- if (parseInt(result[0].questionType) == 1) {
|
|
|
- this.chatContents.push({
|
|
|
- id: result[0].id,
|
|
|
- from: 2,
|
|
|
- isScale: false,
|
|
|
- //是单选还是文字 0单选 1填空 -1描述
|
|
|
- isType: parseInt(result[0].questionType),
|
|
|
- disabled: false,
|
|
|
- question: result,
|
|
|
- from1: HeadImg,
|
|
|
- radio: false,
|
|
|
- text: "",
|
|
|
+ this.$http.get(
|
|
|
+ `chat/getAnswer/${id}/${this.interveneId}/${this.oNum}`,
|
|
|
+ {},
|
|
|
+ (res) => {
|
|
|
+ if (res.code == "200") {
|
|
|
+ if (res.data.length > 0) {
|
|
|
+ let result = res.data;
|
|
|
+ if (parseInt(result[0].questionType) == 1) {
|
|
|
+ this.chatContents.push({
|
|
|
+ id: result[0].id,
|
|
|
+ from: 2,
|
|
|
+ isScale: false,
|
|
|
+ //是单选还是文字 0单选 1填空 -1描述
|
|
|
+ isType: parseInt(result[0].questionType),
|
|
|
+ disabled: false,
|
|
|
+ question: result,
|
|
|
+ from1: HeadImg,
|
|
|
+ radio: false,
|
|
|
+ text: "",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.chatContents.push({
|
|
|
+ from: 2,
|
|
|
+ isScale: false,
|
|
|
+ //是单选还是文字 0单选 1填空 -1描述
|
|
|
+ isType: parseInt(result[0].questionType),
|
|
|
+ disabled: false,
|
|
|
+ question: result,
|
|
|
+ from1: HeadImg,
|
|
|
+ radio: false,
|
|
|
+ text: "",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ let contant1 = document.getElementById("contant1");
|
|
|
+ this.sleep(101).then(() => {
|
|
|
+ contant1.scrollTop = contant1.scrollHeight;
|
|
|
});
|
|
|
} else {
|
|
|
- this.chatContents.push({
|
|
|
- from: 2,
|
|
|
- isScale: false,
|
|
|
- //是单选还是文字 0单选 1填空 -1描述
|
|
|
- isType: parseInt(result[0].questionType),
|
|
|
- disabled: false,
|
|
|
- question: result,
|
|
|
- from1: HeadImg,
|
|
|
- radio: false,
|
|
|
- text: "",
|
|
|
- });
|
|
|
+ this.oNum = this.oNum < 5 ? ++this.oNum : 1;
|
|
|
+ this.getQuestion(1, true);
|
|
|
+ // this.saveChat();
|
|
|
}
|
|
|
- let contant1 = document.getElementById("contant1");
|
|
|
- this.sleep(101).then(() => {
|
|
|
- contant1.scrollTop = contant1.scrollHeight;
|
|
|
- });
|
|
|
- } else {
|
|
|
- // this.saveChat();
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ );
|
|
|
},
|
|
|
|
|
|
// 获取量表信息
|
|
@@ -1114,6 +1143,10 @@ export default {
|
|
|
let testResult = JSON.parse(
|
|
|
res.data.data.userRecordEntity.testResult
|
|
|
);
|
|
|
+ sessionStorage.setItem(
|
|
|
+ "testResults",
|
|
|
+ res.data.data.userRecordEntity.testResults
|
|
|
+ );
|
|
|
// console.log(res.data.data.userRecordEntity.testResults);
|
|
|
// console.log(testResult);
|
|
|
if (this.interveneId == 1) {
|
|
@@ -1131,9 +1164,9 @@ export default {
|
|
|
contant1.scrollTop = contant1.scrollHeight;
|
|
|
});
|
|
|
} else if (score < 70) {
|
|
|
- this.getNext("轻度焦虑或中度焦虑");
|
|
|
+ this.getNext(this.currentId);
|
|
|
} else {
|
|
|
- this.getNext("重度焦虑");
|
|
|
+ this.getNext(this.currentId);
|
|
|
}
|
|
|
} else if (this.interveneId == 2) {
|
|
|
let score = Number(testResult[0].newTableContext.result[0].score);
|
|
@@ -1150,9 +1183,9 @@ export default {
|
|
|
contant1.scrollTop = contant1.scrollHeight;
|
|
|
});
|
|
|
} else if (score < 19) {
|
|
|
- this.getNext("轻度抑郁或有抑郁症状");
|
|
|
+ this.getNext(this.currentId);
|
|
|
} else {
|
|
|
- this.getNext("重度抑郁");
|
|
|
+ this.getNext(this.currentId);
|
|
|
}
|
|
|
} else if (this.interveneId == 3) {
|
|
|
this.chatContents.push({
|
|
@@ -1179,7 +1212,7 @@ export default {
|
|
|
|
|
|
getNext(result) {
|
|
|
this.$http.get(
|
|
|
- `chat/getNextQuestionByScaleResult?label=${this.interveneId}&result=${result}`,
|
|
|
+ `chat/getNextQuestionByScaleResult?label=${this.interveneId}&result=${result}&num=${this.oNum}`,
|
|
|
{},
|
|
|
(res) => {
|
|
|
if (res.code == 200) {
|
|
@@ -1433,7 +1466,6 @@ export default {
|
|
|
_this.scaleSelectFlag = true;
|
|
|
if (res.data.code == 200 && res.data.data) {
|
|
|
_this.resultJsonParams = res.data.data;
|
|
|
-
|
|
|
let testResult = JSON.parse(
|
|
|
res.data.data.userRecordEntity.testResult
|
|
|
)[0].version;
|