体检指标风险评估
接口地址
POST /api/samples
示例:
curl -X POST -d '请见[请求数据包]' \
-H "Content-Type:application/json" \
-H "Authorization:JWT token" \
http://jrisk.99jkom.com/api/samples
请求数据包
{
"user_identifier": "JKOM001", // 用户标识
"namespace": "JKOM", // 请求方标识
"datetime": "2017-01-18T00:00:00.000Z", // 体检时间: ISOString
"profile": { // 个人资料
"dob": "1930-01-01", // 生日: YYYY-MM-DD
"gender": "male" // 性别: male/female
},
"health_background": { // 健康背景信息
"has_diabetes": false,
"is_taking_antihypertensive_therapy": false,
"has_cvd": false,
"smoke_daily_frequency": 0,
"has_hbp": true
},
"samples": [ // 指标列表
{
"name": "LDL-C", // 指标标准名
"unit": "mmol/L", // 单位
"value": 6.0 // 数值
}
]
}
成功返回 HTTP 200
{
// 包含提交的所有字段,以及下列新字段
"created_at": "2017-06-22T07:02:44.621830+00:00",
"samples": [
{
// 以下字段是提交的字段
"name": "LDL-C",
"unit": "mmol/L",
"value": 6,
// 以下字段为新增字段,为分析结果
"tip": "严重升高", // 文字提示
"hint": "血脂管控极差、饮食结构不科学..", // 可能因素
"color": 5, // 颜色代码
"level": "R3", // 风险等级
"risks": [ // 风险提示
{
"id": "20", // 疾病风险ID
"flag": 3, // 疾病风险icon代码
"name": "动脉粥样硬化风险" // 疾病风险名称
},
{
"id": "14",
"flag": 3,
"name": "“坏”胆固醇过多"
}
]
}
]
}
UI 样例
- sample.value -> 3.45
- sample.unit -> mmol/L
- sample.tip -> 轻度升高
- sample.color -> 3.45 和 轻度升高 的颜色
- sample.ideal -> 0~3.4
- sample.risks[0].name -> 动脉粥样硬化风险
- sample.risks[0].flag -> 信号格数
- sample.hint -> 饮食结构不科学、缺乏运动、不良生活方式
失败返回
HTTP 400
{"detail": "失败原因,例如:missing args: {'waist', 'bmi'} "}
HTTP 401
{"detail": "Authentication credentials were not provided."}