insuranceCred half

This commit is contained in:
2025-06-02 21:49:37 +05:30
parent e147481215
commit 8945e56f14
9 changed files with 509 additions and 25 deletions

View File

@@ -20,12 +20,13 @@ datasource db {
}
model User {
id Int @id @default(autoincrement())
username String @unique
password String
patients Patient[]
appointments Appointment[]
claims Claim[]
id Int @id @default(autoincrement())
username String @unique
password String
patients Patient[]
appointments Appointment[]
claims Claim[]
insuranceCredentials InsuranceCredential[]
}
model Patient {
@@ -70,8 +71,7 @@ model Appointment {
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id])
staff Staff? @relation(fields: [staffId], references: [id])
claims Claim[]
claims Claim[]
}
model Staff {
@@ -86,27 +86,27 @@ model Staff {
}
model Claim {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
patientId Int
appointmentId Int
userId Int
staffId Int
patientName String
memberId String
dateOfBirth DateTime @db.Date
memberId String
dateOfBirth DateTime @db.Date
remarks String
serviceDate DateTime
insuranceProvider String // e.g., "Delta MA"
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
status String @default("pending") // "pending", "completed", "cancelled", "no-show"
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
status String @default("pending") // "pending", "completed", "cancelled", "no-show"
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)
user User? @relation(fields: [userId], references: [id])
staff Staff? @relation("ClaimStaff", fields: [staffId], references: [id])
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)
user User? @relation(fields: [userId], references: [id])
staff Staff? @relation("ClaimStaff", fields: [staffId], references: [id])
serviceLines ServiceLine[]
serviceLines ServiceLine[]
}
model ServiceLine {
@@ -120,3 +120,15 @@ model ServiceLine {
billedAmount Float
claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)
}
model InsuranceCredential {
id Int @id @default(autoincrement())
userId Int
siteKey String @unique // Unique key for site (e.g. "github", "slack")
username String
password String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@index([userId])
}

View File

@@ -3,4 +3,5 @@ export * from '../shared/schemas/objects/AppointmentUncheckedCreateInput.schema'
export * from '../shared/schemas/objects/PatientUncheckedCreateInput.schema';
export * from '../shared/schemas/objects/UserUncheckedCreateInput.schema';
export * from '../shared/schemas/objects/StaffUncheckedCreateInput.schema'
export * from '../shared/schemas/objects/ClaimUncheckedCreateInput.schema'
export * from '../shared/schemas/objects/ClaimUncheckedCreateInput.schema'
export * from '../shared/schemas/objects/InsuranceCredentialUncheckedCreateInput.schema'