public TrackingAreaForTrackingVo getTrackingAreaForTracking(TrackingRefVo trackingRef) { if( trackingRef == null ) return null; DomainFactory factory = getDomainFactory(); String query = "select t2_1 from Tracking as t1_1 left join t1_1.currentArea as t2_1 where( t1_1.id = :trackingId )"; List<?> list = factory.find(query, new String[] {"trackingId"}, new Object[] {trackingRef.getID_Tracking()}); if(list == null || list.size() == 0) return null; TrackingAreaForTrackingVoCollection temp =TrackingAreaForTrackingVoAssembler.createTrackingAreaForTrackingVoCollectionFromTrackingArea(list); if( temp != null && temp.size() > 0) return temp.get(0); return null; }
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; }