/** * Extracts results from the returned bundle. Override for special processing. * * @param bundle The bundle. * @return List of extracted resources. */ protected List<R> processBundle(Bundle bundle) { return FhirUtil.getEntries(bundle, resourceClass); }
/** * Sets the patient name criterion. * * @param name Patient name. */ public void setName(String name) { this.name = FhirUtil.parseName(name); }
/** * Two list items are considered equal if their associated patients are equal. */ @Override public boolean equals(Object object) { return patient == null || !(object instanceof PatientListItem) ? false : FhirUtil.areEqual(patient, ((PatientListItem) object).patient); }
@SuppressWarnings("unchecked") @Override protected Object transformData(Object data) { if (data instanceof IBaseDatatype) { return FhirUtil.getDisplayValueForType((IBaseDatatype) data); } if (data instanceof List) { List<?> c = (List<?>) data; if (c.isEmpty()) { return ""; } if (c.get(0) instanceof IBaseDatatype) { return FhirUtil.getDisplayValueForTypes((List<IBaseDatatype>) c, ", "); } } return super.transformData(data); }
/** * Used to sort patient list items alphabetically by patient name. */ @Override public int compareTo(PatientListItem item) { String name1 = FhirUtil.formatName(patient.getName()); String name2 = FhirUtil.formatName(item.patient.getName()); return name1.compareToIgnoreCase(name2); } }
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 void append(StringBuilder sb, IBaseDatatype value, String delimiter) { append(sb, FhirUtil.getDisplayValueForType(value), delimiter); }
/** * Retrieve a resource by logical id. * * @param logicalId The logical id. * @return The retrieved resource. */ protected DomainClass getResource(String logicalId) { if (!logicalId.contains("/")) { logicalId = domainClass.getSimpleName() + "/" + logicalId; } return fhirService.getClient().fetchResourceFromUrl(domainClass, logicalId); }
/** * 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; }
private String formatDOD(Type value) { if (value == null) { return null; } DateType dod = FhirUtil.getTyped(value, DateType.class); if (dod != null) { return formatDateAndAge(dod.getValue()); } BooleanType isDead = FhirUtil.getTyped(value, BooleanType.class); if (isDead != null && isDead.getValue()) { return "unknown"; } return null; }
/** * Creates a CCOW context from the specified patient object. */ @Override public ContextItems toCCOWContext(Patient patient) { Identifier mrn = FhirUtil.getMRN(patient); contextItems.setItem(CCOW_MRN, mrn == null ? null : mrn.getValue(), "MRN"); contextItems.setItem(CCOW_NAM, patient.getName()); contextItems.setItem(CCOW_SEX, patient.getGender()); contextItems.setItem(CCOW_DOB, patient.getBirthDate()); return contextItems; }
protected String getDetail(M modelObject) { if (modelObject instanceof IBaseResource) { Narrative narrative = narrativeService.extractNarrative((IBaseResource) modelObject, true); return narrative == null ? null : narrative.getDivAsString(); } return null; }
/** * Adds a contact element to the demographic panel. Uses default styling. * * @param root Root component. * @param contacts List of contacts from which to select. * @param type Type of contact desired (e.g., "home:phone"). * @param labelId The id of the label to use. */ protected void addContact(BaseUIComponent root, List<ContactPoint> contacts, String type, String labelId) { ContactPoint contact = FhirUtil.getContact(contacts, type); if (contact != null) { addDemographic(root, labelId == null ? contact.getUse().getDisplay() : labelId, contact.getValue(), null); } }
@Override protected List<IBaseResource> processBundle(Bundle bundle) { return FhirUtil.getEntries(bundle, null, Collections.singletonList(Patient.class)); }
@Override protected void render(Observation observation, List<Object> columns) { columns.add(observation.getCode()); columns.add(observation.getEffective()); columns.add(observation.getStatus()); columns.add(observation.getValue()); if (observation.hasReferenceRange()) { columns.add(FhirUtil.getFirst(observation.getReferenceRange()).getText()); } else { columns.add(""); } }
/** * Sets the patient name criterion. * * @param name Patient name. */ public void setName(String name) { this.name = FhirUtil.parseName(name); }
/** * Finds a list item associated with the specified patient. * * @param patient Patient to find. * @param items List of items to search. * @return The patient list item associated with the specified patient, or null if not found. */ public static PatientListItem findListItem(Patient patient, Iterable<PatientListItem> items) { if (items == null || patient == null) { return null; } for (PatientListItem item : items) { if (FhirUtil.areEqual(patient, item.getPatient())) { return item; } } return null; }
/** * Alternative method for performing a search that allows for external configuration of the * query object. * * @param query The query object. * @return List of matching resources. May return null to indicate no matches. */ @Override public List<R> search(IQuery<?> query) { return FhirUtil.getEntries(query.returnBundle(Bundle.class).execute(), resourceClass); } }
@Override public void pending(ISurveyResponse response) { Encounter encounter = EncounterContext.getEncounterContext().getContextObject(true); changeParticipant(encounter == null ? null : FhirUtil.getFirst(encounter.getParticipant())); } }