feature: RBAC + Clinical Audit Logging

This commit is contained in:
voltsrage
2026-06-21 15:46:55 +08:00
parent a43db52813
commit 5af6ab490e
83 changed files with 4281 additions and 70 deletions
@@ -5,11 +5,16 @@ public class PatientService : IPatientService
{
private readonly AppDbContext _db;
private readonly IExternalIdentifierService _identifiers;
private readonly IAuditService _audit;
public PatientService(AppDbContext db, IExternalIdentifierService identifiers)
public PatientService(
AppDbContext db,
IExternalIdentifierService identifiers,
IAuditService audit)
{
_db = db;
_identifiers = identifiers;
_audit = audit;
}
public async Task<Patient> RegisterAsync(RegisterPatientRequest req)
@@ -31,6 +36,13 @@ public class PatientService : IPatientService
};
_db.Patients.Add(patient);
await _db.SaveChangesAsync();
await _audit.WriteAsync(
AuditAction.PatientRegistered,
"Patient",
patient.Id,
newValue: new { patient.Mrn, patient.FirstName, patient.LastName });
return patient;
}