| 226 | | } |
|---|
| | 234 | } |
|---|
| | 235 | return null; |
|---|
| | 236 | |
|---|
| | 237 | } |
|---|
| | 238 | |
|---|
| | 239 | /** |
|---|
| | 240 | * |
|---|
| | 241 | * Returns the first (preferred) patient identifier matching a <code>PatientIdentifierType</code> |
|---|
| | 242 | * Otherwise, returns the first non-voided identifier |
|---|
| | 243 | * Otherwise, null |
|---|
| | 244 | * |
|---|
| | 245 | * @param identifierType |
|---|
| | 246 | * @return |
|---|
| | 247 | */ |
|---|
| | 248 | public PatientIdentifier getPatientIdentifier(PatientIdentifierType pit) { |
|---|
| | 249 | if (getIdentifiers() != null && getIdentifiers().size() > 0) { |
|---|
| | 250 | for (PatientIdentifier id : getIdentifiers()) { |
|---|
| | 251 | if (id.isPreferred() && !id.isVoided() && pit.equals(id.getIdentifierType())) |
|---|
| | 252 | return id; |
|---|
| | 253 | } |
|---|
| | 254 | for (PatientIdentifier id : getIdentifiers()) { |
|---|
| | 255 | if (!id.isVoided() && pit.equals(id.getIdentifierType())) |
|---|
| | 256 | return id; |
|---|
| | 257 | } |
|---|
| | 258 | return null; |
|---|
| | 259 | } |
|---|
| | 260 | return null; |
|---|
| 236 | | if (getIdentifiers() != null && identifiers.size() > 0) { |
|---|
| 237 | | PatientIdentifier found = null; |
|---|
| 238 | | for (PatientIdentifier id : identifiers) { |
|---|
| 239 | | if (id.getIdentifierType().getPatientIdentifierTypeId().equals(identifierTypeId)) { |
|---|
| 240 | | found = id; |
|---|
| 241 | | if (found.isPreferred()) |
|---|
| 242 | | return found; |
|---|
| 243 | | } |
|---|
| 244 | | } |
|---|
| 245 | | return found; |
|---|
| 246 | | } else { |
|---|
| | 271 | if (getIdentifiers() != null && getIdentifiers().size() > 0) { |
|---|
| | 272 | for (PatientIdentifier id : getIdentifiers()) { |
|---|
| | 273 | if (id.isPreferred() && !id.isVoided() && identifierTypeId.equals(id.getIdentifierType().getPatientIdentifierTypeId())) |
|---|
| | 274 | return id; |
|---|
| | 275 | } |
|---|
| | 276 | for (PatientIdentifier id : getIdentifiers()) { |
|---|
| | 277 | if (!id.isVoided() && identifierTypeId.equals(id.getIdentifierType().getPatientIdentifierTypeId())) |
|---|
| | 278 | return id; |
|---|
| | 279 | } |
|---|
| 258 | | if (getIdentifiers() != null && identifiers.size() > 0) { |
|---|
| 259 | | PatientIdentifier found = null; |
|---|
| 260 | | for (PatientIdentifier id : identifiers) { |
|---|
| 261 | | if (id.getIdentifierType().getName().equals(identifierTypeName)) { |
|---|
| 262 | | found = id; |
|---|
| 263 | | if (found.isPreferred()) |
|---|
| 264 | | return found; |
|---|
| 265 | | } |
|---|
| 266 | | } |
|---|
| 267 | | return found; |
|---|
| 268 | | } else { |
|---|
| | 293 | if (getIdentifiers() != null && getIdentifiers().size() > 0) { |
|---|
| | 294 | for (PatientIdentifier id : getIdentifiers()) { |
|---|
| | 295 | if (id.isPreferred() && !id.isVoided() && identifierTypeName.equals(id.getIdentifierType().getName())) |
|---|
| | 296 | return id; |
|---|
| | 297 | } |
|---|
| | 298 | for (PatientIdentifier id : getIdentifiers()) { |
|---|
| | 299 | if (!id.isVoided() && identifierTypeName.equals(id.getIdentifierType().getName())) |
|---|
| | 300 | return id; |
|---|
| | 301 | } |
|---|
| | 325 | |
|---|
| | 326 | /** |
|---|
| | 327 | * Returns only the non-voided identifiers for this patient. |
|---|
| | 328 | * If you want <u>all</u> identifiers, use {@link #getIdentifiers()} |
|---|
| | 329 | * |
|---|
| | 330 | * @return list of non-voided identifiers for this patient |
|---|
| | 331 | * @param identifierType |
|---|
| | 332 | * @see #getIdentifiers() |
|---|
| | 333 | */ |
|---|
| | 334 | public List<PatientIdentifier> getPatientIdentifiers(PatientIdentifierType pit) { |
|---|
| | 335 | List<PatientIdentifier> ids = new Vector<PatientIdentifier>(); |
|---|
| | 336 | if (getIdentifiers() != null) { |
|---|
| | 337 | for (PatientIdentifier pi : getIdentifiers()) { |
|---|
| | 338 | if (pi.isVoided() == false && pit.equals(pi.getIdentifierType())) |
|---|
| | 339 | ids.add(pi); |
|---|
| | 340 | } |
|---|
| | 341 | } |
|---|
| | 342 | return ids; |
|---|
| | 343 | } |
|---|
| | 344 | |
|---|