概述
给定一份中文门诊 复诊病历文本(医生已书写),本技能抽取并规范化为细粒度字段 JSON,例如:
数据安全、隐私与伦理声明
输入格式
纯文本病历(UTF-8),可包含如下分段:
主诉:……
现病史:……
既往史:……
婚育史:……
月经史:……
个人史:……
家族史:……
查体:……
辅助检查:……
诊断:……
处理:……
也支持通过统一入口 scripts/run.py 直接输入 pdf/doc/docx/xls/xlsx/csv/txt/json。
预处理成功后,会先归一化为标准复诊病历文本,再调用本 skill 的原始结构化逻辑。
快速开始
# 从 skills 目录运行
python3 scripts/run.py \
--input data/med-followup-record-struct/followup_record.txt
# 或继续直接使用原始文本入口
python3 scripts/struct_followup_record.py \
--input data/med-followup-record-struct/followup_record.txt
参数说明
--input PATH--output PATH../runs/med-followup-record-struct/structured.json)。--timeout SECONDS0 表示一直等待(默认:0)。--diag-id STRINGskill-diag)。--department STRING统一入口附加参数(scripts/run.py)
--input-type auto|pdf|doc|docx|xls|xlsx|csv|txt|jsonauto。--sheet STRING--encoding STRINGtxt/csv 编码(默认:utf-8)。--save-prepared输出约定
现病史.病情概述、现病史.药物、既往史.疾病、诊断、处理意见.药物 等。依赖
https://shangbao.yunzhisheng.cn/skills/record-struct/gen_abstract_by_hisshangbao.yunzhisheng.cn| 包名 | 用途 | 必要条件 |
|---|---|---|
| ------ | ------ | --------- |
openpyxl | 读取 .xlsx 文件 | 输入为 xlsx 时必须 |
pypdf | 提取 PDF 文本 | 输入为 pdf 时必须(或用 pdftotext 替代) |
安装:pip install openpyxl pypdf
| 工具 | 用途 | 必要条件 |
|---|---|---|
| ------ | ------ | --------- |
LibreOffice (soffice) | 转换 .doc / .xls 为文本 | 输入为 doc/xls 时必须 |
pdftotext(poppler-utils) | 提取 PDF 文本 | 输入为 pdf 且未安装 pypdf 时必须 |
tesseract(含 chi_sim+eng 语言包) | 图片 OCR | 输入为 png/jpg/bmp/tif 等图片时必须 |
安装(Ubuntu/Debian):sudo apt-get install libreoffice poppler-utils tesseract-ocr tesseract-ocr-chi-sim
> 仅使用 TXT/JSON 输入时,无需安装任何第三方包或外部工具。
测试命令
从 skills 目录执行(网络自测):
python3 self_tests/med-followup-record-struct/self_test_followup_record_struct.py --run-network
共 1 个版本