feat(medications): 添加AI智能识别药品功能和有效期管理
- 新增AI药品识别流程,支持多角度拍摄和实时进度显示 - 添加药品有效期字段,支持在添加和编辑药品时设置有效期 - 新增MedicationAddOptionsSheet选择录入方式(AI识别/手动录入) - 新增ai-camera和ai-progress两个独立页面处理AI识别流程 - 新增ExpiryDatePickerModal和MedicationPhotoGuideModal组件 - 移除本地通知系统,迁移到服务端推送通知 - 添加medicationNotificationCleanup服务清理旧的本地通知 - 更新药品详情页支持AI草稿模式和有效期显示 - 优化药品表单,支持有效期选择和AI识别结果确认 - 更新i18n资源,添加有效期相关翻译 BREAKING CHANGE: 药品通知系统从本地通知迁移到服务端推送,旧版本的本地通知将被清理
This commit is contained in:
@@ -7,6 +7,7 @@ import type {
|
||||
Medication,
|
||||
MedicationAiAnalysisV2,
|
||||
MedicationForm,
|
||||
MedicationRecognitionTask,
|
||||
MedicationRecord,
|
||||
MedicationStatus,
|
||||
RepeatPattern,
|
||||
@@ -28,6 +29,7 @@ export interface CreateMedicationDto {
|
||||
medicationTimes: string[];
|
||||
startDate: string;
|
||||
endDate?: string | null;
|
||||
expiryDate?: string | null;
|
||||
repeatPattern?: RepeatPattern;
|
||||
note?: string;
|
||||
}
|
||||
@@ -344,3 +346,39 @@ export async function analyzeMedicationV2(
|
||||
{}
|
||||
);
|
||||
}
|
||||
|
||||
// ==================== AI 药品识别任务 ====================
|
||||
|
||||
export interface CreateMedicationRecognitionDto {
|
||||
frontImageUrl: string;
|
||||
sideImageUrl: string;
|
||||
auxiliaryImageUrl?: string;
|
||||
}
|
||||
|
||||
export interface ConfirmMedicationRecognitionDto {
|
||||
name?: string;
|
||||
timesPerDay?: number;
|
||||
medicationTimes?: string[];
|
||||
startDate?: string;
|
||||
endDate?: string | null;
|
||||
note?: string;
|
||||
}
|
||||
|
||||
export const createMedicationRecognitionTask = async (
|
||||
dto: CreateMedicationRecognitionDto
|
||||
): Promise<{ taskId: string; status: MedicationRecognitionTask['status'] }> => {
|
||||
return api.post('/medications/ai-recognize', dto);
|
||||
};
|
||||
|
||||
export const getMedicationRecognitionStatus = async (
|
||||
taskId: string
|
||||
): Promise<MedicationRecognitionTask> => {
|
||||
return api.get(`/medications/ai-recognize/${taskId}/status`);
|
||||
};
|
||||
|
||||
export const confirmMedicationRecognition = async (
|
||||
taskId: string,
|
||||
payload?: ConfirmMedicationRecognitionDto
|
||||
): Promise<Medication> => {
|
||||
return api.post(`/medications/ai-recognize/${taskId}/confirm`, payload ?? {});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user