WXL
3 天以前 dc082351978a1e9f75d7a1471a0ca7ebeac552a5
src/views/business/transfer/index.vue
@@ -8,7 +8,7 @@
        :inline="true"
        label-width="80px"
      >
        <el-form-item label="案例编号" prop="caseNo">
        <el-form-item label="上报医院" prop="caseNo">
          <el-input
            v-model="queryParams.caseNo"
            placeholder="请输入案例编号"
@@ -17,7 +17,7 @@
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="患者姓名" prop="patName">
        <el-form-item label="姓名" prop="patName">
          <el-input
            v-model="queryParams.patName"
            placeholder="请输入患者姓名"
@@ -41,7 +41,7 @@
            <el-option label="暂存" :value="5" />
          </el-select>
        </el-form-item>
        <el-form-item label="创建时间">
        <el-form-item label="转运时间">
          <el-date-picker
            v-model="dateRange"
            style="width: 240px"
@@ -148,18 +148,8 @@
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" type="index" width="60" align="center" />
      <el-table-column
        label="转运单号"
        align="center"
        prop="reportId"
        width="140"
      />
      <el-table-column
        label="案例编号"
        align="center"
        prop="caseNo"
        width="140"
      />
      <el-table-column label="编号" align="center" prop="caseNo" width="140" />
      <el-table-column label="患者信息" align="center" width="260">
        <template slot-scope="scope">
          <div class="donor-info">
@@ -182,24 +172,6 @@
        show-overflow-tooltip
      />
      <el-table-column
        label="治疗医院"
        align="center"
        prop="treatmentHospitalName"
        width="150"
      />
      <el-table-column
        label="计划转运时间"
        align="center"
        prop="transportStartTime"
        width="160"
      />
      <el-table-column
        label="负责协调员"
        align="center"
        prop="contactPerson"
        width="100"
      />
      <el-table-column
        label="转运状态"
        align="center"
        prop="transitStatus"
@@ -211,6 +183,25 @@
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column
        label="计划转运时间"
        align="center"
        prop="transportStartTime"
        width="160"
      />
      <el-table-column
        label="协调员"
        align="center"
        prop="contactPerson"
        width="100"
      />
      <el-table-column
        label="上报医院"
        align="center"
        prop="treatmentHospitalName"
        width="150"
      />
      <el-table-column
        label="创建时间"
        align="center"
@@ -226,34 +217,49 @@
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            size="small"
            type="primary"
            @click="handleDetail(scope.row)"
            >详情</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            size="small"
            type="primary"
            style="margin-bottom: 10px;"
            plain
            @click="handleUpdate(scope.row)"
            >编辑</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-video-play"
            size="small"
            type="primary"
            plain
            @click="handleStartTransport(scope.row)"
            v-if="scope.row.transitStatus === 1"
            >开始转运</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-check"
            size="small"
            type="success"
            plain
            @click="handleCompleteTransport(scope.row)"
            v-if="scope.row.transitStatus === 2"
            >完成转运</el-button
          ><el-button
            size="small"
            type="danger"
            plain
            @click="cancelTransport(scope.row)"
            v-if="scope.row.transitStatus === 2"
            >取消转运</el-button
          >
          <el-button
            size="small"
            type="warning"
            plain
            @click="recoverTransport(scope.row)"
            v-if="scope.row.transitStatus === 4"
            >恢复转运</el-button
          >
        </template>
      </el-table-column>
@@ -310,7 +316,10 @@
              />
            </el-form-item>
            <el-form-item>
              <el-button type="primary" icon="el-icon-search" @click="searchCaseList"
              <el-button
                type="primary"
                icon="el-icon-search"
                @click="searchCaseList"
                >搜索</el-button
              >
              <el-button icon="el-icon-refresh" @click="resetCaseSearch"
@@ -328,8 +337,18 @@
            highlight-current-row
            style="width: 100%"
          >
            <el-table-column label="案例编号" prop="caseNo" width="150" align="center" />
            <el-table-column label="患者姓名" prop="name" width="120" align="center" />
            <el-table-column
              label="案例编号"
              prop="caseNo"
              width="150"
              align="center"
            />
            <el-table-column
              label="患者姓名"
              prop="name"
              width="120"
              align="center"
            />
            <el-table-column label="性别" width="80" align="center">
              <template slot-scope="scope">
                <dict-tag
@@ -338,7 +357,12 @@
                />
              </template>
            </el-table-column>
            <el-table-column label="年龄" prop="age" width="80" align="center" />
            <el-table-column
              label="年龄"
              prop="age"
              width="80"
              align="center"
            />
            <el-table-column label="血型" width="80" align="center">
              <template slot-scope="scope">
                <dict-tag
@@ -347,15 +371,24 @@
                />
              </template>
            </el-table-column>
            <el-table-column label="疾病诊断" prop="diagnosisname" min-width="200" show-overflow-tooltip />
            <el-table-column label="治疗医院" prop="treatmenthospitalname" width="150" />
            <el-table-column
              label="疾病诊断"
              prop="diagnosisname"
              min-width="200"
              show-overflow-tooltip
            />
            <el-table-column
              label="治疗医院"
              prop="treatmenthospitalname"
              width="150"
            />
            <el-table-column label="是否已转运" width="100" align="center">
              <template slot-scope="scope">
                <el-tag
                  :type="hasTransport(scope.row) ? 'danger' : 'success'"
                  size="small"
                >
                  {{ hasTransport(scope.row) ? '已转运' : '可转运' }}
                  {{ hasTransport(scope.row) ? "已转运" : "可转运" }}
                </el-tag>
              </template>
            </el-table-column>
@@ -408,9 +441,7 @@
    >
      <div class="action-confirm">
        <p>
          确定要{{ actionText }}转运单 "{{
            currentTransport.reportId || currentTransport.id
          }}" 吗?
          确定要{{ actionText }}转运单 "{{ currentTransport.patName }}" 吗?
        </p>
      </div>
      <div slot="footer" class="dialog-footer">
@@ -426,9 +457,11 @@
  transportList,
  transportAdd,
  transportEdit,
  transportDelete,
  transportDel,
  transportInfo,
  donateList
  donateInfo,
  donateList,
  donateEdit
} from "@/api/businessApi/index";
import TransportDetail from "./transportDetail";
import TransportEdit from "./TransportEdit";
@@ -439,7 +472,6 @@
  dicts: ["sys_user_sex", "sys_BloodType"],
  data() {
    return {
      // 遮罩层
      loading: false,
      // 选中数组
@@ -498,16 +530,16 @@
        pageNum: 1,
        pageSize: 10,
        caseNo: undefined,
        patName: undefined,
        patName: undefined
        // 只查询已同意且需要转运的案例
        // reportStatus: "3", // 已同意
        isTransport: "2"   // 需要转运
        // isTransport: "2" // 需要转运
      }
    };
  },
  created() {
    this.getList();
     this.checkAutoCreate();
    // this.getList();
    this.checkAutoCreate();
  },
  methods: {
    /** 查询转运单列表 */
@@ -544,28 +576,33 @@
        this.loading = false;
      }
    },
  checkAutoCreate() {
    const query = this.$route.query;
    if (query.autoCreate === 'true') {
      // 自动打开案例选择弹框
      this.selectCaseOpen = true;
      this.resetCaseSearch();
      // 如果有特定的案例编号,可以预先搜索
      if (query.caseNo) {
        this.caseQueryParams.caseNo = query.caseNo;
        this.searchCaseList();
    checkAutoCreate() {
      const query = this.$route.query;
      // 上报跳转过来进行处理
      if (query.autoCreate === "true") {
        // 如果有特定的案例编号,可以预先搜索
        if (query.caseNo) {
          // this.selectCaseOpen = true;
          this.resetCaseSearch(1);
          this.caseQueryParams.caseNo = query.caseNo;
          this.searchCaseList(1);
        } else {
          this.queryParams.patName = query.patName;
        }
      }
    }
  },
      this.getList();
    },
    /** 搜索可用案例 */
    async searchCaseList() {
    async searchCaseList(type) {
      this.caseLoading = true;
      try {
        const response = await donateList(this.caseQueryParams);
        if (response.code === 200) {
          this.availableCaseList = response.rows || response.data || [];
          this.caseTotal = response.total || 0;
          if (type == 1 && response.data[0]) {
            this.selectCase(response.data[0]);
          }
        } else {
          this.$modal.msgError(response.msg || "获取案例列表失败");
        }
@@ -578,7 +615,7 @@
    },
    /** 重置案例搜索 */
    resetCaseSearch() {
    resetCaseSearch(type) {
      this.caseQueryParams = {
        pageNum: 1,
        pageSize: 10,
@@ -587,15 +624,22 @@
        // reportStatus: "3",
        isTransport: "2"
      };
      this.searchCaseList();
      if (!type) {
        this.searchCaseList();
      } else {
        // 跨页面新增取消限制
        this.caseQueryParams.isTransport = null;
      }
    },
    /** 判断案例是否已有转运单 */
    hasTransport(caseData) {
      // 检查案例是否有转运信息
      if (caseData.serviceTransport &&
          Array.isArray(caseData.serviceTransport) &&
          caseData.serviceTransport.length > 0) {
      if (
        caseData.serviceTransport &&
        Array.isArray(caseData.serviceTransport) &&
        caseData.serviceTransport.length > 0
      ) {
        return true;
      }
      return false;
@@ -613,27 +657,33 @@
      // 打开转运单编辑页面,并传入选中的案例
      this.currentTransport = this.convertCaseToTransport(caseData);
      console.log(this.currentTransport, "currentTransport");
      this.isEditing = false;
      this.editOpen = true;
    },
    /** 将案例信息转换为转运单格式 */
    convertCaseToTransport(caseData) {
      console.log(caseData, "2");
      return {
        caseNo: caseData.caseNo,
        patName: caseData.name,
        sex: caseData.sex,
        age: caseData.age,
        diagnosisname: caseData.diagnosisname,
        reportId: caseData.id,
        treatmentHospitalName: caseData.treatmenthospitalname,
        treatmentDeptName: caseData.treatmentdeptname,
        // 其他字段可以根据需要从案例中获取
        transportStartPlace: caseData.treatmenthospitalname || '',
        contactPerson: caseData.coordinatorName || '',
        transportStartPlace: caseData.treatmenthospitalname || "",
        contactPerson: caseData.coordinatorName || "",
        icuDoctor: caseData.icuDoctor,
        icuDoctorPhone: caseData.icuDoctorPhone,
        transitStatus: 1, // 默认待转运
        // 清空其他字段
        id: undefined,
        reportId: undefined,
        transportStartTime: undefined,
        doctor: undefined,
        doctorPhone: undefined,
@@ -685,7 +735,7 @@
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.reportId || item.id);
      this.ids = selection.map(item => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
@@ -713,7 +763,7 @@
    /** 详情按钮操作 */
    handleDetail(row) {
      this.currentTransport = row;
      this.detailTitle = `转运单详情 - ${row.reportId || row.id}`;
      this.detailTitle = `转运单详情 - ${row.id}`;
      this.detailOpen = true;
    },
@@ -760,25 +810,52 @@
      this.actionTitle = "完成转运";
      this.actionText = "完成";
      this.actionOpen = true;
    } /** 完成转运操作 */,
    async cancelTransport(row) {
      this.currentTransport = row;
      this.actionTitle = "取消转运";
      this.actionText = "取消";
      this.actionOpen = true;
    } /** 完成转运操作 */,
    async recoverTransport(row) {
      this.currentTransport = row;
      this.actionTitle = "恢复转运";
      this.actionText = "恢复";
      this.actionOpen = true;
    },
    /** 确认操作 */
    async confirmAction() {
      try {
        let requestData = {
          id: this.currentTransport.id || this.currentTransport.reportId
          ...this.currentTransport
        };
        if (this.actionText === "开始") {
          requestData.transitStatus = 2; // 设置为转运中
        } else if (this.actionText === "完成") {
          requestData.transitStatus = 3; // 设置为转运完成
        } else if (this.actionText === "取消") {
          requestData.transitStatus = 4; // 设置为转运取消
        } else if (this.actionText === "恢复") {
          requestData.transitStatus = 2; // 设置为转运中
        }
        requestData.annexfilesList.forEach(item => {
          item.id = null;
        });
        const response = await transportEdit(requestData);
        if (response.code === 200) {
        if (response.code == 200) {
          this.$modal.msgSuccess(`${this.actionText}转运成功`);
          if (requestData.transitStatus == 3) {
            const resappear = await donateInfo(requestData.reportId);
            if (resappear.code) {
              let obj = resappear.data;
              obj.isDonate = 1;
              await donateEdit(obj);
              this.$modal.msgSuccess(`对应上报案例已进入正式案例流程`);
            }
          }
          this.getList();
        } else {
          this.$modal.msgError(response.msg || `${this.actionText}转运失败`);
@@ -799,7 +876,7 @@
          '是否确认删除转运单编号为"' + ids + '"的数据项?'
        );
        const response = await transportDelete(ids);
        const response = await transportDel(ids);
        if (response.code === 200) {
          this.$modal.msgSuccess("删除成功");
@@ -903,7 +980,7 @@
.donor-info {
  text-align: center;
  display: flex;
  justify-content: center
  justify-content: center;
}
.donor-name {