initPatient method

DecryptedPatientDto initPatient()

Implementation

DecryptedPatientDto initPatient() {
  if (this.lastName == null && this.hasName(PersonNameDtoUseEnum.official)) {
    this.lastName = this
        .findName(PersonNameDtoUseEnum.official)
        .lastName;
  } else if (this.firstName == null && this.hasName(PersonNameDtoUseEnum.official)) {
    this.firstName = this
        .findName(PersonNameDtoUseEnum.official)
        .firstNames
        .firstOrNull;
  } else if (this.maidenName == null && this.hasName(PersonNameDtoUseEnum.maiden)) {
    this.maidenName = this
        .findName(PersonNameDtoUseEnum.maiden)
        .lastName;
  } else if (this.alias == null && this.hasName(PersonNameDtoUseEnum.nickname)) {
    this.alias = this
        .findName(PersonNameDtoUseEnum.nickname)
        .lastName;
  } else if (this.lastName != null && !this.hasName(PersonNameDtoUseEnum.official)) {
    return this._addName(PersonNameDtoUseEnum.official, this.lastName!, this.firstName);
  } else if (this.maidenName != null && !this.hasName(PersonNameDtoUseEnum.maiden)) {
    return this._addName(PersonNameDtoUseEnum.maiden, this.maidenName!, this.firstName);
  } else if (this.alias != null && !this.hasName(PersonNameDtoUseEnum.nickname)) {
    return this._addName(PersonNameDtoUseEnum.nickname, this.alias!, this.firstName);
  }
  return this;
}