feat: 商业保险/员工福利独立页面+易签宝电子签署框架

- 商业保险:从社公商保中拆出为独立页面,侧边栏新增「福利保障」分组
- 员工福利:新建完整模块(方案管理+批量参保+员工汇总),Prisma模型+后端路由+前端页面
- 电子签署:搭建易签宝对接框架(ESignRecord模型+创建/查询/取消/回调接口+前端签署管理页面)
- 侧边栏新增「福利保障」分组:商业保险、员工福利、电子签署
- Prisma schema 新增6个模型:CommercialInsurancePlan/Enrollment, EmployeeBenefitPlan/Enrollment, ESignRecord
This commit is contained in:
freedakgmail
2026-08-04 23:08:49 +08:00
parent 5604d02de9
commit c328172e7d
12 changed files with 1348 additions and 9 deletions
+119
View File
@@ -183,6 +183,11 @@ model Organization {
attendancePublishes AttendancePublish[]
specialStatuses EmployeeSpecialStatus[]
companyFiles CompanyFile[]
commercialInsPlans CommercialInsurancePlan[]
commercialInsEnrollments CommercialInsuranceEnrollment[]
benefitPlans EmployeeBenefitPlan[]
benefitEnrollments EmployeeBenefitEnrollment[]
eSignRecords ESignRecord[]
}
model User {
@@ -268,6 +273,9 @@ model Employee {
calendarEvents CalendarEvent[]
workProcesses WorkProcess[]
specialStatuses EmployeeSpecialStatus[]
commercialInsEnrollments CommercialInsuranceEnrollment[]
benefitEnrollments EmployeeBenefitEnrollment[]
eSignRecords ESignRecord[]
@@unique([orgId, idCardHash])
}
@@ -1365,3 +1373,114 @@ model AcceptanceTest {
@@unique([orgId, verifierName])
@@index([orgId, status])
}
// ========== 商业保险 ==========
model CommercialInsurancePlan {
id String @id @default(cuid())
orgId String
org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
name String
type String // ACCIDENT | SUPPLEMENTARY_MEDICAL | EMPLOYER_LIABILITY | CRITICAL_ILLNESS | GROUP_LIFE | OTHER
provider String // 保险公司
policyNo String?
premium Float // 年保费
coverageAmount Float // 保额
effectiveFrom String // YYYY-MM-DD
effectiveTo String? // null = 长期
description String?
status String @default("ACTIVE") // ACTIVE | EXPIRED | CANCELLED
enrollments CommercialInsuranceEnrollment[]
createdBy String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([orgId, status])
@@index([orgId, type])
}
model CommercialInsuranceEnrollment {
id String @id @default(cuid())
orgId String
org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
planId String
plan CommercialInsurancePlan @relation(fields: [planId], references: [id], onDelete: Cascade)
employeeId String
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
premium Float // 个人保费
effectiveFrom String // YYYY-MM-DD
effectiveTo String?
status String @default("ACTIVE") // ACTIVE | TERMINATED
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([orgId, planId])
@@index([employeeId])
}
// ========== 员工福利 ==========
model EmployeeBenefitPlan {
id String @id @default(cuid())
orgId String
org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
name String
category String // TRANSPORT | MEAL | HOUSING | COMMUNICATION | HEALTH_CHECK | HOLIDAY | BIRTHDAY | OTHER
amount Float // 每月金额(或每次金额)
frequency String @default("MONTHLY") // MONTHLY | QUARTERLY | YEARLY | ONE_TIME
taxDeductible Boolean @default(false) // 是否税前扣除
description String?
status String @default("ACTIVE")
enrollments EmployeeBenefitEnrollment[]
createdBy String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([orgId, status])
@@index([orgId, category])
}
model EmployeeBenefitEnrollment {
id String @id @default(cuid())
orgId String
org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
planId String
plan EmployeeBenefitPlan @relation(fields: [planId], references: [id], onDelete: Cascade)
employeeId String
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
effectiveFrom String // YYYY-MM
effectiveTo String? // null = 至今
amount Float? // 覆盖默认金额(个别调整)
status String @default("ACTIVE")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([orgId, planId])
@@index([employeeId])
}
// ========== 电子签署(易签宝) ==========
model ESignRecord {
id String @id @default(cuid())
orgId String
org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
contractId String? // 关联 LaborContract
employeeId String
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
flowId String? // 易签宝流程ID
documentTitle String // 文件标题
documentContent String? // 文件内容(HTML/PDF base64
status String @default("PENDING") // PENDING | SIGNING | COMPLETED | REJECTED | EXPIRED | CANCELLED
signUrl String? // 签署链接
signedPdfUrl String? // 签署完成后的PDF链接
initiatedBy String // 发起人(HR用户ID
completedAt DateTime?
expiredAt DateTime?
callbackData Json? // 易签宝回调数据
remark String?
createdBy String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([orgId, status])
@@index([employeeId])
@@index([contractId])
}