again updated
This commit is contained in:
@@ -28,7 +28,7 @@ model User {
|
|||||||
claims Claim[]
|
claims Claim[]
|
||||||
insuranceCredentials InsuranceCredential[]
|
insuranceCredentials InsuranceCredential[]
|
||||||
// reverse relations
|
// reverse relations
|
||||||
updatedPayments Payment[] @relation("PaymentUpdatedBy")
|
updatedPayments Payment[] @relation("PaymentUpdatedBy")
|
||||||
}
|
}
|
||||||
|
|
||||||
model Patient {
|
model Patient {
|
||||||
@@ -116,7 +116,7 @@ model Claim {
|
|||||||
staff Staff? @relation("ClaimStaff", fields: [staffId], references: [id])
|
staff Staff? @relation("ClaimStaff", fields: [staffId], references: [id])
|
||||||
|
|
||||||
serviceLines ServiceLine[]
|
serviceLines ServiceLine[]
|
||||||
payment Payment?
|
payment Payment?
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ClaimStatus {
|
enum ClaimStatus {
|
||||||
@@ -127,18 +127,30 @@ enum ClaimStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model ServiceLine {
|
model ServiceLine {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
claimId Int
|
claimId Int
|
||||||
procedureCode String
|
procedureCode String
|
||||||
procedureDate DateTime @db.Date
|
procedureDate DateTime @db.Date
|
||||||
oralCavityArea String?
|
oralCavityArea String?
|
||||||
toothNumber String?
|
toothNumber String?
|
||||||
toothSurface String?
|
toothSurface String?
|
||||||
billedAmount Float
|
billedAmount Float
|
||||||
claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)
|
status ServiceLineStatus @default(UNPAID)
|
||||||
|
|
||||||
|
claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)
|
||||||
servicePayments ServiceLinePayment[]
|
servicePayments ServiceLinePayment[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum ServiceLineStatus {
|
||||||
|
PENDING
|
||||||
|
PARTIALLY_PAID
|
||||||
|
PAID
|
||||||
|
UNPAID
|
||||||
|
ADJUSTED
|
||||||
|
OVERPAID
|
||||||
|
DENIED
|
||||||
|
}
|
||||||
|
|
||||||
model InsuranceCredential {
|
model InsuranceCredential {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
userId Int
|
userId Int
|
||||||
@@ -197,11 +209,10 @@ model Payment {
|
|||||||
notes String?
|
notes String?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)
|
claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)
|
||||||
updatedBy User? @relation("PaymentUpdatedBy", fields: [updatedById], references: [id])
|
updatedBy User? @relation("PaymentUpdatedBy", fields: [updatedById], references: [id])
|
||||||
transactions PaymentTransaction[]
|
transactions PaymentTransaction[]
|
||||||
servicePayments ServiceLinePayment[]
|
|
||||||
|
|
||||||
@@index([id])
|
@@index([id])
|
||||||
@@index([claimId])
|
@@index([claimId])
|
||||||
@@ -209,29 +220,33 @@ model Payment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model PaymentTransaction {
|
model PaymentTransaction {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
paymentId Int
|
paymentId Int
|
||||||
amount Decimal @db.Decimal(10, 2)
|
amount Decimal @db.Decimal(10, 2)
|
||||||
method PaymentMethod
|
method PaymentMethod
|
||||||
transactionId String?
|
transactionId String?
|
||||||
receivedDate DateTime
|
receivedDate DateTime
|
||||||
payerName String?
|
payerName String?
|
||||||
notes String?
|
notes String?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
payment Payment @relation(fields: [paymentId], references: [id], onDelete: Cascade)
|
payment Payment @relation(fields: [paymentId], references: [id], onDelete: Cascade)
|
||||||
|
serviceLinePayments ServiceLinePayment[]
|
||||||
|
|
||||||
@@index([paymentId])
|
@@index([paymentId])
|
||||||
}
|
}
|
||||||
|
|
||||||
model ServiceLinePayment {
|
model ServiceLinePayment {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
paymentId Int
|
transactionId Int
|
||||||
serviceLineId Int
|
serviceLineId Int
|
||||||
paidAmount Decimal @db.Decimal(10, 2)
|
paidAmount Decimal @db.Decimal(10, 2)
|
||||||
adjustedAmount Decimal @default(0.00) @db.Decimal(10, 2)
|
adjustedAmount Decimal @default(0.00) @db.Decimal(10, 2)
|
||||||
notes String?
|
notes String?
|
||||||
payment Payment @relation(fields: [paymentId], references: [id], onDelete: Cascade)
|
|
||||||
serviceLine ServiceLine @relation(fields: [serviceLineId], references: [id], onDelete: Cascade)
|
transaction PaymentTransaction @relation(fields: [transactionId], references: [id], onDelete: Cascade)
|
||||||
@@index([paymentId])
|
serviceLine ServiceLine @relation(fields: [serviceLineId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
@@index([transactionId])
|
||||||
@@index([serviceLineId])
|
@@index([serviceLineId])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,4 +264,4 @@ enum PaymentMethod {
|
|||||||
CASH
|
CASH
|
||||||
CARD
|
CARD
|
||||||
OTHER
|
OTHER
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user