<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">{{ 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">{{ catheter }}</span>
          <span class="unit"></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">{{ symptom_before_dialysis }}</span>
          <span class="unit"></span>
        </li>
        <li style="height: 0.6rem;" v-if="isShow('出血')">
          <label>出血:</label>
          <span class="content">{{ is_hemorrhage ? hemorrhage + ';' + hemorrhage_other : '无' }}</span>
          <span class="unit"> </span>

        <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">{{ symptom_before_dialysis }}</span>
          <span class="unit"></span>
        </li>

      </ul>

      <ul>

        <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">{{getWay(this.record.puncture_way)}}</span>
        </li>
        <li style="height: 0.6rem;" v-if="isShow('中心静脉置管')">
          <label>中心静脉置管:</label>
          <span class="content">{{getVenousCatheterization(this.record.venous_catheterization)}}</span>
          <span class="unit"> </span>
        </li>

      </ul>



      <ul >
        <li style="height: 0.6rem;" v-if="isShow('位置')">
          <label>位置:</label>
          <span class="content" v-if="this.record.venous_catheterization_part != -1">{{getVenousCatheterizationPart(this.record.venous_catheterization_part)}}</span>
          <span class="content" v-if="this.record.venous_catheterization_part == -1">{{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" v-if="this.record.emergency_treatment != -1">{{getEmergencyTreatment(this.record.emergency_treatment)}}</span>
          <span class="content" v-if="this.record.emergency_treatment == -1">{{emergency_treatment_other}}</span>
        </li>
      </ul>

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

<script>
  export default {
    name: 'assessmentBefore',
    data () {
      return {
        title: '透前评估 ',

      }
    },
    props: {
      record: {
        type: Object
      }
    },
    computed: {
      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
      },
      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.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
      },
      symptom_before_dialysis: function () {
        if (this.record == null || this.record.id == '') {
          return '-'
        }
        return this.record.symptom_before_dialysis
      },
      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 '-'
        }
        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
      }
    },
    methods: {
      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 = this.$store.getters.puncture_way;
        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

      }
      // setRecord(record) {
      //   if (record == null) {
      //     this.info1[0].content = "0"
      //     this.info1[1].content = "0"
      //     this.info1[2].content = "0"
      //     // this.info1[3].content = ""

      //     this.info2[0].content = "0"
      //     this.info2[1].content = "0"
      //     this.info2[2].content = ""
      //     this.info2[3].content = ""

      //     this.info3[0].content = "0"
      //     this.info3[1].content = "0"
      //     this.info3[2].content = ""
      //     this.info3[3].content = ""

      //     this.note = ""

      //   } else {
      //     this.info1[0].content = record.weight_before
      //     this.info1[1].content = record.systolic_blood_pressure
      //     this.info1[2].content = record.last_post_dialysis
      //     // this.info1[3].content = ""

      //     this.info2[0].content = record.additional_weight
      //     this.info2[1].content = record.diastolic_blood_pressure
      //     this.info2[2].content = record.dialysis_interphase
      //     this.info2[3].content = record.catheter

      //     this.info3[0].content = record.temperature
      //     this.info3[1].content = record.breathing_rate
      //     this.info3[2].content = record.symptom_before_dialysis
      //     this.info3[3].content = record.complication

      //     this.note = record.remark
      //   }
      // }
    }
  }
</script>

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



