feat: 退休提醒功能 - 身份证提取出生日期、渐进式退休年龄计算、AI流式获取政策、用户确认生效

This commit is contained in:
freedakgmail
2026-07-25 01:21:07 +08:00
parent 169a0e1117
commit b892df1d52
10 changed files with 659 additions and 5 deletions
+23
View File
@@ -120,6 +120,7 @@ model Organization {
contactName String?
contactPhone String?
payrollFrequency Int @default(1) // 每月发薪次数(1=一次一批)
retirementReminderEnabled Boolean @default(false) // 退休提醒开关
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -151,6 +152,7 @@ model Organization {
attendanceRecords AttendanceRecord[]
trainingRecords TrainingRecord[]
performanceRecords PerformanceRecord[]
retirementPolicies RetirementPolicy[]
}
model User {
@@ -200,6 +202,8 @@ model Employee {
housingFundEndMonth String? // 当前公积金截止年月(便捷字段)
specialDeduction Float @default(0) // 专项附加扣除(子女教育、赡养老人等,员工portal端填报)
city String? // 员工社保参保城市
birthDate DateTime? // 出生日期(从身份证号提取)
retirementDaysLeft Int? // 距退休天数(便捷字段,定期计算)
createdBy String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -828,3 +832,22 @@ model RagKnowledge {
@@index([category])
@@map("rag_knowledge")
}
// ========== 退休政策版本管理 ==========
model RetirementPolicy {
id String @id @default(cuid())
orgId String
org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
version Int @default(1)
content String // AI 返回的完整政策内容
contentHash String // 内容 hash,用于判断内容是否变化
status String @default("PENDING") // PENDING=待确认, CONFIRMED=已生效, SUPERSEDED=已被新版本替代
maleRetireAge Float @default(60) // 男性退休年龄
femaleRetireAge Float @default(55) // 女性退休年龄(干部55,工人50,由AI解析最新政策)
femaleWorkerAge Float @default(50) // 女性工人退休年龄
createdAt DateTime @default(now())
confirmedAt DateTime? // 用户确认时间
@@index([orgId, createdAt])
}