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