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