- AI 提示词拆分为 markdown 模块(Prompts/global + modules + rag + router) - 新增 AI 同意门控(用户需同意后才能使用 AI 功能) - 新增 AI 录入草稿存储(AiEntryDraftContracts/EfAiEntryDraftStore/AiEntryDraftRecord) - 新增 AI 意图路由(ai_intent_router) - 新增医疗引用知识库(MedicalCitationKnowledge) - 重构 prompt_manager 和 ai_chat_endpoints - 优化聊天/趋势/档案/抽屉/医生端等多个页面 UI - 新增 agent 插画和趋势指标图标资源 - 删除 HANDOFF-2026-07-17.md
269 lines
8.7 KiB
Dart
269 lines
8.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import '../core/app_colors.dart';
|
|
import '../core/app_module_visuals.dart';
|
|
import '../core/navigation_provider.dart';
|
|
import '../providers/auth_provider.dart';
|
|
import '../pages/doctor/doctor_home_page.dart' show doctorPageProvider;
|
|
import 'drawer_shell.dart';
|
|
|
|
class DoctorDrawer extends ConsumerWidget {
|
|
const DoctorDrawer({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final auth = ref.watch(authProvider);
|
|
final currentPage = ref.watch(doctorPageProvider);
|
|
final name = auth.user?.name ?? '医生';
|
|
final pages = ref.read(doctorPageProvider.notifier);
|
|
final routes = ref.read(routeStackProvider.notifier);
|
|
final authNotifier = ref.read(authProvider.notifier);
|
|
|
|
return DrawerShell(
|
|
child: SafeArea(
|
|
child: CustomScrollView(
|
|
slivers: [
|
|
SliverFillRemaining(
|
|
hasScrollBody: false,
|
|
child: Column(
|
|
children: [
|
|
_DrawerHeader(
|
|
name: name,
|
|
subtitle: '点击完善医生信息',
|
|
icon: Icons.medical_services_outlined,
|
|
onTap: () => runAfterDrawerClose(
|
|
context,
|
|
() => routes.push('doctorProfile'),
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
_DrawerItem(
|
|
icon: Icons.dashboard_outlined,
|
|
label: '工作台',
|
|
selected: currentPage == 'dashboard',
|
|
onTap: () => runAfterDrawerClose(
|
|
context,
|
|
() => pages.set('dashboard'),
|
|
),
|
|
),
|
|
_DrawerItem(
|
|
icon: Icons.people_outline,
|
|
label: '患者管理',
|
|
selected: currentPage == 'patients',
|
|
onTap: () => runAfterDrawerClose(
|
|
context,
|
|
() => pages.set('patients'),
|
|
),
|
|
),
|
|
_DrawerItem(
|
|
icon: Icons.chat_outlined,
|
|
label: '问诊列表',
|
|
selected: currentPage == 'consultations',
|
|
onTap: () => runAfterDrawerClose(
|
|
context,
|
|
() => pages.set('consultations'),
|
|
),
|
|
),
|
|
_DrawerItem(
|
|
icon: AppModuleVisuals.report.icon,
|
|
label: '报告审核',
|
|
selected: currentPage == 'reports',
|
|
onTap: () => runAfterDrawerClose(
|
|
context,
|
|
() => pages.set('reports'),
|
|
),
|
|
),
|
|
_DrawerItem(
|
|
icon: AppModuleVisuals.followup.icon,
|
|
label: '复查随访',
|
|
selected: currentPage == 'followups',
|
|
onTap: () => runAfterDrawerClose(
|
|
context,
|
|
() => pages.set('followups'),
|
|
),
|
|
),
|
|
const Spacer(),
|
|
const Divider(height: 1, color: AppColors.divider),
|
|
const SizedBox(height: 8),
|
|
_DrawerItem(
|
|
icon: Icons.settings_outlined,
|
|
label: '设置',
|
|
selected: false,
|
|
onTap: () => runAfterDrawerClose(
|
|
context,
|
|
() => routes.push('doctorSettings'),
|
|
),
|
|
),
|
|
_DrawerItem(
|
|
icon: Icons.logout,
|
|
label: '退出登录',
|
|
selected: false,
|
|
danger: true,
|
|
onTap: () async {
|
|
final confirmed = await confirmAccountAction(
|
|
context,
|
|
title: '退出登录',
|
|
message: '确定退出当前医生账号吗?',
|
|
confirmLabel: '退出登录',
|
|
);
|
|
if (!confirmed || !context.mounted) return;
|
|
await runAfterDrawerClose(context, () async {
|
|
await authNotifier.logout();
|
|
routes.replace('login');
|
|
});
|
|
},
|
|
),
|
|
const SizedBox(height: 16),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _DrawerHeader extends StatelessWidget {
|
|
final String name;
|
|
final String subtitle;
|
|
final IconData icon;
|
|
final VoidCallback onTap;
|
|
const _DrawerHeader({
|
|
required this.name,
|
|
required this.subtitle,
|
|
required this.icon,
|
|
required this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
margin: const EdgeInsets.all(14),
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withValues(alpha: 0.88),
|
|
borderRadius: BorderRadius.circular(22),
|
|
border: Border.all(
|
|
color: Colors.white.withValues(alpha: 0.86),
|
|
width: 1.2,
|
|
),
|
|
boxShadow: AppColors.cardShadowLight,
|
|
),
|
|
child: InkWell(
|
|
onTap: onTap,
|
|
borderRadius: BorderRadius.circular(16),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width: 56,
|
|
height: 56,
|
|
decoration: BoxDecoration(
|
|
gradient: AppColors.primaryGradient,
|
|
borderRadius: BorderRadius.circular(20),
|
|
boxShadow: AppColors.buttonShadow,
|
|
),
|
|
child: Icon(icon, color: Colors.white, size: 26),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
name,
|
|
style: const TextStyle(
|
|
fontSize: 17,
|
|
fontWeight: FontWeight.w600,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
const SizedBox(height: 3),
|
|
Text(
|
|
subtitle,
|
|
style: const TextStyle(
|
|
fontSize: 12,
|
|
color: AppColors.textSecondary,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _DrawerItem extends StatelessWidget {
|
|
final IconData icon;
|
|
final String label;
|
|
final bool selected;
|
|
final bool danger;
|
|
final VoidCallback onTap;
|
|
|
|
const _DrawerItem({
|
|
required this.icon,
|
|
required this.label,
|
|
required this.selected,
|
|
required this.onTap,
|
|
this.danger = false,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final color = danger
|
|
? AppColors.error
|
|
: selected
|
|
? const Color(0xFF7C5CFF)
|
|
: AppColors.textPrimary;
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 4),
|
|
child: Material(
|
|
color: Colors.transparent,
|
|
borderRadius: BorderRadius.circular(14),
|
|
child: InkWell(
|
|
borderRadius: BorderRadius.circular(14),
|
|
onTap: onTap,
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
|
decoration: BoxDecoration(
|
|
gradient: selected
|
|
? AppColors.primaryGradient
|
|
: AppColors.surfaceGradient,
|
|
borderRadius: BorderRadius.circular(14),
|
|
border: Border.all(
|
|
color: selected
|
|
? Colors.white.withValues(alpha: 0.80)
|
|
: AppColors.borderLight,
|
|
width: 1.1,
|
|
),
|
|
boxShadow: selected
|
|
? AppColors.buttonShadow
|
|
: AppColors.cardShadowLight,
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(icon, size: 20, color: selected ? Colors.white : color),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Text(
|
|
label,
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
fontWeight: FontWeight.w700,
|
|
color: selected ? Colors.white : color,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|