全局中文化

This commit is contained in:
Cheng Zhou
2026-01-12 11:14:04 +08:00
parent 9021c7fe2b
commit 1338fa7e2b
103 changed files with 2443 additions and 1533 deletions
+8 -8
View File
@@ -15,7 +15,7 @@ router = APIRouter()
async def _ensure_study_exists(db: AsyncSession, study_id: uuid.UUID):
study = await study_crud.get(db, study_id)
if not study:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Study not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="项目不存在")
return study
@@ -34,7 +34,7 @@ async def create_history(
) -> SubjectHistoryRead:
await _ensure_study_exists(db, study_id)
if history_in.subject_id != subject_id:
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="Subject mismatch")
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="受试者不匹配")
history = await history_crud.create_history(db, study_id, history_in, created_by=current_user.id)
await audit_crud.log_action(
db,
@@ -42,7 +42,7 @@ async def create_history(
entity_type="subject_history",
entity_id=history.id,
action="CREATE_SUBJECT_HISTORY",
detail="Subject history created",
detail="病史记录已创建",
operator_id=current_user.id,
operator_role=current_user.role,
)
@@ -80,7 +80,7 @@ async def get_history(
await _ensure_study_exists(db, study_id)
history = await history_crud.get_history(db, history_id)
if not history or history.study_id != study_id or history.subject_id != subject_id:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="History not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="病史记录不存在")
return SubjectHistoryRead.model_validate(history)
@@ -100,7 +100,7 @@ async def update_history(
await _ensure_study_exists(db, study_id)
history = await history_crud.get_history(db, history_id)
if not history or history.study_id != study_id or history.subject_id != subject_id:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="History not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="病史记录不存在")
history = await history_crud.update_history(db, history, history_in)
await audit_crud.log_action(
db,
@@ -108,7 +108,7 @@ async def update_history(
entity_type="subject_history",
entity_id=history_id,
action="UPDATE_SUBJECT_HISTORY",
detail="Subject history updated",
detail="病史记录已更新",
operator_id=current_user.id,
operator_role=current_user.role,
)
@@ -130,7 +130,7 @@ async def delete_history(
await _ensure_study_exists(db, study_id)
history = await history_crud.get_history(db, history_id)
if not history or history.study_id != study_id or history.subject_id != subject_id:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="History not found")
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="病史记录不存在")
await history_crud.delete_history(db, history)
await audit_crud.log_action(
db,
@@ -138,7 +138,7 @@ async def delete_history(
entity_type="subject_history",
entity_id=history_id,
action="DELETE_SUBJECT_HISTORY",
detail="Subject history deleted",
detail="病史记录已删除",
operator_id=current_user.id,
operator_role=current_user.role,
)