feat: cms overview and mobile case query

This commit is contained in:
2026-06-13 01:44:31 +08:00
parent 8fecaeeb54
commit 05ce7e987e
12 changed files with 1787 additions and 1 deletions
+23
View File
@@ -85,6 +85,29 @@ class TrainingRecord(BaseModel):
return f"{self.user.username} - {self.case.title}"
class TrainingSession(BaseModel):
"""训练会话表(只读,fastapi 属主,managed=False)。
用于**平台级**「发起/完成」统计:`COUNT(*)`=累计发起(含未完成),`completed_at` 非空=已完成。
⚠️ 只有 `external_user_id`(varchar)、**无 `user.id`、无机构外键** → 不能按机构/科室聚合;
需按机构聚合的训练统计一律改用 `TrainingRecord`(有 `user_id`)。
"""
id = models.BigAutoField(primary_key=True)
case_id = models.BigIntegerField('病例ID', null=True, blank=True)
case_type = models.CharField('病例类型', max_length=30, blank=True)
training_mode = models.CharField('训练模式', max_length=50, blank=True)
status = models.CharField('状态', max_length=30, blank=True)
external_user_id = models.CharField('宿主系统用户ID', max_length=128, blank=True)
started_at = models.DateTimeField('开始时间', null=True, blank=True)
completed_at = models.DateTimeField('完成时间', null=True, blank=True)
class Meta:
managed = False
db_table = 'training_session'
verbose_name = '训练会话'
verbose_name_plural = '训练会话'
class TrainingScoreDetail(BaseModel):
"""评分明细表(只读,managed=Falsefastapi 属主)。