From c8ce65d4cd95f40cfaa622556a078d50836e8c35 Mon Sep 17 00:00:00 2001 From: "1747191978@qq.com" <1942943850@qq.com> Date: Wed, 19 Mar 2025 11:09:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=9B=E6=9F=A5=E7=BB=93=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- acupuncture-前台/src/views/screening/h5.vue | 185 ++++++++++++++------ 1 file changed, 132 insertions(+), 53 deletions(-) diff --git a/acupuncture-前台/src/views/screening/h5.vue b/acupuncture-前台/src/views/screening/h5.vue index a9a1a19d..fcbb0474 100644 --- a/acupuncture-前台/src/views/screening/h5.vue +++ b/acupuncture-前台/src/views/screening/h5.vue @@ -153,7 +153,7 @@ - {{ form["SCWJ-SMXL"] || "- - -" }} + {{ form["SCWJ-SMXL"] || "- - -" }}% @@ -173,7 +173,7 @@ -
+ +
+
筛查结论
+
+ 您的体重指数(BMI)为: + {{ form["SCWJ-BMI"] || "- - -" }} +
+
+ 您的睡眠效率为: + {{ form["SCWJ-SMXL"] || "- - -" }}% +
+
+ + {{ tips }} + + - - - +
- -
+ +
+ + 提交 +
{{ tenantName || "- - - -" }}
@@ -243,6 +276,7 @@ import { screenSubmit, queryHospitalNoToken, } from "@/api/screening.js"; + export default { name: "Notice", data() { @@ -303,6 +337,8 @@ export default { 超重: "3", 肥胖: "4", }, + tips: "", //结果提示 + tipsError: false, //结果提示 // 1.您觉得平时睡眠足够吗 ? // ①睡眠过多了 ②睡眠正好 ③睡眠欠一些 ④睡眠不够 ⑤睡眠时间远远不够 // 2.您在睡眠后是否已觉得充分休息过了 ? @@ -436,13 +472,13 @@ export default { "SCWJ-BMI": "", "SCWJ-JL": "", "SCWJ-ZLFS": [], - "SCWJ-SCSJ": "22:00", - "SCWJ-RSSJ": "22:30", - "SCWJ-SXSJ": "06:30", - "SCWJ-QCSJ": "07:00", + "SCWJ-SCSJ": "22:00", // 上床睡觉 + "SCWJ-RSSJ": "22:30", // 入睡时间 + "SCWJ-SXSJ": "06:30", // 睡醒时间 + "SCWJ-QCSJ": "07:00", // 起床时间 "SCWJ-SMXL": "", // 睡眠效率 - "SCWJ-XBS": [], - "SCWJ-XBS-QT": "", + "SCWJ-XBS": [], // 现病史 + "SCWJ-XBS-QT": "", // 现病史- 其他 // "SCWJ-NAME": "测试患者2", // "SCWJ-SEX": "男", // "SCWJ-BIRTH": "1945-01-01", @@ -538,6 +574,13 @@ export default { trigger: "change", }, ], + "SCWJ-QCSJ": [ + { + required: true, + message: "起床时间不能为空", + trigger: "change", + }, + ], }, loading: false, }; @@ -549,7 +592,33 @@ export default { this.getQueryHospitalNoToken(); // 组织id获取组织名称 this.calculateSleepTime(); //计算睡眠效率 }, + // 监听结论和睡眠效率 + watch: { + form: { + handler(newVal, oldVal) { + this.getTips(); + }, + deep: true, + }, + }, methods: { + // 获取筛查结论 + getTips() { + console.log("获取筛查结论"); + + const BMI = this.form["SCWJ-BMI"]; // BMI + const sleepEfficiency = this.form["SCWJ-SMXL"]; // 睡眠效率 + if (BMI && sleepEfficiency) { + // BMI大于25或睡眠效率低于85%,{{ "建议找专业医师进一步评估" }}。 + if (BMI > 25 || sleepEfficiency < 85) { + this.tips = "建议找专业医师进一步评估"; + this.tipsError = true; + } else { + this.tips = "均属于正常范围,请继续保持"; + this.tipsError = false; + } + } + }, // 计算睡眠效率 // 上床睡觉时间、入睡时间、睡醒时间、起床时间,自动计算睡眠效率(睡眠时间/在床上时间) // 睡眠时间 = 睡醒时间 - 入睡时间 @@ -596,7 +665,7 @@ export default { const sleepEfficiency = (sleepMinutes / inBedMinutes) * 100; // 更新睡眠效率字段,保留两位小数 - this.form["SCWJ-SMXL"] = sleepEfficiency.toFixed(2) + "%"; + this.form["SCWJ-SMXL"] = sleepEfficiency.toFixed(0); }, // 通过出生日期计算年龄 @@ -728,48 +797,55 @@ export default { // 量表结果 async scaleSubmitForm() { try { - // ------ 量表分值计算 ------ - let score = 0; - // 计算总分, topic${i}属性不一定存在,先校验是否存在 - for (let i = 1; i <= 24; i++) { - if (this.form[`topic${i}`] !== undefined) { - score += this.form[`topic${i}`]; + this.$refs["form"].validate(async (valid) => { + if (valid) { + // ------ 量表分值计算 ------ + let score = 0; + // 计算总分, topic${i}属性不一定存在,先校验是否存在 + for (let i = 1; i <= 24; i++) { + if (this.form[`topic${i}`] !== undefined) { + score += this.form[`topic${i}`]; + } + } + // ------ 创建筛查 ------ + const params = { + param: { + type: 33, + tenantId: this.tenantId, + centerId: this.tenantId, + }, + }; + create(params).then(async (res) => { + this.loading = true; + this.detailId = res.data.detailId; + this.id = res.data.id; + // ------ 保存答案 ------ + // 基本信息 + await this.saveAnswer(this.form["SCWJ-NAME"], "SCWJ-NAME"); + await this.saveAnswer(this.form["SCWJ-SEX"], "SCWJ-SEX"); + await this.saveAnswer(this.form["SCWJ-BIRTH"], "SCWJ-BIRTH"); + await this.saveAnswer(this.form["SCWJ-AGE"], "SCWJ-AGE"); + await this.saveAnswer(this.form["SCWJ-PHONE"], "SCWJ-PHONE"); + await this.saveAnswer(this.form["SCWJ-HEIGHT"], "SCWJ-HEIGHT"); + await this.saveAnswer(this.form["SCWJ-WEIGHT"], "SCWJ-WEIGHT"); + await this.saveAnswer(this.form["SCWJ-BMI"], "SCWJ-BMI"); + await this.saveAnswer(this.form["SCWJ-JL"], "SCWJ-JL"); + // 筛查总分 + await this.saveAnswer(score, "SCWJ-RESULT"); + await this.saveAnswer( + this.form["SCWJ-ZLFS"].toString(), + "SCWJ-ZLFS" + ); // 治疗方式 + await this.saveAnswer(this.form["SCWJ-ZLZQ"], "SCWJ-ZLZQ"); // 治疗周期 + // ------ 提交筛查 ------ + const submitParams = { param: { detailId: this.detailId } }; + await screenSubmit(submitParams).then((response) => { + this.loading = false; + this.disabled = false; + this.$modal.msgSuccess("提交成功"); + }); + }); } - } - // ------ 创建筛查 ------ - const params = { - param: { - type: 33, - tenantId: this.tenantId, - centerId: this.tenantId, - }, - }; - create(params).then(async (res) => { - this.loading = true; - this.detailId = res.data.detailId; - this.id = res.data.id; - // ------ 保存答案 ------ - // 基本信息 - await this.saveAnswer(this.form["SCWJ-NAME"], "SCWJ-NAME"); - await this.saveAnswer(this.form["SCWJ-SEX"], "SCWJ-SEX"); - await this.saveAnswer(this.form["SCWJ-BIRTH"], "SCWJ-BIRTH"); - await this.saveAnswer(this.form["SCWJ-AGE"], "SCWJ-AGE"); - await this.saveAnswer(this.form["SCWJ-PHONE"], "SCWJ-PHONE"); - await this.saveAnswer(this.form["SCWJ-HEIGHT"], "SCWJ-HEIGHT"); - await this.saveAnswer(this.form["SCWJ-WEIGHT"], "SCWJ-WEIGHT"); - await this.saveAnswer(this.form["SCWJ-BMI"], "SCWJ-BMI"); - await this.saveAnswer(this.form["SCWJ-JL"], "SCWJ-JL"); - // 筛查总分 - await this.saveAnswer(score, "SCWJ-RESULT"); - await this.saveAnswer(this.form["SCWJ-ZLFS"].toString(), "SCWJ-ZLFS"); // 治疗方式 - await this.saveAnswer(this.form["SCWJ-ZLZQ"], "SCWJ-ZLZQ"); // 治疗周期 - // ------ 提交筛查 ------ - const submitParams = { param: { detailId: this.detailId } }; - await screenSubmit(submitParams).then((response) => { - this.loading = false; - this.disabled = false; - this.$modal.msgSuccess("提交成功"); - }); }); } catch (error) { this.loading = false; @@ -804,7 +880,9 @@ export default { .form-item-xbs >>> .el-form-item__content { margin-left: 0 !important; } - +.qq { + color: green; +} .idcardupd { height: 44px; margin-bottom: 14px; @@ -896,6 +974,7 @@ export default { font-size: 20px; margin-bottom: 16px; } + .card-tips { font-size: 14px; color: #999999;