Some checks failed
CI/CD Pipeline / pipeline (push) Failing after 3m22s
Suite à la récupération précédente (044ca4b) qui n'avait restauré que les fichiers SUPPRIMÉS, ce commit restaure les MODIFICATIONS d'entités/services qui étaient nécessaires pour que les fichiers restaurés compilent. Restaurés depuis a72ab54^ (=31330d9+ corrections) : - Entities : Organisation, FormuleAbonnement, AuditService, MembreOrganisation, SouscriptionOrganisation, etc. - Services : MigrerOrganisationsVersKeycloakService, ComptabilitePdfService, KycAmlService, AuditService.logKycRisqueEleve, etc. - Resources : PaiementUnifieResource, etc. Backend compile désormais (BUILD SUCCESS).
96 lines
3.0 KiB
Java
96 lines
3.0 KiB
Java
package dev.lions.unionflow.server.entity;
|
|
|
|
import dev.lions.unionflow.server.api.enums.ayantdroit.LienParente;
|
|
import dev.lions.unionflow.server.api.enums.ayantdroit.StatutAyantDroit;
|
|
import jakarta.persistence.*;
|
|
import jakarta.validation.constraints.*;
|
|
import java.time.LocalDate;
|
|
import java.math.BigDecimal;
|
|
import lombok.*;
|
|
|
|
/**
|
|
* Ayant droit d'un membre dans une mutuelle de santé.
|
|
*
|
|
* <p>
|
|
* Permet la gestion des bénéficiaires (conjoint, enfants, parents) pour
|
|
* les conventions avec les centres de santé partenaires et les plafonds
|
|
* annuels.
|
|
*
|
|
* <p>
|
|
* Table : {@code ayants_droit}
|
|
*/
|
|
@Entity
|
|
@Table(name = "ayants_droit", indexes = {
|
|
@Index(name = "idx_ad_membre_org", columnList = "membre_organisation_id"),
|
|
@Index(name = "idx_ad_couverture", columnList = "date_debut_couverture, date_fin_couverture")
|
|
})
|
|
@Data
|
|
@NoArgsConstructor
|
|
@AllArgsConstructor
|
|
@Builder
|
|
@EqualsAndHashCode(callSuper = true)
|
|
public class AyantDroit extends BaseEntity {
|
|
|
|
@NotNull
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
|
@JoinColumn(name = "membre_organisation_id", nullable = false)
|
|
private MembreOrganisation membreOrganisation;
|
|
|
|
@NotBlank
|
|
@Column(name = "prenom", nullable = false, length = 100)
|
|
private String prenom;
|
|
|
|
@NotBlank
|
|
@Column(name = "nom", nullable = false, length = 100)
|
|
private String nom;
|
|
|
|
@Column(name = "date_naissance")
|
|
private LocalDate dateNaissance;
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
@NotNull
|
|
@Column(name = "lien_parente", nullable = false, length = 20)
|
|
private LienParente lienParente;
|
|
|
|
/** Numéro attribué pour les conventions santé avec les centres partenaires */
|
|
@Column(name = "numero_beneficiaire", length = 50)
|
|
private String numeroBeneficiaire;
|
|
|
|
@Column(name = "date_debut_couverture")
|
|
private LocalDate dateDebutCouverture;
|
|
|
|
/** NULL = couverture ouverte */
|
|
@Column(name = "date_fin_couverture")
|
|
private LocalDate dateFinCouverture;
|
|
|
|
@Column(name = "sexe", length = 20)
|
|
private String sexe;
|
|
|
|
@Column(name = "piece_identite", length = 100)
|
|
private String pieceIdentite;
|
|
|
|
@Column(name = "pourcentage_couverture", precision = 5, scale = 2)
|
|
private BigDecimal pourcentageCouvertureSante;
|
|
|
|
@NotNull
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(name = "statut", nullable = false, length = 50)
|
|
@Builder.Default
|
|
private StatutAyantDroit statut = StatutAyantDroit.EN_ATTENTE;
|
|
|
|
// ── Méthodes métier ────────────────────────────────────────────────────────
|
|
|
|
public boolean isCouvertAujourdhui() {
|
|
LocalDate today = LocalDate.now();
|
|
if (dateDebutCouverture != null && today.isBefore(dateDebutCouverture))
|
|
return false;
|
|
if (dateFinCouverture != null && today.isAfter(dateFinCouverture))
|
|
return false;
|
|
return Boolean.TRUE.equals(getActif());
|
|
}
|
|
|
|
public String getNomComplet() {
|
|
return prenom + " " + nom;
|
|
}
|
|
}
|