<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" v-if="diastolic_blood_pressure != '0'">{{
            diastolic_blood_pressure
          }}</span>
          <span class="unit" v-if="diastolic_blood_pressure != '0'">mmHg</span>
        </li>
        <li v-if="isShow('实际超滤量')">
          <label>实际超滤量: </label>
          <span class="content" v-if="actual_ultrafiltration != '0'">{{
            actual_ultrafiltration
          }}</span>
          <span class="unit" v-if=" actual_ultrafiltration != '0' && (this.$store.getters.xt_user.template_info.template_id == 6 || this.$store.getters.xt_user.template_info.template_id == 9 || this.$store.getters.xt_user.template_info.template_id == 17 || this.$store.getters.xt_user.template_info.template_id == 20 || this.$store.getters.xt_user.template_info.template_id == 21 || this.$store.getters.xt_user.template_info.template_id == 22 || this.$store.getters.xt_user.template_info.template_id == 23 || this.$store.getters.xt_user.template_info.template_id == 24) " >ml</span>
          <span class="unit" v-if=" actual_ultrafiltration != '0' && this.$store.getters.xt_user.template_info.template_id != 6 && this.$store.getters.xt_user.template_info.template_id != 9 && this.$store.getters.xt_user.template_info.template_id != 17 && this.$store.getters.xt_user.template_info.template_id != 20 && this.$store.getters.xt_user.template_info.template_id != 21 && this.$store.getters.xt_user.template_info.template_id != 22 && this.$store.getters.xt_user.template_info.template_id != 23 && this.$store.getters.xt_user.template_info.template_id != 24" >L</span>
        </li>
        <li v-if="isShow('导管')">
          <label>导管 : </label>
          <span class="content">{{ catheter }}</span>
        </li>

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

        <li v-if="isShow('实际置换量')">
          <label>实际置换量 : </label>
          <span class="content">{{ actual_displacement }}</span>
          <span class="unit" v-if="this.$store.getters.xt_user.template_info.template_id != 13">ml</span>
          <span class="unit" v-else>L</span>
        </li>
        <li v-if="isShow('压迫后内瘘震颤')">
          <label>压迫后内瘘震颤: </label>
          <span class="content">{{ getInternal() }}</span>
        </li>

        <li v-if="isShow('实际治疗时长')">
          <label>实际治疗时长 : </label>
          <span class="content" v-if="this.record.actual_treatment_hour"
            >{{ this.record.actual_treatment_hour }}小时</span
          >
          <span class="content" v-if="this.record.actual_treatment_minute"
            >{{ this.record.actual_treatment_minute }}分钟</span
          >
        </li>

        <li v-if="isShow('其他观察内容') && patient_gose == 3">
          <label>其他观察内容 : </label>
          <span class="content">{{
            this.record.observation_content_other
          }}</span>
        </li>

        <li
          v-if="this.record.dialysis_process == 2 && isShow('透析过程提前原因')"
        >
          <label for="tw">透析过程提前原因 : </label>
          <span class="content" id="tw">{{
            this.record.in_advance_reason
          }}</span>
        </li>
        <li v-if="isShow('内瘘震颤和血管杂音')">
          <label for="sjzl">内瘘震颤和血管杂音 : </label>
          <span id="sjzl" class="content">{{
            getTremorNoise(this.record.tremor_noise)
          }}</span>
        </li>

        <li v-if="isShow('动脉管道')">
          <label for="xgtlcz">动脉管道: </label>
          <span id="xgtlcz" class="content">{{ getArterialTubeName(this.record.arterial_tube) }}</span>
        </li>

        <li v-if="isShow('透析期间进食')">
          <label for="bzh">透析期间进食: </label>
          <span id="bzh" class="content">{{ eat_name }}</span>
        </li>

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

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

        <li v-if="isShow('血流量')">
          <label>血流量: </label>
          <span id="xgtlcz" class="content">{{ getBloodFlowName(this.record.blood_flow) }}</span>
        </li>

        <li v-if="isShow('封管液配置')">
          <label>封管液配置: </label>
          <!-- <span class="content">{{ getSealingFluidDisposeName(this.record.sealing_fluid_dispose) }}</span> -->
           <span class="content">{{this.record.sealing_fluid_dispose}}</span>
        </li>

        <li v-if="isShow('封管液特殊') && this.record.sealing_fluid_dispose.indexOf('特殊')>-1">
          <label>封管液配置(特殊): </label>
          <span class="content">{{ sealing_fluid_special }}</span>
        </li>

        <!-- <li style="height: 0.6rem;">
          <label></label>
      </li> -->
      </ul>
      <ul>
        <li v-if="isShow('收缩压')">
          <label>收缩压 : </label>
          <span class="content" v-if="systolic_blood_pressure != '0'">{{
            systolic_blood_pressure
          }}</span>
          <span class="unit" v-if="systolic_blood_pressure != '0'">mmHg</span>
        </li>
        <li v-if="isShow('透析器凝血')">
          <label>透析器凝血 : </label>
          <span class="content">{{ cruor }}</span>
        </li>
        <li v-if="isShow('穿刺处血肿')">
          <label>穿刺处血肿 : </label>
          <span class="content">{{ puncture_point_haematoma_name }}</span>
        </li>
        <li v-if="isShow('呼吸频率')">
          <label>呼吸频率 : </label>
          <span class="content" v-if="this.record.breathing_rate">{{
            this.record.breathing_rate
          }}</span>
          <span class="unit" v-if="this.record.breathing_rate">次/min</span>
        </li>

        <li v-if="isShow('血管通路操作')">
          <label>血管通路操作: </label>
          <span class="content">{{ blood_access_opera }}</span>
        </li>
        <li v-if="isShow('透后症状')">
          <label>透后症状 : </label>
          <span class="content">{{ symptom_after_dialysis }}</span>
        </li>
        <li v-if="isShow('透析中入量')">
          <label>透析中入量: </label>
          <span class="content"
            >{{ this.record.dialysis_intakes
            }}{{ getUnit(this.record.dialysis_intakes_unit) }}</span
          >
        </li>

        <li v-if="isShow('拔针后穿刺点渗血')">
          <label>拔针后穿刺点渗血: </label>
          <span class="content">{{ puncture_point_oozing_blood_name }}</span>
        </li>

        <li v-if="isShow('内瘘管拔针后压迫止血时间')">
          <label for="ml">内瘘管拔针后压迫止血时间 : </label>
          <span id="ml" class="content" v-if="this.record.hemostasis_minute">{{ this.record.hemostasis_minute }}min</span>
          <span id="ml" class="content" v-else>-min</span>
        </li>

        <li v-if="isShow('失衡综合症')">
          <label for="txzrl">失衡综合症: </label>
          <span id="txzrl" class="content">{{
            getDisequilibriumSyndrome(this.record.disequilibrium_syndrome)
          }}</span>
        </li>

        <li v-if="isShow('静脉管道')">
          <label for="bzh">静脉管道: </label>
          <span id="bzh" class="content">{{
            getIntravenousTubeName(this.record.intravenous_tube)
          }}</span>
        </li>

        <li v-if="isShow('透析中进食')">
          <label>透析中进食: </label>
          <span class="content" >{{ this.record.dialysis_during ? this.record.dialysis_during : ""  }}</span>
          <span class="unit">{{ this.record.dialysis_during ? "ml" : "" }}</span>
        </li>
      </ul>
      <ul>
        <li v-if="isShow('透后称重')">
          <label>透后称重 : </label>
          <span class="content" v-if="weight_after != '0'">{{ weight_after }}</span>
          <span class="unit" v-if="weight_after != '0'">kg</span>
        </li>
        <li v-if="isShow('内瘘')">
          <label>内瘘 : </label>
          <span class="content">{{ internal_fistula }}</span>
        </li>
        <li v-if="isShow('科室') && patient_gose == 3">
          <label>科室 : </label>
          <span class="content">{{ inpatient_department }}</span>
        </li>
        <li v-if="isShow('脉搏')">
          <label>脉搏 : </label>
          <span class="content" v-if="this.record.pulse_frequency">{{
            this.record.pulse_frequency
          }}</span>
          <span class="unit" v-if="this.record.pulse_frequency">次/分</span>
        </li>

        <li v-if="isShow('体重减少')">
          <label>体重减少 : </label>
          <span class="content" v-if="weight_loss != '0'">{{
            weight_loss
          }}</span>
          <span class="unit" v-if="weight_loss != '0'">kg</span>
        </li>

        <li v-if="isShow('并发症')">
          <label>并发症: </label>
          <span class="content">{{ this.record.complication }}</span>
        </li>
        <li
          v-if="patient_gose == 3 && isShow('交待病房护士/患者/陪人观察内容')"
        >
          <label>交待病房护士/患者/陪人观察内容 : </label>
          <span class="content">{{ this.record.observation_content }}</span>
        </li>

        <li v-if="isShow('患者去向')">
          <label>患者去向: </label>
          <span class="content">{{ patient_gose_name }}</span>
        </li>
        <li v-if="isShow('透析过程')">
          <label for="tw">透析过程 : </label>
          <span class="content" id="tw" v-if="this.record.dialysis_process == 1"
            >完成</span
          >
          <span class="content" id="tw" v-if="this.record.dialysis_process == 2"
            >提前{{ this.record.in_advance_minute }}min</span
          >
        </li>

        <li v-if="isShow('内瘘管拔针后压迫止血操作')">
          <label for="ml">内瘘管拔针后压迫止血操作 : </label>
          <span id="ml" class="content">{{
            getOpera(this.record.hemostasis_opera)
          }}</span>
        </li>
        <li
          v-if="
            this.record.disequilibrium_syndrome == 2 && isShow('失衡综合症症状')
          "
        >
          <label for="txzrl">失衡综合症症状: </label>
          <span id="txzrl" class="content">{{
            this.record.disequilibrium_syndrome_option
          }}</span>
        </li>

        <li v-if="isShow('透析器')">
          <label for="hzqx">透析器: </label>
          <span id="hzqx" class="content">{{
            getDialyzer(this.record.dialyzer)
          }}</span>
        </li>

        <li v-if="isShow('透析器')">
          <label for="hzqx">透析器: </label>
          <span id="hzqx" class="content">{{
            getDialyzer(this.record.dialyzer)
          }}</span>
        </li>

        <li v-if="isShow('中心静脉封管(肝素-A端)')">
          <label for="bzh">中心静脉封管(肝素-A端): </label>
          <span class="content" id="tzjs">{{
            this.record.cvc_a ? this.record.cvc_a : ""
          }}</span>
          <span class="unit">{{ this.record.cvc_a ? "ml" : "" }}</span>
        </li>
        <li v-if="isShow('中心静脉封管(肝素-V端)')">
          <label for="bzh">中心静脉封管(肝素-V端): </label>
          <span class="content" id="tzjs">{{ this.record.cvc_v ? this.record.cvc_v : "" }}</span>
          <span class="unit">{{ this.record.cvc_v ? "ml" : "" }}</span>
        </li>
        <li v-if="isShow('出量')">
          <label>出量: </label>
          <span class="content" >{{ this.record.stroke_volume ? this.record.stroke_volume : ""  }}</span>
          <span class="unit">{{ this.record.stroke_volume ? "ml" : "" }}</span>
        </li>
      </ul>
    </div>
    <div class="note">
      备注 : <span>{{ this.record.remark }}</span>
    </div>
    <div class="middleLine"></div>
  </div>
</template>

<script>
import store from '@/store'
import { getDataConfig } from '@/utils/data'

export default {
  name: 'DialysisPrescription',
  data() {
    return {
      title: '透后评估 '
    }
  },
  props: {
    record: {
      type: Object
    }
  },
  computed: {
    weight_after: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.weight_after
    },
    systolic_blood_pressure: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.systolic_blood_pressure
    },
    actual_ultrafiltration: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.actual_ultrafiltration
    },
    cruor: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.cruor
    },
    internal_fistula: function() {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      return this.record.internal_fistula
    },
    weight_loss: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.weight_loss
    },
    inpatient_department: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.inpatient_department
    },
    patient_gose: function() {
      if (this.record.id == 0) {
        return 0
      }
      return this.record.patient_gose
    },
    diastolic_blood_pressure: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.diastolic_blood_pressure
    },
    actual_displacement: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.actual_displacement
    },
    symptom_after_dialysis: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.symptom_after_dialysis
    },
    blood_access_part: function() {
      if (this.record.id == 0) {
        return '-'
      }
      const vascular_access = this.$store.getters.vascular_access
      const valen = vascular_access.length
      let name = '-'

      for (var index in vascular_access) {
        if (vascular_access[index].id == this.record.blood_access_part_id) {
          name = vascular_access[index].name
          break
        }
      }
      return name
    },
    puncture_point_oozing_blood_name: function() {
      if (this.record.id == 0) {
        return '-'
      }
      switch (this.record.puncture_point_oozing_blood) {
        case 1:
          return '有'
          break
        case 2:
          return '无'
          break

        default:
          return '-'
          break
      }
    },
    eat_name: function() {
      if (this.record == null || this.record.id == '') {
        return '-'
      }
      switch (this.record.is_eat) {
        case 1:
          return '有'
          break
        case 2:
          return '无'
          break

        default:
          return '-'
          break
      }
    },
    patient_gose_name: function() {
      if (this.record.id == 0) {
        return '-'
      }
      switch (this.record.patient_gose) {
        case 1:
          return '离院'
          break
        case 2:
          return '留观'
          break
        case 3:
          return '住院'
          break
        case 4:
          return '门诊'
          break
        default:
          return '-'
          break
      }
    },
    blood_access_opera: function() {
      if (this.record.id == 0) {
        return '-'
      }
      const vascular_access = this.$store.getters.vascular_access_desc
      // console.log(vascular_access);
      let name = '-'
      for (var index in vascular_access) {
        if (
          vascular_access[index].id == this.record.blood_access_part_opera_id
        ) {
          name = vascular_access[index].name
          break
        }
      }
      return name
    },
    catheter: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.catheter
    },
    puncture_point_haematoma_name: function() {
      if (this.record.id == 0) {
        return
      }
      switch (this.record.puncture_point_haematoma) {
        case 1:
          return '有'
          break
        case 2:
          return '无'
          break
        default:
          return '-'
          break
      }
    },
    breathing_rate: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.breathing_rate
    },
    temperature: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.temperature
    },
    pulse_frequency: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.pulse_frequency
    },
    actual_treatment_hour: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.actual_treatment_hour
    },
    actual_treatment_minute: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.actual_treatment_minute
    },

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

    temperature: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.temperature
    },
    pulse_frequency: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.pulse_frequency
    },
    actual_treatment_hour: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.actual_treatment_hour
    },
    actual_treatment_minute: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.actual_treatment_minute
    },
    dialysis_intakes: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.dialysis_intakes
    },
    observation_content_other: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.observation_content_other
    },
    observation_content: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.observation_content
    },
    complication: function() {
      if (this.record.id == 0) {
        return '-'
      }
      return this.record.complication
    },

    remark: function() {
      if (this.record.id == 0) {
        return ''
      }
      return this.record.remark
    },
    sealing_fluid_special: function() {
      if (this.record.id == 0) {
        return ''
      }
      return this.record.sealing_fluid_special
    },
    in_advance_minute: function() {
      if (this.record == null || this.record.id == '') {
        return ''
      }
      return this.record.in_advance_minute
    },
    in_advance_reason: function() {
      if (this.record == null || this.record.id == '') {
        return ''
      }
      return (
        this.record.in_advance_reason + ',' + this.record.in_advance_reason_other
      )
    },
    hemostasis_minute: function() {
      if (this.record == null || this.record.id == '') {
        return ''
      }

      return this.record.hemostasis_minute
    },
    in_advance_reason_other: function() {
      if (this.record == null || this.record.id == '') {
        return ''
      }
      return this.record.in_advance_reason_other
    }
  },
  methods: {
    getInternal: function() {
      if (this.record.id == 0) {
        return '-'
      }
      switch (this.record.internal_fistula_tremor_ac) {
        case 1:
          return '存在'
          break
        case 2:
          return '减弱'
          break
        case 3:
          return '无'
          break
        default:
          return '-'
      }
    },
    getOpera: function(id) {
      var hemostasis_opera = this.$store.getters.hemostasis_opera
      var hemostasisOperaName = ''
      for (let i = 0; i < hemostasis_opera.length; i++) {
        if (hemostasis_opera[i].id == id) {
          hemostasisOperaName = hemostasis_opera[i].name
        }
      }
      return hemostasisOperaName
    },
    getTremorNoise: function(id) {
      var tremor_noise = this.$store.getters.tremor_noise
      var tremorNoiseName = ''
      for (let i = 0; i < tremor_noise.length; i++) {
        if (tremor_noise[i].id == id) {
          tremorNoiseName = tremor_noise[i].name
        }
      }
      return tremorNoiseName
    },
    getUnit: function(val) {
      switch (val) {
        case 1:
          return 'g'
          break
        case 2:
          return 'ml'
          break
      }
    },
    getSealingFluidDisposeName: function(id) {
      var sealing_fluid_dispose_arr = getDataConfig('hemodialysis', 'sealing_fluid_dispose')
      var sealing_fluid_dispose_name = ''
      for (let i = 0; i < sealing_fluid_dispose_arr.length; i++) {
        if (sealing_fluid_dispose_arr[i].id == id) {
          sealing_fluid_dispose_name = sealing_fluid_dispose_arr[i].name
        }
      }
      return sealing_fluid_dispose_name
    },
    getDisequilibriumSyndrome: function(id) {
      var disequilibrium_syndrome = this.$store.getters.disequilibrium_syndrome
      var disequilibriumSyndromeName = ''
      for (let i = 0; i < disequilibrium_syndrome.length; i++) {
        if (disequilibrium_syndrome[i].id == id) {
          disequilibriumSyndromeName = disequilibrium_syndrome[i].name
        }
      }
      return disequilibriumSyndromeName
    },
    getDisequilibriumSyndromeOptionName: function(id) {
      var disequilibrium_syndrome_option = this.$store.getters
        .disequilibrium_syndrome_option
      var disequilibriumSyndromeOptionName = ''
      for (let i = 0; i < disequilibrium_syndrome_option.length; i++) {
        if (disequilibrium_syndrome_option[i].id == id) {
          disequilibriumSyndromeOptionName =
            disequilibrium_syndrome_option[i].name
        }
      }
      return disequilibriumSyndromeOptionName
    },
    getArterialTubeName: function(id) {
      var arterial_tube = this.$store.getters.arterial_tube
      var arterialTubeName = ''
      for (let i = 0; i < arterial_tube.length; i++) {
        if (arterial_tube[i].id == id) {
          arterialTubeName = arterial_tube[i].name
        }
      }
      return arterialTubeName
    },
    getBloodFlowName: function(id) {
      var BloodFloowArr = getDataConfig('hemodialysis', 'blood_flow')
      var BloodFloowArrName = ''
      for (let i = 0; i < BloodFloowArr.length; i++) {
        if (BloodFloowArr[i].id == id) {
          BloodFloowArrName = BloodFloowArr[i].name
        }
      }
      return BloodFloowArrName
    },
    getIntravenousTubeName: function(id) {
      var intravenous_tube = this.$store.getters.intravenous_tube
      var intravenousTubeName = ''
      for (let i = 0; i < intravenous_tube.length; i++) {
        if (intravenous_tube[i].id == id) {
          intravenousTubeName = intravenous_tube[i].name
        }
      }
      return intravenousTubeName
    },
    getDialyzer: function(id) {
      var dialyzer = this.$store.getters.dialyzer
      var dialyzerName = ''
      for (let i = 0; i < dialyzer.length; i++) {
        if (dialyzer[i].id == id) {
          dialyzerName = dialyzer[i].name
        }
      }
      return dialyzerName
    },
    isShow(name) {
      var filedList = store.getters.xt_user.fileds
      for (let i = 0; i < filedList.length; i++) {
        if (
          filedList[i].module == 5 &&
          filedList[i].filed_name_cn == name &&
          filedList[i].is_show == 1
        ) {
          return true
        }
      }
      return false
    }
  }
}
</script>

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