begin: PHI Column Encryption

This commit is contained in:
voltsrage
2026-06-22 21:18:36 +08:00
parent 518cc5b99a
commit 46db694820
21 changed files with 3177 additions and 6 deletions
@@ -21,6 +21,9 @@ public class PatientConfiguration : IEntityTypeConfiguration<Patient>
builder.Property(p => p.Allergies).HasColumnName("allergies");
builder.Property(p => p.EmergencyContactName).HasColumnName("emergency_contact_name").HasMaxLength(200);
builder.Property(p => p.EmergencyContactPhone).HasColumnName("emergency_contact_phone").HasMaxLength(20);
builder.Property(p => p.NameSearchToken)
.HasColumnName("name_search_token")
.HasMaxLength(64);
builder.Property(p => p.CreatedAt).HasColumnName("created_at").HasDefaultValueSql("NOW()");
// MRN uses exact-match unique index — MRN lookups are always equality checks,
@@ -29,5 +32,6 @@ public class PatientConfiguration : IEntityTypeConfiguration<Patient>
// equality match — so no index here; full ILIKE is intentionally unindexed
// at this scale (pg_trgm GIN would be warranted at >500k patients).
builder.HasIndex(p => p.Mrn).IsUnique();
builder.HasIndex(p => p.NameSearchToken);
}
}