<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">{{ weight_before ? weight_before : "" }}</span>
          <span class="unit">{{ weight_before ? "kg" : "" }}</span>
        </li>
         <li v-if="isShow('透前体重备注')">
          <label>透前体重备注 : </label>
          <span class="content">{{ this.record.weight_befor_remake ? this.record.weight_befor_remake : "" }}</span>
        </li>
        <li v-if="this.$store.getters.user.template_info.template_id == 6">
          <label>透前净体重 : </label>
          <span
            class="content">{{ weight_before ? parseFloat(weight_before - additional_weight).toFixed(1) : "" }}</span>
          <span class="unit">{{ weight_before ? "kg" : "" }}</span>
        </li>
        <li v-if="isShow('收缩压')">
          <label>收缩压 : </label>
          <span class="content">{{
            systolic_blood_pressure ? systolic_blood_pressure : ""
          }}</span>
          <span class="unit">{{ systolic_blood_pressure ? "mmHg" : "" }}</span>
        </li>

        <li v-if="isShow('舒张压')">
          <label>舒张压 : </label>
          <span class="content">{{
            diastolic_blood_pressure ? diastolic_blood_pressure : ""
          }}</span>
          <span class="unit">{{ diastolic_blood_pressure ? "mmHg" : "" }}</span>
        </li>

        <li v-if="isShow('前次透析后')">
          <label>前次透析后: </label>
          <span class="content">{{ last_post_dialysis }}</span>
          <span class="unit"></span>
        </li>
        <li v-if="isShow('导管打折')">
          <label>导管打折 : </label>
          <span class="content" v-if="this.record.catheter_bend == 1">{{ '有' }}</span>
          <span class="content" v-if="this.record.catheter_bend == 2">{{ '无' }}</span>

          <span class="unit"></span>
        </li>

        <li v-if="isShow('导管')">
          <label>导管 : </label>
          <span class="content">{{ catheter }}</span>
          <span class="unit"></span>
        </li>
        <li v-if="isShow('衣物重')">
          <label>衣物重 : </label>
          <span class="content">{{
            additional_weight ? additional_weight : ""
          }}</span>
          <span class="unit">{{ additional_weight ? "kg" : "" }}</span>
        </li>
        <li v-if="isShow('干体重')">
          <label>干体重 : </label>
          <span class="content">{{ dry_weight ? dry_weight : "" }}</span>
          <span class="unit">{{ dry_weight ? "kg" : "" }}</span>
        </li>
        <li v-if="isShow('透析期间')">
          <label>透析期间 : </label>
          <span class="content">{{ dialysis_interphase }}</span>
          <span class="unit"></span>
        </li>

        <!-- </ul>
      <ul> -->
        <li v-if="isShow('体温')">
          <label>体温 : </label>
          <span class="content">{{ temperature ? temperature : "" }}</span>
          <span class="unit">{{ temperature ? "℃" : "" }}</span>
        </li>
        <li v-if="isShow('脉搏')">
          <label>脉搏 : </label>
          <span class="content">{{
            pulse_frequency ? pulse_frequency : ""
          }}</span>
          <span class="unit">{{ pulse_frequency ? "次/分" : "" }}</span>
        </li>

        <li v-if="isShow('呼吸频率')">
          <label>呼吸频率 : </label>
          <span class="content">{{
            breathing_rate ? breathing_rate : ""
          }}</span>
          <span class="unit">{{ breathing_rate ? "次/分" : "" }}</span>
        </li>
        <li v-if="isShow('透析前症状')">
          <label>透析前症状 : </label>
          <span class="content">{{ symptom_before_dialysis }}</span>
          <span class="unit"></span>
        </li>

        <li v-if="isShow('透析前状态其他')">
          <label>透析前状态其他 : </label>
          <span class="content">{{ symptom_before_dialysis_other }}</span>
          <span class="unit"></span>
        </li>
        <li v-if="isShow('出血')">
          <label>出血:</label>
          <span class="content">{{
            is_hemorrhage ? hemorrhage + ";" + hemorrhage_other : "无"
          }}</span>
          <span class="unit"> </span>
        </li>

        <li v-if="isShow('并发症')">
          <label>并发症: </label>
          <span class="content">{{ complication }}</span>
          <span class="unit"></span>
        </li>

        <li v-if="isShow('内瘘')">
          <label>内瘘: </label>
          <span class="content">{{ internal_fistula }}</span>
          <span class="unit"></span>
        </li>

        <li v-if="isShow('透析机型号')">
          <label>透析机型号: </label>
          <span class="content">{{ machine_type ? machine_type : "" }}</span>
          <span class="unit"></span>
        </li>

        <li v-if="isShow('透析频次')">
          <label>透析频次: </label>
          <span class="content">{{
            dialysis_count ? dialysis_count : ""
          }}</span>
          <span class="unit">{{ dialysis_count ? "次/周" : "" }}</span>
        </li>
        <li v-if="isShow('血管通路(内瘘)')">
          <label>血管通路(内瘘) : </label>
          <span class="content">{{ blood_access_internal_fistula }}</span>
        </li>
        <li v-if="isShow('血管杂音')">
          <label>血管杂音 : </label>
          <span class="content">{{
            getBloodAccessNoise(this.record.blood_access_noise)
          }}</span>
        </li>

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

        <li v-if="isShow('穿刺方式')">
          <label>穿刺方式 : </label>
          <!-- <span class="content">{{ getWay(this.record.puncture_way) }}</span> -->
          <span class="content">{{this.record.puncture_way}}</span>
        </li>

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

        <li v-if="isShow('穿刺点')">
          <label>穿刺点 : </label>
          <!-- <span class="content">{{ getWay(this.record.puncture_way) }}</span> -->
          <span class="content">{{this.record.point_puncture}}</span>
        </li>
        <li v-if="isShow('中心静脉置管')">
          <label>中心静脉置管:</label>
          <span class="content">{{
            getVenousCatheterization(this.record.venous_catheterization)
          }}</span>
          <span class="unit"> </span>
        </li>
        <!--
      </ul>

      <ul > -->
        <li v-if="isShow('位置')">
          <label>位置:</label>
          <span class="content">{{
            getVenousCatheterizationPart(
              this.record.venous_catheterization_part
            )
          }}</span>
          <span class="content">{{ venous_catheterization_part_other }}</span>
        </li>

        <li v-if="isShow('中心静脉导管')">
          <label>中心静脉导管: </label>
          <span class="content">{{ this.record.ductus_arantii }}</span>
        </li>

        <li v-if="isShow('导管其他')">
          <label>导管其他:</label>
          <span class="content">{{ ductus_arantii_other }}</span>
          <span class="unit"> </span>
        </li>

        <li v-if="isShow('急诊')">
          <label>急诊: </label>
          <span class="content">{{
            getEmergencyTreatment(this.record.emergency_treatment)
          }}</span>
          <span class="content">{{ emergency_treatment_other }}</span>
        </li>

        <li v-if="isShow('感染')">
          <label>感染:</label>
          <span class="content">{{
            this.record.is_infect == 1 ? "无" : "有"
          }}</span>
          <span class="unit"> </span>
        </li>

        <li v-if="isShow('其他感染情况')">
          <label>其他感染情况:</label>
          <span class="content">{{ infect_other }}</span>
          <span class="unit"> </span>
        </li>

        <li v-if="isShow('外露')">
          <label>外露:</label>
          <span class="content">{{
            this.record.exposed ? this.record.exposed : ""
          }}</span>
          <span class="unit">cm</span>
        </li>

        <li v-if="isShow('皮肤')">
          <label>皮肤:</label>
          <!-- <span class="content">{{ getSkin(this.record.skin) }}</span> -->
          <span class="content">{{ this.record.skin }}</span>
          <span class="unit"></span>
        </li>

        <li v-if="isShow('其他皮肤情况')">
          <label>其他皮肤情况:</label>
          <span class="content">{{ skin_other }}</span>
          <span class="unit"> </span>
        </li>

        <li v-if="isShow('血管通路操作')">
          <label>血管通路操作:</label>
          <span class="content">{{ getBloodAccessOpera(this.record.blood_access_part_opera_id) }}</span>
          <span class="unit"> </span>
        </li>

        <li v-if="isShow('体液过多症状')">
          <label>体液过多症状:</label>
          <span class="content">{{this.record.humor_excessive_symptom }}</span>
          <span class="unit"> </span>
        </li>

        <li v-if="isShow('血管通路操作')">
          <label>血管通路操作:</label>
          <span class="content">{{ getBloodAccessOpera(this.record.blood_access_part_opera_id) }}</span>
          <span class="unit"> </span>
        </li>

        <li v-if="isShow('血管通路皮肤情况')">
          <label>血管通路皮肤情况: </label>
          <span class="content">{{ internal_fistula_skin }}</span>
          <span class="unit"></span>
        </li>

        <li v-if="isShow('导管缝线')">
          <label>导管缝线: </label>
          <span class="content" >{{this.record.catheter_suture }},{{this.record.catheter_suture_other }}</span>
          <span class="unit"></span>
        </li>

        <li v-if="isShow('尿量')">
          <label>尿量(ml): </label>
          <span class="content">{{ this.record.urine_volume ? this.record.urine_volume : ''}}</span>
          <span class="unit" v-if="this.record.urine_volume ">ml</span>
        </li>

        <li v-if="isShow('水肿')">
          <label>水肿: </label>
          <span class="content">{{ this.record.edema}}</span>
          <span class="unit"></span>
        </li>

         <li v-if="isShow('血管通路部位')">
          <label>血管通路部位: </label>
          <span class="content">{{ this.record.blood_access_part_id}}</span>
          <span class="unit"></span>
        </li>

        <li v-if="isShow('血管通路')">
          <label>血管通路: </label>
          <span class="content">{{getBloodAccessOpera(this.record.blood_access_part_opera_id)}}</span>
          <span class="unit"></span>
        </li>

         <li v-if="isShow('特殊处理情况')">
          <label>特殊处理情况: </label>
          <span class="content">{{this.record.special_treatment}}</span>
          <span class="unit"></span>
        </li>

        <li v-if="isShow('导管维护')">
          <label>导管维护: </label>
          <span class="content">{{this.record.catheter_maintenance}}</span>
          <span class="unit"></span>
        </li>

        <li v-if="isShow('血栓')">
          <label>血栓: </label>
          <span class="content" v-if="this.record.thromubus_type == 0"></span>
          <span class="content" v-if="this.record.thromubus_type == 1">有</span>
          <span class="content" v-if="this.record.thromubus_type == 2">无</span>
          <span class="unit"></span>
        </li>

       <li v-if="isShow('血栓')">
          <label>导管AV端各约:</label>
          <span class="content">{{
            this.record.thrombus_av ? this.record.thrombus_av : ""
          }}</span>
          <span class="unit">cm</span>
        </li>

       <li v-if="isShow('血栓')">
          <label>导管A端约:</label>
          <span class="content">{{
            this.record.thromubus_a ? this.record.thromubus_a : ""
          }}</span>
          <span class="unit">cm</span>
        </li>

        <li v-if="isShow('血栓')">
          <label>导管V端约:</label>
          <span class="content">{{
            this.record.thromubus_v ? this.record.thromubus_v : ""
          }}</span>
          <span class="unit">cm</span>
        </li>

         <li v-if="isShow('透前尿素')">
          <label>透前尿素:</label>
          <span class="content">{{
            this.record.urea_befor ? this.record.urea_befor : ""
          }}</span>
           <span class="unit">mmol/L</span>
        </li>
         <li v-if="isShow('抽吸')">
          <label>抽吸:</label>
          <span class="content">{{
            this.record.suction ? this.record.suction : ""
          }}</span>
        </li>
        <li v-if="isShow('住院科室')">
          <label>住院科室:</label>
          <span class="content">{{
            this.record.his_department ? this.record.his_department : ""
          }}</span>
        </li>
         <li v-if="isShow('住院床位')">
          <label>住院床位:</label>
          <span class="content">{{
            this.record.his_bed ? this.record.his_bed : ""
          }}</span>
        </li>

        <li v-if="isShow('导管评估项目')">
          <label>导管评估项目:</label>
          <span class="content">{{
            this.record.catheter_evaluation_program ? this.record.catheter_evaluation_program : ""
          }}</span>
        </li>

        <li v-if="isShow('置管部位皮肤')">
          <label>置管部位皮肤:</label>
          <span class="content">{{
            this.record.skin_site_catheterization ? this.record.skin_site_catheterization : ""
          }}</span>
        </li>

        <li v-if="isShow('是否通畅')">
          <label>是否通畅:</label>
          <span class="content" v-if="this.record.whether_unobstructed == 0"></span>
          <span class="content" v-if="this.record.whether_unobstructed == 1">是</span>
          <span class="content" v-if="this.record.whether_unobstructed == 2">否</span>
        </li>

        <li v-if="isShow('留置必要')">
          <label>留置必要:</label>
          <span class="content" v-if="this.record.lien_necessary == 0"></span>
          <span class="content" v-if="this.record.lien_necessary == 1">是</span>
          <span class="content" v-if="this.record.lien_necessary == 2">否</span>
        </li>

        <li v-if="isShow('通路形成时间')">
          <label>通路形成时间:</label>
          <span class="content">{{this.getTime(this.record.pathway_formation_time) }}</span>
        
        </li>
        
        <li v-if="isShow('透前症状')">
          <label>透前症状:</label>
          <span class="content">{{this.record.befor_symptoms }}</span>
        
        </li>

        <li v-if="isShow('冲洗时间')">
          <label>q(h):</label>
          <span class="content">{{this.record.washing_time }}</span>
        
        </li>
        <li v-if="isShow('冲洗量')">
          <label>NS冲洗量(ml):</label>
          <span class="content">{{this.record.warsh_count }}</span>
        
        </li>

       
      </ul>
    </div>

    <div class="note">
      备注 : <span>{{ remark }}</span>
    </div>
  </div>
</template>

<script>
import { getDataConfig } from '@/utils/data'
import { uParseTime } from '@/utils/tools'
export default {
  name: 'assessmentBefore',

  data () {
    return {
      title: '透前评估 ',
      template_id: 0
    }
  },
  props: {
    record: {
      type: Object
    },
    dry_weights: {
      type: Object
    }
  },
  created () {
   
    this.template_id = this.$store.getters.user.template_info.template_id
  },
  computed: {
    internal_fistula_skin: function () {
      if (this.record.id == 0) {
        return '-'
      }

      return this.record.internal_fistula_skin
    },

    machine_type: function () {
      if (this.record == null || this.record.id == '') {
        return ''
      }
      return this.record.machine_type
    },
    weight_before: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.weight_before
    },
    additional_weight: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.additional_weight
    },
    systolic_blood_pressure: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.systolic_blood_pressure
    },
    last_post_dialysis: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.last_post_dialysis
    },

    dry_weight: function () {
      if (this.$store.getters.user.template_info.template_id == 6) {
        if (this.dry_weights != null && this.dry_weights.id > 0) {
          return this.dry_weights.dry_weight
        } else {
          if (this.record == null || this.record.id == '') {
            return '-'
          }
          return this.record.dry_weight
        }
      } else {
        if (this.record == null || this.record.id == '') {
          return '-'
        }

        return this.record.dry_weight
      }
    },
    diastolic_blood_pressure: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.diastolic_blood_pressure
    },
    dialysis_interphase: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.dialysis_interphase
    },
    catheter: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.catheter
    },

    temperature: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.temperature
    },
    pulse_frequency: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.pulse_frequency
    },
    breathing_rate: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.breathing_rate
    },
    symptom_before_dialysis: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.symptom_before_dialysis
    },
    symptom_before_dialysis_other: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.symptom_before_dialysis_other
    },
    complication: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.complication
    },
    internal_fistula: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      } else {
        return this.record.internal_fistula

      }
    },
    is_hemorrhage: function () {
      if (this.record == null || this.record.id == '') {
        return false
      }
      return this.record.is_hemorrhage == 1
    },
    hemorrhage: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.hemorrhage
    },
    hemorrhage_other: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.hemorrhage_other
    },

    remark: function () {
      if (this.record == null || this.record.id == '') {
        return ''
      }
      return this.record.remark
    },
    dialysis_count: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.dialysis_count
    },
    internal_fistula_other: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.internal_fistula_other
    },
    venous_catheterization_part_other: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.venous_catheterization_part_other
    },
    emergency_treatment_other: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.emergency_treatment_other
    },
    blood_access_internal_fistula: function () {
      var name1 = ''
      var name2 = ''

      if (this.record == null || this.record.id == '') {
        return '-'
      }
      if (this.record.blood_access_internal_fistula == undefined) {
        name1 = ''
      } else {
        name1 = this.record.blood_access_internal_fistula + ','
      }
      if (this.record.internal_fistula_other == undefined) {
        name2 = ''
      } else {
        name2 = this.record.internal_fistula_other
      }

      return name1 + name2
    },
    infect_other: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.infect_other
    },
    skin_other: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.skin_other
    },
    ductus_arantii_other: function () {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.ductus_arantii_other
    }
  },
  methods: {
    getBloodAccessPart: function (id) {
      var BloodAccessPart = getDataConfig('hemodialysis', 'vascular_access')
      var BloodAccessPartName = ''
      for (let i = 0; i < BloodAccessPart.length; i++) {
        if (BloodAccessPart[i].id == id) {
          BloodAccessPartName = BloodAccessPart[i].name
        }
      }
      return BloodAccessPartName
    },
    getHumorExcessiv: function (id) {
      var humor_excessive_symptom_array = getDataConfig('hemodialysis', 'humor_excessive_symptom')
      var humor_excessive_symptom_Name = ''
      for (let i = 0; i < humor_excessive_symptom_array.length; i++) {
        if (humor_excessive_symptom_array[i].id == id) {
          humor_excessive_symptom_Name = humor_excessive_symptom_array[i].name
        }
      }
      return humor_excessive_symptom_Name
    },
    getBloodAccessOpera: function (id) {
      var BloodAccessOpera = getDataConfig(
        'hemodialysis',
        'vascular_access_desc'
      )
      var BloodAccessOperaName = ''
      for (let i = 0; i < BloodAccessOpera.length; i++) {
        if (BloodAccessOpera[i].id == id) {
          BloodAccessOperaName = BloodAccessOpera[i].name
        }
      }
      return BloodAccessOperaName
    },
    isShow (name) {
      var filedList = this.$store.getters.user.fileds

      for (let i = 0; i < filedList.length; i++) {
        if (
          filedList[i].module == 3 &&
          filedList[i].filed_name_cn == name &&
          filedList[i].is_show == 1
        ) {
          return true
        }
      }
      return false
    },
    getBloodAccessInternalFistula: function (id) {
      var BloodAccessInternalFistulaOptions = this.$store.getters
        .blood_access_internal_fistula
      var BloodAccessInternalFistulaName = ''
      for (let i = 0; i < BloodAccessInternalFistulaOptions.length; i++) {
        if (BloodAccessInternalFistulaOptions[i].id == id) {
          BloodAccessInternalFistulaName =
            BloodAccessInternalFistulaOptions[i].name
        }
      }
      return BloodAccessInternalFistulaName
    },
    getBloodAccessNoise: function (id) {
      var BloodAccessNoiseOptions = this.$store.getters.blood_access_noise
      var BloodAccessNoiseName = ''
      for (let i = 0; i < BloodAccessNoiseOptions.length; i++) {
        if (BloodAccessNoiseOptions[i].id == id) {
          BloodAccessNoiseName = BloodAccessNoiseOptions[i].name
        }
      }
      return BloodAccessNoiseName
    },
    getVenousCatheterization: function (id) {
      var VenousCatheterizationOptions = this.$store.getters
        .venous_catheterization
      var VenousCatheterizationName = ''
      for (let i = 0; i < VenousCatheterizationOptions.length; i++) {
        if (VenousCatheterizationOptions[i].id == id) {
          VenousCatheterizationName = VenousCatheterizationOptions[i].name
        }
      }
      return VenousCatheterizationName
    },
    getWay: function (id) {
      var PunctureWayOptions = getDataConfig('hemodialysis', 'puncture_method')
      var PunctureWayOptionsName = ''
      for (let i = 0; i < PunctureWayOptions.length; i++) {
        if (PunctureWayOptions[i].id == id) {
          PunctureWayOptionsName = PunctureWayOptions[i].name
        }
      }
      return PunctureWayOptionsName
    },
    getVenousCatheterizationPart: function (id) {
      var venousCatheterizationPartOptions = this.$store.getters
        .venous_catheterization_part
      var venousCatheterizationPartName = ''
      for (let i = 0; i < venousCatheterizationPartOptions.length; i++) {
        if (venousCatheterizationPartOptions[i].id == id) {
          venousCatheterizationPartName =
            venousCatheterizationPartOptions[i].name
        }
      }
      return venousCatheterizationPartName
    },
    getDuctusArantii: function (id) {
      var ductusArantiiOptions = this.$store.getters.ductus_arantii
      var ductusArantiiOptionsName = ''
      for (let i = 0; i < ductusArantiiOptions.length; i++) {
        if (ductusArantiiOptions[i].id == id) {
          ductusArantiiOptionsName = ductusArantiiOptions[i].name
        }
      }
      return ductusArantiiOptionsName
    },
    getEmergencyTreatment: function (id) {
      var emergencyTreatmentOptions = this.$store.getters.emergency_treatment
      var emergencyTreatmentName = ''
      for (let i = 0; i < emergencyTreatmentOptions.length; i++) {
        if (emergencyTreatmentOptions[i].id == id) {
          emergencyTreatmentName = emergencyTreatmentOptions[i].name
        }
      }
      return emergencyTreatmentName
    },
    getSkin: function (id) {
      var skinOptions = this.$store.getters.skin
      var skinName = ''
      for (let i = 0; i < skinOptions.length; i++) {
        if (skinOptions[i].id == id) {
          skinName = skinOptions[i].name
        }
      }
      return skinName
    },
    getTime (time) {
      if(time > 0){
        return uParseTime(time, '{y}-{m}-{d}')
      }else{
        return ""
      }
      
    },
  }
}
</script>

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