feat: share patients across all users
Removed per-user patient filtering so all staff accounts see the same patient pool. Previously each user only saw patients they created. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -145,6 +145,7 @@ exports.Prisma.PatientScalarFieldEnum = {
|
||||
policyHolder: 'policyHolder',
|
||||
allergies: 'allergies',
|
||||
medicalConditions: 'medicalConditions',
|
||||
preferredLanguage: 'preferredLanguage',
|
||||
status: 'status',
|
||||
userId: 'userId',
|
||||
createdAt: 'createdAt',
|
||||
@@ -164,6 +165,7 @@ exports.Prisma.AppointmentScalarFieldEnum = {
|
||||
notes: 'notes',
|
||||
procedureCodeNotes: 'procedureCodeNotes',
|
||||
status: 'status',
|
||||
movedByAi: 'movedByAi',
|
||||
createdAt: 'createdAt',
|
||||
eligibilityStatus: 'eligibilityStatus'
|
||||
};
|
||||
@@ -229,6 +231,7 @@ exports.Prisma.ClaimScalarFieldEnum = {
|
||||
updatedAt: 'updatedAt',
|
||||
status: 'status',
|
||||
claimNumber: 'claimNumber',
|
||||
preAuthNumber: 'preAuthNumber',
|
||||
npiProviderId: 'npiProviderId'
|
||||
};
|
||||
|
||||
@@ -242,6 +245,9 @@ exports.Prisma.ServiceLineScalarFieldEnum = {
|
||||
arch: 'arch',
|
||||
toothNumber: 'toothNumber',
|
||||
toothSurface: 'toothSurface',
|
||||
icn: 'icn',
|
||||
paidCode: 'paidCode',
|
||||
allowedAmount: 'allowedAmount',
|
||||
totalBilled: 'totalBilled',
|
||||
totalPaid: 'totalPaid',
|
||||
totalAdjusted: 'totalAdjusted',
|
||||
@@ -265,6 +271,15 @@ exports.Prisma.InsuranceCredentialScalarFieldEnum = {
|
||||
password: 'password'
|
||||
};
|
||||
|
||||
exports.Prisma.ShoppingVendorScalarFieldEnum = {
|
||||
id: 'id',
|
||||
userId: 'userId',
|
||||
vendorName: 'vendorName',
|
||||
websiteUrl: 'websiteUrl',
|
||||
loginUsername: 'loginUsername',
|
||||
loginPassword: 'loginPassword'
|
||||
};
|
||||
|
||||
exports.Prisma.PdfGroupScalarFieldEnum = {
|
||||
id: 'id',
|
||||
title: 'title',
|
||||
@@ -287,10 +302,14 @@ exports.Prisma.PaymentScalarFieldEnum = {
|
||||
patientId: 'patientId',
|
||||
userId: 'userId',
|
||||
updatedById: 'updatedById',
|
||||
npiProviderId: 'npiProviderId',
|
||||
totalBilled: 'totalBilled',
|
||||
totalPaid: 'totalPaid',
|
||||
totalAdjusted: 'totalAdjusted',
|
||||
totalDue: 'totalDue',
|
||||
mhPaidAmount: 'mhPaidAmount',
|
||||
copayment: 'copayment',
|
||||
adjustment: 'adjustment',
|
||||
status: 'status',
|
||||
notes: 'notes',
|
||||
icn: 'icn',
|
||||
@@ -414,7 +433,9 @@ exports.Prisma.TwilioSettingsScalarFieldEnum = {
|
||||
exports.Prisma.AiSettingsScalarFieldEnum = {
|
||||
id: 'id',
|
||||
userId: 'userId',
|
||||
apiKey: 'apiKey'
|
||||
apiKey: 'apiKey',
|
||||
afterHoursEnabled: 'afterHoursEnabled',
|
||||
openPhoneReply: 'openPhoneReply'
|
||||
};
|
||||
|
||||
exports.Prisma.OfficeHoursScalarFieldEnum = {
|
||||
@@ -426,11 +447,24 @@ exports.Prisma.OfficeHoursScalarFieldEnum = {
|
||||
exports.Prisma.OfficeContactScalarFieldEnum = {
|
||||
id: 'id',
|
||||
userId: 'userId',
|
||||
officeName: 'officeName',
|
||||
receptionistName: 'receptionistName',
|
||||
dentistName: 'dentistName',
|
||||
phoneNumber: 'phoneNumber',
|
||||
email: 'email',
|
||||
fax: 'fax'
|
||||
fax: 'fax',
|
||||
streetAddress: 'streetAddress',
|
||||
city: 'city',
|
||||
state: 'state',
|
||||
zipCode: 'zipCode'
|
||||
};
|
||||
|
||||
exports.Prisma.InsuranceContactScalarFieldEnum = {
|
||||
id: 'id',
|
||||
userId: 'userId',
|
||||
name: 'name',
|
||||
phoneNumber: 'phoneNumber',
|
||||
createdAt: 'createdAt'
|
||||
};
|
||||
|
||||
exports.Prisma.ProcedureTimeslotScalarFieldEnum = {
|
||||
@@ -439,6 +473,31 @@ exports.Prisma.ProcedureTimeslotScalarFieldEnum = {
|
||||
data: 'data'
|
||||
};
|
||||
|
||||
exports.Prisma.PatientConversationScalarFieldEnum = {
|
||||
id: 'id',
|
||||
patientId: 'patientId',
|
||||
userId: 'userId',
|
||||
stage: 'stage',
|
||||
aiHandoff: 'aiHandoff',
|
||||
updatedAt: 'updatedAt'
|
||||
};
|
||||
|
||||
exports.Prisma.CommissionBatchScalarFieldEnum = {
|
||||
id: 'id',
|
||||
npiProviderId: 'npiProviderId',
|
||||
totalCollection: 'totalCollection',
|
||||
commissionAmount: 'commissionAmount',
|
||||
notes: 'notes',
|
||||
createdAt: 'createdAt'
|
||||
};
|
||||
|
||||
exports.Prisma.CommissionBatchItemScalarFieldEnum = {
|
||||
id: 'id',
|
||||
commissionBatchId: 'commissionBatchId',
|
||||
paymentId: 'paymentId',
|
||||
collectionAmount: 'collectionAmount'
|
||||
};
|
||||
|
||||
exports.Prisma.SortOrder = {
|
||||
asc: 'asc',
|
||||
desc: 'desc'
|
||||
@@ -491,7 +550,8 @@ exports.ClaimStatus = exports.$Enums.ClaimStatus = {
|
||||
APPROVED: 'APPROVED',
|
||||
CANCELLED: 'CANCELLED',
|
||||
REVIEW: 'REVIEW',
|
||||
VOID: 'VOID'
|
||||
VOID: 'VOID',
|
||||
PREAUTH: 'PREAUTH'
|
||||
};
|
||||
|
||||
exports.ServiceLineStatus = exports.$Enums.ServiceLineStatus = {
|
||||
@@ -568,6 +628,7 @@ exports.Prisma.ModelName = {
|
||||
ServiceLine: 'ServiceLine',
|
||||
ClaimFile: 'ClaimFile',
|
||||
InsuranceCredential: 'InsuranceCredential',
|
||||
ShoppingVendor: 'ShoppingVendor',
|
||||
PdfGroup: 'PdfGroup',
|
||||
PdfFile: 'PdfFile',
|
||||
Payment: 'Payment',
|
||||
@@ -585,7 +646,11 @@ exports.Prisma.ModelName = {
|
||||
AiSettings: 'AiSettings',
|
||||
OfficeHours: 'OfficeHours',
|
||||
OfficeContact: 'OfficeContact',
|
||||
ProcedureTimeslot: 'ProcedureTimeslot'
|
||||
InsuranceContact: 'InsuranceContact',
|
||||
ProcedureTimeslot: 'ProcedureTimeslot',
|
||||
PatientConversation: 'PatientConversation',
|
||||
CommissionBatch: 'CommissionBatch',
|
||||
CommissionBatchItem: 'CommissionBatchItem'
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
10444
packages/db/generated/prisma/index.d.ts
vendored
10444
packages/db/generated/prisma/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "prisma-client-739d12442b0153003c2c61c3294d05ecee806c9039d5ecd310b332b3c1eca2ec",
|
||||
"name": "prisma-client-763f714d62d731c0b365e1acdf19cac05ed4e6562d30b17cc8ffd11e6278eb14",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"browser": "default.js",
|
||||
|
||||
@@ -30,6 +30,7 @@ model User {
|
||||
npiProviders NpiProvider[]
|
||||
claims Claim[]
|
||||
insuranceCredentials InsuranceCredential[]
|
||||
shoppingVendors ShoppingVendor[]
|
||||
updatedPayments Payment[] @relation("PaymentUpdatedBy")
|
||||
backups DatabaseBackup[]
|
||||
backupDestinations BackupDestination[]
|
||||
@@ -42,6 +43,8 @@ model User {
|
||||
officeHours OfficeHours?
|
||||
officeContact OfficeContact?
|
||||
procedureTimeslot ProcedureTimeslot?
|
||||
insuranceContacts InsuranceContact[]
|
||||
patientConversations PatientConversation[]
|
||||
}
|
||||
|
||||
model Patient {
|
||||
@@ -61,6 +64,7 @@ model Patient {
|
||||
policyHolder String?
|
||||
allergies String?
|
||||
medicalConditions String?
|
||||
preferredLanguage String? @default("English")
|
||||
status PatientStatus @default(UNKNOWN)
|
||||
userId Int
|
||||
createdAt DateTime @default(now())
|
||||
@@ -73,6 +77,7 @@ model Patient {
|
||||
payment Payment[]
|
||||
communications Communication[]
|
||||
documents PatientDocument[]
|
||||
conversation PatientConversation?
|
||||
|
||||
@@index([insuranceId])
|
||||
@@index([createdAt])
|
||||
@@ -98,6 +103,7 @@ model Appointment {
|
||||
notes String?
|
||||
procedureCodeNotes String?
|
||||
status String @default("scheduled") // "scheduled", "completed", "cancelled", "no-show"
|
||||
movedByAi Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
eligibilityStatus PatientStatus @default(UNKNOWN)
|
||||
@@ -147,6 +153,8 @@ model NpiProvider {
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
claims Claim[]
|
||||
payments Payment[]
|
||||
commissionBatches CommissionBatch[]
|
||||
appointmentProcedures AppointmentProcedure[]
|
||||
|
||||
@@unique([userId, npiNumber])
|
||||
@@ -190,7 +198,7 @@ model AppointmentProcedure {
|
||||
model Claim {
|
||||
id Int @id @default(autoincrement())
|
||||
patientId Int
|
||||
appointmentId Int
|
||||
appointmentId Int?
|
||||
userId Int
|
||||
staffId Int
|
||||
patientName String
|
||||
@@ -205,10 +213,11 @@ model Claim {
|
||||
updatedAt DateTime @updatedAt
|
||||
status ClaimStatus @default(PENDING)
|
||||
claimNumber String?
|
||||
preAuthNumber String?
|
||||
npiProviderId Int?
|
||||
|
||||
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
||||
appointment Appointment @relation(fields: [appointmentId], 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])
|
||||
@@ -224,6 +233,7 @@ enum ClaimStatus {
|
||||
CANCELLED
|
||||
REVIEW
|
||||
VOID
|
||||
PREAUTH
|
||||
}
|
||||
|
||||
enum MissingTeethStatus {
|
||||
@@ -242,6 +252,9 @@ model ServiceLine {
|
||||
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)
|
||||
@@ -287,6 +300,19 @@ model InsuranceCredential {
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
model ShoppingVendor {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
vendorName String
|
||||
websiteUrl String
|
||||
loginUsername String
|
||||
loginPassword String
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
model PdfGroup {
|
||||
id Int @id @default(autoincrement())
|
||||
title String
|
||||
@@ -325,10 +351,14 @@ model Payment {
|
||||
patientId Int
|
||||
userId Int
|
||||
updatedById Int?
|
||||
npiProviderId Int?
|
||||
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 @db.Decimal(10, 2)
|
||||
mhPaidAmount Decimal? @db.Decimal(10, 2)
|
||||
copayment Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
adjustment Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
status PaymentStatus @default(PENDING)
|
||||
notes String?
|
||||
icn String?
|
||||
@@ -338,8 +368,10 @@ model Payment {
|
||||
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])
|
||||
npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])
|
||||
serviceLineTransactions ServiceLineTransaction[]
|
||||
serviceLines ServiceLine[]
|
||||
commissionBatchItems CommissionBatchItem[]
|
||||
|
||||
@@index([claimId])
|
||||
@@index([patientId])
|
||||
@@ -564,9 +596,11 @@ model TwilioSettings {
|
||||
}
|
||||
|
||||
model AiSettings {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int @unique
|
||||
apiKey String
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int @unique
|
||||
apiKey String
|
||||
afterHoursEnabled Boolean @default(true)
|
||||
openPhoneReply Boolean @default(false)
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@ -586,17 +620,34 @@ model OfficeHours {
|
||||
model OfficeContact {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int @unique
|
||||
officeName String?
|
||||
receptionistName String?
|
||||
dentistName String?
|
||||
phoneNumber String?
|
||||
email String?
|
||||
fax String?
|
||||
streetAddress String?
|
||||
city String?
|
||||
state String?
|
||||
zipCode String?
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("office_contact")
|
||||
}
|
||||
|
||||
model InsuranceContact {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
name String
|
||||
phoneNumber String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("insurance_contact")
|
||||
}
|
||||
|
||||
model ProcedureTimeslot {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int @unique
|
||||
@@ -606,3 +657,45 @@ model ProcedureTimeslot {
|
||||
|
||||
@@map("procedure_timeslot")
|
||||
}
|
||||
|
||||
model PatientConversation {
|
||||
id Int @id @default(autoincrement())
|
||||
patientId Int @unique
|
||||
userId Int
|
||||
stage String @default("initial")
|
||||
aiHandoff Boolean @default(true)
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("patient_conversation")
|
||||
}
|
||||
|
||||
// Commission tracking
|
||||
model CommissionBatch {
|
||||
id Int @id @default(autoincrement())
|
||||
npiProviderId Int
|
||||
totalCollection Decimal @db.Decimal(14, 2)
|
||||
commissionAmount Decimal @db.Decimal(14, 2)
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
npiProvider NpiProvider @relation(fields: [npiProviderId], references: [id])
|
||||
items CommissionBatchItem[]
|
||||
|
||||
@@index([npiProviderId])
|
||||
}
|
||||
|
||||
model CommissionBatchItem {
|
||||
id Int @id @default(autoincrement())
|
||||
commissionBatchId Int
|
||||
paymentId Int
|
||||
collectionAmount Decimal @db.Decimal(14, 2)
|
||||
|
||||
commissionBatch CommissionBatch @relation(fields: [commissionBatchId], references: [id], onDelete: Cascade)
|
||||
payment Payment @relation(fields: [paymentId], references: [id])
|
||||
|
||||
@@unique([commissionBatchId, paymentId])
|
||||
@@index([paymentId])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user