<template>
  <div class="plate-box">
    <h2 class="DetailsTit"><span>{{ title }}</span></h2>
    <div class="plate ">
      <ul>
        <li v-if="isShow('班次')">
          <label>班次 : </label>
          <span class="content">{{ schedual_type }}</span>
        </li>
        <li v-if="isShow('上机床位')">
          <label>上机床位 : </label>
          <span class="content">{{ device_number }}</span>
        </li>
        <li v-if="isShow('上机护士')">
          <label>上机护士 : </label>
          <span class="content">{{ nurse }}</span>
        </li>
      </ul>
      <ul>
        <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_way }}</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">{{ blood_access_id }}</span>
        </li>
        <li>
          <label>状态 : </label>
          <span class="content">{{ stage }}</span>
        </li>
      </ul>
      <ul>
        <li v-if="isShow('核酸检测日期')">
          <label>核酸检测日期 : </label>
          <span class="content">{{getTimeOne(this.record.nuclein_date)}}</span>
        </li>
      </ul>
      <ul>
        <li v-if="isShow('排班备注')">
          <label>排班备注 : </label>
          <span class="content">{{this.record.schedule_remark}}</span>
        </li>
      </ul>
      <ul>
        <li v-if="isShow('上机备注')">
          <label>上机备注 : </label>
          <span class="content">{{this.record.order_remark}}</span>
        </li>
      </ul>
      <ul>
        <li v-if="isShow('上机时间')">
          <label>上机时间 : </label>
          <span class="content">{{start_time}}</span>
        </li>
      </ul>
      <ul>
        <li v-if="isShow('导管操作')">
          <label>导管操作 : </label>
          <span class="content">{{catheter_operation}}</span>
        </li>
      </ul>
    </div>
    <div class="middleLine"></div>
  </div>
</template>

<script>
  import { uParseTime } from '@/utils/tools'
  import { parseTime } from '@/utils'
  import store from '@/store'
  import { getDataConfig } from '@/utils/data'
  export default {
    name: 'DialysisComputer',
    data() {
      return {
        title: '透析上机 '
      }
    },
    props: {
      record: {
        type: Object
      },
      admin_map: {
        type: Object
      },
      device_number_map: {
        type: Object
      }
    },
    computed: {
      schedual_type: function() {

        if (this.record.id == 0) {
          return '-'
        }

        switch (this.record.schedual_type) {
          case 1:
            return '上午'
            break
          case 2:
            return '下午'

            break
          case 3:
            return '晚上'

            break

        }

      },
      device_number: function() {
        if (this.record.id == 0) {
          return '-'
        }

        if (this.device_number_map[this.record.bed_id].number.indexOf(this.device_number_map[this.record.bed_id].zone_name) == -1) {

          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

        } else {

          return this.device_number_map[this.record.bed_id].number

        }

      },
      nurse: function() {
        if (this.record.id == 0) {
          return '-'
        }
        return this.admin_map[this.record.start_nurse] == null ? '' : this.admin_map[this.record.start_nurse].name
      },
      stage: function() {
        if (this.record.id == 0) {
          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.id == 0) {
          return '-'
        }
        return this.admin_map[this.record.puncture_nurse] == null ? '' : this.admin_map[this.record.puncture_nurse].name
      },
       washpipe_nurse: function() {
        if (this.record.id == 0) {
          return '-'
        }
        return this.admin_map[this.record.washpipe_nurse] == null ? '' : this.admin_map[this.record.washpipe_nurse].name
      },
      change_nurse:function(){
         if (this.record.id == 0) {
          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.id == 0) {
          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.id == 0) {
          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.id == 0) {
          return '-'
        }
        return this.admin_map[this.record.quality_nurse_id] == null ? '' : this.admin_map[this.record.quality_nurse_id].name
      },
      blood_access_id:function(){
        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.id == 0){
          return '-'
        }else{
          return this.record.catheter_operation
        }
       
      }
    },
    methods: {
      isShow(name) {
        var filedList = store.getters.xt_user.fileds
        var arr = []
        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
      },
      getTimeOne(val) {
        if(val == ""){
        return ""
        }else {
        return uParseTime(val, '{y}-{m}-{d}')
        }
       },

    }
  }
</script>

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



