MWLQueryService { public void findScheduledProcedureSteps(IDWithIssuer[] pids, Attributes keys, QueryParam queryParam) { if (results != null) results.close(); BooleanBuilder builder = new BooleanBuilder(); Builder.addPatientLevelPredicates(builder, pids, keys, queryParam); Builder.addServiceRequestPredicates(builder, keys, queryParam); Builder.addRequestedProcedurePredicates(builder, keys, queryParam); Attributes spsItem = keys.getNestedDataset(Tag.ScheduledProcedureStepSequence); Builder.addScheduledProcedureStepPredicates(builder, spsItem, queryParam); results = new HibernateQuery(session) .from(QScheduledProcedureStep.scheduledProcedureStep) .innerJoin(QScheduledProcedureStep.scheduledProcedureStep.requestedProcedure, QRequestedProcedure.requestedProcedure) .innerJoin(QRequestedProcedure.requestedProcedure.serviceRequest, QServiceRequest.serviceRequest) .innerJoin(QServiceRequest.serviceRequest.visit, QVisit.visit) .innerJoin(QVisit.visit.patient, QPatient.patient) .where(builder) .scroll(ScrollMode.FORWARD_ONLY, QScheduledProcedureStep.scheduledProcedureStep.encodedAttributes, QRequestedProcedure.requestedProcedure.encodedAttributes, QServiceRequest.serviceRequest.encodedAttributes, QVisit.visit.encodedAttributes, QPatient.patient.encodedAttributes); hasNext = results.next(); }  void findScheduledProcedureSteps(IDWithIssuer[] pids, Attributes keys,
            QueryParam queryParam); boolean optionalKeyNotSupported(); boolean hasMoreMatches(); Attributes nextMatch(); @Remove void close();  }
@Test public void testByPatientID() throws Exception { IDWithIssuer[] pids = { new IDWithIssuer("MWL_TEST") }; queryService.findScheduledProcedureSteps(pids, new Attributes(), queryParam); assertArrayEquals(new String[] { "9933.1", "9934.1", "9934.2" }, spsids(queryService)); }
@Test public void testByStartDate() throws Exception { queryService.findScheduledProcedureSteps( null, sps(Tag.ScheduledProcedureStepStartDate, VR.DA, "20111025"), queryParam); assertArrayEquals(new String[] { "9934.1", "9934.2" }, spsids(queryService)); }
@Test public void testByStartDateTime() throws Exception { queryService.findScheduledProcedureSteps( null, spsStartDateTime("20111025", "1400-1500"), queryParam); assertArrayEquals(new String[] { "9934.1" }, spsids(queryService)); }
@Test public void testByModality() throws Exception { queryService.findScheduledProcedureSteps( null, sps(Tag.Modality, VR.CS, "CT"), queryParam); assertArrayEquals(new String[] { "9933.1" }, spsids(queryService)); }
@Test public void testByAccessionNumber() throws Exception { queryService.findScheduledProcedureSteps( null, attrs(Tag.AccessionNumber, VR.SH, "MWL_TEST"), queryParam); assertArrayEquals( new String[] { "9933.1", "9934.1", "9934.2" }, spsids(queryService)); }
@Test public void testByStudyInstanceUID() throws Exception { queryService.findScheduledProcedureSteps( null, attrs(Tag.StudyInstanceUID, VR.UI, "1.2.40.0.13.1.1.99.33"), queryParam); assertArrayEquals(new String[] { "9933.1" }, spsids(queryService)); }
@Test public void testByRequestedProcedureID() throws Exception { queryService.findScheduledProcedureSteps( null, attrs(Tag.RequestedProcedureID, VR.SH, "P-9934"), queryParam); assertArrayEquals(new String[] { "9934.1", "9934.2" }, spsids(queryService)); }
@Test public void testByScheduledProcedureID() throws Exception { queryService.findScheduledProcedureSteps( null, sps(Tag.ScheduledProcedureStepID, VR.SH, "9934.2"), queryParam); assertArrayEquals(new String[] { "9934.2" }, spsids(queryService)); }
@Test public void testByStatus() throws Exception { queryService.findScheduledProcedureSteps( null, sps(Tag.ScheduledProcedureStepStatus, VR.CS, ScheduledProcedureStep.ARRIVED, ScheduledProcedureStep.READY), queryParam); assertArrayEquals(new String[] { "9934.1" }, spsids(queryService)); }
@Test public void testByAET1() throws Exception { queryService.findScheduledProcedureSteps( null, sps(Tag.ScheduledStationAETitle, VR.AE, "AET_MR1"), queryParam); assertArrayEquals(new String[] { "9934.1" }, spsids(queryService)); }
@Test public void testByAET2() throws Exception { queryService.findScheduledProcedureSteps( null, sps(Tag.ScheduledStationAETitle, VR.AE, "AET_MR2"), queryParam); assertArrayEquals(new String[] { "9934.1", "9934.2" }, spsids(queryService)); }
@Test public void testByPerformingPhysican() throws Exception { queryService.findScheduledProcedureSteps( null, sps(Tag.ScheduledPerformingPhysicianName, VR.PN, "ScheduledPerformingPhysicianName3"), queryParam); assertArrayEquals(new String[] { "9934.2" }, spsids(queryService)); }