add training configuration APIs
This commit is contained in:
@@ -123,6 +123,73 @@ async def generate_hints(
|
||||
return ok(result)
|
||||
|
||||
|
||||
@router.post("/{session_id}/hints/stream", response_class=StreamingResponse)
|
||||
async def stream_hints(
|
||||
session_id: int,
|
||||
payload: HintRequest,
|
||||
ctx: UserContext = Depends(get_user_context),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""流式练习提示:返回一句话形式的 SSE 提示。"""
|
||||
response = await SessionService(db).stream_hints(ctx, session_id, payload)
|
||||
db.commit()
|
||||
return StreamingResponse(
|
||||
response,
|
||||
media_type="text/event-stream",
|
||||
headers={
|
||||
"Cache-Control": "no-cache",
|
||||
"Connection": "keep-alive",
|
||||
"X-Accel-Buffering": "no",
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@router.get("/{session_id}/physical-exams", response_model=ApiResponse[OrderItemsResponse])
|
||||
def list_physical_exam_items(
|
||||
session_id: int,
|
||||
ctx: UserContext = Depends(get_user_context),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""体格检查列表:返回当前病例可申请的体格检查项目。"""
|
||||
return ok(OrderService(db).list_physical_exam_items(session_id, ctx.user_id))
|
||||
|
||||
|
||||
@router.get("/{session_id}/auxiliary-exams", response_model=ApiResponse[OrderItemsResponse])
|
||||
def list_auxiliary_exam_items(
|
||||
session_id: int,
|
||||
ctx: UserContext = Depends(get_user_context),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""辅助检查列表:返回当前病例可申请的辅助检查项目。"""
|
||||
return ok(OrderService(db).list_auxiliary_exam_items(session_id, ctx.user_id))
|
||||
|
||||
|
||||
@router.post("/{session_id}/physical-exams/{item_code}", response_model=ApiResponse[CreateOrderResponse])
|
||||
def create_physical_exam_order(
|
||||
session_id: int,
|
||||
item_code: str,
|
||||
ctx: UserContext = Depends(get_user_context),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""体格检查结果:按项目编码返回数据库固定结果。"""
|
||||
result = OrderService(db).create_physical_exam_order(session_id, ctx.user_id, item_code)
|
||||
db.commit()
|
||||
return ok(result)
|
||||
|
||||
|
||||
@router.post("/{session_id}/auxiliary-exams/{item_code}", response_model=ApiResponse[CreateOrderResponse])
|
||||
def create_auxiliary_exam_order(
|
||||
session_id: int,
|
||||
item_code: str,
|
||||
ctx: UserContext = Depends(get_user_context),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""辅助检查结果:按项目编码返回数据库固定结果。"""
|
||||
result = OrderService(db).create_auxiliary_exam_order(session_id, ctx.user_id, item_code)
|
||||
db.commit()
|
||||
return ok(result)
|
||||
|
||||
|
||||
@router.post("/{session_id}/diagnosis", response_model=ApiResponse[SubmitDiagnosisResponse])
|
||||
def submit_diagnosis(
|
||||
session_id: int,
|
||||
|
||||
Reference in New Issue
Block a user