public static HumanName getName(EncounterParticipantComponent participant) { IBaseResource resource = ClientUtil.getResource(participant.getIndividual()); List<HumanName> names = FhirUtil.getNames(resource); return names == null ? null : FhirUtil.getName(names, NameUse.USUAL, NameUse.OFFICIAL); }
private static synchronized void loadServiceCategories() { if (serviceCategories == null) { Map<String, CodeableConcept> map = new LinkedHashMap<>(); Bundle bundle = ClientUtil.getFhirClient().search().forResource(ValueSet.class) .where(CodeSystem.NAME.matchesExactly().value("EncounterType")).returnBundle(Bundle.class).execute(); for (CodeSystem cs : FhirUtil.getEntries(bundle, CodeSystem.class)) { UriType system = cs.getUrlElement(); for (ConceptDefinitionComponent concept : cs.getConcept()) { CodeableConcept cc = new CodeableConcept(); Coding coding = cc.addCoding(); coding.setCode(concept.getCode()); coding.setDisplay(concept.getDisplay()); coding.setSystemElement(system); cc.setText(concept.getDefinition()); map.put(coding.getCode(), cc); } } serviceCategories = map; } return; }
/** * Returns an encounter location with the specified physical type. * * @param encounter An encounter. * @param physicalType The physical location type sought. * @return The encounter location corresponding to the specified physical type, or null if none * found. */ public static EncounterLocationComponent getLocationByPhysicalType(Encounter encounter, String physicalType) { for (EncounterLocationComponent encounterLocation : encounter.getLocation()) { Location location = ClientUtil.getResource(encounterLocation.getLocation(), Location.class); if (physicalType.equals(FhirUtil.getFirst(location.getPhysicalType().getCoding()).getCode())) { return encounterLocation; } } return null; }