+
+
+
筛查结论
+
+ 您的体重指数(BMI)为:
+ {{ form["SCWJ-BMI"] || "- - -" }}
+
+
+ 您的睡眠效率为:
+ {{ form["SCWJ-SMXL"] || "- - -" }}%
+
+
+
+ {{ tips }}
+
+ - - -
+
-
-
+
+
+
+ 提交
+
{{ tenantName || "- - - -" }}
@@ -175,6 +282,7 @@ import {
screenSubmit,
queryHospitalNoToken,
} from "@/api/screening.js";
+
export default {
name: "Notice",
data() {
@@ -187,7 +295,30 @@ export default {
stepNum: 1, // 步骤数
uploadFileUrl: process.env.VUE_APP_BASE_URL + "/baidu/ocr/idcardInfo", // 上传的图片服务器地址
fileList: [],
-
+ // 现病史
+ medicalHistory: [
+ "无",
+ "高脂血症",
+ "肝脏疾病(脂肪肝、乙型肝炎、肝硬化等)",
+ "胰岛素抵抗",
+ "高尿酸",
+ "多囊卵巢综合症",
+ "高血压",
+ "脑血管病",
+ "恶性肿瘤",
+ "冠心病",
+ "精神疾病",
+ "胃和十二指肠溃疡",
+ "肥胖症",
+ "骨质疏松症",
+ "遗传性、先天性疾病",
+ "糖尿病",
+ "慢性肺系疾病",
+ "过敏性疾病",
+ "关节炎",
+ "痛风",
+ "肾炎、肾病",
+ ],
BMITips: [
{
label: "体重过轻",
@@ -213,6 +344,8 @@ export default {
超重: "3",
肥胖: "4",
},
+ tips: "", //结果提示
+ tipsError: false, //结果提示
// 1.您觉得平时睡眠足够吗 ?
// ①睡眠过多了 ②睡眠正好 ③睡眠欠一些 ④睡眠不够 ⑤睡眠时间远远不够
// 2.您在睡眠后是否已觉得充分休息过了 ?
@@ -336,6 +469,7 @@ export default {
},
], // 表单参数
form: {
+ "SCWJ-DW": "",
"SCWJ-NAME": "",
"SCWJ-SEX": "男",
"SCWJ-BIRTH": "",
@@ -346,6 +480,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-SMXL": "", // 睡眠效率
+ "SCWJ-XBS": [], // 现病史
+ "SCWJ-XBS-QT": "", // 现病史- 其他
// "SCWJ-NAME": "测试患者2",
// "SCWJ-SEX": "男",
// "SCWJ-BIRTH": "1945-01-01",
@@ -359,6 +500,13 @@ export default {
},
// 表单校验
rules: {
+ "SCWJ-DW": [
+ {
+ required: true,
+ message: "单位不能为空",
+ trigger: "blur",
+ },
+ ],
"SCWJ-NAME": [
{
required: true,
@@ -396,7 +544,7 @@ export default {
{
pattern: /^1[3456789]\d{9}$/,
message: "格式不正确",
- trigger: "change",
+ trigger: ["blur", "change"],
},
],
"SCWJ-HEIGHT": [
@@ -420,6 +568,34 @@ export default {
trigger: "blur",
},
],
+ "SCWJ-SCSJ": [
+ {
+ required: true,
+ message: "上床睡觉不能为空",
+ trigger: "change",
+ },
+ ],
+ "SCWJ-RSSJ": [
+ {
+ required: true,
+ message: "入睡时间不能为空",
+ trigger: "change",
+ },
+ ],
+ "SCWJ-SXSJ": [
+ {
+ required: true,
+ message: "睡醒时间不能为空",
+ trigger: "change",
+ },
+ ],
+ "SCWJ-QCSJ": [
+ {
+ required: true,
+ message: "起床时间不能为空",
+ trigger: "change",
+ },
+ ],
},
loading: false,
};
@@ -429,8 +605,84 @@ export default {
console.log("this.tenantId", this.tenantId);
localStorage.setItem("tenantId", this.tenantId);
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;
+ }
+ }
+ },
+ // 计算睡眠效率
+ // 上床睡觉时间、入睡时间、睡醒时间、起床时间,自动计算睡眠效率(睡眠时间/在床上时间)
+ // 睡眠时间 = 睡醒时间 - 入睡时间
+ // 在床上时间 = 起床时间 - 上床时间
+ // 睡眠效率 = 睡眠时间 / 在床上时间
+ // 注:
+ // 睡醒时间 小于 入睡时间则表示是第二天的时间
+ // 起床时间 小于 上床则表示是第二天的时间
+ calculateSleepTime() {
+ // 获取时间值
+ const bedTime = this.form["SCWJ-SCSJ"]; // 上床睡觉时间
+ const sleepTime = this.form["SCWJ-RSSJ"]; // 入睡时间
+ const wakeTime = this.form["SCWJ-SXSJ"]; // 睡醒时间
+ const wakeBedTime = this.form["SCWJ-QCSJ"]; // 起床时间
+
+ // 如果缺少任一时间,直接返回
+ if (!bedTime || !sleepTime || !wakeTime || !wakeBedTime) return;
+
+ // 将时间字符串转换为分钟数
+ const toMinutes = (timeStr) => {
+ const [hour, minute] = timeStr.split(":");
+ return parseInt(hour) * 60 + parseInt(minute);
+ };
+
+ // 计算在床上时间和睡眠时间
+ // 在床上时间 = 上床睡觉时间 - 入睡时间
+ // 睡眠时间 = 入睡时间 - 起床时间
+ let inBedMinutes = toMinutes(wakeBedTime) - toMinutes(bedTime); // 在床上时间
+ let sleepMinutes = toMinutes(wakeTime) - toMinutes(sleepTime); // 睡眠时间
+
+ // 处理跨天情况
+ // 如果入睡时间小于上床时间,说明跨天,加上24小时
+ if (inBedMinutes < 0) {
+ inBedMinutes += 24 * 60;
+ }
+
+ // 如果睡醒时间小于入睡时间,说明跨天,加上24小时
+ if (sleepMinutes < 0) {
+ sleepMinutes += 24 * 60;
+ }
+ console.log("inBedMinutes", inBedMinutes);
+ console.log("sleepMinutes", sleepMinutes);
+ // 计算睡眠效率(睡眠时间 / 在床上时间)
+ const sleepEfficiency = (sleepMinutes / inBedMinutes) * 100;
+
+ // 更新睡眠效率字段,保留两位小数
+ this.form["SCWJ-SMXL"] = sleepEfficiency.toFixed(0);
+ },
+
// 通过出生日期计算年龄
calculateAge() {
const birthDate = new Date(this.form["SCWJ-BIRTH"]);
@@ -560,48 +812,68 @@ 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-DW"], "SCWJ-DW");
+ 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(this.form["SCWJ-SCSJ"], "SCWJ-SCSJ");
+ await this.saveAnswer(this.form["SCWJ-RSSJ"], "SCWJ-RSSJ");
+ await this.saveAnswer(this.form["SCWJ-SXSJ"], "SCWJ-SXSJ");
+ await this.saveAnswer(this.form["SCWJ-QCSJ"], "SCWJ-QCSJ");
+ await this.saveAnswer(this.form["SCWJ-SMXL"], "SCWJ-SMXL");
+ await this.saveAnswer(
+ this.form["SCWJ-XBS"].toString(),
+ "SCWJ-XBS"
+ );
+ await this.saveAnswer(this.form["SCWJ-XBS-QT"], "SCWJ-XBS-QT");
+ await this.saveAnswer(this.tips, "SCREEN-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;
@@ -633,6 +905,15 @@ export default {