健康日历接入

最近更新时间:2024-05-10 18:22:21

我的收藏

使用方式

1. 获取域名
2. 获取 token
3. 请求日历接口,获取对应数据。

操作步骤

获取域名

预发布环境域名:https://preview.baike.qq.com
生产环境域名:https://h5.baike.qq.com
说明:
在新接口联调时,请使用预发布环境的域名;已上线接口使用正式环境域名。

获取 token

url:htts://preview.baike.qq.com/api/access/pb/cmd/LoginWithAppid
方式:POST
Content-Type:application/json

输入参数说明

参数名
参数说明
参数类型
备注
appid
由医典侧下发的 appid
string
联系我们 为您提供 appid 和 appsecret、adtag 参数,以供正式对接。

appserect
由医典侧下发的 appserect
adtag
由医典侧下发

输出参数说明

参数名
参数说明
参数类型
备注
token
接口调用凭证
string
用于之后的接口调用
expires_in
token 的过期时间
string
token 有效期,单位秒

代码示例

输入参数示例
{
"header": {
"version": "1.0.0",
"flag": 0
},
"body": {
"seq": 0, // 每次请求递增
"cmd": "LoginWithAppid",
"token": "",
"client": {
"clientIP": "192.168.1.1", // clientIP如果是后台转发前端请求,这里填写用户的IP。如果是前端直连则可以填空字符串

"adtag": "$adtag" // 用户填写
},
"payload": {
"appid": "$appid", // 用户填写
"app_secret": "$appserect" // 用户填写
}
}
}
输出参数示例
{
"body": {
"cmd": "LoginWithAppid",
"message": "success", // 失败的话会携带错误信息
"payload": {
"expires_in": 604800, // 过期时间
"token": "7298bdab-9ab2-4cc9-80fa-c13192c6c43d-ap",
"error_msg": "", // 无用,可以忽略
"error_code": 0 // 无用,可以忽略
},
"bizcode": 0,
"retcode": 0, // 只有bizcode和retcode都为0是代表请求成功
"traceid": "4aabb647-a8d8-400e-9904-b19d7e486667",
"seq": 0
},
"header": {
"flag": 0,
"version": "1.0.0"
}
}
预发布 curl 示例
curl -H 'content-type: application/json' -d '{
"header": {
"version": "1.0.0",
"flag": 0
},
"body": {
"seq": 0,
"cmd": "LoginWithAppid",
"token": "",
"client": {
"clientIP": "192.168.1.1",
"adtag": "$adtag"
},
"payload": {
"appid": "$appid",
"app_secret": "$app_secret"
}
}
}' 'https://preview.baike.qq.com/api/access/pb/cmd/LoginWithAppid'
生产 curl 示例
curl -H 'content-type: application/json' -d '{
"header": {
"version": "1.0.0",
"flag": 0
},
"body": {
"seq": 0,
"cmd": "LoginWithAppid",
"token": "",
"client": {
"clientIP": "192.168.1.1",
"adtag": "$adtag"
},
"payload": {
"appid": "$appid",
"app_secret": "$app_secret"
}
}
}' 'https://h5.baike.qq.com/api/access/pb/cmd/LoginWithAppid'

日历接口

通过日历接口拿到相关数据:
url(预发布):https://preview.baike.qq.com/api/access/pb/cmd/GetHealthCalendarSummary
方式:POST
Content-Type:application/json

输入参数

参数名
参数说明
参数类型
备注
date
获取日期,默认为当天,格式为:年份-月份-日期
string
-

输出参数

参数名
参数说明
参数类型
备注
date
返回时的日历,格式为:年份-月份-日期
string
-
title
标题
string
-
content
正文
string
-
image
背景图片
string
-
h5url
医典 h5 的 url
string
需要在前面添加医典前端域名才能访问。
正式发布:https://h5.baike.qq.com
author
作者信息
obj
-
author.name
作者姓名
string
-
author.hospital
作者医院
string
例如:xx医院
author.title
作者头衔
string
例如:主任医师
author.avatar
作者头像
string
例如:https://baike-med-1256891581.file.myqcloud.com/2018097/2ab3b021-b25a-11e8-8bd7-951e7303c542_0.png
一个图片链接
author.hplevel
作者医院等级
string
例如:三甲

代码示例

输入参数示例
{
"header": {
"version": "1.0.0",
"flag": 0
},
"body": {
"seq": 0,
"cmd": "GetHealthCalendarSummary",
"token": "$token", // 接口调用凭证
"client": {
"clientIP": "192.168.1.1", // 如果是后台转发前端请求,这里填写用户的IP。如果是前端直连则可以填空字符串
"adtag": "$adtag"
},
"payload": {
"date":"2024-01-01" // 日期,为空默认为当天
}
}
}
说明:
不需要填写 appid,后台会根据请求的 token 自动匹配对应的日历版本。
输出参数示例
{
"body": {
"cmd": "GetHealthCalendarSummary",
"message": "success",
"payload": {
"title": "标题标题标题",
"content": "正文正文正文正文正文正文",
"date": "2024-04-16",
"h5url": // h5的跳转链接,可以跳转到医典h4的健康日历页面
"/mobile/health-calendar/detail.html?date=2024-04-16&adtag=&id=1",
"author": {
"title": "主任医师",
"name": "吴一龙",
"hplevel": "三甲",
"hospital": "xx医院",
"avatar": "https://baike-med-1256891581.file.myqcloud.com/2018097/2ab3b021-b25a-11e8-8bd7-951e7303c542_0.png"
},
"image": ""
},
"bizcode": 0,
// 注: 有问题提供返回的traceid,方便定位问题
"traceid": "3c6cb96b-50cf-4a4d-bce5-d1f3f0fad95a",
"retcode": 0, // 只有retcode和bizcode都为0时表示接口调用成功
"seq": 0
},
"header": {
"flag": 0,
"version": "1.0.0"
}
}
预发布示例
curl -H 'content-type: application/json' -d '{
"header": {
"version": "1.0.0",
"flag": 0
},
"body": {
"seq": 0,
"cmd": "GetHealthCalendarSummary",
"token": "$token",
"client": {
"clientIP": "192.168.1.1",
"adtag": "$adtag"
},
"payload": {
"date": "2021-06-01"
}
}
}' 'https://preview.baike.qq.com/api/access/pb/cmd/GetHealthCalendarSummary'
生产示例
curl -H 'content-type: application/json' -d '{
"header": {
"version": "1.0.0",
"flag": 0
},
"body": {
"seq": 0,
"cmd": "GetHealthCalendarSummary",
"token": "$token",
"client": {
"clientIP": "192.168.1.1",
"adtag": "$adtag"
},
"payload": {
"date": "2021-06-01"
}
}
}' 'https://h5.baike.qq.com/api/access/pb/cmd/GetHealthCalendarSummary'