feat: BCBS preauth via ADA form; preauth shows dark gray; claim/preauth download

- Preauth column: BCBS appointments fill the 2024 ADA form with box 1
  "Request for Predetermination/Preauthorization" (claim saved as PREAUTH),
  saved to Documents > PreAuth as ADA_PreAuth_*.pdf, then back to schedule
- Claim form PreAuth tab: "BCBS PreAuth (ADA Form)" button
- Preauth forms list procedure dates 6 days after the preauth date
- PREAUTH claims create no payment; saved BCBS preauths count as preauthorized
- Schedule: appointments with a completed preauth show dark gray
- "Download Filled Claim/Preauth Form" also zips the BCBS preauth forms

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 23:51:27 -04:00
co-authored by Claude Opus 5.5
parent 44a1a41efa
commit 2ca42bb15f
5 changed files with 79 additions and 28 deletions
@@ -1899,10 +1899,13 @@ export function ClaimForm({
// BCBS MA has no online claim submission: save the claim, then open the filled
// 2024 ADA paper form to print, sign and mail.
// `auto` (AI claim queue): no tab — just save the filled form to Documents > Claims.
// `preauth`: same ADA form with box 1 "Request for Predetermination/Preauthorization"
// ticked (claim saved as PREAUTH), saved to Documents > PreAuth.
const handleBCBSClaim = async (
formToUse?: ClaimFormData & { uploadedFiles?: File[] },
{ auto = false }: { auto?: boolean } = {},
{ auto = false, preauth = false }: { auto?: boolean; preauth?: boolean } = {},
) => {
const kind = preauth ? "preauth" : "claim";
const f = formToUse ?? form;
const missingFields: string[] = [];
if (!f.memberId?.trim()) missingFields.push("Member ID");
@@ -1923,7 +1926,7 @@ export function ClaimForm({
if (filteredServiceLines.length === 0) {
toast({
title: "No procedure codes",
description: "Please add at least one procedure code before creating the claim form.",
description: `Please add at least one procedure code before creating the ${kind} form.`,
variant: "destructive",
});
return;
@@ -1953,7 +1956,8 @@ export function ClaimForm({
appointmentId: appointmentIdToUse,
claimFiles: claimFilesMeta,
...(selectedNpiProviderId ? { npiProviderId: selectedNpiProviderId } : {}),
});
...(preauth ? { status: "PREAUTH" } : {}),
} as any);
if (auto) {
await saveAdaClaimForm(createdClaim.id!);
@@ -1963,15 +1967,17 @@ export function ClaimForm({
// Saving the form marks the claim submitted — show the appointment as claimed
queryClient.invalidateQueries({ queryKey: ["appointments", "day"] });
toast({
title: "BCBS claim form ready",
description: "Claim saved and ADA form added to the patient's Documents > Claims. Print, sign, and mail it to BCBS MA.",
title: preauth ? "BCBS preauth form ready" : "BCBS claim form ready",
description: preauth
? "PreAuth saved and ADA form added to the patient's Documents > PreAuth. Print, sign, and mail it to BCBS MA."
: "Claim saved and ADA form added to the patient's Documents > Claims. Print, sign, and mail it to BCBS MA.",
});
onClose();
} catch (err: any) {
tab?.close();
toast({
title: "BCBS claim failed",
description: err?.message ?? "Failed to create the ADA claim form.",
title: preauth ? "BCBS preauth failed" : "BCBS claim failed",
description: err?.message ?? `Failed to create the ADA ${kind} form.`,
variant: "destructive",
});
}
@@ -2144,6 +2150,13 @@ export function ClaimForm({
handleCCAPreAuth();
} else if (key === "united_sco" || key === "unitedco" || key === "dentalhub") {
handleUnitedDHPreAuth();
} else if (key === "bcbs" || key === "bcbs_ma") {
const pricedForm = mapPricesForForm({
form: { ...form, insuranceSiteKey: "bcbs" },
patientDOB: patient?.dateOfBirth ?? "",
insuranceSiteKey: "bcbs",
});
handleBCBSClaim(pricedForm, { auto: true, preauth: true });
} else {
// Re-apply fee-schedule prices with the now-loaded patient DOB before submitting —
// the earlier chatbot-prefill pass may have run before `patient` finished loading,
@@ -3331,6 +3344,13 @@ export function ClaimForm({
>
Tufts PreAuth
</Button>
<Button
className="w-44 bg-sky-700 hover:bg-sky-800 text-white"
onClick={() => handleBCBSClaim(undefined, { preauth: true })}
title="Save the preauth and open a filled ADA form (Request for Predetermination/Preauthorization) to print and mail"
>
BCBS PreAuth (ADA Form)
</Button>
</div>
</div>
</div>
@@ -119,6 +119,8 @@ const PREAUTH_SITE_KEYS: Record<string, string> = {
CCA: "CCA",
TUFTSSCO: "TUFTS_SCO",
UNITEDSCO: "UNITED_SCO",
BCBS: "BCBS", // paper ADA form, filled and saved to Documents > PreAuth
BCBSMA: "BCBS",
};
const toPreauthSiteKey = (siteKey: string): string | undefined =>
PREAUTH_SITE_KEYS[siteKey.replace(/_/g, "").toUpperCase()];
@@ -144,7 +146,8 @@ function deriveInsuranceSiteKey(provider: string | null | undefined): string {
}
function appointmentCardColor(apt: ScheduledAppointment): string {
if (apt.hasClaimWithNumber) return "bg-gray-500 text-white";
// Claimed, or preauth done (e.g. BCBS preauth ADA form saved)
if (apt.hasClaimWithNumber || apt.hasPreauth) return "bg-gray-500 text-white";
if (apt.hasProcedures) return "bg-blue-500 text-white";
return "bg-slate-100 text-gray-700 border-slate-300";
}
@@ -1537,12 +1540,12 @@ export default function AppointmentsPage() {
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = `filled_claim_forms_${formattedSelectedDate}.zip`;
a.download = `filled_claim_preauth_forms_${formattedSelectedDate}.zip`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
toast({ title: "Download started", description: `Filled claim forms for ${formattedSelectedDate} saved to your Downloads folder.` });
toast({ title: "Download started", description: `Filled claim/preauth forms for ${formattedSelectedDate} saved to your Downloads folder.` });
} catch (err: any) {
toast({ title: "Download failed", description: err?.message ?? String(err), variant: "destructive" });
} finally {
@@ -1736,7 +1739,7 @@ export default function AppointmentsPage() {
}));
}
// BCBS is a paper form filled and saved in the background — come straight back here
if (!isPreauth && /^bcbs/i.test(siteKey)) sessionStorage.setItem("ai_claim_return_to_schedule", "1");
if (/^bcbs/i.test(siteKey)) sessionStorage.setItem("ai_claim_return_to_schedule", "1");
else sessionStorage.removeItem("ai_claim_return_to_schedule");
setAiClaimModalOpen(false);
setLocation(`/claims?appointmentId=${appointmentId}`);
@@ -2129,7 +2132,7 @@ export default function AppointmentsPage() {
</div>
</div>
{/* Download Filled Claim Form: ADA forms (e.g. BCBS) for the selected date */}
{/* Download Filled Claim/Preauth Form: ADA forms (e.g. BCBS) for the selected date */}
<div className="flex items-center gap-2 border rounded-md px-3 py-2 bg-white shadow-sm">
<Button
onClick={() => handleDownloadClaimPdfs()}
@@ -2144,7 +2147,7 @@ export default function AppointmentsPage() {
) : (
<>
<Download className="h-4 w-4 mr-1" />
Download Filled Claim Form
Download Filled Claim/Preauth Form
</>
)}
</Button>