import{r,j as e,bO as y,bP as w,bQ as P,bW as Y,ci as I,d as C,t as R,a as d,g as f}from"./index-BtzNP73w.js";import{G as p}from"./index-2wwBw2Mo.js";import{L as _}from"./index-BYyeyiZH.js";import{P as T}from"./index-CYUf_agm.js";import{B as k}from"./index-CJeWDVq8.js";import{R as B}from"./index-BYZ7EzgM.js";import{a as $,e as L,g as z,c as E,d as O,b as Z}from"./chartsConfig-CLQzSBgN.js";P([Y,I]);const D=r.memo(t=>{const{option:i}=t,c=r.useRef(null),j=x=>{let l=y(c.current);l||(l=w(c.current)),l.setOption(x),window.addEventListener("onresize",()=>{l.resize()})};return r.useEffect(()=>{j(i)}),e.jsx("div",{style:{width:"100%",height:"100%"},ref:c})});D.displayName="ScatterCharts";const G=C.div`
  height: 100%;
  padding: 10px;
  .layout {
    height: 100%;
    .top {
      height: 30%;
      display: flex;
      .topleft {
        width: 500px;
        display: flex;
        overflow: hidden;
        .list {
          width: 300px;
          height: 100%;
          padding: 0 10px 10px;
          overflow: auto;
          .items {
            height: 36px;
            line-height: 36px;
            font-size: 16px;
            display: flex;
            border-bottom: 1px solid ${t=>t.theme.colorBorder};
            border-left: 1px solid ${t=>t.theme.colorBorder};
            border-right: 1px solid ${t=>t.theme.colorBorder};
            .item {
              flex: 1;
              text-align: center;
              &:nth-child(1) {
                width: 60px;
              }
              &:nth-child(2) {
                width: 150px;
              }
              &:nth-last-child(-n + 2) {
                flex: 2;
              }
            }
          }
          .col {
            cursor: pointer;
            &:hover {
              background-color: ${t=>t.theme.colorBorder};
            }
          }
          .select {
            color: ${t=>t.theme.textCheckedColor};
            background-color: ${t=>t.theme.colorBorder};
          }
          .header {
            border-top: 1px solid ${t=>t.theme.colorBorder};
            font-weight: 700;
            background-color: ${t=>t.theme.colorBgContainer};
          }
        }
        .card {
          width: 200px;
          margin-left: 20px;
          font-size: 16px;
          border-radius: 20px;
          padding-top: 10px;
          overflow: hidden;
          box-shadow: inset 0px 0px 5px 2px ${t=>t.theme.colorBorder};
          .title {
            font-size: 18px;
            justify-content: center;
          }
          p {
            height: 30px;
            line-height: 30px;
            display: flex;
            span {
              &:nth-child(1) {
                width: 60px;
                text-align: right;
              }
              &:nth-child(2) {
                flex: 1;
                padding-left: 20px;
              }
            }
          }
        }
      }
      .topright {
        flex: 1;
        display: flex;
        .panel {
          flex: 1;
          &:nth-child(2n) {
          }
        }
      }
    }
    .bottom {
      height: 70%;
      display: flex;
      .bottomleft {
        width: 260px;
        padding: 0 10px;
        overflow: auto;
        h3 {
          text-align: center;
        }
        .common {
          p {
            font-size: 16px;
            height: 28px;
            line-height: 28px;
            padding-left: 20px;
            display: flex;
            span {
              flex: 2;
              &:nth-child(2) {
                flex: 1;
              }
            }
            &:nth-child(1) {
              padding-left: 0;
            }
          }
        }
        
        .warnText {
          font-size: 12px;
          color: rgba(153, 186, 223, 0.3);
        }
      }
      .bottomcenter {
        flex: 2;
        .line {
          height: 50%;
        }
        .charts {
          height: 50%;
          display: flex;
          .common {
            flex: 1;
          }
          .splashes {
          }
        }
      }
      .bottomright {
        flex: 1;
      }
    }
  }

`,V=r.memo(()=>{const{token:t}=R.useToken(),[i,c]=r.useState(0),[j,x]=r.useState([]),[l,v]=r.useState([]),[h,b]=r.useState([{id:1,pNum:1011,pAge:18,pName:"演示一",pSexDesc:"女",currentDate:d().format("YYYY-MM-DD"),currentTime:d().format("HH:mm:ss")},{id:2,pNum:10112,pAge:18,pName:"演示二",pSexDesc:"女",currentDate:d().format("YYYY-MM-DD"),currentTime:d().format("HH:mm:ss")}]),[s,u]=r.useState({cognitiveStress:1,createTime:d().format("YYYY-MM-DD HH:mm:ss"),currentDate:d().format("YYYY-MM-DD HH:mm:ss"),currentTime:d().format("HH:mm:ss"),deviceID:"0",energy_State:1,fatigue_State:2,focus_State:1,hfnorm:28.3819522857666,id:0,jinZhang:1,lfDivideHf:2.52,lfnorm:71.61,maxHr:88.36,meanHr:83.3,minHr:76.82,personID:"0",pnn50:36,rmssd:61.21,rr:"743,733,733,733,756,756,756,753,753,753,738,738,679,679,679,697,697,697,781,781,781,695,695,695,709,709,694,694,694,703,703,703,728,728,728,739,739,739,679",saO2:99,sdnn:69.67,temperature:36.29,tp:2846.20703125,barData:[50,50],pieData:[{value:"50",name:"PNN50"},{value:"50",name:"其他"}],radarData:[{value:[2,2,2,2,2]}],lineData:[]}),g=r.useCallback(async()=>{const a=await f("/api/Person/PersonZonePoint_vr");if(a.code===200&&a.data.length>0){b(a.data);const o=await f("/api/PsyIndicator/All",{PersonID:a.data[i].id,pageIndex:1,pageSize:9999}),n=await f("/api/PsyIndicator/5minMeanHr",{PersonID:a.data[i].id}),N=await f("/api/PsyIndicator/Get1minRR",{PersonID:a.data[i].id});if(o.code===200&&o.data.items.length>0?u(o.data.items[0]):u({cognitiveStress:0,createTime:d().format("YYYY-MM-DD HH:mm:ss"),deviceID:"438cc4f6-9164-49c7-a3b4-f360ae14e1be",energy_State:0,fatigue_State:0,focus_State:0,hfnorm:0,id:0,jinZhang:0,lfDivideHf:0,lfnorm:0,maxHr:0,meanHr:0,minHr:0,personID:"345fa9d1-45a7-4393-a7a6-55c8194db7d0",pnn50:0,rmssd:0,rr:"",saO2:0,sdnn:0,temperature:0,tp:0,barData:[0,0],pieData:[{value:"0",name:"PNN50"},{value:"0",name:"其他"}],radarData:[{value:[0,0,0,0,0]}],lineData:[]}),n.code===200){const M=n.data.split(",").map(S=>Number(S).toFixed(2));x(M)}N.code===200&&v(N.data)}else u({cognitiveStress:Math.ceil(Math.random()*3),createTime:d().format("YYYY-MM-DD HH:mm:ss"),deviceID:"438cc4f6-9164-49c7-a3b4-f360ae14e1be",energy_State:Math.ceil(Math.random()*3),fatigue_State:Math.ceil(Math.random()*3),focus_State:Math.ceil(Math.random()*3),hfnorm:30.22+Math.random().toFixed(2)*10,id:0,jinZhang:2,lfDivideHf:2.3+Math.random().toFixed(2)*10,lfnorm:69.77+Math.random().toFixed(2)*10,maxHr:88.23+Math.random().toFixed(2)*10,meanHr:77.74+Math.random().toFixed(2)*10,minHr:74.53+Math.random().toFixed(2)*10,personID:"345fa9d1-45a7-4393-a7a6-55c8194db7d0",pnn50:67.64+Math.random().toFixed(2)*10,rmssd:42.16+Math.random().toFixed(2)*10,rr:"",saO2:97+Math.random().toFixed(2)*10,sdnn:53.46+Math.random().toFixed(2)*10,temperature:.2,tp:1261.3+Math.random().toFixed(2)*10,barData:[35,65],pieData:[{value:"67.64",name:"PNN50"},{value:"32.36",name:"其他"}],radarData:[{value:[2,2,2,2,2]}],lineData:[]}),x([95.27,93.34,91.96,91.46,87.77,85.86,85.19,86.36,87.13,86.75,86.52,87.86])},[i]);r.useEffect(()=>{g();const a=setInterval(()=>{g()},2e4);return()=>{clearInterval(a)}},[g]);const m=(a,o)=>{let n=0;return o==="情绪稳定性"?a===0||a===1?n=100:a===2?n=50:a===3?n=0:n=100:a===0||a===1?n=0:a===2?n=50:a===3?n=100:n=0,Z(n,o)},H=a=>[a.jinZhang,a.focus_State,a.energy_State,a.fatigue_State,a.cognitiveStress],F=a=>[{value:a,name:"PNN50"},{value:100-a,name:"其他"}];return e.jsx(G,{theme:t,children:e.jsxs("div",{className:"layout",children:[e.jsxs("div",{className:"top",children:[e.jsxs("div",{className:"topleft",children:[e.jsxs("ul",{className:"list",children:[e.jsxs("li",{className:"items header",children:[e.jsx("span",{className:"item",children:"序 号"}),e.jsx("span",{className:"item",children:"账 号"}),e.jsx("span",{className:"item",children:"姓 名"})]}),h.map((a,o)=>e.jsxs("li",{className:`items col ${i===o?"select":""}`,onClick:n=>c(o),title:a.pNum,children:[e.jsx("span",{className:"item",children:o+1}),e.jsx("span",{className:"item text-nowrap",children:a.pNum}),e.jsx("span",{className:"item",children:a.pName})]},a.id))]}),e.jsxs("div",{className:"card",children:[e.jsx("p",{className:"title",children:"人员信息"}),e.jsxs("p",{children:[e.jsx("span",{children:"账 号 : "}),e.jsx("span",{children:h[i].pNum})]}),e.jsxs("p",{children:[e.jsx("span",{children:"姓 名 : "}),e.jsx("span",{children:h[i].pName})]}),e.jsxs("p",{children:[e.jsx("span",{children:"性 别 : "}),e.jsx("span",{children:h[i].pSexDesc})]}),e.jsxs("p",{children:[e.jsx("span",{children:"年 龄 : "}),e.jsx("span",{children:d().diff(h[i].pBirthDate,"years")})]}),e.jsxs("p",{children:[e.jsx("span",{children:"日 期 : "}),e.jsx("span",{children:s.createTime&&s.createTime.split(" ")[0]})]}),e.jsxs("p",{children:[e.jsx("span",{children:"时 间 : "}),e.jsx("span",{children:s.createTime&&s.createTime.split(" ")[1]})]})]})]}),e.jsxs("div",{className:"topright",children:[e.jsx("div",{className:"panel",children:e.jsx(p,{option:m(s.jinZhang,"情绪稳定性")})}),e.jsx("div",{className:"panel",children:e.jsx(p,{option:m(s.cognitiveStress,"脑力应激")})}),e.jsx("div",{className:"panel",children:e.jsx(p,{option:m(s.fatigue_State,"疲劳度")})}),e.jsx("div",{className:"panel",children:e.jsx(p,{option:m(s.energy_State,"兴奋度")})}),e.jsx("div",{className:"panel",children:e.jsx(p,{option:m(s.focus_State,"专注度")})})]})]}),e.jsxs("div",{className:"bottom",children:[e.jsxs("div",{className:"bottomleft",children:[e.jsx("h3",{children:"生理指标"}),e.jsxs("div",{className:"common basic",children:[e.jsx("p",{children:"基础生理信号"}),e.jsxs("p",{children:[e.jsx("span",{children:"平均心率 (次/分)"}),e.jsx("span",{children:s.meanHr.toFixed(2)})]}),e.jsxs("p",{children:[e.jsx("span",{children:"最大心率 (次/分)"}),e.jsx("span",{children:s.maxHr.toFixed(2)})]}),e.jsxs("p",{children:[e.jsx("span",{children:"最小心率 (次/分)"}),e.jsx("span",{children:s.minHr.toFixed(2)})]}),e.jsxs("p",{children:[e.jsx("span",{children:"血氧饱和度 (%)"}),e.jsx("span",{children:s.saO2.toFixed(2)})]}),e.jsxs("p",{children:[e.jsx("span",{children:"参考温度 (°)"}),e.jsx("span",{children:s.temperature.toFixed(2)})]})]}),e.jsxs("div",{className:"common heartRate",children:[e.jsx("p",{children:"心率变异性 ( HRV )"}),e.jsxs("p",{children:[e.jsx("span",{children:"SDNN (ms)"}),e.jsx("span",{children:s.sdnn.toFixed(2)})]}),e.jsxs("p",{children:[e.jsx("span",{children:"RMSSD (ms)"}),e.jsx("span",{children:s.rmssd.toFixed(2)})]}),e.jsxs("p",{children:[e.jsx("span",{children:"PNN50 (%)"}),e.jsx("span",{children:s.pnn50.toFixed(2)})]}),e.jsxs("p",{children:[e.jsx("span",{children:"TP (ms2)"}),e.jsx("span",{children:s.tp.toFixed(2)})]}),e.jsxs("p",{children:[e.jsx("span",{children:"LFnorm"}),e.jsx("span",{children:s.lfnorm.toFixed(2)})]}),e.jsxs("p",{children:[e.jsx("span",{children:"HFnorm"}),e.jsx("span",{children:s.hfnorm.toFixed(2)})]}),e.jsxs("p",{children:[e.jsx("span",{children:"LF/HF"}),e.jsx("span",{children:s.lfDivideHf.toFixed(2)})]})]}),e.jsxs("p",{className:"warnText text-nowrap",children:[e.jsx("i",{className:"el-icon-warning-outline"}),"人员扫码后, 基值采集大概需要1分钟左右"]})]}),e.jsxs("div",{className:"bottomcenter",children:[e.jsx("div",{className:"line",children:e.jsx(_,{option:$(j,"HRV曲线图")})}),e.jsxs("div",{className:"charts",children:[e.jsx("div",{className:"common pie",children:e.jsx(T,{option:L(F(s.pnn50.toFixed(2)),"PNN50饼状图")})}),e.jsx("div",{className:"common splashes",children:e.jsx(D,{option:z(l,"Poincare散点图")})}),e.jsx("div",{className:"common bar",children:e.jsx(k,{option:E([Number(s.lfnorm).toFixed(0),Number(s.hfnorm).toFixed(0)],["LFnorm","HFnorm"],"LF/HF柱状图")})})]})]}),e.jsx("div",{className:"bottomright",children:e.jsx(B,{option:O(H(s))})})]})]})})});V.displayName="VRMonitor";export{V as default};
