From b53ca0a3bfdb428c63e5924ee9b234881d8cdb92 Mon Sep 17 00:00:00 2001 From: Clement Hennequin Date: Wed, 6 Nov 2024 15:07:07 -0500 Subject: [PATCH] fix on legalName get --- .../immregistries/iis/kernal/model/PatientMaster.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/immregistries/iis/kernal/model/PatientMaster.java b/src/main/java/org/immregistries/iis/kernal/model/PatientMaster.java index 04b65d3a..8d785aa7 100644 --- a/src/main/java/org/immregistries/iis/kernal/model/PatientMaster.java +++ b/src/main/java/org/immregistries/iis/kernal/model/PatientMaster.java @@ -417,17 +417,21 @@ public PatientName getLegalName() { return patientNames.stream().filter(patientName -> "L".equals(patientName.getNameType())).findFirst().orElse(null); } + public PatientName getLegalNameOrFirst() { + return patientNames.stream().filter(patientName -> "L".equals(patientName.getNameType())).findFirst().orElse(this.getPatientNameFirst()); + } + public String getNameLast() { - return this.getPatientNameFirst().getNameLast(); + return this.getLegalNameOrFirst().getNameLast(); } public String getNameFirst() { - return this.getPatientNameFirst().getNameFirst(); + return this.getLegalNameOrFirst().getNameFirst(); } public String getNameMiddle() { - return this.getPatientNameFirst().getNameMiddle(); + return this.getLegalNameOrFirst().getNameMiddle(); } }