常见疾病查询:取得疾病明细并解析症状/诊断/治疗/预防(546-3 的 tagList)
# 常见疾病查询:取得疾病明细并解析症状/诊断/治疗/预防(546-3 的 tagList)
> 接口:常见疾病查询(apiCode=546)· 免费 · 接入点 546-3 · 返回格式 JSON · 适用人群:开发者、医疗内容团队 · 阅读时间:约 6 分钟
## 核心要点
- 546-3「取得疾病明细」**必填 `id`**,该 `id` 来自 546-2 关键字查询的返回,不能自造。
- 明细的核心在 `tagList[]`:每项 `{ name, content }`,承载**症状 / 诊断 / 治疗 / 预防**等结构化标签(也可能含其他 name)。
- 明细还含 `alias`(别名)、`summary`(描述)、`typeName`/`subTypeName`(所属科室),可直接用于病种展示卡。
## Why:列表给不了"这个病怎么回事"
546-2 的列表只有名称、一句话 `summary` 和推荐科室——够做搜索结果,但用户点进去要看"有什么症状、怎么治"。这些信息全在 546-3 的 `tagList` 里。把 `tagList` 解析成「症状-诊断-治疗-预防」几张卡片,就是一张标准的病种详情页。
## What:接口速览
| 项 | 说明 |
|----|------|
| 接入点 | 546-3 取得疾病明细 |
| 必填参数 | `id`(疾病 id,来自 546-2) |
| 返回 | `showapi_res_body.item[]`:{id, name, summary, alias, typeName, typeId, subTypeId, subTypeName, tagList[{name, content}]} |
| 计费 | 免费 |
## How:取明细并解析 tagList
### Python
```python
def get_disease_detail(disease_id):
detail = call("546-3", id=disease_id)
it = (detail.get("item") or [{}])[0]
if not it:
return None
tags = {t["name"]: t["content"] for t in it.get("tagList", [])}
return {
"name": it.get("name"),
"alias": it.get("alias", ""),
"dept": f"{it.get('typeName')}/{it.get('subTypeName')}",
"summary": it.get("summary", ""),
"tags": tags, # {"症状": "...", "诊断": "...", "治疗": "...", "预防": "..."}
}
d = get_disease_detail("DISEASE_ID_XXX")
if d:
print(d["name"], d["alias"], "| 科室:", d["dept"])
for k in ("症状", "诊断", "治疗", "预防"):
if k in d["tags"]:
print(f"【{k}】{d['tags'][k]}")
```
### cURL
```bash
curl -X POST "https://route.showapi.com/546-3?appKey=YOUR_APPKEY" \
-H "content-type: application/x-www-form-urlencoded" \
--data-urlencode "id=<疾病id>"
```
### Node.js(fetch)
```javascript
const detail = await call("546-3", { id: diseaseId });
const it = (detail.item || [])[0];
const tags = Object.fromEntries((it?.tagList || []).map(t => [t.name, t.content]));
console.log(it?.name, it?.alias, "| 症状:", tags["症状"]);
```
## 返回示例与解析
```json
{
"showapi_res_body": {
"ret_code": 0,
"item": [
{
"id": "DISEASE_ID_XXX",
"name": "高血压",
"summary": "以体循环动脉血压增高为主要临床表现...",
"alias": "高血压病",
"typeName": "内科",
"typeId": "3",
"subTypeId": "0304",
"subTypeName": "心血管内科",
"tagList": [
{ "name": "症状", "content": "头晕、头痛、颈项板紧、疲劳、心悸..." },
{ "name": "诊断", "content": "基于诊室/动态/家庭血压测量..." },
{ "name": "治疗", "content": "生活方式干预联合降压药物治疗..." },
{ "name": "预防", "content": "减盐、控制体重、规律运动、戒烟限酒..." }
]
}
]
}
}
```
`tagList` 解析要点:
- 用 `name` 作为分组键(症状/诊断/治疗/预防等),`content` 为对应文本。
- `name` 的取值以接口实时返回为准,不要写死只认这四个,建议用字典收集后按需展示。
## 进阶 / 边界
- **`id` 必须来自 546-2**:自造 id 查不到;典型链路见[三步入诊](https://www.showapi.com/guides/disease-query-pipeline-546)。
- **`tagList` 只在明细**:546-2 列表无 `tagList`,别在列表页找症状。
- **明细可按 id 缓存**:疾病知识相对稳定,按 `id` 做缓存能显著减少重复调用(见[缓存策略](https://www.showapi.com/guides/disease-query-cache-546))。
- **非诊疗免责**:展示时必须标注"内容仅供参考,不能替代医生诊断"。
## FAQ
**Q1:tagList 的 name 一定是"症状/诊断/治疗/预防"吗?**
A:文档示例中为这四类,但实际 `name` 以接口返回为准,代码应通用地用字典收集,不要写死四类。
**Q2:没有 tagList 怎么办?**
A:个别疾病可能无标签或标签较少,展示时做"有则显示"的容错,缺失项留空。
**Q3:id 从哪里来?**
A:来自 546-2 关键字查询返回的 `contentlist[].id`。
**Q4:alias 有什么用?**
A:疾病别名(如"高血压病"),可用于搜索别名匹配或展示,提升用户识别度。
## 相关能力 / 下一步阅读
- [常见疾病查询返回字段全解:科目树、疾病列表与明细结构一文读懂](https://www.showapi.com/guides/disease-query-response-fields-546)
- [常见疾病查询:科目树 → 关键字 → 明细 三步入诊全链路设计](https://www.showapi.com/guides/disease-query-pipeline-546)
- [健康类 App / 医疗知识库:用常见疾病查询搭建结构化病种库](https://www.showapi.com/guides/disease-query-health-kb-546)
- **本系列共 12 篇**:查看[常见疾病查询指南总目录](https://www.showapi.com/guides/disease-query-guides-546)