begin: PHI Column Encryption
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user