<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="weight_before != '0'">{{
            weight_before
          }}</span>
          <span class="unit" v-if="weight_before != '0'">kg</span>
        </li>

        <li v-if="isShow('干体重')">
          <label>干体重 : </label>
          <span class="content" v-if="dry_weight != '0'">{{ dry_weight }}</span>
          <span class="unit" v-if="dry_weight != '0'">kg</span>
        </li>
        <li v-if="isShow('脉搏')">
          <label>脉搏 : </label>
          <span class="content" v-if="pulse_frequency != '0'">{{
            pulse_frequency
          }}</span>
          <span class="unit" v-if="pulse_frequency != '0'">次/分</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">{{
            dialysis_count ? dialysis_count : ""
          }}</span>
          <span class="unit">{{ dialysis_count ? "次/周" : "" }}</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"
            v-if="this.record.venous_catheterization_part != -1"
            >{{
              getVenousCatheterizationPart(
                this.record.venous_catheterization_part
              )
            }}</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">{{ infect_other }}</span>
          <span class="unit"> </span>
        </li>

        <li v-if="isShow('其他皮肤情况')">
          <label>其他皮肤情况:</label>
          <span class="content">{{ skin_other }}</span>
          <span class="unit"> </span>
        </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" v-if="this.record.catheter_bend == 0"></span>
          <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" v-if="breathing_rate != '0'">{{
            breathing_rate
          }}</span>
          <span class="unit" v-if="breathing_rate != '0'">次/分</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">{{ blood_access_internal_fistula }}</span>
        </li>
        <li v-if="isShow('穿刺方式')">
          <label>穿刺方式 : </label>
          <span class="content">{{ getWay(this.record.puncture_way) }}</span>
        </li>
        <li v-if="isShow('其他位置')">
          <label>其他位置</label>
          <span
            class="content"
            v-if="
              this.record.venous_catheterization_part_other &&
                this.record.venous_catheterization_part_other.length > 0
            "
            >{{ venous_catheterization_part_other }}</span
          >
        </li>

        <li v-if="isShow('急诊')">
          <label>急诊: </label>
          <span class="content">{{
            getEmergencyTreatment(this.record.emergency_treatment)
          }}</span>
          <span
            class="content"
            v-if="
              this.record.emergency_treatment_other &&
                this.record.emergency_treatment_other.length > 0
            "
            >,{{ emergency_treatment_other }}</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">{{
            getBloodAccessPart(this.record.blood_access_part_id)
          }}</span>
          <span class="unit"> </span>
        </li>
      </ul>
      <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="additional_weight != '0'">{{
            additional_weight
          }}</span>
          <span class="unit" v-if="additional_weight != '0'">kg</span>
        </li>
        <li v-if="isShow('体温')">
          <label>体温 : </label>
          <span class="content" v-if="temperature != '0'">{{
            temperature
          }}</span>
          <span class="unit" v-if="temperature != '0'">℃</span>
        </li>

        <li v-if="isShow('前次透析后症状')">
          <label>前次透析后症状: </label>
          <span class="content" v-if="last_post_dialysis != '0'">{{
            last_post_dialysis
          }}</span>
          <span class="unit" v-if="last_post_dialysis != '0'"></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" v-if="dialysis_interphase != '0'">{{
            dialysis_interphase
          }}</span>
          <span class="unit" v-if="dialysis_interphase != '0'"></span>
        </li>

        <li v-if="isShow('透析机型号')">
          <label>透析机型号:</label>
          <span class="content" v-if="machine_type != '0'">
            {{ machine_type }}
          </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">{{
            getVenousCatheterization(this.record.venous_catheterization)
          }}</span>
          <span class="unit"> </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">{{
            this.record.is_infect == 1 ? "无" : "有"
          }}</span>
          <span class="unit"> </span>
        </li>

        <li v-if="isShow('皮肤')">
          <label>皮肤:</label>
          <span class="content">{{ getSkin(this.record.skin) }}</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>
      </ul>
    </div>
    <div class="note">
      备注 : <span>{{ remark }}</span>
    </div>
    <!-- <div class="note">处方医生 : {{doctor}}</div> -->
    <div class="middleLine"></div>
  </div>
</template>

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

export default {
  name: "assessmentBefore",
  data() {
    return {
      title: "透前评估 "
    };
  },
  props: {
    record: {
      type: Object
    }
  },
  computed: {
    weight_before: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.weight_before;
    },
    additional_weight: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.additional_weight;
    },
    systolic_blood_pressure: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.systolic_blood_pressure;
    },
    last_post_dialysis: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.last_post_dialysis;
    },
    dry_weight: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.dry_weight;
    },
    diastolic_blood_pressure: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.diastolic_blood_pressure;
    },
    dialysis_interphase: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.dialysis_interphase;
    },
    catheter: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.catheter;
      console.log("导管", this.record.catheter);
    },

    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;
    },
    machine_type: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.machine_type;
    },
    breathing_rate: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.breathing_rate;
    },
    symptom_before_dialysis: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.symptom_before_dialysis;
    },
    complication: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.complication;
    },
    internal_fistula: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.internal_fistula;
    },

    internal_fistula_skin: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.internal_fistula_skin;
    },

    is_hemorrhage: function() {
      if (this.record.id == 0) {
        return false;
      }
      return this.record.is_hemorrhage == 1;
    },
    hemorrhage: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.hemorrhage;
    },
    hemorrhage_other: function() {
      if (this.record.id == 0) {
        return "-";
      }
      return this.record.hemorrhage_other;
    },

    remark: function() {
      if (this.record.id == 0) {
        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;
    },
    ductus_arantii_other: function() {
      if (this.record == null || this.record.id == "") {
        return "-";
      }
      return this.record.ductus_arantii_other;
    },
    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;
    }
  },
  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;
    },
    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;
    },

    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;
    },
    isShow(name) {
      var filedList = store.getters.xt_user.fileds;
      var arr = [];
      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;
    },
    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;
    }
  }
};
</script>

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