View Javadoc
1   
2   package ca.uhn.fhir.jpa.rp.dstu3;
3   
4   import java.util.*;
5   
6   import org.apache.commons.lang3.StringUtils;
7   
8   import ca.uhn.fhir.jpa.provider.dstu3.*;
9   import ca.uhn.fhir.jpa.dao.SearchParameterMap;
10  import ca.uhn.fhir.model.api.Include;
11  import ca.uhn.fhir.model.api.annotation.*;
12  import org.hl7.fhir.dstu3.model.*;
13  import ca.uhn.fhir.rest.annotation.*;
14  import ca.uhn.fhir.rest.param.*;
15  import ca.uhn.fhir.rest.api.SortSpec;
16  import ca.uhn.fhir.rest.api.SummaryEnum;
17  import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
18  
19  public class ObservationResourceProvider extends 
20  	JpaResourceProviderDstu3<Observation>
21  	{
22  
23  	@Override
24  	public Class<Observation> getResourceType() {
25  		return Observation.class;
26  	}
27  
28  	@Search(allowUnknownParams=true)
29  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
30  			javax.servlet.http.HttpServletRequest theServletRequest,
31  			javax.servlet.http.HttpServletResponse theServletResponse,
32  
33  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
34  			
35  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
36  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
37  			StringAndListParam theFtContent, 
38  
39  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
40  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
41  			StringAndListParam theFtText, 
42  
43  			@Description(shortDefinition="Search for resources which have the given tag")
44  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
45  			TokenAndListParam theSearchForTag, 
46  
47  			@Description(shortDefinition="Search for resources which have the given security labels")
48  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
49  			TokenAndListParam theSearchForSecurity, 
50    
51  			@Description(shortDefinition="Search for resources which have the given profile")
52  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
53  			UriAndListParam theSearchForProfile, 
54  
55  			@Description(shortDefinition="Return resources linked to by the given target")
56  			@OptionalParam(name="_has")
57  			HasAndListParam theHas, 
58  
59    
60  			@Description(shortDefinition="The ID of the resource")
61  			@OptionalParam(name="_id")
62  			TokenAndListParam the_id,
63    
64  			@Description(shortDefinition="The language of the resource")
65  			@OptionalParam(name="_language")
66  			StringAndListParam the_language, 
67    
68  			@Description(shortDefinition="Reference to the test or procedure request.")
69  			@OptionalParam(name="based-on", targetTypes={  } )
70  			ReferenceAndListParam theBased_on, 
71    
72  			@Description(shortDefinition="The classification of the type of observation")
73  			@OptionalParam(name="category")
74  			TokenAndListParam theCategory,
75    
76  			@Description(shortDefinition="The code of the observation type")
77  			@OptionalParam(name="code")
78  			TokenAndListParam theCode,
79    
80  			@Description(shortDefinition="Code and coded value parameter pair")
81  			@OptionalParam(name="code-value-concept", compositeTypes= { TokenParam.class, TokenParam.class })
82  			CompositeAndListParam<TokenParam, TokenParam> theCode_value_concept,
83    
84  			@Description(shortDefinition="Code and date/time value parameter pair")
85  			@OptionalParam(name="code-value-date", compositeTypes= { TokenParam.class, DateParam.class })
86  			CompositeAndListParam<TokenParam, DateParam> theCode_value_date,
87    
88  			@Description(shortDefinition="Code and quantity value parameter pair")
89  			@OptionalParam(name="code-value-quantity", compositeTypes= { TokenParam.class, QuantityParam.class })
90  			CompositeAndListParam<TokenParam, QuantityParam> theCode_value_quantity,
91    
92  			@Description(shortDefinition="Code and string value parameter pair")
93  			@OptionalParam(name="code-value-string", compositeTypes= { TokenParam.class, StringParam.class })
94  			CompositeAndListParam<TokenParam, StringParam> theCode_value_string,
95    
96  			@Description(shortDefinition="The code of the observation type or component type")
97  			@OptionalParam(name="combo-code")
98  			TokenAndListParam theCombo_code,
99    
100 			@Description(shortDefinition="Code and coded value parameter pair, including in components")
101 			@OptionalParam(name="combo-code-value-concept", compositeTypes= { TokenParam.class, TokenParam.class })
102 			CompositeAndListParam<TokenParam, TokenParam> theCombo_code_value_concept,
103   
104 			@Description(shortDefinition="Code and quantity value parameter pair, including in components")
105 			@OptionalParam(name="combo-code-value-quantity", compositeTypes= { TokenParam.class, QuantityParam.class })
106 			CompositeAndListParam<TokenParam, QuantityParam> theCombo_code_value_quantity,
107   
108 			@Description(shortDefinition="The reason why the expected value in the element Observation.value[x] or Observation.component.value[x] is missing.")
109 			@OptionalParam(name="combo-data-absent-reason")
110 			TokenAndListParam theCombo_data_absent_reason,
111   
112 			@Description(shortDefinition="The value or component value of the observation, if the value is a CodeableConcept")
113 			@OptionalParam(name="combo-value-concept")
114 			TokenAndListParam theCombo_value_concept,
115   
116 			@Description(shortDefinition="The value or component value of the observation, if the value is a Quantity, or a SampledData (just search on the bounds of the values in sampled data)")
117 			@OptionalParam(name="combo-value-quantity")
118 			QuantityAndListParam theCombo_value_quantity, 
119   
120 			@Description(shortDefinition="The component code of the observation type")
121 			@OptionalParam(name="component-code")
122 			TokenAndListParam theComponent_code,
123   
124 			@Description(shortDefinition="Component code and component coded value parameter pair")
125 			@OptionalParam(name="component-code-value-concept", compositeTypes= { TokenParam.class, TokenParam.class })
126 			CompositeAndListParam<TokenParam, TokenParam> theComponent_code_value_concept,
127   
128 			@Description(shortDefinition="Component code and component quantity value parameter pair")
129 			@OptionalParam(name="component-code-value-quantity", compositeTypes= { TokenParam.class, QuantityParam.class })
130 			CompositeAndListParam<TokenParam, QuantityParam> theComponent_code_value_quantity,
131   
132 			@Description(shortDefinition="The reason why the expected value in the element Observation.component.value[x] is missing.")
133 			@OptionalParam(name="component-data-absent-reason")
134 			TokenAndListParam theComponent_data_absent_reason,
135   
136 			@Description(shortDefinition="The value of the component observation, if the value is a CodeableConcept")
137 			@OptionalParam(name="component-value-concept")
138 			TokenAndListParam theComponent_value_concept,
139   
140 			@Description(shortDefinition="The value of the component observation, if the value is a Quantity, or a SampledData (just search on the bounds of the values in sampled data)")
141 			@OptionalParam(name="component-value-quantity")
142 			QuantityAndListParam theComponent_value_quantity, 
143   
144 			@Description(shortDefinition="Healthcare event  (Episode-of-care or Encounter) related to the observation")
145 			@OptionalParam(name="context", targetTypes={  } )
146 			ReferenceAndListParam theContext, 
147   
148 			@Description(shortDefinition="The reason why the expected value in the element Observation.value[x] is missing.")
149 			@OptionalParam(name="data-absent-reason")
150 			TokenAndListParam theData_absent_reason,
151   
152 			@Description(shortDefinition="Obtained date/time. If the obtained element is a period, a date that falls in the period")
153 			@OptionalParam(name="date")
154 			DateRangeParam theDate, 
155   
156 			@Description(shortDefinition="The Device that generated the observation data.")
157 			@OptionalParam(name="device", targetTypes={  } )
158 			ReferenceAndListParam theDevice, 
159   
160 			@Description(shortDefinition="Encounter related to the observation")
161 			@OptionalParam(name="encounter", targetTypes={  } )
162 			ReferenceAndListParam theEncounter, 
163   
164 			@Description(shortDefinition="The unique id for a particular observation")
165 			@OptionalParam(name="identifier")
166 			TokenAndListParam theIdentifier,
167   
168 			@Description(shortDefinition="The method used for the observation")
169 			@OptionalParam(name="method")
170 			TokenAndListParam theMethod,
171   
172 			@Description(shortDefinition="The subject that the observation is about (if patient)")
173 			@OptionalParam(name="patient", targetTypes={  } )
174 			ReferenceAndListParam thePatient, 
175   
176 			@Description(shortDefinition="Who performed the observation")
177 			@OptionalParam(name="performer", targetTypes={  } )
178 			ReferenceAndListParam thePerformer, 
179   
180 			@Description(shortDefinition="Related Observations - search on related-type and related-target together")
181 			@OptionalParam(name="related", compositeTypes= { ReferenceParam.class, TokenParam.class })
182 			CompositeAndListParam<ReferenceParam, TokenParam> theRelated,
183   
184 			@Description(shortDefinition="Resource that is related to this one")
185 			@OptionalParam(name="related-target", targetTypes={  } )
186 			ReferenceAndListParam theRelated_target, 
187   
188 			@Description(shortDefinition="has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by")
189 			@OptionalParam(name="related-type")
190 			TokenAndListParam theRelated_type,
191   
192 			@Description(shortDefinition="Specimen used for this observation")
193 			@OptionalParam(name="specimen", targetTypes={  } )
194 			ReferenceAndListParam theSpecimen, 
195   
196 			@Description(shortDefinition="The status of the observation")
197 			@OptionalParam(name="status")
198 			TokenAndListParam theStatus,
199   
200 			@Description(shortDefinition="The subject that the observation is about")
201 			@OptionalParam(name="subject", targetTypes={  } )
202 			ReferenceAndListParam theSubject, 
203   
204 			@Description(shortDefinition="The value of the observation, if the value is a CodeableConcept")
205 			@OptionalParam(name="value-concept")
206 			TokenAndListParam theValue_concept,
207   
208 			@Description(shortDefinition="The value of the observation, if the value is a date or period of time")
209 			@OptionalParam(name="value-date")
210 			DateRangeParam theValue_date, 
211   
212 			@Description(shortDefinition="The value of the observation, if the value is a Quantity, or a SampledData (just search on the bounds of the values in sampled data)")
213 			@OptionalParam(name="value-quantity")
214 			QuantityAndListParam theValue_quantity, 
215   
216 			@Description(shortDefinition="The value of the observation, if the value is a string, and also searches in CodeableConcept.text")
217 			@OptionalParam(name="value-string")
218 			StringAndListParam theValue_string, 
219 
220 			@RawParam
221 			Map<String, List<String>> theAdditionalRawParams,
222 
223 			@IncludeParam(reverse=true)
224 			Set<Include> theRevIncludes,
225 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
226 			@OptionalParam(name="_lastUpdated")
227 			DateRangeParam theLastUpdated, 
228 
229 			@IncludeParam(allow= {
230 					"Observation:based-on" , 					"Observation:context" , 					"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:based-on" , 					"Observation:context" , 					"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:based-on" , 					"Observation:context" , 					"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:based-on" , 					"Observation:context" , 					"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:based-on" , 					"Observation:context" , 					"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:based-on" , 					"Observation:context" , 					"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:based-on" , 					"Observation:context" , 					"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:based-on" , 					"Observation:context" , 					"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:based-on" , 					"Observation:context" , 					"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" 					, "*"
231 			}) 
232 			Set<Include> theIncludes,
233 			
234 			@Sort 
235 			SortSpec theSort,
236 			
237 			@ca.uhn.fhir.rest.annotation.Count
238 			Integer theCount,
239 
240 			SummaryEnum theSummaryMode,
241 
242 			SearchTotalModeEnum theSearchTotalMode
243 
244 			) {
245 		startRequest(theServletRequest);
246 		try {
247 			SearchParameterMap paramMap = new SearchParameterMap();
248 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
249 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
250 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
251 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
252 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
253 			paramMap.add("_has", theHas);
254 			paramMap.add("_id", the_id);
255 			paramMap.add("_language", the_language);
256 			paramMap.add("based-on", theBased_on);
257 			paramMap.add("category", theCategory);
258 			paramMap.add("code", theCode);
259 			paramMap.add("code-value-concept", theCode_value_concept);
260 			paramMap.add("code-value-date", theCode_value_date);
261 			paramMap.add("code-value-quantity", theCode_value_quantity);
262 			paramMap.add("code-value-string", theCode_value_string);
263 			paramMap.add("combo-code", theCombo_code);
264 			paramMap.add("combo-code-value-concept", theCombo_code_value_concept);
265 			paramMap.add("combo-code-value-quantity", theCombo_code_value_quantity);
266 			paramMap.add("combo-data-absent-reason", theCombo_data_absent_reason);
267 			paramMap.add("combo-value-concept", theCombo_value_concept);
268 			paramMap.add("combo-value-quantity", theCombo_value_quantity);
269 			paramMap.add("component-code", theComponent_code);
270 			paramMap.add("component-code-value-concept", theComponent_code_value_concept);
271 			paramMap.add("component-code-value-quantity", theComponent_code_value_quantity);
272 			paramMap.add("component-data-absent-reason", theComponent_data_absent_reason);
273 			paramMap.add("component-value-concept", theComponent_value_concept);
274 			paramMap.add("component-value-quantity", theComponent_value_quantity);
275 			paramMap.add("context", theContext);
276 			paramMap.add("data-absent-reason", theData_absent_reason);
277 			paramMap.add("date", theDate);
278 			paramMap.add("device", theDevice);
279 			paramMap.add("encounter", theEncounter);
280 			paramMap.add("identifier", theIdentifier);
281 			paramMap.add("method", theMethod);
282 			paramMap.add("patient", thePatient);
283 			paramMap.add("performer", thePerformer);
284 			paramMap.add("related", theRelated);
285 			paramMap.add("related-target", theRelated_target);
286 			paramMap.add("related-type", theRelated_type);
287 			paramMap.add("specimen", theSpecimen);
288 			paramMap.add("status", theStatus);
289 			paramMap.add("subject", theSubject);
290 			paramMap.add("value-concept", theValue_concept);
291 			paramMap.add("value-date", theValue_date);
292 			paramMap.add("value-quantity", theValue_quantity);
293 			paramMap.add("value-string", theValue_string);
294 			paramMap.setRevIncludes(theRevIncludes);
295 			paramMap.setLastUpdated(theLastUpdated);
296 			paramMap.setIncludes(theIncludes);
297 			paramMap.setSort(theSort);
298 			paramMap.setCount(theCount);
299 			paramMap.setSummaryMode(theSummaryMode);
300 			paramMap.setSearchTotalMode(theSearchTotalMode);
301 
302 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
303 
304 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
305 			return retVal;
306 		} finally {
307 			endRequest(theServletRequest);
308 		}
309 	}
310 
311 }