53 lines
1.2 KiB
Python
53 lines
1.2 KiB
Python
|
|
from pydantic import BaseModel, ConfigDict
|
||
|
|
|
||
|
|
|
||
|
|
class CaseListItem(BaseModel):
|
||
|
|
"""病例列表项:不暴露标准答案和隐藏信息。"""
|
||
|
|
|
||
|
|
id: int
|
||
|
|
case_code: str
|
||
|
|
department_id: int
|
||
|
|
title: str
|
||
|
|
difficulty: str
|
||
|
|
chief_complaint: str | None = None
|
||
|
|
supported_training_type: str
|
||
|
|
supported_mode: str
|
||
|
|
has_teaching_video: bool
|
||
|
|
has_knowledge_points: bool
|
||
|
|
has_quiz: bool
|
||
|
|
|
||
|
|
model_config = ConfigDict(from_attributes=True)
|
||
|
|
|
||
|
|
|
||
|
|
class CaseListResponse(BaseModel):
|
||
|
|
"""病例列表响应:返回激活病例集合。"""
|
||
|
|
|
||
|
|
items: list[CaseListItem]
|
||
|
|
|
||
|
|
|
||
|
|
class CasePatientInfo(BaseModel):
|
||
|
|
"""患者展示信息:用于病例详情页。"""
|
||
|
|
|
||
|
|
name: str | None = None
|
||
|
|
age: int | None = None
|
||
|
|
gender: str | None = None
|
||
|
|
occupation: str | None = None
|
||
|
|
|
||
|
|
|
||
|
|
class CaseDetailResponse(BaseModel):
|
||
|
|
"""病例详情响应:展示训练入口需要的信息。"""
|
||
|
|
|
||
|
|
id: int
|
||
|
|
case_code: str
|
||
|
|
title: str
|
||
|
|
department: str
|
||
|
|
difficulty: str
|
||
|
|
patient: CasePatientInfo
|
||
|
|
chief_complaint: str | None = None
|
||
|
|
supported_training_type: str
|
||
|
|
supported_mode: str
|
||
|
|
has_teaching_video: bool
|
||
|
|
has_knowledge_points: bool
|
||
|
|
has_quiz: bool
|
||
|
|
order_item_types: list[str]
|