<template>
  <div class="page_allLongDialysis">
    <van-sticky>
      <div class="allLongDialysisTitle">
        <i class="iconfont icon-zuojiantou jiantou" @click="$router.go(-1)"></i>
        <span class="titleName">{{ patient_name }}的长期透析处方</span>
      </div>
    </van-sticky>
    <div class="dialysisBox">
      <div class="dialysisBoxOne">
        <p class="time">{{ getTime(longDialysisDetail.created_time) }}</p>
        <div class="orderContent">
          <p>透析模式：{{ longDialysisDetail.mode_id }}</p>
          <p>
            透析时长：{{ longDialysisDetail.dialysis_duration_hour }}h{{
              longDialysisDetail.dialysis_duration_minute
            }}min
          </p>
          <p>血流量(ml/min)：{{ longDialysisDetail.blood_flow_volume }}</p>
          <p>目标超滤量(ml)：{{ longDialysisDetail.target_ultrafiltration }}</p>
          <p>
            透析液配方(mmol/L)：{{ longDialysisDetail.dialysate_formulation }}
          </p>
          <p>
            抗凝剂：
            <span v-if="longDialysisDetail.anticoagulant == 1">无肝素</span>
            <span v-if="longDialysisDetail.anticoagulant == 2">普通肝素</span>
            <span v-if="longDialysisDetail.anticoagulant == 3">低分子肝素</span>
            <span v-if="longDialysisDetail.anticoagulant == 4">阿加曲班</span>
            <span v-if="longDialysisDetail.anticoagulant == 5">枸橼酸钠</span>
            <span v-if="longDialysisDetail.anticoagulant == 6">低分子肝素钙</span>
            <span v-if="longDialysisDetail.anticoagulant == 7">低分子肝素钠</span>
            <span v-if="longDialysisDetail.anticoagulant == 8">依诺肝素</span>
            <span v-if="longDialysisDetail.anticoagulant == 9">达肝素</span>
            <span v-if="longDialysisDetail.anticoagulant == 10">体外抗凝</span>
            <span v-if="longDialysisDetail.anticoagulant == 11">那屈肝素</span>
            <span v-if="longDialysisDetail.anticoagulant == 12">无抗凝剂</span>
          </p>
          <p>
            首剂：
            <span>{{ longDialysisDetail.anticoagulant_shouji }}</span>
            <span v-if="longDialysisDetail.anticoagulant == 1">mg</span>
            <span v-if="longDialysisDetail.anticoagulant == 2">iu</span>
            <span v-if="longDialysisDetail.anticoagulant == 3">iu</span>
            <span v-if="longDialysisDetail.anticoagulant == 4">mg</span>
            <span v-if="longDialysisDetail.anticoagulant == 5">mg</span>
            <span v-if="longDialysisDetail.anticoagulant == 6">iu</span>
            <span v-if="longDialysisDetail.anticoagulant == 7">iu</span>
            <span v-if="longDialysisDetail.anticoagulant == 8">iu</span>
            <span v-if="longDialysisDetail.anticoagulant == 9">iu</span>
             <span v-if="longDialysisDetail.anticoagulant == 10">mg</span>
          </p>
          <p>
            维持：
            <span>{{ longDialysisDetail.anticoagulant_weichi }}</span>
            <span v-if="longDialysisDetail.anticoagulant == 1">mg/h</span>
            <span v-if="longDialysisDetail.anticoagulant == 2">iu/h</span>
            <span v-if="longDialysisDetail.anticoagulant == 3">iu/h</span>
            <span v-if="longDialysisDetail.anticoagulant == 4">mg/h</span>
            <span v-if="longDialysisDetail.anticoagulant == 5">ml/h</span>
            <span v-if="longDialysisDetail.anticoagulant == 6">iu/h</span>
            <span v-if="longDialysisDetail.anticoagulant == 7">iu/h</span>
            <span v-if="longDialysisDetail.anticoagulant == 8">iu/h</span>
            <span v-if="longDialysisDetail.anticoagulant == 9">iu/h</span>
            <span v-if="longDialysisDetail.anticoagulant == 10">mg/h</span>
          </p>
          <p>
            总量：
            <span>{{ longDialysisDetail.anticoagulant_zongliang }}</span>
            <span v-if="longDialysisDetail.anticoagulant == 1">mg</span>
            <span v-if="longDialysisDetail.anticoagulant == 2">iu</span>
            <span v-if="longDialysisDetail.anticoagulant == 3">iu</span>
            <span v-if="longDialysisDetail.anticoagulant == 4">mg</span>
            <span v-if="longDialysisDetail.anticoagulant == 5">mg</span>
            <span v-if="longDialysisDetail.anticoagulant == 6">iu</span>
            <span v-if="longDialysisDetail.anticoagulant == 7">iu</span>
            <span v-if="longDialysisDetail.anticoagulant == 8">iu</span>
            <span v-if="longDialysisDetail.anticoagulant == 9">iu</span>
            <span v-if="longDialysisDetail.anticoagulant == 10">mg</span>
          </p>
          <p>置换量(L)：{{ longDialysisDetail.replacement_total }}</p>
          <p>钾(mmol/L)：{{ longDialysisDetail.kalium }}</p>
          <p>钠(mmol/L)：{{ longDialysisDetail.sodium }}</p>
          <p>钙(mmol/L)：{{ longDialysisDetail.calcium }}</p>
          <p>
            透析器/灌流器：{{ longDialysisDetail.dialyzer_perfusion_apparatus }}
          </p>
          <p>碳酸氢盐(mmol/L)：{{ longDialysisDetail.bicarbonate }}</p>
          <p>葡萄糖(mmol/L)：{{ longDialysisDetail.glucose }}</p>
          <p>透析液流量(ml/min)：{{ longDialysisDetail.dialysate_flow }}</p>
          <p>透析液温度(℃)：{{ longDialysisDetail.dialysate_temperature }}</p>
          <p>
            体液过多症状：
            <span v-if="longDialysisDetail.body_fluid == 1">无</span>
            <span v-if="longDialysisDetail.body_fluid == 2">下肢水肿+</span>
            <span v-if="longDialysisDetail.body_fluid == 3">下肢水肿++</span>
            <span v-if="longDialysisDetail.body_fluid == 4">下肢水肿+++</span>
          </p>
          <p>
            透析前使用特殊药物：{{
              getSpecialMedicine(longDialysisDetail.special_medicine)
            }}
          </p>
          <p>
            使用其他特殊药物：{{ longDialysisDetail.special_medicine_other }}
          </p>
          <p>置换液：{{ longDialysisDetail.displace_liqui_part }}</p>
          <p>置换液总量(L)：{{ longDialysisDetail.displace_liqui_value }}</p>
          <p>
            血管通路：{{
              getBloodAccessOption(longDialysisDetail.blood_access)
            }}
          </p>
          <p>实际超滤量(L)：{{ longDialysisDetail.ultrafiltration }}</p>
          <div>备注：{{ longDialysisDetail.remark }}</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getLongDialysisDetail } from '@/api/patient/patient'
import { uParseTime } from '@/utils/tools'
import { setRem, setHeight } from '@/libs/functionRem'
import '../../styles/resetStyle.scss'
export default {
  data () {
    return {
      patientid: 0,
      active: 0,
      patient_name: '',
      patient: {},
      longDialysisDetail: {},
      anticoagulantsSet: {
        type: 1
      },
      replacementWays: null,
      anticoagulantsConfit: null,
      dialysate_formulation: [],
      body_fluid_option: [],
      special_medicine_option: [],
      displace_liqui_part_option: [],
      blood_access_option: [],
      dialysisrecord: []
    }
  },
  methods: {
    getLongDialysisDetail (id) {
      getLongDialysisDetail(id).then(response => {
        if (response.data.state === 1) {
          var longDialysisDetail = response.data.data.longDialysisDetail
          if (longDialysisDetail.mode_id == 1) {
            longDialysisDetail.mode_id = 'HD'
          }
          if (longDialysisDetail.mode_id == 2) {
            longDialysisDetail.mode_id = 'HDF'
          }
          if (longDialysisDetail.mode_id == 3) {
            longDialysisDetail.mode_id = 'HD+HP'
          }
          if (longDialysisDetail.mode_id == 4) {
            longDialysisDetail.mode_id = 'HP'
          }
          if (longDialysisDetail.mode_id == 5) {
            longDialysisDetail.mode_id = 'HF'
          }
          if (longDialysisDetail.mode_id == 6) {
            longDialysisDetail.mode_id = 'SCUF'
          }
          if (longDialysisDetail.mode_id == 7) {
            longDialysisDetail.mode_id = 'IUF'
          }
          if (longDialysisDetail.mode_id == 8) {
            longDialysisDetail.mode_id = 'HFHD'
          }
          if (longDialysisDetail.mode_id == 9) {
            longDialysisDetail.mode_id = 'HFHD+HP'
          }
          if (longDialysisDetail.mode_id == 10) {
            longDialysisDetail.mode_id = 'PHF'
          }
          if (longDialysisDetail.mode_id == 11) {
            longDialysisDetail.mode_id = 'HFR'
          }
          if (longDialysisDetail.mode_id == 12) {
            longDialysisDetail.mode_id = 'HDF+HP'
          }
          if (longDialysisDetail.mode_id == 13) {
            longDialysisDetail.mode_id = 'CRRT'
          }
          if (longDialysisDetail.mode_id == 14) {
            longDialysisDetail.mode_id = '腹水回输'
          }
          if (longDialysisDetail.mode_id == 15) {
            longDialysisDetail.mode_id = 'HD前置换'
          }
          if (longDialysisDetail.mode_id == 16) {
            longDialysisDetail.mode_id = 'HD后置换'
          }
          if (longDialysisDetail.mode_id == 17) {
            longDialysisDetail.mode_id = 'HDF前置换'
          }
          if (longDialysisDetail.mode_id == 18) {
            longDialysisDetail.mode_id = 'HDF后置换'
          }
          if (longDialysisDetail.mode_id == 21) {
            longDialysisDetail.mode_id = 'HD+'
          }
          if (longDialysisDetail.mode_id == 24) {
            longDialysisDetail.mode_id = 'I-HDF'
          }
          if (longDialysisDetail.mode_id == 25) {
            longDialysisDetail.mode_id = 'HD高通'
          }
          if (longDialysisDetail.mode_id == 26) {
            longDialysisDetail.mode_id = 'CVVH'
          }
          if (longDialysisDetail.mode_id == 27) {
            longDialysisDetail.mode_id = 'CVVHD'
          }
          if (longDialysisDetail.mode_id == 28) {
            longDialysisDetail.mode_id = 'CVVHDF'
          }
          if (longDialysisDetail.mode_id == 29) {
            longDialysisDetail.mode_id = 'PE'
          }
          if (longDialysisDetail.displace_liqui_part == 0) {
            longDialysisDetail.displace_liqui_part = ''
          }
          if (longDialysisDetail.displace_liqui_part == 1) {
            longDialysisDetail.displace_liqui_part = '前稀释'
          }
          if (longDialysisDetail.displace_liqui_part == 2) {
            longDialysisDetail.displace_liqui_part = '后稀释'
          }
          this.longDialysisDetail = longDialysisDetail

          var patient = response.data.data.patient

          this.patient_name = patient.name
        }
      })
    },
    toReturn () {
      this.$router.push(
        '/patientdetail?patientid=' + this.patientid + '&active=' + this.active
      )
    },
    getTime (time) {
      // return uParseTime(time, "{y}-{m}-{d} {h}:{i}:{s}");
      return uParseTime(time, '{y}-{m}-{d}')
    },
    getBloodAccessOption (id) {
      for (let i = 0; i < this.blood_access_option.length; i++) {
        if ((this.blood_access_option[i].id = id)) {
          return this.blood_access_option[i].name
        }
      }
    },
    getSpecialMedicine (id) {
      for (let i = 0; i < this.special_medicine_option.length; i++) {
        if ((this.special_medicine_option[i].id = id)) {
          return this.special_medicine_option[i].name
        }
      }
    }
  },
  created () {
    this.active = parseInt(this.$route.query.active)
    setRem()
    setHeight()
    var id = this.$route.query.id

    var patientid = this.$route.query.patientid
    this.patientid = patientid

    this.getLongDialysisDetail(id)
    this.anticoagulantsSet = this.$store.getters.anticoagulants_set
    this.replacementWays = this.$store.getters.replacement_ways
    this.anticoagulantsConfit = this.$store.getters.anticoagulants_confit
    this.blood_filters = this.$store.getters.blood_filters
    this.dialysate_formulation = this.$store.getters.dialysate_formulation
    this.body_fluid_option = this.$store.getters.body_fluid
    this.special_medicine_option = this.$store.getters.special_medicine
    this.displace_liqui_part_option = this.$store.getters.displace_liqui
    this.blood_access_option = this.$store.getters.blood_access
  }
}
</script>
<style lang="scss" scoped>
.page_allLongDialysis {
  height: 100%;
  overflow-y: auto;
  .allLongDialysisTitle {
    background: #fff;
    padding: 0 1.125rem;
    height: 3.125rem;
    display: flex;
    align-items: center;
  }
  .jiantou {
    font-size: 1.5rem;
    font-weight: 600;
    margin-right: 4.5rem;
  }
  .titleName {
    font-size: 1.125rem;
    font-weight: 600;
  }
  .dialysisBox {
    padding: 0 1.125rem;
    margin-bottom: 3.125rem;
  }
  .dialysisBoxOne {
    box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
    padding-bottom: 1.25rem;
    .time {
      font-size: 1.125rem;
      margin-top: 0.625rem;
      font-weight: bold;
    }
  }
  .orderContent {
    font-size: 0.875rem;
    color: rgba(49, 50, 52, 1);
    margin-top: 0.625rem;
    display: flex;
    flex-wrap: wrap;
    p {
      line-height: 1.5rem;
      width: 50%;
    }
  }
}
::-webkit-scrollbar {
  width: 0;
}
</style>
