This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
113 changed files
with
33,664 additions
and
672 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...irbridge/camel/component/fhir/medicationstatement/CreateMedicationStatementComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2020-2021 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.ehrbase.fhirbridge.camel.component.fhir.medicationstatement; | ||
|
||
import org.ehrbase.fhirbridge.fhir.medicationstatement.CreateMedicationStatementTransaction; | ||
import org.openehealth.ipf.commons.ihe.fhir.audit.GenericFhirAuditDataset; | ||
import org.openehealth.ipf.platform.camel.ihe.fhir.core.custom.CustomFhirComponent; | ||
|
||
/** | ||
* Camel {@link org.apache.camel.Component Component} that handles 'Create Medication Statement' transaction. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@SuppressWarnings({"java:S110"}) | ||
public class CreateMedicationStatementComponent extends CustomFhirComponent<GenericFhirAuditDataset> { | ||
|
||
public CreateMedicationStatementComponent() { | ||
super(new CreateMedicationStatementTransaction()); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...fhirbridge/camel/component/fhir/medicationstatement/FindMedicationStatementComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2020-2021 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.ehrbase.fhirbridge.camel.component.fhir.medicationstatement; | ||
|
||
import org.ehrbase.fhirbridge.fhir.observation.FindObservationTransaction; | ||
import org.openehealth.ipf.commons.ihe.fhir.audit.FhirQueryAuditDataset; | ||
import org.openehealth.ipf.platform.camel.ihe.fhir.core.custom.CustomFhirComponent; | ||
|
||
/** | ||
* Camel {@link org.apache.camel.Component Component} that handles 'Find MedicationStatement' transaction. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@SuppressWarnings({"java:S110"}) | ||
public class FindMedicationStatementComponent extends CustomFhirComponent<FhirQueryAuditDataset> { | ||
|
||
public FindMedicationStatementComponent() { | ||
super(new FindObservationTransaction()); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
src/main/java/org/ehrbase/fhirbridge/camel/route/MedicationStatementRoutes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright 2020-2021 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.ehrbase.fhirbridge.camel.route; | ||
|
||
import org.apache.camel.builder.RouteBuilder; | ||
import org.ehrbase.fhirbridge.camel.FhirBridgeConstants; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* Implementation of {@link RouteBuilder} that provides route definitions for transactions | ||
* linked to {@link org.hl7.fhir.r4.model.MedicationStatement MedicationStatement} resource. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@Component | ||
public class MedicationStatementRoutes extends AbstractRouteBuilder { | ||
|
||
@Override | ||
public void configure() throws Exception { | ||
// @formatter:off | ||
super.configure(); | ||
|
||
// 'Create Medication Statement' route definition | ||
from("medication-statement-create:consumer?fhirContext=#fhirContext") | ||
.onCompletion() | ||
.process("auditCreateResourceProcessor") | ||
.end() | ||
.process("resourceProfileValidator") | ||
.setHeader(FhirBridgeConstants.METHOD_OUTCOME, method("medicationStatementDao", "create(${body}, ${headers.FhirRequestDetails})")) | ||
.process("ehrIdLookupProcessor") | ||
.to("bean:fhirResourceConversionService?method=convert(${headers.FhirBridgeProfile}, ${body})") | ||
.to("ehr-composition:compositionProducer?operation=mergeCompositionEntity") | ||
.process("resourceResponseProcessor"); | ||
|
||
// 'Find Medication Statement' route definition | ||
from("medication-statement-find:consumer?fhirContext=#fhirContext&lazyLoadBundles=true") | ||
.choice() | ||
.when(isSearchOperation()) | ||
.to("bean:medicationStatementDao?method=search(${body}, ${headers.FhirRequestDetails})") | ||
.process("bundleProviderResponseProcessor") | ||
.otherwise() | ||
.to("bean:medicationStatementDao?method=read(${body}, ${headers.FhirRequestDetails})"); | ||
|
||
// @formatter:on | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...g/ehrbase/fhirbridge/ehr/converter/generic/MedicationStatementToCompositionConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.ehrbase.fhirbridge.ehr.converter.generic; | ||
|
||
import org.ehrbase.client.classgenerator.interfaces.CompositionEntity; | ||
import org.hl7.fhir.r4.model.MedicationStatement; | ||
import org.springframework.lang.NonNull; | ||
|
||
public abstract class MedicationStatementToCompositionConverter<C extends CompositionEntity> extends CompositionConverter<MedicationStatement, C>{ | ||
@Override | ||
public C convert(@NonNull MedicationStatement resource) { | ||
C composition = super.convert(resource); | ||
composition.setStartTimeValue(TimeConverter.convertMedicationStatmentTime(resource)); // StartTimeValue | ||
TimeConverter.convertMedicationStatementEndTime(resource).ifPresent(composition::setEndTimeValue); | ||
return composition; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...g/ehrbase/fhirbridge/ehr/converter/generic/MedicationStatementToObservationConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.ehrbase.fhirbridge.ehr.converter.generic; | ||
|
||
import org.ehrbase.client.classgenerator.interfaces.EntryEntity; | ||
import org.hl7.fhir.r4.model.MedicationStatement; | ||
import org.springframework.lang.NonNull; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
import java.time.temporal.TemporalAccessor; | ||
|
||
public abstract class MedicationStatementToObservationConverter<E extends EntryEntity> extends EntryEntityConverter<MedicationStatement, E> { | ||
|
||
@Override | ||
public E convert(@NonNull MedicationStatement resource) { | ||
E entryEntity = super.convert(resource); | ||
invokeTimeValues(entryEntity, resource); | ||
return entryEntity; | ||
} | ||
|
||
public void invokeTimeValues(E entryEntity, MedicationStatement resource) { | ||
invokeOriginValue(entryEntity, resource); | ||
invokeSetTimeValue(entryEntity, resource); | ||
} | ||
|
||
public void invokeSetTimeValue(E entryEntity, MedicationStatement resource){ | ||
try { | ||
Method setOriginValue = entryEntity.getClass().getMethod("setOriginValue", TemporalAccessor.class); | ||
setOriginValue.invoke(entryEntity, TimeConverter.convertMedicationStatmentTime(resource)); | ||
} catch (IllegalAccessException | InvocationTargetException exception) { | ||
exception.printStackTrace(); | ||
} catch (NoSuchMethodException ignored){ | ||
//ignored | ||
} | ||
} | ||
|
||
public void invokeOriginValue(E entryEntity, MedicationStatement resource){ | ||
try { | ||
Method setTimeValue = entryEntity.getClass().getMethod("setTimeValue", TemporalAccessor.class); | ||
setTimeValue.invoke(entryEntity, TimeConverter.convertMedicationStatmentTime(resource)); | ||
} catch ( IllegalAccessException | InvocationTargetException exception) { | ||
exception.printStackTrace(); | ||
}catch (NoSuchMethodException ignored){ | ||
//ignored | ||
} | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
...rg/ehrbase/fhirbridge/ehr/converter/generic/MedicationStatementToPointEventConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.ehrbase.fhirbridge.ehr.converter.generic; | ||
|
||
import org.springframework.lang.NonNull; | ||
import org.ehrbase.client.classgenerator.interfaces.PointEventEntity; | ||
import org.hl7.fhir.r4.model.MedicationStatement; | ||
|
||
|
||
public abstract class MedicationStatementToPointEventConverter <P extends PointEventEntity> extends EventEntityConverter<MedicationStatement, P> { | ||
|
||
@Override | ||
public P convert(@NonNull MedicationStatement resource) { | ||
P pointEvent = super.convert(resource); | ||
pointEvent.setTimeValue(TimeConverter.convertMedicationStatmentTime(resource)); | ||
return pointEvent; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.