<template>
  <div class="plate-box">
    <h2 class="title">
      <span class="line"></span>
      <p>{{ title }}</p>
      <span class="line"></span>
    </h2>
    <div class="plate">
      <ul>
        <li v-if="isShow('上机床位')">
          <label>上机床位 :</label>
          <span class="content">{{ device_number }}</span>
        </li>
        <li v-if="isShow('上机护士') && org_id!=10721">
          <label>上机护士 :</label>
          <span class="content">{{ nurse }}</span>
        </li>

        <li v-if="isShow('上机护士') && org_id==10721">
          <label>治疗护士 :</label>
          <span class="content">{{ nurse }}</span>
        </li>

        <li v-if="isShow('穿刺者')">
          <label>穿刺者 :</label>
          <span class="content">{{ puncture_nurse }}</span>
        </li>

        <li v-if="isShow('冲管护士')">
          <label>冲管护士 :</label>
          <span class="content">{{ washpipe_nurse }}</span>
        </li>

       <li v-if="isShow('换药护士')">
          <label>换药护士 :</label>
          <span class="content">{{ change_nurse }}</span>
        </li>

        <li v-if="isShow('疑难穿刺护士')">
          <label>疑难穿刺护士 :</label>
          <span class="content">{{ difficult_puncture_nurse }}</span>
        </li>

        <li v-if="isShow('新开瘘护士')">
          <label>新开瘘护士 :</label>
          <span class="content">{{ new_fistula_nurse }}</span>
        </li>

        <li v-if="isShow('质控护士')">
          <label>质控护士 :</label>
          <span class="content">{{ quality_nurse_id }}</span>
        </li>

        <li v-if="isShow('穿刺针')">
          <label>穿刺针 :</label>
          <span class="content">{{ record.puncture_needle }}</span>
        </li>

          <li v-if="isShow('穿刺方法')">
          <label>穿刺方法 :</label>
          <span class="content">{{ record.puncture_method }}</span>
        </li>

         <li v-if="isShow('透析器')">
          <label>透析器 :</label>
          <span class="content">{{ record.dialysis_dialyszers }}</span>
        </li>

        <li v-if="isShow('灌流器')">
          <label>灌流器 :</label>
          <span class="content">{{ record.dialysis_irrigation }}</span>
        </li>

        <li v-if="isShow('血滤器')">
          <label>血滤器 :</label>
          <span class="content">{{ record.dialysis_strainer }}</span>
        </li>

        <li v-if="isShow('血管通路')">
          <label>血管通路 :</label>
          <span class="content">{{blood_access_id }}</span>
        </li>

        <li v-if="isShow('排班备注')">
          <label>排班备注 :</label>
          <span class="content">{{record.schedule_remark }}</span>
        </li>

       <li v-if="isShow('上机备注')">
          <label>上机备注 :</label>
          <span class="content">{{record.order_remark }}</span>
        </li>

        <li v-if="isShow('上机时间')">
          <label>上机时间 :</label>
          <span class="content" style="font-size: 0.34rem">{{
            start_time
          }}</span>
        </li>

        <li v-if="isShow('导管备注')">
          <label>导管备注 :</label>
          <span class="content" style="font-size: 0.34rem">{{
            catheter_operation
          }}</span>
        </li>

 
        <li>
          <label>状态 :</label>
          <span class="content">{{ stage }}</span>
        </li>

        <li v-if="isShow('血流量')">
          <label>血流量(ml/min) :</label>
          <span class="content" style="font-size: 0.34rem">{{
            blood_flow_volume
          }}</span>
        </li>
      </ul>
    </div>
    <!-- <div class="note">处方医生 : {{doctor}}</div> -->
  </div>
</template>

<script>
import { parseTime } from '@/utils'
import {getDataConfig} from '@/utils/data'
export default {
  name: 'DialysisComputer',
  data () {
    return {
      title: '透析上机 ',
      org_id:0,
    }
  },
  props: {
    record: {
      type: Object
    },
    admin_map: {
      type: Object
    },
    device_number_map: {
      type: Object
    }
  },
  computed: {
    device_number: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.device_number_map[this.record.bed_id] == null ? '' : this.device_number_map[this.record.bed_id].zone_name + '-' + this.device_number_map[this.record.bed_id].number
    },
    nurse: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.admin_map[this.record.start_nurse] == null
        ? ''
        : this.admin_map[this.record.start_nurse].name
    },
    stage: function () {
      if (this.record == null || this.record.id == '') {
        return '未上机'
      }
      return this.record.stage == 1 ? '已上机' : '已下机'
    },
    start_time: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return parseTime(this.record.start_time, '{y}年{m}月{d}日 {h}时{i}分')
    },
    puncture_nurse: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.admin_map[this.record.puncture_nurse] == null
        ? ''
        : this.admin_map[this.record.puncture_nurse].name
    },
    washpipe_nurse: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.admin_map[this.record.washpipe_nurse] == null
        ? ''
        : this.admin_map[this.record.washpipe_nurse].name
    },
    change_nurse: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.admin_map[this.record.change_nurse] == null
        ? ''
        : this.admin_map[this.record.change_nurse].name
    },
    difficult_puncture_nurse: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.admin_map[this.record.difficult_puncture_nurse] == null
        ? ''
        : this.admin_map[this.record.difficult_puncture_nurse].name
    },
    new_fistula_nurse: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.admin_map[this.record.new_fistula_nurse] == null
        ? ''
        : this.admin_map[this.record.new_fistula_nurse].name
    },
    quality_nurse_id: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.admin_map[this.record.quality_nurse_id] == null
        ? ''
        : this.admin_map[this.record.quality_nurse_id].name
    },
    blood_access_id: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      var name = ''
      var list = getDataConfig('hemodialysis', 'vascular_access_desc')
      for (let i = 0; i < list.length; i++) {
        if (this.record.blood_access_id == list[i].id) {
          name = list[i].name
        }
      }
      return name
    },
    catheter_operation:function(){
      if (this.record == null || this.record.id == '') {
        return ''
      }else{
        return this.record.catheter_operation
      }
    },
    blood_flow_volume:function(){
      if (this.record == null || this.record.id == '') {
        return ''
      }else{
        return this.record.blood_flow_volume
      }
    }
  },
  methods: {
    isShow (name) {
      var filedList = this.$store.getters.user.fileds
      for (let i = 0; i < filedList.length; i++) {
        if (
          filedList[i].module == 7 &&
          filedList[i].filed_name_cn == name &&
          filedList[i].is_show == 1
        ) {
          return true
        }
      }
      return false
    }
  },
  created(){
    this.org_id = this.$store.getters.user.template_info.org_id;
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped></style>
