WXL
2026-05-17 3453ba7e5243022ad4388da1515dc75ad8d81f94
src/views/business/decide/index.vue
@@ -62,11 +62,20 @@
    <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="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"
@@ -93,37 +102,32 @@
        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="caseNo"
          width="120"
        />
         <el-table-column
          label="治疗医院"
          align="center"
          prop="treatmenthospitalname"
          width="180"
          show-overflow-tooltip
        />
        -->
       
        <!-- 基础信息列 -->
        <el-table-column
          label="住院号"
          align="center"
          prop="inpatientno"
          width="120"
          fixed="left"
        />
        <el-table-column
          label="姓名"
          align="center"
          prop="name"
          width="120"
          width="100"
          fixed="left"
        />
        <el-table-column label="性别" align="center" prop="sex" width="80">
        <el-table-column
          label="性别"
          align="center"
          prop="sex"
          width="80"
          fixed="left"
        >
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.sys_user_sex"
@@ -131,7 +135,13 @@
            />
          </template>
        </el-table-column>
        <el-table-column label="年龄" align="center" prop="age" width="80" />
        <el-table-column
          label="年龄"
          align="center"
          prop="age"
          width="80"
          fixed="left"
        />
       
        <el-table-column
          label="疾病诊断"
@@ -140,6 +150,22 @@
          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"
@@ -147,9 +173,13 @@
          width="120"
        >
          <template slot-scope="scope">
            <el-tag :type="reasonFilter(scope.row.deathreason)">
              {{ reasonTextFilter(scope.row.deathreason) }}
              <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
@@ -160,9 +190,7 @@
        >
          <template slot-scope="scope">
            <span>{{
              scope.row.deathtime
                ? parseTime(scope.row.deathtime, "{y}-{m}-{d} {h}:{i}")
                : "-"
                scope.row.deathtime ? formatTime(scope.row.deathtime) : "-"
            }}</span>
          </template>
        </el-table-column>
@@ -171,25 +199,75 @@
          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"
        />
        <el-table-column
          label="判定状态"
          align="center"
          prop="recordstate"
          width="100"
        >
          <template slot-scope="scope">
            <el-tag :type="statusFilter(scope.row.recordstate)">
              {{ statusTextFilter(scope.row.recordstate) }}
            </el-tag>
              {{ 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"
@@ -198,16 +276,15 @@
        >
          <template slot-scope="scope">
            <span>{{
              scope.row.createTime
                ? parseTime(scope.row.createTime, "{y}-{m}-{d} {h}:{i}")
                : "-"
              scope.row.createTime ? formatTime(scope.row.createTime) : "-"
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          width="180"
          width="200"
          fixed="right"
          class-name="small-padding fixed-width"
        >
@@ -219,13 +296,23 @@
              @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"
              @click="handleUpdate(scope.row)"
              >修改</el-button
                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>
@@ -253,7 +340,7 @@
export default {
  name: "DeathJudgmentList",
  components: { Pagination },
  dicts: ["sys_user_sex"],
  dicts: ["sys_user_sex", "decide_type"],
  data() {
    return {
      // 遮罩层
@@ -278,49 +365,63 @@
        deathTimeRange: []
      },
      // 所有数据(用于前端筛选)
      allTableData: []
      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: {
    // 死亡原因过滤器
    reasonFilter(reason) {
      const reasonMap = {
        brain_death: "primary",
        heart_death: "danger",
        other: "info"
      };
      return reasonMap[reason] || "info";
    // 获取死亡原因标签类型
    getDeathReasonTagType(reason) {
      return this.deathReasonMap[reason]?.type || "info";
    },
    reasonTextFilter(reason) {
      const reasonMap = {
        brain_death: "脑死亡",
        heart_death: "心死亡",
        other: "其他"
      };
      return reasonMap[reason] || "未知";
    // 获取死亡原因文本
    getDeathReasonText(reason) {
      return this.deathReasonMap[reason]?.text || "未知";
    },
    // 记录状态过滤器
    statusFilter(status) {
      const statusMap = {
        "0": "warning", // 维护中
        "1": "success", // 已完成
        "99": "danger" // 已终止
      };
      return statusMap[status] || "info";
    // 获取心死亡原因文本
    getHeartDeathReasonText(reason) {
      if (!reason) return "-";
      return this.heartDeathReasonMap[reason]?.text || reason;
    },
    statusTextFilter(status) {
      const statusMap = {
        "0": "维护中",
        "1": "已完成",
        "99": "已终止"
      };
      return statusMap[status] || "未知状态";
    // 获取状态标签类型
    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}");
    },
    // 查询死亡判定列表
@@ -331,21 +432,13 @@
        // 根据实际接口返回结构调整
        let realData = [];
        realData = response.data;
        this.total = response.total;
        // if (Array.isArray(response)) {
        //   realData = response;
        // } else if (response && response.data) {
        //   realData = response.data;
        // } else if (response && response.rows) {
        //   realData = response.rows;
        //   this.total = response.total || response.rows.length;
        // } else if (response && response.code === 200) {
        //   realData = response.data.rows || response.data;
        //   this.total = response.data.total || realData.length;
        // } else {
        //   realData = [];
        // }
        if (response.code === 200) {
          realData = response.rows || response.data || [];
          this.total = response.total || realData.length;
        } else {
          realData = [];
          this.total = 0;
        }
        // 存储所有数据用于前端筛选
        this.allTableData = realData;
@@ -354,12 +447,14 @@
        let filteredData = this.applyFrontendFilter(realData);
        // 前端分页处理(如果接口不支持后端分页)
        if (!response.total && !response.data) {
        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);
          this.total = filteredData.length;
        } else {
          // 接口已分页,直接使用返回数据
          this.deathJudgmentList = filteredData;
@@ -383,22 +478,33 @@
        filteredData = filteredData.filter(
          item =>
            item.inpatientno &&
            item.inpatientno.includes(this.queryParams.inpatientno)
            item.inpatientno
              .toString()
              .toLowerCase()
              .includes(this.queryParams.inpatientno.toLowerCase())
        );
      }
      // 姓名筛选
      if (this.queryParams.name) {
        filteredData = filteredData.filter(
          item => item.name && item.name.includes(this.queryParams.name)
          item =>
            item.name &&
            item.name
              .toLowerCase()
              .includes(this.queryParams.name.toLowerCase())
        );
      }
      // 死亡原因筛选
      if (this.queryParams.deathreason) {
        filteredData = filteredData.filter(
          item => item.deathreason === this.queryParams.deathreason
        filteredData = filteredData.filter(item => {
          // 同时筛选脑死亡和心死亡原因
          return (
            item.deathreason === this.queryParams.deathreason ||
            item.heartdeathreason === this.queryParams.deathreason
        );
        });
      }
      // 死亡时间范围筛选
@@ -408,11 +514,24 @@
      ) {
        const [startDate, endDate] = this.queryParams.deathTimeRange;
        filteredData = filteredData.filter(item => {
          if (!item.deathtime) return false;
          const deathTime = new Date(item.deathtime).getTime();
          // 同时筛选脑死亡时间和心死亡时间
          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 deathTime >= startTime && deathTime <= endTime;
          return (
            (brainDeathTime &&
              brainDeathTime >= startTime &&
              brainDeathTime <= endTime) ||
            (heartDeathTime &&
              heartDeathTime >= startTime &&
              heartDeathTime <= endTime)
          );
        });
      }
@@ -443,25 +562,71 @@
    handleView(row) {
      this.$router.push({
        path: "/case/DecideInfo",
        query: { id: row.id,infoid:row.infoid }
        query: {
          id: row.id,
          infoid: row.infoid,
          type: this.getDeathType(row) // 传递死亡类型
        }
      });
    },
    // 新增按钮操作
    handleCreate() {
      this.$router.push("/case/DecideInfo");
    // 获取死亡类型
    getDeathType(row) {
      if (row.deathreason && row.deathreason.includes("brain")) {
        return "brain";
      } else if (row.heartdeathreason) {
        return "heart";
      }
      return "brain"; // 默认脑死亡
    },
    // 修改按钮操作
    handleUpdate(row) {
      const id = row.id || this.ids[0];
    // 新增脑死亡判定
    handleCreate() {
      this.$router.push({
        path: "/case/DecideInfo",
        query: { id: id,infoid:row.infoid, isEdit: true }
        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: "确定",
@@ -470,19 +635,13 @@
      })
        .then(() => {
          this.loading = true;
          // 模拟导出操作
          return new Promise(resolve => {
            setTimeout(() => {
              resolve({ code: 200 });
            }, 1000);
          });
          // 这里调用导出接口
          return this.exportData();
        })
        .then(response => {
          if (response.code === 200) {
            this.$message.success("导出成功");
            // 实际项目中这里处理文件下载
            // 可以添加以下代码来触发文件下载
            // this.downloadFile();
            this.downloadExportFile(response);
          }
          this.loading = false;
        })
@@ -491,18 +650,34 @@
        });
    },
    // 文件下载方法(预留)
    downloadFile() {
      // 实际项目中的文件下载逻辑
    // 导出数据
    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 = "/api/export/death-judgment"; // 替换为实际导出接口
        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}";
@@ -557,16 +732,73 @@
}
.fixed-width .el-button {
  margin: 0 5px;
  margin: 0 2px;
}
/* 表格样式优化 */
::v-deep .el-table .cell {
  padding: 8px 4px;
::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>