createPatient method

Implementation

Future<DecryptedPatientDto?> createPatient(UserDto user, DecryptedPatientDto patient, CryptoConfig<DecryptedPatientDto, PatientDto> config) async {
  var newPatient = await this.rawCreatePatient(await config.encryptPatient(
      user.dataOwnerId()!,
      <String>{...(user.autoDelegations["all"] ?? {}), ...(user.autoDelegations["medicalInformation"] ?? {})},
      (await patient.initPatient().initDelegations(user, config))));
  return newPatient != null ? await config.decryptPatient(user.dataOwnerId()!, newPatient) : null;
}