@yolanda-qn/four-electrodes-report-public-lib
v1.3.3
Published
公版四电极报告
Downloads
4
Readme
公版四电极指标报告库
更多信息查看@yolanda-qn/four-electrodes-report-lib
Usage
|名称|类型|必须|默认值|说明| |:--|:--|:--:|:--|:--| |measureData|measureData|Y||测量数据| |config|config|N|| |callback|(err: null Error, reportItems: ReportItem[]) => void|N||回调函数|
- 返回
- type: Promise<Array<ReportItem>>
注意:在微信小程序中使用需要将 https://third-api.yolanda.hk 添加到地址白名单中,并指定 runEnv 为 wx_miniprogram
示例:
在模块中
import getReports from '@yolanda-qn/four-electrodes-report-public-lib';
// 测量的数据
cosnt measureData = {"gender":1,"birthday":"1994-08-08","height":"168","weight":"65.6","bmi":"23.2","bodyfat":"16.8","subfat":"14.9","visfat":"6","water":"60.1","bmr":"1549","body_age":"27","muscle":"47.4","bone":"2.7","sinew":"51.9","protein":"19","lbm":"54.6","body_shape":"4","heart_index":"3","heart_rate":"83","score":"94.4"};
const config = {
// sdk的appid
appId: '',
// 如果需要根据设备型号过滤指标
modelId: '',
// 在微信小程序中 请指定为 wx_miniprogram
runEnv: 'browser',
};
getReports(
measureData,
config,
// 使用函数回调的形式。promise和函数回调方式选择一种就可以了
(err, ret) => {
if (err) {
console.error(err);
throw err;
}
console.log(ret);
},
)
// 使用promise方式
.then((ret) => {
console.log(ret);
});
在浏览器中
<script src="./dist/index.umd.js"></script>
<script>
// 获取报告数据
window.QN_globalGetFourElectrodesReports.default(measureData, config)
.then((ret) => {
console.log(ret);
});
</script>
measureData
|名称|类型|必须|说明|单位| |:--|:--|:--:|:--|:--| |gender |1和0 |Y|性别。1:男性,0:女性|| |birthday |string |Y|生日。例如:1994-06-17|| |local_updated_at|string|Y|测量时间|| |height |number |Y|身体高度|cm| |weight |number |Y|体重|kg| |bmi |number |N|BMI|kg/m²| |bodyfat |number |N|体脂率|%| |subfat |number |N|皮下脂肪率|%| |visfat |number |N|内脏脂肪等级|| |water |number |N|体水分|%| |bmr |number |N|基础代谢量|kcal| |body_age |number |N|体年龄。别名:bodyAge|岁| |muscle |number |N|骨骼肌率|%| |bone|number |N|骨量(又称无机盐)|kg| |sinew |number |N|肌肉量。别名:muscleMass|kg| |protein |number |N|蛋白质|%| |lbm|number|N|去脂体重|kg| |body_shape|number|N|体型。别名:bodyShape|| |heart_index|number|N|心脏等级。别名:heartIndex|| |heart_rate|number|N|心率。别名:heartRate|次/分钟| |score|number|N|健康评分||
注意:测量记录一定要保存用户当时测量的用户信息数据,历史数据的指标展示不能根据现在的用户信息去计算
config
|名称|类型|必须|默认值|说明| |:--|:--|:--:|:--|:--| |appId|string|Y||sdk配置所需的appid| |modelId|string|N||设备内部型号Id| |runEnv|browser:浏览器环境;wx_miniprogram: 微信小程序环境;|N|browser|运行环境,默认浏览器环境。涉及到获取sdk配置的请求方式|
返回值
在sdk中配置的指标并且原始输入数据是正确的的情况下才有指标字段和值返回
{
"weight": {
"name": "体重",
"value": "65.6",
"unit": "kg"
},
"weightControl": {
"name": "体重控制",
"value": "-0.79",
"unit": "kg"
},
"bmr": {
"name": "基础代谢",
"value": "1549",
"unit": "kcal"
},
"bestVisualWeight": {
"name": "理想视觉体重",
"value": "61.2",
"unit": "kg"
},
"bodyfat": {
"name": "体脂率",
"value": "16.8",
"unit": "%"
},
"bodyfatMass": {
"name": "脂肪重量",
"value": "11.02",
"unit": "kg"
},
"bmi": {
"name": "BMI",
"value": "23.2",
"unit": ""
},
"bodyAge": {
"name": "体年龄",
"value": "27",
"unit": "岁"
},
"bodyShape": {
"name": "体型",
"value": "4",
"unit": ""
},
"bone": {
"name": "骨量",
"value": "2.7",
"unit": "kg"
},
"fatControl": {
"name": "脂肪控制",
"value": "-1.18",
"unit": "kg"
},
"heartIndex": {
"name": "心脏指数",
"value": "3",
"unit": "L/min/m^2"
},
"heartRate": {
"name": "心率",
"value": "83",
"unit": "bpm"
},
"lbm": {
"name": "去脂体重",
"value": "54.6",
"unit": "kg"
},
"mineralSalt": {
"name": "无机盐状况",
"value": "1",
"unit": ""
},
"muscle": {
"name": "骨骼肌率",
"value": "47.4",
"unit": "%"
},
"sinewControl": {
"name": "肌肉控制",
"value": "+0.39",
"unit": "kg"
},
"sinew": {
"name": "肌肉量",
"value": "51.9",
"unit": "kg"
},
"sinewRate": {
"name": "肌肉率",
"value": "79.1",
"unit": "%"
},
"obesity": {
"name": "肥胖度",
"value": "6.5",
"unit": "%"
},
"protein": {
"name": "蛋白质",
"value": "19",
"unit": "%"
},
"proteinMass": {
"name": "蛋白质量",
"value": "12.46",
"unit": "kg"
},
"score": {
"name": "健康评分",
"value": "94.4",
"unit": ""
},
"standardWeight": {
"name": "标准体重",
"value": "61.6",
"unit": "kg"
},
"subfat": {
"name": "皮下脂肪",
"value": "14.9",
"unit": "%"
},
"visfat": {
"name": "内脏脂肪等级",
"value": "6",
"unit": ""
},
"water": {
"name": "体水分",
"value": "60.1",
"unit": "%"
},
"waterMass": {
"name": "体水量",
"value": "39.43",
"unit": "kg"
},
"fattyLiver": {
"name": "脂肪肝风险等级",
"value": "0",
"unit": "级"
}
}
无机盐输出的值的定义
对应返回字段mineral_salt
BREAKING CHANGE
// Before v1.3.0
export enum MineralSaltReportValueEnum {
// 充足
adequate = 0,
// 正常
normal = 1,
// 缺乏
lack = 2,
}
// Since v1.3.0
export enum MineralSaltReportValueEnum {
// 充足
adequate = 3,
// 正常
normal = 2,
// 缺乏
lack = 1,
}
体型输出值的定义
对应返回的字段body_shape
export enum BodyShapeReportValueEnum {
// 隐形肥胖型
shape1 = 1,
// 运动不足型
shape2 = 2,
// 偏瘦型
shape3 = 3,
// 标准型
shape4 = 4,
// 偏瘦肌肉型
shape5 = 5,
// 肥胖型
shape6 = 6,
// 偏胖型
shape7 = 7,
// 标准肌肉型
shape8 = 8,
// 非常肌肉型
shape9 = 9,
}
脂肪肝风险等级输出值定义
export enum FattyLiverReportValueEnum {
// 0级
level0 = 0,
// I级
level1 = 1,
// II级
level2 = 2,
// III级
level3 = 3,
// IV级
level4 = 4,
}
CHANGELOG
(npm上无法查看当前目录下的其他md文件,可安装库后在对应模块目录里找到CHANGELOG.md文件)