BillRateService¶
Calculates the allowed (paid) amount for a legal-bill service line by applying, in order, copy-fee rates, unknown-service zeroing, IME contract rates, and MCO contract rates found through IUnitOfWork and IProviderQueryProvider/IClaimQueryProvider lookups, falling back to full billed-amount reimbursement when no applicable fee schedule is found. It also flags a service line as a possible or exact duplicate of an existing service line on another bill for the same case/provider/service date.
Purpose¶
- Determines the paid amount for a bill service line based on its service type (electronic/paper copy, unknown service, IME rate, MCO rate, or standard/full reimbursement) and records the corresponding adjustment reason.
- Detects duplicate or possible-duplicate service lines by comparing billed amount, service date, and provider/case across other bills, marking exact duplicates for zero payment and near-matches as possible duplicates.
- Applies the worker's active MCO plan (if the provider participates) or the IME provider fee schedule to cap the paid amount at a configured maximum.
Context¶
- Namespace:
SAIF.Services.Legal.Bills - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package).
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| BillRateService (constructor) | public BillRateService(IUnitOfWork unitOfWork, IProviderQueryProvider providerQueryProvider, IClaimQueryProvider claimQueryProvider, IValidationService validationService) |
Wires the unit of work, provider/claim query providers, and validation service used to compute rates and check for duplicates. |
| CalculateAllowedAmount | public bool CalculateAllowedAmount(long claimId, long providerLocationId, LegalBillService serviceLine) |
Caps the paid amount at the billed amount, validates the service line, then applies copy/unknown-service handling, IME rate, or MCO rate in order; if none apply, sets the paid amount to the full billed amount with a standard rate type and clears the adjustment reason. Returns false only when validation fails. |
| CheckForDuplicateService | public void CheckForDuplicateService(long caseId, long providerLocationId, long billId, LegalBillService serviceLine) |
Sets PaidAmount to 0 and the adjustment reason to DuplicateBill when an existing service line on a different bill for the same case/provider matches exactly on service code, service date, and billed amount; otherwise flags IsPossibleDuplicate when only the provider/case/service date match. |
Behavioral notes¶
CalculateAllowedAmountshort-circuits tofalsewithout modifying the paid amount further (beyond the initial billed-amount cap) whenValidatereports the service line invalid.- IME and MCO rate application (
ApplyImeRate/ApplyMcoRate) look up aBillServiceFeescoped to the service code, effective/expiration date range, and MCO plan or IME provider location; when a fee'sMaximumAmountis exceeded, the paid amount is capped and the adjustment reason is set toImeContractorMcoContractrespectively. ApplyMcoRateonly applies when the claim has an active MCO location for the service date (viaIClaimQueryProvider.GetAllMcoLocations) and the provider participates in that MCO plan (viaIProviderQueryProvider.IsProviderInMco).SetAdjustmentReasonclears the adjustment reason only when it was previously one ofImeContract,McoContract, orNegotiatedRate, preserving other reasons (e.g. manually entered ones) when no new reason applies.
Constraints and usage notes¶
- Only
unitOfWorkis null-checked in the constructor viaEnforce.ArgumentNotNull; the remaining collaborator parameters are not validated for null.* CalculateAllowedAmountandCheckForDuplicateServiceboth require a non-nullserviceLine, enforced viaEnforce.ArgumentNotNull.
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.
Sources¶
Services/SAIF.Services/Legal/Bills/BillRateService.cs