public static CodeableConceptDt getServiceCategory(String category) { initServiceCategories(); if (category == null) { return null; } CodeableConceptDt cat = serviceCategories.get(category); if (cat == null) { cat = createServiceCategory(category, "Unknown", "Unknown service category"); } return cat; }
public static boolean hasType(Participant participant, CodingDt participationType) { return findType(participant, participationType) != null; }
public static Participant getPrimaryParticipant(Encounter encounter) { return getParticipantByType(encounter, primaryType); }
public static boolean isPrimary(Participant participant) { return hasType(participant, primaryType); }
public static boolean isPrepared(Encounter encounter) { return encounter != null && !encounter.getLocationFirstRep().isEmpty() && !encounter.getParticipantFirstRep().isEmpty() && getServiceCategory(encounter) != null; }
private static void initServiceCategories() { if (serviceCategories == null) { loadServiceCategories(); } }
public static Collection<CodeableConceptDt> getServiceCategories() { initServiceCategories(); return serviceCategories.values(); }
public static List<Practitioner> getPractitioners(List<Participant> participants) { List<Practitioner> list = new ArrayList<Practitioner>(); for (Participant participant : participants) { Practitioner practitioner = getPractitioner(participant); if (practitioner != null) { list.add(practitioner); } } return list; }
/** * Perform a search based on given criteria. * * @param criteria Search criteria. * @return Resources matching the search criteria. */ public static List<Encounter> search(EncounterSearchCriteria criteria) { return getSearchEngine().search(criteria); }
public static Participant getParticipantByType(Encounter encounter, CodingDt participationType) { for (Participant p : encounter.getParticipant()) { if (hasType(p, participationType)) { return p; } } return null; }
public static Encounter create(Patient patient, Date date, Location location, String sc) { Encounter encounter = new Encounter(); ResourceReferenceDt pat = new ResourceReferenceDt(patient); encounter.setPatient(pat); PeriodDt period = new PeriodDt(); period.setStart(new DateTimeDt(date)); encounter.setPeriod(period); ResourceReferenceDt loc = new ResourceReferenceDt(location); Encounter.Location encloc = encounter.addLocation(); encloc.setPeriod(period); encloc.setLocation(loc); CodeableConceptDt type = encounter.addType(); CodeableConceptDt cat = getServiceCategory(sc); type.setText(cat.getText()); type.setCoding(cat.getCoding()); return encounter; }
public static boolean addType(Participant participant, CodingDt participationType) { if (!hasType(participant, participationType)) { CodeableConceptDt cpt = participant.addType(); cpt.getCoding().add(participationType); return true; } return false; }
public static boolean removeType(Participant participant, CodingDt participationType) { CodeableConceptDt cpt; boolean found = false; while ((cpt = findType(participant, participationType)) != null) { participant.getType().remove(cpt); found = true; } return found; }