private void search() { clearResults(); EDischargeSearchCriteriaVo voCriteria = new EDischargeSearchCriteriaVo(); voCriteria.setResponsibleHCP((HcpRefVo)form.ccResponsibleHCP().getValue()); voCriteria.setWard(form.cmbWard().getValue()); voCriteria.setStatus(form.cmbStatus().getValue()); voCriteria.setSpecialty(form.cmbSpecialty().getValue()); voCriteria.setFromDate(form.dteFrom().getValue()); voCriteria.setToDate(form.dteTo().getValue()); voCriteria.setClinicaDetailsComplete(form.chkDetailsComplete().getValue() ? YesNo.YES : null); voCriteria.setTTAStatus(form.cmbTTA().getValue()); voCriteria.setNonCornish(form.chkNoEmail().getValue()); form.getGlobalContext().setEDischargeSearchCriteria(voCriteria); long startTimeDB = System.currentTimeMillis(); EdischargeListSTHKManualAssemblyVoCollection summaryDetails = domain.searchByCriteria(voCriteria); long endTimeDB = System.currentTimeMillis(); long startTimeDisplay = System.currentTimeMillis(); if (summaryDetails != null) populateGrid(summaryDetails, null); long endTimeDisplay = System.currentTimeMillis(); setFooter(form.dyngrdDischargeDetails().getRows().size(), endTimeDB-startTimeDB, endTimeDisplay-startTimeDisplay); if (summaryDetails == null || (summaryDetails != null && summaryDetails.size() == 0)) engine.showMessage("No eDischarges found."); }
@Override protected void onDyngrdDischargeDetailsColumnHeaderClicked(DynamicGridColumn column) { if (column.equals(getCol("DISCHARGE_DATE"))) { if(form.getLocalContext().getSortOrderDateOfDischarge() == null) form.getLocalContext().setSortOrderDateOfDischarge(SortOrder.ASCENDING); EdischargeListSTHKManualAssemblyVoCollection voColl = new EdischargeListSTHKManualAssemblyVoCollection(); for (int i = 0 ; i < form.dyngrdDischargeDetails().getRows().size() ; i++) voColl.add(((EdischargeListSTHKManualAssemblyVo) form.dyngrdDischargeDetails().getRows().get(i).getValue())); if(form.getLocalContext().getSortOrderDateOfDischarge().equals(SortOrder.ASCENDING)) { form.getLocalContext().setSortOrderDateOfDischarge(SortOrder.DESCENDING); voColl.sort(new DischargeComparator(SortOrder.DESCENDING)); // WDEV-13138 - Sort using custom comparator } else if(form.getLocalContext().getSortOrderDateOfDischarge().equals(SortOrder.DESCENDING)) { form.getLocalContext().setSortOrderDateOfDischarge(SortOrder.ASCENDING); voColl.sort(new DischargeComparator(SortOrder.ASCENDING)); // WDEV-13138 - Sort using custom comparator } Object selected = form.dyngrdDischargeDetails().getValue(); form.dyngrdDischargeDetails().getRows().clear(); populateGrid(voColl, form.dyngrdDischargeDetails().getSelectedRow() != null ? (EdischargeListSTHKManualAssemblyVo)form.dyngrdDischargeDetails().getSelectedRow().getValue() : null); form.dyngrdDischargeDetails().setValue(selected); } }
private void populateGrid(EdischargeListSTHKManualAssemblyVoCollection summaryDetails, EdischargeListSTHKManualAssemblyVo voToFind) { form.dyngrdDischargeDetails().getRows().clear(); for (int i = 0; i < summaryDetails.size(); i++) { DynamicGridRow row = form.dyngrdDischargeDetails().getRows().newRow(); row.setIdentifier(summaryDetails.get(i).getCareContextRefVo()); row.setValue(summaryDetails.get(i)); DynamicGridCell consultantCell = row.getCells().newCell(getCol("CONSULTANT"), DynamicCellType.HTMLVIEW); consultantCell.setValue(summaryDetails.get(i).getResponsibleHCPName()); consultantCell.setTooltip(summaryDetails.get(i).getResponsibleHCPName()); DynamicGridCell wardCell = row.getCells().newCell(getCol("WARD"), DynamicCellType.HTMLVIEW); wardCell.setValue(summaryDetails.get(i).getWardIsNotNull() ? summaryDetails.get(i).getWard() : ""); DynamicGridCell dischargeDateCell = row.getCells().newCell(getCol("DISCHARGE_DATE"), DynamicCellType.HTMLVIEW); dischargeDateCell.setValue(summaryDetails.get(i).getDischargeDateIsNotNull() ? (summaryDetails.get(i).getDischargeDate().toString() ) : ""); dischargeDateCell.setTooltip(summaryDetails.get(i).getDischargeDateIsNotNull() ? (summaryDetails.get(i).getDischargeDate().toString() ) : ""); DynamicGridCell patientNameCell = row.getCells().newCell(getCol("PATIENT_NAME"), DynamicCellType.HTMLVIEW); patientNameCell.setValue(summaryDetails.get(i).getPatientName()); patientNameCell.setTooltip(summaryDetails.get(i).getPatientName()); //row.setIdentifier(patientSTHK); row.setValue(summaryDetails.get(i)); DynamicGridCell hospitalNoCell = row.getCells().newCell(getCol("HOSPITAL_NO"), DynamicCellType.HTMLVIEW); hospitalNoCell.setValue(summaryDetails.get(i).getPatientHospnumIsNotNull() ? summaryDetails.get(i).getPatientHospnum() : "" ); hospitalNoCell.setTooltip(summaryDetails.get(i).getPatientHospnumIsNotNull() ? summaryDetails.get(i).getPatientHospnum() : "" ); DynamicGridCell letterStatusCell = row.getCells().newCell(getCol("LETTER_STATUS"), DynamicCellType.HTMLVIEW); letterStatusCell.setValue(summaryDetails.get(i).getLetterStatusIsNotNull() ? summaryDetails.get(i).getLetterStatus() : "");// ? letterStatusCell.setTooltip(summaryDetails.get(i).getLetterStatusIsNotNull() ? summaryDetails.get(i).getLetterStatus() : "");// ? // (summaryDetails.get(i).getDischargeLetterStatus().getImage() != null ? // ("<img src='" +summaryDetails.get(i).getDischargeLetterStatus().getImage().getImagePath()+ "'> ") : "") + // summaryDetails.get(i).getDischargeLetterStatus().getIItemText() : ""); // letterStatusCell.setTextColor(summaryDetails.get(i).getDischargeLetterStatusIsNotNull() ? // summaryDetails.get(i).getDischargeLetterStatus().getTextColor() : Color.Black); // letterStatusCell.setTooltip(summaryDetails.get(i).getDischargeLetterStatusIsNotNull() ? // (summaryDetails.get(i).getDischargeLetterStatus().getImage() != null ? // ("<img src='" +summaryDetails.get(i).getDischargeLetterStatus().getImage().getImagePath()+ "'> ") : "") + // summaryDetails.get(i).getDischargeLetterStatus().getIItemText() : ""); if (voToFind != null && voToFind.equals(summaryDetails.get(i))) form.dyngrdDischargeDetails().setSelectedRow(row); } }