<template>
<!--  -->
  <el-table :data="dailyReport" :row-class-name="tableRowClassName" style="width: 100%" >
    <el-table-column prop="dailyreportid" style="width: 1px" v-if=false type="dailyreportid"></el-table-column>
    <el-table-column prop="error" style="width: 1px" v-if=false type="error"></el-table-column>
    <el-table-column prop="date" label="日期" sortable />
    <el-table-column prop="temperature" label="体温" />
    <el-table-column prop="highpressure" label="高压" />
    <el-table-column prop="lowpressure" label="低压" />
    <el-table-column prop="heartRate" label="脉率" />
    <el-table-column prop="covidTest" label="核酸检测结果" :formatter="formatTest"/>

  </el-table>
</template>

<script>
import request from "@/utils/request";

export default {
  name: "DoctorViewDailyReport",
  props:["msg"],
  created() {
    this.userid = this.msg;
    this.loadDailyReport();
  },
  data(){
    return{
      userid: "",
      dailyReport:[

  ],

    }
  },
  methods:{
    loadDailyReport(){

      //将数据库数据呈现出来
      var arr = this;
      request.get('/dailyReport/selectByUserid',{
        params:{userid:this.userid}
      }).then(res=>{
        arr.dailyReport=res.data;
      })
    },
    tableRowClassName({row}) {
      //健康上报异常的条件
      if (row.error === 1) {
        return "dangerousPatient";
      }
      else{
        return "normalPatient";
      }
    },
    formatTest(row){
      if(row.covidTest === false){
        return "阴"
      }
      else{
        return "阳"
      }
    }
  }
}
</script>

<style>
.el-table .dangerousPatient{
  background: #ff3700;
}
.el-table .normalPatient{
  background: #F2F6FC;
}
</style>