feat: MassHealth PDF import auto-pays full balance + patient name fix

- PDF import now marks payments as PAID when MassHealth patient's
  mhPaidAmount >= totalBilled (no patient balance)
- Newly created patients from MH vouchers get insuranceProvider = 'MassHealth'
- Existing patients with blank insuranceProvider get it filled on import
- Fix: update patient name from PDF if existing record has empty name
- Various frontend/selenium/route updates

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-26 00:16:31 -04:00
parent 9efe5c8469
commit b7e06adf2f
15 changed files with 611 additions and 448 deletions

View File

@@ -24,8 +24,10 @@ const ReportsPage = lazy(() => import("./pages/reports-page"));
const CloudStoragePage = lazy(() => import("./pages/cloud-storage-page"));
const JobMonitorPage = lazy(() => import("./pages/job-monitor-page"));
const ChartPage = lazy(() => import("./pages/chart-page"));
const AiInputAgentPage = lazy(() => import("./pages/ai-input-agent-page"));
const DentalShoppingSearchTagPage = lazy(() => import("./pages/dental-shopping-search-tag-page"));
const DentalShoppingLoginInfoPage = lazy(() => import("./pages/dental-shopping-login-info-page"));
const ActivationPage = lazy(() => import("./pages/activation-page"));
const NotFound = lazy(() => import("./pages/not-found"));
function Router() {
return (<Switch>
@@ -46,8 +48,10 @@ function Router() {
<ProtectedRoute path="/database-management" component={() => <DatabaseManagementPage />} adminOnly/>
<ProtectedRoute path="/reports" component={() => <ReportsPage />}/>
<ProtectedRoute path="/cloud-storage" component={() => <CloudStoragePage />}/>
<ProtectedRoute path="/ai-input-agent" component={() => <AiInputAgentPage />}/>
<ProtectedRoute path="/dental-shopping/search-tag" component={() => <DentalShoppingSearchTagPage />}/>
<ProtectedRoute path="/dental-shopping/login-info" component={() => <DentalShoppingLoginInfoPage />}/>
<ProtectedRoute path="/activation" component={() => <ActivationPage />} adminOnly/>
<ProtectedRoute path="/job-monitor" component={() => <JobMonitorPage />} adminOnly/>
<Route path="/auth" component={() => <AuthPage />}/>
<Route component={() => <NotFound />}/>

View File

@@ -18,22 +18,38 @@ export const PatientForm = forwardRef(({ patient, extractedInfo, onSubmit }, ref
: insertPatientSchema.extend({ userId: z.number().optional() }), [isEditing]);
const normalizeInsuranceProvider = (val) => {
const p = (val || "").toLowerCase().trim();
if (p.includes("masshealth") || p === "mh" || p === "mass health") return "MassHealth";
if (p.includes("commonwealth care alliance") || p === "cca") return "CCA";
if (p.includes("ddma")) return "DDMA";
if (p.includes("delta dental") || p.includes("delta ins") || p === "deltains") return "DeltaIns";
if (p.includes("tufts") || p.includes("dentaquest") || p === "tuftssco") return "TuftsSCO";
if (p.includes("united sco") || p === "unitedsco") return "UnitedSCO";
if (p.includes("cmsp")) return "CMSP";
if (p.includes("bcbs") || p.includes("blue cross")) return "BCBS";
if (p.includes("united aapr") || p === "unitedaapr") return "UnitedAAPR";
if (p.includes("aetna")) return "Aetna";
if (p.includes("altus")) return "Altus";
if (p.includes("metlife")) return "MetlifeDental";
if (p.includes("cigna")) return "Cigna";
if (p.includes("delta wa") || p === "deltawa") return "DeltaWA";
if (p.includes("delta il") || p === "deltail") return "DeltaIL";
if (p.includes("other")) return "Others";
if (p.includes("masshealth") || p === "mh" || p === "mass health")
return "MassHealth";
if (p.includes("commonwealth care alliance") || p === "cca")
return "CCA";
if (p.includes("ddma"))
return "DDMA";
if (p.includes("delta dental") || p.includes("delta ins") || p === "deltains")
return "DeltaIns";
if (p.includes("tufts") || p.includes("dentaquest") || p === "tuftssco")
return "TuftsSCO";
if (p.includes("united sco") || p === "unitedsco")
return "UnitedSCO";
if (p.includes("cmsp"))
return "CMSP";
if (p.includes("bcbs") || p.includes("blue cross"))
return "BCBS";
if (p.includes("united aapr") || p === "unitedaapr")
return "UnitedAAPR";
if (p.includes("aetna"))
return "Aetna";
if (p.includes("altus"))
return "Altus";
if (p.includes("metlife"))
return "MetlifeDental";
if (p.includes("cigna"))
return "Cigna";
if (p.includes("delta wa") || p === "deltawa")
return "DeltaWA";
if (p.includes("delta il") || p === "deltail")
return "DeltaIL";
if (p.includes("other"))
return "Others";
return val || "";
};
const computedDefaultValues = useMemo(() => {
@@ -87,15 +103,16 @@ export const PatientForm = forwardRef(({ patient, extractedInfo, onSubmit }, ref
useEffect(() => {
if (patient) {
const { id, userId, createdAt, ...sanitizedPatient } = patient;
const normalized = normalizeInsuranceProvider(patient.insuranceProvider);
const resetValues = {
...sanitizedPatient,
dateOfBirth: patient.dateOfBirth
? formatLocalDate(new Date(patient.dateOfBirth))
: null,
insuranceProvider: normalizeInsuranceProvider(patient.insuranceProvider),
insuranceProvider: normalized,
};
const normalized = normalizeInsuranceProvider(patient.insuranceProvider);
form.reset(resetValues);
// Explicit setValue ensures the controlled Select re-renders with the new value
form.setValue("insuranceProvider", normalized);
}
else {

View File

@@ -579,7 +579,7 @@ export default function PaymentsRecentTable({
}
}}
>
{isMhChecking ? "Checking..." : "Check MH Payment"}
{isMhChecking ? "Checking..." : "Check Single MH Payment"}
</Button>
<Button
size="sm"

View File

@@ -31,12 +31,21 @@ import { apiRequest } from "@/lib/queryClient";
import { toast } from "@/hooks/use-toast";
import PaymentEditModal from "@/components/payments/payment-edit-modal";
function formatDateInput(raw: string): string {
const digits = raw.replace(/\D/g, "").slice(0, 8);
if (digits.length <= 2) return digits;
if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4)}`;
}
export default function PaymentsPage() {
const [paymentPeriod, setPaymentPeriod] = useState<string>("all-time");
// Check Payments Online date range
const [mhFromDate, setMhFromDate] = useState<Date | undefined>(undefined);
const [mhToDate, setMhToDate] = useState<Date | undefined>(undefined);
const [mhFromText, setMhFromText] = useState("");
const [mhToText, setMhToText] = useState("");
const [fromCalendarOpen, setFromCalendarOpen] = useState(false);
const [toCalendarOpen, setToCalendarOpen] = useState(false);
@@ -229,7 +238,7 @@ export default function PaymentsPage() {
{/* Check Payments Online */}
<Card className="mb-6">
<CardHeader>
<CardTitle>Check Payments Online</CardTitle>
<CardTitle>Check MH Payments</CardTitle>
<CardDescription>
Select a date range and check MH payment status online
</CardDescription>
@@ -239,69 +248,115 @@ export default function PaymentsPage() {
{/* From date picker */}
<div className="flex items-center gap-2">
<span className="text-sm font-medium text-gray-600 whitespace-nowrap">From:</span>
<Popover open={fromCalendarOpen} onOpenChange={setFromCalendarOpen}>
<PopoverTrigger asChild>
<Button
variant="outline"
className="w-[160px] justify-start text-left font-normal"
>
<CalendarIcon className="mr-2 h-4 w-4 text-gray-400" />
{mhFromDate
? mhFromDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })
: <span className="text-muted-foreground">Pick a date</span>}
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar
mode="single"
selected={mhFromDate}
onSelect={(d) => {
setMhFromDate(d);
setFromCalendarOpen(false);
}}
onClose={() => setFromCalendarOpen(false)}
/>
</PopoverContent>
</Popover>
<div className="flex items-center gap-1">
<input
type="text"
placeholder="MM/DD/YYYY"
className="border rounded-md px-2 py-1.5 text-sm w-[110px] focus:outline-none focus:ring-2 focus:ring-ring"
value={mhFromText}
onChange={(e) => {
const formatted = formatDateInput(e.target.value);
setMhFromText(formatted);
if (formatted === "") { setMhFromDate(undefined); return; }
if (/^\d{2}\/\d{2}\/\d{4}$/.test(formatted)) {
const parsed = new Date(formatted);
if (!isNaN(parsed.getTime())) setMhFromDate(parsed);
}
}}
/>
<Popover open={fromCalendarOpen} onOpenChange={setFromCalendarOpen}>
<PopoverTrigger asChild>
<Button type="button" variant="outline" size="icon" className="h-8 w-8 shrink-0">
<CalendarIcon className="h-4 w-4" />
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar
mode="single"
selected={mhFromDate}
onSelect={(d) => {
setMhFromDate(d);
setMhFromText(d ? d.toLocaleDateString("en-US", { month: "2-digit", day: "2-digit", year: "numeric" }) : "");
setFromCalendarOpen(false);
}}
onClose={() => setFromCalendarOpen(false)}
/>
</PopoverContent>
</Popover>
</div>
</div>
{/* To date picker */}
<div className="flex items-center gap-2">
<span className="text-sm font-medium text-gray-600 whitespace-nowrap">To:</span>
<Popover open={toCalendarOpen} onOpenChange={setToCalendarOpen}>
<PopoverTrigger asChild>
<Button
variant="outline"
className="w-[160px] justify-start text-left font-normal"
>
<CalendarIcon className="mr-2 h-4 w-4 text-gray-400" />
{mhToDate
? mhToDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })
: <span className="text-muted-foreground">Pick a date</span>}
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar
mode="single"
selected={mhToDate}
onSelect={(d) => {
setMhToDate(d);
setToCalendarOpen(false);
}}
onClose={() => setToCalendarOpen(false)}
/>
</PopoverContent>
</Popover>
<div className="flex items-center gap-1">
<input
type="text"
placeholder="MM/DD/YYYY"
className="border rounded-md px-2 py-1.5 text-sm w-[110px] focus:outline-none focus:ring-2 focus:ring-ring"
value={mhToText}
onChange={(e) => {
const formatted = formatDateInput(e.target.value);
setMhToText(formatted);
if (formatted === "") { setMhToDate(undefined); return; }
if (/^\d{2}\/\d{2}\/\d{4}$/.test(formatted)) {
const parsed = new Date(formatted);
if (!isNaN(parsed.getTime())) setMhToDate(parsed);
}
}}
/>
<Popover open={toCalendarOpen} onOpenChange={setToCalendarOpen}>
<PopoverTrigger asChild>
<Button type="button" variant="outline" size="icon" className="h-8 w-8 shrink-0">
<CalendarIcon className="h-4 w-4" />
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar
mode="single"
selected={mhToDate}
onSelect={(d) => {
setMhToDate(d);
setMhToText(d ? d.toLocaleDateString("en-US", { month: "2-digit", day: "2-digit", year: "numeric" }) : "");
setToCalendarOpen(false);
}}
onClose={() => setToCalendarOpen(false)}
/>
</PopoverContent>
</Popover>
</div>
</div>
{/* Check All MH Payment button */}
{/* MH Batch Payment Check button */}
<Button
variant="default"
onClick={() => {
// Logic to be defined later
onClick={async () => {
if (!mhFromDate || !mhToDate) {
toast({ title: "Please select both From and To dates", variant: "destructive" });
return;
}
try {
const res = await apiRequest("POST", "/api/payments/mh-batch-payment-check", {
fromDate: mhFromDate.toISOString().split("T")[0],
toDate: mhToDate.toISOString().split("T")[0],
});
if (!res.ok) {
const err = await res.json();
toast({ title: "MH Batch Payment Check Failed", description: err.message, variant: "destructive" });
} else {
const result = await res.json();
if (result.noResults) {
toast({ title: "No Results", description: result.message, variant: "destructive" });
} else {
toast({ title: "MH Batch Payment Check", description: result.importSummary ?? result.message ?? "Done" });
}
}
} catch (e: any) {
toast({ title: "Error", description: e.message, variant: "destructive" });
}
}}
>
Check All MH Payment
Go
</Button>
</div>
</CardContent>

View File

@@ -110,7 +110,7 @@ function isDateOnlyString(s) {
}
// ---------- formatDateToHumanReadable ----------
/**
* Frontend-safe human readable formatter.
* Frontend-safe date formatter. Output format: "MM/DD/YYYY" (e.g. "03/01/1980").
*
* Rules:
* - If input is a date-only string "YYYY-MM-DD", format it directly (no TZ math).
@@ -118,37 +118,35 @@ function isDateOnlyString(s) {
* - If input is any other string (ISO/timestamp), DO NOT call new Date(isoString) directly
* for display. Instead, use parseLocalDate(dateInput) to extract the local calendar day
* (strip time portion) and render that. This prevents off-by-one day drift.
*
* Output example: "Oct 7, 2025"
*/
export function formatDateToHumanReadable(dateInput) {
if (!dateInput)
return "N/A";
// date-only string -> show as-is using MONTH_SHORT
// date-only string "YYYY-MM-DD" -> m and d are already zero-padded
if (typeof dateInput === "string" && isDateOnlyString(dateInput)) {
const [y, m, d] = dateInput.split("-");
if (!y || !m || !d)
return "Invalid Date";
return `${MONTH_SHORT[parseInt(m, 10) - 1]} ${d}, ${y}`;
return `${m}/${d}/${y}`;
}
// Date object -> use local calendar fields
if (dateInput instanceof Date) {
if (isNaN(dateInput.getTime()))
return "Invalid Date";
const dd = String(dateInput.getDate());
const mm = MONTH_SHORT[dateInput.getMonth()];
const dd = String(dateInput.getDate()).padStart(2, "0");
const mm = String(dateInput.getMonth() + 1).padStart(2, "0");
const yy = dateInput.getFullYear();
return `${mm} ${dd}, ${yy}`;
return `${mm}/${dd}/${yy}`;
}
// Other string (likely ISO/timestamp) -> normalize via parseLocalDate
// This preserves the calendar day the user expects (no timezone drift).
if (typeof dateInput === "string") {
try {
const localDate = parseLocalDate(dateInput);
const dd = String(localDate.getDate());
const mm = MONTH_SHORT[localDate.getMonth()];
const dd = String(localDate.getDate()).padStart(2, "0");
const mm = String(localDate.getMonth() + 1).padStart(2, "0");
const yy = localDate.getFullYear();
return `${mm} ${dd}, ${yy}`;
return `${mm}/${dd}/${yy}`;
}
catch (err) {
console.error("Invalid date input provided:", dateInput, err);

View File

@@ -220,6 +220,27 @@ export const PROCEDURE_COMBOS = {
label: "PL (Cast)",
codes: ["D5214"],
},
// Implants
implantFull: {
id: "implantFull",
label: "Implant/Abut/Crown",
codes: ["D6010", "D6057", "D6058"],
},
implantFixture: {
id: "implantFixture",
label: "Implant Fixture",
codes: ["D6010"],
},
implantAbutment: {
id: "implantAbutment",
label: "Abutment",
codes: ["D6057"],
},
implantCrown: {
id: "implantCrown",
label: "Implant Crown",
codes: ["D6058"],
},
// Endodontics
rctAnterior: {
id: "rctAnterior",
@@ -353,6 +374,7 @@ export const COMBO_CATEGORIES = {
"plResin",
"plCast",
],
Implants: ["implantFull", "implantFixture", "implantAbutment", "implantCrown"],
Endodontics: ["rctAnterior", "rctAnteriorPostCrown", "rctPremolar", "rctPremolarPostCrown", "rctMolar", "rctMolarPostCrown", "postCore", "coreBU"],
Prosthodontics: ["crown"],
Periodontics: ["deepCleaning"],

View File

@@ -1,7 +1,15 @@
import Decimal from "decimal.js";
import rawCodeTable from "@/assets/data/procedureCodesMH.json";
import rawCCACodeTable from "@/assets/data/procedureCodesCCA.json";
import rawDDMACodeTable from "@/assets/data/procedureCodesDDMA.json";
import rawUnitedDHCodeTable from "@/assets/data/procedureCodesUnitedDH.json";
import rawTuftsSCOCodeTable from "@/assets/data/procedureCodesTuftsSCO.json";
import { PROCEDURE_COMBOS } from "./procedureCombos";
const CODE_TABLE = rawCodeTable;
const CCA_CODE_TABLE = rawCCACodeTable;
const DDMA_CODE_TABLE = rawDDMACodeTable;
const UNITEDDH_CODE_TABLE = rawUnitedDHCodeTable;
const TUFTSSCO_CODE_TABLE = rawTuftsSCOCodeTable;
/* ----------------------------- Helpers ----------------------------- */
export const COMBO_BUTTONS = Object.values(PROCEDURE_COMBOS).map((c) => ({
id: c.id,
@@ -18,6 +26,55 @@ const CODE_MAP = (() => {
}
return m;
})();
const CCA_CODE_MAP = (() => {
const m = new Map();
for (const r of CCA_CODE_TABLE) {
const k = normalizeCode(String(r["Procedure Code"] || ""));
if (k && !m.has(k))
m.set(k, r);
}
return m;
})();
const DDMA_CODE_MAP = (() => {
const m = new Map();
for (const r of DDMA_CODE_TABLE) {
const k = normalizeCode(String(r["Procedure Code"] || ""));
if (k && !m.has(k))
m.set(k, r);
}
return m;
})();
const UNITEDDH_CODE_MAP = (() => {
const m = new Map();
for (const r of UNITEDDH_CODE_TABLE) {
const k = normalizeCode(String(r["Procedure Code"] || ""));
if (k && !m.has(k))
m.set(k, r);
}
return m;
})();
const TUFTSSCO_CODE_MAP = (() => {
const m = new Map();
for (const r of TUFTSSCO_CODE_TABLE) {
const k = normalizeCode(String(r["Procedure Code"] || ""));
if (k && !m.has(k))
m.set(k, r);
}
return m;
})();
/** Return the correct fee-schedule map for the given insurance type. */
function getCodeMap(insuranceSiteKey) {
const k = (insuranceSiteKey ?? "").replace(/_/g, "").toLowerCase();
if (k === "cca")
return CCA_CODE_MAP;
if (k === "ddma")
return DDMA_CODE_MAP;
if (k === "unitedsco" || k === "uniteddh" || k === "dentalhub")
return UNITEDDH_CODE_MAP;
if (k === "tuftssco" || k === "tufts")
return TUFTSSCO_CODE_MAP;
return CODE_MAP; // default: MassHealth
}
// this function is solely for abbrevations feature in claim-form
export function getDescriptionForCode(code) {
if (!code)
@@ -83,44 +140,35 @@ const ageOnDate = (dob, on) => {
export function pickPriceForRowByAge(row, age, normalizedCode) {
// Special-case rules (add more codes here if needed)
if (normalizedCode) {
// D1110: only valid for age >=14 (14..21 => PriceLTEQ21, >21 => PriceGT21)
// D1110: only valid for age >=14
if (normalizedCode === "D1110") {
if (age < 14) {
// D1110 not applicable to children <14 (those belong to D1120)
return new Decimal(0);
}
if (age >= 14 && age <= 21) {
// use PriceLTEQ21 only if present
if (!isBlankPrice(row.PriceLTEQ21))
return toDecimalOrZero(row.PriceLTEQ21);
return new Decimal(0);
}
// age > 21
if (!isBlankPrice(row.PriceGT21))
if (age < 14)
return new Decimal(0); // D1110 not for children <14
// age >= 14: use age-split if present, then flat Price
if (age <= 21 && !isBlankPrice(row.PriceLTEQ21))
return toDecimalOrZero(row.PriceLTEQ21);
if (age > 21 && !isBlankPrice(row.PriceGT21))
return toDecimalOrZero(row.PriceGT21);
if (!isBlankPrice(row.Price))
return toDecimalOrZero(row.Price);
return new Decimal(0);
}
// D1120: child 0-13 => PriceLTEQ21, otherwise no price (NC)
// D1120: valid for child 0-13 only
if (normalizedCode === "D1120") {
if (age < 14) {
if (!isBlankPrice(row.PriceLTEQ21))
return toDecimalOrZero(row.PriceLTEQ21);
return new Decimal(0);
}
// age >= 14 => NC / no price
if (age >= 14)
return new Decimal(0); // NC for adults
if (!isBlankPrice(row.PriceLTEQ21))
return toDecimalOrZero(row.PriceLTEQ21);
if (!isBlankPrice(row.Price))
return toDecimalOrZero(row.Price);
return new Decimal(0);
}
}
// Generic/default behavior (unchanged)
if (age <= 21) {
if (!isBlankPrice(row.PriceLTEQ21))
return toDecimalOrZero(row.PriceLTEQ21);
}
else {
if (!isBlankPrice(row.PriceGT21))
return toDecimalOrZero(row.PriceGT21);
}
// Fallback to Price if tiered not available/blank
// Generic/default: age-split first, flat Price as fallback
if (age <= 21 && !isBlankPrice(row.PriceLTEQ21))
return toDecimalOrZero(row.PriceLTEQ21);
if (age > 21 && !isBlankPrice(row.PriceGT21))
return toDecimalOrZero(row.PriceGT21);
if (!isBlankPrice(row.Price))
return toDecimalOrZero(row.Price);
return new Decimal(0);
@@ -158,7 +206,8 @@ const ensureCapacity = (lines, min, lineDate) => {
* Returns a NEW form object (immutable).
*/
export function mapPricesForForm(params) {
const { form, patientDOB } = params;
const { form, patientDOB, insuranceSiteKey } = params;
const map = getCodeMap(insuranceSiteKey);
return {
...form,
serviceLines: form.serviceLines.map((ln) => {
@@ -166,7 +215,7 @@ export function mapPricesForForm(params) {
const code = normalizeCode(ln.procedureCode || "");
if (!code)
return { ...ln };
const price = getPriceForCodeWithAgeFromMap(CODE_MAP, code, age);
const price = getPriceForCodeWithAgeFromMap(map, code, age);
return { ...ln, procedureCode: code, totalBilled: price };
}),
};
@@ -175,7 +224,7 @@ export function mapPricesForForm(params) {
* Apply a preset combo (fills codes & prices) using patientDOB and serviceDate.
* Returns a NEW form object (immutable).
*/
export function applyComboToForm(form, comboId, patientDOB, options = {}) {
export function applyComboToForm(form, comboId, patientDOB, options = {}, insuranceSiteKey) {
const preset = PROCEDURE_COMBOS[String(comboId)];
if (!preset)
return form;
@@ -205,8 +254,8 @@ export function applyComboToForm(form, comboId, patientDOB, options = {}) {
} // if replaceAll, insertAt stays 0
// Make sure we have enough rows for the whole combo
ensureCapacity(next.serviceLines, insertAt + preset.codes.length, lineDate);
// Age on the specific line date we will set
const age = ageOnDate(patientDOB, lineDate);
const age = options.skipPrice ? 0 : ageOnDate(patientDOB, lineDate);
const map = options.skipPrice ? CODE_MAP : getCodeMap(insuranceSiteKey);
for (let j = 0; j < preset.codes.length; j++) {
const i = insertAt + j;
if (i >= next.serviceLines.length)
@@ -215,7 +264,9 @@ export function applyComboToForm(form, comboId, patientDOB, options = {}) {
if (!codeRaw)
continue;
const code = normalizeCode(codeRaw);
const price = getPriceForCodeWithAgeFromMap(CODE_MAP, code, age);
const price = options.skipPrice
? new Decimal(0)
: getPriceForCodeWithAgeFromMap(map, code, age);
const original = next.serviceLines[i];
next.serviceLines[i] = {
...original,
@@ -238,4 +289,32 @@ export function applyComboToForm(form, comboId, patientDOB, options = {}) {
}
return next;
}
export { CODE_MAP, getPriceForCodeWithAgeFromMap };
export { CODE_MAP, CCA_CODE_MAP, DDMA_CODE_MAP, UNITEDDH_CODE_MAP, TUFTSSCO_CODE_MAP, getCodeMap, getPriceForCodeWithAgeFromMap };
/** Compare each service line's totalBilled against the fee schedule.
* Returns lines where the entered price differs from the schedule price.
* Returns empty array if the siteKey has no schedule (United, Tufts, etc.). */
export function findPriceMismatches(serviceLines, insuranceSiteKey, patientDOB, serviceDate) {
const supported = ["MH", "MASSHEALTH", "CCA", "DDMA", "UNITEDDH", "UNITEDSCO", "TUFTSSCO"];
if (!insuranceSiteKey || !supported.includes(insuranceSiteKey.toUpperCase()))
return [];
const map = getCodeMap(insuranceSiteKey);
const mismatches = [];
for (const line of serviceLines) {
const code = normalizeCode(line.procedureCode || "");
if (!code)
continue;
const enteredPrice = new Decimal(Number(line.totalBilled) || 0);
if (enteredPrice.isZero())
continue;
const age = ageOnDate(patientDOB, serviceDate);
const schedulePrice = getPriceForCodeWithAgeFromMap(map, code, age);
if (!schedulePrice.isZero() && !enteredPrice.equals(schedulePrice)) {
mismatches.push({
procedureCode: code,
enteredPrice: enteredPrice.toNumber(),
schedulePrice: schedulePrice.toNumber(),
});
}
}
return mismatches;
}

View File

@@ -78,10 +78,22 @@ export default {
height: "0",
},
},
blob: {
"0%, 100%": { transform: "translate(0, 0) scale(1)", borderRadius: "40% 60% 70% 30% / 40% 50% 60% 50%" },
"25%": { transform: "translate(80px, -60px) scale(1.25)", borderRadius: "60% 40% 30% 70% / 60% 30% 70% 40%" },
"50%": { transform: "translate(-50px, 50px) scale(0.85)", borderRadius: "30% 60% 40% 70% / 50% 60% 30% 60%" },
"75%": { transform: "translate(40px, 30px) scale(1.1)", borderRadius: "50% 40% 60% 30% / 40% 70% 50% 60%" },
},
"blob-spin": {
"0%": { transform: "rotate(0deg)" },
"100%": { transform: "rotate(360deg)" },
},
},
animation: {
"accordion-down": "accordion-down 0.2s ease-out",
"accordion-up": "accordion-up 0.2s ease-out",
blob: "blob 10s ease-in-out infinite",
"blob-spin": "blob-spin 20s linear infinite",
},
},
},

File diff suppressed because one or more lines are too long

View File

@@ -11,7 +11,10 @@ export default defineConfig(({ mode }) => {
fs: {
allow: [".."],
},
allowedHosts: ["communitydentistsoflowell.mydentalofficemanagement.com"],
allowedHosts: [
...(env.VITE_CLOUDFLARE_HOST ? [env.VITE_CLOUDFLARE_HOST] : []),
"192.168.0.94",
],
proxy: {
"/api": {
target: env.VITE_API_BASE_URL_BACKEND || "http://localhost:5000",