Skip to content

Commit

Permalink
Ap-84-V2 - Filter null values
Browse files Browse the repository at this point in the history
  • Loading branch information
icrc-toliveira committed Sep 5, 2022
1 parent e68550e commit 2560bbc
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void mapAppointmentRequestToAppointment(AppointmentRequest appointmentReq
if (appointmentRequest.getServiceTypeUuid() != null) {
appointmentServiceType = getServiceTypeByUuid(appointmentServiceDefinition.getServiceTypes(true), appointmentRequest.getServiceTypeUuid());
}
if (StringUtils.isNotBlank(appointmentRequest.getStatus())){
if (StringUtils.isNotBlank(appointmentRequest.getStatus())) {
appointment.setStatus(AppointmentStatus.valueOf(appointmentRequest.getStatus()));
}
appointment.setServiceType(appointmentServiceType);
Expand Down Expand Up @@ -171,14 +171,12 @@ public AppointmentProviderResponse mapProviderResponse(String response) {


private AppointmentServiceType getServiceTypeByUuid(Set<AppointmentServiceType> serviceTypes, String serviceTypeUuid) {
return serviceTypes.stream()
.filter(avb -> avb.getUuid().equals(serviceTypeUuid)).findAny().get();
return serviceTypes.stream().filter(avb -> avb.getUuid().equals(serviceTypeUuid)).findAny().get();
}

public Appointment mapQueryToAppointment(AppointmentQuery searchQuery) {
Appointment appointment = new Appointment();
appointment.setService(
appointmentServiceDefinitionService.getAppointmentServiceByUuid(searchQuery.getServiceUuid()));
appointment.setService(appointmentServiceDefinitionService.getAppointmentServiceByUuid(searchQuery.getServiceUuid()));
appointment.setPatient(patientService.getPatientByUuid(searchQuery.getPatientUuid()));
appointment.setProvider(identifyAppointmentProvider(searchQuery.getProviderUuid()));
appointment.setLocation(identifyAppointmentLocation(searchQuery.getLocationUuid()));
Expand All @@ -202,8 +200,7 @@ private AppointmentDefaultResponse mapToDefaultResponse(Appointment a, Appointme
response.setStatus(a.getStatus().name());
response.setComments(a.getComments());
response.setTeleconsultation(a.getTeleconsultation());
if (appointmentResponseExtension != null)
response.setAdditionalInfo(appointmentResponseExtension.run(a));
if (appointmentResponseExtension != null) response.setAdditionalInfo(appointmentResponseExtension.run(a));
response.setProviders(mapAppointmentProviders(a.getProviders()));
response.setRecurring(a.isRecurring());
response.setVoided(a.getVoided());
Expand Down Expand Up @@ -255,9 +252,7 @@ private Map createPatientMap(Patient p) {
map.put("identifier", p.getPatientIdentifier().getIdentifier());
map.put("age", p.getAge());
map.put("gender", p.getGender());
map.putAll(p.getActiveIdentifiers().stream()
.collect(Collectors.toMap(e -> e.getIdentifierType().toString().replaceAll("[- ]", ""),
e -> e.getIdentifier())));
map.putAll(p.getActiveIdentifiers().stream().filter(e -> e.getIdentifierType() != null).collect(Collectors.toMap(e -> e.getIdentifierType().toString().replaceAll("[- ]", ""), e -> e.getIdentifier())));
return map;
}

Expand Down

0 comments on commit 2560bbc

Please sign in to comment.