private void populateResultsToScreen(TTAMedicationAndPharmacyShortVoCollection results) { // Clear results grid form.grdWorklist().getRows().clear(); // Terminate function if the results collection is null if (results == null) return; // Add each result to grid for (TTAMedicationAndPharmacyShortVo result : results) { if (result == null) continue; populateResultRow(result, form.grdWorklist().getRows().newRow()); } }
private void populateResultRow(TTAMedicationAndPharmacyShortVo result, grdWorklistRow row) { if (row == null) throw new CodingRuntimeException("Expected row can not be null"); if (result == null) throw new CodingRuntimeException("Expected value can not be null"); // Check patient (mandatory field - must not be null) if (!result.getPatientIsNotNull()) throw new CodingRuntimeException("Expected patient can not be null"); // Set column values row.setColHospNumber(result.getPatient().getHospnum() != null ? result.getPatient().getHospnum().getValue() : ""); row.setColPatientName(result.getPatient().getName().toString()); row.setColDob(result.getPatient().getDob()); row.setColSex(result.getPatient().getSexIsNotNull() ? result.getPatient().getSex().getText() : ""); row.setColLocWard(result.getCareContext().getPasEventIsNotNull() && result.getCareContext().getPasEvent().getLocationIsNotNull() ? result.getCareContext().getPasEvent().getLocation().getName() : ""); row.setColExpDateOfDisch(result.getCareContext().getEstimatedDischargeDate()); row.setColDateSubmitt(result.getDateSubmittedToPharmacy()); row.setColPharmacyStatus(result.getCurrentTTAStatusIsNotNull() && result.getCurrentTTAStatus().getStatusIsNotNull() ? result.getCurrentTTAStatus().getStatus().getText() : ""); // Set row value row.setValue(result); }
public int compare(TTAMedicationAndPharmacyShortVo o1, TTAMedicationAndPharmacyShortVo o2) { if (o1 == null || o2 == null) return 0; if (!o1.getPatientIsNotNull() || !o2.getPatientIsNotNull()) return 0; if (o1.getPatient().getDobIsNotNull()) return direction * o1.getPatient().getDob().compareTo(o2.getPatient().getDob()); if (o2.getPatient().getDobIsNotNull()) return (-1) * direction; return 0; }
@Override protected void onGrdWorklistGridHeaderClicked(int column) throws PresentationLogicException { switch (column) { case COL_DOB: // Set sort order if (!SortOrder.ASCENDING.equals(form.getLocalContext().getColumnDOBSortOrder())) form.getLocalContext().setColumnDOBSortOrder(SortOrder.ASCENDING); else form.getLocalContext().setColumnDOBSortOrder(SortOrder.DESCENDING); // Get values TTAMedicationAndPharmacyShortVoCollection list = form.grdWorklist().getValues(); // Save selected value TTAMedicationAndPharmacyShortVo selected = form.grdWorklist().getValue(); // Sort values populateResultsToScreen(list.sort(new DoBComparator(form.getLocalContext().getColumnDOBSortOrder()))); // Re-select the saved value form.grdWorklist().setValue(selected); break; } // Update controls state updateControlsState(); }
@Override protected void onTimer(Timer timer) throws PresentationLogicException { TTAMedicationAndPharmacyShortVo selected = form.grdWorklist().getValue(); search(false); form.grdWorklist().setValue(selected); updateControlsState(); }