prepare fastapi root layout for server deployment
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
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]
|
||||
|
||||
|
||||
class CaseDeletePreviewResponse(BaseModel):
|
||||
"""病例删除预览:返回删除该病例会影响的业务数据数量。"""
|
||||
|
||||
case_id: int
|
||||
case_title: str
|
||||
can_delete: bool
|
||||
affected: dict[str, int]
|
||||
|
||||
|
||||
class CaseDeleteRequest(BaseModel):
|
||||
"""病例删除请求:前端必须显式确认,并默认同时删除该病例训练数据。"""
|
||||
|
||||
confirm: bool = False
|
||||
delete_training_data: bool = True
|
||||
|
||||
|
||||
class CaseDeleteResponse(BaseModel):
|
||||
"""病例删除结果:返回已删除的各表记录数量。"""
|
||||
|
||||
deleted: bool
|
||||
case_id: int
|
||||
deleted_counts: dict[str, int]
|
||||
Reference in New Issue
Block a user