feat: Check DDMA Payments reads Plan Pays from DDMA claim status, fills app payments and saves a PDF
Adds a Check DDMA Payments card (date range, Go, auto-check schedule) above Check MH Payments. Go logs into DDMA (with OTP), searches Check Claim Status by service date range, reads claim numbers and Plan Pays across pages, matches them to app claims to fill the paid amount, creates patient + payment for unmatched paid claims, and saves the results page as a PDF in uploads/DDMAPayment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+115
-113
@@ -19,81 +19,84 @@ datasource db {
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
username String @unique
|
||||
password String
|
||||
autoBackupEnabled Boolean @default(true)
|
||||
autoBackupHour Int @default(20)
|
||||
usbBackupEnabled Boolean @default(false)
|
||||
usbBackupHour Int @default(21)
|
||||
autoMhCheckEnabled Boolean @default(false)
|
||||
autoMhCheckDayOfWeek Int @default(1)
|
||||
autoMhCheckHour Int @default(13)
|
||||
patients Patient[]
|
||||
appointments Appointment[]
|
||||
staff Staff[]
|
||||
npiProviders NpiProvider[]
|
||||
claims Claim[]
|
||||
insuranceCredentials InsuranceCredential[]
|
||||
shoppingVendors ShoppingVendor[]
|
||||
updatedPayments Payment[] @relation("PaymentUpdatedBy")
|
||||
backups DatabaseBackup[]
|
||||
backupDestinations BackupDestination[]
|
||||
notifications Notification[]
|
||||
cloudFolders CloudFolder[]
|
||||
cloudFiles CloudFile[]
|
||||
communications Communication[]
|
||||
twilioSettings TwilioSettings?
|
||||
telnyxSettings TelnyxSettings?
|
||||
aiSettings AiSettings?
|
||||
officeHours OfficeHours?
|
||||
officeContact OfficeContact?
|
||||
procedureTimeslot ProcedureTimeslot?
|
||||
insuranceContacts InsuranceContact[]
|
||||
patientConversations PatientConversation[]
|
||||
labRxTemplates LabRxTemplate[]
|
||||
seleniumSettings SeleniumSettings?
|
||||
id Int @id @default(autoincrement())
|
||||
username String @unique
|
||||
password String
|
||||
autoBackupEnabled Boolean @default(true)
|
||||
autoBackupHour Int @default(20)
|
||||
usbBackupEnabled Boolean @default(false)
|
||||
usbBackupHour Int @default(21)
|
||||
autoMhCheckEnabled Boolean @default(false)
|
||||
autoMhCheckDayOfWeek Int @default(1)
|
||||
autoMhCheckHour Int @default(13)
|
||||
autoDdmaCheckEnabled Boolean @default(false)
|
||||
autoDdmaCheckDayOfWeek Int @default(1)
|
||||
autoDdmaCheckHour Int @default(13)
|
||||
patients Patient[]
|
||||
appointments Appointment[]
|
||||
staff Staff[]
|
||||
npiProviders NpiProvider[]
|
||||
claims Claim[]
|
||||
insuranceCredentials InsuranceCredential[]
|
||||
shoppingVendors ShoppingVendor[]
|
||||
updatedPayments Payment[] @relation("PaymentUpdatedBy")
|
||||
backups DatabaseBackup[]
|
||||
backupDestinations BackupDestination[]
|
||||
notifications Notification[]
|
||||
cloudFolders CloudFolder[]
|
||||
cloudFiles CloudFile[]
|
||||
communications Communication[]
|
||||
twilioSettings TwilioSettings?
|
||||
telnyxSettings TelnyxSettings?
|
||||
aiSettings AiSettings?
|
||||
officeHours OfficeHours?
|
||||
officeContact OfficeContact?
|
||||
procedureTimeslot ProcedureTimeslot?
|
||||
insuranceContacts InsuranceContact[]
|
||||
patientConversations PatientConversation[]
|
||||
labRxTemplates LabRxTemplate[]
|
||||
seleniumSettings SeleniumSettings?
|
||||
}
|
||||
|
||||
model Patient {
|
||||
id Int @id @default(autoincrement())
|
||||
firstName String
|
||||
lastName String
|
||||
dateOfBirth DateTime? @db.Date
|
||||
gender String
|
||||
phone String
|
||||
email String?
|
||||
address String?
|
||||
city String?
|
||||
state String? @default("MA")
|
||||
zipCode String?
|
||||
insuranceProvider String?
|
||||
insuranceId String?
|
||||
groupNumber String?
|
||||
policyHolder String?
|
||||
policyHolderPatientId Int? // patient record of the policy holder, when picked from the DB
|
||||
id Int @id @default(autoincrement())
|
||||
firstName String
|
||||
lastName String
|
||||
dateOfBirth DateTime? @db.Date
|
||||
gender String
|
||||
phone String
|
||||
email String?
|
||||
address String?
|
||||
city String?
|
||||
state String? @default("MA")
|
||||
zipCode String?
|
||||
insuranceProvider String?
|
||||
insuranceId String?
|
||||
groupNumber String?
|
||||
policyHolder String?
|
||||
policyHolderPatientId Int? // patient record of the policy holder, when picked from the DB
|
||||
policyHolderRelationship String? // ADA box 18: SELF | SPOUSE | DEPENDENT | OTHER
|
||||
allergies String?
|
||||
medicalConditions String?
|
||||
preferredLanguage String? @default("English")
|
||||
status PatientStatus @default(UNKNOWN)
|
||||
remainingBenefit String?
|
||||
thirdPartyInsurance String?
|
||||
userId Int
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
appointments Appointment[]
|
||||
procedures AppointmentProcedure[]
|
||||
claims Claim[]
|
||||
groups PdfGroup[]
|
||||
payment Payment[]
|
||||
communications Communication[]
|
||||
documents PatientDocument[]
|
||||
conversation PatientConversation?
|
||||
cloudFolders CloudFolder[] @relation("PatientCloudFolder")
|
||||
serviceHistory PatientServiceHistory[]
|
||||
preauthHistory PatientPreauthHistory[]
|
||||
allergies String?
|
||||
medicalConditions String?
|
||||
preferredLanguage String? @default("English")
|
||||
status PatientStatus @default(UNKNOWN)
|
||||
remainingBenefit String?
|
||||
thirdPartyInsurance String?
|
||||
userId Int
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
appointments Appointment[]
|
||||
procedures AppointmentProcedure[]
|
||||
claims Claim[]
|
||||
groups PdfGroup[]
|
||||
payment Payment[]
|
||||
communications Communication[]
|
||||
documents PatientDocument[]
|
||||
conversation PatientConversation?
|
||||
cloudFolders CloudFolder[] @relation("PatientCloudFolder")
|
||||
serviceHistory PatientServiceHistory[]
|
||||
preauthHistory PatientPreauthHistory[]
|
||||
|
||||
@@index([insuranceId])
|
||||
@@index([createdAt])
|
||||
@@ -164,14 +167,14 @@ model Staff {
|
||||
}
|
||||
|
||||
model NpiProvider {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
npiNumber String
|
||||
providerName String
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
npiNumber String
|
||||
providerName String
|
||||
/// State dental license (ADA claim form item 55)
|
||||
licenseNumber String?
|
||||
sortOrder Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
sortOrder Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
claims Claim[]
|
||||
@@ -184,14 +187,13 @@ model NpiProvider {
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
|
||||
enum ProcedureSource {
|
||||
COMBO
|
||||
MANUAL
|
||||
}
|
||||
|
||||
model AppointmentProcedure {
|
||||
id Int @id @default(autoincrement())
|
||||
id Int @id @default(autoincrement())
|
||||
appointmentId Int
|
||||
patientId Int
|
||||
npiProviderId Int?
|
||||
@@ -269,23 +271,23 @@ enum MissingTeethStatus {
|
||||
}
|
||||
|
||||
model ServiceLine {
|
||||
id Int @id @default(autoincrement())
|
||||
claimId Int?
|
||||
paymentId Int?
|
||||
procedureCode String
|
||||
procedureDate DateTime @db.Date
|
||||
quad String?
|
||||
arch String?
|
||||
toothNumber String?
|
||||
toothSurface String?
|
||||
icn String?
|
||||
paidCode String?
|
||||
allowedAmount Decimal? @db.Decimal(10, 2)
|
||||
totalBilled Decimal @db.Decimal(10, 2)
|
||||
totalPaid Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
totalAdjusted Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
totalDue Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
status ServiceLineStatus @default(UNPAID)
|
||||
id Int @id @default(autoincrement())
|
||||
claimId Int?
|
||||
paymentId Int?
|
||||
procedureCode String
|
||||
procedureDate DateTime @db.Date
|
||||
quad String?
|
||||
arch String?
|
||||
toothNumber String?
|
||||
toothSurface String?
|
||||
icn String?
|
||||
paidCode String?
|
||||
allowedAmount Decimal? @db.Decimal(10, 2)
|
||||
totalBilled Decimal @db.Decimal(10, 2)
|
||||
totalPaid Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
totalAdjusted Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
totalDue Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
status ServiceLineStatus @default(UNPAID)
|
||||
|
||||
claim Claim? @relation(fields: [claimId], references: [id], onDelete: Cascade)
|
||||
payment Payment? @relation(fields: [paymentId], references: [id], onDelete: Cascade)
|
||||
@@ -327,10 +329,10 @@ model InsuranceCredential {
|
||||
}
|
||||
|
||||
model ShoppingVendor {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
vendorName String
|
||||
websiteUrl String
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
vendorName String
|
||||
websiteUrl String
|
||||
loginUsername String
|
||||
loginPassword String
|
||||
|
||||
@@ -488,8 +490,8 @@ enum NotificationTypes {
|
||||
// Cron job execution log
|
||||
model CronJobLog {
|
||||
id Int @id @default(autoincrement())
|
||||
jobName String // e.g. "local-backup", "usb-backup"
|
||||
status String // "success" | "failed" | "skipped"
|
||||
jobName String // e.g. "local-backup", "usb-backup"
|
||||
status String // "success" | "failed" | "skipped"
|
||||
startedAt DateTime
|
||||
completedAt DateTime?
|
||||
durationMs Int?
|
||||
@@ -588,7 +590,7 @@ model Communication {
|
||||
status CommunicationStatus
|
||||
// Which platform produced twilioSid — twilio for dial-pad-originated calls,
|
||||
// telnyx for everything else (SMS, inbound/AI voice, staff-triggered outbound calls).
|
||||
provider CommunicationProvider @default(twilio)
|
||||
provider CommunicationProvider @default(twilio)
|
||||
|
||||
body String?
|
||||
callDuration Int?
|
||||
@@ -605,16 +607,16 @@ model Communication {
|
||||
}
|
||||
|
||||
model PatientDocument {
|
||||
id Int @id @default(autoincrement())
|
||||
patientId Int
|
||||
filename String
|
||||
id Int @id @default(autoincrement())
|
||||
patientId Int
|
||||
filename String
|
||||
originalName String
|
||||
mimeType String
|
||||
fileSize BigInt
|
||||
filePath String
|
||||
uploadedAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
||||
mimeType String
|
||||
fileSize BigInt
|
||||
filePath String
|
||||
uploadedAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([patientId])
|
||||
@@index([uploadedAt])
|
||||
@@ -822,7 +824,7 @@ model CommissionBatch {
|
||||
}
|
||||
|
||||
model CommissionBatchItem {
|
||||
id Int @id @default(autoincrement())
|
||||
id Int @id @default(autoincrement())
|
||||
commissionBatchId Int
|
||||
paymentId Int
|
||||
collectionAmount Decimal @db.Decimal(14, 2)
|
||||
|
||||
Reference in New Issue
Block a user