feat: fall back to saved procedures for no-notes appointments in AI claim queue, and include appointment attachments in MH selenium submission
- AI claim queue now uses previously saved AppointmentProcedure data (with a derived insurance site key) when an appointment has no notes but has saved procedures, instead of skipping with "No notes on this appointment" - selenium-claim route now reads saved AppointmentFile attachments from disk when they weren't re-uploaded in the browser, so images/PDFs already attached via "Select Procedures" reach the MassHealth submission
This commit is contained in:
@@ -346,6 +346,24 @@ router.post(
|
||||
mimetype: f.mimetype,
|
||||
}));
|
||||
|
||||
// Include attachments already saved on the appointment (e.g. via "Select Procedures")
|
||||
// that weren't re-uploaded in this request — read straight from disk by filePath.
|
||||
if (claimData.appointmentId) {
|
||||
const seenNames = new Set(filesForQueue.map((f) => f.originalname));
|
||||
const apptFiles = await storage.getAppointmentFiles(Number(claimData.appointmentId));
|
||||
for (const f of apptFiles) {
|
||||
if (!f.filePath || seenNames.has(f.filename)) continue;
|
||||
const absPath = path.join(process.cwd(), f.filePath);
|
||||
if (!fs.existsSync(absPath)) continue;
|
||||
filesForQueue.push({
|
||||
originalname: f.filename,
|
||||
bufferBase64: fs.readFileSync(absPath).toString("base64"),
|
||||
mimetype: f.mimeType ?? "application/octet-stream",
|
||||
});
|
||||
seenNames.add(f.filename);
|
||||
}
|
||||
}
|
||||
|
||||
const job = await seleniumQueue.add("claim-submit", {
|
||||
jobType: "claim-submit",
|
||||
userId: req.user.id,
|
||||
|
||||
Reference in New Issue
Block a user