init files

This commit is contained in:
2025-07-30 23:20:15 +05:30
parent c5b27fbe7b
commit 23e4eb6b7c
6 changed files with 410 additions and 14 deletions

View File

@@ -114,6 +114,7 @@ model Claim {
staff Staff? @relation("ClaimStaff", fields: [staffId], references: [id])
serviceLines ServiceLine[]
payment Payment?
}
enum ClaimStatus {
@@ -124,15 +125,16 @@ enum ClaimStatus {
}
model ServiceLine {
id Int @id @default(autoincrement())
claimId Int
procedureCode String
procedureDate DateTime @db.Date
oralCavityArea String?
toothNumber String?
toothSurface String?
billedAmount Float
claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)
id Int @id @default(autoincrement())
claimId Int
procedureCode String
procedureDate DateTime @db.Date
oralCavityArea String?
toothNumber String?
toothSurface String?
billedAmount Float
claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)
servicePayments ServiceLinePayment[]
}
model InsuranceCredential {
@@ -177,3 +179,72 @@ enum PdfCategory {
ELIGIBILITY
OTHER
}
model Payment {
id Int @id @default(autoincrement())
patientId Int
userId Int
claimId Int @unique
totalBilled Decimal @db.Decimal(10, 2)
totalPaid Decimal @default(0.00) @db.Decimal(10, 2)
totalDue Decimal @db.Decimal(10, 2)
status PaymentStatus @default(PENDING)
receivedDate DateTime?
paymentMethod PaymentMethod?
notes String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)
transactions PaymentTransaction[]
servicePayments ServiceLinePayment[]
@@index([claimId])
}
model PaymentTransaction {
id Int @id @default(autoincrement())
paymentId Int
amount Decimal @db.Decimal(10, 2)
method PaymentMethod
transactionId String?
receivedDate DateTime
payerName String?
notes String?
createdAt DateTime @default(now())
payment Payment @relation(fields: [paymentId], references: [id], onDelete: Cascade)
@@index([paymentId])
}
model ServiceLinePayment {
id Int @id @default(autoincrement())
paymentId Int
serviceLineId Int
paidAmount Decimal @db.Decimal(10, 2)
adjustedAmount Decimal @default(0.00) @db.Decimal(10, 2)
notes String?
payment Payment @relation(fields: [paymentId], references: [id], onDelete: Cascade)
serviceLine ServiceLine @relation(fields: [serviceLineId], references: [id], onDelete: Cascade)
@@index([paymentId])
@@index([serviceLineId])
}
enum PaymentStatus {
PENDING
PARTIALLY_PAID
PAID
OVERPAID
DENIED
}
enum PaymentMethod {
EFT
CHECK
CASH
CARD
OTHER
}