WXL (wul)
3 天以前 d54ac083e2992a5613f5cb22849db9742dbe9a9b
src/views/patient/propaganda/QuestionnaireTask.vue
@@ -69,7 +69,7 @@
                    placeholder="请输入任务描述"
                  />
                </el-form-item>
                <el-form-item label="服务形式">
                <!-- <el-form-item label="服务形式">
                  <el-radio-group v-model="checkList">
                    <el-radio
                      v-for="(item, index) in checkboxlist"
@@ -79,6 +79,16 @@
                      {{ item.label }}</el-radio
                    >
                  </el-radio-group>
                </el-form-item> -->
                <el-form-item label="服务形式">
                  <SortCheckbox
                    v-model="checkList"
                    :options="checkboxlist"
                    :initialselectedOrder="selectedOrder"
                    value-key="value"
                    label-key="label"
                    @change="checkSelectionChange"
                  />
                </el-form-item>
                <el-form-item label="执行周期" prop="longTask">
                  <el-radio-group v-model="form.longTask">
@@ -199,7 +209,7 @@
                </el-form-item>
                <el-form-item label="任务关联" prop="longTask">
                  <el-radio-group v-model="form.appltype">
                    <el-radio label="1">课题组关联</el-radio>
                    <el-radio label="1">科室关联</el-radio>
                    <el-radio label="2">病区关联</el-radio>
                    <el-radio label="3">疾病关联</el-radio>
                    <el-radio label="4">手术关联</el-radio>
@@ -207,7 +217,7 @@
                </el-form-item>
                <el-row v-if="form.appltype == 1">
                  <el-col :span="20"
                    ><el-form-item label="适用课题组" prop="region">
                    ><el-form-item label="适用科室" prop="region">
                      <el-select
                        v-model="deptcodesWards"
                        @remove-tag="removetag"
@@ -215,7 +225,7 @@
                        size="medium"
                        multiple
                        filterable
                        placeholder="请选择课题组"
                        placeholder="请选择科室"
                      >
                        <el-option
                          class="ruleFormaa"
@@ -432,10 +442,16 @@
            </div>
          </div>
        </div>
        <el-button type="success" @click="nextstep('ruleForm')">{{
          quote ? "立即创建" : "任务详情配置"
        <el-button type="primary" @click="nextstep('ruleForm')">{{
          quote ? "立即创建" : "派发患者配置"
        }}</el-button>
        <el-button @click="resetForm('ruleForm')">重置</el-button>
        <el-button
          :loading="submitLoading"
          type="success"
          @click="submitForm('ruleForm')"
          >{{ quote ? "立即创建" : "确认服务配置" }}</el-button
        >
        <!-- <el-button @click="resetForm('ruleForm')">重置</el-button> -->
      </div>
      <!-- 任务详情 -->
      <div v-if="Editprogress == 2">
@@ -516,10 +532,13 @@
          </div>
        </div>
        <el-button type="primary" @click="laststep()">上一步</el-button>
        <el-button type="success" @click="submitForm('ruleForm')">{{
          quote ? "立即创建" : "确认任务配置"
        }}</el-button>
        <el-button @click="resetForm('ruleForm')">重置</el-button>
        <el-button
          :loading="submitLoading"
          type="success"
          @click="submitForm('ruleForm')"
          >{{ quote ? "立即创建" : "确认服务配置" }}</el-button
        >
        <!-- <el-button @click="resetForm('ruleForm')">重置</el-button> -->
      </div>
    </div>
    <!-- 添加患者 -->
@@ -911,8 +930,10 @@
  taskdiaggetlist,
  taskopergetlist,
} from "@/api/AiCentre/index";
import OptionalForm from "@/components/OptionalForm"; //正则组件
import OptionalForm from "@/components/OptionalForm"; //疾病添加组件
import SFtable from "@/components/SFtable"; //表格组件
import SortCheckbox from "@/components/SortCheckbox"; //表格组件
import { MessageBox } from "element-ui";
export default {
@@ -925,6 +946,7 @@
      previewid: "", //任务模板传递id
      libName: "",
      templateor: false,
      submitLoading: false, // 控制按钮加载状态
      objyl: {},
      overallCase: [], //选择患者总
      allpids: [],
@@ -941,7 +963,7 @@
      previewtftype: 0, //预览情况0新模板预览1已选择模板修改
      dialogVisiblepatient: false, //添加患者弹框
      dialogVisiblepatientjb: false, //添加疾病弹框
      deptcodesWards: [], //课题组数据
      deptcodesWards: [], //科室数据
      leavehospitaldistrictcodes: [], //病区数据
      operationcodes: [], //手术数据
      illnesscodes: [], //疾病数据
@@ -969,9 +991,10 @@
        { label: "身份证", width: "200", prop: "idcardno" },
        { label: "性别", width: "", prop: "sex" },
        { label: "年龄", width: "", prop: "age" },
        { label: "电话", width: "180", prop: "telcode" },
        { label: "责任护士", width: "", prop: "nurseName" },
        { label: "主治医生", width: "", prop: "drname" },
        { label: "课题组", width: "240", prop: "dept" },
        { label: "科室", width: "240", prop: "dept" },
        { label: "病区", width: "240", prop: "leavehospitaldistrictname" },
      ],
      // 患者表单
@@ -982,10 +1005,11 @@
        { label: "身份证", width: "200", prop: "sfzh" },
        { label: "性别", width: "", prop: "sex" },
        { label: "年龄", width: "", prop: "age" },
        { label: "电话", width: "180", prop: "telcode" },
        { label: "出院天数", width: "", prop: "endDay" },
        { label: "责任护士", width: "", prop: "nurseName" },
        { label: "主治医生", width: "", prop: "drname" },
        { label: "课题组", width: "180", prop: "deptName" },
        { label: "科室", width: "180", prop: "deptName" },
        { label: "病区", width: "150", prop: "leavehospitaldistrictname" },
      ],
@@ -1026,6 +1050,7 @@
        pageSize: 10,
      },
      checkList: "",
      selectedOrder: [],
      deliverytopqueryParams: {
        pageNum: 1, //
        pageSize: 10,
@@ -1146,7 +1171,7 @@
        },
        {
          value: 1,
          label: "课题组患者",
          label: "科室患者",
        },
        {
          value: 2,
@@ -1155,14 +1180,14 @@
      ],
      tasktypes: store.getters.tasktypes,
      // 课题组/病区
      // 科室/病区
      belongWards: [],
      deptlist: [],
      hosplist: [],
      diagglist: [],
      operlist: [],
      tempDetpRelevanceslist: [], //课题组数据
      tempDetpRelevanceslistform: [], //课题组数据
      tempDetpRelevanceslist: [], //科室数据
      tempDetpRelevanceslistform: [], //科室数据
      tempbelongWards: [], //病区数据
      tempbelongWardsform: [], //病区数据
      rules: {
@@ -1179,20 +1204,20 @@
          { required: true, message: "发送设置不能为空", trigger: "blur" },
        ],
        deptcode: [
          { required: true, message: "适用课题组不能为空", trigger: "blur" },
          { required: true, message: "适用科室不能为空", trigger: "blur" },
        ],
        // leavehospitaldistrictcode: [
        //   { required: true, message: "适用病区不能为空", trigger: "blur" },
        // ],
      },
      belongDepts: [],
      // 课题组院区查询入参
      // 科室院区查询入参
      queryParamsdept: {},
      quote: false,
      serviceType: null,
    };
  },
  components: { SFtable, OptionalForm },
  components: { SFtable, OptionalForm, SortCheckbox },
  created() {
    this.appraiselist = store.getters.appraiselist;
@@ -1284,9 +1309,13 @@
            value: "5",
            label: "微信公众号",
          },
          { label: "微信小程序", value: '6' },
          { label: "微信小程序", value: "6" },
        ];
      } else if (this.form.serviceType == 6||this.form.serviceType == 14||this.form.serviceType == 15) {
      } else if (
        this.form.serviceType == 6 ||
        this.form.serviceType == 14 ||
        this.form.serviceType == 15
      ) {
        this.checkboxlist = [
          {
            value: "3",
@@ -1402,105 +1431,126 @@
    },
    // 保存
    submitForm(formName) {
      if (this.time4 && this.form.sendType == 3)
        this.form.showTimeMorn = this.time4;
      this.form.sendTimeslot = [
        {
          begantime: this.time4,
          endtime: "",
          xh: 1,
        },
      ];
      if (this.form.appltype == 1) {
        this.leavehospitaldistrictcodes = [];
        this.operationcodes = [];
        this.illnesscodes = [];
      } else if (this.form.appltype == 2) {
        this.deptcodesWards = [];
        this.operationcodes = [];
        this.illnesscodes = [];
      } else if (this.form.appltype == 3) {
        this.deptcodesWards = [];
        this.leavehospitaldistrictcodes = [];
        this.operationcodes = [];
      } else if (this.form.appltype == 4) {
        this.deptcodesWards = [];
        this.illnesscodes = [];
        this.leavehospitaldistrictcodes = [];
      }
      if (this.checkList) {
        this.form.preachform = this.checkList;
      } else {
        this.$modal.msgError("请选择服务类型");
      console.log(this.submitLoading);
      if (this.submitLoading) {
        return;
      }
      console.log(this.operationcodes[0]);
      console.log(this.operationcodes);
      // 第二步:开启加载状态,禁用按钮
      this.submitLoading = true;
      console.log(this.submitLoading);
      if (
        this.deptcodesWards[0] ||
        this.leavehospitaldistrictcodes[0] ||
        this.diagglist[0] ||
        this.operationcodes[0] ||
        this.form.longTask == 2
      ) {
      } else {
        this.$modal.msgError("请选择任务关联条件");
        return;
      }
      if (!this.form.patTaskRelevances[0] && !this.form.longTask) {
        this.$modal.msgError("请选择病人");
        return;
      }
      if (!this.form.templatename && !this.templateor) {
        this.$modal.msgError("未选择模板");
        return;
      }
      if ((this.form.sendType == 1 && this.time1) || this.form.sendType == 2) {
      } else if (
        (this.form.sendType == 3 && this.time4) ||
        this.form.longTask
      ) {
      } 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;
      this.form.deptcode = this.deptcodesWards.join(",");
      this.form.leavehospitaldistrictcode =
        this.leavehospitaldistrictcodes.join(",");
      this.form.opcode = this.operationcodes.join(",");
      this.form.icd10code = this.diagglist
        .map((item) => item.icdcode)
        .join(",");
      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 },
          });
      try {
        if (this.time4 && this.form.sendType == 3)
          this.form.showTimeMorn = this.time4;
        this.form.sendTimeslot = [
          {
            begantime: this.time4,
            endtime: "",
            xh: 1,
          },
        ];
        if (this.form.appltype == 1) {
          this.leavehospitaldistrictcodes = [];
          this.operationcodes = [];
          this.illnesscodes = [];
        } else if (this.form.appltype == 2) {
          this.deptcodesWards = [];
          this.operationcodes = [];
          this.illnesscodes = [];
        } else if (this.form.appltype == 3) {
          this.deptcodesWards = [];
          this.leavehospitaldistrictcodes = [];
          this.operationcodes = [];
        } else if (this.form.appltype == 4) {
          this.deptcodesWards = [];
          this.illnesscodes = [];
          this.leavehospitaldistrictcodes = [];
        }
      });
        if (this.checkList) {
          this.form.preachform = this.checkList.join(",");
          this.form.preachformList = this.selectedOrder;
        } else {
          this.$modal.msgError("请选择服务类型");
          return;
        }
        console.log(this.operationcodes[0]);
        console.log(this.operationcodes);
        if (
          this.deptcodesWards[0] ||
          this.leavehospitaldistrictcodes[0] ||
          this.diagglist[0] ||
          this.operationcodes[0] ||
          this.form.longTask == 2 ||
          this.serviceType == 3
        ) {
        } else {
          this.$modal.msgError("请选择任务关联条件");
          return;
        }
        //暂停任务患者限制
        // if (!this.form.patTaskRelevances[0] && !this.form.longTask) {
        //   this.$modal.msgError("请选择病人");
        //   return;
        // }
        if (!this.form.templatename && !this.templateor) {
          this.$modal.msgError("未选择模板");
          return;
        }
        if (
          (this.form.sendType == 1 && this.time1) ||
          this.form.sendType == 2
        ) {
        } else if (
          (this.form.sendType == 3 && this.time4) ||
          this.form.longTask
        ) {
        } 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;
        this.form.deptcode = this.deptcodesWards.join(",");
        this.form.leavehospitaldistrictcode =
          this.leavehospitaldistrictcodes.join(",");
        this.form.opcode = this.operationcodes.join(",");
        this.form.icd10code = this.diagglist
          .map((item) => item.icdcode)
          .join(",");
        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.submitLoading = false;
          }
        });
      } catch (error) {
        this.submitLoading = false;
      } finally {
        // 第四步:无论成功或失败,最终都关闭加载状态
      }
    },
    // ----------------------表格子组件事件
@@ -1560,6 +1610,27 @@
          });
        }
      });
    },
    checkSelectionChange(selectedValues, selectedOrder) {
      this.selectedOrder = selectedValues;
      console.log("当前选中:", selectedValues);
      console.log("选中顺序:", selectedOrder);
    },
    // 服务形式选取
    handleCheckedCitiesChange(row) {
      console.log(row, "服务");
      this.foncheckList = this.checkboxlist.filter((obj) =>
        row.includes(obj.value)
      );
    },
    // 服务形式删除
    handleClosetag(tag) {
      console.log(tag, "tag");
      console.log(this.foncheckList, "foncheckList");
      this.checkList = this.checkList.filter((item) => item != tag.value);
      this.foncheckList = this.foncheckList.filter(
        (obj) => obj.value !== tag.value
      );
    },
    getillness(id) {
      if (id) {
@@ -1651,10 +1722,11 @@
          { label: "身份证", width: "200", prop: "idcardno" },
          { label: "性别", width: "", prop: "sex" },
          { label: "年龄", width: "", prop: "age" },
          { label: "电话", width: "180", prop: "telcode" },
          { label: "出院天数", width: "", prop: "endDay" },
          { label: "责任护士", width: "", prop: "nurseName" },
          { label: "医生", width: "", prop: "drname" },
          { label: "课题组", width: "180", prop: "dept" },
          { label: "科室", width: "180", prop: "dept" },
          { label: "病区", width: "150", prop: "leavehospitaldistrictname" },
        ];
      } else if (this.patientqueryParams.allhosp == 1) {
@@ -1665,10 +1737,26 @@
          { label: "身份证", width: "200", prop: "idcardno" },
          { label: "性别", width: "", prop: "sex" },
          { label: "年龄", width: "", prop: "age" },
          { label: "电话", width: "180", prop: "telcode" },
          { label: "出院天数", width: "", prop: "endDay" },
          { label: "责任护士", width: "", prop: "nurseName" },
          { label: "医生", width: "", prop: "drname" },
          { label: "课题组", width: "180", prop: "dept" },
          { label: "科室", width: "180", prop: "dept" },
          { label: "病区", width: "150", prop: "leavehospitaldistrictname" },
        ];
      } else if (this.patientqueryParams.allhosp == 2) {
        this.tableLabelhz = [
          { label: "就诊日期", width: "150", prop: "admitdate" },
          { label: "患者", width: "", prop: "name" },
          { label: "身份证", width: "200", prop: "idcardno" },
          { label: "电话号码", width: "180", prop: "telcode" },
          { label: "性别", width: "", prop: "sex" },
          { label: "年龄", width: "", prop: "age" },
          { label: "电话", width: "180", prop: "telcode" },
          { label: "出院天数", width: "", prop: "endDay" },
          { label: "责任护士", width: "", prop: "nurseName" },
          { label: "医生", width: "", prop: "drname" },
          { label: "科室", width: "180", prop: "dept" },
          { label: "病区", width: "150", prop: "leavehospitaldistrictname" },
        ];
      }
@@ -1726,6 +1814,13 @@
          item.sfzh = item.idcardno;
          if (this.patientqueryParams.allhosp == 6) {
            item.patfrom = 1;
          }
          if (this.patientqueryParams.allhosp == 1) {
            item.visittime = item.endtime;
          } else if (this.patientqueryParams.allhosp == 4) {
            item.visittime = item.starttime;
          } else if (this.patientqueryParams.allhosp == 2) {
            item.visittime = item.admitdate;
          }
          this.overallCase.push(item);
          this.form.patTaskRelevances.push(item);
@@ -1817,6 +1912,7 @@
        { label: "身份证", width: "200", prop: "idcardno" },
        { label: "性别", width: "", prop: "sex" },
        { label: "年龄", width: "", prop: "age" },
        { label: "电话", width: "180", prop: "telcode" },
        { label: "出院天数", width: "", prop: "endDay" },
      ];
      this.patientqueryParams.pageSize = 1000;
@@ -1842,7 +1938,7 @@
      this.patientqueryParams = {
        pageNum: 1, //
        pageSize: 10,
        topica: 1, //0全部1课题组2病区
        topica: 1, //0全部1科室2病区
        leavehospitaldistrictcodes: [],
        leaveldeptcodes: [],
      };
@@ -1897,8 +1993,8 @@
              ? this.form.patTaskRelevances
              : [];
            this.overallCase = this.form.patTaskRelevances.concat();
            this.checkList = this.form.preachform;
            this.checkList = this.form.preachform.split(",");
            this.selectedOrder = this.form.preachformList;
            this.overallCase.forEach((item) => {
              if (item.endtime) {
                item.endDay = this.daysBetween(item.endtime);
@@ -1913,7 +2009,7 @@
                this.time1 = this.form.showTimeMorn.split(",");
              }
            }
            // 获取任务课题组
            // 获取任务科室
            if (this.form.taskid) {
              this.listDept();
            }
@@ -1990,7 +2086,7 @@
        }
      });
    },
    // 任务课题组删除触发
    // 任务科室删除触发
    removetag(row) {
      let result = this.deptlist
        .filter((item) => item.deptCode == row)
@@ -2180,7 +2276,7 @@
        });
      }
    },
    // 保存课题组/病区
    // 保存科室/病区
    putbelongDepts(id) {
      this.tempDetpRelevanceslistform.forEach((item) => {
        item.tempid = id;
@@ -2190,7 +2286,7 @@
      });
      depthospgetson(this.tempDetpRelevanceslistform).then((res) => {
        if (res.code == 200) {
          this.$modal.msgSuccess("课题组更新成功");
          this.$modal.msgSuccess("科室更新成功");
          this.tempDetpRelevanceslistform = [];
        }
      });
@@ -2202,7 +2298,7 @@
      });
    },
    // 课题组处理
    // 科室处理
    Departmenttreatment() {
      if (!this.form.taskid) {
        this.templateor = true;
@@ -2224,9 +2320,13 @@
            this.objyl.isoperation = 1;
            this.objyl.svyTaskTemplateScriptVOS =
              this.objyl.svyTemplateLibScripts;
            this.objyl.svyTaskTemplateScriptVOS.forEach((item) => {
              item.svyTaskTemplateTargetoptions =
                item.svyLibTemplateTargetoptions;
            });
            this.form.svyTaskTemplateVO = this.objyl;
            this.form.templatename = this.objyl.svyname;
            this.$modal.msgSuccess("暂存成功保存任务后模板失效");
            this.$modal.msgSuccess("暂存成功保存任务后模板生效");
            this.drawermb = false;
            this.previewtf = false;
          })