fix: AI claims/preauths keep all codes past 10; reuse CCA/DentalHub Chrome

- Claim form: AI claim/preauth prefill adds rows beyond the initial 10
  instead of dropping codes 11+
- CDT lookup: "D6010 #5, 9, 11, 12" expands to one line per tooth, and
  the chat graph rebuilds such lists from the message if the LLM drops items
- Eligibility: match an existing patient by name+DOB when the insurance ID
  changed (e.g. MassHealth → CCA) instead of creating a duplicate patient
- CCA PreAuth: services grid scrolls to reach rows 11+
- CCA and Tufts SCO PreAuth: tentative service date = today + 3 days
- CCA (eligibility/claim/preauth) and DentalHub (claim/preauth): keep Chrome
  open, blank and minimized, after a job so the next job reuses it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 01:27:28 -04:00
co-authored by Claude Opus 5.5
parent 8937a3390c
commit 143319909f
13 changed files with 218 additions and 63 deletions
@@ -125,6 +125,15 @@ export async function createOrUpdatePatientByInsuranceId(options: {
console.log(`[createOrUpdatePatient] id-only fallback (no DOB on record): found id=${patient.id}`);
}
}
if (!patient && incomingFirst && incomingLast) {
// Same person whose insurance changed (e.g. MassHealth → CCA): match by
// name+DOB and move them to the new insuranceId instead of duplicating.
const byNameDob = await storage.getPatientByNameAndDob(incomingFirst, incomingLast, dobDate);
if (byNameDob) {
patient = byNameDob;
console.log(`[createOrUpdatePatient] name+DOB fallback: found id=${patient.id} (insuranceId "${patient.insuranceId}" → "${normalizedId}")`);
}
}
} else {
// No DOB supplied — fall back to insuranceId-only (legacy / non-family plans)
patient = await storage.getPatientByInsuranceId(normalizedId);
@@ -138,6 +147,7 @@ export async function createOrUpdatePatientByInsuranceId(options: {
if (incomingLast && String(patient.lastName ?? "").trim() !== incomingLast)
updates.lastName = incomingLast;
if (dobDate && !patient.dateOfBirth) updates.dateOfBirth = dobDate;
if (String(patient.insuranceId ?? "") !== normalizedId) updates.insuranceId = normalizedId;
if (Object.keys(updates).length > 0) {
console.log(`[createOrUpdatePatient] updating patient id=${patient.id} with`, updates);
await storage.updatePatient(patient.id, updates);