# Fhir Patient Resource with search with custom query **Category:** [FHIR](https://openhealthhub.org/c/fhir/31) **Created:** 2020-04-13 08:30 UTC **Views:** 2196 **Replies:** 5 **URL:** https://openhealthhub.org/t/fhir-patient-resource-with-search-with-custom-query/2246 --- ## Post #1 by @Tharma hi All, I am trying to find a way to introduce a search method for a Patient Resource as follows using Hapi Fhir for CCRI https:/x/y/z/domain/Patient?_query=ongoingAdmission&Identifier=34567. couldn't find the similar implementation here https://hapifhir.io/hapi-fhir/docs/server_plain/rest_operations_search.html please give your thoughts on this? thanks Tharma --- ## Post #2 by @mayfield.g.kev It doesn't support more complex queries by design. It might be able to perform an equivalent query on Encounter resource. Something like Encounter?patient.identifier=34567&status=in-progress (I don't think CCRI support chained parameters but it would be possible to extend it to do so) --- ## Post #3 by @Tharma [quote="Tharma, post:1, topic:2246"] Patient?_query= [/quote] Thanks Kevin, does that mean it is not available / supported in CCRI ? I am trying to find it in hapi reference implementation for this https://www.hl7.org/fhir/search.html#query GET [base]/Patient?_query=name¶meters... if not available in HAPI implentation, should we intercept the request & handle manually ? any idea ? thanks Tharma --- ## Post #4 by @mayfield.g.kev It may be in the standard HAPI, ccri has a different data model. However if your familiar with Hibernate, extending ccri would be possible. https://hibernate.org/ You would need to alter the patient provider and put in a Hibernate query in the patient Dao. --- ## Post #5 by @Tharma hi Kevin, Thank you, I have issue with defining the search method in the PatientProvider not the back end. @Search public Bundle getBundleByPatient(/* the query Parameter */) { read the _query parameter here and handle it. } what type of parameter I should define here ? apologies I didn't clearly explain the issue I am facing ? thanks Tharma --- ## Post #6 by @Tharma hi, I solved this problem https://hapifhir.io/hapi-fhir/docs/server_plain/rest_operations_search.html#combining-multiple-parameters @Search(queryName="namedQuery1") public List searchByNamedQuery(@RequiredParam(name="someparam") StringParam theSomeParam) { List retVal = new ArrayList(); // ...populate... return retVal; } thanks Tharma --- **Canonical:** https://openhealthhub.org/t/fhir-patient-resource-with-search-with-custom-query/2246 **Original content:** https://openhealthhub.org/t/fhir-patient-resource-with-search-with-custom-query/2246