feat(用药管理): 集成AI智能分析功能,提供用药依从性深度洞察和专业健康建议

This commit is contained in:
richarjiang
2025-12-01 10:49:35 +08:00
parent a309123b35
commit a47f0fb72e
15 changed files with 1792 additions and 468 deletions

View File

@@ -39,6 +39,7 @@ export enum ChallengeType {
MOOD = 'mood',
SLEEP = 'sleep',
WEIGHT = 'weight',
STEP = 'step',
CUSTOM = 'custom',
}

View File

@@ -6,6 +6,7 @@ import type {
DailyMedicationStats,
Medication,
MedicationAiAnalysisV2,
MedicationAiSummary,
MedicationForm,
MedicationRecognitionTask,
MedicationRecord,
@@ -315,6 +316,14 @@ export const getOverallStats = async (): Promise<{
// ==================== AI 分析相关 ====================
/**
* 获取 AI 用药总结
* @returns 当前激活用药计划的 AI 关键解读与完成度
*/
export const getMedicationAiSummary = async (): Promise<MedicationAiSummary> => {
return api.get<MedicationAiSummary>('/medications/ai-summary');
};
/**
* 流式获取药品 AI 分析
* @param medicationId 药品 ID

View File

@@ -189,9 +189,13 @@ export class NotificationService {
} else if (data?.type === 'goal_achievement') {
// 处理目标达成通知
console.log('用户点击了目标达成通知');
} else if (data?.type === 'mood_checkin') {
} else if (data?.type === 'mood_checkin' || data?.type === 'mood_checkin_reminder') {
// 处理心情打卡提醒
console.log('用户点击了心情打卡提醒');
router.push({
pathname: '/mood/edit',
params: { date: new Date().toISOString().split('T')[0] }
} as any);
} else if (data?.type === 'goal_reminder') {
// 处理目标提醒通知
console.log('用户点击了目标提醒通知', data);
@@ -221,13 +225,21 @@ export class NotificationService {
if (data?.url) {
router.push(data.url as any);
}
} else if (data?.type === 'water_reminder' || data?.type === 'regular_water_reminder') {
} else if (data?.type === 'water_reminder' || data?.type === 'regular_water_reminder' || data?.type === 'custom_water_reminder') {
// 处理喝水提醒通知
console.log('用户点击了喝水提醒通知', data);
// 跳转到统计页面查看喝水进度
if (data?.url) {
router.push(data.url as any);
}
} else if (data?.type === 'daily_summary' || data?.type === 'daily_summary_reminder') {
// 处理每日总结通知
console.log('用户点击了每日总结通知', data);
if (data?.url) {
router.push(data.url as any);
} else {
router.push('/(tabs)/statistics' as any);
}
} else if (data?.type === NotificationTypes.FASTING_START || data?.type === NotificationTypes.FASTING_END) {
router.push(ROUTES.TAB_FASTING as any);
} else if (data?.type === NotificationTypes.WORKOUT_COMPLETION) {