<template>
  <div class="app-container">
    <el-table
      v-loading="loading"
      :data="patientDetailsList"
      @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="medName"
        prop="medName"
         width="140"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="药品医保编码"
        align="center"
        key="medYbNo"
        prop="medYbNo"
        width="200"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="药品类别"
        align="center"
        key="categoryCode_dictText"
        prop="categoryCode_dictText"
        width="200"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="剂型"
        align="center"
        key="doseFormCode_dictText"
        prop="doseFormCode_dictText"
        width="140px"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="规格"
        align="center"
        key="totalVolume"
        prop="totalVolume"
         width="140"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="计价单位"
        align="center"
        key="unitCode_dictText"
        prop="unitCode_dictText"
        width="160"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="是否中选产品"
        align="center"
        key="isSelected"
        prop="isSelected"
        width="140"
        :show-overflow-tooltip="true"
      />
       <el-table-column
        label="生产企业"
        align="center"
        key="manufacturerText"
        prop="manufacturerText"
        width="100"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="单价（元）"
        align="center"
        key="price"
        prop="price"
        width="200"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="使用数量（片袋支）"
        align="center"
        key="quantity"
        prop="quantity"
        width="200"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="使用总金额（元）"
        align="center"
        key="totalPrice"
        prop="totalPrice"
        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="patientDetails">
import {
  getReportPatientDetails
} from './statisticalManagent';


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

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

/** 查询调拨管理项目列表 */
function getList() {
  loading.value = true;
  getReportPatientDetails(queryParams.value).then((res) => {
    loading.value = false;
    patientDetailsList.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>