APS - Enrollment Span Helper

Methods

Create Enrollment Span

Method Detail

Value

Method Detail

Value

Visibility

Public

Method Parameters

TransactionDto, Account, List<EnrollmentSpanDto> priorEnrollmentSpans

Return

EnrollmentSpan

Functionality

Below are the steps to create the enrollment span.

  1. Identify the primary subscriber in the transaction (getPrimaryMember)

  2. Generate a unique code for the new enrollment span to be created.

  3. Create the enrollment span entity with the below details retrieved from the transaction

    1. Set the account enrollment span sk to NULL, since this is a new enrollment span.

    2. Set the enrollment span code

    3. Set the account for which the enrollment span is being created

    4. Set the zeus transaction control number

    5. Set the state type code

    6. Set the marketplace type code

    7. Set the business unit type code

    8. Set the coverage type code

    9. Set the start date

    10. Set the end date (determineEndDate)

    11. Set the exchange subscriber id

    12. Set the effectuation date (determineEffectuationDate)

    13. Set the plan

    14. Set the product type

    15. Set the group policy id

    16. Set the changed flag to "TRUE"

    17. Set the enrollment span status (determineEnrollmentSpanStatus)

  4. Save the enrollment span

  5. Call the premium span helper instance to create the premium spans (createPremiumSpans)

Determine Enrollment Span Status

Method Detail

Value

Method Detail

Value

Visibility

Public

Method Parameters

EnrollmentSpan(Current Enrollment Span), List<EnrollmentSpanDto> (Prior Enrollment Spans)

Return Parameter

String

Functionality

If the prior enrollment span is delinquent (isDelinquent) then the status of the current enrollment span is either "DELINQUENT" or "SUSPENDED"

If the end date of the current enrollment span is less than the start date, then status is "CANCELED"

If the prior enrollment span is not delinquent and if the end date of the current enrollment span is greater than the start date and if the effectuation date is not NUL, then the status is "ENROLLED"

If the If the prior enrollment span is not delinquent and if the end date of the current enrollment span is greater than the start date and if the effectuation date is NUL, then the status is "PRE_MEMBER"

If none of the above conditions are met, then return the status as "NO_VALID_STATUS"

Determine Status

Method Detail

Value

Method Detail

Value

Visibility

Public

Method Parameters

EnrollmentSpanStatusDto

Return Parameter

String

Functionality

Invoke the enrollment span status determination method (determineEnrollmentSpanStatus) by passing the current enrollment span the list of prior enrollment span.

Set Enrollment Span

Method Detail

Value

Method Detail

Value

Visibility

Public

Method Parameters

AccountDto, Account, Sting (Ztcn)

Return Parameter

void

Functionality

The main objective of this method is to retrieve the enrollment spans present in the Account entity and convert them into dto object and set them in the Account Dto object.

This method also internally invokes the premium span helper to set the premium span dto in the respective enrollment span dto object.

Update Enrollment Span

Method Detail

Value

Method Detail

Value

Visibility

Public

Method Parameters

AccountDto, TransactionDto, Account

Return Parameter

void

Functionality

Check if there are any enrollment spans that are being affected by add this enrollment span to the account (getOverlappingEnrollmentSpans).

Update these overlapping enrollment spans as appropriate by terming or canceling them as needed. (updateOverlappingEnrollmentSpans)

Update the account dto object with the enrollment spans that have been identified as overlapping and are termed or canceled (updateAccountDtoWithOverlappingSpans)

Save the updated enrollment spans in the database (saveUpdatedEnrollmentSpans)

Create the new enrollment span based on the information from the transaction (createEnrollmentSpan)

Update the account entity with the updated and created enrollment spans.

Cancel Premium Span

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameter

PremiumSpanDto

Return Parameter

void

Functionality

If the premium span start date is not equal to end date or if they are equal and the status is "ACTIVE" then,

  1. Set the end date same as that of the start date

  2. Set the status of the premium span to "CANCEL"

  3. Set the "Changed" flag to TRUE.

Cancel Premium Spans

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameter

Set<PremiumSpanDto>

Return Parameter

void

Functionality

Iterate through each premium span and invoke cancel premium span (cancelPremiumSpan) method to cancel the premium span.

Determine Effectuation Date

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameters

TransactionDto, List<EnrollmentSpan> (Prior Enrollment Spans)

Return parameter

LocalDate

Functionality

Perform the below steps to determine if an effectuation date should be returned or not.

  1. If the responsibility amount for the enrollment is zero then, return the current date as the effectuation date.

  2. If there is at least one prior enrollment span that is in Enrolled Status, and

    1. It has the same plan (isSamePlan) and

    2. There is no gap in coverage between the prior enrollment span and the new enrollment (isThereGapInCoverage)

    3. Then return the current date as the effectuation date.

  3. If current date is not returned as effectuation date in steps 1 and 2, then return NULL.

Determine End Date

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameters

LocalDate (Start Date), LocalDate (End Date)

Return Parameter

LocalDate

Functionality

If the end date is passed in as a non-null value, then return the end date value.

If the end date is passed in as NULL, then get the year of the start date and return the last day of the same year as the end date.

Get Exchange Subscriber Id

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameters

TransactionMemberDto (Primary Subscriber Info)

Return Parameter

String (Exchange Subscriber Id)

Functionality

Iterate through the identifiers list of the member to find an identifier of type "EXCHSUBID" and return the value.

Get Overlapping Enrollment Spans

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameters

AccountDto, LocalDate (Effective Start date), LocalDate (Effective End Date), String (coverageTypeCode)

Return Parameter

List<EnrollmentSpanDto>

Functionality

Follow the below steps to identify the enrollment spans that will overlap with the the effective date received for the transaction.

  1. Get all the enrollment spans that are present for the year for which the effective date is received and has the same coverage type code that is passed to the method. i.e. if the effective date is 2/1/2023 get all the enrollment spans that belong to the year 2023 and also has the same coverage type code "FAM" or "DEP".

  2. From the enrollment spans filtered from step 1, get all the enrollment spans that have the end date that is greater than the effective start date. This eliminates all the enrollment spans that are termed prior to the effective start date of the transaction.

  3. From the enrollment spans filtered from step 2, Get all enrollment spans that have the start date that is before the effective end date received in the transaction and is not in CANCEL status.

  4. After completion of steps 1, 2 and 3, if there are any overlapping enrollment spans still, present, return that list, else return NULL.

Get Primary Member

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameters

TransactionDto

Return

TransactionMemberDto

Functionality

Iterate through the members in the transaction the retrieve the member with the relationship type code "HOH"

Note: No exception handling is added if no member with relationship type code of "HOH" is not present, because such validations should have been done by rules well before the transaction is at this step.

Get Prior Enrollment Spans

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameter

AccountDto, LocalDate (Start Date), boolean (match cancel span or not)

Return Parameter

List<EnrollmentSpanDto>

Functionality

Get all the enrollment spans that are in the account with end date that is prior to the start date of the transaction.

If the match cancel span boolean is set to false then remove any canceled enrollment spans (removeCanceledSpans) from the list and then return the enrollment that has the max end date among all of the remaining enrollment spans.

Is Delinquent

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameters

EnrollmentSpan (Current Enrollment Span), List<EnrollmentSpanDto> priorEnrollmentSpans

Return Parameter

int

Functionality

This method returns one of the three below values

1 - To indicate the current enrollment span should be set to delinquent

-1 - To indicate that the current enrollment span should be set to suspended

0 - To indicate that the current enrollment span is not delinquent.

Below is how the logic is perform the determine which of the above three should be sent.

Check for below conditions

  1. Current Enrollment Span effectuation date is not NULL

  2. Current Enrollment Span delinquency indicator is set to TRUE

  3. Current Enrollment Span start date is greater than the end date (Cancel span condition)

If any of the above conditions are false, then span is not delinquent return the value "0"

If all of the above conditions are true, then follow the below logic.

  1. If the current enrollment span does not have claim paid through date, then return the value -1 (Suspended - Note at this point the delinquency indicator is true and the effectuation date is not null)

  2. If the current enrollment span has a claim paid through date then

    1. If the the current system date is before or equal to the claim paid through date and

    2. There is no gap in coverage between the current enrollment and the prior enrollment span, and

    3. Both enrollments are for the same plan and

    4. The prior enrollment span is in delinquent status

    5. If all of the above conditions are true, then return the value "1" (Delinquent)

    6. If any of the above conditions are false, then return the value "-1" (Suspended)

 

Is Same Plan

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameters

String (Current plan), String (Prior Plan)

Return Parameter

Boolean

Functionality

Return true if the current plan and prior plan are same, return false if they are different.

Is There Gap In Coverage

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameters

Local Date(Effective Start Date), EnrollmentSpanDto (Prior Enrollment Span)

Return Parameter

boolean

Functionality

If the prior enrollment span is in "CANCEL" status, then return true.

Determine the number of days between the last day of the prior enrollment span and the effective start date.

If the number of days gap is greater than 1 then return true, else return false.

Remove Canceled Spans

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameter

List<EnrollmentSpanDto>

Return Parameter

List<EnrollmentSpanDto>

Functionality

Iterate through the input list of enrollment spans and remove the enrollment spans that are canceled and return the remaining enrollment spans.

Save Updated Enrollment Spans

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameter

List<EnrollmentSpanDto>, Account

Return Parameter

List<EnrollmentSpan>

Functionality

Retrieve the enrollment spans from the list and convert them into enrollment span entities with the help of the mapper and set the account the MMS key of the enrollment span and save the enrollment span to the repository. The corresponding premium spans are also updated by invoking the methods in the premium span helper.

Update Account Dto With Overlapping Spans

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameters

AccountDto, List<EnrollmentSpanDto> (overlapping enrollment spans)

Return Parameter

void

Functionality

In the account dto, remove the enrollment span that matches using the enrollment span code from the overlapping enrollment span list.

Once the stale enrollment spans are removed, add the overlapping enrollment span list received in the input to the account.

Update Overlapping Enrollment Spans

Method Detail

Value

Method Detail

Value

Visibility

Private

Method Parameters

List<EnrollmentSpanDto> (Overlapping Enrollment Spans), LocalDate (Effective Start Date), LocalDate (Effective End Date)

Return Parameter

List<EnrollmentSpanDto>

Functionality

The objective of this method is to identify the overlapping enrollment spans and term or cancel them appropriately. It follows the below steps to achieve this objective.

  1. Get the enrollment span in which the effective date is falling in between its start date and end date.

  2. Term the enrollment span identified in step 1, the premium spans will also be termed or canceled

  3. If there are additional overlapping enrollment spans, cancel those enrollment spans. All the premium spans should be canceled.