WXL
2026-09-17 3df460667d74868d0a54fce12d5e881bbd6c0c1a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!-- src/views/statistics/components/CaseDetail.vue -->
<template>
  <div class="case-detail">
    <el-table
      v-loading="loading"
      :data="caseList"
      style="width: 100%"
      border
      stripe
    >
      <el-table-column label="案例编号" prop="caseNo" align="center" />
      <el-table-column label="捐献者姓名" prop="name" align="center" />
      <el-table-column label="住院号" prop="inpatientNo" align="center" />
      <el-table-column label="案例状态" prop="workflow" align="center">
        <template slot-scope="{ row }">
          <el-tag :type="getStatusTag(row.workflow)" size="small">
            {{ getStatusText(row.workflow) }}
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column label="捐献器官" prop="organName" align="center">
        <template slot-scope="{ row }">
          <span v-if="row.organName">{{ row.organName }}</span>
          <span v-else>-</span>
        </template>
      </el-table-column>
      <el-table-column label="案例时间" prop="donatetime" align="center" />
      <el-table-column label="死亡原因" prop="deathReason" align="center" />
      <el-table-column label="医院" prop="treatmentHospitalName" align="center" width="200" />
    </el-table>
 
    <div style="text-align: center; margin-top: 20px;">
      <el-button @click="$emit('close')">关闭</el-button>
    </div>
  </div>
</template>
 
<script>
import { trendList } from '@/api/businessApi';
import { toTotalsList } from '@/utils/totals';
 
export default {
  name: 'CaseDetail',
  props: {
    query: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      loading: false,
      caseList: []
    };
  },
  created() {
    this.loadList();
  },
  watch: {
    query: {
      handler() {
        this.loadList();
      },
      deep: true
    }
  },
  methods: {
    // 加载案例明细:/opo/totals/trendList
    async loadList() {
      this.loading = true;
      try {
        const params = {};
        if (this.query.region) params.area = this.query.region;
        if (this.query.month) {
          params.startTime = `${this.query.month}-01`;
          params.endTime = this.endOfMonth(this.query.month);
        }
        const res = await trendList(params);
        this.caseList = toTotalsList(res);
      } catch (error) {
        console.error('加载案例明细失败:', error);
        this.$message.error('案例明细加载失败');
      } finally {
        this.loading = false;
      }
    },
    // 月份(yyyy-MM) -> 当月最后一天(yyyy-MM-dd)
    endOfMonth(month) {
      const [y, m] = String(month).split('-').map(Number);
      const lastDay = new Date(y, m, 0).getDate();
      return `${month}-${String(lastDay).padStart(2, '0')}`;
    },
    // 工作流状态文案
    getStatusText(workflow) {
      const map = {
        1: '供者维护',
        2: '捐献意愿',
        3: '医学评估',
        4: '死亡判定',
        5: '伦理审查',
        6: '器官分配',
        7: '器官利用',
        99: '捐献完成'
      };
      return map[workflow] || '未知';
    },
    getStatusTag(workflow) {
      if (workflow === 99) return 'success';
      if (workflow) return 'warning';
      return 'info';
    }
  }
};
</script>
 
<style scoped>
.case-detail {
  padding: 0;
}
</style>