org.hl7.fhir.dstu3.model.Medication Java Examples
The following examples show how to use
org.hl7.fhir.dstu3.model.Medication.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MedicationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam Medication medication, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { resourcePermissionProvider.checkPermission("update"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Medication newMedication = medicationDao.create(ctx,medication, theId, theConditional); method.setId(newMedication.getIdElement()); method.setResource(newMedication); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example #2
Source File: MedicationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Create public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam Medication medication) { resourcePermissionProvider.checkPermission("create"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Medication newMedication = medicationDao.create(ctx,medication, null,null); method.setId(newMedication.getIdElement()); method.setResource(newMedication); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example #3
Source File: TestData.java From bunsen with Apache License 2.0 | 5 votes |
/** * Returns a new Medication for testing. * * @return a FHIR Medication for testing. */ public static Medication newMedication(String id) { Medication medication = new Medication(); medication.setId(id); CodeableConcept itemCodeableConcept = new CodeableConcept(); itemCodeableConcept.addCoding() .setSystem("http://www.nlm.nih.gov/research/umls/rxnorm") .setCode("103109") .setDisplay("Vitamin E 3 MG Oral Tablet [Ephynal]") .setUserSelected(true); MedicationIngredientComponent ingredientComponent = new MedicationIngredientComponent(); ingredientComponent.setItem(itemCodeableConcept); medication.addIngredient(ingredientComponent); Reference itemReference = new Reference("test-item-reference"); MedicationPackageContentComponent medicationPackageContentComponent = new MedicationPackageContentComponent(); medicationPackageContentComponent.setItem(itemReference); MedicationPackageComponent medicationPackageComponent = new MedicationPackageComponent(); medicationPackageComponent.addContent(medicationPackageContentComponent); medication.setPackage(medicationPackageComponent); return medication; }
Example #4
Source File: SparkRowConverterTest.java From bunsen with Apache License 2.0 | 5 votes |
@Test public void testContainedResources() throws FHIRException { Medication testMedicationOne = (Medication) testMedicationRequest.getContained().get(0); String testMedicationOneId = testMedicationOne.getId(); CodeableConcept testMedicationIngredientItem = testMedicationOne.getIngredientFirstRep() .getItemCodeableConcept(); Medication decodedMedicationOne = (Medication) testMedicationRequestDecoded.getContained() .get(0); String decodedMedicationOneId = decodedMedicationOne.getId(); CodeableConcept decodedMedicationOneIngredientItem = decodedMedicationOne .getIngredientFirstRep() .getItemCodeableConcept(); Assert.assertEquals(testMedicationOneId, decodedMedicationOneId); Assert.assertTrue(decodedMedicationOneIngredientItem.equalsDeep(testMedicationIngredientItem)); Provenance testProvenance = (Provenance) testMedicationRequest.getContained().get(1); String testProvenanceId = testProvenance.getId(); Provenance decodedProvenance = (Provenance) testMedicationRequestDecoded.getContained().get(1); String decodedProvenanceId = decodedProvenance.getId(); Assert.assertEquals(testProvenanceId, decodedProvenanceId); Medication testMedicationTwo = (Medication) testMedicationRequest.getContained().get(2); String testMedicationTwoId = testMedicationTwo.getId(); Medication decodedMedicationTwo = (Medication) testMedicationRequestDecoded.getContained() .get(2); String decodedMedicationTwoId = decodedMedicationTwo.getId(); Assert.assertEquals(testMedicationTwoId, decodedMedicationTwoId); }
Example #5
Source File: AvroConverterTest.java From bunsen with Apache License 2.0 | 5 votes |
@Test public void testContainedResources() throws FHIRException { Medication testMedicationOne = (Medication) testMedicationRequest.getContained().get(0); String testMedicationOneId = testMedicationOne.getId(); CodeableConcept testMedicationIngredientItem = testMedicationOne.getIngredientFirstRep() .getItemCodeableConcept(); Medication decodedMedicationOne = (Medication) testMedicationRequestDecoded.getContained() .get(0); String decodedMedicationOneId = decodedMedicationOne.getId(); CodeableConcept decodedMedicationOneIngredientItem = decodedMedicationOne .getIngredientFirstRep() .getItemCodeableConcept(); Assert.assertEquals(testMedicationOneId, decodedMedicationOneId); Assert.assertTrue(decodedMedicationOneIngredientItem.equalsDeep(testMedicationIngredientItem)); Provenance testProvenance = (Provenance) testMedicationRequest.getContained().get(1); String testProvenanceId = testProvenance.getId(); Provenance decodedProvenance = (Provenance) testMedicationRequestDecoded.getContained().get(1); String decodedProvenanceId = decodedProvenance.getId(); Assert.assertEquals(testProvenanceId, decodedProvenanceId); Medication testMedicationTwo = (Medication) testMedicationRequest.getContained().get(2); String testMedicationTwoId = testMedicationTwo.getId(); Medication decodedMedicationTwo = (Medication) testMedicationRequestDecoded.getContained() .get(2); String decodedMedicationTwoId = decodedMedicationTwo.getId(); Assert.assertEquals(testMedicationTwoId, decodedMedicationTwoId); }
Example #6
Source File: MedicationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
@Read() public Medication get(@IdParam IdType prescriptionId) { resourcePermissionProvider.checkPermission("read"); Medication medication = medicationDao.read(ctx,prescriptionId); if ( medication == null) { throw OperationOutcomeFactory.buildOperationOutcomeException( new ResourceNotFoundException("No Medication/ " + prescriptionId.getIdPart()), OperationOutcome.IssueType.NOTFOUND); } return medication; }
Example #7
Source File: MedicationRepository.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
List<Medication> search(FhirContext ctx , @OptionalParam(name = Medication.SP_CODE) TokenParam code ,@OptionalParam(name= Medication.SP_RES_ID) StringParam id );
Example #8
Source File: MedicationRepository.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
List<MedicationEntity> searchEntity(FhirContext ctx , @OptionalParam(name = Medication.SP_CODE) TokenParam code ,@OptionalParam(name= Medication.SP_RES_ID) StringParam id );
Example #9
Source File: MedicationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Override public Class<? extends IBaseResource> getResourceType() { return Medication.class; }
Example #10
Source File: MedicationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Validate public MethodOutcome testResource(@ResourceParam Medication resource, @Validate.Mode ValidationModeEnum theMode, @Validate.Profile String theProfile) { return resourceTestProvider.testResource(resource,theMode,theProfile); }
Example #11
Source File: MedicationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 3 votes |
@Search public List<Medication> searchMedication(HttpServletRequest httpRequest , @OptionalParam(name = Medication.SP_CODE) TokenParam code , @OptionalParam(name = Medication.SP_RES_ID) StringParam resid ) { return medicationDao.search(ctx,code,resid); }
Example #12
Source File: AvroConverterTest.java From bunsen with Apache License 2.0 | 2 votes |
/** * Initialize test data. */ @BeforeClass public static void convertTestData() throws IOException { AvroConverter observationConverter = AvroConverter.forResource(FhirContexts.forStu3(), "Observation"); avroObservation = (Record) observationConverter.resourceToAvro(testObservation); testObservationDecoded = (Observation) observationConverter.avroToResource(avroObservation); avroObservationNullStatus = (Record) observationConverter .resourceToAvro(testObservationNullStatus); testObservationDecodedNullStatus = (Observation) observationConverter .avroToResource(avroObservationNullStatus); AvroConverter patientConverter = AvroConverter.forResource(FhirContexts.forStu3(), TestData.US_CORE_PATIENT); avroPatient = (Record) patientConverter.resourceToAvro(testPatient); testPatientDecoded = (Patient) patientConverter.avroToResource(avroPatient); AvroConverter conditionConverter = AvroConverter.forResource(FhirContexts.forStu3(), TestData.US_CORE_CONDITION); avroCondition = (Record) conditionConverter.resourceToAvro(testCondition); testConditionDecoded = (Condition) conditionConverter.avroToResource(avroCondition); AvroConverter medicationConverter = AvroConverter.forResource(FhirContexts.forStu3(), TestData.US_CORE_MEDICATION); Record avroMedication = (Record) medicationConverter.resourceToAvro(testMedicationOne); testMedicationDecoded = (Medication) medicationConverter.avroToResource(avroMedication); AvroConverter medicationRequestConverter = AvroConverter.forResource(FhirContexts.forStu3(), TestData.US_CORE_MEDICATION_REQUEST, Arrays.asList(TestData.US_CORE_MEDICATION, TestData.PROVENANCE)); avroMedicationRequest = (Record) medicationRequestConverter .resourceToAvro(testMedicationRequest); testMedicationRequestDecoded = (MedicationRequest) medicationRequestConverter .avroToResource(avroMedicationRequest); AvroConverter converterBunsenTestProfilePatient = AvroConverter .forResource(FhirContexts.forStu3(), TestData.BUNSEN_TEST_PATIENT); avroBunsenTestProfilePatient = (Record) converterBunsenTestProfilePatient .resourceToAvro(testBunsenTestProfilePatient); testBunsenTestProfilePatientDecoded = (Patient) converterBunsenTestProfilePatient .avroToResource(avroBunsenTestProfilePatient); }
Example #13
Source File: MedicationRepository.java From careconnect-reference-implementation with Apache License 2.0 | votes |
Medication read(FhirContext ctx, IdType theId);
Example #14
Source File: MedicationRepository.java From careconnect-reference-implementation with Apache License 2.0 | votes |
Medication create(FhirContext ctx, Medication medication, @IdParam IdType theId, @ConditionalUrlParam String theConditional) throws OperationOutcomeException;
Example #15
Source File: MedicationRepository.java From careconnect-reference-implementation with Apache License 2.0 | votes |
MedicationEntity createEntity(FhirContext ctx, Medication medication, @IdParam IdType theId, @ConditionalUrlParam String theConditional) throws OperationOutcomeException;