GenerateCbpBills¶
GenerateCbpBills builds the internal CBP (CbpBill) representation of an indexed e-bill (operation OP-DOM-06): it derives the bill type, statement dates, worker identification, priority/rebill flags, per-service codes/quantities/tooth codes/service locations, and procedure/diagnosis lists, persists the new records through IRepositoryFactory/IUnitOfWork, and finally marks the e-bill CbpSetup. It resolves service and location codes by delegating to ServiceCodeManager/IServiceCodeManager rather than duplicating that lookup logic.
Purpose¶
- Translates an indexed
Ebilland its services into aCbpBillwith associated services, procedures, and diagnoses, applying the bill-type, date, worker, and flag rules used by downstream CBP processing (DOM-BR-050 through DOM-BR-064). - Inserts the generated
CbpBilland its child records via the repository factory, and sets the e-bill status to CbpSetup once generation completes (DOM-BR-063). - Provides standalone helper methods (service code selection, tooth-number validation, service-type-code derivation, service-location derivation, e-bill type derivation) that the main
Generatemethod composes and that other Ebilling code can also call directly.
Context¶
- Namespace:
SAIF.Domain.Claims.Ebilling - Assembly/package:
SAIF.Domain(Domain/SAIF.Domain/SAIF.Domain.csproj, .NET Framework 4.6.2 class library)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| Generate | public static GenerateCBPBillsResults Generate(IUnitOfWork uow, Ebill bill, string currentUser, IEbillingQueryProvider ebillingQueryProvider, IErrorConditionHandler errorConditionHandler, ILogWriter controlReport, GenerateCBPBillsResults billResults, IServiceCodeManager serviceCodeManager, ICCClaimApiService ccclaimApiService) |
Builds and inserts the CbpBill (type, dates, worker data, priority/rebill flags), its services, procedures, and diagnoses for the given e-bill, then sets the e-bill status to CbpSetup (DOM-BR-050–DOM-BR-063). |
| GetCbpProviderServiceCode | public static string GetCbpProviderServiceCode(string natinalDrugCode, string revenueCode, string serviceCode) |
Chooses the code to bill for a non-institutional service: the NDC when present, otherwise the revenue code, otherwise the service code (DOM-BR-056). |
| GetCbpProviderServiceCodeForInstitutional | public static string GetCbpProviderServiceCodeForInstitutional(string revenueCode, string serviceCode) |
Chooses the code to bill for an institutional service: the revenue code when present, otherwise the service code (DOM-BR-056). |
| GetServiceLocationForInstitutionalServiceLine | public static string GetServiceLocationForInstitutionalServiceLine(CbpBill cbpBill) |
Derives the service-location code for an institutional bill, distinguishing inpatient from outpatient (DOM-BR-060). |
| DetermineServiceLocationCode | public static string DetermineServiceLocationCode(Ebill ebill, CbpBill cbpBill) |
Derives the service-location code for a bill, using the institutional inpatient/outpatient rule when applicable and otherwise taking it from UbBillTypeCode (DOM-BR-060). |
| GetToothNumber | public static decimal? GetToothNumber(string toothCode, string billServiceTypeCode, IErrorConditionHandler errorConditionHandler, EbillService service) |
Validates and returns the tooth number for a dental ("D") service, recording a bill-service error when the tooth code is invalid (DOM-BR-059). |
| GetCbpBillServiceTypeCode | public static string GetCbpBillServiceTypeCode(EbillService service, IEbillingQueryProvider ebillingQueryProvider, IErrorConditionHandler errorConditionHandler, string serviceTypeCode) |
Returns the CBP service type code (P/D/R/serviceType/U) for a service and flags an invalid National Drug Code as an error condition (DOM-BR-064). |
| GetEbillType | public static string GetEbillType(IEbillingQueryProvider ebillingQueryProvider, Ebill bill) |
Derives the e-bill type code: I for an institutional bill with a resolvable place of service, O for institutional without one, otherwise S (DOM-BR-050). |
Behavioral notes¶
Generatede-duplicates diagnosis codes and only sets diagnosis pointers on Standard-type bills (DOM-BR-061); other bill types are built without pointers.- Worker tax IDs equal to
999999999are nulled and 9-digit tax IDs are reformatted toxxx-xx-xxxxas part ofGenerate's worker-data step (DOM-BR-053). GetCbpBillServiceTypeCodeandGetServiceCode-style resolution ultimately call intoServiceCodeManager/IServiceCodeManagerfor code lookups rather than queryingIEbillingQueryProviderdirectly for service codes.
Sources¶
Domain/SAIF.Domain/Claims/Ebilling/GenerateCBPBills.cs