fix: CCA preauth status stays Submitted (not Approved) and screenshot mime type

- ccaPreAuthProcessor: keep claim status as PREAUTH after successful
  submission instead of jumping straight to APPROVED, matching the
  Tufts SCO/UnitedDH/MassHealth preauth flows; also tag PNG fallback
  screenshots with image/png instead of the default application/pdf
  so they render in the Documents preview modal.
- claims-recent-table: add a PREAUTH status case so it displays as
  "Submitted" instead of falling through to the raw enum value.
This commit is contained in:
2026-07-25 10:15:35 -04:00
parent f457d6282a
commit ae961781ac
2 changed files with 10 additions and 2 deletions

View File

@@ -102,7 +102,7 @@ export async function runCCAPreAuthProcessor(
// Save authNumber into the claim record (preauth no column)
if (claimId && authNumber) {
try {
await storage.updateClaim(claimId, { claimNumber: authNumber, status: "APPROVED" } as any);
await storage.updateClaim(claimId, { claimNumber: authNumber, status: "PREAUTH" } as any);
log("cca-preauth-processor", "authNumber saved to claim", { claimId, authNumber });
} catch (e: any) {
log("cca-preauth-processor", "failed to save authNumber to claim", { error: e?.message });
@@ -117,13 +117,15 @@ export async function runCCAPreAuthProcessor(
const pdfBuffer = Buffer.from(pdfBase64, "base64");
const patient = await storage.getPatient(patientId);
const patientName = patient ? `${patient.firstName ?? ""} ${patient.lastName ?? ""}`.trim() : "";
const mimeType = pdfFilename.toLowerCase().endsWith(".png") ? "image/png" : "application/pdf";
const cloudFile = await storage.savePdfToCloudStorage(
userId,
patientId,
patientName || `Patient ${patientId}`,
"PreAuth",
pdfFilename,
pdfBuffer
pdfBuffer,
mimeType
);
pdfFileId = `cloud:${cloudFile.id}`;
log("cca-preauth-processor", "PDF saved", { pdfFilename, pdfFileId, patientId });

View File

@@ -287,6 +287,12 @@ export default function ClaimsRecentTable({
color: "bg-red-100 text-red-800",
icon: <AlertCircle className="h-3 w-3 mr-1" />,
};
case "PREAUTH":
return {
label: "Submitted",
color: "bg-blue-100 text-blue-800",
icon: <Clock className="h-3 w-3 mr-1" />,
};
default:
return {
label: status