private int addTrackingArea(TrackingCountVo trackingArea, grdTrackingCountRow row) { if(trackingArea == null) return 0; grdTrackingCountRow childRow = null; if(row == null) { childRow = form.grdTrackingCount().getRows().newRow(); } else { childRow = row.getRows().newRow(); } childRow.setColArea(trackingArea.getTrackingArea().getAreaDisplayName()); childRow.setTooltipForColArea(trackingArea.getTrackingArea().getAreaDisplayName());//WDEV-17301 childRow.setColNumberOfPatients(trackingArea.getNumberOfPatiens()); childRow.setValue(trackingArea.getTrackingArea()); /*if(trackingArea.getTrackingArea() != null && Boolean.TRUE.equals(trackingArea.getTrackingArea().getIsOverallView())) { childRow.setSelectable(false); }*/ return trackingArea.getNumberOfPatiensIsNotNull() ? trackingArea.getNumberOfPatiens() : 0; }
private int populateTrackingCount(ILocation currentLocation, grdTrackingCountRow row) { if(row == null) { form.grdTrackingCount().getRows().clear(); } else { row.getRows().clear(); } if(currentLocation == null) return 0; TrackingCountVoCollection trackingAreaColl = domain.listTrackingAreas(currentLocation); if(trackingAreaColl == null) return 0; TrackingCountVo overallTrackingCount = null; TrackingCountVo registrationTrackingCount = null; int totalNumberOfPatients = 0; for(TrackingCountVo trackingArea : trackingAreaColl) { if(trackingArea == null) continue; if(trackingArea.getTrackingAreaIsNotNull() && Boolean.TRUE.equals(trackingArea.getTrackingArea().getIsRegistrationArea())) { registrationTrackingCount = trackingArea; continue; } if(trackingArea.getTrackingAreaIsNotNull() && Boolean.TRUE.equals(trackingArea.getTrackingArea().getIsOverallView())) { overallTrackingCount = trackingArea; continue; } totalNumberOfPatients += addTrackingArea(trackingArea, row); } //totalNumberOfPatients += addTrackingArea(registrationTrackingCount, row);//wdev-17306 if(row == null) { overallTrackingCount.setNumberOfPatiens(totalNumberOfPatients); addTrackingArea(overallTrackingCount, row); } else { row.setColNumberOfPatients(totalNumberOfPatients); } form.grdTrackingCount().setValue(form.getLocalContext().getSelectedTrackingArea()); return totalNumberOfPatients; }
public TrackingCountVoCollection listTrackingAreas(ILocation location) { if(location == null) throw new CodingRuntimeException("Cannot list Tracking Area for a null EDLocation Id."); DomainFactory factory = getDomainFactory(); String query = "select ta, (select count(tr1.patient.id) from Tracking as tr1 left join tr1.currentArea as ta1 where ta1.id = ta.id group by ta1) as patientNumber from TrackingConfiguration as trc left join trc.areas as ta where ta.eDLocation.id = :EDLocationId and ta.status.id = :ActiveStatus order by index(ta)";//order by upper(ta.areaDisplayName)"; List<?> list = factory.find(query, new String[] {"EDLocationId", "ActiveStatus"}, new Object[] {location.getID(), PreActiveActiveInactiveStatus.ACTIVE.getID()}); if(list == null || list.size() == 0) return null; TrackingCountVoCollection coll = new TrackingCountVoCollection(); for(int i=0; i<list.size(); i++) { Object[] record = (Object[]) list.get(i); if(record == null) continue; TrackingCountVo item = new TrackingCountVo(); if(record[0] instanceof TrackingArea) { item.setTrackingArea(TrackingAreaForTrackingVoAssembler.create((TrackingArea) record[0])); } if(record[1] != null) { item.setNumberOfPatiens(((Long) record[1]).intValue()); } else { item.setNumberOfPatiens(0); } coll.add(item); } return coll; }
public TrackingCountVoCollection listTrackingAreas(ILocation location) { if(location == null) throw new CodingRuntimeException("Cannot list Tracking Area for a null EDLocation Id."); DomainFactory factory = getDomainFactory(); String query = "select ta, (select count(tr1.patient.id) from Tracking as tr1 left join tr1.currentArea as ta1 where ta1.id = ta.id and (tr1.isRIE is null or tr1.isRIE <> 1 ) group by ta1) as patientNumber from TrackingConfiguration as trc left join trc.areas as ta where ta.eDLocation.id = :EDLocationId and ta.status.id = :ActiveStatus order by index(ta)";//order by upper(ta.areaDisplayName)"; //wdev-19104 List<?> list = factory.find(query, new String[] {"EDLocationId", "ActiveStatus"}, new Object[] {location.getID(), PreActiveActiveInactiveStatus.ACTIVE.getID()}); if(list == null || list.size() == 0) return null; TrackingCountVoCollection coll = new TrackingCountVoCollection(); for(int i=0; i<list.size(); i++) { Object[] record = (Object[]) list.get(i); if(record == null) continue; TrackingCountVo item = new TrackingCountVo(); if(record[0] instanceof TrackingArea) { item.setTrackingArea(TrackingAreaForTrackingVoAssembler.create((TrackingArea) record[0])); } if(record[1] != null) { item.setNumberOfPatiens(((Long) record[1]).intValue()); } else { item.setNumberOfPatiens(0); } coll.add(item); } return coll; }