Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RA-2050 - FIX NPE on registration find patient page. #146

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading