fix: DDMA claim checkbox, eligibility patient name, and ID+DOB patient lookup
- Claim step2: robust member checkbox selection with page-wide fallback - Eligibility: take patient name from 'Benefits for' heading, not subscriber name - Processor: update the patient just created/matched by ID+DOB, not first ID match Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -167,12 +167,17 @@ export async function createOrUpdatePatientByInsuranceId(options: {
|
||||
}
|
||||
|
||||
try {
|
||||
await storage.createPatient(patientData);
|
||||
const created = await storage.createPatient(patientData);
|
||||
console.log(`[createOrUpdatePatient] patient created successfully for insuranceId="${normalizedId}"`);
|
||||
// Return the record just created — family members share an insuranceId, so an
|
||||
// id-only lookup could return a different member.
|
||||
if (created?.id) return created;
|
||||
} catch (dbErr: any) {
|
||||
console.error(`[createOrUpdatePatient] DB create failed:`, dbErr?.message ?? dbErr);
|
||||
throw dbErr;
|
||||
}
|
||||
|
||||
return storage.getPatientByInsuranceId(normalizedId);
|
||||
return dobDate
|
||||
? storage.getPatientByInsuranceIdAndDob(normalizedId, dobDate)
|
||||
: storage.getPatientByInsuranceId(normalizedId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user