Save user-provided medical test reports to the personal medical data center.
Core Process
用户输入图片 -> 读取并分析图片 -> 提取数据 -> 生成JSON -> 保存图片和数据 -> 更新索引 -> 确认输出
Step 1: Check Parameters
- image_path (required): local path of the examination report image
- exam_date (optional): examination date, format YYYY-MM-DD
Step 2: Date Determination Rules (Important)
Priority order:
- exam_date provided by the user(highest priority)
- Sampling time in the image
- Sample submission time in the image
- Testing time/report time in the image
- Other date identifiers in the image
- Current date (only as a fallback)
Step 3: Read and Analyze the Image
Image Analysis Prompt Templates
Biochemical Test Prompt:
请详细识别这张医疗检验报告单中的所有信息,包括:
1. 日期时间信息(采样/送检/检测/报告时间)
2. 医院/检验机构名称
3. 检验项目和结果(项目名、数值、单位、参考范围、异常标识)
Imaging Test Prompt: Use the corresponding prompt template according to the examination type:
- B-ultrasound/Color Doppler Ultrasound
- X-ray Examination
- CT Examination
- MRI Examination
- Endoscopy Examination
- Pathology Examination
- Electrocardiogram Examination
- Mammography Examination
- PET-CT Examination
Step 4: Generate the Data File
File Path Format
- Biochemical tests:
data/biochemical-tests/YYYY-MM/YYYY-MM-DD_test-type.json - Imaging studies:
data/imaging-studies/YYYY-MM/YYYY-MM-DD_exam-type_body-part.json
Data Structure Definition
For the complete data structure definition, please refer to schema.json file. This file uses the JSON Schema format to define two report types:
Biochemical Test (BiochemicalTestReport)
id: unique identifiertype: fixed value "Biochemical Test"date: examination date (YYYY-MM-DD)hospital: name of the hospital/testing institutionoriginal_image: original image pathitems: array of test itemsname: item namevalue: test valueunit: unitmin_ref: minimum value of the reference rangemax_ref: maximum value of the reference rangeis_abnormal: whether abnormal
Imaging Test (ImagingTestReport)
id: unique identifiertype: fixed value "Imaging Test"subtype: examination type (B-ultrasound/CT/MRI/X-ray/Endoscopy/Pathology/Electrocardiogram/Mammography/PET-CT)date: examination date (YYYY-MM-DD)hospital: name of the hospital/testing institutionbody_part: examination sitefindings: examination resultsdescription: description of examination findingstargets: array of target lesions (optional)name: lesion namelocation: locationsize: size (length/width/height/unit)characteristics: characteristics (shape/margin/density)
conclusion: examination conclusion
original_image: original image path
Step 5: Save the Data
- Create the month directory (if it does not exist)
- Create the images subdirectory (if it does not exist)
- Copy the original image to the corresponding directory
- Save the JSON data file
- Update the global index
data/index.json
Step 6: Update the Index
In data/index.json add the index information of the new record.
Execution Instructions
1. 验证图片路径
2. 读取 schema.json 确认数据结构定义
3. 使用 mcp__4_5v_mcp__analyze_image 分析图片
4. 提取数据(优先使用用户提供的日期)
5. 根据 schema.json 生成符合规范的JSON数据文件
6. 复制图片到images目录
7. 保存JSON文件
8. 更新index.json
9. 显示确认信息
Schema Validation
The generated JSON data must conform to the structure defined in schema.json . The Schema uses the oneOf keyword to distinguish the two report types:
- Biochemical Test Report (
type: "生化检查") - Imaging Examination Report (
type: "影像检查")
Example Interaction
Automatically extract date
用户: @医疗报告/血液检查.jpg
输出:
✅ 检查单保存成功!
类型:生化检查(血液常规)
日期:2025-10-07(从图片提取)
提取到 15 项检查指标
文件路径:data/生化检查/2025-10/2025-10-07_血液常规.json
Manually specify date
用户: @医疗报告/血液检查.jpg 2025-10-07
输出:
✅ 检查单保存成功!
类型:生化检查(血液常规)
日期:2025-10-07(使用用户指定日期)