<template>
  <div class="overView">
    <div v-for="(item, index) in tableData" :key="index" style="width: 100%;">
      <div class="vieweBox">
        <span class="title">{{ item.category }}</span>
        <span class="time">{{ item.createTime }}</span>
      </div>
      <div v-if="item.category === '门诊'" style="width: 100%;padding-right: 24px;display: flex;justify-content: space-between">
        <div>
          <p class="info">
            <span class="mr16">主诉:</span>
            <span>{{ item.zs }}</span>
          </p>
          <p class="info">
            <span class="mr16">现病史:</span>
            <span>{{ item.xbs }}</span>
          </p>
          <p class="info">
            <span class="mr16">既往史:</span>
            <span>{{ item.jws }}</span>
          </p>
          <p class="info">
            <span class="mr16">诊断:</span>
            <span>{{ item.zd }}</span>
          </p>
          <p class="info">
            <span class="mr16">治疗意见:</span>
            <span>{{ item.zlyj }}</span>
          </p>
        </div>
        <div>
          <p class="info">
            <span class="mr16">处置:</span>
          </p>
          <p class="info">
            <span class="mr16">检查:</span>
            <span>{{ item.jc }}</span>
          </p>
          <p class="info">
            <span class="mr16">用药:</span>
            <span>{{ item.yy }}</span>
          </p>
          <p class="info">
            <span class="mr16">治疗:</span>
            <span>{{ item.zl }}</span>
          </p>
        </div>
      </div>
      <div v-if="item.category === '手术'">
        <p class="info">
          <span class="mr16">手术名称:</span>
          <span>{{ item.opName }}</span>
        </p>
        <p class="info">
          <span class="mr16">主刀医生:</span>
          <span>{{ item.mainDrName }}</span>
        </p>
        <p class="info">
          <span class="mr16">手术记录:</span>
          <span></span>
        </p>
      </div>
    </div>
  </div>
</template>
<script>
const Base64 = require('js-base64').Base64
export default {
  components: {
  },
  mixins: [],
  props: {
    patientIdNumber: {
      type: String,
      default: ''
    },
    patientId: {
      type: String,
      default: ''
    },
  },
  inject: ['refresh'],
  data() {
    return {
      tableData: [],
      multipleSelection: [],
    }
  },
  created() {

  },
  mounted() {
    this.getHistoryData()
  },
  methods: {
    async getHistoryData() {
      const { data: res } = await this.$http.get('/patient/view/getHistory', {
        params: {
          patientId: '797064'
          // patientId: this.patientId
        }
      })
      if (res.code === 0) {
        this.tableData = res.data || []
      } else {
        this.tableData = []
        this.$message.error(res.msg)
      }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    // 查看报告
    handleRecord() {

    },
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 0) {
        if (rowIndex % 2 === 0) {
          return {
            rowspan: 2,
            colspan: 1
          }
        } else {
          return {
            rowspan: 0,
            colspan: 0
          }
        }
      }
    },
    // 共三个参数，依次为：传递给 data 属性的数组中该节点所对应的对象、节点对应的 Node、节点组件本身
    handleMoveCopyNodeClick(data) {
      this.currentNodeKey = data.id
    }
  }
}
</script>
<style lang="scss" scoped>
.overView{
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  .mt15{
    margin-top: 16px;
  }
  .mr16{
    margin-right: 16px;
  }
  .vieweBox{
    width: 100%;
    padding-left: 16px;
    height: 48px;
    line-height: 48px;
    background-color: #E8F5FF;

    .title{
      font-size: 16px;
      font-weight: 500;
      color: rgba(0, 0, 0, 0.88);
      margin-right: 16px;
    }
    .time{
      color: rgba(0, 0, 0, 0.45);
    }
  }
  .info{
    width: 100%;
    height: 48px;
    line-height: 48px;
    padding-left: 20px;
  }
}
</style>
<style lang="scss">
.specialBox{
  .el-table th{
    background-color: #FAFAFA;
  }
}
</style>
