diff --git a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/DocumentReferencesResourceProvider.java b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/DocumentReferencesResourceProvider.java index 7e06bfbf285e74879757b27f9b16ccc5d6302f47..362f0a9a42952a9607924822b539aa1f768b135b 100644 --- a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/DocumentReferencesResourceProvider.java +++ b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/DocumentReferencesResourceProvider.java @@ -4,14 +4,17 @@ package net.ihe.gazelle.fhir.server.buisness; import ca.uhn.fhir.rest.annotation.*; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.param.DateParam; -import ca.uhn.fhir.rest.param.StringParam; -import ca.uhn.fhir.rest.param.TokenParam; +import ca.uhn.fhir.rest.param.ReferenceAndListParam; +import ca.uhn.fhir.rest.param.StringAndListParam; +import ca.uhn.fhir.rest.param.TokenAndListParam; import ca.uhn.fhir.rest.server.IResourceProvider; import jakarta.inject.Inject; import net.ihe.gazelle.fhir.server.technical.ws.DocumentReferencesProviderService; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; -import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.DocumentReference; + import java.util.List; public class DocumentReferencesResourceProvider implements IResourceProvider { @@ -32,25 +35,30 @@ public class DocumentReferencesResourceProvider implements IResourceProvider { } @Read - public DocumentReference readDocumentReference( @IdParam IIdType theId) { + public DocumentReference readDocumentReference(@IdParam IIdType theId) { return documentReferencesProviderService.getDocumentReference(theId.getValue()); } @Search() public List<DocumentReference> findDocumentReference( - @OptionalParam(name = DocumentReference.SP_PATIENT) TokenParam thePatient, + @OptionalParam(name = "author.given") StringAndListParam authorGiven, + @OptionalParam(name = "author.family") StringAndListParam authorFamily, + @OptionalParam(name = DocumentReference.SP_CATEGORY) TokenAndListParam category, + @OptionalParam(name = "creation") DateParam creation, @OptionalParam(name = DocumentReference.SP_DATE) DateParam date, - @OptionalParam(name = DocumentReference.SP_AUTHOR) StringParam author, - @OptionalParam(name = DocumentReference.SP_STATUS) StringParam status, - @OptionalParam(name = DocumentReference.SP_CATEGORY) StringParam category, - @OptionalParam(name = DocumentReference.SP_TYPE) StringParam type, - @OptionalParam(name = DocumentReference.SP_SETTING) StringParam setting, + @OptionalParam(name = DocumentReference.SP_EVENT) TokenAndListParam event, + @OptionalParam(name = DocumentReference.SP_FACILITY) TokenAndListParam facilty, + @OptionalParam(name = DocumentReference.SP_FORMAT) TokenAndListParam format, + @OptionalParam(name = DocumentReference.SP_IDENTIFIER) TokenAndListParam identifier, + @OptionalParam(name = DocumentReference.SP_PATIENT) ReferenceAndListParam patient, + @OptionalParam(name = "patient.identifier") TokenAndListParam patientIdentifier, @OptionalParam(name = DocumentReference.SP_PERIOD) DateParam period, - @OptionalParam(name = DocumentReference.SP_FACILITY) StringParam facilty, - @OptionalParam(name = DocumentReference.SP_EVENT) StringParam event, - @OptionalParam(name = DocumentReference.SP_SECURITY_LABEL) StringParam securityLabel, - @OptionalParam(name = DocumentReference.SP_FORMAT) StringParam format, - @OptionalParam(name = DocumentReference.SP_RELATED) StringParam related, RequestDetails requestDetails) { + @OptionalParam(name = DocumentReference.SP_RELATED) ReferenceAndListParam related, + @OptionalParam(name = DocumentReference.SP_SECURITY_LABEL) TokenAndListParam securityLabel, + @OptionalParam(name = DocumentReference.SP_SETTING) TokenAndListParam setting, + @OptionalParam(name = DocumentReference.SP_STATUS) TokenAndListParam status, + @OptionalParam(name = DocumentReference.SP_TYPE) TokenAndListParam type, + RequestDetails requestDetails) { return documentReferencesProviderService.searchDocumentReferences(requestDetails); } @@ -61,5 +69,4 @@ public class DocumentReferencesResourceProvider implements IResourceProvider { } - } diff --git a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/ListResourceProvider.java b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/ListResourceProvider.java index 3d60c32493f2693aaa06f52ac175a538afacff66..8f85d33d4f6dc68ad49d277e1f299d4b34fa5fd3 100644 --- a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/ListResourceProvider.java +++ b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/ListResourceProvider.java @@ -4,18 +4,17 @@ package net.ihe.gazelle.fhir.server.buisness; import ca.uhn.fhir.rest.annotation.OptionalParam; import ca.uhn.fhir.rest.annotation.Search; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.param.DateParam; -import ca.uhn.fhir.rest.param.TokenParam; +import ca.uhn.fhir.rest.param.*; import ca.uhn.fhir.rest.server.IResourceProvider; import jakarta.inject.Inject; import net.ihe.gazelle.fhir.server.technical.ws.ListProviderService; import org.hl7.fhir.instance.model.api.IBaseResource; +import org.hl7.fhir.r4.model.DocumentReference; import org.hl7.fhir.r4.model.ListResource; import java.util.List; - public class ListResourceProvider implements IResourceProvider { @@ -31,18 +30,22 @@ public class ListResourceProvider implements IResourceProvider { public Class<? extends IBaseResource> getResourceType() { return ListResource.class; } + @Search() - public List<ListResource> findListResource(@OptionalParam(name = ListResource.SP_CODE) TokenParam code, + public List<ListResource> findListResource(@OptionalParam(name = ListResource.SP_CODE) TokenAndListParam code, @OptionalParam(name = ListResource.SP_DATE) DateParam date, - @OptionalParam(name = ListResource.SP_PATIENT) TokenParam patient, - @OptionalParam(name = ListResource.SP_SOURCE) TokenParam source, - @OptionalParam(name = ListResource.SP_STATUS) String status, - @OptionalParam(name = ListResource.SP_SUBJECT) TokenParam subject, + @OptionalParam(name = "designationType") TokenAndListParam designationType, + @OptionalParam(name = "identifier") TokenAndListParam identifier, + @OptionalParam(name = DocumentReference.SP_PATIENT) ReferenceAndListParam patient, + @OptionalParam(name = "patient.identifier") TokenAndListParam patientIdentifier, + @OptionalParam(name = "source.given") StringAndListParam sourceGiven, + @OptionalParam(name = "source.family") StringAndListParam sourceFamily, + @OptionalParam(name = "sourceId") TokenAndListParam sourceId, + @OptionalParam(name = ListResource.SP_STATUS) TokenAndListParam status, RequestDetails requestDetails ) { return listProviderService.searchListResource(requestDetails); } - } diff --git a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/controler/MHDRestfullServer.java b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/controler/MHDRestfullServer.java index 6188d1ca8cbead771b686467651f528b21a2fa71..03b6084521059d22defa6209fbc8c2402f9d72d2 100644 --- a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/controler/MHDRestfullServer.java +++ b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/controler/MHDRestfullServer.java @@ -5,25 +5,23 @@ import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.narrative.INarrativeGenerator; import ca.uhn.fhir.rest.server.IResourceProvider; import ca.uhn.fhir.rest.server.RestfulServer; +import net.ihe.gazelle.fhir.server.buisness.DocumentReferencesResourceProvider; +import net.ihe.gazelle.fhir.server.buisness.ListResourceProvider; import net.ihe.gazelle.fhir.server.technical.FhirValidatorInterceptor; import net.ihe.gazelle.fhir.server.technical.HTTPValidatorInterceptor; import net.ihe.gazelle.fhir.server.technical.mapper.MHDFhirValidationServiceMapper; import net.ihe.gazelle.fhir.server.technical.mapper.MHDHttpValidationServiceMapper; import net.ihe.gazelle.fhir.server.technical.ws.DocumentReferencesProviderServiceImpl; import net.ihe.gazelle.fhir.server.technical.ws.ListProviderServiceImpl; -import net.ihe.gazelle.fhir.server.buisness.DocumentReferencesResourceProvider; -import net.ihe.gazelle.fhir.server.buisness.ListResourceProvider; import org.eclipse.microprofile.config.ConfigProvider; import java.util.ArrayList; import java.util.List; - public class MHDRestfullServer extends RestfulServer { - public MHDRestfullServer() { super(FhirContext.forR4Cached()); } @@ -46,8 +44,6 @@ public class MHDRestfullServer extends RestfulServer { registerInterceptor(new FhirValidatorInterceptor(evsEndpoint, new MHDFhirValidationServiceMapper())); - - } } diff --git a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/DocumentReferencesProviderServiceImpl.java b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/DocumentReferencesProviderServiceImpl.java index e092553e1744e74cd2fd0f957c986f47221c38d1..5aabe38e4611c5af96ccf8c9a24ec8badf4eeccb 100644 --- a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/DocumentReferencesProviderServiceImpl.java +++ b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/DocumentReferencesProviderServiceImpl.java @@ -10,6 +10,7 @@ import org.eclipse.microprofile.config.ConfigProvider; import org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.DocumentReference; + import java.util.List; import java.util.Map; @@ -41,8 +42,7 @@ public class DocumentReferencesProviderServiceImpl implements DocumentReferences IQuery<IBaseBundle> query = client.search().forResource(DocumentReference.class); for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) { String key = entry.getKey(); - String value = entry.getValue()[0]; - query = query.where(new StringClientParam(key).matches().value(value)); + query = query.where(new StringClientParam(key).matches().values(entry.getValue())); } return query.returnBundle(org.hl7.fhir.r4.model.Bundle.class) .execute() diff --git a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/ListProviderServiceImpl.java b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/ListProviderServiceImpl.java index bb3e66cf2a8c14665c864a271394249e3b6b3ab4..9ed8669d5a55275489aa56a09e84eba10995ac8b 100644 --- a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/ListProviderServiceImpl.java +++ b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/ListProviderServiceImpl.java @@ -9,6 +9,7 @@ import jakarta.enterprise.context.ApplicationScoped; import org.eclipse.microprofile.config.ConfigProvider; import org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.r4.model.ListResource; + import java.util.List; import java.util.Map; @@ -32,8 +33,8 @@ public class ListProviderServiceImpl implements ListProviderService { IQuery<IBaseBundle> query = client.search().forResource(ListResource.class); for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) { String key = entry.getKey(); - String value = entry.getValue()[0]; - query = query.where(new StringClientParam(key).matches().value(value)); + + query = query.where(new StringClientParam(key).matches().values(entry.getValue())); } return query.returnBundle(org.hl7.fhir.r4.model.Bundle.class) .execute() diff --git a/mhd-fhir-server-simulator/src/main/resources/application.properties b/mhd-fhir-server-simulator/src/main/resources/application.properties index c7374bee1063b09c46af40543c61be851323a2aa..b6926a9bbb3a11488e9150296d484e3bbe7384c3 100644 --- a/mhd-fhir-server-simulator/src/main/resources/application.properties +++ b/mhd-fhir-server-simulator/src/main/resources/application.properties @@ -6,5 +6,5 @@ http.validation.schematron.name-iti-67=CH_ITI-67-FindDocumentReferences-GET_MHD_ http.validation.schematron.name-iti-68=CH_ITI-68-RetrieveDocument-GET_MHD_Request fhir.validation.name=Matchbox -fhir.validation.schematron.name-iti-65=CH:MHD [ITI-65] Provide Document Bundle Comprehensive Response +fhir.validation.schematron.name-iti-65=http://fhir.ch/ig/ch-epr-fhir/StructureDefinition/ch-mhd-providedocumentbundle-comprehensive evs.endpoint=https://qualification.ihe-europe.net/evs/rest/validations diff --git a/mhd-fhir-server-simulator/src/test/java/net/ihe/gazelle/fhir/server/taechnical/mapper/MHDFhirValidationServiceMapperTest.java b/mhd-fhir-server-simulator/src/test/java/net/ihe/gazelle/fhir/server/taechnical/mapper/MHDFhirValidationServiceMapperTest.java index 5c9fd7551ff2a9d92a2a2ce69ae1b51a6a3e5fda..078790af7c094e28c4164d2da563049269246cc1 100644 --- a/mhd-fhir-server-simulator/src/test/java/net/ihe/gazelle/fhir/server/taechnical/mapper/MHDFhirValidationServiceMapperTest.java +++ b/mhd-fhir-server-simulator/src/test/java/net/ihe/gazelle/fhir/server/taechnical/mapper/MHDFhirValidationServiceMapperTest.java @@ -27,7 +27,7 @@ public class MHDFhirValidationServiceMapperTest { ValidationService validationService = mapper.getValidationService(requestDetails); - assertEquals("CH:MHD [ITI-65] Provide Document Bundle Comprehensive Response", validationService.getValidator()); + assertEquals("http://fhir.ch/ig/ch-epr-fhir/StructureDefinition/ch-mhd-providedocumentbundle-comprehensive", validationService.getValidator()); assertEquals("Matchbox", validationService.getName()); } }