001 002package ca.uhn.fhir.jpa.rp.dstu2; 003 004import java.util.*; 005 006import org.apache.commons.lang3.StringUtils; 007 008import ca.uhn.fhir.jpa.provider.*; 009import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; 010import ca.uhn.fhir.model.api.Include; 011import ca.uhn.fhir.model.api.annotation.*; 012import ca.uhn.fhir.model.dstu2.composite.*; 013import ca.uhn.fhir.model.dstu2.resource.*; // 014import ca.uhn.fhir.rest.annotation.*; 015import ca.uhn.fhir.rest.param.*; 016import ca.uhn.fhir.rest.api.SortSpec; 017import ca.uhn.fhir.rest.api.SummaryEnum; 018import ca.uhn.fhir.rest.api.SearchTotalModeEnum; 019import ca.uhn.fhir.rest.api.SearchContainedModeEnum; 020 021public class PractitionerResourceProvider extends 022 JpaResourceProviderDstu2<Practitioner> 023 { 024 025 @Override 026 public Class<Practitioner> getResourceType() { 027 return Practitioner.class; 028 } 029 030 @Search(allowUnknownParams=true) 031 public ca.uhn.fhir.rest.api.server.IBundleProvider search( 032 javax.servlet.http.HttpServletRequest theServletRequest, 033 javax.servlet.http.HttpServletResponse theServletResponse, 034 035 ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, 036 037 @Description(shortDefinition="Search the contents of the resource's data using a filter") 038 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_FILTER) 039 StringAndListParam theFtFilter, 040 041 @Description(shortDefinition="Search the contents of the resource's data using a fulltext search") 042 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT) 043 StringAndListParam theFtContent, 044 045 @Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search") 046 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT) 047 StringAndListParam theFtText, 048 049 @Description(shortDefinition="Search for resources which have the given tag") 050 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG) 051 TokenAndListParam theSearchForTag, 052 053 @Description(shortDefinition="Search for resources which have the given security labels") 054 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY) 055 TokenAndListParam theSearchForSecurity, 056 057 @Description(shortDefinition="Search for resources which have the given profile") 058 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE) 059 UriAndListParam theSearchForProfile, 060 061 @Description(shortDefinition="Search for resources which have the given source value (Resource.meta.source)") 062 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE) 063 UriAndListParam theSearchForSource, 064 065 @Description(shortDefinition="Return resources linked to by the given target") 066 @OptionalParam(name="_has") 067 HasAndListParam theHas, 068 069 070 071 @Description(shortDefinition="The ID of the resource") 072 @OptionalParam(name="_id") 073 StringAndListParam the_id, 074 075 076 @Description(shortDefinition="An address in any kind of address/part") 077 @OptionalParam(name="address") 078 StringAndListParam theAddress, 079 080 081 @Description(shortDefinition="A city specified in an address") 082 @OptionalParam(name="address-city") 083 StringAndListParam theAddress_city, 084 085 086 @Description(shortDefinition="A country specified in an address") 087 @OptionalParam(name="address-country") 088 StringAndListParam theAddress_country, 089 090 091 @Description(shortDefinition="A postalCode specified in an address") 092 @OptionalParam(name="address-postalcode") 093 StringAndListParam theAddress_postalcode, 094 095 096 @Description(shortDefinition="A state specified in an address") 097 @OptionalParam(name="address-state") 098 StringAndListParam theAddress_state, 099 100 101 @Description(shortDefinition="A use code specified in an address") 102 @OptionalParam(name="address-use") 103 TokenAndListParam theAddress_use, 104 105 106 @Description(shortDefinition="One of the languages that the practitioner can communicate with") 107 @OptionalParam(name="communication") 108 TokenAndListParam theCommunication, 109 110 111 @Description(shortDefinition="A value in an email contact") 112 @OptionalParam(name="email") 113 TokenAndListParam theEmail, 114 115 116 @Description(shortDefinition="A portion of the family name") 117 @OptionalParam(name="family") 118 StringAndListParam theFamily, 119 120 121 @Description(shortDefinition="Gender of the practitioner") 122 @OptionalParam(name="gender") 123 TokenAndListParam theGender, 124 125 126 @Description(shortDefinition="A portion of the given name") 127 @OptionalParam(name="given") 128 StringAndListParam theGiven, 129 130 131 @Description(shortDefinition="A practitioner's Identifier") 132 @OptionalParam(name="identifier") 133 TokenAndListParam theIdentifier, 134 135 136 @Description(shortDefinition="One of the locations at which this practitioner provides care") 137 @OptionalParam(name="location", targetTypes={ } ) 138 ReferenceAndListParam theLocation, 139 140 141 @Description(shortDefinition="A portion of either family or given name") 142 @OptionalParam(name="name") 143 StringAndListParam theName, 144 145 146 @Description(shortDefinition="The identity of the organization the practitioner represents / acts on behalf of") 147 @OptionalParam(name="organization", targetTypes={ } ) 148 ReferenceAndListParam theOrganization, 149 150 151 @Description(shortDefinition="A value in a phone contact") 152 @OptionalParam(name="phone") 153 TokenAndListParam thePhone, 154 155 156 @Description(shortDefinition="A portion of either family or given name using some kind of phonetic matching algorithm") 157 @OptionalParam(name="phonetic") 158 StringAndListParam thePhonetic, 159 160 161 @Description(shortDefinition="The practitioner can perform this role at for the organization") 162 @OptionalParam(name="role") 163 TokenAndListParam theRole, 164 165 166 @Description(shortDefinition="The practitioner has this specialty at an organization") 167 @OptionalParam(name="specialty") 168 TokenAndListParam theSpecialty, 169 170 171 @Description(shortDefinition="The value in any kind of contact") 172 @OptionalParam(name="telecom") 173 TokenAndListParam theTelecom, 174 175 @RawParam 176 Map<String, List<String>> theAdditionalRawParams, 177 178 @Description(shortDefinition="Only return resources which were last updated as specified by the given range") 179 @OptionalParam(name="_lastUpdated") 180 DateRangeParam theLastUpdated, 181 182 @IncludeParam 183 Set<Include> theIncludes, 184 185 @IncludeParam(reverse=true) 186 Set<Include> theRevIncludes, 187 188 @Sort 189 SortSpec theSort, 190 191 @ca.uhn.fhir.rest.annotation.Count 192 Integer theCount, 193 194 @ca.uhn.fhir.rest.annotation.Offset 195 Integer theOffset, 196 197 SummaryEnum theSummaryMode, 198 199 SearchTotalModeEnum theSearchTotalMode, 200 201 SearchContainedModeEnum theSearchContainedMode 202 203 ) { 204 startRequest(theServletRequest); 205 try { 206 SearchParameterMap paramMap = new SearchParameterMap(); 207 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter); 208 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent); 209 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText); 210 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag); 211 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity); 212 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile); 213 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource); 214 paramMap.add("_has", theHas); 215 paramMap.add("_id", the_id); 216 paramMap.add("address", theAddress); 217 paramMap.add("address-city", theAddress_city); 218 paramMap.add("address-country", theAddress_country); 219 paramMap.add("address-postalcode", theAddress_postalcode); 220 paramMap.add("address-state", theAddress_state); 221 paramMap.add("address-use", theAddress_use); 222 paramMap.add("communication", theCommunication); 223 paramMap.add("email", theEmail); 224 paramMap.add("family", theFamily); 225 paramMap.add("gender", theGender); 226 paramMap.add("given", theGiven); 227 paramMap.add("identifier", theIdentifier); 228 paramMap.add("location", theLocation); 229 paramMap.add("name", theName); 230 paramMap.add("organization", theOrganization); 231 paramMap.add("phone", thePhone); 232 paramMap.add("phonetic", thePhonetic); 233 paramMap.add("role", theRole); 234 paramMap.add("specialty", theSpecialty); 235 paramMap.add("telecom", theTelecom); 236 paramMap.setRevIncludes(theRevIncludes); 237 paramMap.setLastUpdated(theLastUpdated); 238 paramMap.setIncludes(theIncludes); 239 paramMap.setSort(theSort); 240 paramMap.setCount(theCount); 241 paramMap.setOffset(theOffset); 242 paramMap.setSummaryMode(theSummaryMode); 243 paramMap.setSearchTotalMode(theSearchTotalMode); 244 paramMap.setSearchContainedMode(theSearchContainedMode); 245 246 getDao().translateRawParameters(theAdditionalRawParams, paramMap); 247 248 ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse); 249 return retVal; 250 } finally { 251 endRequest(theServletRequest); 252 } 253 } 254 255}