Browse Source

认知行为干预

root 1 year ago
parent
commit
97406cccc1

+ 6 - 2
src/renderer/components/intervene.vue

@@ -2,7 +2,7 @@
   <div class="main_right_height">
     <TopDes :flag="false" topDesFont="认知行为干预"></TopDes>
     <div class="intervene_content">
-      <div class="intervene_item" v-for="item in interveneList" :key="item.id">
+      <div class="intervene_item" v-for="item in interveneList" :key="item.id" @click="goDetail(item)">
         <img :src="item.imgUrl" alt="" />
         <h2>{{ item.name }}</h2>
         <p style="font-size: 1vw">{{ item.title }}</p>
@@ -11,7 +11,7 @@
     </div>
   </div>
 </template>
-  <script>
+<script>
 import * as echarts from "echarts";
 const { ipcRenderer } = require("electron");
 var chartDom;
@@ -113,6 +113,7 @@ export default {
           name: "走出抑郁",
           title: "重新点燃生活的希望",
           desc: "焦虑、惊恐、恐惧的情绪,社交焦虑,各种心理、身体原因引起的焦虑状态。",
+          url: '/treatDepression'
         },
         {
           id: 2,
@@ -1006,6 +1007,9 @@ export default {
       };
       chartDom.setOption(option);
     },
+    goDetail(item) {
+      this.$router.push('/menu/treatDepression')
+    }
   },
 };
 </script>

+ 1197 - 0
src/renderer/components/treatDepression.vue

@@ -0,0 +1,1197 @@
+<template>
+  <div class="main_right_height">
+    <div class="smart_content">
+      <el-row>
+        <el-col :span="1">&nbsp;</el-col>
+        <el-col :span="22">
+          <div class="chat-window" id="contant1">
+            <div
+              class="chat-msg-content"
+              id="rongqi"
+              v-for="content in chatContents"
+              :key="content.index"
+            >
+              <div
+                v-if="content.from == 1"
+                :key="content.id"
+                class="main_answer_right"
+                style="margin-top: 10px"
+              >
+                <div class="img-wrapper">
+                  <img width="60px" heigth="60px" class="img" :src="from1" />
+                </div>
+                <div class="message-wrapper message-wrapper-left">
+                  <div class="message" v-if="content.isScale">
+                    <el-radio-group
+                      v-model="answerList[content.index].answer"
+                      @input="nextHandle(content.index)"
+                      :disabled="content.disabled"
+                    >
+                      <el-radio
+                        v-for="(item, index) in content.question"
+                        :key="index"
+                        size="small"
+                        :label="item"
+                        border
+                        >{{ item }}</el-radio
+                      >
+                    </el-radio-group>
+                  </div>
+                  <div class="message" v-else>{{ content.question }}</div>
+                </div>
+              </div>
+              <el-row v-else style="margin-top: 10px">
+                <el-col :span="10"> &nbsp; </el-col>
+                <el-col :span="14">
+                  <div class="main_answer_left" style="float: right">
+                    <div class="message-wrapper message-wrapper-right">
+                      <el-radio-group
+                        v-model="content.radio"
+                        :disabled="content.disabled"
+                        @input="chooseAnswer"
+                      >
+                        <el-radio
+                          v-for="item in content.question"
+                          :key="item.id"
+                          size="small"
+                          :label="item.nextQuestionNo"
+                          border
+                          >{{ item.answer }}</el-radio
+                        >
+                      </el-radio-group>
+                    </div>
+                    <div class="img-wrapper">
+                      <img
+                        width="60px"
+                        heigth="60px"
+                        class="img"
+                        :src="from2"
+                      />
+                    </div>
+                  </div>
+                </el-col>
+              </el-row>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="1">&nbsp;</el-col>
+      </el-row>
+      <el-row v-show="inputFlag === 2" class="footSendSelect">
+        <el-col :span="1"> &nbsp; </el-col>
+        <el-col :span="22" style="margin-top: 20px; margin-bottom: 20px">
+          <div>
+            <el-radio
+              style="margin-top: 10px"
+              v-for="(item, index) in scale_checkItems"
+              :key="index"
+              v-model="radio"
+              :label="item"
+              fill="#57ACBB"
+              @change="selectRadio(item)"
+              >{{ item }}</el-radio
+            >
+          </div></el-col
+        >
+        <el-col :span="1"> &nbsp; </el-col>
+      </el-row>
+      <el-row v-show="inputFlag === 3" class="footSendSelect">
+        <el-col :span="1"> &nbsp; </el-col>
+        <el-col :span="22" style="margin-top: 20px; margin-bottom: 20px">
+          <div>
+            <el-radio
+              :disabled="!scaleSelectFlag"
+              style="margin-top: 10px"
+              v-for="(item, index) in scale_checkItems"
+              :key="index"
+              v-model="radio"
+              :label="item"
+              fill="#57ACBB"
+              @change="choiceTriger(item)"
+              >{{ item }}</el-radio
+            >
+          </div></el-col
+        >
+        <el-col :span="1"> &nbsp; </el-col>
+      </el-row>
+    </div>
+  </div>
+</template>
+  <script>
+import HeadImg from "@/assets/lion.png";
+import HeadImg1 from "@/assets/newImage/peopleUser.png";
+import axios from "axios";
+export default {
+  data() {
+    return {
+      tmpRadio: "",
+      radio: "",
+      inputFlag: 1,
+      desc: "",
+      from1: HeadImg,
+      from2: HeadImg1,
+      chatContents: [],
+      //前三个问题
+      preList: [],
+      questionList: [],
+      answerList: [],
+      //随机的4个数集合
+      radomNumList: [],
+      questionNum: 0,
+
+      //随机4个问题的集合
+      randomQuestion: [],
+      //随机4个答案的集合
+      randomAnswer: [],
+      //全部题目
+      scale_infos: [{ answer: "" }],
+      //题目总数
+      scale_all: 0,
+      scale_checkItems: [],
+      //进度参数
+      scale_percent: [],
+      //
+      scale_index: 0,
+      // 答案数据
+      scale_result: [],
+
+      //检测情绪前的发送数据条数
+      threeAnswers: [],
+
+      //负面情绪标志
+      moonNegative: 0,
+      scale_flag: "",
+      pressure_flag: "",
+      sendMsgFlag: true,
+      scaleSelectFlag: true,
+      radio3: "",
+      scaleTestStart: false,
+      flag: "",
+      questionList: [],
+      answerList: [],
+    };
+  },
+  created() {},
+  mounted() {
+    this.init("start");
+    // this.selectScale("20220805135201");
+  },
+  methods: {
+    init(val) {
+      this.getQuestion();
+      let contant1 = document.getElementById("contant1");
+      this.sleep(101).then(() => {
+        contant1.scrollTop = contant1.scrollHeight;
+      });
+    },
+
+    // 获取问题
+    getQuestion(id) {
+      this.$http.get(
+        "chat/getQuestion/2",
+        {
+          id: id,
+        },
+        (res) => {
+          if (res.code == "200") {
+            let result = res.data;
+            // 将本次问题加入对话
+            this.chatContents.push({
+              from: 1,
+              isScale: false,
+              disabled: false,
+              question: result.question,
+              from1: HeadImg,
+            });
+            let contant1 = document.getElementById("contant1");
+            this.sleep(101).then(() => {
+              contant1.scrollTop = contant1.scrollHeight;
+            });
+            if (!result.nextQuestionNo) {
+              // 无下一题,查询答案
+              this.getAnswer(result.id);
+            } else if (/flag/g.test(result.nextQuestionNo)) {
+              // 下一题为量表,查询量表内容
+              this.flag = result.nextQuestionNo.split("-")[1];
+              this.getScaleInfo(this.flag);
+            } else {
+              // 下一题非量表,继续查询下一题
+              this.getQuestion(result.nextQuestionNo);
+            }
+          }
+        }
+      );
+    },
+
+    // 获取答案
+    getAnswer(id) {
+      this.$http.get(`chat/getAnswer/${id}/2`, {}, (res) => {
+        if (res.code == "200" && res.data.length > 0) {
+          let result = res.data;
+          this.chatContents.push({
+            from: 2,
+            isScale: false,
+            disabled: false,
+            question: result,
+            from1: HeadImg,
+            radio: ''
+          });
+          let contant1 = document.getElementById("contant1");
+          this.sleep(101).then(() => {
+            contant1.scrollTop = contant1.scrollHeight;
+          });
+        }
+      });
+    },
+
+    // 获取量表信息
+    getScaleInfo(flag) {
+      this.$http.get(`v1/scale/${flag}`, {}, (res) => {
+        let data = res.data;
+        let anwserListx = [];
+        for (var i = 0; i < data.length; i++) {
+          anwserListx.push({
+            answer: data[i].answer,
+            checkItems: data[i].checkItems,
+            flag: data[i].flag,
+            id: data[i].id,
+            questionNo: data[i].questionNo,
+            questionType: data[i].questionType,
+            score: data[i].score,
+            scoreDirection: data[i].scoreDirection,
+            serialNo: data[i].serialNo,
+            weight: data[i].weight,
+          });
+        }
+        this.questionList = res.data;
+        this.answerList = anwserListx;
+        this.scaleTestStart = true;
+        let checkItems = data[0].checkItems;
+        this.chatContents.push({
+          index: 0,
+          from: 1,
+          disabled: false,
+          isScale: true,
+          question: checkItems.split(";"),
+          from1: HeadImg,
+        });
+      });
+    },
+
+    // 选择答案
+    chooseAnswer(id) {
+      this.getQuestion(id);
+    },
+
+    // 量表选中切换下一题
+    nextHandle(i) {
+      this.chatContents[i].disabled = true;
+      if (i < this.questionList.length - 1) {
+        i = i + 1;
+        let checkItems = this.questionList[i].checkItems;
+        this.chatContents.push({
+          index: i,
+          from: 1,
+          isScale: true,
+          question: checkItems.split(";"),
+          from1: HeadImg,
+        });
+        let contant1 = document.getElementById("contant1");
+        this.sleep(101).then(() => {
+          contant1.scrollTop = contant1.scrollHeight;
+        });
+      } else {
+        this.getScaleResult(this.flag);
+      }
+    },
+
+    // 提交测试结果
+    getScaleResult(flag) {
+      this.$http.post(
+        `v1/result/${flag}`,
+        {
+          scale_result: this.answerList,
+          identifier: sessionStorage.getItem("num"),
+        },
+        (res) => {
+          if (res.data.code == 200) {
+            this.resultQuery(res.data.data);
+          } else {
+            that.$message.error("访问服务器失败!");
+          }
+        }
+      );
+    },
+
+    // 查询测试结果
+    resultQuery(id) {
+      this.$http.post(`v1/record/find/${id}`, {}, (res) => {
+        if (res.data.code == 200 && res.data.data) {
+          this.resultJsonParams = res.data.data;
+          let testResult = JSON.parse(
+            res.data.data.userRecordEntity.testResult
+          );
+          let score = Number(testResult[0].newTableContext.result[0].score);
+          //   if (score < 10) {
+          //     this.chatContents.push({
+          //       index: 0,
+          //       from: 1,
+          //       isScale: false,
+          //       question: "根据测试,你很健康,无抑郁表现",
+          //       from1: HeadImg,
+          //     });
+          //   } else if (score < 19) {
+          //     this.getNext("轻度抑郁或有抑郁症状");
+          //   } else {
+          //     this.getNext("重度抑郁");
+          //   }
+          this.getNext("轻度抑郁或有抑郁症状");
+        }
+      });
+    },
+
+    getNext(result) {
+      this.$http.get(
+        `chat/getNextQuestionByScaleResult?label=2&result=${result}`,{},
+        (res) => {
+            if(res.code == 200) {
+                if(res.data && res.data.nextQuestionNo) {
+                    this.getQuestion(res.data.nextQuestionNo);
+                }
+            }
+        }
+      );
+    },
+
+    sleep(time) {
+      return new Promise((resolve) => setTimeout(resolve, time));
+    },
+
+    sendMsg() {
+      this.sendMsgFlag = false;
+      let contant1 = document.getElementById("contant1");
+      let tmp = {
+        from: 2,
+        isScale: false,
+        answer: this.desc,
+        from1: HeadImg,
+      };
+      this.chatContents.push(tmp);
+      // 让滚动条始终在最底部
+      this.sleep(101).then(() => {
+        contant1.scrollTop = contant1.scrollHeight;
+      });
+
+      //第一个问题出来后先对答案进行解析
+      this.selectMood(this.desc);
+      this.desc = "";
+    },
+    //调用接口查询情绪
+    selectMood(val) {
+      // this.sendMsgFlag=true;
+      let that = this;
+      axios
+        .post(`http://127.0.0.1:9999/sentiment`, { text: val })
+        .then((res) => {
+          that.sendMsgFlag = true;
+          that.threeAnswers.push(res.data.sentiment);
+          //是否问问题的标志
+          //当答案小于3时需要接着提问
+          if (that.threeAnswers.length < 3) {
+            that.askQuestions();
+          } else if (that.threeAnswers.length === 3) {
+            //当等于3时需要判断是否接着提问
+            //当负面情绪小于2时则终止询问
+            //当负面情绪大于等于2时需要再次提问
+            that.judgeMood(2);
+          } else if (that.threeAnswers.length === 4) {
+            //当问题等于4时再次询问
+            that.askQuestions();
+          } else if (that.threeAnswers.length === 5) {
+            //调用判断结果负面情绪是否大于等于3
+            that.judgeMood(3);
+          }
+
+          //当回答的答案大于等于3时判断是否结束,当负面情绪大于等于2时
+          // that.judgeMood();
+        });
+    },
+    //当回答的答案大于等于3时判断是否结束,当负面情绪大于等于2时
+    judgeMood(val) {
+      this.moonNegative = 0;
+      for (let i = 0; i < this.threeAnswers.length; i++) {
+        if (
+          this.threeAnswers[i] === "厌恶" ||
+          this.threeAnswers[i] === "恐惧" ||
+          this.threeAnswers[i] === "悲伤" ||
+          this.threeAnswers[i] === "愤怒"
+        ) {
+          this.moonNegative += 1;
+        }
+      }
+      if (this.moonNegative >= val) {
+        if (val === 2) {
+          //需要再拿根据情绪生成两个数据
+          //如果是2个负面
+          //循环情绪得到判断哪一个是负面情绪
+
+          for (let j = 0; j < this.threeAnswers.length; j++) {
+            if (
+              this.threeAnswers[j] === "厌恶" ||
+              this.threeAnswers[j] === "恐惧" ||
+              this.threeAnswers[j] === "悲伤" ||
+              this.threeAnswers[j] === "愤怒"
+            ) {
+              //调用方法进行测试
+              this.afterListFun(this.preList[j].type);
+            }
+          }
+
+          this.askQuestions();
+        } else {
+          console.log("需要进行选择提");
+          this.inputFlag = 2;
+          //进行提问
+          this.chatContents.push({
+            from: 1,
+            isScale: false,
+            question: "请问您近期是否存在以下方面的困扰(请选择)",
+            from1: HeadImg,
+          });
+          this.scale_checkItems = ["抑郁", "焦虑", "压力", "睡眠问题", "无"];
+        }
+      } else {
+        //发送一条信息说你的心理状态良好
+        this.askEnd("您的心理状态良好请继续保持!");
+        this.inputFlag = 0;
+      }
+    },
+    selectRadio(val) {
+      this.answerSelect(val);
+
+      if (val === "无") {
+        this.askEnd("您可能存在心理健康方面问题,建议寻求专业人员的指导");
+        this.inputFlag = 0;
+        //隐藏选项框和输入框进行提示
+      } else if (val === "睡眠问题") {
+        this.inputFlag = 3;
+        this.askEnd(
+          "为了进一步判断您是否存在睡眠方面的问题,下面我会问您一些问题,请您选择作答"
+        );
+        // this.askEnd("睡眠问卷");
+        this.scale_checkItems = ["好的"];
+        this.inputFlag = 2;
+        this.scale_flag = "20210910163158";
+        // this.selectScale(this.scale_flag);
+        //调用接口睡眠量表
+      } else if (val === "抑郁" || val === "焦虑" || val === "压力") {
+        if (val === "抑郁") {
+          this.pressure_flag = "抑郁";
+        }
+        if (val === "焦虑") {
+          this.pressure_flag = "焦虑";
+        }
+        if (val === "压力") {
+          this.pressure_flag = "压力";
+        }
+        this.inputFlag = 3;
+        this.askEnd(
+          "为了进一步判断您是否存在心理健康方面的问题,下面我会问您一些问题,请您选择作答"
+        );
+        // this.askEnd("抑郁、焦虑、压力问卷");
+        this.scale_checkItems = ["好的"];
+        this.inputFlag = 2;
+        this.scale_flag = "20220805135201";
+        // this.selectScale(this.scale_flag);
+        //调用接口抑郁焦虑压力问卷
+      } else if (val === "好的") {
+        this.inputFlag = 3;
+        // if(this.scale_flag==='20210910163158'){
+
+        // }
+        this.selectScale(this.scale_flag);
+      } else if (val === "是") {
+        //从头开始
+        this.init("reStart");
+        this.inputFlag = 1;
+      } else if (val === "否") {
+        //结束测试
+        this.askEnd("对话结束");
+        this.inputFlag = 0;
+      }
+    },
+    choiceTriger(item) {
+      let that = this;
+      that.radioChange(item);
+    },
+    // 选中选项
+    radioChange(item) {
+      this.tmpRadio = item;
+      var scaleInfoTemp = Object.assign({}, this.scale_infos[this.scale_index]);
+      this.radio = "";
+      scaleInfoTemp.checkItems = item;
+      this.scale_result.push(scaleInfoTemp);
+      // bbc测试判断是否展示20~24题
+      if (
+        item != "是" &&
+        this.scale_flag == "20211101163739" &&
+        this.scale_index == 19
+      ) {
+        this.scale_index = 24;
+        for (let i = 20; i < 24; i++) {
+          this.scale_result.push(this.scale_infos[i]);
+        }
+        this.scale_checkItems =
+          this.scale_infos[this.scale_index].checkItems.split(";");
+        return;
+      }
+      //如果是单选题
+
+      if (scaleInfoTemp.questionType == "0") {
+        if (this.scale_index <= this.scale_infos.length - 1)
+          this.scale_index += 1;
+        this.answerSelect(this.tmpRadio);
+        //scale_index == 题目总数,表示结束
+        if (this.scale_index == this.scale_infos.length) {
+          this.scale_index -= 1;
+          this.scaleSelectFlag = false;
+
+          //发送测试结果给后台
+          // this.$message({
+          //   message: "测试完成,即将生成测试报告!",
+          //   type: "success",
+          // });
+
+          // console.log("==--3--------->", this.testPlanId);
+          console.log(
+            "==---4-------->",
+            sessionStorage.getItem("b80bb7740288fda1f201890375a60c8f")
+          );
+          this.$http.post(
+            `v1/result/${this.scale_flag}`,
+            {
+              scale_result: this.scale_result,
+
+              identifier: sessionStorage.getItem("num"),
+            },
+            (res) => {
+              this.next_and_last_button = false;
+
+              if (res.data.code == 200) {
+                this.resultJson = res.data.data;
+
+                if (this.scale_flag == "20210725100704") {
+                } else {
+                  this.getAnswerQuestionPaymentSuccess(this.resultJson);
+                }
+              } else {
+                this.$message.error("访问服务器失败!");
+              }
+            }
+          );
+        } else {
+          // 我觉得很难让自己安静下来
+
+          this.askEnd(this.scale_infos[this.scale_index].answer);
+          this.scale_checkItems =
+            this.scale_infos[this.scale_index].checkItems.split(";");
+        }
+      }
+    },
+
+    getAnswerQuestionPaymentSuccess(id) {
+      // sessionStorage.setItem("back_page", "1");
+      let _this = this;
+      _this.$http.post(`v1/record/find/${id}`, {}, (res) => {
+        _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;
+
+          if (_this.scale_flag === "20210910163158") {
+            let sleep = JSON.parse(
+              _this.resultJsonParams.userRecordEntity.testResult
+            );
+            sleep = sleep[0].newTableContext.result[0].improvementSuggestions;
+            _this.askEnd(sleep);
+            _this.askEnd("您还想跟我再聊一聊吗?");
+            this.scale_checkItems = ["是", "否"];
+            this.inputFlag = 2;
+          }
+
+          if (_this.scale_flag === "20220805135201") {
+            let sleep = JSON.parse(
+              _this.resultJsonParams.userRecordEntity.testResult
+            );
+            sleep = sleep[0].tableContext;
+            let str = "";
+            for (let i = 0; i < sleep.length; i++) {
+              if (_this.pressure_flag === "压力") {
+                if (sleep[i].name === "压力指导语") {
+                  str = "压力建议:" + sleep[i].value[0] + " ";
+                }
+              }
+              if (_this.pressure_flag === "焦虑") {
+                if (sleep[i].name === "焦虑指导语") {
+                  str = "焦虑建议:" + sleep[i].value[0] + " ";
+                }
+              }
+              if (_this.pressure_flag === "抑郁") {
+                if (sleep[i].name === "抑郁指导语") {
+                  str = "抑郁建议:" + sleep[i].value[0] + " ";
+                }
+              }
+              // if (sleep[i].name === "压力建议") {
+              //   str += "压力建议:" + sleep[i].value[0] + " ";
+              // }
+              // if (sleep[i].name === "焦虑建议") {
+              //   str += "焦虑建议:" + sleep[i].value[0] + " ";
+              // }
+              // if (sleep[i].name === "抑郁建议") {
+              //   str += "抑郁建议:" + sleep[i].value[0] + " ";
+              // }
+            }
+            console.log(sleep);
+            _this.askEnd(str);
+
+            _this.askEnd("您还想跟我再聊一聊吗?");
+            this.scale_checkItems = ["是", "否"];
+            this.inputFlag = 2;
+          }
+          // let testResult = JSON.parse(
+          //   res.data.data.userRecordEntity.testResult
+          // )[0].version;
+
+          // if (testResult == 2) {
+          //   _this.$router.push({
+          //     name: "scaleResultSCl",
+          //     params: { tableData: _this.resultJsonParams }
+          //   });
+          // } else {
+          //   _this.$router.push({
+          //     name: "scaleResult",
+          //     params: { tableData: _this.resultJsonParams }
+          //   });
+          // }
+        }
+      });
+    },
+    //调用查询量表的接口
+    //20210910163158  睡眠状况自评量表
+    //20220805135201 抑郁-焦虑-压力量表简版(DASS-21)
+
+    selectScale(flag) {
+      this.$http.get(`v1/scale/${flag}`, {}, (res) => {
+        this.scale_infos = res.data;
+        console.log(this.scale_infos);
+        this.scale_all = this.scale_infos.length;
+        this.askEnd(this.scale_infos[this.scale_index].answer);
+        this.scale_checkItems =
+          this.scale_infos[this.scale_index].checkItems.split(";");
+        console.log(this.scale_checkItems);
+        this.scale_percent = parseInt((this.scale_index + 1) / this.scale_all);
+        this.scale_percent = ((this.scale_index + 1) * 100) / this.scale_all;
+      });
+    },
+    askEnd(val) {
+      this.chatContents.push({
+        from: 1,
+        isScale: false,
+
+        question: val,
+        from1: HeadImg,
+      });
+      let contant1 = document.getElementById("contant1");
+      this.sleep(101).then(() => {
+        contant1.scrollTop = contant1.scrollHeight;
+      });
+    },
+    answerSelect(val) {
+      this.chatContents.push({
+        from: 2,
+        isScale: false,
+        answer: val,
+        from1: HeadImg,
+      });
+    },
+    askQuestions() {
+      this.chatContents.push({
+        from: 1,
+        isScale: false,
+        question: this.preList[this.threeAnswers.length].des,
+        from1: HeadImg,
+      });
+      this.questionNum++;
+    },
+
+    goBack() {
+      this.$router.go(-1);
+    },
+    //判断是否是是已婚
+    //如果是已婚
+    //取随机数1-5否则取1-7
+    //格式为需要新加一个情绪判断
+    getDom() {
+      //判断是否是已婚
+      ////已婚0  未婚  1  离异 2
+      let married = sessionStorage.getItem("isMarried");
+      if (married == "0") {
+        //从7个中抽取3个
+        console.log(this.getDomList(3, 7));
+      } else {
+        //从5个中抽取三个
+        this.getDomList(3, 5);
+      }
+    },
+    //val抽取几个,totol总共数据
+    getDomList(val, totol) {
+      let arr = [];
+      while (arr.length < val) {
+        let num = parseInt(Math.random() * totol + 1);
+        // parseInt取正,小数点后面的数字全部抹掉
+        // Math.random() 0-1的随机数
+        if (arr.indexOf(num) == -1) {
+          // this.arr.indexOf(num)若等于-1则证明arr这个数组里没有num这个随机数,因此可以放进这个数组里
+          arr.push(num);
+        }
+      }
+      //循环的数组的到想要的那三个问题
+      for (let i = 0; i < arr.length; i++) {
+        this.switchFun(arr[i]);
+      }
+      return arr;
+    },
+
+    afterListFun(val) {
+      let listLin = [];
+      //this.preList[val].type
+      switch (val) {
+        case "1-1":
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "2-1") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+        case "1-2":
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "2-2") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+        case "1-3":
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "2-3") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+        case "1-4":
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "2-4") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+        case "1-5":
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "2-5") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+        case "1-6":
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "2-6") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+        case "1-7":
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "2-7") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+      }
+    },
+    switchFun(val) {
+      let listLin = [];
+      console.log(val);
+      // let listOne = [];
+      // if (numKey == 1) {
+      //   listOne = ["1-1", "1-2", "1-3", "1-4", "1-5", "1-6", "1-7"];
+      // } else {
+      //   listOne = ["2-1", "2-2", "2-3", "2-4", "2-5", "2-6", "2-7"];
+      // }
+      switch (val) {
+        case 1:
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "1-1") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+        case 2:
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "1-2") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+        case 3:
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "1-3") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+        case 4:
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "1-4") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+        case 5:
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "1-5") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+        case 6:
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "1-6") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+        case 7:
+          {
+            for (let i = 0; i < this.questionList.length; i++) {
+              if (this.questionList[i].type == "1-7") {
+                listLin.push(this.questionList[i]);
+              }
+            }
+            //根据获数组长度获取随机数
+            let len = parseInt(Math.random() * listLin.length);
+            this.preList.push(listLin[len]);
+          }
+          break;
+      }
+    },
+    questionFun() {
+      let tmp = [];
+      let value = null;
+      let flag = true;
+      while (flag) {
+        if (tmp.length === 0) {
+          value = Math.floor(Math.random() * 49);
+          tmp.push(value);
+        } else {
+          value = Math.floor(Math.random() * 49);
+          let repeat = false; //是否重复
+          for (let i = 0; i < tmp.length; i++) {
+            if (value == tmp[i]) {
+              repeat = true;
+              break;
+            }
+          }
+          if (!repeat && tmp.length < 5) {
+            tmp.push(value);
+            if (tmp.length === 5) {
+              flag = false;
+            }
+          }
+        }
+      }
+      return tmp;
+    },
+  },
+};
+</script>
+  <style scoped>
+.mainTable-top {
+  margin-top: 5%;
+}
+.mainTable-top-two {
+  margin-top: 10%;
+}
+.mainTable-tab {
+  cursor: pointer;
+  margin-left: 100px;
+  margin-right: 100px;
+  border-radius: 5px;
+  border: 1px solid #000000;
+  text-align: center;
+  height: 150px;
+  margin-bottom: 100px;
+}
+.mainTable-tab-p {
+  padding-top: 40px;
+}
+.musicTitle {
+  display: block;
+  font-size: 18px;
+  color: #57acbb;
+  margin-bottom: 5px;
+}
+.main_answer_left {
+  display: flex;
+  /* text-align: left; */
+}
+.main_answer_right {
+  display: flex;
+  /* text-align: right; */
+}
+.message-wrapper {
+  background-color: #ffffff;
+}
+.message-wrapper-left {
+  margin-left: 10px;
+  /* border-radius: 0 1rem 1rem 1rem; */
+  border-radius: 4px 4px 4px 4px;
+  max-width: 20.86667rem;
+  display: inline-table;
+}
+.message-wrapper-right {
+  margin-right: 10px;
+  border-radius: 4px 4px 4px 4px;
+  max-width: 20.86667rem;
+  display: inline-table;
+  background-color: #1fd18e;
+  color: #ffffff;
+  /* margin-top: 25px; */
+  padding: 18px;
+}
+
+.message-wrapper-right ::v-deep .el-radio {
+  color: #ffffff;
+}
+
+.message {
+  word-break: break-all;
+  padding: 18px;
+  /* font-size: 20px; */
+}
+
+.xl_d_button {
+  background: rgb(87, 172, 187);
+  opacity: 1;
+  border-radius: 50%;
+  font-size: 20px;
+  font-family: PingFang SC;
+  font-weight: 400;
+  color: #ffffff;
+  width: 40px;
+  line-height: 40px;
+  text-align: center;
+}
+.xl_d_button:hover {
+  background: rgb(87, 172, 187);
+  opacity: 1;
+  /* border-radius: 18px; */
+  font-size: 14px;
+  font-family: PingFang SC;
+  font-weight: 400;
+  color: #ffffff;
+}
+.xl_d_button:focus {
+  background: rgb(87, 172, 187);
+  opacity: 1;
+  /* border-radius: 18px; */
+  font-size: 14px;
+  font-family: PingFang SC;
+  font-weight: 400;
+  color: #ffffff;
+}
+.refrshSmart {
+  float: right;
+  cursor: pointer;
+}
+.xl_input >>> .el-input__inner {
+  border: 0;
+  border-radius: 4px;
+  background-color: #f4f4f4;
+}
+.footSend {
+  background: #ffffff;
+  position: absolute;
+  height: 80px;
+  margin-left: 2%;
+  width: 90%;
+  border-radius: 14px;
+  bottom: 50px;
+}
+.smart_line_class {
+  /* background: #BBC5D4; */
+  position: absolute;
+  height: 1px;
+  margin-left: 2%;
+  width: 90%;
+  border-radius: 14px;
+  bottom: 150px;
+  border-bottom: 1px solid #bbc5d4;
+}
+.footSend >>> .el-textarea__inner {
+  border: 0px solid #ffffff !important;
+  border-radius: 14px !important;
+}
+.footSendSelect {
+  background: #ffffff;
+  /* padding-bottom: 40px; */
+  position: absolute;
+  margin-left: 2%;
+  width: 90%;
+  bottom: 40px;
+}
+.xl_d_send {
+  margin-top: 18px;
+  color: #087b50;
+  background: #c6f0ed !important;
+  opacity: 1;
+  font-size: 14px;
+  font-family: PingFang SC;
+  font-weight: 400;
+  text-align: center;
+  border: 0px;
+  border-radius: 10px;
+}
+.xl_d_send:hover {
+  margin-top: 18px;
+  color: #087b50;
+  background: #c6f0ed !important;
+  opacity: 1;
+  font-size: 14px;
+  font-family: PingFang SC;
+  font-weight: 400;
+  text-align: center;
+  border-radius: 10px;
+}
+.xl_d_send:focus {
+  margin-top: 18px;
+  color: #087b50;
+  background: #c6f0ed !important;
+  opacity: 1;
+  font-size: 14px;
+  font-family: PingFang SC;
+  font-weight: 400;
+  text-align: center;
+  border-radius: 10px;
+}
+.xl_d_send.is-disabled,
+.xl_d_send.is-disabled:hover,
+.xl_d_send.is-disabled:focus {
+  margin-top: 18px;
+  color: #087b50;
+  background: #c6f0ed !important;
+  opacity: 1;
+  font-size: 14px;
+  font-family: PingFang SC;
+  font-weight: 400;
+  text-align: center;
+  border-radius: 10px;
+}
+
+.main_right_height {
+  /* padding:40px; */
+  height: 100vh !important;
+  display: block !important;
+  overflow-y: auto !important;
+  background-color: #ffffff;
+}
+
+.smart_content {
+  height: 88%;
+  margin-top: 5%;
+  width: 94%;
+  margin-left: 3%;
+  border-radius: 40px;
+  background: #f6f6f6;
+}
+.chat-window {
+  height: 70vh;
+  overflow: auto;
+  /* overflow-y:hidden; */
+}
+
+/* .contant1{
+   height:70vh;
+    overflow:auto;
+  } */
+
+::v-deep .el-radio.is-bordered + .el-radio.is-bordered {
+  display: block;
+  margin: 10px 0 0 0;
+}
+</style>

+ 8 - 6
src/renderer/router/index.js

@@ -240,21 +240,23 @@ if (result != '0') {
         {
           path: 'psychologicalClinic',
           name: 'psychologicalClinic',
-          component: ()=>import('@/components/psychologicalClinic.vue')
+          component: () => import('@/components/psychologicalClinic.vue')
         },
         {
           path: 'healthKnowledge',
           name: 'healthKnowledge',
-          component: ()=>import('@/components/HealthKnowledge.vue')
+          component: () => import('@/components/HealthKnowledge.vue')
         },
         {
           path: 'healthDetail',
           name: 'healthDetail',
-          component: ()=>import('@/components/healthDetail.vue')
+          component: () => import('@/components/healthDetail.vue')
+        },
+        {
+          path: 'treatDepression',
+          name: 'TreatDepression',
+          component: () => import('@/components/treatDepression.vue')
         }
-
-
-
       ]
     },
     {