feat: 后端架构重构 — Endpoint→Service→Repository分层 + AI确认机制 + 异步任务持久化
- 核心业务拆分为 Endpoint → Application Service → Repository 三层 - AI写入操作必须用户确认后才写库(确认卡片机制) - 报告/饮食/用药分析改为持久化任务队列(原子领取/重试/重启恢复) - 运动计划修复: 连续真实日期替代周模板 - 用药提醒去重 + 通知Outbox预留 - 认证收拢到AuthService, 管理员收拢到AdminService - AI会话加用户归属校验防串号 - 提示词调整为患者视角 - 开发假数据已关闭 - 21/21测试通过, 0警告0错误
This commit is contained in:
@@ -218,10 +218,16 @@ class _TrendPageState extends ConsumerState<TrendPage> {
|
||||
body['value'] = v1;
|
||||
}
|
||||
await api.post('/api/health-records', data: body);
|
||||
if (!ctx.mounted || !mounted) {
|
||||
return;
|
||||
}
|
||||
Navigator.pop(ctx);
|
||||
ref.invalidate(latestHealthProvider);
|
||||
_loadAll();
|
||||
} catch (_) {
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(const SnackBar(content: Text('录入失败')));
|
||||
@@ -454,8 +460,9 @@ class _TrendPageState extends ConsumerState<TrendPage> {
|
||||
: 1,
|
||||
getTitlesWidget: (v, meta) {
|
||||
final idx = v.toInt();
|
||||
if (idx < 0 || idx >= _filtered.length)
|
||||
if (idx < 0 || idx >= _filtered.length) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
final d = _filtered[idx]['date'] as DateTime;
|
||||
return Text(
|
||||
'${d.month}/${d.day}',
|
||||
@@ -482,7 +489,7 @@ class _TrendPageState extends ConsumerState<TrendPage> {
|
||||
barWidth: 2.5,
|
||||
dotData: FlDotData(
|
||||
show: spots.length <= 60,
|
||||
getDotPainter: (spot, _, __, ___) => FlDotCirclePainter(
|
||||
getDotPainter: (spot, _, _, _) => FlDotCirclePainter(
|
||||
radius: 3,
|
||||
color: _color,
|
||||
strokeWidth: 1,
|
||||
|
||||
Reference in New Issue
Block a user