<template>
  <div class="app-container">
    <el-table
      v-loading="loading"
      :data="patientMasterList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="50" align="center" />
      <el-table-column
        label="门诊住院号"
        align="center"
        key="encounterBusNo"
        prop="encounterBusNo"
        width="200"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="患者姓名"
        align="center"
        key="patientName"
        prop="patientName"
         width="140"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="身份证号"
        align="center"
        key="idCard"
        prop="idCard"
        width="200"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="人员编码"
        align="center"
        key="psnNo"
        prop="psnNo"
        width="200"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="参保地区"
        align="center"
        key="insuPlcNo"
        prop="insuPlcNo"
        width="140px"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="参保类型"
        align="center"
        key="ybType"
        prop="ybType"
         width="140"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="入院时间"
        align="center"
        key="encounterStartTime"
        prop="encounterStartTime"
        width="160"
        :show-overflow-tooltip="true"
      >
        <template #default="scope">
          <span>{{ parseTime(scope.row.occurrenceTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="出院时间"
        align="center"
        key="encounterEndTime"
        prop="encounterEndTime"
        width="160"
        :show-overflow-tooltip="true"
      >
        <template #default="scope">
          <span>{{ parseTime(scope.row.approvalTime) }}</span>
        </template>
      </el-table-column>
            <el-table-column
        label="处方日期"
        align="center"
        key="issueTime"
        prop="issueTime"
        width="160"
        :show-overflow-tooltip="true"
      >
        <template #default="scope">
          <span>{{ parseTime(scope.row.approvalTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="出院诊断"
        align="center"
        key="outDiagnoseName"
        prop="outDiagnoseName"
        width="160"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="总费用（元）"
        align="center"
        key="feeAmount"
        prop="feeAmount"
        width="140"
        :show-overflow-tooltip="true"
      />
       <el-table-column
        label="政策范围内"
        align="center"
        key="inscpScpAmt"
        prop="inscpScpAmt"
        width="100"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="基本医保统筹支付金额（元）"
        align="center"
        key="tcPayAmount"
        prop="tcPayAmount"
        width="200"
        :show-overflow-tooltip="true"
      />
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      v-model:page="queryParams.pageNo"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script setup name="patientMasterDetails">
import {getReportPatientMasterDetail} from './statisticalManagent';


const patientMasterList = ref([]);
const loading = ref(true);
const ids = ref([]);
const total = ref(0);

const queryParams = ref({
    pageNo: 1,
    pageSize: 10,
    searchKey: undefined,
    encounterBusNo: undefined,
    patientName: undefined,
});

/** 查询调拨管理项目列表 */
function getList() {
  loading.value = true;
  getReportPatientMasterDetail(queryParams.value).then((res) => {
    loading.value = false;
    patientMasterList.value = res.data.records;
    total.value = res.data.total;
  })
}

/** 选择条数  */
function handleSelectionChange(selection) {
  ids.value = selection.map((item) => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}

// 页面加载时获取数据
onMounted(() => {
  getList();
});

</script>
<style scoped>
.custom-tree-node {
  display: flex;
  align-items: center;
}

.title {
  font-weight: bold;
  font-size: large;
  margin-bottom: 10px;
}
</style>