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
@@ -8,17 +8,26 @@ public class PatientService : IPatientService
private readonly IExternalIdentifierService _identifiers;
private readonly IAuditService _audit;
private readonly PatientOptions _options;
private readonly IPhiEncryptionService _crypto;
private readonly IPhiAccessLogService _phiAccess;
private readonly IHttpContextAccessor _http;
public PatientService(
AppDbContext db,
IExternalIdentifierService identifiers,
IAuditService audit,
IOptions<PatientOptions> options)
IOptions<PatientOptions> options,
IPhiEncryptionService crypto,
IPhiAccessLogService phiAccess,
IHttpContextAccessor http)
{
_db = db;
_identifiers = identifiers;
_audit = audit;
_options = options.Value;
_crypto = crypto;
_phiAccess = phiAccess;
_http = http;
}
public async Task<Patient> RegisterAsync(RegisterPatientRequest req)
@@ -37,6 +46,7 @@ public class PatientService : IPatientService
EmergencyContactPhone = req.EmergencyContactPhone,
CreatedAt = DateTimeOffset.UtcNow
};
SetNameSearchToken(patient);
_db.Patients.Add(patient);
try
@@ -260,4 +270,10 @@ public class PatientService : IPatientService
.SingleAsync();
return $"{_options.MrnPrefix}-{seq.ToString($"D{_options.MrnDigits}")}";
}
private void SetNameSearchToken(Patient patient)
{
patient.NameSearchToken = _crypto.ComputeNameSearchToken(
patient.FirstName, patient.LastName);
}
}