public static Practitioner getPractitioner(Participant participant) { if (participant == null) { return null; } ResourceReferenceDt resource = participant.getIndividual(); IBaseResource ele = resource.getResource(); return ele instanceof Practitioner ? (Practitioner) ele : null; }
/** * Returns the current participant from the shared context if it is a practitioner. * * @return Current practitioner. */ public static Participant getActivePractitioner() { Participant participant = getParticipantContext().getContextObject(false); return participant == null ? null : participant.getIndividual().getResource() instanceof Practitioner ? participant : null; }
/** * Returns a resource given a resource reference. If the resource has not been previously * fetched, it will be fetched from the server. * * @param reference A resource reference. * @return The corresponding resource. */ public static IBaseResource getResource(ResourceReferenceDt reference) { if (reference.isEmpty()) { return null; } if (reference.getResource() != null) { return reference.getResource(); } IdDt resourceId = reference.getReference(); if (resourceId == null) { throw new IllegalStateException("Reference has no resource ID defined"); } String resourceUrl = expandURL(resourceId.getValue()); IBaseResource resource = getFhirClient().read(new UriDt(resourceUrl)); reference.setResource(resource); return resource; }
public void onClick$btnAddNote() { String note = AddNoteController.execute(); if (note == null || note.isEmpty()) { return; } ProblemNote pn = new ProblemNote(); IUser user = UserContext.getActiveUser(); pn.setAuthor(user.getFullName()); pn.setFacility((Organization) PatientContext.getActivePatient().getManagingOrganization().getResource()); pn.setNumber("*"); pn.setNarrative(note); pn.setDateAdded(new FMDate(DateUtil.stripTime(new Date()))); changedNotes.add(pn); renderNote(pn); } }
Organization institution = (Organization) patient.getManagingOrganization().getResource(); String sNum = "1".equals(sRpc) ? "" : txtID.getValue(); // Pass only if changed
IUser user = UserContext.getActiveUser(); Practitioner activePractitioner = (Practitioner) EncounterParticipantContext.getActivePractitioner().getIndividual() .getResource(); String practitionerId = activePractitioner == null ? null : activePractitioner.getId().getIdPart();