feat: MassHealth service history extraction, shown in Patient Details

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-05 08:38:13 -05:00
co-authored by Claude Opus 5.5
parent 1ee3b0cfc9
commit 33bea3822c
172 changed files with 4044 additions and 127 deletions
+27 -9
View File
@@ -56,16 +56,16 @@ model User {
}
model Patient {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
firstName String
lastName String
dateOfBirth DateTime? @db.Date
dateOfBirth DateTime? @db.Date
gender String
phone String
email String?
address String?
city String?
state String? @default("MA")
state String? @default("MA")
zipCode String?
insuranceProvider String?
insuranceId String?
@@ -75,14 +75,14 @@ model Patient {
policyHolderRelationship String? // ADA box 18: SELF | SPOUSE | DEPENDENT | OTHER
allergies String?
medicalConditions String?
preferredLanguage String? @default("English")
status PatientStatus @default(UNKNOWN)
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])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
appointments Appointment[]
procedures AppointmentProcedure[]
claims Claim[]
@@ -91,7 +91,8 @@ model Patient {
communications Communication[]
documents PatientDocument[]
conversation PatientConversation?
cloudFolders CloudFolder[] @relation("PatientCloudFolder")
cloudFolders CloudFolder[] @relation("PatientCloudFolder")
serviceHistory PatientServiceHistory[]
@@index([insuranceId])
@@index([createdAt])
@@ -744,6 +745,23 @@ model PatientConversation {
@@map("patient_conversation")
}
// Snapshot of the MassHealth Service History table, replaced on each eligibility check
model PatientServiceHistory {
id Int @id @default(autoincrement())
patientId Int
procedureCode String
description String?
toothQuadArchSurface String?
placeOfService String?
serviceDate String? // as shown by the portal, e.g. 10/15/2026
createdAt DateTime @default(now())
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
@@index([patientId])
@@map("patient_service_history")
}
model LabRxTemplate {
id Int @id @default(autoincrement())
userId Int