feat(claim-form) - combo added, toothSurface uppercase,lowercase
This commit is contained in:
@@ -77,7 +77,7 @@ interface ClaimFormProps {
|
|||||||
onSubmit: (data: ClaimFormData) => Promise<Claim>;
|
onSubmit: (data: ClaimFormData) => Promise<Claim>;
|
||||||
onHandleAppointmentSubmit: (
|
onHandleAppointmentSubmit: (
|
||||||
appointmentData: InsertAppointment | UpdateAppointment
|
appointmentData: InsertAppointment | UpdateAppointment
|
||||||
) => void;
|
) => Promise<number | { id: number }>;
|
||||||
onHandleUpdatePatient: (patient: UpdatePatient & { id: number }) => void;
|
onHandleUpdatePatient: (patient: UpdatePatient & { id: number }) => void;
|
||||||
onHandleForMHSelenium: (data: ClaimFormData) => void;
|
onHandleForMHSelenium: (data: ClaimFormData) => void;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
@@ -347,6 +347,13 @@ export function ClaimForm({
|
|||||||
setForm({ ...form, serviceLines: updatedLines });
|
setForm({ ...form, serviceLines: updatedLines });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// normalize for display while typing: uppercase and allow letters, commas and spaces
|
||||||
|
function normalizeToothSurface(raw?: string): string {
|
||||||
|
if (!raw) return "";
|
||||||
|
// Uppercase and remove characters that are not A-Z, comma or space
|
||||||
|
return raw.toUpperCase().replace(/[^A-Z,\s]/g, "");
|
||||||
|
}
|
||||||
|
|
||||||
// for serviceLine rows, to auto scroll when it got updated by combo buttons and all.
|
// for serviceLine rows, to auto scroll when it got updated by combo buttons and all.
|
||||||
const rowRefs = useRef<(HTMLDivElement | null)[]>([]);
|
const rowRefs = useRef<(HTMLDivElement | null)[]>([]);
|
||||||
|
|
||||||
@@ -400,12 +407,22 @@ export function ClaimForm({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 1. Create or update appointment
|
// 1. Create or update appointment
|
||||||
|
let appointmentIdToUse = appointmentId;
|
||||||
|
|
||||||
|
if (appointmentIdToUse == null) {
|
||||||
const appointmentData = {
|
const appointmentData = {
|
||||||
patientId: patientId,
|
patientId: patientId,
|
||||||
date: f.serviceDate,
|
date: serviceDate,
|
||||||
staffId: staff?.id,
|
staffId: staff?.id,
|
||||||
};
|
};
|
||||||
const appointmentId = await onHandleAppointmentSubmit(appointmentData);
|
const created = await onHandleAppointmentSubmit(appointmentData);
|
||||||
|
|
||||||
|
if (typeof created === "number" && created > 0) {
|
||||||
|
appointmentIdToUse = created;
|
||||||
|
} else if (created && typeof (created as any).id === "number") {
|
||||||
|
appointmentIdToUse = (created as any).id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 2. Update patient
|
// 2. Update patient
|
||||||
if (patient && typeof patient.id === "number") {
|
if (patient && typeof patient.id === "number") {
|
||||||
@@ -443,7 +460,7 @@ export function ClaimForm({
|
|||||||
staffId: Number(staff?.id),
|
staffId: Number(staff?.id),
|
||||||
patientId: patientId,
|
patientId: patientId,
|
||||||
insuranceProvider: "MassHealth",
|
insuranceProvider: "MassHealth",
|
||||||
appointmentId: appointmentId!,
|
appointmentId: appointmentIdToUse!,
|
||||||
claimFiles: claimFilesMeta,
|
claimFiles: claimFilesMeta,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -454,7 +471,7 @@ export function ClaimForm({
|
|||||||
staffId: Number(staff?.id),
|
staffId: Number(staff?.id),
|
||||||
patientId: patientId,
|
patientId: patientId,
|
||||||
insuranceProvider: "Mass Health",
|
insuranceProvider: "Mass Health",
|
||||||
appointmentId: appointmentId!,
|
appointmentId: appointmentIdToUse!,
|
||||||
insuranceSiteKey: "MH",
|
insuranceSiteKey: "MH",
|
||||||
claimId: createdClaim.id,
|
claimId: createdClaim.id,
|
||||||
});
|
});
|
||||||
@@ -482,12 +499,22 @@ export function ClaimForm({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 1. Create or update appointment
|
// 1. Create or update appointment
|
||||||
|
let appointmentIdToUse = appointmentId;
|
||||||
|
|
||||||
|
if (appointmentIdToUse == null) {
|
||||||
const appointmentData = {
|
const appointmentData = {
|
||||||
patientId: patientId,
|
patientId: patientId,
|
||||||
date: serviceDate,
|
date: serviceDate,
|
||||||
staffId: staff?.id,
|
staffId: staff?.id,
|
||||||
};
|
};
|
||||||
const appointmentId = await onHandleAppointmentSubmit(appointmentData);
|
const created = await onHandleAppointmentSubmit(appointmentData);
|
||||||
|
|
||||||
|
if (typeof created === "number" && created > 0) {
|
||||||
|
appointmentIdToUse = created;
|
||||||
|
} else if (created && typeof (created as any).id === "number") {
|
||||||
|
appointmentIdToUse = (created as any).id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 2. Update patient
|
// 2. Update patient
|
||||||
if (patient && typeof patient.id === "number") {
|
if (patient && typeof patient.id === "number") {
|
||||||
@@ -525,7 +552,7 @@ export function ClaimForm({
|
|||||||
staffId: Number(staff?.id),
|
staffId: Number(staff?.id),
|
||||||
patientId: patientId,
|
patientId: patientId,
|
||||||
insuranceProvider: "MassHealth",
|
insuranceProvider: "MassHealth",
|
||||||
appointmentId: appointmentId!,
|
appointmentId: appointmentIdToUse!,
|
||||||
claimFiles: claimFilesMeta,
|
claimFiles: claimFilesMeta,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -769,6 +796,14 @@ export function ClaimForm({
|
|||||||
>
|
>
|
||||||
Adult Recall Direct 4BW2PA
|
Adult Recall Direct 4BW2PA
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
onClick={() =>
|
||||||
|
applyComboAndThenMH("adultRecallDirectPano")
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Adult Recall Direct Pano
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -890,11 +925,12 @@ export function ClaimForm({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
placeholder="eg. 'B', 'D', 'F', 'I', 'L', 'M', 'O'"
|
placeholder="eg. B,D,F,I,L,M,O (comma-separated)"
|
||||||
value={line.toothSurface}
|
value={line.toothSurface}
|
||||||
onChange={(e) =>
|
onChange={(e) => {
|
||||||
updateServiceLine(i, "toothSurface", e.target.value)
|
const typed = normalizeToothSurface(e.target.value);
|
||||||
}
|
updateServiceLine(i, "toothSurface", typed);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
@@ -1023,17 +1059,17 @@ export function ClaimForm({
|
|||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<Button
|
<Button
|
||||||
className="w-32"
|
className="w-32"
|
||||||
variant="warning"
|
variant="secondary"
|
||||||
onClick={() => handleMHSubmit()}
|
onClick={() => handleMHSubmit()}
|
||||||
>
|
>
|
||||||
MH
|
MH
|
||||||
</Button>
|
</Button>
|
||||||
<Button className="w-32" variant="warning">
|
<Button className="w-32" variant="secondary">
|
||||||
MH PreAuth
|
MH PreAuth
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
className="w-32"
|
className="w-32"
|
||||||
variant="warning"
|
variant="secondary"
|
||||||
onClick={handleAddService}
|
onClick={handleAddService}
|
||||||
>
|
>
|
||||||
Add Service
|
Add Service
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ export const PROCEDURE_COMBOS: Record<
|
|||||||
codes: ["D0120", "D0220", "D0230", "D0274", "D1110"],
|
codes: ["D0120", "D0220", "D0230", "D0274", "D1110"],
|
||||||
toothNumbers: [null, "9", "24", null, null], // only these two need values
|
toothNumbers: [null, "9", "24", null, null], // only these two need values
|
||||||
},
|
},
|
||||||
|
adultRecallDirectPano: {
|
||||||
|
id: "adultRecallDirectPano",
|
||||||
|
label: "Adult Recall Direct - Pano",
|
||||||
|
codes: ["D0120", "D1110", "D0330"],
|
||||||
|
},
|
||||||
newChildPatient: {
|
newChildPatient: {
|
||||||
id: "newChildPatient",
|
id: "newChildPatient",
|
||||||
label: "New Child Patient",
|
label: "New Child Patient",
|
||||||
|
|||||||
Reference in New Issue
Block a user