feat: MassHealth PDF import auto-pays full balance + patient name fix

- PDF import now marks payments as PAID when MassHealth patient's
  mhPaidAmount >= totalBilled (no patient balance)
- Newly created patients from MH vouchers get insuranceProvider = 'MassHealth'
- Existing patients with blank insuranceProvider get it filled on import
- Fix: update patient name from PDF if existing record has empty name
- Various frontend/selenium/route updates

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-26 00:16:31 -04:00
parent 9efe5c8469
commit b7e06adf2f
15 changed files with 611 additions and 448 deletions

View File

@@ -10,7 +10,8 @@ from selenium_MH_eligibilityHistoryCheckWorker import AutomationMassHealthEligib
from selenium_CMSP_eligibilityHistoryRemainingCheckWorker import AutomationCMSPEligibilityHistoryRemainingCheck
from selenium_claimStatusCheckWorker import AutomationMassHealthClaimStatusCheck
from selenium_preAuthWorker import AutomationMassHealthPreAuth
from selenium_MHPaymentCheckWorker import AutomationMassHealthPaymentCheck
from selenium_MHSinglePaymentCheckWorker import AutomationMassHealthSinglePaymentCheck
from selenium_MHBatchPaymentCheckWorker import AutomationMassHealthBatchPaymentCheck
import os
import time
import helpers_ddma_eligibility as hddma
@@ -290,7 +291,35 @@ async def mh_payment_check(request: Request):
waiting_jobs -= 1
active_jobs += 1
try:
bot = AutomationMassHealthPaymentCheck(data)
bot = AutomationMassHealthSinglePaymentCheck(data)
result = bot.main_workflow("https://provider.masshealth-dental.org/mh_provider_login")
if result.get("status") != "success":
return {"status": "error", "message": result.get("message")}
return result
except Exception as e:
return {"status": "error", "message": str(e)}
finally:
async with lock:
active_jobs -= 1
# Endpoint: 6 — Check MassHealth payments in batch by date range
@app.post("/mh-batch-payment-check")
async def mh_batch_payment_check(request: Request):
global active_jobs, waiting_jobs
data = await request.json()
async with lock:
waiting_jobs += 1
async with semaphore:
async with lock:
waiting_jobs -= 1
active_jobs += 1
try:
bot = AutomationMassHealthBatchPaymentCheck(data)
result = bot.main_workflow("https://provider.masshealth-dental.org/mh_provider_login")
if result.get("status") != "success":