<template>
  <div class="medical-history">
    <div class="flex-vertical-center-l">
      <!-- <div class="flex-center" @click="$router.back()">返回</div> -->
      <el-button size="mini" type="primary" @click="$router.back()">返回</el-button>
    </div>

    <!-- 底部表格 -->
    <div class="today-table">
      <!-- <div class="screening-title flex-vertical-center-l">
                <span></span>
                <div>患者病案</div>
      </div>-->
      <div class="table-content">
        <el-table :data="tableData" stripe style="width: 100%" @row-click="toDetail" height="100%">
          <el-table-column prop="id" label="序号"></el-table-column>

          <el-table-column prop="diseaseName" label="病名"></el-table-column>
          <el-table-column prop="name" label="姓名"></el-table-column>
          <el-table-column prop="sex" label="性别"></el-table-column>
          <el-table-column prop="age" label="年龄"></el-table-column>

          <el-table-column prop="endTime" label="末次就诊时间"></el-table-column>
        </el-table>
      </div>
      <div class="today-page mr-t20 flex-vertical-center-r">
        <el-pagination
          background
          layout=" prev, pager, next, jumper, total"
          :total="total"
          :page-size="limit"
          @current-change="sizeC($event)"
        ></el-pagination>
      </div>
    </div>
  </div>
</template>
<script>
import { getPatiensCase } from "@/api/business.js";
export default {
  data() {
    return {
      tableData: [],
      page: 1,
      limit: 10,
      total: 0
    };
  },
  created() {
    this.getPatiensCase();
  },
  methods: {
    toDetail(row, c, e) {
      this.$router.push({
        path:
          "/index/medRdetail?pid=" +
          row.pid +
          "&name=" +
          row.diseaseName +
          "&endTime=" +
          row.endTime
      });
    },
    sizeC() {
      this.getPatiensCase();
    },
    async getPatiensCase() {
      let params = {
        patientId: this.$route.query.pid,
        page: this.page,
        limit: this.limit
      };
      let res = await getPatiensCase(params);
      if (res.ResultCode == 0) {
        this.tableData = res.Data.Items;
        this.total = res.Data.TotalRecordCount;
        this.tableData.filter((item, index) => {
          return (item.id = index + 1);
        });
      }
    }
  }
};
</script>
<style lang="scss" scoped>
@import "../../style/common.scss";
@import "../../style/base.scss";

.medical-history {
  .bottom-table {
    margin-top: 20px;
    // padding: 33px 46px;
    background: #ffffff;
    border-radius: 5px;
    padding-bottom: 20px;
  }

  .today-table {
    margin-top: 10px;
    background: #ffffff;
    border-radius: 5px;
    // padding-bottom: 20px;
    padding: 5px;
    height: 72vh;
  }

  .btns {
    margin-bottom: 20px;

    div {
      width: 74px;
      height: 36px;
      background: #5386f6;
      border-radius: 4px;
      font-size: 14px;
      font-family: PingFang SC;
      font-weight: 400;
      color: #ffffff;
      margin-right: 20px;
    }

    .bg-yellow {
      background: #ffae45;
    }
  }

  .today-page {
    margin-top: 10px;
  }

  .table-content {
    height: 90%;

    .find-detail {
      width: 60px;
      height: 24px;
      border: 1px solid #5386f6;
      border-radius: 2px;
      text-align: center;
      color: #fff;
      font-size: 14px;
      cursor: pointer;
      margin: 0 auto;
      background: #5386f6;
    }
  }
}

.table-content::v-deep .el-table .cell {
  text-align: center;
}
</style>

<style lang="scss" scoped>
@media screen and (min-width: 1681px) and (max-width: 1920px) {
  .medical-history {
    .today-table {
      height: 82vh;
    }

    .table-content {
      height: 94%;
    }
  }

  .today-table::v-deep .el-table td {
    padding: 18px 0;
  }

  .today-table::v-deep .el-table th {
    padding: 18px 0;
  }
}

@media screen and (min-width: 1601px) and (max-width: 1680px) {
  .medical-history {
    .today-table {
      height: 81vh;
    }

    .table-content {
      height: 94%;
    }
  }

  .today-table::v-deep .el-table td {
    padding: 18px 0;
  }

  .today-table::v-deep .el-table th {
    padding: 18px 0;
  }
}

@media screen and (min-width: 1361px) and (max-width: 1600px) {
  .medical-history {
    .today-table {
      height: 78vh;
    }

    .table-content {
      height: 93%;
    }
  }

  .today-table::v-deep .el-table td {
    padding: 12px 0;
  }

  .today-table::v-deep .el-table th {
    padding: 12px 0;
  }
}

@media screen and(min-width:1281px) and (max-width: 1360px) {
  .medical-history {
    .today-table {
      height: 73vh;
    }

    .table-content {
      height: 90%;
    }
  }

  .today-table::v-deep .el-table td {
    padding: 5px 0;
  }

  .today-table::v-deep .el-table th {
    padding: 5px 0;
  }
}
</style>