@Search(queryName = "stitchedInclude") public List<DiagnosticReport> stitchedInclude() { Practitioner pr1 = new Practitioner(); pr1.setId("Practitioner/001"); pr1.getName().addFamily("Pract1"); Practitioner pr2 = new Practitioner(); pr2.setId("Practitioner/002"); pr2.getName().addFamily("Pract2"); Practitioner pr3 = new Practitioner(); pr3.setId("Practitioner/003"); pr3.getName().addFamily("Pract3"); Observation o1 = new Observation(); o1.getCode().setText("Obs1"); o1.addPerformer().setResource(pr1); Observation o2 = new Observation(); o2.getCode().setText("Obs2"); o2.addPerformer().setResource(pr2); Observation o3 = new Observation(); o3.getCode().setText("Obs3"); o3.addPerformer().setResource(pr3); DiagnosticReport rep = new DiagnosticReport(); rep.setId("DiagnosticReport/999"); rep.getName().setText("Rep"); rep.addResult().setResource(o1); rep.addResult().setResource(o2); rep.addResult().setResource(o3); return Collections.singletonList(rep); }
@Test public void checkCreatePractitionerAddsTheAttributes() { Practitioner checkPrac = CreateXML.createPractitioner(); assertEquals("41fe704c-18e5-11e5-b60b-1697f925ec7b", checkPrac.getId().toString()); assertEquals( "urn:x-fhir:uk:nhs:profile: practitioner:NHS-FGM-Practitioner", checkPrac.getResourceMetadata().get(ResourceMetadataKeyEnum.PROFILES)); assertEquals("official", checkPrac.getIdentifier().get(0).getUse()); assertEquals("urn:x-fhir:uk:nhs:id:SDSUserID", checkPrac.getIdentifier().get(0).getSystem()); assertEquals("G12345678", checkPrac.getIdentifier().get(0).getValue()); assertEquals("official", checkPrac.getIdentifier().get(01).getUse()); assertEquals( "urn:x-fhir:uk:nhs:id:SDSRoleProfileID", checkPrac.getIdentifier().get(1).getSystem()); assertEquals("PT1234", checkPrac.getIdentifier().get(1).getValue()); assertEquals("official", checkPrac.getName().getUse()); assertEquals("Wood", checkPrac.getName().getFamily().get(0).toString()); assertEquals("Town", checkPrac.getName().getGiven().get(0).toString()); assertEquals("Dr.", checkPrac.getName().getPrefix().get(0).toString()); assertEquals( "Organization/41fe704c-18e5-11e5-b60b-1697f925ec7b", checkPrac.getPractitionerRole().get(0).getManagingOrganization().getReference().toString()); assertEquals( "urn:x-fhir:uk:nhs:vs:SDSJobRoleName", checkPrac.getPractitionerRole().get(0).getRole().getCoding().get(0).getSystem().toString()); assertEquals( "R0090", checkPrac.getPractitionerRole().get(0).getRole().getCoding().get(0).getCode()); assertEquals( "Hospital Practitioner", checkPrac.getPractitionerRole().get(0).getRole().getCoding().get(0).getDisplay()); }