feat(medications): 添加提醒发送状态追踪,防止重复推送

- 新增 reminder_sent 字段到服药记录表,用于标记提醒发送状态
- 添加数据库索引优化未发送提醒记录的查询性能
- 提醒检查频率从 5 分钟优化至 1 分钟,提升及时性
- 添加主进程检测机制,避免多进程环境下重复发送提醒
- 增强错误处理和发送结果统计功能
This commit is contained in:
richarjiang
2025-11-11 11:13:44 +08:00
parent 2850eba7cf
commit d9c144ff87
3 changed files with 73 additions and 7 deletions

View File

@@ -83,6 +83,14 @@ export class MedicationRecord extends Model {
})
declare deleted: boolean;
@Column({
type: DataType.BOOLEAN,
allowNull: false,
defaultValue: false,
comment: '是否已发送提醒',
})
declare reminderSent: boolean;
// 关联关系
@BelongsTo(() => Medication, 'medicationId')
declare medication: Medication;