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.dao.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  
18  public class ObservationResourceProvider extends 
19  	JpaResourceProviderDstu2<Observation>
20  	{
21  
22  	@Override
23  	public Class<Observation> getResourceType() {
24  		return Observation.class;
25  	}
26  
27  	@Search(allowUnknownParams=true)
28  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
29  			javax.servlet.http.HttpServletRequest theServletRequest,
30  			javax.servlet.http.HttpServletResponse theServletResponse,
31  
32  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
33  			
34  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
35  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
36  			StringAndListParam theFtContent, 
37  
38  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
39  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
40  			StringAndListParam theFtText, 
41  
42  			@Description(shortDefinition="Search for resources which have the given tag")
43  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
44  			TokenAndListParam theSearchForTag, 
45  
46  			@Description(shortDefinition="Search for resources which have the given security labels")
47  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
48  			TokenAndListParam theSearchForSecurity, 
49    
50  			@Description(shortDefinition="Search for resources which have the given profile")
51  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
52  			UriAndListParam theSearchForProfile, 
53  
54  			@Description(shortDefinition="Return resources linked to by the given target")
55  			@OptionalParam(name="_has")
56  			HasAndListParam theHas, 
57  
58    
59  			@Description(shortDefinition="The ID of the resource")
60  			@OptionalParam(name="_id")
61  			StringAndListParam the_id, 
62    
63  			@Description(shortDefinition="The language of the resource")
64  			@OptionalParam(name="_language")
65  			StringAndListParam the_language, 
66    
67  			@Description(shortDefinition="The classification of the type of observation")
68  			@OptionalParam(name="category")
69  			TokenAndListParam theCategory, 
70    
71  			@Description(shortDefinition="The code of the observation type")
72  			@OptionalParam(name="code")
73  			TokenAndListParam theCode, 
74    
75  			@Description(shortDefinition="Both code and one of the value parameters")
76  			@OptionalParam(name="code-value-concept", compositeTypes= { TokenParam.class, TokenParam.class })
77  			CompositeAndListParam<TokenParam, TokenParam> theCode_value_concept,
78    
79  			@Description(shortDefinition="Both code and one of the value parameters")
80  			@OptionalParam(name="code-value-date", compositeTypes= { TokenParam.class, DateParam.class })
81  			CompositeAndListParam<TokenParam, DateParam> theCode_value_date,
82    
83  			@Description(shortDefinition="Both code and one of the value parameters")
84  			@OptionalParam(name="code-value-quantity", compositeTypes= { TokenParam.class, QuantityParam.class })
85  			CompositeAndListParam<TokenParam, QuantityParam> theCode_value_quantity,
86    
87  			@Description(shortDefinition="Both code and one of the value parameters")
88  			@OptionalParam(name="code-value-string", compositeTypes= { TokenParam.class, StringParam.class })
89  			CompositeAndListParam<TokenParam, StringParam> theCode_value_string,
90    
91  			@Description(shortDefinition="The component code of the observation type")
92  			@OptionalParam(name="component-code")
93  			TokenAndListParam theComponent_code, 
94    
95  			@Description(shortDefinition="Both component code and one of the component value parameters")
96  			@OptionalParam(name="component-code-component-value-concept", compositeTypes= { TokenParam.class, TokenParam.class })
97  			CompositeAndListParam<TokenParam, TokenParam> theComponent_code_component_value_concept,
98    
99  			@Description(shortDefinition="Both component code and one of the component value parameters")
100 			@OptionalParam(name="component-code-component-value-quantity", compositeTypes= { TokenParam.class, QuantityParam.class })
101 			CompositeAndListParam<TokenParam, QuantityParam> theComponent_code_component_value_quantity,
102   
103 			@Description(shortDefinition="Both component code and one of the component value parameters")
104 			@OptionalParam(name="component-code-component-value-string", compositeTypes= { TokenParam.class, StringParam.class })
105 			CompositeAndListParam<TokenParam, StringParam> theComponent_code_component_value_string,
106   
107 			@Description(shortDefinition="The reason why the expected value in the element Observation.component.value[x] is missing.")
108 			@OptionalParam(name="component-data-absent-reason")
109 			TokenAndListParam theComponent_data_absent_reason, 
110   
111 			@Description(shortDefinition="The value of the component observation, if the value is a CodeableConcept")
112 			@OptionalParam(name="component-value-concept")
113 			TokenAndListParam theComponent_value_concept, 
114   
115 			@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)")
116 			@OptionalParam(name="component-value-quantity")
117 			QuantityAndListParam theComponent_value_quantity, 
118   
119 			@Description(shortDefinition="The value of the component observation, if the value is a string, and also searches in CodeableConcept.text")
120 			@OptionalParam(name="component-value-string")
121 			StringAndListParam theComponent_value_string, 
122   
123 			@Description(shortDefinition="The reason why the expected value in the element Observation.value[x] is missing.")
124 			@OptionalParam(name="data-absent-reason")
125 			TokenAndListParam theData_absent_reason, 
126   
127 			@Description(shortDefinition="Obtained date/time. If the obtained element is a period, a date that falls in the period")
128 			@OptionalParam(name="date")
129 			DateRangeParam theDate, 
130   
131 			@Description(shortDefinition="The Device that generated the observation data.")
132 			@OptionalParam(name="device", targetTypes={  } )
133 			ReferenceAndListParam theDevice, 
134   
135 			@Description(shortDefinition="Healthcare event related to the observation")
136 			@OptionalParam(name="encounter", targetTypes={  } )
137 			ReferenceAndListParam theEncounter, 
138   
139 			@Description(shortDefinition="The unique id for a particular observation")
140 			@OptionalParam(name="identifier")
141 			TokenAndListParam theIdentifier, 
142   
143 			@Description(shortDefinition="The subject that the observation is about (if patient)")
144 			@OptionalParam(name="patient", targetTypes={  } )
145 			ReferenceAndListParam thePatient, 
146   
147 			@Description(shortDefinition="Who performed the observation")
148 			@OptionalParam(name="performer", targetTypes={  } )
149 			ReferenceAndListParam thePerformer, 
150   
151 			@Description(shortDefinition="")
152 			@OptionalParam(name="related-target", targetTypes={  } )
153 			ReferenceAndListParam theRelated_target, 
154   
155 			@Description(shortDefinition="Related Observations - search on related-type and related-target together")
156 			@OptionalParam(name="related-target-related-type", compositeTypes= { ReferenceParam.class, TokenParam.class })
157 			CompositeAndListParam<ReferenceParam, TokenParam> theRelated_target_related_type,
158   
159 			@Description(shortDefinition="")
160 			@OptionalParam(name="related-type")
161 			TokenAndListParam theRelated_type, 
162   
163 			@Description(shortDefinition="")
164 			@OptionalParam(name="specimen", targetTypes={  } )
165 			ReferenceAndListParam theSpecimen, 
166   
167 			@Description(shortDefinition="The status of the observation")
168 			@OptionalParam(name="status")
169 			TokenAndListParam theStatus, 
170   
171 			@Description(shortDefinition="The subject that the observation is about")
172 			@OptionalParam(name="subject", targetTypes={  } )
173 			ReferenceAndListParam theSubject, 
174   
175 			@Description(shortDefinition="The value of the observation, if the value is a CodeableConcept")
176 			@OptionalParam(name="value-concept")
177 			TokenAndListParam theValue_concept, 
178   
179 			@Description(shortDefinition="The value of the observation, if the value is a date or period of time")
180 			@OptionalParam(name="value-date")
181 			DateRangeParam theValue_date, 
182   
183 			@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)")
184 			@OptionalParam(name="value-quantity")
185 			QuantityAndListParam theValue_quantity, 
186   
187 			@Description(shortDefinition="The value of the observation, if the value is a string, and also searches in CodeableConcept.text")
188 			@OptionalParam(name="value-string")
189 			StringAndListParam theValue_string, 
190 
191 			@RawParam
192 			Map<String, List<String>> theAdditionalRawParams,
193 
194 			@IncludeParam(reverse=true)
195 			Set<Include> theRevIncludes,
196 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
197 			@OptionalParam(name="_lastUpdated")
198 			DateRangeParam theLastUpdated, 
199 
200 			@IncludeParam(allow= {
201 					"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" , 						"Observation:device" , 					"Observation:encounter" , 					"Observation:patient" , 					"Observation:performer" , 					"Observation:related-target" , 					"Observation:specimen" , 					"Observation:subject" 					, "*"
202 			}) 
203 			Set<Include> theIncludes,
204 			
205 			@Sort 
206 			SortSpec theSort,
207 			
208 			@ca.uhn.fhir.rest.annotation.Count
209 			Integer theCount
210 	) {
211 		startRequest(theServletRequest);
212 		try {
213 			SearchParameterMap paramMap = new SearchParameterMap();
214 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
215 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
216 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
217 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
218 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
219 			paramMap.add("_has", theHas);
220 			paramMap.add("_id", the_id);
221 			paramMap.add("_language", the_language);
222 			paramMap.add("category", theCategory);
223 			paramMap.add("code", theCode);
224 			paramMap.add("code-value-concept", theCode_value_concept);
225 			paramMap.add("code-value-date", theCode_value_date);
226 			paramMap.add("code-value-quantity", theCode_value_quantity);
227 			paramMap.add("code-value-string", theCode_value_string);
228 			paramMap.add("component-code", theComponent_code);
229 			paramMap.add("component-code-component-value-concept", theComponent_code_component_value_concept);
230 			paramMap.add("component-code-component-value-quantity", theComponent_code_component_value_quantity);
231 			paramMap.add("component-code-component-value-string", theComponent_code_component_value_string);
232 			paramMap.add("component-data-absent-reason", theComponent_data_absent_reason);
233 			paramMap.add("component-value-concept", theComponent_value_concept);
234 			paramMap.add("component-value-quantity", theComponent_value_quantity);
235 			paramMap.add("component-value-string", theComponent_value_string);
236 			paramMap.add("data-absent-reason", theData_absent_reason);
237 			paramMap.add("date", theDate);
238 			paramMap.add("device", theDevice);
239 			paramMap.add("encounter", theEncounter);
240 			paramMap.add("identifier", theIdentifier);
241 			paramMap.add("patient", thePatient);
242 			paramMap.add("performer", thePerformer);
243 			paramMap.add("related-target", theRelated_target);
244 			paramMap.add("related-target-related-type", theRelated_target_related_type);
245 			paramMap.add("related-type", theRelated_type);
246 			paramMap.add("specimen", theSpecimen);
247 			paramMap.add("status", theStatus);
248 			paramMap.add("subject", theSubject);
249 			paramMap.add("value-concept", theValue_concept);
250 			paramMap.add("value-date", theValue_date);
251 			paramMap.add("value-quantity", theValue_quantity);
252 			paramMap.add("value-string", theValue_string);
253 			paramMap.setRevIncludes(theRevIncludes);
254 			paramMap.setLastUpdated(theLastUpdated);
255 			paramMap.setIncludes(theIncludes);
256 			paramMap.setSort(theSort);
257 			paramMap.setCount(theCount);
258 
259 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
260 
261 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
262 			return retVal;
263 		} finally {
264 			endRequest(theServletRequest);
265 		}
266 	}
267 
268 }