WXL (wul)
2026-11-09 b4fe2c16274a91fee4fb26d91374f95fbe2dbcec
src/views/followvisit/discharge/index.vue
@@ -73,7 +73,7 @@
        <el-form-item label="经管医生" prop="managementDoctor">
          <el-input
            v-model="topqueryParams.managementDoctor"
            placeholder="请输入主治医生"
            placeholder="请输入经管医生"
          ></el-input>
        </el-form-item>
        <el-form-item label="日期限制" prop="status">
@@ -115,6 +115,24 @@
          <el-select v-model="topqueryParams.sort" placeholder="请选择">
            <el-option
              v-for="item in topicoptionssort"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="当前执行方式" prop="currentPreachforms">
          <el-select
            v-model="topqueryParams.currentPreachforms"
            placeholder="请选择"
            multiple
            clearable
            collapse-tags
          >
            <el-option
              v-for="item in currentPreachformOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
@@ -243,6 +261,17 @@
            </div>
          </div>
        </el-col>
        <div class="color-legend">
          <span class="legend-item" v-if="orgname == '南华大学附属第一医院'">
            <span class="legend-block legend-blue"></span>未到随访时间
          </span>
          <span class="legend-item">
            <span class="legend-block legend-red"></span>填报内容存在异常
          </span>
          <span class="legend-item">
            <span class="legend-block legend-yellow"></span>填报内容存在警告
          </span>
        </div>
      </el-row>
      <div class="selected-info">
        已选中
@@ -574,6 +603,29 @@
          key="phone"
          prop="phone"
        />
        <el-table-column
          v-if="
            orgname == '景宁畲族自治县人民医院' ||
            orgname == '丽水市中医院'
          "
          label="拨号状态"
          width="120"
          align="center"
          key="isManuallyCalled"
          prop="isManuallyCalled"
        >
          <template slot-scope="scope">
            <el-tag
              v-if="Number(scope.row.isManuallyCalled) > 0"
              type="success"
              :disable-transitions="false"
              >拨通{{ scope.row.isManuallyCalled }}次</el-tag
            >
            <el-tag v-else type="info" :disable-transitions="false"
              >未拨通</el-tag
            >
          </template>
        </el-table-column>
        <el-table-column
          label="身份证号码"
          width="200"
@@ -1286,7 +1338,7 @@
      },
      // endOut: 1,
      endOut:
        localStorage.getItem("orgname") == "景宁畲族自治县人民医院" ? 0 : 1, //0 出院时间(正序)    1 出院时间(倒序)   2 发送时间(正序)    3 发送时间(倒序)  7应随访日期(倒序) 应随访日期(正序)
        localStorage.getItem("orgname") == "丽水市中医院" ? 0 : 1, //0 出院时间(正序)    1 出院时间(倒序)   2 发送时间(正序)    3 发送时间(倒序)  7应随访日期(倒序) 应随访日期(正序)
      endOuts: [
        {
          value: 0,
@@ -1350,6 +1402,7 @@
            : "",
        leaveldeptcodes: [],
        leavehospitaldistrictcodes: [],
        currentPreachforms: [],
      },
      orgname: "",
      propss: { multiple: true },
@@ -1380,6 +1433,16 @@
          value: 5,
          label: "无需随访",
        },
      ],
      currentPreachformOptions: [
        { value: "1", label: "人工" },
        { value: "2", label: "纸质" },
        { value: "3", label: "智能语音" },
        { value: "4", label: "短信" },
        { value: "5", label: "微信公众号" },
        { value: "6", label: "微信小程序" },
        { value: "7", label: "术后随访" },
      ],
      sextype: [
@@ -1500,6 +1563,8 @@
        value: dept.districtCode,
      };
    });
    // 免登直达:根据科室/病区编码预填患者范围
    this.applyFollowUpScope();
    if (this.errtype == 1) {
      this.toleadExport(2);
    } else if (this.errtype == 2) {
@@ -1546,7 +1611,7 @@
    async getList(refresh) {
      // 默认全部
      this.applyDeptWardScope();
      if (this.endOut == 0) {
      if (this.endOut == 0 && !this.topqueryParams.endSendDateTime) {
        this.topqueryParams.endSendDateTime = this.formatDateToYYYYMMDDHHMMSS(
          this.getEndOfDay()
        );
@@ -1577,7 +1642,12 @@
      }
      try {
        const response = await getTaskservelist(this.topqueryParams);
        // 当前执行方式为多选,需转成逗号分隔字符串(如 1,2,5)
        const params = { ...this.topqueryParams };
        if (Array.isArray(params.currentPreachforms)) {
          params.currentPreachforms = params.currentPreachforms.join(",");
        }
        const response = await getTaskservelist(params);
        // ✅ 第一步:先锁定恢复状态
        this.isRestoring = true;
@@ -1624,10 +1694,11 @@
            });
          }
          if (item.currentPreachform) {
            item.currentPreachform = this.checkboxlist.find(
              (item) => item.value == item.currentPreachform
            )?.value;
            console.log(item.currentPreachform, "mi");
              (items) => items.value == item.currentPreachform
            )?.label;
          }
        });
@@ -1714,8 +1785,10 @@
    onthatday() {
      this.resetQuerykj();
      this.topqueryParams.startSendDateTime = this.getCurrentDate();
      this.topqueryParams.endSendDateTime = this.getCurrentDate();
      this.topqueryParams.sendstateView = 1; // 待随访
      this.topqueryParams.sendstate = null;
      this.topqueryParams.startSendDateTime = null;
      this.topqueryParams.endSendDateTime = this.getCurrentDate(); // 开始随访日期 <= 今天
      this.getList(1);
    },
    getCurrentDate() {
@@ -1724,10 +1797,12 @@
    },
    buidegetTasklist(type) {
      if (type) {
        this.resetQuerykj();
      }
      this.applyDeptWardScope();
      // 用户权限下所有待随访任务:传递全部科室和病区
      this.topqueryParams.leaveldeptcodes = store.getters.belongDepts.map(
        (obj) => obj.deptCode
      );
      this.topqueryParams.leavehospitaldistrictcodes =
        store.getters.belongWards.map((obj) => obj.districtCode);
      // 接受异常跳转
      if (this.errtype) {
        this.topqueryParams.leavehospitaldistrictcodes.push(
@@ -1739,7 +1814,7 @@
        pageSize: 10,
        leavehospitaldistrictcodes:
          this.topqueryParams.leavehospitaldistrictcodes,
        sendstates: [2, 3],
        sendstateView: 1,
        leaveldeptcodes: this.topqueryParams.leaveldeptcodes,
      };
      buidegetTasklist(obj).then((response) => {
@@ -1836,6 +1911,7 @@
    /** 搜索按钮操作 */
    handleQuery(refresh) {
      this.applyDeptWardScope();
      this.clearAllSelection();
      this.topqueryParams.pageNum = 1;
      // 判断是不是工作台快捷查询
      if (this.errtype != 2) {
@@ -1845,6 +1921,17 @@
        this.topqueryParams.endSendDateTime = this.dateRangefs[1];
      }
      this.getList(refresh);
    },
    // 免登直达:根据路由中的科室/病区编码预填患者范围
    applyFollowUpScope() {
      const deptCode = this.$route.query.followUpDeptCode;
      const wardCode = this.$route.query.followUpWardCode;
      if (!deptCode && !wardCode) return;
      const scope = [];
      if (deptCode) scope.push([1, deptCode]);
      if (wardCode) scope.push([2, wardCode]);
      this.topqueryParams.scopetype = scope;
      this.lastScopeType = deptCode ? 1 : 2;
    },
    // 患者范围处理:从多选级联 scopetype 解析科室/病区
    applyDeptWardScope() {
@@ -1950,6 +2037,7 @@
        scopetype: [],
        leaveldeptcodes: [],
        leavehospitaldistrictcodes: [],
        currentPreachforms: [],
      };
      this.handleQuery(1);
    },
@@ -1970,6 +2058,7 @@
        scopetype: [],
        leaveldeptcodes: [],
        leavehospitaldistrictcodes: [],
        currentPreachforms: [],
      };
    },
    handleSelectionChange(rows) {
@@ -2309,14 +2398,41 @@
        this.getList();
      });
    },
    // 异常列渲染
    // 行颜色渲染:蓝色(未到随访时间) / 红色(异常) / 黄色(警告)
    tableRowClassName({ row, rowIndex }) {
      // 当前时间小于应随访时间且任务状态为待随访 → 整行蓝色(南华大学附属第一医院不生效)
      if (
        this.orgname == "南华大学附属第一医院" &&
        row.sendstate == 2 &&
        this.isBeforeVisitTime(row.visitTime)
      ) {
        return "blue-row";
      }
      if (row.excep == 1) {
        return "warning-row";
      } else if (row.excep == 2) {
        return "remind-row";
      }
      return "";
    },
    // 判断当前时间是否早于应随访时间(按“天”比较)
    isBeforeVisitTime(visitTime) {
      if (!visitTime) return false;
      let date;
      if (typeof visitTime === "number") {
        date = new Date(visitTime);
      } else {
        date = new Date(String(visitTime).replace(/-/g, "/"));
      }
      if (isNaN(date.getTime())) return false;
      const now = new Date();
      const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
      const visitDay = new Date(
        date.getFullYear(),
        date.getMonth(),
        date.getDate()
      );
      return today.getTime() < visitDay.getTime();
    },
    restoreSelection() {
      if (!this.$refs.userform) {
@@ -2549,12 +2665,46 @@
::v-deep.el-table .remind-row {
  background: #fcf5aa;
}
::v-deep.el-table .blue-row {
  background: #c6e2ff;
}
.documentf {
  display: flex;
  justify-content: flex-end;
}
.color-legend {
  float: right;
  display: flex;
  align-items: center;
  height: 40px;
  gap: 16px;
  margin-right: 5px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  font-size: 16px;
  color: #666;
}
.legend-block {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  margin-right: 6px;
}
.legend-blue {
  background: #9cc9fa;
}
.legend-red {
  background: #f1aaaa;
}
.legend-yellow {
  background: #faf18d;
}
.download {
  text-align: center;