View Javadoc
1   
2   package ca.uhn.fhir.jpa.rp.dstu2;
3   
4   import java.util.*;
5   
6   import org.apache.commons.lang3.StringUtils;
7   
8   import ca.uhn.fhir.jpa.provider.*;
9   import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
10  import ca.uhn.fhir.model.api.Include;
11  import ca.uhn.fhir.model.api.annotation.*;
12  import ca.uhn.fhir.model.dstu2.composite.*;
13  import ca.uhn.fhir.model.dstu2.resource.*; //
14  import ca.uhn.fhir.rest.annotation.*;
15  import ca.uhn.fhir.rest.param.*;
16  import ca.uhn.fhir.rest.api.SortSpec;
17  import ca.uhn.fhir.rest.api.SummaryEnum;
18  import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
19  
20  public class PractitionerResourceProvider extends 
21  	JpaResourceProviderDstu2<Practitioner>
22  	{
23  
24  	@Override
25  	public Class<Practitioner> getResourceType() {
26  		return Practitioner.class;
27  	}
28  
29  	@Search(allowUnknownParams=true)
30  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
31  			javax.servlet.http.HttpServletRequest theServletRequest,
32  			javax.servlet.http.HttpServletResponse theServletResponse,
33  
34  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
35  			
36  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
37  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
38  			StringAndListParam theFtContent, 
39  
40  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
41  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
42  			StringAndListParam theFtText, 
43  
44  			@Description(shortDefinition="Search for resources which have the given tag")
45  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
46  			TokenAndListParam theSearchForTag, 
47  
48  			@Description(shortDefinition="Search for resources which have the given security labels")
49  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
50  			TokenAndListParam theSearchForSecurity, 
51    
52  			@Description(shortDefinition="Search for resources which have the given profile")
53  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
54  			UriAndListParam theSearchForProfile, 
55  
56  			@Description(shortDefinition="Return resources linked to by the given target")
57  			@OptionalParam(name="_has")
58  			HasAndListParam theHas, 
59  
60    
61  			@Description(shortDefinition="The ID of the resource")
62  			@OptionalParam(name="_id")
63  			StringAndListParam the_id, 
64    
65  			@Description(shortDefinition="The language of the resource")
66  			@OptionalParam(name="_language")
67  			StringAndListParam the_language, 
68    
69  			@Description(shortDefinition="An address in any kind of address/part")
70  			@OptionalParam(name="address")
71  			StringAndListParam theAddress, 
72    
73  			@Description(shortDefinition="A city specified in an address")
74  			@OptionalParam(name="address-city")
75  			StringAndListParam theAddress_city, 
76    
77  			@Description(shortDefinition="A country specified in an address")
78  			@OptionalParam(name="address-country")
79  			StringAndListParam theAddress_country, 
80    
81  			@Description(shortDefinition="A postalCode specified in an address")
82  			@OptionalParam(name="address-postalcode")
83  			StringAndListParam theAddress_postalcode, 
84    
85  			@Description(shortDefinition="A state specified in an address")
86  			@OptionalParam(name="address-state")
87  			StringAndListParam theAddress_state, 
88    
89  			@Description(shortDefinition="A use code specified in an address")
90  			@OptionalParam(name="address-use")
91  			TokenAndListParam theAddress_use,
92    
93  			@Description(shortDefinition="One of the languages that the practitioner can communicate with")
94  			@OptionalParam(name="communication")
95  			TokenAndListParam theCommunication,
96    
97  			@Description(shortDefinition="A value in an email contact")
98  			@OptionalParam(name="email")
99  			TokenAndListParam theEmail,
100   
101 			@Description(shortDefinition="A portion of the family name")
102 			@OptionalParam(name="family")
103 			StringAndListParam theFamily, 
104   
105 			@Description(shortDefinition="Gender of the practitioner")
106 			@OptionalParam(name="gender")
107 			TokenAndListParam theGender,
108   
109 			@Description(shortDefinition="A portion of the given name")
110 			@OptionalParam(name="given")
111 			StringAndListParam theGiven, 
112   
113 			@Description(shortDefinition="A practitioner's Identifier")
114 			@OptionalParam(name="identifier")
115 			TokenAndListParam theIdentifier,
116   
117 			@Description(shortDefinition="One of the locations at which this practitioner provides care")
118 			@OptionalParam(name="location", targetTypes={  } )
119 			ReferenceAndListParam theLocation, 
120   
121 			@Description(shortDefinition="A portion of either family or given name")
122 			@OptionalParam(name="name")
123 			StringAndListParam theName, 
124   
125 			@Description(shortDefinition="The identity of the organization the practitioner represents / acts on behalf of")
126 			@OptionalParam(name="organization", targetTypes={  } )
127 			ReferenceAndListParam theOrganization, 
128   
129 			@Description(shortDefinition="A value in a phone contact")
130 			@OptionalParam(name="phone")
131 			TokenAndListParam thePhone,
132   
133 			@Description(shortDefinition="A portion of either family or given name using some kind of phonetic matching algorithm")
134 			@OptionalParam(name="phonetic")
135 			StringAndListParam thePhonetic, 
136   
137 			@Description(shortDefinition="The practitioner can perform this role at for the organization")
138 			@OptionalParam(name="role")
139 			TokenAndListParam theRole,
140   
141 			@Description(shortDefinition="The practitioner has this specialty at an organization")
142 			@OptionalParam(name="specialty")
143 			TokenAndListParam theSpecialty,
144   
145 			@Description(shortDefinition="The value in any kind of contact")
146 			@OptionalParam(name="telecom")
147 			TokenAndListParam theTelecom,
148 
149 			@RawParam
150 			Map<String, List<String>> theAdditionalRawParams,
151 
152 			@IncludeParam(reverse=true)
153 			Set<Include> theRevIncludes,
154 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
155 			@OptionalParam(name="_lastUpdated")
156 			DateRangeParam theLastUpdated, 
157 
158 			@IncludeParam(allow= {
159 					"Practitioner:location" , 					"Practitioner:organization" , 						"Practitioner:location" , 					"Practitioner:organization" 					, "*"
160 			}) 
161 			Set<Include> theIncludes,
162 			
163 			@Sort 
164 			SortSpec theSort,
165 			
166 			@ca.uhn.fhir.rest.annotation.Count
167 			Integer theCount,
168 
169 			SummaryEnum theSummaryMode,
170 
171 			SearchTotalModeEnum theSearchTotalMode
172 
173 			) {
174 		startRequest(theServletRequest);
175 		try {
176 			SearchParameterMap paramMap = new SearchParameterMap();
177 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
178 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
179 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
180 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
181 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
182 			paramMap.add("_has", theHas);
183 			paramMap.add("_id", the_id);
184 			paramMap.add("_language", the_language);
185 			paramMap.add("address", theAddress);
186 			paramMap.add("address-city", theAddress_city);
187 			paramMap.add("address-country", theAddress_country);
188 			paramMap.add("address-postalcode", theAddress_postalcode);
189 			paramMap.add("address-state", theAddress_state);
190 			paramMap.add("address-use", theAddress_use);
191 			paramMap.add("communication", theCommunication);
192 			paramMap.add("email", theEmail);
193 			paramMap.add("family", theFamily);
194 			paramMap.add("gender", theGender);
195 			paramMap.add("given", theGiven);
196 			paramMap.add("identifier", theIdentifier);
197 			paramMap.add("location", theLocation);
198 			paramMap.add("name", theName);
199 			paramMap.add("organization", theOrganization);
200 			paramMap.add("phone", thePhone);
201 			paramMap.add("phonetic", thePhonetic);
202 			paramMap.add("role", theRole);
203 			paramMap.add("specialty", theSpecialty);
204 			paramMap.add("telecom", theTelecom);
205 			paramMap.setRevIncludes(theRevIncludes);
206 			paramMap.setLastUpdated(theLastUpdated);
207 			paramMap.setIncludes(theIncludes);
208 			paramMap.setSort(theSort);
209 			paramMap.setCount(theCount);
210 			paramMap.setSummaryMode(theSummaryMode);
211 			paramMap.setSearchTotalMode(theSearchTotalMode);
212 
213 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
214 
215 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
216 			return retVal;
217 		} finally {
218 			endRequest(theServletRequest);
219 		}
220 	}
221 
222 }