listHealthElementsByHCPartyAndPatient method

Future<List<DecryptedHealthElementDto>> listHealthElementsByHCPartyAndPatient(
  1. UserDto user,
  2. String hcPartyId,
  3. PatientDto patient,
  4. CryptoConfig<DecryptedHealthElementDto, HealthElementDto> config,
)

Implementation

Future<List<DecryptedHealthElementDto>> listHealthElementsByHCPartyAndPatient(UserDto user, String hcPartyId, PatientDto patient,
    CryptoConfig<DecryptedHealthElementDto, HealthElementDto> config) async {
  final Set<String> keys = await config.crypto.decryptEncryptionKeys(user.dataOwnerId()!, patient.delegations);
  if (keys.isEmpty) {
    throw Exception("No delegation for this user");
  }
  return await listHealthElementsByHCPartyAndPatientForeignKeys(user, hcPartyId, keys.join(","), config);
}