
001 002package ca.uhn.fhir.jpa.rp.dstu3; 003 004import java.util.*; 005 006import org.apache.commons.lang3.StringUtils; 007 008import ca.uhn.fhir.jpa.provider.dstu3.*; 009import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; 010import ca.uhn.fhir.model.api.Include; 011import ca.uhn.fhir.model.api.annotation.*; 012import org.hl7.fhir.dstu3.model.*; 013import ca.uhn.fhir.rest.annotation.*; 014import ca.uhn.fhir.rest.param.*; 015import ca.uhn.fhir.rest.api.SortSpec; 016import ca.uhn.fhir.rest.api.SummaryEnum; 017import ca.uhn.fhir.rest.api.SearchTotalModeEnum; 018import ca.uhn.fhir.rest.api.SearchContainedModeEnum; 019 020public class ObservationResourceProvider extends 021 BaseJpaResourceProviderObservationDstu3 022 { 023 024 @Override 025 public Class<Observation> getResourceType() { 026 return Observation.class; 027 } 028 029 @Search(allowUnknownParams=true) 030 public ca.uhn.fhir.rest.api.server.IBundleProvider search( 031 javax.servlet.http.HttpServletRequest theServletRequest, 032 javax.servlet.http.HttpServletResponse theServletResponse, 033 034 ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, 035 036 @Description(shortDefinition="Search the contents of the resource's data using a filter") 037 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_FILTER) 038 StringAndListParam theFtFilter, 039 040 @Description(shortDefinition="Search the contents of the resource's data using a fulltext search") 041 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT) 042 StringAndListParam theFtContent, 043 044 @Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search") 045 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT) 046 StringAndListParam theFtText, 047 048 @Description(shortDefinition="Search for resources which have the given tag") 049 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG) 050 TokenAndListParam theSearchForTag, 051 052 @Description(shortDefinition="Search for resources which have the given security labels") 053 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY) 054 TokenAndListParam theSearchForSecurity, 055 056 @Description(shortDefinition="Search for resources which have the given profile") 057 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE) 058 UriAndListParam theSearchForProfile, 059 060 @Description(shortDefinition="Search for resources which have the given source value (Resource.meta.source)") 061 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE) 062 UriAndListParam theSearchForSource, 063 064 @Description(shortDefinition="Return resources linked to by the given target") 065 @OptionalParam(name="_has") 066 HasAndListParam theHas, 067 068 069 070 @Description(shortDefinition="The ID of the resource") 071 @OptionalParam(name="_id") 072 TokenAndListParam the_id, 073 074 075 @Description(shortDefinition="Reference to the test or procedure request.") 076 @OptionalParam(name="based-on", targetTypes={ } ) 077 ReferenceAndListParam theBased_on, 078 079 080 @Description(shortDefinition="The classification of the type of observation") 081 @OptionalParam(name="category") 082 TokenAndListParam theCategory, 083 084 085 @Description(shortDefinition="The code of the observation type") 086 @OptionalParam(name="code") 087 TokenAndListParam theCode, 088 089 090 @Description(shortDefinition="Code and coded value parameter pair") 091 @OptionalParam(name="code-value-concept", compositeTypes= { TokenParam.class, TokenParam.class }) 092 CompositeAndListParam<TokenParam, TokenParam> theCode_value_concept, 093 094 095 @Description(shortDefinition="Code and date/time value parameter pair") 096 @OptionalParam(name="code-value-date", compositeTypes= { TokenParam.class, DateParam.class }) 097 CompositeAndListParam<TokenParam, DateParam> theCode_value_date, 098 099 100 @Description(shortDefinition="Code and quantity value parameter pair") 101 @OptionalParam(name="code-value-quantity", compositeTypes= { TokenParam.class, QuantityParam.class }) 102 CompositeAndListParam<TokenParam, QuantityParam> theCode_value_quantity, 103 104 105 @Description(shortDefinition="Code and string value parameter pair") 106 @OptionalParam(name="code-value-string", compositeTypes= { TokenParam.class, StringParam.class }) 107 CompositeAndListParam<TokenParam, StringParam> theCode_value_string, 108 109 110 @Description(shortDefinition="The code of the observation type or component type") 111 @OptionalParam(name="combo-code") 112 TokenAndListParam theCombo_code, 113 114 115 @Description(shortDefinition="Code and coded value parameter pair, including in components") 116 @OptionalParam(name="combo-code-value-concept", compositeTypes= { TokenParam.class, TokenParam.class }) 117 CompositeAndListParam<TokenParam, TokenParam> theCombo_code_value_concept, 118 119 120 @Description(shortDefinition="Code and quantity value parameter pair, including in components") 121 @OptionalParam(name="combo-code-value-quantity", compositeTypes= { TokenParam.class, QuantityParam.class }) 122 CompositeAndListParam<TokenParam, QuantityParam> theCombo_code_value_quantity, 123 124 125 @Description(shortDefinition="The reason why the expected value in the element Observation.value[x] or Observation.component.value[x] is missing.") 126 @OptionalParam(name="combo-data-absent-reason") 127 TokenAndListParam theCombo_data_absent_reason, 128 129 130 @Description(shortDefinition="The value or component value of the observation, if the value is a CodeableConcept") 131 @OptionalParam(name="combo-value-concept") 132 TokenAndListParam theCombo_value_concept, 133 134 135 @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)") 136 @OptionalParam(name="combo-value-quantity") 137 QuantityAndListParam theCombo_value_quantity, 138 139 140 @Description(shortDefinition="The component code of the observation type") 141 @OptionalParam(name="component-code") 142 TokenAndListParam theComponent_code, 143 144 145 @Description(shortDefinition="Component code and component coded value parameter pair") 146 @OptionalParam(name="component-code-value-concept", compositeTypes= { TokenParam.class, TokenParam.class }) 147 CompositeAndListParam<TokenParam, TokenParam> theComponent_code_value_concept, 148 149 150 @Description(shortDefinition="Component code and component quantity value parameter pair") 151 @OptionalParam(name="component-code-value-quantity", compositeTypes= { TokenParam.class, QuantityParam.class }) 152 CompositeAndListParam<TokenParam, QuantityParam> theComponent_code_value_quantity, 153 154 155 @Description(shortDefinition="The reason why the expected value in the element Observation.component.value[x] is missing.") 156 @OptionalParam(name="component-data-absent-reason") 157 TokenAndListParam theComponent_data_absent_reason, 158 159 160 @Description(shortDefinition="The value of the component observation, if the value is a CodeableConcept") 161 @OptionalParam(name="component-value-concept") 162 TokenAndListParam theComponent_value_concept, 163 164 165 @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)") 166 @OptionalParam(name="component-value-quantity") 167 QuantityAndListParam theComponent_value_quantity, 168 169 170 @Description(shortDefinition="Healthcare event (Episode-of-care or Encounter) related to the observation") 171 @OptionalParam(name="context", targetTypes={ } ) 172 ReferenceAndListParam theContext, 173 174 175 @Description(shortDefinition="The reason why the expected value in the element Observation.value[x] is missing.") 176 @OptionalParam(name="data-absent-reason") 177 TokenAndListParam theData_absent_reason, 178 179 180 @Description(shortDefinition="Obtained date/time. If the obtained element is a period, a date that falls in the period") 181 @OptionalParam(name="date") 182 DateRangeParam theDate, 183 184 185 @Description(shortDefinition="The Device that generated the observation data.") 186 @OptionalParam(name="device", targetTypes={ } ) 187 ReferenceAndListParam theDevice, 188 189 190 @Description(shortDefinition="Encounter related to the observation") 191 @OptionalParam(name="encounter", targetTypes={ } ) 192 ReferenceAndListParam theEncounter, 193 194 195 @Description(shortDefinition="The unique id for a particular observation") 196 @OptionalParam(name="identifier") 197 TokenAndListParam theIdentifier, 198 199 200 @Description(shortDefinition="The method used for the observation") 201 @OptionalParam(name="method") 202 TokenAndListParam theMethod, 203 204 205 @Description(shortDefinition="The subject that the observation is about (if patient)") 206 @OptionalParam(name="patient", targetTypes={ } ) 207 ReferenceAndListParam thePatient, 208 209 210 @Description(shortDefinition="Who performed the observation") 211 @OptionalParam(name="performer", targetTypes={ } ) 212 ReferenceAndListParam thePerformer, 213 214 215 @Description(shortDefinition="Related Observations - search on related-type and related-target together") 216 @OptionalParam(name="related", compositeTypes= { ReferenceParam.class, TokenParam.class }) 217 CompositeAndListParam<ReferenceParam, TokenParam> theRelated, 218 219 220 @Description(shortDefinition="Resource that is related to this one") 221 @OptionalParam(name="related-target", targetTypes={ } ) 222 ReferenceAndListParam theRelated_target, 223 224 225 @Description(shortDefinition="has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by") 226 @OptionalParam(name="related-type") 227 TokenAndListParam theRelated_type, 228 229 230 @Description(shortDefinition="Specimen used for this observation") 231 @OptionalParam(name="specimen", targetTypes={ } ) 232 ReferenceAndListParam theSpecimen, 233 234 235 @Description(shortDefinition="The status of the observation") 236 @OptionalParam(name="status") 237 TokenAndListParam theStatus, 238 239 240 @Description(shortDefinition="The subject that the observation is about") 241 @OptionalParam(name="subject", targetTypes={ } ) 242 ReferenceAndListParam theSubject, 243 244 245 @Description(shortDefinition="The value of the observation, if the value is a CodeableConcept") 246 @OptionalParam(name="value-concept") 247 TokenAndListParam theValue_concept, 248 249 250 @Description(shortDefinition="The value of the observation, if the value is a date or period of time") 251 @OptionalParam(name="value-date") 252 DateRangeParam theValue_date, 253 254 255 @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)") 256 @OptionalParam(name="value-quantity") 257 QuantityAndListParam theValue_quantity, 258 259 260 @Description(shortDefinition="The value of the observation, if the value is a string, and also searches in CodeableConcept.text") 261 @OptionalParam(name="value-string") 262 StringAndListParam theValue_string, 263 264 @RawParam 265 Map<String, List<String>> theAdditionalRawParams, 266 267 @Description(shortDefinition="Only return resources which were last updated as specified by the given range") 268 @OptionalParam(name="_lastUpdated") 269 DateRangeParam theLastUpdated, 270 271 @IncludeParam 272 Set<Include> theIncludes, 273 274 @IncludeParam(reverse=true) 275 Set<Include> theRevIncludes, 276 277 @Sort 278 SortSpec theSort, 279 280 @ca.uhn.fhir.rest.annotation.Count 281 Integer theCount, 282 283 @ca.uhn.fhir.rest.annotation.Offset 284 Integer theOffset, 285 286 SummaryEnum theSummaryMode, 287 288 SearchTotalModeEnum theSearchTotalMode, 289 290 SearchContainedModeEnum theSearchContainedMode 291 292 ) { 293 startRequest(theServletRequest); 294 try { 295 SearchParameterMap paramMap = new SearchParameterMap(); 296 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter); 297 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent); 298 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText); 299 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag); 300 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity); 301 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile); 302 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource); 303 paramMap.add("_has", theHas); 304 paramMap.add("_id", the_id); 305 paramMap.add("based-on", theBased_on); 306 paramMap.add("category", theCategory); 307 paramMap.add("code", theCode); 308 paramMap.add("code-value-concept", theCode_value_concept); 309 paramMap.add("code-value-date", theCode_value_date); 310 paramMap.add("code-value-quantity", theCode_value_quantity); 311 paramMap.add("code-value-string", theCode_value_string); 312 paramMap.add("combo-code", theCombo_code); 313 paramMap.add("combo-code-value-concept", theCombo_code_value_concept); 314 paramMap.add("combo-code-value-quantity", theCombo_code_value_quantity); 315 paramMap.add("combo-data-absent-reason", theCombo_data_absent_reason); 316 paramMap.add("combo-value-concept", theCombo_value_concept); 317 paramMap.add("combo-value-quantity", theCombo_value_quantity); 318 paramMap.add("component-code", theComponent_code); 319 paramMap.add("component-code-value-concept", theComponent_code_value_concept); 320 paramMap.add("component-code-value-quantity", theComponent_code_value_quantity); 321 paramMap.add("component-data-absent-reason", theComponent_data_absent_reason); 322 paramMap.add("component-value-concept", theComponent_value_concept); 323 paramMap.add("component-value-quantity", theComponent_value_quantity); 324 paramMap.add("context", theContext); 325 paramMap.add("data-absent-reason", theData_absent_reason); 326 paramMap.add("date", theDate); 327 paramMap.add("device", theDevice); 328 paramMap.add("encounter", theEncounter); 329 paramMap.add("identifier", theIdentifier); 330 paramMap.add("method", theMethod); 331 paramMap.add("patient", thePatient); 332 paramMap.add("performer", thePerformer); 333 paramMap.add("related", theRelated); 334 paramMap.add("related-target", theRelated_target); 335 paramMap.add("related-type", theRelated_type); 336 paramMap.add("specimen", theSpecimen); 337 paramMap.add("status", theStatus); 338 paramMap.add("subject", theSubject); 339 paramMap.add("value-concept", theValue_concept); 340 paramMap.add("value-date", theValue_date); 341 paramMap.add("value-quantity", theValue_quantity); 342 paramMap.add("value-string", theValue_string); 343 paramMap.setRevIncludes(theRevIncludes); 344 paramMap.setLastUpdated(theLastUpdated); 345 paramMap.setIncludes(theIncludes); 346 paramMap.setSort(theSort); 347 paramMap.setCount(theCount); 348 paramMap.setOffset(theOffset); 349 paramMap.setSummaryMode(theSummaryMode); 350 paramMap.setSearchTotalMode(theSearchTotalMode); 351 paramMap.setSearchContainedMode(theSearchContainedMode); 352 353 getDao().translateRawParameters(theAdditionalRawParams, paramMap); 354 355 ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse); 356 return retVal; 357 } finally { 358 endRequest(theServletRequest); 359 } 360 } 361 362}