@Test public void testIndexContained() { Patient p = new Patient(); p.setId("#some_patient"); p.addName().setFamily("MYFAMILY").addGiven("MYGIVEN"); Observation o1 = new Observation(); o1.getCode().setText("Some Observation"); o1.setSubject(new Reference(p)); IIdType oid1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless(); Observation o2 = new Observation(); o2.getCode().setText("Some Observation"); o2.setSubject(new Reference(p)); IIdType oid2 = myObservationDao.create(o2, mySrd).getId().toUnqualifiedVersionless(); Patient p2 = new Patient(); p2.addName().setFamily("MYFAMILY").addGiven("MYGIVEN"); IIdType pid2 = myPatientDao.create(p2, mySrd).getId().toUnqualifiedVersionless(); ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(o2)); SearchParameterMap map; // map = new SearchParameterMap(); // map.add(Observation.SP_CODE, new TokenParam(null, "some // observation").setModifier(TokenParamModifier.TEXT)); // assertThat(toUnqualifiedVersionlessIdValues(myObservationDao.search(map)), // containsInAnyOrder(toValues(id1, id2))); }
protected List<String> toNameList(Bundle resp) { List<String> names = new ArrayList<String>(); for (BundleEntryComponent next : resp.getEntry()) { Patient nextPt = (Patient) next.getResource(); String nextStr = nextPt.getName().size() > 0 ? nextPt.getName().get(0).getGivenAsSingleString() + " " + nextPt.getName().get(0).getFamily() : ""; if (isNotBlank(nextStr)) { names.add(nextStr); } } return names; }