WXL (wul)
2026-11-09 b4fe2c16274a91fee4fb26d91374f95fbe2dbcec
src/views/followvisit/record/detailpage/index.vue
@@ -128,6 +128,28 @@
            </template>
          </el-table-column>
          <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
            prop="finishtime"
            align="center"
            label="随访完成时间"
@@ -383,9 +405,20 @@
                        type="primary"
                        round
                        @click="smsSubTask"
                        v-if="orgname != '省立同德翠苑院区'"
                        v-if="
                          orgname != '省立同德翠苑院区' &&
                          orgname != '丽水市中医院'
                        "
                      >
                        问卷短信推送
                      </el-button>
                      <el-button
                        type="primary"
                        round
                        @click="weChatSubTask"
                        v-if="orgname == '丽水市中医院'"
                      >
                        问卷微信推送
                      </el-button>
                    </span>
                  </div>
@@ -682,7 +715,13 @@
          <!-- 顶部操作区域 -->
          <div class="section-header">
            <h3><i class="el-icon-s-operation"></i> 人工处理</h3>
            <div class="header-actions">
              <div v-if="form.doctorOpinion2" class="last-opinion">
                <i class="el-icon-sunny"></i>
                <span class="last-opinion-label">上次的处理意见:</span>
                <span class="last-opinion-text">{{ form.doctorOpinion2 }}</span>
              </div>
              <!-- 基础操作按钮组 -->
              <div class="action-group basic-actions">
                <el-button type="primary" plain @click="alterpatient('')">
@@ -762,6 +801,8 @@
              </div>
            </div>
          </div>
          <!-- 表单区域 -->
          <div class="form-content">
@@ -983,6 +1024,14 @@
                    人工随访
                  </el-button>
                  <el-button
                    plain
                    v-if="orgname != '缙云第二人民医院'"
                    type="primary"
                    @click="Editsingletaskson('7')"
                  >
                    回院复查复诊
                  </el-button>
                  <el-button
                    type="primary"
                    round
                    @click="sendAgainmsg"
@@ -1144,9 +1193,9 @@
      title="患者再次随访"
      v-dialogDrags
      :visible.sync="dialogFormVisible"
      width="700px"
      width="900px"
    >
      <el-form ref="zcform" :rules="zcrules" :model="form" label-width="80px">
      <el-form ref="zcform" :rules="zcrules" :model="form" label-width="120px">
        <!-- 基础服务信息 - 默认折叠 -->
        <el-collapse v-model="activeNames" @change="handleCollapseChange">
          <el-collapse-item title="基础服务信息" name="basic">
@@ -1242,10 +1291,26 @@
                v-model="form.remark2"
              ></el-input>
            </el-form-item>
            <el-form-item label="处理意见">
              <el-input
                class="custom-disabled"
                type="textarea"
                disabled
                v-model="form.doctorOpinion2"
                placeholder="无"
              ></el-input>
            </el-form-item>
          </el-collapse-item>
          <!-- 下次随访信息 - 默认展开 -->
          <el-collapse-item title="下次随访" name="next">
            <el-form-item label="再次随访任务">
              <el-input
                disabled
                v-model="nextTaskName"
                placeholder="再次随访任务"
              ></el-input>
            </el-form-item>
            <el-row>
              <el-col :span="12">
                <el-form-item label="随访方式" prop="visitType">
@@ -1285,13 +1350,23 @@
              </el-col>
            </el-row>
            <el-form-item label="随访类型" prop="resource">
              <el-radio-group v-model="form.resource">
              <el-radio-group
                v-model="form.resource"
                @change="handleResourceChange"
              >
                <el-radio label="1">本病区随访</el-radio>
                <el-radio label="2">随访中心随访</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="随访记录" :required="form.resource == '2'">
              <el-input type="textarea" v-model="form.remark"></el-input>
            </el-form-item>
            <el-form-item
              label="医生处理意见"
              prop="doctorOpinion"
              :required="isDoctorOpinionRequired"
            >
              <el-input type="textarea" v-model="form.doctorOpinion"></el-input>
            </el-form-item>
          </el-collapse-item>
        </el-collapse>
@@ -1312,7 +1387,11 @@
        :visible.sync="CaldialogVisible"
        width="60%"
      >
        <CallCenterLs ref="CallCenterLs" :initial-phone="currentPhoneNumber" />
        <CallCenterLs
          ref="CallCenterLs"
          :initial-phone="currentPhoneNumber"
          @call-connected="recordCallConnected"
        />
      </el-dialog>
    </div>
  </div>
@@ -1336,8 +1415,10 @@
  query360PatInfonh,
  sendMsg,
  smsSubTask,
  weChatSubTask,
  getconfigKey,
} from "@/api/AiCentre/index";
import { getIvrtask } from "@/api/smartor/ivrtask";
import {
  messagelistpatient,
  alterpatient,
@@ -1487,6 +1568,7 @@
      input: "今天身体还不错",
      radio: "2",
      taskname: "",
      nextTaskName: "",
      activeName: "wj",
      voice: "",
      templateid: "",
@@ -1581,6 +1663,20 @@
              callback();
            },
            trigger: "change",
          },
        ],
        // 医生处理意见:仅「随访中心随访」+「丽水市中医院」时必填,其余情况不校验
        doctorOpinion: [
          {
            validator: (rule, value, callback) => {
              const needRequired =
                this.form.resource == "2" && this.orgname === "丽水市中医院";
              if (needRequired && !String(value || "").trim()) {
                return callback(new Error("请输入医生处理意见"));
              }
              callback();
            },
            trigger: "blur",
          },
        ],
      },
@@ -1705,6 +1801,10 @@
        failed: "error",
      };
      return typeMap[this.callStatus];
    },
    // 医生处理意见是否必填:随访类型选「随访中心随访」且当前机构为丽水市中医院
    isDoctorOpinionRequired() {
      return this.form.resource == "2" && this.orgname === "丽水市中医院";
    },
    // 是否以问卷形式展示(非语音服务,或语音服务但无完整语音数据需手动填报)
    showQuestionnaireForm() {
@@ -2215,8 +2315,29 @@
            path: "/followvisit/discharge",
          });
        }
      } else if (this.form.serviceType == 3) {
        if (this.visitCount != 1) {
          this.$router.push({
            path: "/logisticsservice/OutpatientAgain",
          });
        } else {
          this.$router.push({
            path: "/followvisit/discharge",
          });
        }
      } else if (this.form.serviceType == 19) {
        if (this.visitCount != 1) {
          this.$router.push({
            path: "/logisticsservice/operationAgain",
          });
        } else {
          this.$router.push({
            path: "/followvisit/discharge",
          });
        }
      } else {
        location.reload();
        // location.reload();
        this.$router.go(-1);
      }
    },
    // 电话============================
@@ -2299,6 +2420,22 @@
          console.log(err);
        });
    },
    weChatSubTask() {
      this.$modal
        .confirm("是否向患者通过微信推送问卷内容?")
        .then(() => {
          weChatSubTask(this.id).then((res) => {
            if (String(res.code) === "200") {
              this.$modal.msgSuccess(res.msg || "发送成功");
            } else {
              this.$modal.msgError(res.message || res.msg || "发送失败");
            }
          });
        })
        .catch((err) => {
          console.log(err);
        });
    },
    handleConfirmReplace() {
      // 遍历所有题目(tableDatatop)
      this.tableDatatop.forEach((item) => {
@@ -2349,7 +2486,7 @@
        this.CaldialogVisible = true;
        return;
      }
      // 下方是中医院呼叫
      // 下方是丽水市中医院
      if (this.isSipRegistering) {
        this.$message.warning("系统正在初始化,请稍候...");
        return;
@@ -2379,11 +2516,15 @@
      this.callStatus = status.type;
      if (status.type === "connected") {
        this.currentCall = {
          phone: this.currentPhoneNumber,
          type: this.callType,
          startTime: new Date(),
        };
        if (!this.currentCall) {
          this.currentCall = {
            phone: this.currentPhoneNumber,
            type: this.callType,
            startTime: new Date(),
          };
          // 丽水市中医院:电话接通后记录拨打成功次数
          this.recordCallConnected();
        }
      } else if (status.type === "ended" || status.type === "failed") {
        this.currentCall = null;
      }
@@ -2392,6 +2533,39 @@
      if (status.type === "failed") {
        this.$message.error(`呼叫失败: ${status.text}`);
      }
    },
    // 电话拨打成功后(接通)次数 +1,并通过 Editsingletaskson 更新服务数据
    // 仅限景宁畲族自治县人民医院与丽水市中医院
    recordCallConnected() {
      const allowedOrgs = ["景宁畲族自治县人民医院", "丽水市中医院"];
      if (!allowedOrgs.includes(this.orgname)) return;
      getTaskservelist({
        patid: this.patid,
        subId: this.id,
      }).then((res) => {
        if (res.code == 200) {
          const objson = res.rows[0].serviceSubtaskList.find(
            (item) => item.id == this.id
          );
          if (!objson) return;
          objson.isManuallyCalled = (Number(objson.isManuallyCalled) || 0) + 1;
          Editsingletaskson(objson).then((r) => {
            if (r.code == 200) {
              // 及时更新顶部服务列表与表单中的拨号状态
              const localRow = (this.logsheetlist || []).find(
                (item) => item.id == this.id
              );
              if (localRow) {
                localRow.isManuallyCalled = objson.isManuallyCalled;
              }
              if (this.form && this.form.id == this.id) {
                this.form.isManuallyCalled = objson.isManuallyCalled;
              }
            }
          });
        }
      });
    },
    // 结束当前通话
    endCurrentCall() {
@@ -2522,6 +2696,8 @@
          console.log(this.form.templatename, "templatename");
          this.form.remark = this.form.remark || "";
          this.form.doctorOpinion2 = this.form.doctorOpinion || "";
          this.form.doctorOpinion = "";
          this.logsheetlist = res.rows[0].serviceSubtaskList;
          this.templateid = this.form.templateid;
          this.selectedTag = this.form.excep;
@@ -2711,8 +2887,29 @@
      return tag ? tag.description : "";
    },
    // 获取再次随访任务信息(下次随访部分展示)
    fetchNextTaskInfo() {
      const taskid = this.form.taskid || this.taskid;
      if (!taskid) {
        this.nextTaskName = "";
        return;
      }
      getIvrtask(taskid).then((r) => {
        const task = r.data || {};
        const nextid = task.nexttaskid;
        if (nextid) {
          getIvrtask(nextid).then((r2) => {
            this.nextTaskName =
              (r2.data && r2.data.taskName) || task.nexttaskname || "";
          });
        } else {
          this.nextTaskName = task.nexttaskname || "";
        }
      });
    },
    // 调起再次发送
    sendAgain() {
      this.fetchNextTaskInfo();
      getTaskservelist({
        patid: this.patid,
        visitCount: 2,
@@ -2934,6 +3131,14 @@
        }
      });
    },
    // 切换随访类型后,重置医生处理意见的校验状态(必填条件随类型变化)
    handleResourceChange() {
      this.$nextTick(() => {
        if (this.$refs.zcform) {
          this.$refs.zcform.clearValidate("doctorOpinion");
        }
      });
    },
    // 创建再次随访服务
    setupsubtask() {
      this.$refs["zcform"].validate((valid) => {
@@ -2949,6 +3154,10 @@
          this.form.remark =
            this.form.remark + "【" + this.getCurrentTime() + "】";
          let form = structuredClone(this.form);
          // 再次随访即“回院复查复诊”:处理意见置为 suggest=7
          if (String(form.suggest) !== "7") {
            form.suggest = "7";
          }
          form.visitTime = this.parseTime(form.date1);
          form.finishtime = "";
          if (form.resource) {
@@ -3653,14 +3862,14 @@
  margin-top: 20px;
}
.el-input.is-disabled .el-input__inner {
::v-deep .el-input.is-disabled .el-input__inner {
  background-color: #fff;
  border-color: #dcdfe6;
  color: #080808 !important;
  cursor: not-allowed;
}
.el-textarea.is-disabled .el-textarea__inner {
::v-deep .el-textarea.is-disabled .el-textarea__inner {
  background-color: #fff;
  border-color: #dcdfe6;
  color: #080808 !important;
@@ -3986,6 +4195,41 @@
  }
}
/* 上次的处理意见 */
.last-opinion {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdfa 100%);
  border: 1px solid #d1fae5;
  border-left: 4px solid #10b981;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.08);
  line-height: 1.5;
  > i {
    font-size: 18px;
    color: #10b981;
    flex-shrink: 0;
  }
  .last-opinion-label {
    font-size: 13px;
    color: #059669;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .last-opinion-text {
    font-size: 14px;
    color: #334155;
    word-break: break-word;
    white-space: pre-wrap;
  }
}
/* 通话控制区域 */
.call-controls {
  margin: 15px 0;