<template>
  <div class="plate-box">
    <h2 class="DetailsTit">
      <span>{{ title }}</span>
    </h2>
    <div style="width:100%;overflow:hildden;overflow-x:auto;">
      <table class="table" style="">
        <tr>
          <th v-if="isShow('监测时间')" width="124px">时间</th>
          <th v-if="isShow('体温')" width="72px">体温(℃)</th>
          <th v-if="isShow('血压')" width="72px">血压(mmHg)</th>
          <th v-if="isShow('脉搏')" width="80px">脉搏(次/分)</th>
          <th v-if="isShow('呼吸频率')" width="110px">呼吸频率(次/分)</th>
          <th width="76px">静脉压/动脉压({{monitores[0]&&monitores[0]['venous_pressure_type'] == 2 ? 'kpa' : 'mmHg'}})</th>
          <th v-if="isShow('血流量')" width="92px">血流量(ml/min)</th>
          <th v-if="isShow('跨膜压')" width="76px">跨膜压({{monitores[0]&&monitores[0]['transmembrane_pressure_type'] == 2 ? 'kpa' : 'mmHg'}})</th>
          <th v-if=" isShow('超滤量') &&(template_id == 6 || template_id == 9 || template_id == 10 || template_id == 11 || template_id == 13 || template_id == 17 || template_id == 18 || template_id == 19 || template_id == 20 || template_id == 21 || template_id == 22 || template_id == 23 || template_id == 24 || template_id == 26 || template_id == 27 || template_id == 28 || template_id == 29 || template_id == 30 || template_id == 31 || template_id == 32 || template_id == 34 || template_id == 35 || template_id == 36 || template_id == 38 || template_id == 39 || template_id == 40  || template_id == 41 || template_id == 43 || template_id == 44 || template_id == 46 || template_id == 47 || template_id == 48 || this.$store.getters.xt_user.template_info.org_id == 9555 || template_id == 53 || template_id == 54 || template_id == 56)" width="76px" > 超滤量(ml)</th>
          <th v-if=" isShow('超滤量') && template_id != 6 && template_id != 9 && template_id != 10 && template_id != 11 && template_id != 13 && template_id != 17 && template_id != 18 && template_id != 19 && template_id != 20 && template_id != 21 && template_id != 22 && template_id != 23 && template_id != 24 && template_id != 26 && template_id !=27 && template_id!=28 && template_id!=29 && template_id!=30 && template_id!=31 && template_id!=32 && template_id!=34 && template_id!=35 && template_id!=36 && template_id!=38 && template_id != 39 && template_id != 40  && template_id != 41 && template_id != 43 && template_id != 44 && template_id != 46  && template_id != 47 && template_id != 48 && template_id != 53  && template_id != 54  && template_id != 56 && this.$store.getters.xt_user.template_info.org_id != 9555"  width="76px"> 超滤量(L) </th>
          <th v-if="isShow('超滤率') && (template_id ==6 || template_id == 10 || template_id == 11 || template_id == 12 || template_id == 13 || template_id == 17 || template_id == 18 || template_id == 19 || template_id == 20 || template_id == 21 || template_id == 22 || template_id == 23 || template_id == 24 || template_id == 26 || template_id == 29 || template_id == 30 || template_id == 31 || template_id == 34 || template_id == 35 || template_id == 38 || template_id == 41 || template_id == 43 || template_id == 44 || template_id == 46 || template_id == 47  || template_id == 48  || template_id == 53 || template_id == 54 || template_id == 56)" width="50px"> 超滤率 <br />(ml/h) </th>
          <th v-if="isShow('超滤率') && template_id !=6 && template_id !=10 && template_id !=11 && template_id !=12 && template_id !=13 && template_id !=17 && template_id !=18 && template_id !=19 && template_id !=20 && template_id !=21 && template_id !=22 && template_id !=23 && template_id !=24 && template_id !=26 && template_id !=29 && template_id !=30 && template_id !=31 && template_id !=34 && template_id !=35 && template_id !=38  && template_id !=41 && template_id !=43 && template_id !=44 && template_id !=46 && template_id !=47 &&  template_id !=48 &&  template_id !=53 &&  template_id !=54 &&  template_id !=56" width="50px"> 超滤率 <br />(L/h) </th>
          <th v-if="isShow('钠浓度')" width="92px">钠浓度(mmol/L)</th>
          <th v-if="isShow('透析液温度')" width="92px">透析液温度(℃)</th>
          <th v-if=" isShow('置换率') && (template_id == 6 || template_id == 10 || template_id == 11 || template_id == 20 || template_id == 26 || template_id == 29 || template_id == 46 || template_id == 47 || template_id == 48 || template_id == 53  || template_id == 54 || template_id == 56) " width="92px" > 置换率(ml/min) </th>
          <th v-if=" isShow('置换率') && template_id != 6 && template_id != 10 && template_id != 11 && template_id != 20 && template_id != 26 && template_id != 29 && template_id != 46 && template_id != 47 && template_id != 48 && template_id != 53 && template_id != 54 && template_id != 56" width="92px" > 置换率(L/h)  </th>
          <th v-if=" isShow('置换量') && (template_id == 43)" width="92px"> 置换量(ml/h)  </th>
          <th v-if=" isShow('置换量') && ((template_id == 6 && org_id != 9919 && org_id !=10191) || org_id == 9779 || template_id == 11 || template_id == 20 || template_id == 26 || template_id == 29 || template_id == 46 || template_id == 48 || template_id == 53 || template_id == 54 || template_id == 56)" width="92px"  > 置换量(ml)  </th>
          <th v-if=" isShow('置换量') && ((template_id != 6 || org_id == 9919 || org_id == 10191) && org_id != 9779 && template_id != 11 && template_id != 20 && template_id != 26 && template_id != 29 && template_id != 46 && template_id != 48 && template_id != 53 && template_id != 54 && template_id != 56)" width="92px" > 置换量(L) </th>
          <th v-if=" isShow('SpO₂') && template_id != 6 && template_id != 10 && template_id != 11  " width="92px" > SpO₂(%) </th>
          <th v-if="isShow('电导度')" width="92px">电导度(mS/m)</th>
          <th v-if="isShow('置换液流量') && template_id != 27" width="92px">置换液流量(ml/h)</th>
          <th v-if="isShow('置换液流量') && template_id == 27" width="92px">置换液流量(ml/min)</th>
          <th v-if="isShow('透析液流量')" width="92px">透析液流量(ml/h)</th>
          <th v-if="isShow('肝素用量余量')" width="92px">肝素用量余量(ml)</th>
          <th v-if="isShow('抗凝剂')" width="92px">抗凝剂</th>
          <th v-if="isShow('累计血容量')" width="92px">累计血容量 
            <span v-if="template_id !=41">(ml)</span>
            <span v-if="template_id == 41">(L)</span>
          </th>
          <th v-if="isShow('血容量')" width="92px">血容量(L)</th>
          <th v-if="isShow('血温监测')" width="92px">血温监测</th>
          <th v-if="isShow('尿素监测')" width="92px">尿素监测</th>
          <th v-if="isShow('血浓量')" width="92px">血浓量</th>
          <th v-if="isShow('血压监测')" width="92px">血压监测</th>
          <th v-if="isShow('肝素量')" width="92px">肝素量(mg)</th>
          <th v-if="isShow('脱水')" width="92px">脱水(L)</th>
          <th v-if="isShow('KT/V') && (org_id == 9987 || org_id == 10215 || org_id ==  9800)" width="92px">KT/V</th>
          <th v-if="isShow('病情变化')" width="92px">病情变化</th>

          <th v-if="isShow('处理')" width="92px">处理</th>
          <th v-if="isShow('结果')" width="92px">结果</th>
        </tr>
        <tr v-for="(monitor, index) in monitores" :key="index">
          <td v-if="isShow('监测时间')"> {{ parseTime(monitor.operate_time, "{y}-{m}-{d} {h}:{i}") }} </td>
          <td v-if="isShow('体温')"> {{ monitor.temperature ? monitor.temperature : "" }} </td>
          <td v-if="isShow('血压')"> {{ monitor.systolic_blood_pressure ? monitor.systolic_blood_pressure : "" }}/{{ monitor.diastolic_blood_pressure ? monitor.diastolic_blood_pressure : "" }} </td>
          <td v-if="isShow('脉搏')"> {{ monitor.pulse_frequency ? monitor.pulse_frequency : "" }} </td>
          <td v-if="isShow('呼吸频率')"> {{ monitor.breathing_rate ? monitor.breathing_rate : "" }} </td>
          <td> {{ monitor.venous_pressure ? monitor.venous_pressure : "" }} /{{ monitor.arterial_pressure ? monitor.arterial_pressure : "" }}  </td>

          <td v-if="isShow('血流量')"> {{ monitor.blood_flow_volume ? monitor.blood_flow_volume : "" }} </td>
          <td v-if="isShow('跨膜压')"> {{ monitor.transmembrane_pressure ? monitor.transmembrane_pressure : "" }} </td>
          <td v-if="isShow('超滤量')"> {{ monitor.ultrafiltration_volume ? monitor.ultrafiltration_volume : "" }} </td>
          <td v-if="isShow('超滤率')" >{{monitor.ultrafiltration_rate?monitor.ultrafiltration_rate:''}}</td>
          <td v-if="isShow('钠浓度')"> {{ monitor.sodium_concentration ? monitor.sodium_concentration : "" }} </td>
          <td v-if="isShow('透析液温度')"> {{ monitor.dialysate_temperature ? monitor.dialysate_temperature : "" }} </td>
          <td v-if="isShow('置换率')"> {{ monitor.replacement_rate ? monitor.replacement_rate : "" }} </td>
          <td v-if="isShow('置换量')"> {{ monitor.displacement_quantity ? monitor.displacement_quantity : "" }} </td>
          <td v-if="isShow('SpO₂')"> {{ monitor.blood_oxygen_saturation ? monitor.blood_oxygen_saturation : "" }} </td>
          <td v-if="isShow('电导度')"> {{ monitor.conductivity ? monitor.conductivity : "" }} </td>
          <td v-if="isShow('置换液流量')"> {{ monitor.displacement_flow_quantity  ? monitor.displacement_flow_quantity : "" }} </td>
          <td v-if="isShow('透析液流量')"> {{ monitor.dialysate_flow  ? monitor.dialysate_flow : "" }} </td>
          <td v-if="isShow('肝素用量余量')"> {{ monitor.heparin ? monitor.heparin : "" }} </td>
          <td v-if="isShow('抗凝剂')">
            <span v-if="monitor.monitor_anticoagulant == 1">无肝素</span>
            <span v-if="monitor.monitor_anticoagulant == 2">普通肝素</span>
            <span v-if="monitor.monitor_anticoagulant == 3">低分子肝素</span>
            <span v-if="monitor.monitor_anticoagulant == 4">阿加曲班</span>
            <span v-if="monitor.monitor_anticoagulant == 5">枸橼酸钠</span>
            <span v-if="monitor.monitor_anticoagulant == 6">低分子肝素钙</span>
            <span v-if="monitor.monitor_anticoagulant == 7">低分子肝素钠</span>
            <span v-if="monitor.monitor_anticoagulant == 8">依诺肝素</span>
            <span v-if="monitor.monitor_anticoagulant == 9">达肝素</span>
            <span v-if="monitor.monitor_anticoagulant == 12">无抗凝剂</span>
            <span v-if="monitor.monitor_anticoagulant_value!=''">（{{monitor.monitor_anticoagulant_value ? monitor.monitor_anticoagulant_value : ""  }}）</span>
          </td>
          <th v-if="isShow('累计血容量')" width="92px">{{monitor.accumulated_blood_volume ? monitor.accumulated_blood_volume : ""}}</th>
          <th v-if="isShow('血容量')" width="92px">{{monitor.accumulated_blood_volume ? monitor.accumulated_blood_volume : ""}}</th>
          <th v-if="isShow('血温监测')" width="92px">{{monitor.blood_temperature ? monitor.blood_temperature : ""}}</th>
          <th v-if="isShow('尿素监测')" width="92px">{{monitor.urea_monitoring ? monitor.urea_monitoring : ""}}</th>
          <th v-if="isShow('血浓量')" width="92px">{{monitor.blood_thickness ? monitor.blood_thickness : ""}}</th>
          <th v-if="isShow('血压监测')" width="92px">{{monitor.blood_monitor ? monitor.blood_monitor : ""}}</th>
          <th v-if="isShow('肝素量')" width="92px">{{monitor.heparin_amount ? monitor.heparin_amount : ""}}</th>
          <th v-if="isShow('脱水')" width="92px">{{monitor.dehydration ? monitor.dehydration : ""}}</th>
          <td v-if="isShow('KT/V') && (org_id == 9987 || org_id == 10215 || org_id ==  9800)">{{ monitor.ktv?monitor.ktv:""}}</td>
          <td v-if="isShow('病情变化')">{{ monitor.symptom }}</td>
          <td v-if="isShow('处理')">{{ monitor.dispose }}</td>
          <td v-if="isShow('结果')">{{ monitor.result }}</td>
        </tr>
      </table>
    </div>
    <div class="middleLine"></div>
  </div>
</template>

<script>
import store from '@/store'
import { parseTime } from '@/utils'
import { getDataConfig } from '@/utils/data'
export default {
  name: 'statOrder',
  data() {
    return {
      title: '透析监测 ',
      template_id: 0
    }
  },
  props: {
    monitores: {
      type: Array
    }
  },
  created() {
    this.template_id = this.$store.getters.xt_user.template_info.template_id
    this.org_id = this.$store.getters.xt_user.template_info.org_id
  },
  methods: {
    parseTime(time, layout) {
      return parseTime(time, layout)
    },
    isShow(name) {
      var filedList = store.getters.xt_user.fileds
      for (let i = 0; i < filedList.length; i++) {
        if (filedList[i].module == 4 && filedList[i].filed_name_cn == name && filedList[i].is_show === 1) {
          return true
        }
      }
      return false
    },
    getBloodPressure(id){
       var bloodPressureMmonitoringSite = getDataConfig('hemodialysis','blood_pressure_monitoring_site')
       var name = ""
       for(let i=0;i<bloodPressureMmonitoringSite.length;i++){
         if(id == bloodPressureMmonitoringSite[i].id){
            name = bloodPressureMmonitoringSite[i].name
         }
       }
       return name
    },
    getComplication(id){
      var complication = getDataConfig('hemodialysis','complication')
      var name = ""
      for(let i=0;i<complication.length;i++){
         if(id == complication[i].id){
            name = complication[i].name
         }
      }
      return name
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.table {
  width: 1500px;
  overflow: auto;
  font-size: 14px;
  text-align: center;
  border: $border-color;
  padding-bottom: 2px;
  tr {
    padding: 0;
    margin: 0;
    padding: 10px 0;
    th {
      background: $main-color;
      border: none;
      color: #fff;
      padding: 0;
      margin: 0;
      height: 44px;
      font-weight: normal;
      padding: 18px 0;
    }
    td {
      background: #f0f5fa;
      border: none;
      padding: 18px 0;
    }
  }
}
</style>
