use of org.hl7.gravity.refimpl.sdohexchange.fhir.UsCoreConditionCategory in project Gravity-SDOH-Exchange-RI by FHIR.
the class ConditionBundleFactory method createBundle.
public Bundle createBundle() {
Assert.notNull(name, "Name cannot be null.");
Assert.notNull(category, "SDOH DomainCode cannot be null.");
Assert.notNull(conditionType, "UsCoreConditionCategory cannot be null.");
Assert.notNull(icdCode, "ICD-10 code cannot be null.");
Assert.notNull(snomedCode, "SNOMED-CT code cannot be null.");
Assert.notNull(patient, "Patient cannot be null.");
Assert.notNull(practitioner, "Practitioner cannot be null.");
Assert.hasText(basedOnText, "BaseOn text cannot be null or empty.");
Bundle bundle = new Bundle();
bundle.setType(Bundle.BundleType.TRANSACTION);
Condition healthConcern = createCondition();
bundle.addEntry(FhirUtil.createPostEntry(healthConcern));
return bundle;
}
use of org.hl7.gravity.refimpl.sdohexchange.fhir.UsCoreConditionCategory in project Gravity-SDOH-Exchange-RI by FHIR.
the class HealthConcernService method promote.
public void promote(String id) {
Assert.notNull(SmartOnFhirContext.get().getPatient(), "Patient id cannot be null.");
Bundle responseBundle = searchHealthConcernQuery(ConditionClinicalStatus.ACTIVE).where(Condition.RES_ID.exactly().code(id)).returnBundle(Bundle.class).execute();
Condition healthConcern = Optional.ofNullable(FhirUtil.getFirstFromBundle(responseBundle, Condition.class)).orElseThrow(() -> new ResourceNotFoundException(new IdType(Condition.class.getSimpleName(), id)));
UsCoreConditionCategory problem = UsCoreConditionCategory.PROBLEMLISTITEM;
Coding coding = FhirUtil.findCoding(healthConcern.getCategory(), problem.getSystem());
coding.setCode(problem.toCode());
coding.setDisplay(problem.getDisplay());
// set time when the problem becomes effective
healthConcern.setOnset(DateTimeType.now());
ehrClient.update().resource(healthConcern).execute();
}
Aggregations