feat(ddma eligibility - name now fetched by selenium

This commit is contained in:
2025-12-15 23:35:44 +05:30
parent 587749144b
commit d14f25656d
2 changed files with 21 additions and 3 deletions

View File

@@ -143,9 +143,18 @@ async function handleDdmaCompletedJob(
throw new Error("Missing memberId for ddma job");
}
// 2) Create or update patient
// 2) Create or update patient (with name from selenium result if available)
const patientNameFromResult =
typeof seleniumResult?.patientName === "string"
? seleniumResult.patientName.trim()
: null;
const { firstName, lastName } = splitName(patientNameFromResult);
await createOrUpdatePatientByInsuranceId({
insuranceId,
firstName,
lastName,
dob: insuranceEligibilityData.dateOfBirth,
userId: job.userId,
});