<template>
|
<div class="death-judgment-list">
|
<!-- 查询条件 -->
|
<el-card class="search-card">
|
<el-form
|
:model="queryParams"
|
ref="queryForm"
|
:inline="true"
|
label-width="100px"
|
>
|
<el-form-item label="住院号" prop="inpatientno">
|
<el-input
|
v-model="queryParams.inpatientno"
|
placeholder="请输入住院号"
|
clearable
|
style="width: 200px"
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item label="捐献者姓名" prop="name">
|
<el-input
|
v-model="queryParams.name"
|
placeholder="请输入捐献者姓名"
|
clearable
|
style="width: 200px"
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item label="死亡原因" prop="deathreason">
|
<el-select
|
v-model="queryParams.deathreason"
|
placeholder="请选择死亡原因"
|
clearable
|
style="width: 200px"
|
>
|
<el-option label="脑死亡" value="brain_death" />
|
<el-option label="心死亡" value="heart_death" />
|
<el-option label="其他" value="other" />
|
</el-select>
|
</el-form-item>
|
<el-form-item label="死亡时间范围" prop="deathTimeRange">
|
<el-date-picker
|
v-model="queryParams.deathTimeRange"
|
type="daterange"
|
range-separator="至"
|
start-placeholder="开始日期"
|
end-placeholder="结束日期"
|
value-format="yyyy-MM-dd"
|
style="width: 240px"
|
/>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery"
|
>搜索</el-button
|
>
|
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
</el-form-item>
|
</el-form>
|
</el-card>
|
|
<!-- 操作按钮 -->
|
<el-card class="tool-card">
|
<el-row :gutter="10">
|
<el-col :span="16">
|
<!-- <el-button
|
type="primary"
|
icon="el-icon-plus"
|
@click="handleCreate"
|
>新增脑死亡判定</el-button
|
>
|
<el-button
|
type="success"
|
icon="el-icon-plus"
|
@click="handleCreateHeartDeath"
|
>新增心死亡判定</el-button
|
>
|
<el-button
|
type="warning"
|
icon="el-icon-edit"
|
:disabled="single"
|
@click="handleUpdate"
|
>修改</el-button
|
> -->
|
<el-button
|
type="warning"
|
icon="el-icon-download"
|
@click="handleExport"
|
>导出</el-button
|
>
|
</el-col>
|
<el-col :span="8" style="text-align: right">
|
<el-tooltip content="刷新" placement="top">
|
<el-button icon="el-icon-refresh" circle @click="getList" />
|
</el-tooltip>
|
</el-col>
|
</el-row>
|
</el-card>
|
|
<!-- 数据表格 -->
|
<el-card>
|
<el-table
|
v-loading="loading"
|
:data="deathJudgmentList"
|
@selection-change="handleSelectionChange"
|
:header-cell-style="{ background: '#f5f7fa', 'font-weight': 'bold' }"
|
>
|
<el-table-column type="selection" width="55" align="center" />
|
|
<!-- 基础信息列 -->
|
<el-table-column
|
label="住院号"
|
align="center"
|
prop="inpatientno"
|
width="120"
|
fixed="left"
|
/>
|
<el-table-column
|
label="姓名"
|
align="center"
|
prop="name"
|
width="100"
|
fixed="left"
|
/>
|
<el-table-column
|
label="性别"
|
align="center"
|
prop="sex"
|
width="80"
|
fixed="left"
|
>
|
<template slot-scope="scope">
|
<dict-tag
|
:options="dict.type.sys_user_sex"
|
:value="scope.row.sex"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="年龄"
|
align="center"
|
prop="age"
|
width="80"
|
fixed="left"
|
/>
|
|
<el-table-column
|
label="疾病诊断"
|
align="center"
|
prop="diagnosisname"
|
min-width="200"
|
show-overflow-tooltip
|
/>
|
<!-- 状态信息 -->
|
<el-table-column
|
label="判定状态"
|
align="center"
|
prop="state"
|
width="100"
|
>
|
<template slot-scope="scope">
|
<dict-tag
|
:options="dict.type.decide_type"
|
:value="scope.row.state"
|
/>
|
</template>
|
</el-table-column>
|
<!-- 脑死亡判定信息 -->
|
<el-table-column label="脑死亡判定" align="center">
|
<el-table-column
|
label="死亡原因"
|
align="center"
|
prop="deathreason"
|
width="120"
|
>
|
<template slot-scope="scope">
|
<el-tag
|
v-if="scope.row.deathreason"
|
:type="getDeathReasonTagType(scope.row.deathreason)"
|
>
|
{{ getDeathReasonText(scope.row.deathreason) }}
|
</el-tag>
|
<span v-else>-</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="死亡时间"
|
align="center"
|
prop="deathtime"
|
width="160"
|
>
|
<template slot-scope="scope">
|
<span>{{
|
scope.row.deathtime ? formatTime(scope.row.deathtime) : "-"
|
}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="判定医生一"
|
align="center"
|
prop="deathjudgedocto"
|
width="120"
|
>
|
<template slot-scope="scope">
|
{{ scope.row.deathjudgedocto || "-" }}
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="判定医生二"
|
align="center"
|
prop="deathjudgedoctt"
|
width="120"
|
>
|
<template slot-scope="scope">
|
{{ scope.row.deathjudgedoctt || "-" }}
|
</template>
|
</el-table-column>
|
</el-table-column>
|
|
<!-- 心死亡判定信息 -->
|
<el-table-column label="心死亡判定" align="center">
|
<el-table-column
|
label="死亡原因"
|
align="center"
|
prop="heartdeathreason"
|
width="120"
|
>
|
<template slot-scope="scope">
|
<el-tag v-if="scope.row.heartdeathreason" type="danger">
|
{{ getHeartDeathReasonText(scope.row.heartdeathreason) }}
|
</el-tag>
|
<span v-else>-</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="死亡时间"
|
align="center"
|
prop="heartdeathtime"
|
width="160"
|
>
|
<template slot-scope="scope">
|
<span>{{
|
scope.row.heartdeathtime
|
? formatTime(scope.row.heartdeathtime)
|
: "-"
|
}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="判定医生一"
|
align="center"
|
prop="heartdeathjudgedocto"
|
width="120"
|
>
|
<template slot-scope="scope">
|
{{ scope.row.heartdeathjudgedocto || "-" }}
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="判定医生二"
|
align="center"
|
prop="heartdeathjudgedoctt"
|
width="120"
|
>
|
<template slot-scope="scope">
|
{{ scope.row.heartdeathjudgedoctt || "-" }}
|
</template>
|
</el-table-column>
|
</el-table-column>
|
|
<!-- 判定时间和操作列 -->
|
<el-table-column
|
label="判定时间"
|
align="center"
|
prop="createTime"
|
width="160"
|
>
|
<template slot-scope="scope">
|
<span>{{
|
scope.row.createTime ? formatTime(scope.row.createTime) : "-"
|
}}</span>
|
</template>
|
</el-table-column>
|
|
<el-table-column
|
label="操作"
|
align="center"
|
width="200"
|
fixed="right"
|
class-name="small-padding fixed-width"
|
>
|
<template slot-scope="scope">
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-view"
|
@click="handleView(scope.row)"
|
>详情</el-button
|
>
|
<el-dropdown
|
size="mini"
|
@command="command => handleUpdateDropdown(scope.row, command)"
|
>
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-edit"
|
class="el-button--text"
|
>
|
修改<i class="el-icon-arrow-down el-icon--right"></i>
|
</el-button>
|
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-item command="brainDeath">脑死亡</el-dropdown-item>
|
<el-dropdown-item command="heartDeath">心死亡</el-dropdown-item>
|
</el-dropdown-menu>
|
</el-dropdown>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<!-- 分页组件 -->
|
<pagination
|
v-show="total > 0"
|
:total="total"
|
:page.sync="queryParams.pageNum"
|
:limit.sync="queryParams.pageSize"
|
@pagination="getList"
|
/>
|
</el-card>
|
</div>
|
</template>
|
|
<script>
|
import {
|
queryDathInfoBaseInfo,
|
deathinfoedit,
|
deathinfoInfo
|
} from "@/api/businessApi";
|
import Pagination from "@/components/Pagination";
|
|
export default {
|
name: "DeathJudgmentList",
|
components: { Pagination },
|
dicts: ["sys_user_sex", "decide_type"],
|
data() {
|
return {
|
// 遮罩层
|
loading: true,
|
// 选中数组
|
ids: [],
|
// 非单个禁用
|
single: true,
|
// 非多个禁用
|
multiple: true,
|
// 总条数
|
total: 0,
|
// 死亡判定表格数据
|
deathJudgmentList: [],
|
// 查询参数
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
inpatientno: undefined,
|
name: undefined,
|
deathreason: undefined,
|
deathTimeRange: []
|
},
|
// 所有数据(用于前端筛选)
|
allTableData: [],
|
// 死亡原因映射
|
deathReasonMap: {
|
brain_death: { text: "脑死亡", type: "primary" },
|
heart_death: { text: "心死亡", type: "danger" },
|
other: { text: "其他", type: "info" }
|
},
|
// 心死亡原因映射
|
heartDeathReasonMap: {
|
cardiac_arrest: { text: "心搏骤停", type: "danger" },
|
myocardial_infarction: { text: "心肌梗死", type: "danger" },
|
heart_failure: { text: "心力衰竭", type: "danger" },
|
other: { text: "其他", type: "info" }
|
},
|
// 状态映射
|
statusMap: {
|
"0": { text: "维护中", type: "warning" },
|
"1": { text: "已完成", type: "success" },
|
"2": { text: "审核中", type: "info" },
|
"99": { text: "已终止", type: "danger" }
|
}
|
};
|
},
|
created() {
|
this.getList();
|
},
|
methods: {
|
// 获取死亡原因标签类型
|
getDeathReasonTagType(reason) {
|
return this.deathReasonMap[reason]?.type || "info";
|
},
|
|
// 获取死亡原因文本
|
getDeathReasonText(reason) {
|
return this.deathReasonMap[reason]?.text || "未知";
|
},
|
|
// 获取心死亡原因文本
|
getHeartDeathReasonText(reason) {
|
if (!reason) return "-";
|
return this.heartDeathReasonMap[reason]?.text || reason;
|
},
|
|
// 获取状态标签类型
|
getStatusTagType(status) {
|
return this.statusMap[status]?.type || "info";
|
},
|
|
// 获取状态文本
|
getStatusText(status) {
|
return this.statusMap[status]?.text || "未知状态";
|
},
|
|
// 格式化时间
|
formatTime(time) {
|
if (!time) return "-";
|
return this.parseTime(time, "{y}-{m}-{d} {h}:{i}");
|
},
|
|
// 查询死亡判定列表
|
async getList() {
|
this.loading = true;
|
try {
|
const response = await queryDathInfoBaseInfo(this.queryParams);
|
|
// 根据实际接口返回结构调整
|
let realData = [];
|
if (response.code === 200) {
|
realData = response.rows || response.data || [];
|
this.total = response.total || realData.length;
|
} else {
|
realData = [];
|
this.total = 0;
|
}
|
|
// 存储所有数据用于前端筛选
|
this.allTableData = realData;
|
|
// 应用前端筛选条件
|
let filteredData = this.applyFrontendFilter(realData);
|
|
// 前端分页处理(如果接口不支持后端分页)
|
if (
|
this.total === filteredData.length &&
|
this.total > this.queryParams.pageSize
|
) {
|
const startIndex =
|
(this.queryParams.pageNum - 1) * this.queryParams.pageSize;
|
const endIndex = startIndex + this.queryParams.pageSize;
|
this.deathJudgmentList = filteredData.slice(startIndex, endIndex);
|
} else {
|
// 接口已分页,直接使用返回数据
|
this.deathJudgmentList = filteredData;
|
}
|
} catch (error) {
|
console.error("获取死亡判定数据失败:", error);
|
this.$message.error("数据加载失败");
|
this.deathJudgmentList = [];
|
this.total = 0;
|
} finally {
|
this.loading = false;
|
}
|
},
|
|
// 应用前端筛选
|
applyFrontendFilter(data) {
|
let filteredData = data;
|
|
// 住院号筛选
|
if (this.queryParams.inpatientno) {
|
filteredData = filteredData.filter(
|
item =>
|
item.inpatientno &&
|
item.inpatientno
|
.toString()
|
.toLowerCase()
|
.includes(this.queryParams.inpatientno.toLowerCase())
|
);
|
}
|
|
// 姓名筛选
|
if (this.queryParams.name) {
|
filteredData = filteredData.filter(
|
item =>
|
item.name &&
|
item.name
|
.toLowerCase()
|
.includes(this.queryParams.name.toLowerCase())
|
);
|
}
|
|
// 死亡原因筛选
|
if (this.queryParams.deathreason) {
|
filteredData = filteredData.filter(item => {
|
// 同时筛选脑死亡和心死亡原因
|
return (
|
item.deathreason === this.queryParams.deathreason ||
|
item.heartdeathreason === this.queryParams.deathreason
|
);
|
});
|
}
|
|
// 死亡时间范围筛选
|
if (
|
this.queryParams.deathTimeRange &&
|
this.queryParams.deathTimeRange.length === 2
|
) {
|
const [startDate, endDate] = this.queryParams.deathTimeRange;
|
filteredData = filteredData.filter(item => {
|
// 同时筛选脑死亡时间和心死亡时间
|
const brainDeathTime = item.deathtime
|
? new Date(item.deathtime).getTime()
|
: null;
|
const heartDeathTime = item.heartdeathtime
|
? new Date(item.heartdeathtime).getTime()
|
: null;
|
const startTime = new Date(startDate).getTime();
|
const endTime = new Date(endDate + " 23:59:59").getTime();
|
|
return (
|
(brainDeathTime &&
|
brainDeathTime >= startTime &&
|
brainDeathTime <= endTime) ||
|
(heartDeathTime &&
|
heartDeathTime >= startTime &&
|
heartDeathTime <= endTime)
|
);
|
});
|
}
|
|
return filteredData;
|
},
|
|
// 搜索按钮操作
|
handleQuery() {
|
this.queryParams.pageNum = 1;
|
this.getList();
|
},
|
|
// 重置按钮操作
|
resetQuery() {
|
this.$refs.queryForm.resetFields();
|
this.queryParams.pageNum = 1;
|
this.getList();
|
},
|
|
// 多选框选中数据
|
handleSelectionChange(selection) {
|
this.ids = selection.map(item => item.id);
|
this.single = selection.length !== 1;
|
this.multiple = !selection.length;
|
},
|
|
// 查看详情
|
handleView(row) {
|
this.$router.push({
|
path: "/case/DecideInfo",
|
query: {
|
id: row.id,
|
infoid: row.infoid,
|
type: this.getDeathType(row) // 传递死亡类型
|
}
|
});
|
},
|
|
// 获取死亡类型
|
getDeathType(row) {
|
if (row.deathreason && row.deathreason.includes("brain")) {
|
return "brain";
|
} else if (row.heartdeathreason) {
|
return "heart";
|
}
|
return "brain"; // 默认脑死亡
|
},
|
|
// 新增脑死亡判定
|
handleCreate() {
|
this.$router.push({
|
path: "/case/DecideInfo",
|
query: { type: "brain" }
|
});
|
},
|
|
// 新增心死亡判定
|
handleCreateHeartDeath() {
|
this.$router.push({
|
path: "/case/DecideInfo",
|
query: { type: "heart" }
|
});
|
},
|
|
// 修改按钮操作(下拉菜单)
|
handleUpdateDropdown(row, command) {
|
const id = row.id;
|
const infoid = row.infoid;
|
|
if (command === "brainDeath") {
|
// 修改脑死亡判定
|
this.$router.push({
|
path: "/case/DecideInfo",
|
query: {
|
id: id,
|
infoid: infoid,
|
type: "brain",
|
isEdit: true
|
}
|
});
|
} else if (command === "heartDeath") {
|
// 修改心死亡判定
|
this.$router.push({
|
path: "/case/DecideInfo",
|
query: {
|
id: id,
|
infoid: infoid,
|
type: "heart",
|
isEdit: true
|
}
|
});
|
}
|
},
|
|
// 导出按钮操作
|
handleExport() {
|
this.$confirm("是否确认导出所有死亡判定数据?", "警告", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
this.loading = true;
|
// 这里调用导出接口
|
return this.exportData();
|
})
|
.then(response => {
|
if (response.code === 200) {
|
this.$message.success("导出成功");
|
this.downloadExportFile(response);
|
}
|
this.loading = false;
|
})
|
.catch(() => {
|
this.loading = false;
|
});
|
},
|
|
// 导出数据
|
async exportData() {
|
try {
|
// 调用导出接口
|
const response = await exportDeathJudgment(this.queryParams);
|
return response;
|
} catch (error) {
|
console.error("导出失败:", error);
|
this.$message.error("导出失败");
|
throw error;
|
}
|
},
|
|
// 下载导出文件
|
downloadExportFile(response) {
|
// 假设接口返回文件下载地址
|
if (response.data && response.data.fileUrl) {
|
const link = document.createElement("a");
|
link.style.display = "none";
|
link.href = response.data.fileUrl;
|
link.download = "死亡判定数据.xlsx";
|
document.body.appendChild(link);
|
link.click();
|
document.body.removeChild(link);
|
}
|
},
|
|
// 时间格式化工具函数
|
parseTime(time, pattern) {
|
if (!time) return "";
|
const format = pattern || "{y}-{m}-{d} {h}:{i}:{s}";
|
let date;
|
if (typeof time === "object") {
|
date = time;
|
} else {
|
if (typeof time === "string" && /^[0-9]+$/.test(time)) {
|
time = parseInt(time);
|
}
|
if (typeof time === "number" && time.toString().length === 10) {
|
time = time * 1000;
|
}
|
date = new Date(time);
|
}
|
const formatObj = {
|
y: date.getFullYear(),
|
m: date.getMonth() + 1,
|
d: date.getDate(),
|
h: date.getHours(),
|
i: date.getMinutes(),
|
s: date.getSeconds(),
|
a: date.getDay()
|
};
|
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
let value = formatObj[key];
|
if (key === "a") {
|
return ["日", "一", "二", "三", "四", "五", "六"][value];
|
}
|
if (result.length > 0 && value < 10) {
|
value = "0" + value;
|
}
|
return value || 0;
|
});
|
return time_str;
|
}
|
}
|
};
|
</script>
|
|
<style scoped>
|
.death-judgment-list {
|
padding: 20px;
|
}
|
|
.search-card {
|
margin-bottom: 20px;
|
}
|
|
.tool-card {
|
margin-bottom: 20px;
|
}
|
|
.fixed-width .el-button {
|
margin: 0 2px;
|
}
|
|
/* 表格样式优化 */
|
::v-deep .el-table {
|
border: 1px solid #ebeef5;
|
border-radius: 4px;
|
}
|
|
::v-deep .el-table th {
|
background-color: #f5f7fa;
|
font-weight: bold;
|
color: #333;
|
}
|
|
::v-deep .el-table .cell {
|
padding: 8px 4px;
|
line-height: 1.5;
|
}
|
|
::v-deep .el-table--border td,
|
::v-deep .el-table--border th {
|
border-right: 1px solid #ebeef5;
|
}
|
|
::v-deep .el-table--border {
|
border: 1px solid #ebeef5;
|
border-bottom: none;
|
}
|
|
/* 多级表头样式 */
|
::v-deep .el-table .el-table__header-wrapper tr:first-child th {
|
background-color: #f8f9fa;
|
border-bottom: 2px solid #409eff;
|
}
|
|
::v-deep .el-table .el-table__header-wrapper tr:nth-child(2) th {
|
background-color: #f0f7ff;
|
}
|
|
/* 操作列按钮样式 */
|
.el-dropdown-link {
|
cursor: pointer;
|
color: #409eff;
|
}
|
|
.el-dropdown-link:hover {
|
color: #66b1ff;
|
}
|
|
/* 标签样式优化 */
|
::v-deep .el-tag {
|
margin: 2px;
|
border-radius: 12px;
|
font-size: 12px;
|
padding: 0 8px;
|
height: 24px;
|
line-height: 22px;
|
}
|
|
/* 分页样式 */
|
.pagination-container {
|
margin-top: 20px;
|
padding: 10px 0;
|
background: #fff;
|
border: 1px solid #ebeef5;
|
border-top: none;
|
border-radius: 0 0 4px 4px;
|
}
|
</style>
|