import{p as S,r as o,t as Y,d as r,g as p,j as e}from"./index-CKIL6d0V.js";import{G as h,S as y}from"./index-CP5om1e5.js";import{L as P}from"./index-BBmyp6e2.js";import{P as w}from"./index-ByXZCobc.js";import{d as I,a as C,b as _,B as T,c as k,e as R,f as B}from"./chartsConfig-B08bcqCP.js";import{R as $}from"./index-B2ZyvyaB.js";const L=S.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;
      }
    }
  }

`,z=o.memo(()=>{const{token:t}=Y.useToken(),[d,u]=o.useState(0),[g,j]=o.useState([]),[N,D]=o.useState([]),[l,v]=o.useState([{id:1,pNum:1011,pAge:18,pName:"演示一",pSexDesc:"女",currentDate:r().format("YYYY-MM-DD"),currentTime:r().format("HH:mm:ss")},{id:2,pNum:10112,pAge:18,pName:"演示二",pSexDesc:"女",currentDate:r().format("YYYY-MM-DD"),currentTime:r().format("HH:mm:ss")}]),[s,m]=o.useState({cognitiveStress:1,createTime:r().format("YYYY-MM-DD HH:mm:ss"),currentDate:r().format("YYYY-MM-DD HH:mm:ss"),currentTime:r().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:[]}),x=o.useCallback(async()=>{const a=await p("/api/Person/PersonZonePoint_vr");if(a.code===200&&a.data.length>0){v(a.data);const i=await p("/api/PsyIndicator/All",{PersonID:a.data[d].id,pageIndex:1,pageSize:9999}),n=await p("/api/PsyIndicator/5minMeanHr",{PersonID:a.data[d].id}),f=await p("/api/PsyIndicator/Get1minRR",{PersonID:a.data[d].id});if(i.code===200&&i.data.items.length>0?m(i.data.items[0]):m({cognitiveStress:0,createTime:r().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 F=n.data.split(",").map(M=>Number(M).toFixed(2));j(F)}f.code===200&&D(f.data)}else m({cognitiveStress:Math.ceil(Math.random()*3),createTime:r().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:[]}),j([95.27,93.34,91.96,91.46,87.77,85.86,85.19,86.36,87.13,86.75,86.52,87.86])},[d]);o.useEffect(()=>{x();const a=setInterval(()=>{x()},2e4);return()=>{clearInterval(a)}},[x]);const c=(a,i)=>{let n=0;return i==="情绪稳定性"?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,B(n,i)},H=a=>[a.jinZhang,a.focus_State,a.energy_State,a.fatigue_State,a.cognitiveStress],b=a=>[{value:a,name:"PNN50"},{value:100-a,name:"其他"}];return e.jsx(L,{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:"姓 名"})]}),l.map((a,i)=>e.jsxs("li",{className:`items col ${d===i?"select":""}`,onClick:n=>u(i),title:a.pNum,children:[e.jsx("span",{className:"item",children:i+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:l[d].pNum})]}),e.jsxs("p",{children:[e.jsx("span",{children:"姓 名 : "}),e.jsx("span",{children:l[d].pName})]}),e.jsxs("p",{children:[e.jsx("span",{children:"性 别 : "}),e.jsx("span",{children:l[d].pSexDesc})]}),e.jsxs("p",{children:[e.jsx("span",{children:"年 龄 : "}),e.jsx("span",{children:r().diff(l[d].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(h,{option:c(s.jinZhang,"情绪稳定性")})}),e.jsx("div",{className:"panel",children:e.jsx(h,{option:c(s.cognitiveStress,"脑力应激")})}),e.jsx("div",{className:"panel",children:e.jsx(h,{option:c(s.fatigue_State,"疲劳度")})}),e.jsx("div",{className:"panel",children:e.jsx(h,{option:c(s.energy_State,"兴奋度")})}),e.jsx("div",{className:"panel",children:e.jsx(h,{option:c(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(P,{option:I(g,"HRV曲线图")})}),e.jsxs("div",{className:"charts",children:[e.jsx("div",{className:"common pie",children:e.jsx(w,{option:C(b(s.pnn50.toFixed(2)),"PNN50饼状图")})}),e.jsx("div",{className:"common splashes",children:e.jsx(y,{option:_(N,"Poincare散点图")})}),e.jsx("div",{className:"common bar",children:e.jsx(T,{option:k([Number(s.lfnorm).toFixed(0),Number(s.hfnorm).toFixed(0)],["LFnorm","HFnorm"],"LF/HF柱状图")})})]})]}),e.jsx("div",{className:"bottomright",children:e.jsx($,{option:R(H(s))})})]})]})})});z.displayName="VRMonitor";export{z as default};
