diff --git a/index.html b/index.html
index 257bbe2..9a58217 100644
--- a/index.html
+++ b/index.html
@@ -103,11 +103,20 @@
+
+
+
+
+
+
+
+
+ 青少年界值请按《WS/T 586-2018 学龄儿童青少年超重与肥胖筛查》中对应年龄与性别填入,默认值为 15 岁男性参考值。
@@ -177,16 +186,16 @@ function bmrOf(sex, weightKg, heightCm, age){
: 10 * weightKg + 6.25 * heightCm - 5 * age - 161;
}
-function judgeBmi(bmi, age, sex){
+function judgeBmi(bmi, age, tOver, tObese){
if(age >= 18){
if(bmi < 18.5) return { t:'偏瘦', c:'b-warn' };
if(bmi < 24) return { t:'正常', c:'b-ok' };
if(bmi < 28) return { t:'超重', c:'b-warn' };
return { t:'肥胖', c:'b-bad' };
}
- // 青少年:中国标准只筛查超重与肥胖
- if(bmi >= 26.4) return { t:'肥胖', c:'b-bad' };
- if(bmi >= 24.6) return { t:'超重', c:'b-warn' };
+ // 青少年:中国标准只筛查超重与肥胖,界值由使用者按年龄性别填入
+ if(bmi >= tObese) return { t:'肥胖', c:'b-bad' };
+ if(bmi >= tOver) return { t:'超重', c:'b-warn' };
return { t:'未达超重', c:'b-ok' };
}
@@ -220,11 +229,21 @@ function compute(){
if($('unit').value === 'jin') weightKg = weightKg / 2;
const pal = Number($('pal').value);
const goal = $('goal').value;
+ let tOver = Number($('teenOver').value);
+ let tObese = Number($('teenObese').value);
if(!heightCm || !weightKg || !age){
alert('请把身高、体重、年龄填写完整。');
return;
}
+ if(age < 18 && (!tOver || !tObese) ){
+ tOver = tOver || 24.6;
+ tObese = tObese || 26.4;
+ }
+ if(age < 18 && tObese <= tOver){
+ alert('青少年肥胖界值应大于超重界值。');
+ return;
+ }
const heightM = heightCm / 100;
const bmi = weightKg / (heightM * heightM);
@@ -252,11 +271,10 @@ function compute(){
const pPct = Math.round(pMid * 4 / target * 100);
const cPct = Math.round(carbMid * 4 / target * 100);
const fatPct = 100 - pPct - cPct;
- const fiberLow = teen ? 25 : 25, fiberHigh = teen ? 30 : 30;
const water = teen ? '1500–2000 ml' : (sex === 'male' ? '1700–2000 ml' : '1500–1800 ml');
// 渲染
- const j = judgeBmi(bmi, age, sex);
+ const j = judgeBmi(bmi, age, tOver, tObese);
$('k-bmi').textContent = bmi.toFixed(1);
const badge = $('k-bmi-badge');
badge.textContent = j.t;
@@ -267,7 +285,8 @@ function compute(){
$('bmi-ref').textContent = age >= 18
? '判定标准:中国成人标准 —— 正常 18.5–23.9,超重 24.0–27.9,肥胖 ≥ 28.0。'
- : '青少年参考界值(15 岁男:超重 ≥ 24.6、肥胖 ≥ 26.4),其他年龄与性别请对照 WS/T 586-2018 原表判定。';
+ : '本次按自定义界值判定:超重 ≥ ' + tOver + ',肥胖 ≥ ' + tObese
+ + '。青少年界值随年龄与性别变化,请对照 WS/T 586-2018 原表修改上方界值。';
$('formula-note').textContent = age < 18
? 'BMR 采用 Schofield 青少年公式(10–18 岁);TDEE = BMR × PAL。'
@@ -277,7 +296,7 @@ function compute(){
| 蛋白质 | ${Math.round(pLow)}–${Math.round(pHigh)} g | ${pPct}% |
| 脂肪 | ${Math.round(fatLow)}–${Math.round(fatHigh)} g | ${fatPct}% |
| 碳水化合物 | ${Math.round(carbMid)} g | ${cPct}% |
- | 膳食纤维 | ${fiberLow}–${fiberHigh} g | — |
+ | 膳食纤维 | 25–30 g | — |
| 饮水 | ${water} | — |
`;
$('micro-body').innerHTML = microList(age, sex)
@@ -290,8 +309,7 @@ function compute(){
let warn = '';
if(goal === 'cut'){
- warn += '减脂建议每天制造 400–500 kcal 缺口,每周降 0.5–1 kg 为宜;'
- + '摄入不要长期低于基础代谢。';
+ warn += '减脂建议每天制造 400–500 kcal 缺口,每周降 0.5–1 kg 为宜;摄入不要长期低于基础代谢。';
if(clamped) warn += ' 按缺口计算后低于安全下限,已自动调整为下限值。';
}
if(age < 18){
@@ -313,6 +331,8 @@ function resetAll(){
$('sex').value = 'male';
$('pal').value = '1.6';
$('goal').value = 'cut';
+ $('teenOver').value = 24.6;
+ $('teenObese').value = 26.4;
compute();
}