feat: BCBS AI column claim fills ADA form, saves to Documents; form fixes
- Claim for column with AI: BCBS patients auto-generate the 2024 ADA form (no tab) and save it to the patient's Documents > Claims folder; the manual BCBS button saves there too (new POST /api/claims/:id/ada-form) - Saved BCBS form sets the claim to REVIEW; appointments with a claim number or REVIEW/APPROVED status show as claimed (dark gray) - CDT lookup: "comp on #18 O, 20 O, 21 O" applies composite to every tooth - BCBS fee schedule (procedureCodesBCBS.json, copied from DDMA prices) - Office Contact: Legal Name field; "Dental Office Name (DBA)" label - ADA form: 48 = legal name, DBA, address; 56 = address only; 53 date = claim date; 23 and 26 left blank; 43 = No unless appointment notes say a prosthesis is replaced (then Yes, with 44 prior date when given) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -66,7 +66,7 @@ import {
|
||||
} from "@/components/procedure/procedure-combo-buttons";
|
||||
import { inferTypeFromProcedureCodes, getAppointmentTypeLabel } from "@/utils/appointmentTypeUtils";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { openPendingTab, showAdaClaimForm } from "@/utils/adaClaimForm";
|
||||
import { openPendingTab, saveAdaClaimForm, showAdaClaimForm } from "@/utils/adaClaimForm";
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
@@ -1564,7 +1564,7 @@ export function ClaimForm({
|
||||
} else if (siteKey === "UNITEDUCARD" || siteKey === "UNITED_UCARD") {
|
||||
runWithPriceCheck(handleUnitedUcardClaim);
|
||||
} else if (siteKey === "BCBS" || siteKey === "BCBS_MA") {
|
||||
runWithPriceCheck(handleBCBSClaim);
|
||||
runWithPriceCheck(() => handleBCBSClaim());
|
||||
} else {
|
||||
toast({
|
||||
title: "No automated claim for this insurance",
|
||||
@@ -1893,10 +1893,15 @@ export function ClaimForm({
|
||||
// No Selenium action — works like a real MassHealth claim for payment/report tracking.
|
||||
// BCBS MA has no online claim submission: save the claim, then open the filled
|
||||
// 2024 ADA paper form to print, sign and mail.
|
||||
const handleBCBSClaim = async () => {
|
||||
// `auto` (AI claim queue): no tab — just save the filled form to Documents > Claims.
|
||||
const handleBCBSClaim = async (
|
||||
formToUse?: ClaimFormData & { uploadedFiles?: File[] },
|
||||
{ auto = false }: { auto?: boolean } = {},
|
||||
) => {
|
||||
const f = formToUse ?? form;
|
||||
const missingFields: string[] = [];
|
||||
if (!form.memberId?.trim()) missingFields.push("Member ID");
|
||||
if (!form.dateOfBirth?.trim()) missingFields.push("Date of Birth");
|
||||
if (!f.memberId?.trim()) missingFields.push("Member ID");
|
||||
if (!f.dateOfBirth?.trim()) missingFields.push("Date of Birth");
|
||||
if (!patient?.firstName?.trim()) missingFields.push("First Name");
|
||||
if (missingFields.length > 0) {
|
||||
toast({
|
||||
@@ -1907,7 +1912,7 @@ export function ClaimForm({
|
||||
return;
|
||||
}
|
||||
|
||||
const filteredServiceLines = form.serviceLines.filter(
|
||||
const filteredServiceLines = (f.serviceLines || []).filter(
|
||||
(line) => (line.procedureCode ?? "").trim() !== "",
|
||||
);
|
||||
if (filteredServiceLines.length === 0) {
|
||||
@@ -1920,10 +1925,10 @@ export function ClaimForm({
|
||||
}
|
||||
|
||||
// Open the tab before any await so the browser doesn't block it
|
||||
const tab = openPendingTab();
|
||||
const tab = auto ? null : openPendingTab();
|
||||
|
||||
const appointmentIdToUse = appointmentId ?? null;
|
||||
const { uploadedFiles, insuranceSiteKey, npiProvider, ...formToCreateClaim } = form;
|
||||
const { uploadedFiles, insuranceSiteKey, npiProvider, ...formToCreateClaim } = f;
|
||||
|
||||
try {
|
||||
const claimFilesMeta: ClaimFileMeta[] = mergeWithExistingAttachments(
|
||||
@@ -1945,10 +1950,16 @@ export function ClaimForm({
|
||||
...(selectedNpiProviderId ? { npiProviderId: selectedNpiProviderId } : {}),
|
||||
});
|
||||
|
||||
await showAdaClaimForm(createdClaim.id!, tab);
|
||||
if (auto) {
|
||||
await saveAdaClaimForm(createdClaim.id!);
|
||||
} else {
|
||||
await showAdaClaimForm(createdClaim.id!, tab, "BCBS_MA", { save: true });
|
||||
}
|
||||
// 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. Print the ADA form, sign it, and mail it to BCBS MA.",
|
||||
description: "Claim saved and ADA form added to the patient's Documents > Claims. Print, sign, and mail it to BCBS MA.",
|
||||
});
|
||||
onClose();
|
||||
} catch (err: any) {
|
||||
@@ -2106,6 +2117,8 @@ export function ClaimForm({
|
||||
handleUnitedDHClaim(pricedForm);
|
||||
} else if (key === "united_ucard" || key === "uniteducard" || key === "ucard") {
|
||||
handleUnitedUcardClaim(pricedForm);
|
||||
} else if (key === "bcbs" || key === "bcbs_ma") {
|
||||
handleBCBSClaim(pricedForm, { auto: true });
|
||||
} else {
|
||||
handleMHSubmit(pricedForm);
|
||||
}
|
||||
@@ -2773,7 +2786,7 @@ export function ClaimForm({
|
||||
</Button>
|
||||
<Button
|
||||
className="w-44 bg-sky-700 hover:bg-sky-800 text-white"
|
||||
onClick={() => runWithPriceCheck(handleBCBSClaim)}
|
||||
onClick={() => runWithPriceCheck(() => handleBCBSClaim())}
|
||||
title="Save the claim and open a filled ADA paper form to print and mail"
|
||||
>
|
||||
BCBS Claim (ADA Form)
|
||||
|
||||
@@ -6,6 +6,7 @@ import { apiRequest, queryClient } from "@/lib/queryClient";
|
||||
|
||||
type OfficeContact = {
|
||||
id?: number;
|
||||
legalName?: string | null;
|
||||
officeName?: string | null;
|
||||
receptionistName?: string | null;
|
||||
dentistName?: string | null;
|
||||
@@ -21,6 +22,7 @@ type OfficeContact = {
|
||||
export function OfficeContactCard() {
|
||||
const { toast } = useToast();
|
||||
|
||||
const [legalName, setLegalName] = useState("");
|
||||
const [officeName, setOfficeName] = useState("");
|
||||
const [receptionistName, setReceptionistName] = useState("");
|
||||
const [dentistName, setDentistName] = useState("");
|
||||
@@ -43,6 +45,7 @@ export function OfficeContactCard() {
|
||||
|
||||
useEffect(() => {
|
||||
if (contact) {
|
||||
setLegalName(contact.legalName ?? "");
|
||||
setOfficeName(contact.officeName ?? "");
|
||||
setReceptionistName(contact.receptionistName ?? "");
|
||||
setDentistName(contact.dentistName ?? "");
|
||||
@@ -76,7 +79,7 @@ export function OfficeContactCard() {
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
saveMutation.mutate({ officeName, receptionistName, dentistName, phoneNumber, email, fax, streetAddress, city, state, zipCode });
|
||||
saveMutation.mutate({ legalName, officeName, receptionistName, dentistName, phoneNumber, email, fax, streetAddress, city, state, zipCode });
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -94,7 +97,18 @@ export function OfficeContactCard() {
|
||||
) : (
|
||||
<form className="space-y-4" onSubmit={handleSubmit}>
|
||||
<div>
|
||||
<label className="block text-sm font-medium">Dental Office Name</label>
|
||||
<label className="block text-sm font-medium">Legal Name</label>
|
||||
<input
|
||||
type="text"
|
||||
value={legalName}
|
||||
onChange={(e) => setLegalName(e.target.value)}
|
||||
className="mt-1 p-2 border rounded w-full text-sm"
|
||||
placeholder="e.g. Kai Gao DMD LLC"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium">Dental Office Name (DBA)</label>
|
||||
<input
|
||||
type="text"
|
||||
value={officeName}
|
||||
|
||||
Reference in New Issue
Block a user