Skip to content

Commit

Permalink
RA-2050 - FIX NPE on registration find patient page. (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
mseaton authored Oct 3, 2024
1 parent 8d5c4ef commit 975d6f2
Showing 1 changed file with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,25 @@ public void controller(UiSessionContext uiSessionContext,
) throws EvaluationException {

Location sessionLocation = uiSessionContext.getSessionLocation();
List<Encounter> mostRecentRegistrationEncounters = null;

// only show the most recent registration encounters if a registration encounter has been defined for this app
if (app.getConfig() != null && app.getConfig().get("registrationEncounter") != null) {
model.addAttribute("mostRecentRegistrationEncounters", addMostRecentRegistrationEncounters(model, app, libraries, dsdService, encounterService, sessionLocation));
model.addAttribute("appId", app.getId());
}
else {
model.addAttribute("mostRecentRegistrationEncounters", null);
model.addAttribute("appId", null);
if (app.getConfig() != null) {
JsonNode registrationEncounterConfig = app.getConfig().get("registrationEncounter");
if (registrationEncounterConfig != null) {
JsonNode encounterTypeConfig = registrationEncounterConfig.get("encounterType");
if (encounterTypeConfig != null) {
String encounterTypeUuid = encounterTypeConfig.getTextValue();
EncounterType et = encounterService.getEncounterTypeByUuid(encounterTypeUuid);
if (et == null) {
throw new IllegalStateException("Invalid configuration for registrationEncounter. No encounterType found for uuid " + encounterTypeUuid);
}
mostRecentRegistrationEncounters = addMostRecentRegistrationEncounters(model, app, libraries, dsdService, encounterService, sessionLocation);
}
}
}
model.addAttribute("mostRecentRegistrationEncounters", mostRecentRegistrationEncounters);
model.addAttribute("appId", app.getId());

JsonNode columnConfig = null;
if (app.getConfig() != null) {
Expand Down

0 comments on commit 975d6f2

Please sign in to comment.