BillQueryService¶
Executes bill search, inbox, and explanation-of-benefits queries against CbpBill data, applying claim-security filtering via ClaimUserSecurityAccess and enriching results with data fetched from Guidewire's IClaimDataApiClient and IFinancialDataApiClient. It depends on IUnitOfWork for repository access, IUserProfileService for the acting user's identity and security context, IDocumentService to render the EOB PDF, IClaimInformationService for security-override checks, and several query providers (IBillQueryProvider, IClaimQueryProvider, IAuditNoteQueryProvider, IWorkerQueryProvider) plus ICCClaimApiService used when constructing the domain Bill for EOB generation.
Purpose¶
- Searches bills by flexible criteria (bill ID, check number, claim number, status, type, provider, date ranges), filtering out results the current user is not authorized to see due to claim restriction conflicts.
- Searches "bill entry" queue bills by a distinct set of entry-oriented criteria (provider tax ID, provider location, worker tax ID, received-date ranges), applying the same conflict-based security filter.
- Searches bills by responsible-party mail ID for an inbox view, optionally including items not yet due for review.
- Generates an Explanation of Benefits document as a PDF for a given bill.
Context¶
- Namespace:
SAIF.Services.Claims.Bills - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package).
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| BillQueryService (constructor) | public BillQueryService(IUnitOfWork unitOfWork, IUserProfileService profileService, IDocumentService document, IClaimInformationService claimInfo, IBillQueryProvider billQueryProvider, IClaimQueryProvider claimQueryProvider, IAuditNoteQueryProvider auditNoteQueryProvider, IWorkerQueryProvider workerQueryProvider, ICCClaimApiService claimApiService, IClaimDataApiClient gwClaimDataApiClient, IFinancialDataApiClient gwFinancialDataApiClient) |
Wires the unit of work, user-profile, document, claim-information, and query-provider/API-client collaborators used by all search and EOB operations. |
| SearchByCriteria | public SearchResult SearchByCriteria(SearchCriteria criteria) |
Runs a filtered bill search (excluding pending/disallowed statuses), pages results to 300 items, cross-checks each bill's claim against Guidewire claim data, drops claims the caller cannot access due to a restriction conflict, and attaches the associated check number to each result item. |
| GetBillEntryBillsByCriteria | public SearchResult GetBillEntryBillsByCriteria(BillEntrySearchCriteria criteria) |
Runs a bill-entry-focused search (by provider, worker, claim number, or received-date range), pages results to 300 items, filters out bills tied to a worker-conflicted claim unless the caller has conflict access or a recorded security override, and attaches the associated check number to each result. |
| SearchByResponsiblePartyId | public InboxResult SearchByResponsiblePartyId(string responsiblePartyId, bool displayAll) |
Returns bills currently assigned to the given responsible-party mail ID, restricted by default to items due for review on or before today (displayAll disables that date filter), excluding claims the caller cannot access, and includes the responsible party's display name. |
| GetExplanationOfBenefits | public MemoryStream GetExplanationOfBenefits(long billId) |
Builds the domain Bill's EOB XML and renders it through IDocumentService as a PDF, returning the generated document as an in-memory stream. |
Behavioral notes¶
- Applies claim-level security by constructing
ClaimUserSecurityAccessfrom the current user and checkingHasConflictbefore exposing a claim's bill data, hiding conflicted items and flagging the result asSecurityFiltered. - Calls the Guidewire
IClaimDataApiClient.GetClaims/IFinancialDataApiClient.GetPaymentsByInvoiceNumber/GetBillDetailsForCheckNumbersynchronously via.GetAwaiter().GetResult(), blocking on what are otherwise asynchronous external API calls.* - Truncates check-number lookups and claim ID batches to prevent exceeding the Oracle
IN-clause limit (explicitly documented in code as avoidingORA-01795). - A static constructor calls
BillMappingHelper.MapBillQueryService(), registering AutoMapper mappings once per process. GetExplanationOfBenefitsconstructs a new domainBillobject directly (bypassing the query providers used elsewhere for search) to generate EOB XML.*
Constraints and usage notes¶
SearchByCriteriaandGetBillEntryBillsByCriteriacap returned rows at 300/299 respectively and setMoreItemsExistwhen the underlying query exceeds that page size; callers must narrow criteria to retrieve additional results.- Constructor null-checks are only applied to
unitOfWork,profileService,document, andclaimInfo; the remaining query-provider/API-client parameters are not validated for null.*
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/Claims/Bills/BillQueryService.cs