public List<FHIRResource> mapToFhirObservation( Obs observation, Encounter fhirEncounter, SystemProperties systemProperties) { List<FHIRResource> result = new ArrayList<>(); FHIRResource entry = mapObservation(observation, fhirEncounter, systemProperties); Observation fhirObservation = (Observation) entry.getResource(); fhirObservation.setStatus(ObservationStatusEnum.PRELIMINARY); for (Obs member : observation.getGroupMembers()) { mapGroupMember(member, fhirEncounter, fhirObservation, result, systemProperties); } result.add(entry); return result; }
private FHIRResource mapObservation( Obs openmrsObs, Encounter fhirEncounter, SystemProperties systemProperties) { FHIRResource fhirObservationResource = observationBuilder.buildObservationResource( fhirEncounter, systemProperties, openmrsObs.getUuid(), openmrsObs.getConcept().getName().getName()); Observation fhirObservation = (Observation) fhirObservationResource.getResource(); fhirObservation.setStatus(ObservationStatusEnum.PRELIMINARY); mapCode(openmrsObs, fhirObservation); mapValue(openmrsObs, fhirObservation); return fhirObservationResource; }
private void mapGroupMember( Obs obs, Encounter fhirEncounter, Observation parentObservation, List<FHIRResource> result, SystemProperties systemProperties) { if (hasIgnoredConcept(obs)) { return; } FHIRResource entry = mapObservation(obs, fhirEncounter, systemProperties); Observation observation = (Observation) entry.getResource(); mapRelatedObservation(observation).mergeWith(parentObservation, systemProperties); for (Obs member : obs.getGroupMembers()) { mapGroupMember(member, fhirEncounter, observation, result, systemProperties); } result.add(entry); }