Install
openclaw skills install medical-record-structuringEN: Convert unstructured Chinese clinical narratives (admission notes, progress notes, discharge summaries, outpatient records) into structured JSON aligned with HL7 FHIR R4 and Chinese national EMR standards (WS 445-2014, ICD-10, ICD-9-CM-3). Use when the user provides medical text and asks to "结构化 / 抽取 / 解析病历 / 转 FHIR / extract diagnoses / parse EMR". 中文:将非结构化中文临床文本(入院记录、病程记录、出院小结、门诊病历)转换为符合 HL7 FHIR R4 与国家电子病历共享文档规范(WS 445-2014、ICD-10、ICD-9-CM-3)的结构化 JSON。当用户提供病历文本并要求"结构化/抽取实体/解析病历/转FHIR"时触发。
openclaw skills install medical-record-structuringProduction-grade extraction of clinical entities from Chinese free-text medical records into FHIR R4 + WS 445-2014 compliant JSON.
将中文自由文本病历精准抽取为符合 FHIR R4 与国标 WS 445-2014 的结构化 JSON。
Trigger keywords (中文): 结构化病历、病历抽取、电子病历解析、入院记录抽取、出院小结结构化、ICD 编码、症状抽取、用药抽取、FHIR 转换、临床实体识别、病历归一化
Trigger keywords (EN): structure EMR, parse clinical notes, extract diagnosis, FHIR conversion, ICD coding, clinical NER, normalize medical record
Typical inputs:
Do NOT use when:
smart-ocr skill first)The skill extracts 8 core entity groups per record:
| 字段组 / Group | 字段示例 / Fields | FHIR Resource | 国标依据 |
|---|---|---|---|
| 患者基本信息 Patient | 姓名、性别、年龄、住院号 | Patient | WS 445.1 |
| 主诉与现病史 Chief Complaint & HPI | 主诉、起病时间、伴随症状 | Condition + Observation | WS 445.4 |
| 既往史 Past History | 慢性病、手术史、过敏史 | AllergyIntolerance, Condition | WS 445.5 |
| 生命体征 Vitals | T/P/R/BP/SpO2 | Observation (vital-signs) | LOINC |
| 诊断 Diagnosis | 主要诊断、次要诊断 + ICD-10 | Condition | ICD-10 (GB/T 14396) |
| 药物医嘱 Medication | 药品名、剂量、频次、用法 | MedicationRequest | RxNorm + NMPA |
| 手术操作 Procedure | 术式 + ICD-9-CM-3 | Procedure | ICD-9-CM-3 |
| 化验结果 Lab Results | 检验项、结果值、参考范围、异常标志 | Observation (laboratory) | LOINC |
python3 scripts/validate_input.py --input <path-or-stdin>
--mask-pii flag)Use scripts/segment_sections.py to split the record into standard sections:
Two-stage hybrid extraction:
scripts/rule_extract.py)templates/extraction_prompt.mdknowledge/icd10_zh.csv (10,000+ Chinese terms)knowledge/drug_aliases.csvknowledge/lab_loinc.csvpython3 scripts/assemble_fhir.py --extracted entities.json --output bundle.json
Output: a FHIR R4 Bundle (type: collection) containing all derived resources, plus a sidecar provenance.json recording extraction source spans for auditability.
python3 scripts/validate_fhir.py bundle.json
Checks:
Default output is a JSON object with three top-level keys:
{
"fhir_bundle": { /* FHIR R4 Bundle */ },
"ws445_summary": { /* 国标关键字段速览 */ },
"extraction_report": {
"record_type": "discharge_summary",
"sections_found": ["主诉","现病史","既往史","体格检查","辅助检查","诊断","诊疗经过"],
"entities_count": { "diagnosis": 3, "medication": 7, "lab": 12, "procedure": 1 },
"low_confidence_spans": [ /* fields needing human review */ ],
"warnings": [ /* e.g. inconsistent dates */ ]
}
}
For human-readable preview, append --format=markdown to get a side-by-side table.
This skill is data extraction only, not a clinical decision tool. The following constraints are enforced:
王*三, ***1234). Full values stay only in the JSON output the caller controls.source.span pointer back to the original text offset for traceability.low_confidence_spans for human review rather than silently accepted.本技能仅做数据结构化,不提供任何临床诊断或治疗建议。患者隐私字段默认在预览中脱敏;所有抽取均可溯源;置信度低字段强制人工复核;技能本身不产生任何外部网络请求。
User: "帮我把这段入院记录结构化:患者王某某,男,58岁,因'反复胸痛3月,加重1周'入院。既往有高血压病史10年,最高180/100mmHg,规律服用氨氯地平5mg qd..."
Agent:
echo "$RECORD_TEXT" | python3 scripts/run_pipeline.py --record-type admission --output /tmp/extracted.json
python3 scripts/render_preview.py /tmp/extracted.json
Returns a structured table preview + the full JSON path.
python3 scripts/batch_process.py \
--input-dir ./discharge_notes/ \
--output-dir ./structured/ \
--record-type discharge \
--workers 4
python3 scripts/run_pipeline.py \
--input record.txt \
--record-type outpatient \
--fhir-only \
--output bundle.fhir.json
See examples/ for full input → output samples on real (anonymized) records.
Run the test suite to verify the installation:
cd tests && python3 -m unittest discover -v
Tests cover:
medical healthcare EMR FHIR ICD-10 clinical-NER 中文 病历 结构化