72 lines
2.2 KiB
Python
72 lines
2.2 KiB
Python
import requests
|
|
import json
|
|
|
|
# API配置
|
|
BASE_URL = "http://192.168.110.252:18080/openhis"
|
|
ENCOUNTER_ID = "2038823905749327873"
|
|
|
|
print("=" * 80)
|
|
print("API 返回数据检查")
|
|
print("=" * 80)
|
|
print()
|
|
|
|
# 检查 doctor-station API
|
|
print("1. 检查 doctor-station API:")
|
|
print(
|
|
f" URL: {BASE_URL}/doctor-station/advice/request-base-info?encounterId={ENCOUNTER_ID}"
|
|
)
|
|
print()
|
|
|
|
try:
|
|
response = requests.get(
|
|
f"{BASE_URL}/doctor-station/advice/request-base-info",
|
|
params={"encounterId": ENCOUNTER_ID},
|
|
timeout=10,
|
|
)
|
|
print(f" 状态码: {response.status_code}")
|
|
|
|
if response.status_code == 200:
|
|
data = response.json()
|
|
if data.get("code") == 200:
|
|
records = data.get("data", [])
|
|
print(f" 返回记录数: {len(records)}")
|
|
print()
|
|
|
|
# 查找手术医嘱 (adviceType=4)
|
|
surgery_records = [
|
|
r
|
|
for r in records
|
|
if r.get("adviceType") == 4 or r.get("categoryEnum") == 4
|
|
]
|
|
print(f" 手术医嘱数量: {len(surgery_records)}")
|
|
print()
|
|
|
|
for record in surgery_records:
|
|
print(f" 手术医嘱详情:")
|
|
print(f" - requestId: {record.get('requestId')}")
|
|
print(f" - adviceType: {record.get('adviceType')}")
|
|
print(f" - adviceName: {record.get('adviceName')}")
|
|
print(f" - categoryEnum: {record.get('categoryEnum')}")
|
|
print(
|
|
f" - contentJson: {record.get('contentJson', '')[:100] if record.get('contentJson') else 'None'}..."
|
|
)
|
|
print()
|
|
else:
|
|
print(f" 返回错误: {data.get('msg')}")
|
|
else:
|
|
print(f" 请求失败: {response.status_code}")
|
|
except Exception as e:
|
|
print(f" 请求异常: {e}")
|
|
|
|
print()
|
|
print("=" * 80)
|
|
print("诊断建议:")
|
|
print("=" * 80)
|
|
print()
|
|
print("如果手术医嘱未显示,可能原因:")
|
|
print(" 1. adviceType 仍为 3 (不是 4)")
|
|
print(" 2. adviceName 为空")
|
|
print(" 3. 前端过滤逻辑排除了该记录")
|
|
print(" 4. API返回了数据但前端未正确渲染")
|
|
print()
|