feat(medications): 添加AI智能识别药品功能和有效期管理
- 新增AI药品识别流程,支持多角度拍摄和实时进度显示 - 添加药品有效期字段,支持在添加和编辑药品时设置有效期 - 新增MedicationAddOptionsSheet选择录入方式(AI识别/手动录入) - 新增ai-camera和ai-progress两个独立页面处理AI识别流程 - 新增ExpiryDatePickerModal和MedicationPhotoGuideModal组件 - 移除本地通知系统,迁移到服务端推送通知 - 添加medicationNotificationCleanup服务清理旧的本地通知 - 更新药品详情页支持AI草稿模式和有效期显示 - 优化药品表单,支持有效期选择和AI识别结果确认 - 更新i18n资源,添加有效期相关翻译 BREAKING CHANGE: 药品通知系统从本地通知迁移到服务端推送,旧版本的本地通知将被清理
This commit is contained in:
@@ -40,6 +40,7 @@ export interface Medication {
|
||||
medicationTimes: string[]; // 服药时间列表 ['08:00', '20:00']
|
||||
startDate: string; // 开始日期 ISO
|
||||
endDate?: string | null; // 结束日期 ISO(可选)
|
||||
expiryDate?: string | null; // 药品有效期 ISO(可选)
|
||||
repeatPattern: RepeatPattern; // 重复模式
|
||||
note?: string; // 备注
|
||||
aiAnalysis?: string; // AI 分析结果(Markdown 格式)
|
||||
@@ -105,3 +106,48 @@ export interface MedicationAiAnalysisV2 {
|
||||
storageAdvice: string[]; // 储存建议
|
||||
healthAdvice: string[]; // 健康建议/使用建议
|
||||
}
|
||||
|
||||
/**
|
||||
* AI 识别结果结构化数据
|
||||
*/
|
||||
export interface MedicationAiRecognitionResult {
|
||||
name: string;
|
||||
photoUrl?: string;
|
||||
form?: MedicationForm;
|
||||
dosageValue?: number;
|
||||
dosageUnit?: string;
|
||||
timesPerDay?: number;
|
||||
medicationTimes?: string[];
|
||||
startDate?: string;
|
||||
endDate?: string | null;
|
||||
expiryDate?: string | null;
|
||||
note?: string;
|
||||
suitableFor?: string[];
|
||||
unsuitableFor?: string[];
|
||||
mainIngredients?: string[];
|
||||
mainUsage?: string;
|
||||
sideEffects?: string[];
|
||||
storageAdvice?: string[];
|
||||
healthAdvice?: string[];
|
||||
confidence?: number;
|
||||
}
|
||||
|
||||
export type MedicationRecognitionStatus =
|
||||
| 'pending'
|
||||
| 'analyzing_product'
|
||||
| 'analyzing_suitability'
|
||||
| 'analyzing_ingredients'
|
||||
| 'analyzing_effects'
|
||||
| 'completed'
|
||||
| 'failed';
|
||||
|
||||
export interface MedicationRecognitionTask {
|
||||
taskId: string;
|
||||
status: MedicationRecognitionStatus;
|
||||
currentStep?: string;
|
||||
progress?: number;
|
||||
result?: MedicationAiRecognitionResult;
|
||||
errorMessage?: string; // 识别失败时的错误信息
|
||||
createdAt: string;
|
||||
completedAt?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user