feat: Preauth column for AI claims; searchable policy holder + ADA box 18; 2PA fix

- Schedule: last column is the Preauth column; "Claim for Column with AI" is now
  "Claim/Preauth for Column with AI" — that column's appointments go to PreAuth
  (MH, CCA, Tufts SCO, United/DentalHub; other insurances are skipped), the rest
  to Claim. Preauthorized appointments (hasPreauth) aren't resubmitted
- PreAuth payloads carry appointmentId; appointment X-rays/attachments are sent
  with MH/CCA/UnitedDH/Tufts preauths (shared appendAppointmentFiles helper)
- Patient form: policy holder is searchable from patients in the DB, plus
  "Relationship to Policy Holder/Subscriber" (Self, Spouse, Dependent Child,
  Other). New Patient columns policyHolderPatientId, policyHolderRelationship;
  browser-side schema updated so the fields aren't stripped on save
- ADA form: box 12-14 filled from the linked policy holder's record; box 18
  ticks the relationship (Self when the patient is the holder)
- AI notes: a bare "2PA" is an image count, not tooth #2 — restored before CDT
  lookup so it maps to D0220 #8 / D0230 #24

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 21:09:51 -04:00
co-authored by Claude Opus 5.5
parent c3efdc7f8e
commit 44a1a41efa
261 changed files with 2159 additions and 195 deletions
@@ -15,6 +15,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: z.ZodString;
groupNumber: z.ZodString;
policyHolder: z.ZodString;
policyHolderPatientId: z.ZodNumber;
policyHolderRelationship: z.ZodString;
allergies: z.ZodString;
medicalConditions: z.ZodString;
preferredLanguage: z.ZodString;
@@ -39,6 +41,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: z.ZodNumber;
groupNumber: z.ZodNumber;
policyHolder: z.ZodNumber;
policyHolderPatientId: z.ZodNumber;
policyHolderRelationship: z.ZodNumber;
allergies: z.ZodNumber;
medicalConditions: z.ZodNumber;
preferredLanguage: z.ZodNumber;
@@ -85,6 +89,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: number;
groupNumber: number;
policyHolder: number;
policyHolderPatientId: number;
policyHolderRelationship: number;
allergies: number;
medicalConditions: number;
preferredLanguage: number;
@@ -120,6 +126,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: number;
groupNumber: number;
policyHolder: number;
policyHolderPatientId: number;
policyHolderRelationship: number;
allergies: number;
medicalConditions: number;
preferredLanguage: number;
@@ -131,23 +139,29 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
}>>;
_sum: z.ZodOptional<z.ZodNullable<z.ZodObject<{
id: z.ZodNullable<z.ZodNumber>;
policyHolderPatientId: z.ZodNullable<z.ZodNumber>;
userId: z.ZodNullable<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
id: number | null;
userId: number | null;
policyHolderPatientId: number | null;
}, {
id: number | null;
userId: number | null;
policyHolderPatientId: number | null;
}>>>;
_avg: z.ZodOptional<z.ZodNullable<z.ZodObject<{
id: z.ZodNullable<z.ZodNumber>;
policyHolderPatientId: z.ZodNullable<z.ZodNumber>;
userId: z.ZodNullable<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
id: number | null;
userId: number | null;
policyHolderPatientId: number | null;
}, {
id: number | null;
userId: number | null;
policyHolderPatientId: number | null;
}>>>;
_min: z.ZodOptional<z.ZodNullable<z.ZodObject<{
id: z.ZodNullable<z.ZodNumber>;
@@ -165,6 +179,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: z.ZodNullable<z.ZodString>;
groupNumber: z.ZodNullable<z.ZodString>;
policyHolder: z.ZodNullable<z.ZodString>;
policyHolderPatientId: z.ZodNullable<z.ZodNumber>;
policyHolderRelationship: z.ZodNullable<z.ZodString>;
allergies: z.ZodNullable<z.ZodString>;
medicalConditions: z.ZodNullable<z.ZodString>;
preferredLanguage: z.ZodNullable<z.ZodString>;
@@ -192,6 +208,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: string | null;
groupNumber: string | null;
policyHolder: string | null;
policyHolderPatientId: number | null;
policyHolderRelationship: string | null;
allergies: string | null;
medicalConditions: string | null;
preferredLanguage: string | null;
@@ -216,6 +234,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: string | null;
groupNumber: string | null;
policyHolder: string | null;
policyHolderPatientId: number | null;
policyHolderRelationship: string | null;
allergies: string | null;
medicalConditions: string | null;
preferredLanguage: string | null;
@@ -238,6 +258,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: z.ZodNullable<z.ZodString>;
groupNumber: z.ZodNullable<z.ZodString>;
policyHolder: z.ZodNullable<z.ZodString>;
policyHolderPatientId: z.ZodNullable<z.ZodNumber>;
policyHolderRelationship: z.ZodNullable<z.ZodString>;
allergies: z.ZodNullable<z.ZodString>;
medicalConditions: z.ZodNullable<z.ZodString>;
preferredLanguage: z.ZodNullable<z.ZodString>;
@@ -265,6 +287,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: string | null;
groupNumber: string | null;
policyHolder: string | null;
policyHolderPatientId: number | null;
policyHolderRelationship: string | null;
allergies: string | null;
medicalConditions: string | null;
preferredLanguage: string | null;
@@ -289,6 +313,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: string | null;
groupNumber: string | null;
policyHolder: string | null;
policyHolderPatientId: number | null;
policyHolderRelationship: string | null;
allergies: string | null;
medicalConditions: string | null;
preferredLanguage: string | null;
@@ -314,6 +340,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: string;
groupNumber: string;
policyHolder: string;
policyHolderPatientId: number;
policyHolderRelationship: string;
allergies: string;
medicalConditions: string;
preferredLanguage: string;
@@ -346,6 +374,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: number;
groupNumber: number;
policyHolder: number;
policyHolderPatientId: number;
policyHolderRelationship: number;
allergies: number;
medicalConditions: number;
preferredLanguage: number;
@@ -374,6 +404,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: string | null;
groupNumber: string | null;
policyHolder: string | null;
policyHolderPatientId: number | null;
policyHolderRelationship: string | null;
allergies: string | null;
medicalConditions: string | null;
preferredLanguage: string | null;
@@ -399,6 +431,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: string | null;
groupNumber: string | null;
policyHolder: string | null;
policyHolderPatientId: number | null;
policyHolderRelationship: string | null;
allergies: string | null;
medicalConditions: string | null;
preferredLanguage: string | null;
@@ -408,10 +442,12 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
_avg?: {
id: number | null;
userId: number | null;
policyHolderPatientId: number | null;
} | null | undefined;
_sum?: {
id: number | null;
userId: number | null;
policyHolderPatientId: number | null;
} | null | undefined;
}, {
id: number;
@@ -432,6 +468,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: string;
groupNumber: string;
policyHolder: string;
policyHolderPatientId: number;
policyHolderRelationship: string;
allergies: string;
medicalConditions: string;
preferredLanguage: string;
@@ -464,6 +502,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: number;
groupNumber: number;
policyHolder: number;
policyHolderPatientId: number;
policyHolderRelationship: number;
allergies: number;
medicalConditions: number;
preferredLanguage: number;
@@ -492,6 +532,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: string | null;
groupNumber: string | null;
policyHolder: string | null;
policyHolderPatientId: number | null;
policyHolderRelationship: string | null;
allergies: string | null;
medicalConditions: string | null;
preferredLanguage: string | null;
@@ -517,6 +559,8 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
insuranceId: string | null;
groupNumber: string | null;
policyHolder: string | null;
policyHolderPatientId: number | null;
policyHolderRelationship: string | null;
allergies: string | null;
medicalConditions: string | null;
preferredLanguage: string | null;
@@ -526,10 +570,12 @@ export declare const PatientGroupByResultSchema: z.ZodArray<z.ZodObject<{
_avg?: {
id: number | null;
userId: number | null;
policyHolderPatientId: number | null;
} | null | undefined;
_sum?: {
id: number | null;
userId: number | null;
policyHolderPatientId: number | null;
} | null | undefined;
}>, "many">;
//# sourceMappingURL=PatientGroupByResult.schema.d.ts.map