WXL (wul)
2026-11-09 7b38cbd5c0af64e2f11e02d4d2e0ea6cbb1c09f5
src/views/followvisit/record/detailpage/index.vue
@@ -127,10 +127,9 @@
              </el-tooltip>
            </template>
          </el-table-column>
                <el-table-column
          <el-table-column
            v-if="
              orgname == '景宁畲族自治县人民医院' ||
              orgname == '丽水市中医院'
              orgname == '景宁畲族自治县人民医院' || orgname == '丽水市中医院'
            "
            label="拨号状态"
            width="120"
@@ -306,8 +305,6 @@
          >
          </el-table-column>
          <el-table-column
            prop="bankcardno"
            align="center"
@@ -408,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>
@@ -628,10 +636,16 @@
                  <el-button
                    v-if="showQuestionnaireForm"
                    type="primary"
                    :disabled="!canSaveQuestionnaire"
                    :loading="savingQuestion"
                    @click="getdetail"
                    >保存问卷详情</el-button
                  >
                  <el-button v-else type="primary" @click="yuyingetdetail"
                  <el-button
                    v-else
                    type="primary"
                    :loading="savingQuestion"
                    @click="yuyingetdetail"
                    >保存问卷详情</el-button
                  >
                </div>
@@ -689,10 +703,15 @@
                  <el-button
                    v-if="Voicetype"
                    type="primary"
                    :loading="savingVoice"
                    @click="yuyingetdetail"
                    >保存随访详情</el-button
                  >
                  <el-button v-else type="primary" @click="getdetail"
                  <el-button
                    v-else
                    type="primary"
                    :loading="savingQuestion"
                    @click="getdetail"
                    >保存随访详情</el-button
                  >
                </div>
@@ -701,13 +720,51 @@
          </div>
        </div>
      </div>
      <!-- 未选选项提示:大字醒目提醒,允许用户坚持保存 -->
      <el-dialog
        :visible.sync="confirmSaveVisible"
        width="640px"
        append-to-body
        :close-on-click-modal="false"
        custom-class="unanswered-dialog"
      >
        <div slot="title" class="unanswered-title">
          <i class="el-icon-warning"></i> 注意:有题目没有选择选项
        </div>
        <div class="unanswered-warn">
          当前问卷还有
          <span class="unanswered-count">{{ unansweredQuestions.length }}</span>
          道题<strong>没有选择任何选项</strong>,继续保存将按“未作答”记录:
        </div>
        <div class="unanswered-list">
          <div v-for="q in unansweredQuestions" :key="q.index">
            第 {{ q.index }} 题:{{ q.title }}
          </div>
        </div>
        <div class="unanswered-tip">确定还要保存吗?</div>
        <span slot="footer">
          <el-button size="medium" @click="confirmSaveVisible = false"
            >返回补填</el-button
          >
          <el-button type="danger" size="medium" @click="confirmForceSave"
            >仍要保存</el-button
          >
        </span>
      </el-dialog>
      <!-- 人工处理 -->
      <div class="manual-action">
        <div class="Followuserinfos">
          <!-- 顶部操作区域 -->
          <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('')">
@@ -787,6 +844,8 @@
              </div>
            </div>
          </div>
          <!-- 表单区域 -->
          <div class="form-content">
@@ -1008,6 +1067,14 @@
                    人工随访
                  </el-button>
                  <el-button
                    plain
                    v-if="orgname != '缙云第二人民医院'"
                    type="primary"
                    @click="Editsingletaskson('7')"
                  >
                    回院复查复诊
                  </el-button>
                  <el-button
                    type="primary"
                    round
                    @click="sendAgainmsg"
@@ -1146,7 +1213,7 @@
          <!-- 注意这里可能使用 userform.telcode -->
        </el-form-item>
        <el-form-item label="科室">
          <el-input style="width: 400px" v-model="form.deptname"></el-input>
          <el-input style="width: 400px" v-model="form.leaveldeptname"></el-input>
        </el-form-item>
        <el-form-item label="病区">
          <el-input
@@ -1169,9 +1236,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">
@@ -1200,7 +1267,7 @@
              <el-input
                style="width: 100%"
                disabled
                v-model="form.deptname"
                v-model="form.leaveldeptname"
              ></el-input>
            </el-form-item>
            <el-form-item label="病区">
@@ -1267,10 +1334,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">
@@ -1310,13 +1393,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>
@@ -1365,8 +1458,10 @@
  query360PatInfonh,
  sendMsg,
  smsSubTask,
  weChatSubTask,
  getconfigKey,
} from "@/api/AiCentre/index";
import { getIvrtask } from "@/api/smartor/ivrtask";
import {
  messagelistpatient,
  alterpatient,
@@ -1516,6 +1611,7 @@
      input: "今天身体还不错",
      radio: "2",
      taskname: "",
      nextTaskName: "",
      activeName: "wj",
      voice: "",
      templateid: "",
@@ -1562,6 +1658,12 @@
        "预约下次复诊",
      ],
      tableDatatop: [], //题目表
      // 保存问卷:未答题提示弹窗 / 用户坚持保存标记
      confirmSaveVisible: false,
      forceSave: false,
      // 防重复提交:保存中禁用按钮
      savingQuestion: false,
      savingVoice: false,
      voiceDatatop: [], //题目表
      dynamicTags: [],
      isMergeMode: false,
@@ -1610,6 +1712,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",
          },
        ],
      },
@@ -1712,6 +1828,26 @@
    }
  },
  computed: {
    // 是否有任意一道题「选了选项」或「填了备注」
    hasAnyAnswer() {
      return (this.tableDatatop || []).some((item) => this.isQuestionAnswered(item));
    },
    // 右侧处理意见/备注框是否有内容
    hasRemarkText() {
      const remark = this.form && this.form.remark;
      return remark !== null && remark !== undefined && String(remark).trim() !== "";
    },
    // 保存问卷详情的可点条件:问卷有作答 或 右边备注框有内容(有其一即可)
    canSaveQuestionnaire() {
      return this.hasAnyAnswer || this.hasRemarkText;
    },
    // 没有选择选项的题目(保存前用大字醒目提示,不区分有没有填备注)
    // index 用题目在问卷里的原始序号,方便和左边问卷对照
    unansweredQuestions() {
      return (this.tableDatatop || [])
        .map((item, i) => ({ index: i + 1, title: item.scriptContent || "未命名题目", raw: item }))
        .filter((q) => !this.hasOptionValue(q.raw));
    },
    callStatusText() {
      if (this.customCallStatus) {
        return this.customCallStatus;
@@ -1734,6 +1870,10 @@
        failed: "error",
      };
      return typeMap[this.callStatus];
    },
    // 医生处理意见是否必填:随访类型选「随访中心随访」且当前机构为丽水市中医院
    isDoctorOpinionRequired() {
      return this.form.resource == "2" && this.orgname === "丽水市中医院";
    },
    // 是否以问卷形式展示(非语音服务,或语音服务但无完整语音数据需手动填报)
    showQuestionnaireForm() {
@@ -1760,13 +1900,7 @@
    this.orgname = localStorage.getItem("orgname");
    console.log(localStorage.getItem("orgname"));
    if (
      this.orgname == "省立同德翠苑院区" ||
      this.orgname == "省立同德之江院区" ||
      this.orgname == "省立同德闲林院区" ||
      this.orgname == "省立同德青山湖院区" ||
      this.orgname == "省立同德天目山路院区"
    ) {
    if (this.isTongdeCampus) {
      this.showContinuationCareBtn = true;
    }
@@ -2123,8 +2257,52 @@
        }
      });
    },
    // 题目是否选了选项(单选字符串 / 多选数组)
    hasOptionValue(item) {
      if (!item) {
        return false;
      }
      const val = item.scriptResult;
      if (Array.isArray(val)) {
        return val.some(
          (v) => v !== null && v !== undefined && String(v).trim() !== ""
        );
      }
      return val !== null && val !== undefined && String(val).trim() !== "";
    },
    // 题目是否填了备注
    hasRemarkValue(item) {
      if (!item) {
        return false;
      }
      const remark = item.answerps;
      return (
        remark !== null && remark !== undefined && String(remark).trim() !== ""
      );
    },
    // 题目是否已作答:选了选项 或 填了备注(两者有其一即算已答)
    isQuestionAnswered(item) {
      return this.hasOptionValue(item) || this.hasRemarkValue(item);
    },
    // 未答题提示里点「仍要保存」
    confirmForceSave() {
      this.forceSave = true;
      this.confirmSaveVisible = false;
      this.getdetail();
    },
    // 医护人员存储数据
    getdetail() {
      // 问卷没作答、右边备注框也空 → 不允许保存
      if (!this.canSaveQuestionnaire) {
        this.$message.warning("请先在问卷中作答,或在右侧填写处理意见/备注");
        return;
      }
      // 还有题目没作答:大字提示,用户坚持才继续
      if (this.unansweredQuestions.length > 0 && !this.forceSave) {
        this.confirmSaveVisible = true;
        return;
      }
      this.forceSave = false;
      console.log(1);
      let excep = "";
@@ -2179,6 +2357,11 @@
        param6: this.id,
        type: 2,
      };
      // 防重复提交:保存中再次点击直接忽略
      if (this.savingQuestion) {
        return;
      }
      this.savingQuestion = true;
      savequestiondetail(obj).then((res) => {
        if (res.code == 200) {
          this.$modal.msgSuccess("服务保存成功");
@@ -2221,6 +2404,8 @@
              });
          }
        }
      }).finally(() => {
        this.savingQuestion = false;
      });
    },
    Torouter() {
@@ -2238,6 +2423,26 @@
        if (this.visitCount != 1) {
          this.$router.push({
            path: "/logisticsservice/again",
          });
        } else {
          this.$router.push({
            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({
@@ -2322,6 +2527,22 @@
            if (res.code) {
              this.$modal.msgSuccess("文件已通过短信推送给患者");
            } else {
            }
          });
        })
        .catch((err) => {
          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 || "发送失败");
            }
          });
        })
@@ -2508,6 +2729,11 @@
        type: 1,
      };
      console.log("c", 4);
      // 防重复提交:保存中再次点击直接忽略
      if (this.savingVoice) {
        return;
      }
      this.savingVoice = true;
      const orgName = localStorage.getItem("orgname");
      console.log(orgName, "orgName");
@@ -2550,6 +2776,8 @@
              this.Torouter();
            });
        }
      }).finally(() => {
        this.savingVoice = false;
      });
    },
    // 再次随访数据更替
@@ -2589,6 +2817,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;
@@ -2622,7 +2852,7 @@
        name: this.form.sendname,
        age: this.form.age,
        phone: this.userform.telcode,
        deptName: this.form.deptname,
        deptName: this.form.leaveldeptname,
        wardName: this.form.leavehospitaldistrictname,
        smsTemplate: `尊敬的${this.form.sendname},您好!`,
      });
@@ -2778,12 +3008,33 @@
      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,
        leaveldeptcodes: [this.form.deptcode],
        leaveldeptcodes: [this.form.leaveldeptcode],
      }).then((res) => {
        if (res.rows[0].serviceSubtaskList.length) {
          if (
@@ -2793,7 +3044,7 @@
            this.$modal
              .confirm(
                '本患者在"' +
                  res.rows[0].serviceSubtaskList[0].deptname +
                  res.rows[0].serviceSubtaskList[0].leaveldeptname +
                  '"科室下已有再次随访服务进行中是否继续创建?'
              )
              .then(() => {
@@ -3001,6 +3252,14 @@
        }
      });
    },
    // 切换随访类型后,重置医生处理意见的校验状态(必填条件随类型变化)
    handleResourceChange() {
      this.$nextTick(() => {
        if (this.$refs.zcform) {
          this.$refs.zcform.clearValidate("doctorOpinion");
        }
      });
    },
    // 创建再次随访服务
    setupsubtask() {
      this.$refs["zcform"].validate((valid) => {
@@ -3016,17 +3275,21 @@
          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) {
            if (form.resource == 2) {
              form.visitDeptCode = localStorage.getItem("deptCode")
                ? localStorage.getItem("deptCode")
                : form.deptcode;
                : form.leaveldeptcode;
              form.visitDeptName = "随访中心";
            } else {
              form.visitDeptCode = form.deptcode;
              form.visitDeptName = form.deptname;
              form.visitDeptCode = form.leaveldeptcode;
              form.visitDeptName = form.leaveldeptname;
            }
          } else {
            this.$modal.msgError("未选择随访方式");
@@ -3720,14 +3983,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;
@@ -4053,6 +4316,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;
@@ -4363,4 +4661,53 @@
    margin-bottom: 12px;
  }
}
/* 未选选项提示:大字醒目提醒 */
.unanswered-title {
  font-size: 22px;
  font-weight: 700;
  color: #f56c6c;
  display: flex;
  align-items: center;
}
.unanswered-title i {
  font-size: 26px;
  margin-right: 10px;
}
.unanswered-warn {
  font-size: 20px;
  font-weight: 600;
  color: #303133;
  line-height: 1.8;
}
.unanswered-warn strong {
  color: #f56c6c;
  font-size: 22px;
}
.unanswered-count {
  font-size: 40px;
  font-weight: 700;
  color: #f56c6c;
  margin: 0 6px;
  vertical-align: middle;
}
.unanswered-list {
  margin-top: 14px;
  max-height: 300px;
  overflow-y: auto;
  padding: 12px 16px;
  background: #fef0f0;
  border: 1px solid #fbc4c4;
  border-radius: 6px;
  font-size: 18px;
  line-height: 2;
  color: #303133;
}
.unanswered-tip {
  margin-top: 18px;
  font-size: 22px;
  font-weight: 700;
  color: #f56c6c;
  text-align: center;
}
</style>