初始化医疗报告生成项目,添加核心代码文件
This commit is contained in:
23
backend/_check_report.py
Normal file
23
backend/_check_report.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from docx import Document
|
||||
|
||||
report_path = r'C:\Users\UI\Desktop\医疗报告\backend\reports\filled_report_20260212_154247.docx'
|
||||
doc = Document(report_path)
|
||||
body = doc.element.body
|
||||
children = list(body)
|
||||
|
||||
keywords = ['overall health', '整体健康', 'medical intervention', '医学干预',
|
||||
'functional medical health', '功能医学健康建议',
|
||||
'nutrition intervention', '营养干预', 'exercise intervention', '运动干预',
|
||||
'sleep', '睡眠', 'lifestyle', '生活方式', 'long-term', '长期随访',
|
||||
'功能医学检测档案', 'abnormal index', '异常指标']
|
||||
|
||||
print(f"文档总元素数: {len(children)}")
|
||||
print("=" * 80)
|
||||
|
||||
for i, elem in enumerate(children):
|
||||
text = ''.join(elem.itertext()).strip()
|
||||
if text:
|
||||
text_lower = text.lower()
|
||||
if any(kw in text_lower for kw in keywords):
|
||||
tag = elem.tag.split("}")[-1]
|
||||
print(f'[{i}] {tag}: {text[:150]}')
|
||||
Reference in New Issue
Block a user