feat: Select Procedures flow, batch-column NPI provider fix, auto PDF save
- Add 'Select Procedures' right-click option on appointment page (separate from Claims/PreAuth) - Select Procedures form saves CDT codes + NPI provider to AppointmentProcedure storage - Remove Save button from insurance claim form; Claims/PreAuth opens for insurance submission only - Claims/PreAuth auto-prefills from saved procedures including NPI provider - Batch-column: procedures npiProviderId takes priority over stale claim npiProviderId - Batch-column: auto-save PDF to patient Documents after successful submission (no socket needed) - Add npiProviderId column to AppointmentProcedure table (prisma db push) - Fix 'invalid db creation invocation': guard staffId, npiProviderId, procedureDate as Date object, totalBilled NaN guard - Add full error logging to batch-column catch block Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -126,7 +126,9 @@ model NpiProvider {
|
||||
providerName String
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
claims Claim[]
|
||||
appointmentProcedures AppointmentProcedure[]
|
||||
|
||||
@@unique([userId, npiNumber])
|
||||
@@index([userId])
|
||||
@@ -142,6 +144,7 @@ model AppointmentProcedure {
|
||||
id Int @id @default(autoincrement())
|
||||
appointmentId Int
|
||||
patientId Int
|
||||
npiProviderId Int?
|
||||
|
||||
procedureCode String
|
||||
procedureLabel String?
|
||||
@@ -158,8 +161,9 @@ model AppointmentProcedure {
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)
|
||||
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
||||
appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)
|
||||
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
||||
npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])
|
||||
|
||||
@@index([appointmentId])
|
||||
@@index([patientId])
|
||||
@@ -183,11 +187,13 @@ model Claim {
|
||||
updatedAt DateTime @updatedAt
|
||||
status ClaimStatus @default(PENDING)
|
||||
claimNumber String?
|
||||
npiProviderId Int?
|
||||
|
||||
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])
|
||||
npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])
|
||||
|
||||
serviceLines ServiceLine[]
|
||||
claimFiles ClaimFile[]
|
||||
@@ -241,10 +247,11 @@ enum ServiceLineStatus {
|
||||
}
|
||||
|
||||
model ClaimFile {
|
||||
id Int @id @default(autoincrement())
|
||||
id Int @id @default(autoincrement())
|
||||
claimId Int
|
||||
filename String
|
||||
mimeType String
|
||||
filePath String?
|
||||
|
||||
claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
@@ -441,6 +448,7 @@ model CloudFile {
|
||||
folderId Int? // optional: null => root
|
||||
isComplete Boolean @default(false) // upload completed?
|
||||
totalChunks Int? // optional: expected number of chunks
|
||||
diskPath String? // relative path on disk under uploads/
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
|
||||
Reference in New Issue
Block a user