<template>
  <div class="page_allCourse">
    <van-sticky>
      <div class="allCourseTitle">
        <i class="iconfont icon-zuojiantou jiantou" @click="toReturn"></i>
        <span class="titleName">{{ couseDetail.name }}的病程记录</span>
      </div>
    </van-sticky>
    <div class="courseBox">
      <div class="courseOne">
        <div class="statOrder">
          <p class="time">{{ getTime(couseDetail.record_time) }}</p>
          <div class="statOrderTitle">
            <span>{{ couseDetail.title }}</span>
          </div>
          <div class="orderContent">
            <p>
              <span v-html="couseDetail.content"></span>
            </p>
          </div>
          <div class="doctorBox">
            <p>记录医生：{{ couseDetail.user_name }}</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import '../../../styles/resetStyle.scss'
import { getCouseManagementDetail } from '@/api/patient/patient'
import { uParseTime } from '@/utils/tools'
import { setRem, setHeight } from '@/libs/functionRem'
export default {
  data () {
    return {
      couseDetail: {
        name: '',
        record_time: '',
        content: '',
        title: '',
        user_name: ''
      },
      id: 0,
      active: 0,
      date: 0,
      patient_name: 0,
      patient_id: 0
    }
  },
  methods: {
    getCouseManagementDetail (id) {
      getCouseManagementDetail(id).then(response => {
        if (response.data.state === 1) {
          var couseDetail = response.data.data.couseDetail
          this.couseDetail.name = couseDetail.name
          this.couseDetail.record_time = couseDetail.record_time
          this.couseDetail.content = couseDetail.content
          this.couseDetail.title = couseDetail.title
          this.couseDetail.user_name = couseDetail.user_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.patient_id + '&date=' + this.date + '&patient_name=' + this.patient_name + '&active1=' + 1 + '&active2=' + 5
      )
    }
  },
  created () {
    this.active = parseInt(this.$route.query.active)
    setRem()
    setHeight()
    var id = this.$route.query.id
    this.getCouseManagementDetail(id)
    var patientid = this.$route.query.patientid
    this.id = patientid
    this.patient_id = this.$route.query.patientid
    this.date = this.$route.query.date
    this.patient_name = this.$route.query.patient_name
  }
}
</script>
<style lang="scss" scoped>
.page_allCourse {
  height: 100%;
  overflow-y: auto;
  .allCourseTitle {
    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;
  }
  .courseBox {
    padding: 0 1.125rem;
    margin-bottom: 3.125rem;
  }
  .courseOne {
    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;
    }
  }
  .statOrderTitle {
    color: #5b98ff;
    font-size: 0.8125rem;
    font-weight: bold;
    margin: 0.625rem 0;
  }
  .orderContent {
    font-size: 0.875rem;
    color: rgba(49, 50, 52, 1);
    p {
      line-height: 1.125rem;
    }
  }
  .doctorBox {
    font-size: 0.75rem;
    color: rgba(152, 152, 152, 1);
    line-height: 1.125rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.625rem;
  }
}
::-webkit-scrollbar {
  width: 0;
}
</style>
