fix: auto-price CDT codes and fix crown/recement code mismatches
- Auto-fill service line price when a recognized CDT code is typed (e.g. D2740), instead of requiring a separate "Map Price" click - Fix chatbot preauth prefill using an empty DOB for price lookup, causing age-tiered codes (D2740) to price as $0 - Re-apply fee-schedule pricing with the loaded patient DOB before MassHealth preauth auto-submit - Add a "Recement Crown" (D2920) combo button distinct from "Crown" (D2740) to avoid picking the wrong code/price - Fix AI note parsing to prioritize "recement" over "crown" regardless of word order or tooth-number format (e.g. "#7 crown recement") Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -51,6 +51,9 @@ import {
|
||||
applyComboToForm,
|
||||
getDescriptionForCode,
|
||||
findPriceMismatches,
|
||||
getCodeMap,
|
||||
getPriceForCodeWithAgeFromMap,
|
||||
ageOnDate,
|
||||
type PriceMismatch,
|
||||
} from "@/utils/procedureCombosMapping";
|
||||
import { PROCEDURE_COMBOS } from "@/utils/procedureCombos";
|
||||
@@ -624,7 +627,11 @@ export function ClaimForm({
|
||||
}
|
||||
});
|
||||
const filled = { ...prev, insuranceSiteKey, serviceLines: updatedLines };
|
||||
return mapPricesForForm({ form: filled, patientDOB: "", insuranceSiteKey });
|
||||
return mapPricesForForm({
|
||||
form: filled,
|
||||
patientDOB: patient?.dateOfBirth ?? "",
|
||||
insuranceSiteKey,
|
||||
});
|
||||
});
|
||||
setPrefillDone(true);
|
||||
} catch {}
|
||||
@@ -845,6 +852,22 @@ export function ClaimForm({
|
||||
} else {
|
||||
updatedLines[index][field] = value;
|
||||
}
|
||||
|
||||
// Auto-fill the price as soon as a recognized, fully-typed CDT code is entered,
|
||||
// so users don't have to remember to click "Map Price" for a single line.
|
||||
if (field === "procedureCode") {
|
||||
const code = String(value || "").trim().toUpperCase();
|
||||
if (/^D\d{4}$/.test(code)) {
|
||||
const line = updatedLines[index];
|
||||
const map = getCodeMap(form.insuranceSiteKey);
|
||||
const age = ageOnDate(
|
||||
patient?.dateOfBirth ?? "",
|
||||
line.procedureDate || form.serviceDate,
|
||||
);
|
||||
const price = getPriceForCodeWithAgeFromMap(map, code, age);
|
||||
updatedLines[index] = { ...line, totalBilled: price };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setForm({ ...form, serviceLines: updatedLines });
|
||||
@@ -1873,7 +1896,17 @@ export function ClaimForm({
|
||||
} else if (key === "united_sco" || key === "unitedco" || key === "dentalhub") {
|
||||
handleUnitedDHPreAuth();
|
||||
} else {
|
||||
handleMHPreAuth();
|
||||
// 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,
|
||||
// leaving age-tiered codes (e.g. D2740) unpriced.
|
||||
const siteKeyForPricing =
|
||||
form.insuranceSiteKey || deriveInsuranceSiteKey(form.insuranceProvider || "");
|
||||
const pricedForm = mapPricesForForm({
|
||||
form: { ...form, insuranceSiteKey: siteKeyForPricing },
|
||||
patientDOB: patient?.dateOfBirth ?? "",
|
||||
insuranceSiteKey: siteKeyForPricing,
|
||||
});
|
||||
handleMHPreAuth(pricedForm);
|
||||
}
|
||||
}, [autoSubmitPreauth, prefillDone, isFormReady]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user