/** * Sets the default location to the specified value. This value is stored in the * LOCATION.DEFAULT property. * * @param location The location. */ public static void setDefaultLocation(Location location) { PropertyUtil.saveValue(PROPERTY_DEFAULT_LOCATION, null, false, location.getId().getIdPart()); }
/** * @return The location resource corresponding to the location id in context. If caching is enabled, this * resource will be remembered for subsequent calls, and not loaded fresh with each call. */ public Location getLocationResource() { String locationId = getLocationId(); if (locationId != null) { if (enableCaching) { // is the id matching the prior loaded location? if (priorLocation != null && priorLocation.getId() != null) { if (locationId.equals(priorLocation.getId())) { return priorLocation; } } } // find the location priorLocation = session.read().resource(Location.class).withId(locationId).execute(); return priorLocation; } else { priorLocation = null; return null; } }
/** * @return The location resource corresponding to the location id in context. If caching is enabled, this * resource will be remembered for subsequent calls, and not loaded fresh with each call. */ public Location getLocationResource() { String locationId = getLocationId(); if (locationId != null) { if (enableCaching) { // is the id matching the prior loaded location? if (priorLocation != null && priorLocation.getId() != null) { if (locationId.equals(priorLocation.getId().getIdPart())) { return priorLocation; } } } // find the location priorLocation = session.read().resource(Location.class).withId(locationId).execute(); return priorLocation; } else { priorLocation = null; return null; } }
/** * Encode an encounter to a visit string. * * @param encounter The encounter. * @return The encoded encounter (visit string). */ public static String encode(Encounter encounter) { Location location = ClientUtil.getResource(encounter.getLocationFirstRep().getLocation(), Location.class); String locIEN = location.isEmpty() ? "" : location.getId().getIdPart(); Date date = encounter.getPeriod().getStart(); String sc = getServiceCategory(encounter); String ien = encounter.getId().isEmpty() ? "" : encounter.getId().getIdPart(); return locIEN + VSTR_DELIM + new FMDate(date).getFMDate() + VSTR_DELIM + sc + VSTR_DELIM + ien; }