Record personal surgery history, extracting structured surgical information from natural language descriptions.
Core Process
用户输入 -> 解析手术信息 -> 询问植入物 -> 确认信息 -> 生成JSON -> 保存数据
Step 1: Parse User Input
Required Field Extraction
| Field | Extraction Rule |
|---|---|
| Surgery full name | Medical terminology, e.g., "Laparoscopic cholecystectomy" |
| Surgery alias | Common description, e.g., "Gallbladder minimally invasive surgery" |
| Surgery reason | Preoperative diagnosis, e.g., "Chronic calculous cholecystitis" |
| Surgery date | YYYY-MM-DD format |
| Surgery site | Body part, e.g., "abdomen" |
Optional Field Extraction
| Field | Description |
|---|---|
| Surgery type | elective/emergency/day_surgery |
| Anesthesia type | General anesthesia/local anesthesia/spinal anesthesia, etc. |
| Surgery duration | Minutes |
| Intraoperative blood loss | Milliliters |
| Lead surgeon | Doctor's name |
| Surgery hospital | Hospital name |
| Hospitalization days | Days |
Surgery Type Classification
| Type | Description |
|---|---|
| elective | Surgery that can be scheduled in advance, non-emergency |
| emergency | Emergency surgery that needs to be performed immediately |
| day_surgery | Surgery with same-day admission and same-day discharge |
| diagnostic | Surgery mainly used to confirm a diagnosis |
| therapeutic | Surgery mainly used for treatment |
| palliative | Surgery that relieves symptoms but cannot cure |
| reconstructive | Surgery to reconstruct or repair function |
Step 2: Ask for Implant Information
Must ask the user:
📋 植入物信息确认
本次手术中是否有植入以下任何医疗材料?
- 人工关节/植入物
- 支架/导管
- 金属内固定物(钢板、螺钉、钢针等)
- 人工瓣膜/起搏器
- 疝修补片/补片
- 其他植入物
A. 有植入物
B. 无植入物
If "has implant" is selected, ask for detailed information:
- Implant name
- Implant model/specification
- Implantation site
- Implant quantity
- Expected removal time
Step 3: Generate JSON
Surgery Data Structure
{
"id": "surgery_20240815_001",
"basic_info": {
"surgery_name": "腹腔镜下胆囊切除术",
"surgery_alias": "胆囊微创手术",
"surgery_date": "2024-08-15",
"preoperative_diagnosis": "慢性结石性胆囊炎",
"body_part": "腹部",
"surgery_type": "elective",
"anesthesia_type": "全身麻醉",
"duration_minutes": 90,
"blood_loss_ml": 50,
"surgeon": "张医生",
"hospital": "某某医院",
"hospitalization_days": 3
},
"implants": {
"has_implants": false,
"implants_list": []
},
"postoperative_info": {
"complications": null,
"recovery_status": "良好",
"follow_up_plan": null
},
"notes": "",
"created_at": "2024-08-15",
"original_input": "用户原始输入描述"
}
Implant Data Structure
{
"has_implants": true,
"implants_list": [
{
"implant_name": "钛合金钢板",
"model": "××品牌×型号",
"location": "右胫骨中段",
"quantity": 1,
"removal_plan": "12个月后取出",
"implant_date": "2024-08-15"
}
]
}
For the complete Schema definition, see schema.json。
Step 4: Save Data
- Generate unique ID:
surgery_YYYYMMDD_XXX - Save to
data/手术记录/YYYY-MM/YYYY-MM-DD_手术名称.json - Update
data/index.json
Step 5: Output Confirmation
✅ 手术记录已保存
基本信息:
━━━━━━━━━━━━━━━━━━━━━━━━━━
手术名称: 腹腔镜下胆囊切除术(胆囊微创手术)
手术日期: 2024-08-15
术前诊断: 慢性结石性胆囊炎
手术部位: 腹部
手术类型: 择期手术
麻醉方式: 全身麻醉
手术时长: 90分钟
术中出血: 50ml
植入物信息:
━━━━━━━━━━━━━━━━━━━━━━━━━━
无植入物
数据已保存至:
data/手术记录/2024-08/2024-08-15_腹腔镜下胆囊切除术.json
Common Surgery Examples
Example 1: Gallbladder Surgery
用户: 去年8月15日做了腹腔镜下胆囊切除术,因为慢性结石性胆囊炎
AI: [解析信息并确认植入物...]
Example 2: Fracture Surgery
用户: 2024年3月10日右腿胫骨骨折内固定术,车祸
AI: [解析信息并询问植入物...]
检测到骨折内固定术,需要确认植入物信息...
Example 3: Coronary Stent
用户: 2023年12月做了冠状动脉支架植入术,心绞痛
AI: [解析信息并确认支架信息...]
检测到支架植入,需要确认支架详情...
Execution Instructions
1. 解析自然语言描述,提取手术信息
2. 识别手术名称、原因、日期、部位
3. 询问并确认植入物信息 (重要!)
4. 补充可选信息 (如缺失)
5. 生成符合 schema.json 的 JSON
6. 保存到相应文件路径
7. 更新全局索引
8. 向用户确认保存成功,并显示摘要
Important Notes
- Implant information is particularly important and must be confirmed
- Date formats are uniformly converted to YYYY-MM-DD
- Record surgery information as completely as possible
- Keep data structured for subsequent querying and analysis
- All data is stored locally only
Surgery Record Query
Surgery records can be queried in the following ways:
- Query by time range
- Query by surgical site
- Query by surgery name