fix: UnitedDH pre-auth number extraction, service lines saved, RCT combo buttons

- Pre-auth step9: scan all table cells alphanumeric-first (A0260616190876 format),
  URL extraction, body scan fallback with debug logging
- Pre-auth route: save service lines (totalBilled) when creating PREAUTH claim record
  so claim page shows correct billed amount after selecting patient
- Pre-auth processor: read pdf_path fallback alongside pdf_url from Selenium result
- UnitedDH/SCO workers: billing entity selection via direct paymentGroupId click,
  Summit Dental Care first with fallback, Escape to close dropdown
- Pre-auth form: remove Other Insurance step (not present on pre-auth page),
  file upload direct to hidden input without button click
- Pre-auth step8: JS click + Submit Authorization in XPath, Continue via [last()] + JS click
- RCT combo buttons added (pre-auth form only): RCT Ant/Post/Crown, PreM/Post/Crown,
  Mol/Post/Crown; claim form excludes these three combos

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ff
2026-06-16 17:34:45 -04:00
parent a04176538e
commit 43340ab39d
8 changed files with 207 additions and 112 deletions

View File

@@ -148,7 +148,7 @@ export async function runUnitedDHPreAuthProcessor(
}
const preAuthNumber: string | undefined = seleniumResult.preAuthNumber ?? undefined;
const pdf_url: string | undefined = seleniumResult.pdf_url ?? undefined;
const pdf_url: string | undefined = seleniumResult.pdf_url ?? seleniumResult.pdf_path ?? undefined;
if (claimId) {
try {

View File

@@ -62,6 +62,24 @@ router.post("/uniteddh-preauth", async (req: Request, res: Response): Promise<an
const dob = claimData.dateOfBirth
? new Date(claimData.dateOfBirth)
: new Date("2000-01-01");
const rawLines = Array.isArray(claimData.serviceLines) ? claimData.serviceLines : [];
const serviceLinesInput = rawLines.length > 0
? {
create: rawLines.map((sl: any) => ({
procedureCode: sl.procedureCode ?? "",
procedureDate: sl.procedureDate ? new Date(sl.procedureDate) : serviceDate,
quad: sl.quad ?? "",
arch: sl.arch ?? "",
toothNumber: sl.toothNumber ?? "",
toothSurface: sl.toothSurface ?? "",
totalBilled: Number(sl.totalBilled ?? 0),
totalAdjusted: Number(sl.totalAdjusted ?? 0),
totalPaid: Number(sl.totalPaid ?? 0),
})),
}
: undefined;
const record = await storage.createClaim({
patientId: Number(claimData.patientId),
appointmentId: claimData.appointmentId ? Number(claimData.appointmentId) : null,
@@ -75,9 +93,10 @@ router.post("/uniteddh-preauth", async (req: Request, res: Response): Promise<an
serviceDate,
insuranceProvider: "United/DentalHub",
status: "PREAUTH",
...(serviceLinesInput ? { serviceLines: serviceLinesInput } : {}),
} as any);
claimId = record.id;
console.log(`[uniteddh-preauth route] created claim record id=${claimId}`);
console.log(`[uniteddh-preauth route] created claim record id=${claimId} with ${rawLines.length} service line(s)`);
} catch (e: any) {
console.error("[uniteddh-preauth route] failed to create claim record:", e?.message);
}