WXL
2024-09-11 b5a56d53e44c426fa188ba3e4e1db3eb779e2fd9
src/views/patient/propaganda/QuestionnaireTask.vue
@@ -69,7 +69,7 @@
                    placeholder="请输入任务描述"
                  />
                </el-form-item>
                <el-form-item label="服务形式" prop="taskDesc">
                <el-form-item label="服务形式">
                  <el-checkbox-group v-model="checkList">
                    <el-checkbox
                      v-for="(item, index) in checkboxlist"
@@ -176,6 +176,26 @@
                    </div>
                  </div>
                </el-form-item>
                <el-row>
                  <el-col :span="12"
                    ><el-form-item label="开场白" prop="kcb">
                      <el-input
                        type="textarea"
                          :rows="3"
                        v-model="form.kcb"
                        placeholder="请输入开场白"
                      /> </el-form-item
                  ></el-col>
                  <el-col :span="12"
                    ><el-form-item label="结束语" prop="jsy">
                      <el-input
                        type="textarea"
                        :rows="3"
                        v-model="form.jsy"
                        placeholder="请输入结束语"
                      /> </el-form-item
                  ></el-col>
                </el-row>
              </el-form>
            </div>
          </div>
@@ -183,7 +203,7 @@
            <div class="headline">
              <div>任务使用模板</div>
              <div style="margin-left: 20px">
                <el-form :model="form">
                <el-form ref="forms">
                  <el-form-item label="">
                    <el-input
                      style="width: 300px"
@@ -199,7 +219,7 @@
                    ></el-button>
                    <el-button
                      v-if="this.form.libtemplateid"
                      v-if="form.libtemplateid"
                      type="success"
                      icon="el-icon-search"
                      @click="previewfnmb"
@@ -286,6 +306,7 @@
                        </el-option>
                      </el-select>
                    </el-col>
                    <el-col :span="1.5">
                      <el-button
                        type="primary"
@@ -293,7 +314,7 @@
                        icon="el-icon-plus"
                        size="medium"
                        :disabled="!patientqueryParams.allhosp"
                        @click="handleAddpatient"
                        @click="handleQuery"
                        >新增</el-button
                      >
                    </el-col>
@@ -369,6 +390,18 @@
                  @keyup.enter.native="handleQuery"
                ></el-input>
              </el-form-item>
              <el-select
                v-model="patientqueryParams.topica"
                placeholder="请选择患者来源"
              >
                <el-option
                  v-for="item in source"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
              <el-form-item>
                <el-button
@@ -416,66 +449,66 @@
    </el-dialog>
    <el-dialog title="模板预览" :visible.sync="previewtf" width="60%">
      <div class="preview-left">
        <!-- 单选 -->
        <div
          class="scriptTopic-dev"
          v-for="item in questionList"
          :key="item.sort"
          v-if="item.scriptType == 1"
        >
          <div class="dev-text">
            {{ item.sort }}、[单选]<span>{{ item.scriptContent }}</span>
        <div v-for="item in questionList">
          <!-- 单选 -->
          <div
            class="scriptTopic-dev"
            :key="item.sort"
            v-if="item.scriptType == 1"
          >
            <div class="dev-text">
              {{ item.sort }}、[单选]<span>{{ item.scriptContent }}</span>
            </div>
            <div class="dev-xx">
              <el-radio-group v-model="item.remark">
                <el-radio
                  v-for="(items, index) in item.svyLibTemplateTargetoptions"
                  :key="index"
                  :label="index"
                  >{{ items.optioncontent }}</el-radio
                >
              </el-radio-group>
            </div>
          </div>
          <div class="dev-xx">
            <el-radio-group v-model="item.remark">
              <el-radio
                v-for="(items, index) in item.svyLibTemplateTargetoptions"
                :key="index"
                :label="index"
                >{{ items.optioncontent }}</el-radio
              >
            </el-radio-group>
          <!-- 多选 -->
          <div
            class="scriptTopic-dev"
            :key="item.sort"
            v-if="item.scriptType == 2"
          >
            <div class="dev-text">
              {{ item.sort }}、[多选]<span>{{ item.scriptContent }}</span>
            </div>
            <div class="dev-xx">
              <el-checkbox-group v-model="qremark">
                <el-checkbox
                  v-for="(items, index) in item.svyLibTemplateTargetoptions"
                  :key="index"
                  :label="index"
                >
                  {{ items.optioncontent }}
                </el-checkbox>
              </el-checkbox-group>
            </div>
          </div>
        </div>
        <!-- 多选 -->
        <div
          class="scriptTopic-dev"
          v-for="item in questionList"
          v-if="item.scriptType == 2"
        >
          <div class="dev-text">
            {{ item.sort }}、[多选]<span>{{ item.scriptContent }}</span>
          </div>
          <div class="dev-xx">
            <el-checkbox-group v-model="multiplechoice">
              <el-checkbox
                v-for="items in item.svyLibTemplateTargetoptions"
                :key="items.optioncontent"
                :label="items.optioncontent"
              >
                {{ items.optioncontent }}
              </el-checkbox>
            </el-checkbox-group>
          </div>
        </div>
        <!-- 填空 -->
        <div
          class="scriptTopic-dev"
          v-for="item in questionList"
          :key="item.sort"
          v-if="item.scriptType == 4"
        >
          <div class="dev-text">
            {{ item.sort }}、[填空]<span>{{ item.scriptContent }}</span>
          </div>
          <div class="dev-xx">
            <el-input placeholder="请输入答案" v-model="item.radioas" clearable>
            </el-input>
          <!-- 填空 -->
          <div
            class="scriptTopic-dev"
            :key="item.sort"
            v-if="item.scriptType == 4"
          >
            <div class="dev-text">
              {{ item.sort }}、[问答]<span>{{ item.scriptContent }}</span>
            </div>
            <div class="dev-xx">
              <el-input placeholder="请输入答案" v-model="radioas" clearable>
              </el-input>
            </div>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="previewGo">前往模板详情修改</el-button>
        <!-- <el-button @click="previewGo">前往模板详情修改</el-button> -->
        <el-button type="primary" @click="previewFn">确认使用</el-button>
      </span>
    </el-dialog>
@@ -502,18 +535,6 @@
              <el-form-item label="问卷名称">
                <el-input v-model="topqueryParams.svyname"></el-input>
              </el-form-item>
              <!-- <el-form-item label="问卷类型" prop="status">
                <el-select v-model="topqueryParams.topic" placeholder="请选择">
                  <el-option
                    v-for="item in taskoptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item> -->
              <el-form-item label="适用形式" prop="status">
                <el-select v-model="topqueryParams.topica" placeholder="请选择">
                  <el-option
@@ -525,18 +546,6 @@
                  </el-option>
                </el-select>
              </el-form-item>
              <!-- <el-form-item label="适用科室" prop="status">
                <el-select v-model="topqueryParams.topicd" placeholder="请选择">
                  <el-option
                    v-for="item in topicoptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item> -->
              <el-form-item>
                <el-button
                  type="primary"
@@ -586,6 +595,7 @@
  getlibrarylist,
  getFollowuplist,
  getQtemplatelist,
  getQtemplateobj,
  TaskQuestioncomit,
  Questionnairetaskget,
  gethetaskinfo,
@@ -674,6 +684,7 @@
      patientqueryParams: {
        pageNum: 1, //
        pageSize: 10,
        topica:0,//0全部1科室2病区
      },
      topicoptions: [{ children: [{ children: [] }] }],
      showSearch: true, //
@@ -741,6 +752,8 @@
        templatename: "",
        templateid: null,
        libtemplateid: null,
        kcb:'亲爱的患者-家属,您好!我们是浙中医大二院的医护人员,为了更好地了解您的康复情况,请您抽一点宝贵时间,完成这份随访问卷。',
        jsy:'生活上要劳逸结合,注意休息和营养,适当锻炼,戒烟限酒,保持心情舒畅,定期复诊。那本次回访就到这里,祝您身体健康!',
      },
      taskoptions: [
        {
@@ -756,6 +769,21 @@
          label: "体检病人",
        },
      ],
      source: [
        {
          value: 0,
          label: "所有患者",
        },
        {
          value: 1,
          label: "科室患者",
        },
        {
          value: 2,
          label: "病区患者",
        },
      ],
      tasktypes: [
        {
          value: 1,
@@ -796,19 +824,17 @@
          { required: true, message: "任务名称不能为空", trigger: "blur" },
          {
            min: 2,
            max: 20,
            message: "任务名称长度必须介于 2 和 20 之间",
            max: 30,
            message: "任务名称长度必须介于 2 和 30 之间",
            trigger: "blur",
          },
        ],
        taskDesc: [
          { required: true, message: "任务描述不能为空", trigger: "blur" },
        ],
        sendType: [
          { required: true, message: "发送设置不能为空", trigger: "blur" },
        ],
        daytime: [{ required: true, message: "民族不能为空", trigger: "blur" }],
      },
      quote: false,
      serviceType: null,
@@ -975,55 +1001,72 @@
      });
    },
    nextstep() {
      if (this.Editprogress <= 3) {
        return this.Editprogress++;
      }
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.Editprogress <= 3) {
            return this.Editprogress++;
          }
        } else {
          this.$modal.msgError("表单内容未完善,请检查");
        }
      });
    },
    // 保存
    submitForm(formName) {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.checkList[0]) {
            this.form.preachform = this.checkList.join(",");
          } else {
            this.$modal.msgError("请选择服务类型");
            return;
          }
          if (!this.form.patTaskRelevances[0]) {
            this.$modal.msgError("请选择病人");
            return;
          }
          const filteredArray = this.variableList.filter(
            (item) =>
              item.name !== "姓名" &&
              item.name !== "电话" &&
              item.name !== "地址"
          );
          this.form.textParam = this.convertFormat2ToFormat1(filteredArray);
      if (this.time4 && this.form.sendType == 3)
        this.form.showTimeMorn = this.time4;
      this.form.sendTimeslot = [
        {
          begantime: this.time4,
          endtime: "",
          xh: 1,
        },
      ];
      if (this.checkList[0]) {
        this.form.preachform = this.checkList.join(",");
      } else {
        this.$modal.msgError("请选择服务类型");
        return;
      }
      if (!this.form.patTaskRelevances[0]) {
        this.$modal.msgError("请选择病人");
        return;
      }
      if (!this.form.templatename) {
        this.$modal.msgError("未选择模板");
        return;
      }
      if ((this.form.sendType == 1 && this.time1) || this.form.sendType == 2) {
      } else if (this.form.sendType == 3 && this.time4) {
      } else {
        return this.$modal.msgError("时间信息缺失");
      }
      const filteredArray = this.variableList.filter(
        (item) =>
          item.name !== "姓名" && item.name !== "电话" && item.name !== "地址"
      );
      this.form.textParam = this.convertFormat2ToFormat1(filteredArray);
      if (this.form.taskid) {
        this.form.isoperation = 2;
      } else {
        this.form.isoperation = 1;
      }
      if (!this.form.type) {
        this.form.type = this.$route.query.type;
      }
      this.form.serviceType = this.serviceType;
      Editsingletask(this.form).then((res) => {
        if (res.code == 200) {
          if (this.form.taskid) {
            this.form.isoperation = 2;
            this.$modal.msgSuccess("新增成功");
          } else {
            this.form.isoperation = 1;
            this.$modal.msgSuccess("修改成功");
          }
          if (!this.form.type) {
            this.form.type = this.$route.query.type;
          }
          this.form.serviceType = this.serviceType;
          Editsingletask(this.form).then((res) => {
            if (res.code == 200) {
              if (this.form.taskid) {
                this.$modal.msgSuccess("新增成功");
              } else {
                this.$modal.msgSuccess("修改成功");
              }
              this.$router.push({
                path: "/followvisit/tasklist",
                query: { tasktopic: this.form.serviceType },
              });
            }
          this.$router.push({
            path: "/followvisit/tasklist",
            query: { tasktopic: this.form.serviceType },
          });
        }else{
          this.$modal.msgError("表单内容未完善,请检查");
        }
      });
    },
@@ -1037,7 +1080,13 @@
        this.libId = row.svyid;
        this.Tasktemplate = row;
        this.questionList = row.svyTemplateLibScripts;
        this.previewtf = true;
        getQtemplateobj({ svyid: row.svyid }).then((res) => {
          if (res.code == 200) {
            this.questionList = res.rows[0].svyTemplateLibScripts;
            this.previewtf = true;
          }
        });
        console.log(row.svyTemplateLibScripts);
        this.previewid = row.svyid;
        this.Variablehandling(row.svyTemplateLibScripts, 1);
      } else if (type == 2) {
@@ -1048,10 +1097,8 @@
    previewfnmb() {
      console.log(this.form);
      getQtemplatelist({ svyid: this.form.libtemplateid }).then((res) => {
      getQtemplateobj({ svyid: this.form.libtemplateid }).then((res) => {
        if (res.code == 200) {
          console.log();
          this.questionList = res.rows[0].svyTemplateLibScripts;
          this.previewtf = true;
        }
@@ -1132,7 +1179,6 @@
    handleUpdate() {},
    handleDelete() {},
    handleExport() {},
    // 选择患者表数据
    handleSelectionChange(selection) {
      console.log("多选患者");
@@ -1193,6 +1239,18 @@
    },
    getList() {},
    handleQuery() {
      if (this.patientqueryParams.topica == 0) {
        this.patientqueryParams.leavehospitaldistrictcodes =
          store.getters.leavehospitaldistrictcodes;
        this.patientqueryParams.leaveldeptcodes = store.getters.leaveldeptcodes;
      } else if (topica == 1) {
        this.patientqueryParams.leavehospitaldistrictcodes = null;
        this.patientqueryParams.leaveldeptcodes = store.getters.leaveldeptcodes;
      } else if (topica == 2) {
        this.patientqueryParams.leavehospitaldistrictcodes =
          store.getters.leavehospitaldistrictcodes;
        this.patientqueryParams.leaveldeptcodes = null;
      }
      this.handleAddpatient();
    },
    resetQuery() {},
@@ -1226,6 +1284,8 @@
        templatename: "",
        templateid: null,
        libtemplateid: null,
        kcb:'亲爱的患者-家属,您好!我们是浙中医大二院的医护人员,为了更好地了解您的康复情况,请您抽一点宝贵时间,完成这份随访问卷。',
        jsy:'生活上要劳逸结合,注意休息和营养,适当锻炼,戒烟限酒,保持心情舒畅,定期复诊。那本次回访就到这里,祝您身体健康!',
      };
      this.questionList = [];
      if (this.id) {
@@ -1239,11 +1299,13 @@
              : [];
            this.overallCase = this.form.patTaskRelevances.concat();
            this.checkList = this.form.preachform.split(",");
            console.log(this.form.showDate, "this.form");
            this.daytime = this.form.showDate.split(",");
            console.log(this.form, "this.form");
            if (this.form.showDate)
              this.daytime = this.form.showDate.split(",");
            if (this.form.showTimeMorn) {
              if (this.form.sendType == 3) {
                this.time4 = this.form.showTimeMorn;
                console.log(1122);
              } else {
                this.time1 = this.form.showTimeMorn.split(",");
              }
@@ -1354,7 +1416,6 @@
      if (this.time1) this.form.showTimeMorn = this.time1.join(",");
      if (this.time2) this.form.showTimeNoon = this.time2.join(",");
      if (this.time3) this.form.showTimeNight = this.time3.join(",");
      console.log(combinedData, "combinedData");
    },
    // 查看模板
    previewGo() {