feat: secondary insurance; SCO primary + MassHealth secondary rule; United SCO service history
- Patient: new secondaryInsuranceProvider / secondaryInsuranceId (form section, Patient Details, merge fill) - MassHealth check on an SCO patient (Tufts SCO / United SCO primary), matched by MassHealth ID on file as secondary or by the single SCO patient with the same DOB (name must share a word when the portal returns one): MassHealth saved as secondary, primary plan/ID/status unchanged, MassHealth history not imported, PDF still saved to Eligibility documents. Prevents the name+DOB fallback from overwriting the SCO ID - United SCO check: a MassHealth patient moved to United SCO keeps the old MassHealth ID as secondary; reads Dental Hub Service History and saves it - Service history saves drop duplicate identical lines - Chatbot: bare 100… member ID + DOB with no patient/insurance defaults to MassHealth Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -51,6 +51,25 @@ const US_STATES = [
|
||||
"SD", "TN", "TX", "UT", "VA", "WA", "WI", "WV", "WY",
|
||||
];
|
||||
|
||||
const INSURANCE_OPTIONS: { value: string; label: string }[] = [
|
||||
{ value: "MassHealth", label: "MassHealth" },
|
||||
{ value: "CCA", label: "CCA" },
|
||||
{ value: "DDMA", label: "DDMA" },
|
||||
{ value: "DeltaIns", label: "Delta Ins" },
|
||||
{ value: "Delta Dental Indiv", label: "Delta Indiv" },
|
||||
{ value: "TuftsSCO", label: "Tufts SCO" },
|
||||
{ value: "UnitedSCO", label: "United SCO" },
|
||||
{ value: "BCBS", label: "BCBS" },
|
||||
{ value: "UnitedAAPR", label: "United AAPR" },
|
||||
{ value: "Aetna", label: "Aetna" },
|
||||
{ value: "Altus", label: "Altus" },
|
||||
{ value: "MetlifeDental", label: "Metlife Dental" },
|
||||
{ value: "Cigna", label: "Cigna" },
|
||||
{ value: "DeltaWA", label: "Delta WA" },
|
||||
{ value: "DeltaIL", label: "Delta IL" },
|
||||
{ value: "Others", label: "Others" },
|
||||
];
|
||||
|
||||
interface PatientFormProps {
|
||||
patient?: Patient;
|
||||
extractedInfo?: {
|
||||
@@ -135,6 +154,8 @@ export const PatientForm = forwardRef<PatientFormRef, PatientFormProps>(
|
||||
policyHolder: "",
|
||||
policyHolderPatientId: null,
|
||||
policyHolderRelationship: "SELF",
|
||||
secondaryInsuranceProvider: "",
|
||||
secondaryInsuranceId: "",
|
||||
allergies: "",
|
||||
medicalConditions: "",
|
||||
preferredLanguage: "English",
|
||||
@@ -502,22 +523,9 @@ export const PatientForm = forwardRef<PatientFormRef, PatientFormProps>(
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectItem value="MassHealth">MassHealth</SelectItem>
|
||||
<SelectItem value="CCA">CCA</SelectItem>
|
||||
<SelectItem value="DDMA">DDMA</SelectItem>
|
||||
<SelectItem value="DeltaIns">Delta Ins</SelectItem>
|
||||
<SelectItem value="Delta Dental Indiv">Delta Indiv</SelectItem>
|
||||
<SelectItem value="TuftsSCO">Tufts SCO</SelectItem>
|
||||
<SelectItem value="UnitedSCO">United SCO</SelectItem>
|
||||
<SelectItem value="BCBS">BCBS</SelectItem>
|
||||
<SelectItem value="UnitedAAPR">United AAPR</SelectItem>
|
||||
<SelectItem value="Aetna">Aetna</SelectItem>
|
||||
<SelectItem value="Altus">Altus</SelectItem>
|
||||
<SelectItem value="MetlifeDental">Metlife Dental</SelectItem>
|
||||
<SelectItem value="Cigna">Cigna</SelectItem>
|
||||
<SelectItem value="DeltaWA">Delta WA</SelectItem>
|
||||
<SelectItem value="DeltaIL">Delta IL</SelectItem>
|
||||
<SelectItem value="Others">Others</SelectItem>
|
||||
{INSURANCE_OPTIONS.map((o) => (
|
||||
<SelectItem key={o.value} value={o.value}>{o.label}</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
@@ -634,6 +642,55 @@ export const PatientForm = forwardRef<PatientFormRef, PatientFormProps>(
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Secondary Insurance — e.g. MassHealth ID of a United SCO member, or MassHealth behind a commercial plan */}
|
||||
<div>
|
||||
<h4 className="text-md font-medium text-gray-700 mb-3">
|
||||
Secondary Insurance
|
||||
</h4>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={"secondaryInsuranceProvider" as any}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Secondary Insurance Type</FormLabel>
|
||||
<Select
|
||||
onValueChange={(v) => field.onChange(v === "__none__" ? "" : v)}
|
||||
value={(field.value as string) || ""}
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="None" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectItem value="__none__">None</SelectItem>
|
||||
{INSURANCE_OPTIONS.map((o) => (
|
||||
<SelectItem key={o.value} value={o.value}>{o.label}</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={"secondaryInsuranceId" as any}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Secondary Insurance ID</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} value={(field.value as string) || ""} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Hidden submit button for form validation */}
|
||||
<button type="submit" className="hidden" aria-hidden="true"></button>
|
||||
</form>
|
||||
|
||||
@@ -1403,6 +1403,18 @@ export function PatientTable({
|
||||
] ?? currentPatient.policyHolderRelationship}
|
||||
</p>
|
||||
)}
|
||||
{(currentPatient.secondaryInsuranceProvider || currentPatient.secondaryInsuranceId) && (
|
||||
<>
|
||||
<p>
|
||||
<span className="text-gray-500">Secondary Provider:</span>{" "}
|
||||
{currentPatient.secondaryInsuranceProvider || "N/A"}
|
||||
</p>
|
||||
<p>
|
||||
<span className="text-gray-500">Secondary ID:</span>{" "}
|
||||
{currentPatient.secondaryInsuranceId || "N/A"}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1463,7 +1475,7 @@ export function PatientTable({
|
||||
<p className="mt-2 text-gray-500">Loading...</p>
|
||||
) : serviceHistory.length === 0 ? (
|
||||
<p className="mt-2 text-gray-500">
|
||||
No service history on file. It is saved when MH or Tufts SCO eligibility is checked.
|
||||
No service history on file. It is saved when MH, DentaQuest, Tufts SCO or United SCO eligibility is checked.
|
||||
</p>
|
||||
) : (
|
||||
<Table className="mt-2">
|
||||
|
||||
Reference in New Issue
Block a user