private void populateMergeGrid(PatientMergeVo sourcePatient, PatientMergeVo destinationPatient) { if(sourcePatient == null || destinationPatient == null) return; for(int i=0; i<form.dyngrdMerge().getRows().size(); i++) { DynamicGridRow row = form.dyngrdMerge().getRows().get(i); if(row.getRows().size() > 0) { for(int j =0; j<row.getRows().size(); j++) { populateMergeRow(row.getRows().get(j), sourcePatient, destinationPatient); } } populateMergeRow(form.dyngrdMerge().getRows().get(i), sourcePatient, destinationPatient); } }
private void populateMergeRow(DynamicGridRow row, PatientMergeVo sourcePatient, PatientMergeVo destinationPatient) { if(row == null || sourcePatient == null || destinationPatient == null) return; if(row.getValue() instanceof PatientMergeFields) { populateCell(row.getCells().newCell(getColumn(COL_SOURCE_PATIENT), DynamicCellType.STRING), (PatientMergeFields) row.getValue(), sourcePatient, null, false, false); populateCell(row.getCells().newCell(getColumn(COL_DESTINATION_PATIENT), DynamicCellType.STRING), (PatientMergeFields) row.getValue(), destinationPatient, null, false, false); if(!PatientMergeFields.DATE_OF_DEATH.equals((PatientMergeFields) row.getValue())) { createMoveButtons(row); } populateCell(row.getCells().newCell(getColumn(COL_RESULT_DATA), DynamicCellType.STRING), (PatientMergeFields) row.getValue(), destinationPatient, null, false, false); removeMoveButtons(row); } }
private void open() { form.getLocalContext().setSourcePatient(domain.getPatient(form.getGlobalContext().Core.getPatientSource())); form.getLocalContext().setDestinationPatient(domain.getPatient(form.getGlobalContext().Core.getPatientDestination())); form.getLocalContext().setResultPatient(domain.getDestinationPatient(form.getGlobalContext().Core.getPatientDestination())); populateMergeGrid(form.getLocalContext().getSourcePatient(), (PatientMergeVo) form.getLocalContext().getDestinationPatient().clone()); }
private void populateResultCommChannels(DynamicGridCell cell, PatientMergeVo patient, boolean isFromSource) { if(cell == null) return; for(int i=0; i<cell.getRow().getRows().size(); i++) { DynamicGridCell buttonCell = cell.getRow().getRows().get(i).getCells().get(isFromSource ? getColumn(COL_SOURCE_BUTTONS) : getColumn(COL_DESTINATION_BUTTONS)); DynamicGridCell newCell = cell.getRow().getRows().get(i).getCells().newCell(getColumn(COL_RESULT_DATA), DynamicCellType.STRING); newCell.setReadOnly(true); populateResultChannelCell(buttonCell, isFromSource, patient, newCell); } }
public PatientMergeVo getPatient(ims.core.patient.vo.PatientRefVo patRef) { if(patRef == null) return null; return PatientMergeVoAssembler.create((Patient) getDomainFactory().getDomainObject(Patient.class, patRef.getID_Patient())); }
private void populateResultChannelCell(DynamicGridCell cell, boolean isFromSource, PatientMergeVo patient, DynamicGridCell newCell) { if(cell == null) return; Object rowValue = cell.getRow().getValue(); Patient result = form.getLocalContext().getResultPatient(); Object commChannelValue = null; DynamicGridCell commChannelValueCell = isFromSource ? cell.getRow().getCells().get(getColumn(COL_SOURCE_PATIENT)) : cell.getRow().getCells().get(getColumn(COL_DESTINATION_PATIENT)); DynamicGridCell previousCommChannelValueCell = isFromSource ? cell.getRow().getCells().get(getColumn(COL_DESTINATION_PATIENT)) : cell.getRow().getCells().get(getColumn(COL_SOURCE_PATIENT)); if(commChannelValueCell != null) commChannelValue = commChannelValueCell.getValue(); CommChannelVo channel = getCommChannel((ChannelType) rowValue, commChannelValue, patient.getCommChannels()); CommChannelVo previousChannel = null; if(previousCommChannelValueCell != null) { previousChannel = getCommChannel((ChannelType) rowValue, previousCommChannelValueCell.getValue(), result.getCommChannels()); } newCell.setValue(channel != null ? channel.getCommValue() : null); if(channel != null) { if(result.getCommChannels() == null) result.setCommChannels(new CommChannelVoCollection()); result.getCommChannels().add(channel); } if(previousChannel != null) result.getCommChannels().remove(previousChannel); newCell.setBackColor(isFromSource && !sourceIsEqualWithDestination(cell.getRow()) ? Color.Beige : null); if(!sourceIsEqualWithDestination(cell.getRow())) { DynamicGridCell wasDestinationModified = cell.getRow().getCells().get(getColumn(COL_WAS_MODIFIED)); if(wasDestinationModified == null) wasDestinationModified = cell.getRow().getCells().newCell(getColumn(COL_WAS_MODIFIED), DynamicCellType.BOOL); wasDestinationModified.setValue(isFromSource ? Boolean.TRUE : Boolean.FALSE); } }