WXL (wul)
8 天以前 ffa22cc18c75c0a73a3fd987e2b62fbf55316db2
src/views/followvisit/record/detailpage/index.vue
@@ -77,7 +77,7 @@
                    scope.row.sfzh,
                    scope.row.drcode,
                    scope.row.drname,
                    scope.row.patid,
                    scope.row.patid
                  )
                "
                ><span class="button-textsc">{{
@@ -95,43 +95,36 @@
          >
          </el-table-column>
          <el-table-column
            prop="sendstate"
            label="随访状态"
            align="center"
            width="200"
            label="任务状态"
            key="sendstateView"
            prop="sendstateView"
            width="120"
          >
            <template slot-scope="scope">
              <div v-if="scope.row.sendstate == 1">
                <el-tag type="primary" :disable-transitions="false"
                  >表单已领取</el-tag
                >
              </div>
              <div v-if="scope.row.sendstate == 2">
                <el-tag type="primary" :disable-transitions="false"
                  >待随访</el-tag
                >
              </div>
              <div v-if="scope.row.sendstate == 3">
                <el-tag type="success" :disable-transitions="false"
                  >表单已发送</el-tag
                >
              </div>
              <div v-if="scope.row.sendstate == 4">
                <el-tag type="info" :disable-transitions="false">不执行</el-tag>
              </div>
              <div v-if="scope.row.sendstate == 5">
                <el-tag type="danger" :disable-transitions="false"
                  >发送失败</el-tag
                >
              </div>
              <div v-if="scope.row.sendstate == 6">
                <el-tag type="success" :disable-transitions="false"
                  >已完成</el-tag
                >
              </div>
              <div v-if="scope.row.sendstate == 7">
                <el-tag type="danger" :disable-transitions="false">超时</el-tag>
              </div>
              <el-tooltip
                class="item"
                effect="dark"
                :content="scope.row.remark"
                placement="top-start"
                popper-class="statistics-tooltip"
              >
                <div v-if="scope.row.sendstateView == 1">
                  <el-tag type="primary" :disable-transitions="false"
                    >待随访</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstateView == 2">
                  <el-tag type="success" :disable-transitions="false"
                    >已完成</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstateView == 3">
                  <el-tag type="warning" :disable-transitions="false"
                    >无需随访</el-tag
                  >
                </div>
              </el-tooltip>
            </template>
          </el-table-column>
          <el-table-column
@@ -143,6 +136,18 @@
          >
          </el-table-column>
          <el-table-column
            v-if="orgname == '南华大学附属第一医院'"
            label="入院日期"
            width="200"
            align="center"
            key="starttime"
            prop="starttime"
          >
            <template slot-scope="scope">
              <span>{{ formatTime(scope.row.starttime) }}</span>
            </template></el-table-column
          >
          <el-table-column
            label="出院日期"
            width="200"
            align="center"
@@ -153,6 +158,7 @@
              <span>{{ formatTime(scope.row.endtime) }}</span>
            </template></el-table-column
          >
          <el-table-column
            label="责任护士"
            width="120"
@@ -167,7 +173,58 @@
            key="drname"
            prop="drname"
          />
          <el-table-column
            label="任务状态"
            align="center"
            key="sendstate"
            prop="sendstate"
            width="120"
          >
            <template slot-scope="scope">
              <el-tooltip
                class="item"
                effect="dark"
                :content="scope.row.remark"
                placement="top-start"
              >
                <div v-if="scope.row.sendstate == 1">
                  <el-tag type="primary" :disable-transitions="false"
                    >表单已领取</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstate == 2">
                  <el-tag type="primary" :disable-transitions="false"
                    >待随访</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstate == 3">
                  <el-tag type="success" :disable-transitions="false"
                    >表单已发送</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstate == 4">
                  <el-tag type="info" :disable-transitions="false"
                    >不执行</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstate == 5">
                  <el-tag type="danger" :disable-transitions="false"
                    >发送失败</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstate == 6">
                  <el-tag type="success" :disable-transitions="false"
                    >已完成</el-tag
                  >
                </div>
                <div v-if="scope.row.sendstate == 7">
                  <el-tag type="danger" :disable-transitions="false"
                    >超时</el-tag
                  >
                </div>
              </el-tooltip>
            </template>
          </el-table-column>
          <el-table-column
            label="结果状态"
            align="center"
@@ -262,9 +319,38 @@
      <!-- 随访内容 -->
      <div class="call-action">
        <div class="call-container">
          <!-- <div class="call-header">
            <h2>一键呼叫功能</h2>
          </div> -->
          <div
            style="display: flex"
            v-if="
              (orgname == '南华大学附属第一医院' ||
                orgname == '丽水市第二人民医院' ||
                orgname == '缙云县人民医院') &&
              !Voicetype
            "
          >
            <template-selector
              v-model="form.templateid"
              :templateName="form.templatename"
              :service-type="form.serviceType"
              :is-editable="form.sendState !== 2"
              @select="handleTemplateSelect"
              @clear="handleTemplateClear"
            />
            <div
              v-if="defaultKey"
              style="
                display: flex;
                align-items: center;
                justify-content: center;
                height: 100%;
                padding: 33px 0 0 50px;
              "
            >
              <el-button type="success" round @click="handleConfirmReplace">
                默认填充
              </el-button>
            </div>
          </div>
          <div class="headline">
            <div>随访内容</div>
@@ -291,9 +377,14 @@
                        v-if="item.scriptType == 1 && !item.astrict"
                      >
                        <div class="dev-text">
                          {{ index + 1 }}、[单选]<span>{{
                            item.scriptContent
                          }}</span>
                          {{ index + 1 }}. [单选]
                          <span> {{ item.scriptContent }}</span>
                          <span style="margin-left: 20px"
                            ><dict-tag
                              :options="dict.type.dimensionality_type"
                              :value="item.dimension"
                          /></span>
                        </div>
                        <div class="dev-xx">
                          <el-radio-group v-model="item.scriptResult">
@@ -344,9 +435,14 @@
                        v-if="item.scriptType == 2 && !item.astrict"
                      >
                        <div class="dev-text">
                          {{ index + 1 }}、[多选]<span>{{
                          {{ index + 1 }}. [多选]<span>{{
                            item.scriptContent
                          }}</span>
                          <span style="margin-left: 20px"
                            ><dict-tag
                              :options="dict.type.dimensionality_type"
                              :value="item.dimension"
                          /></span>
                        </div>
                        <div class="dev-xx">
                          <el-checkbox-group
@@ -378,9 +474,14 @@
                        v-if="item.scriptType == 4 && !item.astrict"
                      >
                        <div class="dev-text">
                          {{ index + 1 }}、[问答]<span>{{
                          {{ index + 1 }}. [问答]<span>{{
                            item.scriptContent
                          }}</span>
                          <span style="margin-left: 20px"
                            ><dict-tag
                              :options="dict.type.dimensionality_type"
                              :value="item.dimension"
                          /></span>
                          <span v-if="item.valueType == 3">(只能输入数字)</span>
                        </div>
                        <div class="dev-xx" v-if="item.valueType == 3">
@@ -414,9 +515,8 @@
                    >
                      <div v-if="item.targetvalue">
                        <div class="dev-text">
                          {{ index + 1 }}、[单选]<span>{{
                            item.questiontext
                          }}</span>
                          {{ index + 1 }}. [单选]
                          <span>{{ item.questiontext }}</span>
                        </div>
                        <div class="dev-xx">
                          <el-radio-group
@@ -447,7 +547,7 @@
                      <div class="scriptTopic-dev" :key="index" v-else>
                        <div class="dev-text">
                          {{ index + 1 }}、[问答]<span>{{
                          {{ index + 1 }}. [问答]<span>{{
                            item.questiontext
                          }}</span>
                          <span v-if="item.valueType == 3">(只能输入数字)</span>
@@ -577,7 +677,7 @@
                  type="primary"
                  round
                  @click="sendAgain"
                  v-if="form.isVisitAgain != 2"
                  v-if="(form.isVisitAgain != 2) & (visitAgain == 2)"
                >
                  再次随访
                </el-button>
@@ -793,7 +893,13 @@
              </el-form-item>
              <!-- 随访情况 -->
              <el-form-item label="随访情况" v-if="orgname == '丽水市中医院'">
              <el-form-item
                label="随访情况"
                v-if="
                  orgname == '丽水市中医院' ||
                  orgname == '景宁畲族自治县人民医院'
                "
              >
                <el-radio-group v-model="form.taskSituation">
                  <el-radio
                    v-for="city in cities"
@@ -939,34 +1045,21 @@
      <!-- 注意这里使用了 smsDialogVisible 以区分已有的 dialogFormVisible -->
      <el-form ref="smsForm" :model="form" label-width="80px">
        <el-form-item label="患者名称">
          <el-input
            style="width: 400px"
            disabled
            v-model="form.sendname"
          ></el-input>
          <el-input style="width: 400px" v-model="form.sendname"></el-input>
        </el-form-item>
        <el-form-item label="年龄">
          <el-input style="width: 400px" disabled v-model="form.age"></el-input>
          <el-input style="width: 400px" v-model="form.age"></el-input>
        </el-form-item>
        <el-form-item label="电话">
          <el-input
            style="width: 400px"
            disabled
            v-model="userform.telcode"
          ></el-input>
          <el-input style="width: 400px" v-model="userform.telcode"></el-input>
          <!-- 注意这里可能使用 userform.telcode -->
        </el-form-item>
        <el-form-item label="科室">
          <el-input
            style="width: 400px"
            disabled
            v-model="form.deptname"
          ></el-input>
          <el-input style="width: 400px" v-model="form.deptname"></el-input>
        </el-form-item>
        <el-form-item label="病区">
          <el-input
            style="width: 400px"
            disabled
            v-model="form.leavehospitaldistrictname"
          ></el-input>
        </el-form-item>
@@ -1157,7 +1250,10 @@
  savequestiondetail,
  addPersonVoices,
  query360PatInfo,
  updateTemplate,
  query360PatInfonh,
  sendMsg,
  getconfigKey,
} from "@/api/AiCentre/index";
import {
  messagelistpatient,
@@ -1165,13 +1261,16 @@
  listcontactinformation,
} from "@/api/patient/homepage";
import CallButton from "@/components/CallButton";
import TemplateSelector from "@/components/optionalModule";
import MergeAndModify from "./MergeAndModify.vue";
import CallCenterLs from "@/components/CallCenterLs";
import store from "@/store";
export default {
  components: {
    CallButton,
    MergeAndModify,
    CallCenterLs,
    TemplateSelector,
  },
  directives: {
    numericOnly: {
@@ -1236,6 +1335,7 @@
  },
  dicts: [
    "sys_normal_disable",
    "dimensionality_type",
    "quickfollow_up",
    "sys_user_sex",
    "sys_yujing",
@@ -1255,7 +1355,9 @@
      }, 300);
    };
    return {
      visitAgain: 1,
      userid: "",
      defaultKey: false, //是否可默认填报
      currentPhoneNumber: "",
      callType: "", // 用于区分是哪个电话
      isSipRegistering: true, // SIP注册状态
@@ -1293,6 +1395,7 @@
      showContinuationCareBtn: false, // 控制延续护理按钮显示
      // 路由监听相关
      routeWatcher: null,
      lastRoutePath: this.$route.path,
      input: "今天身体还不错",
      radio: "2",
@@ -1437,56 +1540,6 @@
          // 禁用今天及之前的日期
          return time.getTime() < Date.now() - 24 * 60 * 60 * 1000;
        },
        // shortcuts: [
        //   {
        //     text: "七天后",
        //     onClick(picker) {
        //       const date = new Date();
        //       date.setTime(date.getTime() + 3600 * 1000 * 24 * 7);
        //       picker.$emit("pick", date);
        //     },
        //   },
        //   {
        //     text: "15天后",
        //     onClick(picker) {
        //       const date = new Date();
        //       date.setTime(date.getTime() + 3600 * 1000 * 24 * 15);
        //       picker.$emit("pick", date);
        //     },
        //   },
        //   {
        //     text: "一个月后",
        //     onClick(picker) {
        //       const date = new Date();
        //       date.setTime(date.getTime() + 3600 * 1000 * 24 * 30);
        //       picker.$emit("pick", date);
        //     },
        //   },
        //   {
        //     text: "三个月后",
        //     onClick(picker) {
        //       const date = new Date();
        //       date.setTime(date.getTime() + 3600 * 1000 * 24 * 90);
        //       picker.$emit("pick", date);
        //     },
        //   },
        //   {
        //     text: "六个月后",
        //     onClick(picker) {
        //       const date = new Date();
        //       date.setTime(date.getTime() + 3600 * 1000 * 24 * 180);
        //       picker.$emit("pick", date);
        //     },
        //   },
        //   {
        //     text: "一年后",
        //     onClick(picker) {
        //       const date = new Date();
        //       date.setTime(date.getTime() + 3600 * 1000 * 24 * 365);
        //       picker.$emit("pick", date);
        //     },
        //   },
        // ],
      },
      options: [
        {
@@ -1572,6 +1625,8 @@
    this.Voicetype = this.$route.query.Voicetype;
    this.visitCount = this.$route.query.visitCount;
    this.serviceType = this.$route.query.serviceType;
    this.visitAgain = store.getters.visitAgain;
    console.log(store.getters.visitAgain);
    this.orgname = localStorage.getItem("orgname");
    if (this.orgname == "省立同德翠苑院区") {
@@ -1607,6 +1662,7 @@
      ];
    }
    this.getTaskservelist();
    this.getconfigKey();
  },
  mounted() {
    // 监听子组件的sipStatus属性变化
@@ -1646,7 +1702,29 @@
        return "scriptTopic-dev"; // 正常 - 默认样式
      }
    },
    getconfigKey() {
      getconfigKey("default.value.icon").then((res) => {
        if (res.msg) {
          if (
            this.getAssignArr(res.msg).includes(this.$store.state.user.name) ||
            this.$store.state.user.name == "admin"
          ) {
            this.defaultKey = true;
          } else {
            this.defaultKey = false;
          }
        }
      });
    },
    getAssignArr(rule) {
      let arr = [];
      let assiginArr = rule.split(",");
      for (let i = 0; i < assiginArr.length; i++) {
        arr[i] = assiginArr[i];
      }
      arr.sort(this.compare);
      return arr;
    },
    // 获取选项样式类
    getOptionClass(items) {
      if (items.isabnormal == 1) {
@@ -1723,8 +1801,8 @@
      const orgname = localStorage.getItem("orgname");
      if (orgname == "南华大学附属第一医院") {
        query360PatInfonh(id).then((res) => {
          if (res.url) {
            window.open(res.url, "_blank");
          if (res.data) {
            window.open(res.data, "_blank");
          } else {
            this.$modal.msgWarning("360查询无结果");
          }
@@ -1947,33 +2025,37 @@
          this.Editsingletasksonyic(this.serviceStates);
          const orgName = localStorage.getItem("orgname");
          if (this.form.isVisitAgain != 1 || orgName == "丽水市中医院") {
          if (
            this.form.isVisitAgain != 1 ||
            orgName == "丽水市中医院" ||
            this.visitAgain == 1
          ) {
            this.Torouter();
            return;
          }
          this.$modal
            .confirm(
              '任务保存成功是否针对患者:"' +
                this.userform.name +
                '"再次随访?',
              "确认",
              {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                showCancelButton: true,
                dangerouslyUseHTMLString: true,
                confirmButtonClass: "custom-confirm-button", // 自定义确认按钮的类名
                cancelButtonClass: "custom-cancel-button", // 自定义取消按钮的类名
              }
            )
            .then(() => {
              document.querySelector("#app").scrollTo(0, 0);
              this.formtidy();
              this.dialogFormVisible = true;
            })
            .catch(() => {
              this.Torouter();
            });
          // this.$modal
          //   .confirm(
          //     '任务保存成功是否针对患者:"' +
          //       this.userform.name +
          //       '"再次随访?',
          //     "确认",
          //     {
          //       confirmButtonText: "确定",
          //       cancelButtonText: "取消",
          //       showCancelButton: true,
          //       dangerouslyUseHTMLString: true,
          //       confirmButtonClass: "custom-confirm-button", // 自定义确认按钮的类名
          //       cancelButtonClass: "custom-cancel-button", // 自定义取消按钮的类名
          //     }
          //   )
          //   .then(() => {
          //     document.querySelector("#app").scrollTo(0, 0);
          //     this.formtidy();
          //     this.dialogFormVisible = true;
          //   })
          //   .catch(() => {
          //     this.Torouter();
          //   });
        }
      });
    },
@@ -2031,6 +2113,68 @@
          message: "请输入正确的电话号码(手机号或带区号的固定电话)",
        };
      }
    },
    handleTemplateSelect(templateData) {
      console.log("选择了模板:", templateData);
      // 处理模板选择逻辑
      let templateobj = templateData.templateData;
      templateobj.templateid = templateobj.svyid;
      templateobj.taskid = this.form.taskid;
      templateobj.isoperation = 1;
      templateobj.svyTaskTemplateScriptVOS = templateobj.svyTemplateLibScripts;
      templateobj.svyTaskTemplateScriptVOS.forEach((item) => {
        item.taskid = this.form.taskid;
        item.templateid = item.svyid;
        item.svyTaskTemplateTargetoptions = item.svyLibTemplateTargetoptions;
      });
      let obj = {
        subId: this.form.id,
        svyTaskTemplateVO: templateobj,
      };
      updateTemplate(obj).then((res) => {
        if (res.code) {
          location.reload();
          this.$modal.msgSuccess("模板修改成功");
        } else {
        }
      });
    },
    handleTemplateClear() {
      console.log("清除了模板选择");
    },
    handleConfirmReplace() {
      // 遍历所有题目(tableDatatop)
      this.tableDatatop.forEach((item) => {
        // 只处理未填报的题目(scriptResult 为空或空数组)
        if (
          !item.scriptResult ||
          (Array.isArray(item.scriptResult) && item.scriptResult.length === 0)
        ) {
          // 查找选项中 defaultValue 为 2 的选项
          const defaultOption = item.svyTaskTemplateTargetoptions?.find(
            (opt) => opt.defaultValue == 2
          );
          console.log(item);
          if (defaultOption) {
            // 根据题目类型赋值
            if (item.scriptType === "1") {
              // 单选题:直接赋值为 optioncontent 字符串
              item.scriptResult = defaultOption.optioncontent;
            } else if (item.scriptType === "2") {
              // 多选题:赋值为包含 optioncontent 的数组
              item.scriptResult = [defaultOption.optioncontent];
            } else if (item.scriptType === "4") {
              // 填空题:一般没有选项,但如果有则赋值
              item.scriptResult = defaultOption.optioncontent;
            }
            // 触发视图更新(因为 Vue 可能无法检测到深层嵌套对象的变化)
            this.$forceUpdate();
          }
        }
      });
    },
    // 使用示例
    isValidPhone(phone) {
@@ -2144,36 +2288,42 @@
      const orgName = localStorage.getItem("orgname");
      console.log(orgName, "orgName");
      if (this.form.isVisitAgain != 1 || orgName == "丽水市中医院") {
      if (
        this.form.isVisitAgain != 1 ||
        orgName == "丽水市中医院" ||
        this.visitAgain == 1
      ) {
        this.Torouter();
        return;
      }
      savequestiondetail(obj).then((res) => {
        if (res.code == 200) {
          this.$modal.msgSuccess("服务保存成功");
          this.$modal
            .confirm(
              '任务保存成功是否针对患者:"' +
                this.userform.name +
                '"再次随访?',
              "确认",
              {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                showCancelButton: true,
                dangerouslyUseHTMLString: true,
                confirmButtonClass: "custom-confirm-button", // 自定义确认按钮的类名
                cancelButtonClass: "custom-cancel-button", // 自定义取消按钮的类名
              }
            )
            .then(() => {
              document.querySelector("#app").scrollTo(0, 0);
              this.formtidy();
              this.dialogFormVisible = true;
            })
            .catch(() => {
              this.Torouter();
            });
          this.Torouter();
          //   this.$modal
          //     .confirm(
          //       '任务保存成功是否针对患者:"' +
          //         this.userform.name +
          //         '"再次随访?',
          //       "确认",
          //       {
          //         confirmButtonText: "确定",
          //         cancelButtonText: "取消",
          //         showCancelButton: true,
          //         dangerouslyUseHTMLString: true,
          //         confirmButtonClass: "custom-confirm-button", // 自定义确认按钮的类名
          //         cancelButtonClass: "custom-cancel-button", // 自定义取消按钮的类名
          //       }
          //     )
          //     .then(() => {
          //       document.querySelector("#app").scrollTo(0, 0);
          //       this.formtidy();
          //       this.dialogFormVisible = true;
          //     })
          //     .catch(() => {
          //       this.Torouter();
          //     });
        }
      });
    },
@@ -2209,14 +2359,19 @@
          this.form = res.rows[0].serviceSubtaskList.find(
            (item) => item.id == this.id
          );
          console.log(this.form.templatename, "templatename");
          this.form.remark = this.form.remark || "";
          this.logsheetlist = res.rows[0].serviceSubtaskList;
          this.templateid = this.form.templateid;
          this.selectedTag = this.form.excep;
          const targetDate = new Date(this.form.visitTime); // 目标日期
          const now = new Date(); // 当前时间
          console.log(now, "当前时间");
          console.log(targetDate, "目标日期");
          if (now < targetDate && this.form.sendstate == 2) {
            this.$confirm("当前服务未到发送时间请谨慎修改", "提示", {
            this.$confirm("当前服务未到随访时间请谨慎修改", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
@@ -2270,6 +2425,9 @@
        if (res.code == 200) {
          objson = res.rows[0].serviceSubtaskList[0];
          objson.suggest = son;
          objson.remark = this.form.remark;
          objson.sendstate = this.serviceStates;
          objson.taskSituation = this.form.taskSituation;
          Editsingletaskson(objson).then((res) => {
            if (res.code) {
              this.$modal.msgSuccess("服务记录成功");
@@ -2310,13 +2468,14 @@
      });
    },
    alterpatient(sendstate) {
      alterpatient(this.userform).then((res) => {
        if (res.code == 200) {
          this.$modal.msgSuccess("基础信息保存成功");
        } else {
          this.$modal.msgError("基础信息修改失败");
        }
      });
      this.Editsingletasksonyic(this.serviceStates)
      // alterpatient(this.userform).then((res) => {
      //   if (res.code == 200) {
      //     this.$modal.msgSuccess("基础信息保存成功");
      //   } else {
      //     this.$modal.msgError("基础信息修改失败");
      //   }
      // });
    },
    // 异常列渲染
    tableRowClassName({ row, rowIndex }) {
@@ -2708,14 +2867,38 @@
  //   console.log(11);
  // },
  beforeRouteLeave(to, from, next) {
    this.$refs.callButton.cleanupResources();
    if (this.$refs.CallCenterLs) {
      console.log(1);
  const callButton = this.$refs.callButton;
  // 如果存在呼叫组件且正在通话中
  if (callButton && callButton.isCalling) {
    this.$confirm('当前正在通话中,确定要离开此页面吗?', '提示', {
      confirmButtonText: '挂断并离开',
      cancelButtonText: '继续通话',
      type: 'warning'
    })
      .then(() => {
        // 用户确认离开,主动挂断并清理
        callButton.cleanupResources();
        if (this.$refs.CallCenterLs) {
          this.$refs.CallCenterLs.handleSeatLogout();
        }
        next();
      })
      .catch(() => {
        // 用户取消,阻止路由跳转
        next(false);
      });
  } else {
    // 未通话或呼叫组件不存在,正常清理
    if (callButton) {
      callButton.cleanupResources();
    }
    if (this.$refs.CallCenterLs) {
      this.$refs.CallCenterLs.handleSeatLogout();
    }
    next(); // 确保调用 nex
  },
    next();
  }
}
  // beforeRouteUpdate() {
  //   console.log(33);
  // },
@@ -3044,6 +3227,7 @@
    .dev-text {
      margin-bottom: 10px;
      display: flex;
    }
  }
}