001
002package ca.uhn.fhir.jpa.rp.r4;
003
004import java.util.*;
005
006import org.apache.commons.lang3.StringUtils;
007
008import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
009import ca.uhn.fhir.model.api.Include;
010import ca.uhn.fhir.model.api.annotation.*;
011import org.hl7.fhir.r4.model.*;
012import ca.uhn.fhir.rest.annotation.*;
013import ca.uhn.fhir.rest.param.*;
014import ca.uhn.fhir.rest.api.SortSpec;
015import ca.uhn.fhir.rest.api.SummaryEnum;
016import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
017import ca.uhn.fhir.rest.api.SearchContainedModeEnum;
018
019public class PractitionerRoleResourceProvider extends 
020        ca.uhn.fhir.jpa.provider.BaseJpaResourceProvider<PractitionerRole>
021        {
022
023        @Override
024        public Class<PractitionerRole> getResourceType() {
025                return PractitionerRole.class;
026        }
027
028        @Search(allowUnknownParams=true)
029        public ca.uhn.fhir.rest.api.server.IBundleProvider search(
030                        jakarta.servlet.http.HttpServletRequest theServletRequest,
031                        jakarta.servlet.http.HttpServletResponse theServletResponse,
032
033                        ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
034
035                        @Description(shortDefinition="Search the contents of the resource's data using a filter")
036                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_FILTER)
037                        StringAndListParam theFtFilter,
038
039                        @Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
040                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
041                        StringAndListParam theFtContent, 
042
043                        @Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
044                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
045                        StringAndListParam theFtText, 
046
047                        @Description(shortDefinition="Search for resources which have the given tag")
048                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
049                        TokenAndListParam theSearchForTag, 
050
051                        @Description(shortDefinition="Search for resources which have the given security labels")
052                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
053                        TokenAndListParam theSearchForSecurity, 
054  
055                        @Description(shortDefinition="Search for resources which have the given profile")
056                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
057                        UriAndListParam theSearchForProfile,
058
059                        @Description(shortDefinition="Search the contents of the resource's data using a list")
060                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_LIST)
061                        StringAndListParam theList,
062
063                        @Description(shortDefinition="Search for resources which have the given source value (Resource.meta.source)")
064                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE)
065                        UriAndListParam theSearchForSource,
066
067                        @Description(shortDefinition="Return resources linked to by the given target")
068                        @OptionalParam(name="_has")
069                        HasAndListParam theHas, 
070
071   
072
073                        @Description(shortDefinition="The ID of the resource")
074                        @OptionalParam(name="_id")
075                        TokenAndListParam the_id,
076   
077
078                        @Description(shortDefinition="Whether this practitioner role record is in active use")
079                        @OptionalParam(name="active")
080                        TokenAndListParam theActive,
081   
082
083                        @Description(shortDefinition="The period during which the practitioner is authorized to perform in these role(s)")
084                        @OptionalParam(name="date")
085                        DateRangeParam theDate, 
086   
087
088                        @Description(shortDefinition="A value in an email contact")
089                        @OptionalParam(name="email")
090                        TokenAndListParam theEmail,
091   
092
093                        @Description(shortDefinition="Technical endpoints providing access to services operated for the practitioner with this role")
094                        @OptionalParam(name="endpoint", targetTypes={  } )
095                        ReferenceAndListParam theEndpoint, 
096   
097
098                        @Description(shortDefinition="A practitioner's Identifier")
099                        @OptionalParam(name="identifier")
100                        TokenAndListParam theIdentifier,
101   
102
103                        @Description(shortDefinition="One of the locations at which this practitioner provides care")
104                        @OptionalParam(name="location", targetTypes={  } )
105                        ReferenceAndListParam theLocation, 
106   
107
108                        @Description(shortDefinition="The identity of the organization the practitioner represents / acts on behalf of")
109                        @OptionalParam(name="organization", targetTypes={  } )
110                        ReferenceAndListParam theOrganization, 
111   
112
113                        @Description(shortDefinition="A value in a phone contact")
114                        @OptionalParam(name="phone")
115                        TokenAndListParam thePhone,
116   
117
118                        @Description(shortDefinition="Practitioner that is able to provide the defined services for the organization")
119                        @OptionalParam(name="practitioner", targetTypes={  } )
120                        ReferenceAndListParam thePractitioner, 
121   
122
123                        @Description(shortDefinition="The practitioner can perform this role at for the organization")
124                        @OptionalParam(name="role")
125                        TokenAndListParam theRole,
126   
127
128                        @Description(shortDefinition="The list of healthcare services that this worker provides for this role's Organization/Location(s)")
129                        @OptionalParam(name="service", targetTypes={  } )
130                        ReferenceAndListParam theService, 
131   
132
133                        @Description(shortDefinition="The practitioner has this specialty at an organization")
134                        @OptionalParam(name="specialty")
135                        TokenAndListParam theSpecialty,
136   
137
138                        @Description(shortDefinition="The value in any kind of contact")
139                        @OptionalParam(name="telecom")
140                        TokenAndListParam theTelecom,
141
142                        @RawParam
143                        Map<String, List<String>> theAdditionalRawParams,
144
145                        @Description(shortDefinition="Only return resources which were last updated as specified by the given range")
146                        @OptionalParam(name="_lastUpdated")
147                        DateRangeParam theLastUpdated, 
148
149                        @IncludeParam
150                        Set<Include> theIncludes,
151
152                        @IncludeParam(reverse=true)
153                        Set<Include> theRevIncludes,
154
155                        @Sort
156                        SortSpec theSort,
157                        
158                        @ca.uhn.fhir.rest.annotation.Count
159                        Integer theCount,
160
161                        @ca.uhn.fhir.rest.annotation.Offset
162                        Integer theOffset,
163
164                        SummaryEnum theSummaryMode,
165
166                        SearchTotalModeEnum theSearchTotalMode,
167
168                        SearchContainedModeEnum theSearchContainedMode
169
170                        ) {
171                startRequest(theServletRequest);
172                try {
173                        SearchParameterMap paramMap = new SearchParameterMap();
174                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter);
175                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
176                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
177                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
178                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
179                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
180                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource);
181                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_LIST, theList);
182                        paramMap.add("_has", theHas);
183                        paramMap.add("_id", the_id);
184                        paramMap.add("active", theActive);
185                        paramMap.add("date", theDate);
186                        paramMap.add("email", theEmail);
187                        paramMap.add("endpoint", theEndpoint);
188                        paramMap.add("identifier", theIdentifier);
189                        paramMap.add("location", theLocation);
190                        paramMap.add("organization", theOrganization);
191                        paramMap.add("phone", thePhone);
192                        paramMap.add("practitioner", thePractitioner);
193                        paramMap.add("role", theRole);
194                        paramMap.add("service", theService);
195                        paramMap.add("specialty", theSpecialty);
196                        paramMap.add("telecom", theTelecom);
197                        paramMap.setRevIncludes(theRevIncludes);
198                        paramMap.setLastUpdated(theLastUpdated);
199                        paramMap.setIncludes(theIncludes);
200                        paramMap.setSort(theSort);
201                        paramMap.setCount(theCount);
202                        paramMap.setOffset(theOffset);
203                        paramMap.setSummaryMode(theSummaryMode);
204                        paramMap.setSearchTotalMode(theSearchTotalMode);
205                        paramMap.setSearchContainedMode(theSearchContainedMode);
206
207                        getDao().translateRawParameters(theAdditionalRawParams, paramMap);
208
209                        ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
210                        return retVal;
211                } finally {
212                        endRequest(theServletRequest);
213                }
214        }
215
216}