<template>
  <div class="page_allScheduling">
    <van-sticky>
      <div class="allSchedulingTitle">
        <i class="iconfont icon-zuojiantou jiantou" @click="toReturn"></i>
        <span class="titleName">{{ name }}的排班信息</span>
      </div>
    </van-sticky>
    <div class="dialysisBox">
      <div class="dialysisBoxOne">
        <p class="time">{{ getTime(schedulingDetail.schedule_date) }}</p>
        <div class="orderContent">
          <p>班次：{{ schedulingDetail.schedule_type }}</p>
          <p>分区：{{ schedulingDetail.name }}</p>
          <p>机号：{{ schedulingDetail.number }}</p>
          <p>治疗模式：{{ schedulingDetail.mode_id }}</p>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getSchedulingDetail } from '@/api/patient/patient'
import { uParseTime } from '@/utils/tools'
import { setRem, setHeight } from '@/libs/functionRem'
import '../../../styles/resetStyle.scss'
export default {
  data () {
    return {
      name: '',
      schedulingDetail: {},
      patientid: 0,
      active: 0,
      date: 0,
      patient_name: ''
    }
  },
  methods: {
    getSchedulingDetail (id) {
      getSchedulingDetail(id).then(response => {
        if (response.data.state === 1) {
          var schedulingDetail = response.data.data.schedulingDetail
          if (schedulingDetail.mode_id == 1) {
            schedulingDetail.mode_id = 'HD'
          }
          if (schedulingDetail.mode_id == 2) {
            schedulingDetail.mode_id = 'HDF'
          }
          if (schedulingDetail.mode_id == 3) {
            schedulingDetail.mode_id = 'HD+HP'
          }
          if (schedulingDetail.mode_id == 4) {
            schedulingDetail.mode_id = 'HP'
          }
          if (schedulingDetail.mode_id == 5) {
            schedulingDetail.mode_id = 'HF'
          }
          if (schedulingDetail.mode_id == 6) {
            schedulingDetail.mode_id = 'SCUF'
          }
          if (schedulingDetail.mode_id == 7) {
            schedulingDetail.mode_id = 'IUF'
          }
          if (schedulingDetail.mode_id == 8) {
            schedulingDetail.mode_id = 'HFHD'
          }
          if (schedulingDetail.mode_id == 9) {
            schedulingDetail.mode_id = 'HFHD+HP'
          }
          if (schedulingDetail.mode_id == 10) {
            schedulingDetail.mode_id = 'PHF'
          }
          if (schedulingDetail.mode_id == 11) {
            schedulingDetail.mode_id = 'HFR'
          }
          if (schedulingDetail.mode_id == 12) {
            schedulingDetail.mode_id = 'HDF+HP'
          }
          if (schedulingDetail.mode_id == 13) {
            schedulingDetail.mode_id = 'CRRT'
          }
          if (schedulingDetail.mode_id == 14) {
            schedulingDetail.mode_id = '腹水回输'
          }
           if (schedulingDetail.mode_id == 21) {
            schedulingDetail.mode_id = 'HD+'
          }
           if (schedulingDetail.mode_id == 24) {
            schedulingDetail.mode_id = 'I-HDF'
          }
           if (schedulingDetail.mode_id == 25) {
            schedulingDetail.mode_id = 'HD高通'
          }
           if (schedulingDetail.mode_id == 26) {
            schedulingDetail.mode_id = 'CVVH'
          }
           if (schedulingDetail.mode_id == 27) {
            schedulingDetail.mode_id = 'CVVHD'
          }
          if (schedulingDetail.mode_id == 28) {
            schedulingDetail.mode_id = 'CVVHDF'
          }
          if (schedulingDetail.schedule_type == 1) {
            schedulingDetail.schedule_type = '上午'
          }
          if (schedulingDetail.schedule_type == 2) {
            schedulingDetail.schedule_type = '中午'
          }
          if (schedulingDetail.schedule_type == 3) {
            schedulingDetail.schedule_type = '下午'
          }
          this.schedulingDetail = schedulingDetail
          var patient = response.data.data.patient
          this.name = patient.name
        }
      })
    },
    getTime (time) {
      // return uParseTime(time, "{y}-{m}-{d} {h}:{i}:{s}");
      return uParseTime(time, '{y}-{m}-{d}')
    },
    toReturn () {
      this.$router.push(
        '/details?patient_id=' + this.patientid + '&date=' + this.date + '&patient_name=' + this.patient_name + '&active1=' + 1 + '&active2=' + 7
      )
    }
  },
  created () {
    setRem()
    setHeight()
    var id = this.$route.query.id
    var patientid = this.$route.query.patientid
    this.patientid = patientid
    this.getSchedulingDetail(id)
    this.date = this.$route.query.date
    this.patient_name = this.$route.query.patient_name
  }
}
</script>
<style lang="scss" scoped>
.page_allScheduling {
  height: 100%;
  overflow-y: auto;
  .allSchedulingTitle {
    background: #fff;
    padding: 0 1.125rem;
    height: 3.125rem;
    display: flex;
    align-items: center;
  }
  .jiantou {
    font-size: 1.5rem;
    font-weight: 600;
    margin-right: 5.5rem;
  }
  .titleName {
    font-size: 1.125rem;
    font-weight: 600;
  }
  .dialysisBox {
    padding: 0 1.125rem;
    margin-bottom: 3.125rem;
    >div:last-child{
      border: none;
    }
  }

  .dialysisBoxOne {
    // box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e5e5e5;
    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>
