Browse Source

计算计算睡眠效率

newMaster
1747191978@qq.com 3 months ago
parent
commit
e023de9fa3
  1. 59
      acupuncture-前台/src/views/screening/h5.vue

59
acupuncture-前台/src/views/screening/h5.vue

@ -101,7 +101,7 @@
</div> </div>
</div> </div>
<!-- 睡眠质量评估 --> <!-- 睡眠质量评估 -->
<!-- <div class="card"> <div class="card">
<div class="card-title">睡眠质量评估</div> <div class="card-title">睡眠质量评估</div>
<el-form-item label="上床睡觉" prop="SCWJ-SCSJ"> <el-form-item label="上床睡觉" prop="SCWJ-SCSJ">
<el-time-select <el-time-select
@ -124,7 +124,6 @@
start: '00:30', start: '00:30',
step: '00:15', step: '00:15',
end: '23:59', end: '23:59',
minTime: form['SCWJ-SCSJ'],
}" }"
></el-time-select> ></el-time-select>
</el-form-item> </el-form-item>
@ -137,7 +136,18 @@
start: '00:30', start: '00:30',
step: '00:15', step: '00:15',
end: '23:59', end: '23:59',
minTime: form['SCWJ-RSSJ'], }"
></el-time-select>
</el-form-item>
<el-form-item label="起床时间" prop="SCWJ-QCSJ">
<el-time-select
@change="calculateSleepTime"
placeholder="请选择时间"
v-model="form['SCWJ-QCSJ']"
:picker-options="{
start: '00:30',
step: '00:15',
end: '23:59',
}" }"
></el-time-select> ></el-time-select>
</el-form-item> </el-form-item>
@ -146,7 +156,7 @@
{{ form["SCWJ-SMXL"] || "- - -" }} {{ form["SCWJ-SMXL"] || "- - -" }}
</span> </span>
</el-form-item> </el-form-item>
</div> --> </div>
<!-- 疾病风险选择(现病史) --> <!-- 疾病风险选择(现病史) -->
<div class="card"> <div class="card">
<div class="card-title">疾病风险选择</div> <div class="card-title">疾病风险选择</div>
@ -426,10 +436,11 @@ export default {
"SCWJ-BMI": "", "SCWJ-BMI": "",
"SCWJ-JL": "", "SCWJ-JL": "",
"SCWJ-ZLFS": [], "SCWJ-ZLFS": [],
"SCWJ-SCSJ": "", "SCWJ-SCSJ": "22:00",
"SCWJ-RSSJ": "", "SCWJ-RSSJ": "22:30",
"SCWJ-SXSJ": "", "SCWJ-SXSJ": "06:30",
"SCWJ-SMXL": "", "SCWJ-QCSJ": "07:00",
"SCWJ-SMXL": "", //
"SCWJ-XBS": [], "SCWJ-XBS": [],
"SCWJ-XBS-QT": "", "SCWJ-XBS-QT": "",
// "SCWJ-NAME": "2", // "SCWJ-NAME": "2",
@ -536,22 +547,26 @@ export default {
console.log("this.tenantId", this.tenantId); console.log("this.tenantId", this.tenantId);
localStorage.setItem("tenantId", this.tenantId); localStorage.setItem("tenantId", this.tenantId);
this.getQueryHospitalNoToken(); // id this.getQueryHospitalNoToken(); // id
this.calculateSleepTime(); //
}, },
methods: { methods: {
// //
// / // /
// = - // = -
// = - // = -
// = / // = /
//
//
//
calculateSleepTime() { calculateSleepTime() {
// //
const bedTime = this.form["SCWJ-SCSJ"]; // const bedTime = this.form["SCWJ-SCSJ"]; //
const sleepTime = this.form["SCWJ-RSSJ"]; // const sleepTime = this.form["SCWJ-RSSJ"]; //
const wakeTime = this.form["SCWJ-SXSJ"]; // const wakeTime = this.form["SCWJ-SXSJ"]; //
const wakeBedTime = this.form["SCWJ-QCSJ"]; //
// //
if (!bedTime || !sleepTime || !wakeTime) return; if (!bedTime || !sleepTime || !wakeTime || !wakeBedTime) return;
// //
const toMinutes = (timeStr) => { const toMinutes = (timeStr) => {
@ -559,12 +574,24 @@ export default {
return parseInt(hour) * 60 + parseInt(minute); return parseInt(hour) * 60 + parseInt(minute);
}; };
// - //
const inBedMinutes = toMinutes(sleepTime) - toMinutes(bedTime); // = -
// = -
let inBedMinutes = toMinutes(wakeBedTime) - toMinutes(bedTime); //
let sleepMinutes = toMinutes(wakeTime) - toMinutes(sleepTime); //
// - //
const 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; const sleepEfficiency = (sleepMinutes / inBedMinutes) * 100;

Loading…
Cancel
Save