From ef6f1f320dc53bff79892bba5ebd190e47ebb2de Mon Sep 17 00:00:00 2001 From: Paul Bastide Date: Wed, 14 Apr 2021 09:21:21 -0400 Subject: [PATCH 1/2] operation error when specifying practitioner #2240 Signed-off-by: Paul Bastide --- .../com/ibm/fhir/operation/apply/ApplyOperation.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/operation/fhir-operation-apply/src/main/java/com/ibm/fhir/operation/apply/ApplyOperation.java b/operation/fhir-operation-apply/src/main/java/com/ibm/fhir/operation/apply/ApplyOperation.java index 844f0a2b6a0..4af93596c5a 100644 --- a/operation/fhir-operation-apply/src/main/java/com/ibm/fhir/operation/apply/ApplyOperation.java +++ b/operation/fhir-operation-apply/src/main/java/com/ibm/fhir/operation/apply/ApplyOperation.java @@ -266,7 +266,6 @@ private CarePlan transform(PlanDefinition planDefinition, List subjects, if (!altSubjectsRefs.isEmpty()) { builder.supportingInfo(altSubjectsRefs); } - } // Encounter @@ -274,14 +273,9 @@ private CarePlan transform(PlanDefinition planDefinition, List subjects, builder.encounter(Reference.builder().reference(string(encounter)).build()); } - // Practitioner - the following block is used as there may be a cardinality of 0..* in the future. - List careTeam = new ArrayList<>(); + // Practitioner maps to a contributor if (practitioner != null) { - careTeam.add(Reference.builder().reference(string(practitioner)).build()); - } - - if (!careTeam.isEmpty()) { - builder.careTeam(careTeam); + builder.contributor(Reference.builder().reference(string(practitioner)).build()); } // Organization From fa33f95228cfaf1dd9b76e540b16de87ed3d5188 Mon Sep 17 00:00:00 2001 From: Paul Bastide Date: Wed, 14 Apr 2021 12:12:27 -0400 Subject: [PATCH 2/2] Update the test to include a practitioner Signed-off-by: Paul Bastide --- .../server/test/PlanDefinitionApplyOperationTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fhir-server-test/src/test/java/com/ibm/fhir/server/test/PlanDefinitionApplyOperationTest.java b/fhir-server-test/src/test/java/com/ibm/fhir/server/test/PlanDefinitionApplyOperationTest.java index b30e37a5589..d5019eb96d1 100644 --- a/fhir-server-test/src/test/java/com/ibm/fhir/server/test/PlanDefinitionApplyOperationTest.java +++ b/fhir-server-test/src/test/java/com/ibm/fhir/server/test/PlanDefinitionApplyOperationTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2019, 2020 + * (C) Copyright IBM Corp. 2019, 2021 * * SPDX-License-Identifier: Apache-2.0 */ @@ -150,7 +150,7 @@ public void loadTestData() throws Exception { @Test(groups = { TEST_GROUP_NAME }, dependsOnMethods = "loadTestData") public void testSubjectPatient() { - List subjects = Arrays.asList(patientId); + List subjects = Arrays.asList("Patient/" + patientId); // Valid - Instance Level. // ApplyOperationResult result = @@ -158,7 +158,7 @@ public void testSubjectPatient() { // null, practitionerId, null, null, null, null, null, null); Response response = - doPost(FHIRMediaType.APPLICATION_FHIR_JSON, false, false, planDefinitionId, subjects, null, practitionerId, "my-org", "user-type", "user-language", "user-task-context", "my-setting", "my-setting-context"); + doPost(FHIRMediaType.APPLICATION_FHIR_JSON, false, false, planDefinitionId, subjects, null, "Practitioner/" + practitionerId, "Organization/my-org", "user-type", "user-language", "user-task-context", "my-setting", "my-setting-context"); assertEquals(response.getStatus(), 200); CarePlan carePlan = response.readEntity(CarePlan.class); @@ -171,7 +171,7 @@ public void testSubjectPatient() { public Response doPost(String mimeType, boolean root, boolean invalid, String planDefinition, List subject, String encounter, String practitioner, String organization, String userType, String userLanguage, String userTaskContext, String setting, String settingContext) { - Parameters parameters = generateParameters(planDefinitionId, subject, null, practitionerId, null, null, null, null, null, null); + Parameters parameters = generateParameters(planDefinitionId, subject, null, practitioner, null, null, null, null, null, null); WebTarget target = getWebTarget(); // valid && root by default