feat(ocr) - schema updated, allowed payment model to allow both - claim and ocr data
This commit is contained in:
@@ -94,7 +94,7 @@ model Staff {
|
||||
role String // e.g., "Dentist", "Hygienist", "Assistant"
|
||||
phone String?
|
||||
createdAt DateTime @default(now())
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
appointments Appointment[]
|
||||
claims Claim[] @relation("ClaimStaff")
|
||||
}
|
||||
@@ -133,7 +133,8 @@ enum ClaimStatus {
|
||||
|
||||
model ServiceLine {
|
||||
id Int @id @default(autoincrement())
|
||||
claimId Int
|
||||
claimId Int?
|
||||
paymentId Int?
|
||||
procedureCode String
|
||||
procedureDate DateTime @db.Date
|
||||
oralCavityArea String?
|
||||
@@ -145,7 +146,9 @@ model ServiceLine {
|
||||
totalDue Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
status ServiceLineStatus @default(UNPAID)
|
||||
|
||||
claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)
|
||||
claim Claim? @relation(fields: [claimId], references: [id], onDelete: Cascade)
|
||||
payment Payment? @relation(fields: [paymentId], references: [id], onDelete: Cascade)
|
||||
|
||||
serviceLineTransactions ServiceLineTransaction[]
|
||||
}
|
||||
|
||||
@@ -204,7 +207,7 @@ enum PdfCategory {
|
||||
|
||||
model Payment {
|
||||
id Int @id @default(autoincrement())
|
||||
claimId Int @unique
|
||||
claimId Int? @unique
|
||||
patientId Int
|
||||
userId Int
|
||||
updatedById Int?
|
||||
@@ -217,12 +220,12 @@ model Payment {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)
|
||||
claim Claim? @relation(fields: [claimId], references: [id], onDelete: Cascade)
|
||||
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
||||
updatedBy User? @relation("PaymentUpdatedBy", fields: [updatedById], references: [id])
|
||||
serviceLineTransactions ServiceLineTransaction[]
|
||||
serviceLines ServiceLine[]
|
||||
|
||||
@@index([id])
|
||||
@@index([claimId])
|
||||
@@index([patientId])
|
||||
}
|
||||
|
||||
@@ -67,12 +67,14 @@ export type PaymentWithExtras = Prisma.PaymentGetPayload<{
|
||||
serviceLines: true;
|
||||
};
|
||||
};
|
||||
serviceLines: true; // ✅ OCR-only service lines directly under Payment
|
||||
serviceLineTransactions: {
|
||||
include: {
|
||||
serviceLine: true;
|
||||
};
|
||||
};
|
||||
updatedBy: true;
|
||||
patient: true;
|
||||
};
|
||||
}> & {
|
||||
patientName: string;
|
||||
|
||||
Reference in New Issue
Block a user