Check for a Group Membership

Entities, such as diagnoses, procedures, messages, etc., are grouped into different groups. You can use a predefined method to check if an entity belongs to a group.

Following is an example to check if a procedure belongs to a procedure group:

procedure.inProcedureGroup('MBS_MANDATORY_TIME_ACP')

There is also another way to check for an entity using the SearchBuilder in the following way:

def procedureGroupDetail = new SearchBuilder(ProcedureGroupDetail.class)
        .join("procedureGroup")
        .by("code").eq("MBS_MANDATORY_TIME_ACP")
        .and()
        .join("procedure")
        .by("code").eq(claimLine.procedure1?.code)
        .execute()

However, this is not the best practice as:

  • It triggers a query to the database

  • It does not work if group membership is in a range. For example, all procedures between 1000 and 2000

  • It is not using a predefined method, so it does not use cached information.

Therefore, it is advisable to use the predefined method to avoid database queries wherever possible.