WXL
3 天以前 4c9fdc87987140e8b2c3f0dfc2f6608cdb6be774
src/views/business/ethicalReview/index.vue
@@ -8,37 +8,47 @@
        :inline="true"
        label-width="100px"
      >
        <el-form-item label="住院号" prop="hospitalNo">
        <el-form-item label="住院号" prop="inpatientno">
          <el-input
            v-model="queryParams.hospitalNo"
            v-model="queryParams.inpatientno"
            placeholder="请输入住院号"
            clearable
            style="width: 200px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="捐献者姓名" prop="donorName">
        <el-form-item label="捐献者姓名" prop="name">
          <el-input
            v-model="queryParams.donorName"
            v-model="queryParams.name"
            placeholder="请输入捐献者姓名"
            clearable
            style="width: 200px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="伦理结论" prop="ethicsConclusion">
        <el-form-item label="案例编号" prop="caseNo">
          <el-input
            v-model="queryParams.caseNo"
            placeholder="请输入案例编号"
            clearable
            style="width: 200px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="伦理状态" prop="status">
          <el-select
            v-model="queryParams.ethicsConclusion"
            placeholder="请选择伦理结论"
            v-model="queryParams.status"
            placeholder="请选择伦理状态"
            clearable
            style="width: 200px"
          >
            <el-option label="审查中" value="reviewing" />
            <el-option label="同意" value="approved" />
            <el-option label="修改后同意" value="approved_with_modifications" />
            <el-option label="修改后重审" value="re-review" />
            <el-option label="不同意" value="disapproved" />
            <el-option label="终止审查" value="terminated" />
            <el-option label="全部" value="" />
            <el-option
              v-for="dict in dict.type.sys_ethical"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="审查时间范围" prop="reviewTimeRange">
@@ -65,33 +75,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 type="primary" icon="el-icon-plus" @click="handleCreate"
            >新建审查</el-button
          >
          <el-button
          > -->
          <!-- <el-button
            type="success"
            icon="el-icon-edit"
            :disabled="single"
            @click="handleUpdate"
            >修改</el-button
          >
          <el-button
            type="danger"
            icon="el-icon-delete"
            :disabled="multiple"
            @click="handleDelete"
            >删除</el-button
          >
          <el-button
            type="warning"
            icon="el-icon-download"
            @click="handleExport"
            >导出</el-button
          >
          > -->
          <el-button
            type="info"
            icon="el-icon-check"
            :disabled="multiple"
            :disabled="single"
            @click="handleEndReview"
            >结束审查</el-button
          >
@@ -115,88 +112,101 @@
        <el-table-column
          label="住院号"
          align="center"
          prop="hospitalNo"
          prop="inpatientno"
          width="120"
        />
        <el-table-column
          label="捐献者姓名"
          align="center"
          prop="donorName"
          width="120"
        />
        <el-table-column label="性别" align="center" prop="gender" width="80">
        <el-table-column label="姓名" align="center" prop="name" width="100" />
        <el-table-column label="性别" align="center" prop="sex" width="80">
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.sys_user_sex"
              :value="parseInt(scope.row.gender)"
              :value="scope.row.sex"
            />
          </template>
        </el-table-column>
        <el-table-column label="年龄" align="center" prop="age" width="80" />
        <el-table-column
          label="疾病诊断"
          align="center"
          prop="diagnosis"
          min-width="180"
          show-overflow-tooltip
        />
        <el-table-column
          label="伦理结论"
          align="center"
          prop="ethicsConclusion"
          width="120"
        >
        <el-table-column label="血型" align="center" prop="bloodtype" width="80">
          <template slot-scope="scope">
            <el-tag :type="conclusionFilter(scope.row.ethicsConclusion)">
              {{ conclusionTextFilter(scope.row.ethicsConclusion) }}
            </el-tag>
            <dict-tag
              :options="dict.type.sys_BloodType"
              :value="scope.row.bloodtype"
            />
          </template>
        </el-table-column>
        <el-table-column
          label="伦理意见"
          label="疾病诊断"
          align="center"
          prop="ethicsOpinion"
          min-width="200"
          prop="diagnosisname"
          width="200"
          show-overflow-tooltip
        />
        <el-table-column
          label="捐献类型"
          align="center"
          prop="donationcategory"
          width="180"
        >
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.sys_DonationCategory"
              :value="scope.row.donationcategory"
            />
          </template>
        </el-table-column>
        <el-table-column
          label="审查状态"
          align="center"
          prop="status"
          width="100"
        >
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.sys_ethical"
              :value="scope.row.status"
            />
          </template>
        </el-table-column>
        <!-- <el-table-column
          label="审查结论"
          align="center"
          prop="expertConclusion"
          width="120"
        >
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.expert_Conclusion"
              :value="scope.row.expertConclusion"
            />
          </template>
        </el-table-column> -->
        <el-table-column
          label="审查意见"
          align="center"
          prop="expertOpinion"
          min-width="150"
          show-overflow-tooltip
        />
        <el-table-column
          label="审查时间"
          align="center"
          prop="reviewTime"
          prop="expertTime"
          width="160"
        >
          <template slot-scope="scope">
            <span>{{
              scope.row.reviewTime
                ? parseTime(scope.row.reviewTime, "{y}-{m}-{d} {h}:{i}")
              scope.row.expertTime
                ? parseTime(scope.row.expertTime, "{y}-{m}-{d} {h}:{i}")
                : "-"
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="登记时间"
          align="center"
          prop="registrationTime"
          width="160"
        >
          <template slot-scope="scope">
            <span>{{
              scope.row.registrationTime
                ? parseTime(scope.row.registrationTime, "{y}-{m}-{d} {h}:{i}")
                : "-"
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="登记人"
          align="center"
          prop="registrant"
          width="100"
        />
        <el-table-column
          label="操作"
          align="center"
          width="260"
          width="220"
          fixed="right"
          class-name="small-padding fixed-width"
        >
          <template slot-scope="scope">
@@ -204,31 +214,22 @@
              size="mini"
              type="text"
              icon="el-icon-view"
              @click="handleView(scope.row)"
              >详情</el-button
              @click.stop="handleView(scope.row)"
              >查看</el-button
            >
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
              >修改</el-button
              @click.stop="handleUpdate(scope.row)"
              >编辑</el-button
            >
            <el-button
              size="mini"
              type="text"
              icon="el-icon-check"
              @click="handleEndReview(scope.row)"
              :disabled="scope.row.ethicsConclusion === 'terminated'"
              >结束</el-button
            >
            <el-button
              size="mini"
              type="text"
              icon="el-icon-delete"
              style="color: #F56C6C"
              @click="handleDelete(scope.row)"
              >删除</el-button
              icon="el-icon-printer"
              @click.stop="handleDownload(scope.row)"
              >打印</el-button
            >
          </template>
        </el-table-column>
@@ -247,19 +248,33 @@
</template>
<script>
import { listEthicsReview, delEthicsReview, exportEthicsReview, endEthicsReview } from "./ethicsReview";
import {
  reviewinitiateBaseInfoList,
  ethicalreviewedit,
  ethicalReviewDownload
} from "@/api/businessApi";
import Pagination from "@/components/Pagination";
import { getToken } from "@/utils/auth";
export default {
  name: "EthicsReviewList",
  components: { Pagination },
  dicts: ["sys_user_sex"],
  dicts: [
    "sys_user_sex",
    "ReviewForm_status",
    "sys_ethical",
    "expert_Conclusion",
    "sys_BloodType",
    "sys_DonationCategory"
  ],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 选中的行数据
      selectedRows: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
@@ -272,9 +287,10 @@
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        hospitalNo: undefined,
        donorName: undefined,
        ethicsConclusion: undefined,
        inpatientno: undefined,
        name: undefined,
        caseNo: undefined,
        status: undefined,
        reviewTimeRange: []
      }
    };
@@ -283,39 +299,36 @@
    this.getList();
  },
  methods: {
    // 伦理结论过滤器
    conclusionFilter(conclusion) {
      const conclusionMap = {
        "reviewing": "warning", // 审查中
        "approved": "success", // 同意
        "approved_with_modifications": "primary", // 修改后同意
        "re-review": "info", // 修改后重审
        "disapproved": "danger", // 不同意
        "terminated": "info" // 终止审查
      };
      return conclusionMap[conclusion] || "info";
    },
    conclusionTextFilter(conclusion) {
      const conclusionMap = {
        "reviewing": "审查中",
        "approved": "同意",
        "approved_with_modifications": "修改后同意",
        "re-review": "修改后重审",
        "disapproved": "不同意",
        "terminated": "终止审查"
      };
      return conclusionMap[conclusion] || "未知";
    },
    // 查询伦理审查列表
    getList() {
      this.loading = true;
      listEthicsReview(this.queryParams)
      // 处理查询参数
      const params = {
        ...this.queryParams
      };
      // 移除分页参数以外的额外参数
      delete params.reviewTimeRange;
      // 如果有时间范围参数
      if (
        this.queryParams.reviewTimeRange &&
        this.queryParams.reviewTimeRange.length === 2
      ) {
        params.expertTimeStart =
          this.queryParams.reviewTimeRange[0] + " 00:00:00";
        params.expertTimeEnd =
          this.queryParams.reviewTimeRange[1] + " 23:59:59";
      }
      reviewinitiateBaseInfoList(params)
        .then(response => {
          if (response.code === 200) {
            this.ethicsReviewList = response.data.rows;
            this.total = response.data.total;
            this.ethicsReviewList = response.data || [];
            this.total = response.total || 0;
          } else {
            this.$message.error("获取数据失败");
            this.$message.error(response.msg || "获取数据失败");
          }
          this.loading = false;
        })
@@ -337,7 +350,8 @@
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id);
      this.ids = selection.map(item => item.infoid);
      this.selectedRows = selection;
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
@@ -345,7 +359,7 @@
    handleView(row) {
      this.$router.push({
        path: "/case/ethicalReviewInfo",
        query: { id: row.id }
        query: { infoid: row.infoid, id: row.id, mode: "view" }
      });
    },
    // 新增按钮操作
@@ -354,70 +368,85 @@
    },
    // 修改按钮操作
    handleUpdate(row) {
      const id = row.id || this.ids[0];
      const infoid = row.infoid;
      this.$router.push({
        path: "/case/ethicalReviewInfo",
        query: { id: id }
        query: { infoid: infoid, id: row.id, mode: "edit" }
      });
    },
    // 删除按钮操作
    handleDelete(row) {
      const ids = row.id ? [row.id] : this.ids;
      this.$confirm("是否确认删除选中的数据项?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return delEthicsReview(ids);
        })
        .then(response => {
          if (response.code === 200) {
            this.$message.success("删除成功");
            this.getList();
          }
        })
        .catch(() => {});
    },
    // 结束审查操作
    handleEndReview(row) {
      const ids = row.id ? [row.id] : this.ids;
      const selectedRow =
        row || (this.selectedRows.length === 1 ? this.selectedRows[0] : null);
      if (!selectedRow) {
        this.$message.warning("请选择一条记录");
        return;
      }
      this.$confirm("是否确认结束选中的审查项目?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return endEthicsReview(ids);
          // 调用修改接口,将状态改为结束(status: '2')
          const updateData = {
            infoid: selectedRow.infoid,
            status: "2",
            // 可以保留原有数据
            expertName: selectedRow.expertName,
            expertConclusion: selectedRow.expertConclusion,
            expertOpinion: selectedRow.expertOpinion,
            expertTime: selectedRow.expertTime
          };
          return ethicalreviewedit(updateData);
        })
        .then(response => {
          if (response.code === 200) {
            this.$message.success("审查已结束");
            this.getList();
          } else {
            this.$message.error(response.msg || "操作失败");
          }
        })
        .catch(() => {});
    },
    // 导出按钮操作
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm("是否确认导出所有伦理审查数据?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.loading = true;
          return exportEthicsReview(queryParams);
        })
        .then(response => {
          if (response.code === 200) {
            this.$message.success("导出成功");
    // 下载伦理审查档案
    handleDownload(row) {
      ethicalReviewDownload({ nitiateId: row.id })
        .then(res => {
          if (res.code !== 200 || !res.data || !res.data.downloadUrl) {
            this.$message.error(res.msg || "下载失败");
            return;
          }
          this.loading = false;
          const fileUrl = res.data;
          // 拼接下载地址:origin + /dev-api(开发代理前缀) + /profile + downloadUrl,
          // 后端静态文件实际挂在 /profile 下,downloadUrl 少了这层前缀
          const urlBase = process.env.VUE_APP_BASE_API;
          const curWWWPath = window.document.location.href;
          const pos = curWWWPath.indexOf(window.document.location.pathname);
          const fullUrl =
            curWWWPath.substring(0, pos) + urlBase + "/profile" + fileUrl.downloadUrl;
          fetch(fullUrl, {
            headers: { Authorization: "Bearer " + getToken() }
          })
            .then(response => response.blob())
            .then(blob => {
              const url = window.URL.createObjectURL(new Blob([blob]));
              const link = document.createElement("a");
              link.href = url;
              link.setAttribute("download", fileUrl.downloadName);
              document.body.appendChild(link);
              link.click();
              link.parentNode.removeChild(link);
              window.URL.revokeObjectURL(url);
            });
        })
        .catch(() => {
          this.loading = false;
        .catch(error => {
          console.error("下载档案失败:", error);
          this.$message.error("下载失败");
        });
    },
    // 时间格式化