BillRegenerator¶
BillRegenerator implements OP-DOM-16, the bill-regeneration workflow that clones a rejected or corrected CbpBill into a brand-new bill so it can re-enter the CBP processing pipeline without losing its original service, procedure, and diagnosis detail. It copies every scalar field from the source CbpBill (worker, provider, dates, addresses, totals) onto a new entity tagged with a regenerated entry-source code, re-adds the services, procedures, and diagnoses, persists the clone through IRepositoryFactory, and then drives the new Bill domain wrapper through ModifyStatus so the clone starts life at status Entered with responsible party SYSTEM (DOM-BR-160). Callers in SAIF.Services invoke it when a bill needs to be resubmitted.
Purpose¶
- Clones a bill's core data plus its services, procedures, and diagnoses into a fresh
CbpBillrow so the original audit/status history is not disturbed. - Sets the regenerated bill's initial state to Entered with responsible party SYSTEM, per DOM-BR-160.
- Provides the SAIF.Services layer with a single entry point for bill regeneration, isolating the field-by-field copy logic from the caller.
Context¶
- Namespace:
SAIF.Domain.Claims.Bills - Assembly/package:
SAIF.Domain(packaged inSAIF.SAIFCode.Core)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| Regenerate | public static bool Regenerate(IRepositoryFactory factory, Bill bill, IUserProfileService profileService, string noteText, IBillQueryProvider billQueryProvider, IClaimQueryProvider claimQueryProvider, IAuditNoteQueryProvider auditNoteQueryProvider, IWorkerQueryProvider workerQueryProvider, ICCClaimApiService claimApiService, IClaimDataApiClient gwClaimDataApiClient) |
Clones bill's data, services, procedures, and diagnoses into a new CbpBill tagged with the regenerated entry-source code, persists it, and moves the new bill to status Entered with responsible party SYSTEM via Bill.ModifyStatus (DOM-BR-160); always returns true on completion*. |
Behavioral notes¶
- The clone's
BillEntrySourceis obtained fromIBillQueryProvider.GetRegeneratedBillEntrySourceCode(), distinguishing regenerated bills from originally entered ones. noteText, when supplied, is passed through toBill.ModifyStatusand becomes an audit note attached to the regenerated bill's status change.- The method has no failure return path in the current implementation; any error surfaces as an unhandled exception rather than a
falseresult*.
Constraints and usage notes¶
- Callers must supply query providers for bills, claims, audit notes, and workers because the cloned
Billwrapper is constructed with the same dependency set as any otherBill. factorymust supportGetRepository<CbpBill>().Add, since the clone is persisted before status modification.
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
Domain/SAIF.Domain/Claims/Bills/BillRegenerator.cs