Skip to content

Commit

Permalink
Small fix to ensure expected behavior for non existant patient code.
Browse files Browse the repository at this point in the history
  • Loading branch information
ra247362 committed Nov 29, 2024
1 parent 11e4d33 commit d8d2880
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/org/isf/lab/gui/LabBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -515,19 +515,25 @@ class LabBrowsingModel extends DefaultTableModel {
private static final long serialVersionUID = 1L;

public LabBrowsingModel(String exam, LocalDate dateFrom, LocalDate dateTo, String patid) {
boolean exists = true;
try {
Patient pat;
if (patid.isEmpty()) {
pat = null;
} else {
try {
pat = patManager.getPatientById(Integer.parseInt(patid));
exists = pat == null ? false : true;
} catch (NumberFormatException e) {
MessageDialog.error(null, "angal.lab.insertvalidpatientid.msg");
pat = null;
}
}
pLabs = labManager.getLaboratory(exam, dateFrom.atStartOfDay(), dateTo.atStartOfDay(), pat);
if (exists) {
pLabs = labManager.getLaboratory(exam, dateFrom.atStartOfDay(), dateTo.atStartOfDay(), pat);
} else {
pLabs = new ArrayList<>();
}
} catch (OHServiceException e) {
pLabs = new ArrayList<>();
OHServiceExceptionUtil.showMessages(e);
Expand Down

0 comments on commit d8d2880

Please sign in to comment.