use of org.hl7.fhir.r4b.model.IdType in project elexis-server by elexis.
the class AbstractFhirCrudResourceProvider method create.
@Create
public MethodOutcome create(@ResourceParam FHIR fhirObject) {
MethodOutcome outcome = new MethodOutcome();
Optional<ELEXIS> exists = getTransformer().getLocalObject(fhirObject);
if (exists.isPresent()) {
outcome.setCreated(false);
outcome.setId(new IdType(fhirObject.getId()));
} else {
outcome = resourceProviderUtil.createResource(getTransformer(), fhirObject, log);
}
return outcome;
}
use of org.hl7.fhir.r4b.model.IdType in project elexis-server by elexis.
the class AllergyIntoleranceResourceProvider method createAllergyIntolerance.
@Create
public MethodOutcome createAllergyIntolerance(@ResourceParam AllergyIntolerance allergyIntolerance) {
MethodOutcome outcome = new MethodOutcome();
Optional<IAllergyIntolerance> exists = getTransformer().getLocalObject(allergyIntolerance);
if (exists.isPresent()) {
outcome.setCreated(false);
outcome.setId(new IdType(allergyIntolerance.getId()));
} else {
Optional<IAllergyIntolerance> created = getTransformer().createLocalObject(allergyIntolerance);
if (created.isPresent()) {
outcome.setCreated(true);
outcome.setId(new IdType(created.get().getId()));
} else {
throw new InternalErrorException("Creation failed");
}
}
return outcome;
}
use of org.hl7.fhir.r4b.model.IdType in project elexis-server by elexis.
the class AllergyIntoleranceResourceProvider method findAllergyIntolerance.
@Search()
public List<AllergyIntolerance> findAllergyIntolerance(@RequiredParam(name = AllergyIntolerance.SP_PATIENT) IdType patientId) {
if (patientId != null && !patientId.isEmpty()) {
Optional<IPatient> patient = modelService.load(patientId.getIdPart(), IPatient.class);
if (patient.isPresent()) {
if (patient.get().isPatient()) {
List<AllergyIntolerance> ret = new ArrayList<>();
List<IAllergyIntolerance> findings = findingsService.getPatientsFindings(patientId.getIdPart(), IAllergyIntolerance.class);
if (findings != null && !findings.isEmpty()) {
for (IAllergyIntolerance iFinding : findings) {
Optional<AllergyIntolerance> fhirAllergyIntolerance = getTransformer().getFhirObject(iFinding);
if (fhirAllergyIntolerance.isPresent()) {
ret.add(fhirAllergyIntolerance.get());
}
}
}
return ret;
}
}
}
return Collections.emptyList();
}
use of org.hl7.fhir.r4b.model.IdType in project elexis-server by elexis.
the class ConditionResourceProvider method createCondition.
@Create
public MethodOutcome createCondition(@ResourceParam Condition condition) {
MethodOutcome outcome = new MethodOutcome();
Optional<ICondition> exists = getTransformer().getLocalObject(condition);
if (exists.isPresent()) {
outcome.setCreated(false);
outcome.setId(new IdType(condition.getId()));
} else {
Optional<ICondition> created = getTransformer().createLocalObject(condition);
if (created.isPresent()) {
outcome.setCreated(true);
outcome.setId(new IdType(created.get().getId()));
} else {
throw new InternalErrorException("Creation failed");
}
}
return outcome;
}
use of org.hl7.fhir.r4b.model.IdType in project elexis-server by elexis.
the class CoverageResourceProvider method findCoverageByBeneficiary.
@Search()
public List<Coverage> findCoverageByBeneficiary(@RequiredParam(name = Coverage.SP_BENEFICIARY) IdType theBeneficiaryId) {
if (theBeneficiaryId != null) {
Optional<IPatient> patient = coreModelService.load(theBeneficiaryId.getIdPart(), IPatient.class);
if (patient.isPresent()) {
List<ICoverage> faelle = patient.get().getCoverages();
if (faelle != null) {
List<Coverage> ret = new ArrayList<Coverage>();
for (ICoverage fall : faelle) {
Optional<Coverage> fhirCoverage = getTransformer().getFhirObject(fall);
fhirCoverage.ifPresent(fp -> ret.add(fp));
}
return ret;
}
}
}
return Collections.emptyList();
}
Aggregations