|
@@ -2,7 +2,12 @@
|
|
|
<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" @click="goDetail(item)">
|
|
|
+ <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>
|
|
@@ -12,118 +17,35 @@
|
|
|
</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,
|
|
|
+ id: 1,
|
|
|
imgUrl: require("../assets/newImage/rzgy1.png"),
|
|
|
name: "战胜焦虑",
|
|
|
title: "每天放松好心情",
|
|
|
desc: "焦虑是个人对可能会出现的危险或威胁所产生的紧张、不安、忧虑、烦恼等不愉快的复杂情绪状态,CBT通过认知重构,暴露疗法,行为改变,放松训练等方法可以有效治疗焦虑。",
|
|
|
},
|
|
|
{
|
|
|
- id: 1,
|
|
|
+ id: 2,
|
|
|
imgUrl: require("../assets/newImage/rzgy2.png"),
|
|
|
name: "走出抑郁",
|
|
|
title: "重新点燃生活的希望",
|
|
|
desc: "抑郁症是一种以连续且长期的心情低落为主要特征的心理疾病,通过CBT的阶段治疗,配合认知重建,行为改变等治疗手段可有效缓解抑郁情绪。",
|
|
|
- url: '/treatDepression'
|
|
|
+ url: "/treatDepression",
|
|
|
},
|
|
|
{
|
|
|
- id: 2,
|
|
|
+ id: 3,
|
|
|
imgUrl: require("../assets/newImage/rzgy3.png"),
|
|
|
name: "远离失眠",
|
|
|
title: "甜蜜梦乡不是奢望",
|
|
|
desc: "失眠和睡眠节律紊乱等睡眠障碍会对您的生活质量和身体健康产生严重影响,CBT治疗通过放松训练,睡眠限制治疗,刺激控制技术,睡眠健康教育等方法来改善睡眠障碍。",
|
|
|
},
|
|
|
{
|
|
|
- id: 3,
|
|
|
+ id: 4,
|
|
|
imgUrl: require("../assets/newImage/rzgy4.png"),
|
|
|
name: "克服应激",
|
|
|
title: "与自己的身心和解",
|
|
@@ -132,884 +54,18 @@ export default {
|
|
|
],
|
|
|
};
|
|
|
},
|
|
|
- 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;
|
|
|
- },
|
|
|
+ activated() {},
|
|
|
+ deactivated() {},
|
|
|
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);
|
|
|
- },
|
|
|
goDetail(item) {
|
|
|
- this.$router.push('/menu/treatDepression')
|
|
|
- }
|
|
|
+ // this.$router.push("/menu/treatDepression");
|
|
|
+ this.$router.push({path:'/menu/treatDepression',query:{id:item.id}});
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|