use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project cqf-ruler by DBCG.
the class Session method applyPlanDefinition.
@Operation(name = "$apply", idempotent = true, type = PlanDefinition.class)
public CarePlan applyPlanDefinition(RequestDetails theRequest, @IdParam IdType theId, @OperationParam(name = "patient") String patientId, @OperationParam(name = "encounter") String encounterId, @OperationParam(name = "practitioner") String practitionerId, @OperationParam(name = "organization") String organizationId, @OperationParam(name = "userType") String userType, @OperationParam(name = "userLanguage") String userLanguage, @OperationParam(name = "userTaskContext") String userTaskContext, @OperationParam(name = "setting") String setting, @OperationParam(name = "settingContext") String settingContext) throws IOException, FHIRException {
PlanDefinition planDefinition = this.planDefinitionDao.read(theId);
if (planDefinition == null) {
throw new IllegalArgumentException("Couldn't find PlanDefinition " + theId);
}
logger.info("Performing $apply operation on PlanDefinition/{}", theId);
CarePlanBuilder builder = new CarePlanBuilder();
builder.buildInstantiatesCanonical(planDefinition.getUrl()).buildSubject(new Reference(patientId)).buildStatus(CarePlan.CarePlanStatus.DRAFT);
if (encounterId != null)
builder.buildEncounter(new Reference(encounterId));
if (practitionerId != null)
builder.buildAuthor(new Reference(practitionerId));
if (organizationId != null)
builder.buildAuthor(new Reference(organizationId));
if (userLanguage != null)
builder.buildLanguage(userLanguage);
// Each Group of actions shares a RequestGroup
RequestGroupBuilder requestGroupBuilder = new RequestGroupBuilder().buildStatus().buildIntent();
Session session = new Session(planDefinition, builder, patientId, encounterId, practitionerId, organizationId, userType, userLanguage, userTaskContext, setting, settingContext, requestGroupBuilder);
return (CarePlan) ContainedHelper.liftContainedResourcesToParent(resolveActions(session, theRequest));
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project cqf-ruler by DBCG.
the class Session method applyPlanDefinition.
@Operation(name = "$apply", idempotent = true, type = PlanDefinition.class)
public CarePlan applyPlanDefinition(RequestDetails theRequest, @IdParam IdType theId, @OperationParam(name = "patient") String patientId, @OperationParam(name = "encounter") String encounterId, @OperationParam(name = "practitioner") String practitionerId, @OperationParam(name = "organization") String organizationId, @OperationParam(name = "userType") String userType, @OperationParam(name = "userLanguage") String userLanguage, @OperationParam(name = "userTaskContext") String userTaskContext, @OperationParam(name = "setting") String setting, @OperationParam(name = "settingContext") String settingContext) throws IOException, FHIRException {
PlanDefinition planDefinition = this.planDefinitionDao.read(theId);
if (planDefinition == null) {
throw new IllegalArgumentException("Couldn't find PlanDefinition " + theId);
}
logger.info("Performing $apply operation on PlanDefinition/{}", theId);
CarePlanBuilder builder = new CarePlanBuilder();
builder.buildDefinition(new Reference(planDefinition.getIdElement().getIdPart())).buildSubject(new Reference(patientId)).buildStatus(CarePlan.CarePlanStatus.DRAFT);
if (encounterId != null)
builder.buildContext(new Reference(encounterId));
if (practitionerId != null)
builder.buildAuthor(new Reference(practitionerId));
if (organizationId != null)
builder.buildAuthor(new Reference(organizationId));
if (userLanguage != null)
builder.buildLanguage(userLanguage);
// Each Group of actions shares a RequestGroup
RequestGroupBuilder requestGroupBuilder = new RequestGroupBuilder().buildStatus().buildIntent();
Session session = new Session(planDefinition, builder, patientId, encounterId, practitionerId, organizationId, userType, userLanguage, userTaskContext, setting, settingContext, requestGroupBuilder);
return (CarePlan) ContainedHelper.liftContainedResourcesToParent(resolveActions(theRequest, session));
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project cqf-ruler by DBCG.
the class CareGapsProviderIT method testPractitionerAndOrganization.
@Test
public void testPractitionerAndOrganization() throws Exception {
Parameters params = new Parameters();
params.addParameter().setName("periodStart").setValue(new StringType(periodStartValid));
params.addParameter().setName("periodEnd").setValue(new StringType(periodEndValid));
params.addParameter().setName("status").setValue(new StringType(statusValid));
params.addParameter().setName("measureId").setValue(new StringType(measureIdValid));
params.addParameter().setName("organization").setValue(new StringType(organizationValid));
params.addParameter().setName("practitioner").setValue(new StringType(practitionerValid));
assertThrows(InternalErrorException.class, () -> {
getClient().operation().onType(Measure.class).named("$care-gaps").withParameters(params).useHttpGet().returnResourceType(Parameters.class).execute();
});
// TODO: implement practitioner and organization
// assertDoesNotThrow(() -> {
// getClient().operation().onType(Measure.class).named("$care-gaps")
// .withParameters(params)
// .useHttpGet()
// .returnResourceType(Parameters.class)
// .execute();
// });
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project cqf-ruler by DBCG.
the class CareGapsProvider method patientReports.
// warning for greater than 7 parameters
@SuppressWarnings("squid:S00107")
private Parameters.ParametersParameterComponent patientReports(RequestDetails requestDetails, String periodStart, String periodEnd, Patient patient, List<String> status, List<Measure> measures, String organization) {
// TODO: add organization to report, if it exists.
Composition composition = getComposition(patient);
List<DetectedIssue> detectedIssues = new ArrayList<>();
Map<String, Resource> evaluatedResources = new HashMap<>();
List<MeasureReport> reports = getReports(requestDetails, periodStart, periodEnd, patient, status, measures, composition, detectedIssues, evaluatedResources);
if (reports.isEmpty()) {
return null;
}
return initializePatientParameter(patient).setResource(addBundleEntries(requestDetails.getFhirServerBase(), composition, detectedIssues, reports, evaluatedResources));
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project summary-care-record-api by NHSDigital.
the class AgentPersonMapper method mapOrganization.
private Organization mapOrganization(Node agentPerson) {
Organization org;
Optional<Node> orgNode = xmlUtils.detachOptionalNodeByXPath(agentPerson, ORG_XPATH);
Optional<Node> orgSdsNode = xmlUtils.detachOptionalNodeByXPath(agentPerson, ORG_SDS_XPATH);
if (orgNode.isPresent()) {
org = organisationMapper.mapOrganization(orgNode.get());
} else if (orgSdsNode.isPresent()) {
org = organisationSdsMapper.mapOrganizationSds(orgSdsNode.get());
} else {
org = new Organization();
org.setId(randomUUID());
}
org.setTelecom(mapContactPoints(agentPerson));
xmlUtils.getOptionalValueByXPath(agentPerson, ADDRESS_XPATH).ifPresent(val -> org.addAddress(new Address().setText(val)));
return org;
}
Aggregations