Skip to content

Commit 9dd7afc

Browse files
committed
Added currenlty hospitalized handling for doctor declaration
1 parent 48440bf commit 9dd7afc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/doctordeclaration/AbstractDoctorDeclarationMessageProcessingFlow.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
package de.symeda.sormas.api.externalmessage.processing.doctordeclaration;
1717

18+
import java.time.LocalDate;
1819
import java.util.ArrayList;
1920
import java.util.Date;
2021
import java.util.List;
@@ -372,6 +373,15 @@ protected void postBuildHospitalization(CaseDataDto caseDto, ExternalMessageDto
372373
hospitalizationDto.setDischargeDate(externalMessageDto.getHospitalizationDischargeDate());
373374
hospitalizationDto.setAdmittedToHealthFacility(externalMessageDto.getAdmittedToHealthFacility());
374375

376+
// we need to do a sanity check on discharge date
377+
// if the discharge date is before today's date, we need to handle it
378+
if (hospitalizationDto.getDischargeDate() != null && hospitalizationDto.getDischargeDate().before(new Date())) {
379+
hospitalizationDto.setCurrentlyHospitalized(YesNoUnknown.NO);
380+
} else {
381+
// the date is either null or in the future so we consider the patient currently hospitalized
382+
hospitalizationDto.setCurrentlyHospitalized(YesNoUnknown.YES);
383+
}
384+
375385
caseDto.setResponsibleRegion(hospitalFacility.getRegion());
376386
caseDto.setResponsibleDistrict(hospitalFacility.getDistrict());
377387
caseDto.setResponsibleCommunity(hospitalFacility.getCommunity());

0 commit comments

Comments
 (0)