feat: auto-trigger eligibility selenium from schedule right-click menu
- Remove "Claim Status" from appointment context menu - Rename "Eligibility Status" → "Check Eligibility" - Check Eligibility now navigates to insurance-status page and auto-starts the correct selenium flow based on the patient's stored insurance provider: MassHealth 21+ → MH Eligibility & History MassHealth <21 → CMSP Eligibility & History & Remaining Delta Dental MA → DDMA selenium Delta Dental Ins → Delta Ins selenium (OTP modal if needed) United Healthcare SCO → United SCO selenium DentaQuest/Tufts → Tufts SCO selenium Commonwealth Care Alliance → CCA selenium Unknown → scroll to Other provider checks section - Add autoTrigger/onAutoTriggered props to all five button components Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -955,15 +955,42 @@ export default function AppointmentsPage() {
|
||||
// -------------------
|
||||
// appointment page — update these handlers
|
||||
const handleCheckEligibility = (appointmentId: number) => {
|
||||
setLocation(
|
||||
`/insurance-status?appointmentId=${appointmentId}&action=eligibility`
|
||||
);
|
||||
};
|
||||
const apt = appointments.find((a) => a.id === appointmentId);
|
||||
const patient = apt ? patientsFromDay.find((p) => p.id === apt.patientId) : null;
|
||||
const insuranceProvider = (patient as any)?.insuranceProvider as string | null ?? null;
|
||||
const p = insuranceProvider?.toLowerCase() ?? "";
|
||||
const isMassHealth = p.includes("masshealth");
|
||||
|
||||
const handleCheckClaimStatus = (appointmentId: number) => {
|
||||
setLocation(
|
||||
`/insurance-status?appointmentId=${appointmentId}&action=claim`
|
||||
);
|
||||
let autoCheck = "other-providers";
|
||||
|
||||
if (isMassHealth) {
|
||||
const dob = (patient as any)?.dateOfBirth;
|
||||
let age: number | null = null;
|
||||
if (dob) {
|
||||
const dobDate = typeof dob === "string" ? new Date(dob) : dob as Date;
|
||||
const today = new Date();
|
||||
age = today.getFullYear() - dobDate.getFullYear();
|
||||
const m = today.getMonth() - dobDate.getMonth();
|
||||
if (m < 0 || (m === 0 && today.getDate() < dobDate.getDate())) age--;
|
||||
}
|
||||
autoCheck = age !== null && age >= 21 ? "mh-history" : "cmsp";
|
||||
} else if (p.includes("delta dental ma")) {
|
||||
autoCheck = "ddma";
|
||||
} else if (p.includes("delta dental ins")) {
|
||||
autoCheck = "delta-ins";
|
||||
} else if (p.includes("united healthcare sco") || p.includes("united sco")) {
|
||||
autoCheck = "united-sco";
|
||||
} else if (p.includes("tufts") || p.includes("dentaquest")) {
|
||||
autoCheck = "tufts-sco";
|
||||
} else if (p.includes("commonwealth care alliance") || p.includes("cca")) {
|
||||
autoCheck = "cca";
|
||||
}
|
||||
|
||||
if (autoCheck === "other-providers") {
|
||||
setLocation(`/insurance-status?appointmentId=${appointmentId}&scrollTo=other-providers`);
|
||||
} else {
|
||||
setLocation(`/insurance-status?appointmentId=${appointmentId}&autoCheck=${autoCheck}`);
|
||||
}
|
||||
};
|
||||
|
||||
const handleClaimsPreAuth = (appointmentId: number) => {
|
||||
@@ -1602,7 +1629,7 @@ export default function AppointmentsPage() {
|
||||
>
|
||||
<span className="flex items-center gap-2">
|
||||
<Shield className="h-4 w-4" />
|
||||
Eligibility Status
|
||||
Check Eligibility
|
||||
</span>
|
||||
</Item>
|
||||
|
||||
@@ -1650,16 +1677,6 @@ export default function AppointmentsPage() {
|
||||
</span>
|
||||
</Item>
|
||||
|
||||
{/* Claim Status */}
|
||||
<Item
|
||||
onClick={({ props }) => handleCheckClaimStatus(props.appointmentId)}
|
||||
>
|
||||
<span className="flex items-center gap-2">
|
||||
<Shield className="h-4 w-4" />
|
||||
Claim Status
|
||||
</span>
|
||||
</Item>
|
||||
|
||||
{/* Chat */}
|
||||
<Item onClick={({ props }) => handleChat(props.appointmentId)}>
|
||||
<span className="flex items-center gap-2 text-blue-600">
|
||||
|
||||
Reference in New Issue
Block a user