use of gov.cms.bfd.server.war.r4.providers.R4PatientResourceProvider in project beneficiary-fhir-data by CMSgov.
the class EndpointJsonResponseComparatorV2IT method patientRead.
/**
* @return the results of the {@link
* R4PatientResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation
*/
public static String patientRead() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
Beneficiary beneficiary = loadedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r).findFirst().get();
IGenericClient fhirClient = createFhirClientAndSetEncoding();
JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
fhirClient.read().resource(Patient.class).withId(beneficiary.getBeneficiaryId()).execute();
return sortPatientIdentifiers(jsonInterceptor.getResponse());
}
use of gov.cms.bfd.server.war.r4.providers.R4PatientResourceProvider in project beneficiary-fhir-data by CMSgov.
the class EndpointJsonResponseComparatorV2IT method patientByIdentifier.
/**
* @return the results of the {@link
* R4PatientResourceProvider#searchByIdentifier(ca.uhn.fhir.rest.param.TokenParam)} operation
*/
public static String patientByIdentifier() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
Beneficiary beneficiary = loadedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r).findFirst().get();
IGenericClient fhirClient = createFhirClientAndSetEncoding();
JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
fhirClient.search().forResource(Patient.class).where(Patient.IDENTIFIER.exactly().systemAndIdentifier(TransformerConstants.CODING_BBAPI_BENE_HICN_HASH, beneficiary.getHicn())).returnBundle(Bundle.class).execute();
return sortPatientIdentifiers(jsonInterceptor.getResponse());
}
use of gov.cms.bfd.server.war.r4.providers.R4PatientResourceProvider in project beneficiary-fhir-data by CMSgov.
the class EndpointJsonResponseComparatorV2IT method patientSearchByIdWithIncludeIdentifiers.
/**
* @return the results of the {@link
* R4PatientResourceProvider#searchByLogicalId(ca.uhn.fhir.rest.param.TokenParam)} operation
* when {@link ExtraParamsInterceptor#setIncludeIdentifiers(IncludeIdentifiersValues)} set to
* "hicn, mbi"
*/
public static String patientSearchByIdWithIncludeIdentifiers() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
Beneficiary beneficiary = loadedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r).findFirst().get();
IGenericClient fhirClient = createFhirClientAndSetEncoding();
ExtraParamsInterceptor extraParamsInterceptor = new ExtraParamsInterceptor();
extraParamsInterceptor.setHeaders(RequestHeaders.getHeaderWrapper(R4PatientResourceProvider.HEADER_NAME_INCLUDE_IDENTIFIERS, "hicn,mbi", R4PatientResourceProvider.HEADER_NAME_INCLUDE_ADDRESS_FIELDS, "true"));
fhirClient.registerInterceptor(extraParamsInterceptor);
JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
fhirClient.search().forResource(Patient.class).where(Patient.RES_ID.exactly().systemAndIdentifier(null, beneficiary.getBeneficiaryId())).returnBundle(Bundle.class).execute();
return sortPatientIdentifiers(jsonInterceptor.getResponse());
}
use of gov.cms.bfd.server.war.r4.providers.R4PatientResourceProvider in project beneficiary-fhir-data by CMSgov.
the class EndpointJsonResponseComparatorV2IT method patientSearchById.
/**
* @return the results of the {@link
* R4PatientResourceProvider#searchByLogicalId(ca.uhn.fhir.rest.param.TokenParam)} operation
*/
public static String patientSearchById() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
Beneficiary beneficiary = loadedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r).findFirst().get();
IGenericClient fhirClient = createFhirClientAndSetEncoding();
JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
fhirClient.search().forResource(Patient.class).where(Patient.RES_ID.exactly().systemAndIdentifier(null, beneficiary.getBeneficiaryId())).returnBundle(Bundle.class).execute();
return sortPatientIdentifiers(jsonInterceptor.getResponse());
}
use of gov.cms.bfd.server.war.r4.providers.R4PatientResourceProvider in project beneficiary-fhir-data by CMSgov.
the class EndpointJsonResponseComparatorV2IT method patientReadWithIncludeIdentifiers.
/**
* @return the results of the {@link
* R4PatientResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation when {@link
* ExtraParamsInterceptor#setIncludeIdentifiers(IncludeIdentifiersValues)} set to "hicn,mbi"
*/
public static String patientReadWithIncludeIdentifiers() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
Beneficiary beneficiary = loadedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r).findFirst().get();
IGenericClient fhirClient = createFhirClientAndSetEncoding();
ExtraParamsInterceptor extraParamsInterceptor = new ExtraParamsInterceptor();
extraParamsInterceptor.setHeaders(RequestHeaders.getHeaderWrapper(R4PatientResourceProvider.HEADER_NAME_INCLUDE_IDENTIFIERS, "hicn,mbi", R4PatientResourceProvider.HEADER_NAME_INCLUDE_ADDRESS_FIELDS, "true"));
fhirClient.registerInterceptor(extraParamsInterceptor);
JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
fhirClient.read().resource(Patient.class).withId(beneficiary.getBeneficiaryId()).execute();
return sortPatientIdentifiers(jsonInterceptor.getResponse());
}
Aggregations