public int compare(EdischargeListSTHKManualAssemblyVo o1, EdischargeListSTHKManualAssemblyVo o2) { if (o1.getDischargeDateIsNotNull() && o2.getDischargeDateIsNotNull()) return o1.getDischargeDate().compareTo(o2.getDischargeDate()) * sortOrder; if (o1.getDischargeDateIsNotNull() && !o2.getDischargeDateIsNotNull()) return sortOrder; if (o2.getDischargeDateIsNotNull() && !o1.getDischargeDateIsNotNull()) return -1 * sortOrder; return 0; }
@Override protected void onDyngrdDischargeDetailsRowSelectionChanged(DynamicGridRow row) { if (row != null && row.getIdentifier() != null && row.getIdentifier() instanceof CareContextRefVo && row.getValue() != null && row.getValue() instanceof EdischargeListSTHKManualAssemblyVo) { form.getGlobalContext().Core.setPatientShort(domain.getPatientByCareContext((CareContextRefVo)row.getIdentifier())); CareContextRefVo careContextRefVo = ((EdischargeListSTHKManualAssemblyVo) row.getValue()).getCareContextRefVoIsNotNull() ? ((EdischargeListSTHKManualAssemblyVo) row.getValue()).getCareContextRefVo() : null; if (careContextRefVo != null) { CareContextShortVo careContextShortVo = domain.getCareContextShort(careContextRefVo); if (careContextShortVo != null) { form.getGlobalContext().Core.setCurrentCareContext(careContextShortVo); form.getContextMenus().Clinical.getEDischargeListViewItem().setVisible(true); } } } else { clearSelectedPatient(); } }
@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); } }