root 1 년 전
부모
커밋
c60ca2d430

BIN
src/renderer/assets/newImage/rzgy1.png


BIN
src/renderer/assets/newImage/rzgy2.png


BIN
src/renderer/assets/newImage/rzgy3.png


BIN
src/renderer/assets/newImage/rzgy4.png


+ 3 - 17
src/renderer/components/HealthKnowledge.vue

@@ -2,22 +2,7 @@
   <div class="main_right_height">
     <div class="">
       <div class="">
-        <el-row>
-          <el-col :span="1">&nbsp;</el-col>
-          <el-col :span="22" class="navigation_card">
-            <div style="display: flex">
-              <i
-                class="el-icon-arrow-left"
-                style="cursor: pointer; line-height: 1.5"
-                @click="goBack()"
-              ></i>
-              <span class="musicTitle">健康常识</span>
-            </div>
-
-            <!-- <el-divider></el-divider> -->
-          </el-col>
-          <el-col :span="1"> &nbsp; </el-col>
-        </el-row>
+        <TopDes :flag='true' topDesFont='健康常识'></TopDes>
         <!-- <el-row class="mainTable-top-two">
           <el-col :span="1">
             <div>&nbsp;</div>
@@ -420,8 +405,9 @@ export default {
   margin-right: 15px;
 }
 .main_right_height {
-  height: 95vh !important;
   display: block !important;
+  height: 100vh !important;
+  background: #ffffff;
   overflow-y: auto !important;
 }
 .card {

+ 1 - 1
src/renderer/components/Menu.vue

@@ -117,7 +117,7 @@
             >
           </el-menu-item>
           <el-menu-item
-            index="/menu/pulse"
+            index="/menu/intervene"
             v-show="userType === 1"
             @click="menuClick('rzgy')"
           >

+ 2 - 13
src/renderer/components/Relax.vue

@@ -1,19 +1,6 @@
 <template>
   <div class="relax-bg">
     <el-row class="mainTable-top-two">
-      <!-- <el-col :span="20">
-        <el-row>
-          <el-col :span="12"><div class="table-view" >量表报告查看</div></el-col>
-          <el-col :span="12"><div class="music-relax" @click='pageUrl("/menu/musicRelax")'>音乐放松</div></el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="8"><div class="breathing-relax" @click='pageUrl("/menu/video")'>呼吸放松</div></el-col>
-          <el-col :span="8"
-            ><div class="psychologicalClinic" key="" @click='pageUrl("/menu/psychologicalClinic")'>心理门诊</div></el-col
-          >
-          <el-col :span="8"><div class="health" @click='pageUrl("/menu/healthKnowledge")'>健康常识</div></el-col>
-        </el-row>
-      </el-col> -->
       <div class="menu_list">
         <div class="menu_item1" @click="pageUrl('/menu/scaleListResult')">
           <img src="../assets/newImage/relax1.png" alt="" />
@@ -164,6 +151,7 @@ export default {
 
 .menu_item1 {
   width: 21.66vw;
+  cursor: pointer;
 }
 
 .menu_item1 img {
@@ -173,6 +161,7 @@ export default {
 
 .menu_item {
   width: 19.01vw;
+  cursor: pointer;
 }
 
 .menu_item img {

+ 1154 - 0
src/renderer/components/intervene.vue

@@ -0,0 +1,1154 @@
+<template>
+  <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">
+        <img :src="item.imgUrl" alt="" />
+        <h2>{{ item.name }}</h2>
+        <p style="font-size: 1vw">{{ item.title }}</p>
+        <p>{{ item.desc }}</p>
+      </div>
+    </div>
+  </div>
+</template>
+  <script>
+import * as echarts from "echarts";
+const { ipcRenderer } = require("electron");
+var chartDom;
+const fs = require("fs");
+var os = require("os");
+var userInfo = os.userInfo();
+import Utils from "./util.js";
+export default {
+  data() {
+    return {
+      isEcg: "未连接",
+      numPluseDom: "",
+      numPluseTmp: "",
+      //存储文件的路径
+      filePath: "",
+      currentPulseFlag: false,
+      //脉搏原始信号
+      pulseList: [],
+      //脉搏x轴数据
+      pulseListX: [],
+      //脉搏全量数据
+      pulseListAll: [],
+      //脉搏过滤后的数据
+      filterPluse: [],
+      //脉搏滤波后最大值和最小值
+      filterPluseMin: 0,
+      filterPluseMax: 100,
+      testFlag: "开始测试",
+      aa: {
+        sdnn: "-",
+        sdsd: "-",
+        rmssd: "-",
+        sd1: "-",
+        sd2: "-",
+        pnn20: "-",
+        pnn50: "-",
+        p_total: "-",
+        vlf: "-",
+        lf: "-",
+        hf: "-",
+        "lf/hf": "-",
+        lf_nu: "-",
+        hf_nu: "-",
+        "0.1Hz": "-",
+      },
+      bb: {
+        sdnn: "-",
+        sdsd: "-",
+        rmssd: "-",
+        sd1: "-",
+        sd2: "-",
+        pnn20: "-",
+        pnn50: "-",
+        p_total: "-",
+        vlf: "-",
+        lf: "-",
+        hf: "-",
+        "lf/hf": "-",
+        lf_nu: "-",
+        hf_nu: "-",
+        "0.1Hz": "-",
+      },
+      cc: {
+        sdnn: "-",
+        sdsd: "-",
+        rmssd: "-",
+        sd1: "-",
+        sd2: "-",
+        pnn20: "-",
+        pnn50: "-",
+        p_total: "-",
+        vlf: "-",
+        lf: "-",
+        hf: "-",
+        "lf/hf": "-",
+        lf_nu: "-",
+        hf_nu: "-",
+        "0.1Hz": "-",
+      },
+      //游戏脉搏开始标志
+      animationPulseFlag: false,
+      //游戏期间的脉搏数据
+      pulseAnimationList: [],
+      //游戏期间脉搏指标数组
+      pulseAnimationTarget: [],
+      //测试脉搏期间的指标数组
+      pulseTarget: [],
+      interveneList: [
+        {
+          id: 0,
+          imgUrl: require("../assets/newImage/rzgy1.png"),
+          name: "战胜焦虑",
+          title: "每天放松好心情",
+          desc: "焦虑、惊恐、恐惧的情绪,社交焦虑,各种心理、身体原因引起的焦虑状态",
+        },
+        {
+          id: 1,
+          imgUrl: require("../assets/newImage/rzgy2.png"),
+          name: "走出抑郁",
+          title: "重新点燃生活的希望",
+          desc: "焦虑、惊恐、恐惧的情绪,社交焦虑,各种心理、身体原因引起的焦虑状态。",
+        },
+        {
+          id: 2,
+          imgUrl: require("../assets/newImage/rzgy3.png"),
+          name: "远离失眠",
+          title: "甜蜜梦乡不是奢望",
+          desc: "焦虑、惊恐、恐惧的情绪,社交焦虑,各种心理、身体原因引起的焦虑状态。",
+        },
+        {
+          id: 3,
+          imgUrl: require("../assets/newImage/rzgy4.png"),
+          name: "直面强迫",
+          title: "再也不跟自己过不去",
+          desc: "焦虑、惊恐、恐惧的情绪,社交焦虑,各种心理、身体原因引起的焦虑状态。",
+        },
+      ],
+    };
+  },
+  activated() {
+    let that = this;
+    this.currentPulseFlag = true;
+    chartDom.resize();
+    let url = userInfo.homedir;
+
+    let downloadsUrl = url.replace(/\\/g, "/");
+
+    this.filePath = downloadsUrl + "/KJB";
+    fs.exists(that.filePath, function (exists) {
+      // var that = this;
+
+      if (!exists) {
+        fs.mkdirSync(that.filePath);
+      }
+    });
+  },
+  deactivated() {
+    this.currentPulseFlag = false;
+  },
+  mounted() {
+    console.log(
+      "-----------------------------------------------------------------"
+    );
+
+    console.log(Utils);
+    let that = this;
+    chartDom = echarts.init(document.getElementById("pluse"));
+
+    var flag = true;
+    window.addEventListener("resize", function () {
+      if (flag) {
+        setTimeout(() => {
+          chartDom.resize();
+          flag = true;
+        }, 1000);
+      }
+      flag = false;
+    });
+    this.pulseListX = this.initPluseX();
+
+    this.refreshPluse();
+
+    ipcRenderer.on("asynchronous-message", (event, arg) => {
+      let a = JSON.parse(arg);
+      let pluseArrTmp = [];
+      if (a.flag === "KJB") {
+        pluseArrTmp = JSON.parse(a.data);
+      } else if (a.flag === "KJB-PULSE-STATE") {
+        if (a.data === "PULSE-STOP") {
+          console.log(a.data);
+          this.startTest(2);
+        }
+      }
+
+      for (let i = 0; i < pluseArrTmp.length; i++) {
+        if (this.pulseList.length == 500) {
+          // e.log(this.listMachining);
+          this.pulseList.shift();
+          this.pulseListX.shift();
+        }
+        if (!isNaN(pluseArrTmp[i])) {
+          //如果有些界面点击开始则开始储存游戏开始的数据
+
+          this.pulseList.push(pluseArrTmp[i]);
+          this.pulseListAll.push(pluseArrTmp[i]);
+
+          if (this.animationPulseFlag) {
+            this.pulseAnimationList.push(pluseArrTmp[i]);
+          }
+
+          if (this.pulseListAll.length > 500) {
+            this.pulseListX.push(this.pulseListAll.length);
+          }
+          this.numPluseDom = this.pulseListAll.length.toString();
+        }
+      }
+    });
+    Utils.$on("animation-pulse", (msg) => {
+      if (msg.command == "开始") {
+        that.pulseAnimationList = [];
+        that.pulseAnimationTarget = [];
+        that.animationPulseFlag = true;
+      } else {
+        that.animationPulseFlag = false;
+        let saveTime = that.getCurrentTime();
+        //调用保存接口
+        //将数据
+        //将脉搏数据存储进文件
+
+        //调用接口将脉搏数据入库
+        let timeStamp = that.formateDate();
+        let acount = sessionStorage.getItem("num");
+        let fileName = acount + "-" + timeStamp + "脉搏训练";
+        let test_result_tmp = that.pulseAnimationList;
+        fs.writeFile(
+          `${that.filePath}/${fileName}.txt`,
+          test_result_tmp,
+          "binary",
+          function (err) {
+            if (err) {
+              that.$message.error("导出失败");
+            } else {
+            }
+          }
+        );
+
+        let params = {
+          num: sessionStorage.getItem("num"), //个人编号
+          gameScene: that.formatterGame(msg.gameScene), //游戏场景
+          equipmentType: "脉搏", //设备类型
+          gameDifficulty: that.formatterGameDiff(msg.gameDifficulty), //游戏难度
+          gameTime: that.formatterGameTime(msg.gameTime), //游戏时间
+          animationSourceList: "-", //原始数据
+          fileName: fileName,
+          animationTarget: JSON.stringify(that.pulseAnimationTarget), //指标数据
+          saveTime: saveTime, //保存指标数据
+        };
+        that.savePulseAnimation(params);
+      }
+    });
+    ipcRenderer.on("send-message-to-render-pluse", (event, arg) => {
+      // that.filterPluse = arg;
+      let filterPluseList = arg;
+      for (let i = 0; i < filterPluseList.length; i++) {
+        that.filterPluse[i] = filterPluseList[i].toFixed();
+      }
+      that.filterPluseMin = Math.min.apply(null, that.filterPluse);
+      that.filterPluseMax = Math.max.apply(null, that.filterPluse);
+    });
+
+    ipcRenderer.on("send-message-to-render-hrv", (event, arg) => {
+      console.log("22222222222222222222");
+      that.aa = arg;
+      if (typeof that.aa === "undefined") {
+        that.aa = "";
+      }
+      if (that.aa == "") {
+        that.aa = {
+          sdnn: "-",
+          sdsd: "-",
+          rmssd: "-",
+          sd1: "-",
+          sd2: "-",
+          pnn20: "-",
+          pnn50: "-",
+          p_total: "-",
+          vlf: "-",
+          lf: "-",
+          hf: "-",
+          "lf/hf": "-",
+          lf_nu: "-",
+          hf_nu: "-",
+          "0.1Hz": "-",
+        };
+      } else {
+        if (that.aa.sdnn != "" || that.aa.sdnn != null) {
+          that.aa.sdnn = parseFloat(that.aa.sdnn).toFixed(4);
+        } else {
+          that.aa.sdnn = "-";
+        }
+
+        if (that.aa.sdsd != "" || that.aa.sdsd != null) {
+          that.aa.sdsd = parseFloat(that.aa.sdsd).toFixed(4);
+        } else {
+          that.aa.sdsd = "-";
+        }
+
+        if (that.aa.rmssd != "" || that.aa.rmssd != null) {
+          that.aa.rmssd = parseFloat(that.aa.rmssd).toFixed(4);
+        } else {
+          that.aa.rmssd = "-";
+        }
+
+        if (that.aa.sd1 != "" || that.aa.sd1 != null) {
+          that.aa.sd1 = parseFloat(that.aa.sd1).toFixed(4);
+        } else {
+          that.aa.sd1 = "-";
+        }
+
+        if (that.aa.sd2 != "" || that.aa.sd2 != null) {
+          that.aa.sd2 = parseFloat(that.aa.sd2).toFixed(4);
+        } else {
+          that.aa.sd2 = "-";
+        }
+
+        if (that.aa.pnn20 != "" || that.aa.pnn20 != null) {
+          that.aa.pnn20 = parseFloat(that.aa.pnn20).toFixed(4);
+        } else {
+          that.aa.pnn20 = "-";
+        }
+        if (that.aa.pnn50 != "" || that.aa.pnn50 != null) {
+          that.aa.pnn50 = parseFloat(that.aa.pnn50).toFixed(4);
+        } else {
+          that.aa.pnn50 = "-";
+        }
+
+        if (that.aa.p_total != "" || that.aa.p_total != null) {
+          that.aa.p_total = parseFloat(that.aa.p_total).toFixed(4);
+        } else {
+          that.aa.p_total = "-";
+        }
+        if (that.aa.vlf != "" || that.aa.vlf != null) {
+          that.aa.vlf = parseFloat(that.aa.vlf).toFixed(4);
+        } else {
+          that.aa.vlf = "-";
+        }
+
+        if (that.aa.lf != "" || that.aa.lf != null) {
+          that.aa.lf = parseFloat(that.aa.lf).toFixed(4);
+        } else {
+          that.aa.lf = "-";
+        }
+
+        if (that.aa.hf != "" || that.aa.hf != null) {
+          that.aa.hf = parseFloat(that.aa.hf).toFixed(4);
+        } else {
+          this.aa.hf = "-";
+        }
+        if (that.aa["lf/hf"] != "" || that.aa["lf/hf"] != null) {
+          that.aa["lf/hf"] = parseFloat(that.aa["lf/hf"]).toFixed(4);
+        } else {
+          that.aa["lf/hf"] = "-";
+        }
+
+        if (that.aa.lf_nu != "" || that.aa.lf_nu != null) {
+          that.aa.lf_nu = parseFloat(that.aa.lf_nu).toFixed(4);
+        } else {
+          that.aa.lf_nu = "-";
+        }
+        if (that.aa.hf_nu != "" || that.aa.hf_nu != null) {
+          that.aa.hf_nu = parseFloat(that.aa.hf_nu).toFixed(4);
+        } else {
+          that.aa.hf_nu = "-";
+        }
+
+        if (that.aa["0.1Hz"] != "" || that.aa["0.1Hz"] != null) {
+          that.aa["0.1Hz"] = parseFloat(that.aa["0.1Hz"]).toFixed(4);
+        } else {
+          that.aa["0.1Hz"] = "-";
+        }
+      }
+      //调用接口将脉搏数据入库
+      let timeStamp = that.formateDate();
+      let acount = sessionStorage.getItem("num");
+      let fileName = acount + "-" + timeStamp + "脉搏";
+      let test_result_tmp = that.pulseListAll;
+      fs.writeFile(
+        `${that.filePath}/${fileName}.txt`,
+        test_result_tmp,
+        "binary",
+        function (err) {
+          if (err) {
+            that.$message.error("导出失败");
+          } else {
+          }
+        }
+      );
+      that.$http.post(
+        `v1/recordPhy/save`,
+        {
+          testDate: timeStamp,
+          testResult: that.aa,
+          sourceData: "",
+          hrv: that.aa,
+          type: 1,
+          identifier: sessionStorage.getItem("num"),
+          fileName: fileName,
+          target: that.pulseTarget,
+        },
+        (res) => {
+          if (res.data.code == 200) {
+            this.$message.success("保存成功");
+          } else {
+            this.$message.error("访问服务器失败!");
+          }
+        }
+      );
+    });
+
+    ipcRenderer.on("send-message-to-render-hrv-pluseAll", (event, arg) => {
+      that.bb = arg;
+      if (typeof that.bb === "undefined") {
+        that.bb = "";
+      }
+      if (that.bb == "") {
+        that.bb = {
+          sdnn: "-",
+          sdsd: "-",
+          rmssd: "-",
+          sd1: "-",
+          sd2: "-",
+          pnn20: "-",
+          pnn50: "-",
+          p_total: "-",
+          vlf: "-",
+          lf: "-",
+          hf: "-",
+          "lf/hf": "-",
+          lf_nu: "-",
+          hf_nu: "-",
+          "0.1Hz": "-",
+        };
+      } else {
+        if (that.bb.sdnn != "" || that.bb.sdnn != null) {
+          that.bb.sdnn = parseFloat(that.bb.sdnn).toFixed(4);
+        } else {
+          that.bb.sdnn = "-";
+        }
+
+        if (that.bb.sdsd != "" || that.bb.sdsd != null) {
+          that.bb.sdsd = parseFloat(that.bb.sdsd).toFixed(4);
+        } else {
+          that.bb.sdsd = "-";
+        }
+
+        if (that.bb.rmssd != "" || that.bb.rmssd != null) {
+          that.bb.rmssd = parseFloat(that.bb.rmssd).toFixed(4);
+        } else {
+          that.bb.rmssd = "-";
+        }
+
+        if (that.bb.sd1 != "" || that.bb.sd1 != null) {
+          that.bb.sd1 = parseFloat(that.bb.sd1).toFixed(4);
+        } else {
+          that.bb.sd1 = "-";
+        }
+
+        if (that.bb.sd2 != "" || that.bb.sd2 != null) {
+          that.bb.sd2 = parseFloat(that.bb.sd2).toFixed(4);
+        } else {
+          that.bb.sd2 = "-";
+        }
+
+        if (that.bb.pnn20 != "" || that.bb.pnn20 != null) {
+          that.bb.pnn20 = parseFloat(that.bb.pnn20).toFixed(4);
+        } else {
+          that.bb.pnn20 = "-";
+        }
+        if (that.bb.pnn50 != "" || that.bb.pnn50 != null) {
+          that.bb.pnn50 = parseFloat(that.bb.pnn50).toFixed(4);
+        } else {
+          that.bb.pnn50 = "-";
+        }
+
+        if (that.bb.p_total != "" || that.bb.p_total != null) {
+          that.bb.p_total = parseFloat(that.bb.p_total).toFixed(4);
+        } else {
+          that.bb.p_total = "-";
+        }
+        if (that.bb.vlf != "" || that.bb.vlf != null) {
+          that.bb.vlf = parseFloat(that.bb.vlf).toFixed(4);
+        } else {
+          that.bb.vlf = "-";
+        }
+
+        if (that.bb.lf != "" || that.bb.lf != null) {
+          that.bb.lf = parseFloat(that.bb.lf).toFixed(4);
+        } else {
+          that.bb.lf = "-";
+        }
+
+        if (that.bb.hf != "" || that.bb.hf != null) {
+          that.bb.hf = parseFloat(that.bb.hf).toFixed(4);
+        } else {
+          this.bb.hf = "-";
+        }
+        if (that.bb["lf/hf"] != "" || that.bb["lf/hf"] != null) {
+          that.bb["lf/hf"] = parseFloat(that.bb["lf/hf"]).toFixed(4);
+        } else {
+          that.bb["lf/hf"] = "-";
+        }
+
+        if (that.bb.lf_nu != "" || that.bb.lf_nu != null) {
+          that.bb.lf_nu = parseFloat(that.bb.lf_nu).toFixed(4);
+        } else {
+          that.bb.lf_nu = "-";
+        }
+        if (that.bb.hf_nu != "" || that.bb.hf_nu != null) {
+          that.bb.hf_nu = parseFloat(that.bb.hf_nu).toFixed(4);
+        } else {
+          that.bb.hf_nu = "-";
+        }
+
+        if (that.bb["0.1Hz"] != "" || that.bb["0.1Hz"] != null) {
+          that.bb["0.1Hz"] = parseFloat(that.bb["0.1Hz"]).toFixed(4);
+        } else {
+          that.bb["0.1Hz"] = "-";
+        }
+      }
+      if (that.bb.lf == "-" || that.bb.hf == "-") {
+        Utils.$emit("pulse", {
+          status: that.isEcg,
+          waitTime: 0,
+          value: 0,
+          pulseGame: 0,
+          bbGame: "",
+        });
+        //当游戏点击开始后
+        //进行保存指标数据进数据库
+        // that.pulseAnimationList = [];
+        // that.pulseAnimationTarget = [];
+        // that.animationPulseFlag = ture;
+        //当脉搏连接上且按钮为结束测试时
+        // if ((that.isEcg = "已连接" && that.testFlag == "结束测试")) {
+        //   that.pulseTarget.push({ lf: "-", hf: "-", "lf/hf": 0 });
+        // }
+        if (that.animationPulseFlag) {
+          // let linTarget={}
+          that.pulseAnimationTarget.push({ lf: "-", hf: "-", "lf/hf": 0 });
+        }
+      } else {
+        let lf = parseInt(that.bb.lf);
+        let hf = parseInt(that.bb.hf);
+        let pulseGame = parseInt(that.bb.hf_nu);
+        Utils.$emit("pulse", {
+          status: that.isEcg,
+          waitTime: 0,
+          value: lf / hf,
+          pulseGame: pulseGame,
+          bbGame: that.bb,
+        });
+        // if ((that.isEcg = "已连接" && that.testFlag == "结束测试")) {
+        //   that.pulseTarget.push({ lf: lf, hf: hf, "lf/hf": lf / hf });
+        // }
+        if (that.animationPulseFlag) {
+          // let linTarget={}
+          that.pulseAnimationTarget.push({ lf: lf, hf: hf, "lf/hf": lf / hf });
+        }
+      }
+      //判断那两个指标是否存在
+    });
+
+    ipcRenderer.on("send-message-to-render-hrv-realtime", (event, arg) => {
+      that.cc = arg;
+      if (typeof that.cc === "undefined") {
+        that.cc = "";
+      }
+      if (that.cc == "") {
+        that.cc = {
+          sdnn: "-",
+          sdsd: "-",
+          rmssd: "-",
+          sd1: "-",
+          sd2: "-",
+          pnn20: "-",
+          pnn50: "-",
+          p_total: "-",
+          vlf: "-",
+          lf: "-",
+          hf: "-",
+          "lf/hf": "-",
+          lf_nu: "-",
+          hf_nu: "-",
+          "0.1Hz": "-",
+        };
+      } else {
+        if (that.cc.sdnn != "" || that.cc.sdnn != null) {
+          that.cc.sdnn = parseFloat(that.cc.sdnn).toFixed(4);
+        } else {
+          that.cc.sdnn = "-";
+        }
+
+        if (that.cc.sdsd != "" || that.cc.sdsd != null) {
+          that.cc.sdsd = parseFloat(that.cc.sdsd).toFixed(4);
+        } else {
+          that.cc.sdsd = "-";
+        }
+
+        if (that.cc.rmssd != "" || that.cc.rmssd != null) {
+          that.cc.rmssd = parseFloat(that.cc.rmssd).toFixed(4);
+        } else {
+          that.cc.rmssd = "-";
+        }
+
+        if (that.cc.sd1 != "" || that.cc.sd1 != null) {
+          that.cc.sd1 = parseFloat(that.cc.sd1).toFixed(4);
+        } else {
+          that.cc.sd1 = "-";
+        }
+
+        if (that.cc.sd2 != "" || that.cc.sd2 != null) {
+          that.cc.sd2 = parseFloat(that.cc.sd2).toFixed(4);
+        } else {
+          that.cc.sd2 = "-";
+        }
+
+        if (that.cc.pnn20 != "" || that.cc.pnn20 != null) {
+          that.cc.pnn20 = parseFloat(that.cc.pnn20).toFixed(4);
+        } else {
+          that.cc.pnn20 = "-";
+        }
+        if (that.cc.pnn50 != "" || that.cc.pnn50 != null) {
+          that.cc.pnn50 = parseFloat(that.cc.pnn50).toFixed(4);
+        } else {
+          that.cc.pnn50 = "-";
+        }
+
+        if (that.cc.p_total != "" || that.cc.p_total != null) {
+          that.cc.p_total = parseFloat(that.cc.p_total).toFixed(4);
+        } else {
+          that.cc.p_total = "-";
+        }
+        if (that.cc.vlf != "" || that.cc.vlf != null) {
+          that.cc.vlf = parseFloat(that.cc.vlf).toFixed(4);
+        } else {
+          that.cc.vlf = "-";
+        }
+
+        if (that.cc.lf != "" || that.cc.lf != null) {
+          that.cc.lf = parseFloat(that.cc.lf).toFixed(4);
+        } else {
+          that.cc.lf = "-";
+        }
+
+        if (that.cc.hf != "" || that.cc.hf != null) {
+          that.cc.hf = parseFloat(that.cc.hf).toFixed(4);
+        } else {
+          this.cc.hf = "-";
+        }
+        if (that.cc["lf/hf"] != "" || that.cc["lf/hf"] != null) {
+          that.cc["lf/hf"] = parseFloat(that.cc["lf/hf"]).toFixed(4);
+        } else {
+          that.cc["lf/hf"] = "-";
+        }
+
+        if (that.cc.lf_nu != "" || that.cc.lf_nu != null) {
+          that.cc.lf_nu = parseFloat(that.cc.lf_nu).toFixed(4);
+        } else {
+          that.cc.lf_nu = "-";
+        }
+        if (that.cc.hf_nu != "" || that.cc.hf_nu != null) {
+          that.cc.hf_nu = parseFloat(that.cc.hf_nu).toFixed(4);
+        } else {
+          that.cc.hf_nu = "-";
+        }
+
+        if (that.cc["0.1Hz"] != "" || that.cc["0.1Hz"] != null) {
+          that.cc["0.1Hz"] = parseFloat(that.cc["0.1Hz"]).toFixed(4);
+        } else {
+          that.cc["0.1Hz"] = "-";
+        }
+      }
+      if (that.cc.lf == "-" || that.cc.hf == "-") {
+        //当游戏点击开始后
+        //进行保存指标数据进数据库
+        // that.pulseAnimationList = [];
+        // that.pulseAnimationTarget = [];
+        // that.animationPulseFlag = ture;
+        //当脉搏连接上且按钮为结束测试时
+        if (that.isEcg == "已连接" && that.testFlag == "结束测试") {
+          that.pulseTarget.push({ lf: "-", hf: "-", "lf/hf": 0 });
+        }
+      } else {
+        let lf = parseInt(that.cc.lf);
+        let hf = parseInt(that.cc.hf);
+        if (that.isEcg == "已连接" && that.testFlag == "结束测试") {
+          that.pulseTarget.push({ lf: lf, hf: hf, "lf/hf": lf / hf });
+        }
+      }
+    });
+
+    //实时算法的东西
+
+    setInterval(() => {
+      //向游戏训练传输脉搏的连接状态
+      //如果连接状态时已连接,则判断运行是否超过3分钟,如果未超过3分钟则返回剩余多少分钟
+      //如果剩余是0,则再传输指标值
+
+      //应该是判断属于游戏脉搏数组的长度
+      //用游戏脉搏的数组判断是否大于3分钟。3分钟数据长度后,需要将数据算为指标,指标算出来以后传输给游戏界面
+      if (that.pulseAnimationList.length > 0) {
+        if (that.pulseAnimationList.length >= 18000 && that.isEcg == "已连接") {
+          let rawData = that.pulseAnimationList;
+          if (that.animationPulseFlag) {
+            ipcRenderer.send("asynchronoushrv-message-pluseAll", rawData);
+          }
+        } else {
+          Utils.$emit("pulse", {
+            status: that.isEcg,
+            waitTime: 180 - that.pulseAnimationList.length / 100,
+            value: 0,
+          });
+        }
+      } else {
+        Utils.$emit("pulse", {
+          status: that.isEcg,
+          waitTime: 180 - that.pulseAnimationList.length / 100,
+          value: 0,
+        });
+      }
+
+      //判断全量的数据
+      if (that.pulseListAll.length > 0) {
+        // Utils.$emit("pluse", 1); 100*60*3
+        //需要计算脉搏单独测试的接口。
+        //满足条件 长度大于18000 并且脉搏已连接,并且按钮为已点击开始测试的状态
+        if (
+          that.pulseListAll.length >= 18000 &&
+          that.isEcg == "已连接" &&
+          that.testFlag == "结束测试"
+        ) {
+          let rawData = that.pulseListAll;
+          //脉搏页面自己测试的数据调用算法
+          ipcRenderer.send("asynchronoushrv-message-pluse-realtime", rawData);
+          //向python程序发送消息计算hrv值
+          //计算hrv值后向生物反馈发送指标消息
+        }
+      }
+
+      if (that.pulseList.length > 0) {
+        //连接状态在不在当前页面时也要体现出来
+        if (that.numPluseTmp !== that.numPluseDom) {
+          //假如不相等就是已连接
+          that.numPluseTmp = that.numPluseDom;
+          that.isEcg = "已连接";
+        } else {
+          that.isEcg = "未连接";
+          // this.isEle = "未连接";
+          //已断开
+        }
+        if (that.currentPulseFlag) {
+          that.refreshPluse();
+        }
+      }
+    }, 1000);
+  },
+  methods: {
+    //保存游戏数据接口
+
+    savePulseAnimation(params) {
+      let that = this;
+      that.$http.post(
+        `v1/game/record/save`,
+        {
+          identifier: params.num,
+          gameScene: params.gameScene,
+          equipmentType: params.equipmentType,
+          gameDifficulty: params.gameDifficulty,
+          gameTime: params.gameTime,
+          animationSourceList: params.animationSourceList,
+          fileName: params.fileName,
+          animationTarget: params.animationTarget,
+          saveTime: params.saveTime,
+        },
+        (res) => {
+          if (res.data.code == 200) {
+            // this.$message.success("保存成功");
+            this.$message({
+              message: "保存成功",
+              type: "success",
+              duration: 800,
+            });
+          } else {
+            this.$message.error("访问服务器失败!");
+          }
+        }
+      );
+    },
+    formatterGameTime(val) {
+      if (val == "1") {
+        return "3分钟";
+      }
+      if (val == "2") {
+        return "5分钟";
+      }
+      if (val == "3") {
+        return "10分钟";
+      }
+      return "";
+    },
+    formatterGameDiff(val) {
+      if (val == "1") {
+        return "简单";
+      }
+      if (val == "2") {
+        return "普通";
+      }
+      if (val == "3") {
+        return "困难";
+      }
+      return "";
+    },
+    //格式化游戏场景
+    formatterGame(val) {
+      if (val == "1") {
+        return "心灵之火";
+      }
+      if (val == "2") {
+        return "心之花";
+      }
+      if (val == "3") {
+        return "急速赛车";
+      }
+      if (val == "4") {
+        return "爆爆桶";
+      }
+      if (val == "5") {
+        return "炸弹";
+      }
+      if (val == "6") {
+        return "漂浮球";
+      }
+      return "";
+    },
+    getCurrentTime() {
+      let date = new Date();
+      let year = date.getFullYear();
+      let month = this.formatterMonth(date.getMonth() + 1);
+      let day = this.formatterMonth(date.getDate());
+      let hour = this.formatterMonth(date.getHours());
+      let min = this.formatterMonth(date.getMinutes());
+      let ss = this.formatterMonth(date.getSeconds());
+      let ms = date.getMilliseconds();
+      return (
+        year.toString() +
+        "年" +
+        month.toString() +
+        "月" +
+        day.toString() +
+        "日" +
+        hour.toString() +
+        "时" +
+        min.toString() +
+        "分" +
+        ss.toString() +
+        "秒" +
+        ms
+      );
+    },
+    formatterMonth(val) {
+      let a = 0;
+      if (val < 10) {
+        a = "0" + val;
+        return a;
+      } else {
+        a = val;
+        return a;
+      }
+    },
+    formateDate() {
+      let current = new Date();
+      let year = current.getFullYear();
+      let month = current.getMonth();
+      let day = current.getDate();
+      let hour = current.getHours();
+      let min = current.getMinutes();
+      let ss = current.getSeconds();
+      let mm = current.getMilliseconds();
+      return (
+        year +
+        "年" +
+        (month + 1) +
+        "月" +
+        day +
+        "日" +
+        hour +
+        "时" +
+        min +
+        "分" +
+        ss +
+        "秒" +
+        mm
+      );
+    },
+    startTest(val) {
+      console.log("val == 1");
+      console.log(val == "1");
+      let that = this;
+      if (val == "1") {
+        if (this.testFlag == "开始测试") {
+          this.pulseTarget = [];
+          this.testFlag = "结束测试";
+          this.pulseList = [];
+          //脉搏x轴数据
+          this.pulseListX = this.initPluseX();
+          //脉搏全量数据
+          this.pulseListAll = [];
+          //脉搏过滤后的数据
+          this.filterPluse = [];
+          //脉搏滤波后最大值和最小值
+          this.filterPluseMin = 0;
+          this.filterPluseMax = 100;
+        } else {
+          this.testFlag = "开始测试";
+          let rawData = this.pulseListAll;
+          //调用算法将值算出来
+          ipcRenderer.send("asynchronoushrv-message", rawData);
+          ipcRenderer.send("pulse-message-stop", "1");
+        }
+      } else {
+        if (this.testFlag == "结束测试") {
+          this.testFlag = "开始测试";
+          let rawData = this.pulseListAll;
+          //调用算法将值算出来
+          ipcRenderer.send("asynchronoushrv-message", rawData);
+        }
+      }
+    },
+    initPluseX() {
+      let tempArr = [];
+      for (let i = 0; i <= 500; i++) {
+        tempArr.push(i);
+      }
+      return tempArr;
+    },
+    goBack() {
+      this.$router.go(-1);
+    },
+    refreshPluse() {
+      // if (this.numPluseTmp !== this.numPluseDom) {
+      //   //假如不相等就是已连接
+      //   this.numPluseTmp = this.numPluseDom;
+      //   this.isEcg = "已连接";
+      // } else {
+      //   this.isEcg = "未连接";
+      //   // this.isEle = "未连接";
+      //   //已断开
+      // }
+
+      let arrPluse = [];
+      for (let i = 0; i < this.pulseList.length; i++) {
+        arrPluse.push(this.pulseList[i] * -1);
+      }
+      if (arrPluse.length > 0) {
+        ipcRenderer.send("asynchronoushrv-filter_signal", arrPluse);
+      }
+
+      let option;
+      option = {
+        animation: false,
+        title: {
+          text: "脉搏",
+          subtext: "",
+          left: "center",
+          align: "right",
+          x: "center",
+          y: "bottom",
+        },
+        xAxis: {
+          name: "",
+          boundaryGap: false,
+          splitLine: { show: true },
+          type: "category",
+          data: this.pulseListX,
+          axisLabel: {
+            interval: 99,
+            formatter: function (value, index) {
+              let i = parseInt(value);
+              // 采样大于100 情况下
+              let b = Math.round(i / 100);
+              if (i % 100 > 50) {
+                b = b + 1;
+              }
+              // 向下取整
+              return b;
+            },
+          },
+        },
+        yAxis: {
+          type: "value",
+          min: this.filterPluseMin,
+          max: this.filterPluseMax,
+        },
+        series: [
+          {
+            data: this.filterPluse,
+            type: "line",
+            smooth: true,
+            showSymbol: false,
+          },
+        ],
+      };
+      chartDom.setOption(option);
+    },
+  },
+};
+</script>
+  <style scoped>
+.main_right_height {
+  display: block !important;
+  height: 100vh;
+  background: #ffffff;
+  overflow-y: auto !important;
+}
+.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;
+}
+.pluse_tiao {
+  background: rgb(52, 122, 255);
+  border-radius: 100px;
+}
+.pluse_tiao_pl {
+  font-weight: 600;
+}
+.pluse {
+  width: 100%;
+  height: 70vh;
+  width: 100%;
+}
+.xl_d_button {
+  background: rgb(87, 172, 187);
+  opacity: 1;
+  border-radius: 18px;
+  font-size: 14px;
+  font-family: PingFang SC;
+  font-weight: 400;
+  color: #ffffff;
+  margin-bottom: 20px;
+}
+.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;
+  margin-bottom: 20px;
+}
+.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;
+  margin-bottom: 20px;
+}
+.statusNaoDuan {
+  border-radius: 50%;
+  background-color: red;
+  display: inline-block;
+  width: 10px;
+  height: 10px;
+}
+.statusNaoLink {
+  border-radius: 50%;
+  background-color: #42b983;
+  display: inline-block;
+  width: 10px;
+  height: 10px;
+}
+.xl_d_button.is-disabled,
+.xl_d_button.is-disabled:focus,
+.xl_d_button.is-disabled:hover {
+  color: #c0c4cc;
+  cursor: not-allowed;
+  background-image: none;
+  background-color: rgb(87, 172, 187);
+  border-color: #ebeef5;
+}
+.miaoz {
+  position: absolute;
+
+  right: 80px;
+
+  bottom: 60px;
+}
+
+.intervene_content {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  margin-top: 10vh;
+}
+
+.intervene_item {
+  width: 17.6vw;
+  height: 57.87vh;
+  background: #f5f5f5;
+  border-radius: 16px 16px 16px 16px;
+  opacity: 1;
+  margin: 0 1.275vw;
+  cursor: pointer;
+}
+
+.intervene_item h2 {
+  padding-left: 10px;
+  font-size: 1.25vw;
+  font-family: Source Han Sans CN-Bold, Source Han Sans CN;
+  font-weight: bold;
+  color: #0f0f0f;
+}
+
+.intervene_item p {
+  padding-left: 10px;
+  font-size: 0.83vw;
+  font-family: Source Han Sans CN-Regular, Source Han Sans CN;
+  font-weight: 400;
+  color: #4b4a4a;
+}
+
+.intervene_item img {
+  width: 100%;
+  height: auto;
+}
+</style>

+ 3 - 17
src/renderer/components/psychologicalClinic.vue

@@ -2,22 +2,7 @@
   <div class="main_right_height">
     <div class="">
       <div class="">
-        <el-row>
-          <el-col :span="1">&nbsp;</el-col>
-          <el-col :span="22" class="navigation_card">
-            <div style="display: flex">
-              <i
-                class="el-icon-arrow-left"
-                style="cursor: pointer; line-height: 1.5"
-                @click="goBack()"
-              ></i>
-              <span class="musicTitle">心理门诊</span>
-            </div>
-
-            <!-- <el-divider></el-divider> -->
-          </el-col>
-          <el-col :span="1"> &nbsp; </el-col>
-        </el-row>
+        <TopDes :flag='true' topDesFont='心理门诊'></TopDes>
         <el-row class="mainTable-top-two">
           <el-col :span="1">
             <div>&nbsp;</div>
@@ -394,8 +379,9 @@ export default {
   margin-right: 15px;
 }
 .main_right_height {
-  height: 95vh !important;
   display: block !important;
+  height: 100vh;
+  background: #ffffff;
   overflow-y: auto !important;
 }
 .card {

+ 9 - 0
src/renderer/router/index.js

@@ -7,6 +7,7 @@ import Smart from '@/components/Smart'
 import Evaluation from '@/components/Evaluation'
 import Electrical from '@/components/Electrical'
 import Pulse from '@/components/Pulse'
+import Intervene from '@/components/intervene'
 import Animation from '@/components/Animation'
 import MusicRelax from '@/components/MusicRelax'
 import Video from '@/components/Video'
@@ -108,6 +109,14 @@ if (result != '0') {
             keepAlive: true, // 需要被缓存
           }
         },
+        {
+          path: 'intervene',
+          name: 'Intervene',
+          component: Intervene,
+          meta: {
+            keepAlive: true, // 需要被缓存
+          }
+        },
         {
           path: 'animation',
           name: 'animation',