
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 EncounterResourceProvider extends 022 BaseJpaResourceProviderEncounterDstu2 023 { 024 025 @Override 026 public Class<Encounter> getResourceType() { 027 return Encounter.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="") 077 @OptionalParam(name="appointment", targetTypes={ } ) 078 ReferenceAndListParam theAppointment, 079 080 081 @Description(shortDefinition="") 082 @OptionalParam(name="condition", targetTypes={ } ) 083 ReferenceAndListParam theCondition, 084 085 086 @Description(shortDefinition="A date within the period the Encounter lasted") 087 @OptionalParam(name="date") 088 DateRangeParam theDate, 089 090 091 @Description(shortDefinition="") 092 @OptionalParam(name="episodeofcare", targetTypes={ } ) 093 ReferenceAndListParam theEpisodeofcare, 094 095 096 @Description(shortDefinition="") 097 @OptionalParam(name="identifier") 098 TokenAndListParam theIdentifier, 099 100 101 @Description(shortDefinition="") 102 @OptionalParam(name="incomingreferral", targetTypes={ } ) 103 ReferenceAndListParam theIncomingreferral, 104 105 106 @Description(shortDefinition="") 107 @OptionalParam(name="indication", targetTypes={ } ) 108 ReferenceAndListParam theIndication, 109 110 111 @Description(shortDefinition="Length of encounter in days") 112 @OptionalParam(name="length") 113 NumberAndListParam theLength, 114 115 116 @Description(shortDefinition="") 117 @OptionalParam(name="location", targetTypes={ } ) 118 ReferenceAndListParam theLocation, 119 120 121 @Description(shortDefinition="") 122 @OptionalParam(name="location-period") 123 DateRangeParam theLocation_period, 124 125 126 @Description(shortDefinition="") 127 @OptionalParam(name="part-of", targetTypes={ } ) 128 ReferenceAndListParam thePart_of, 129 130 131 @Description(shortDefinition="") 132 @OptionalParam(name="participant", targetTypes={ } ) 133 ReferenceAndListParam theParticipant, 134 135 136 @Description(shortDefinition="") 137 @OptionalParam(name="participant-type") 138 TokenAndListParam theParticipant_type, 139 140 141 @Description(shortDefinition="") 142 @OptionalParam(name="patient", targetTypes={ } ) 143 ReferenceAndListParam thePatient, 144 145 146 @Description(shortDefinition="") 147 @OptionalParam(name="practitioner", targetTypes={ } ) 148 ReferenceAndListParam thePractitioner, 149 150 151 @Description(shortDefinition="") 152 @OptionalParam(name="procedure", targetTypes={ } ) 153 ReferenceAndListParam theProcedure, 154 155 156 @Description(shortDefinition="") 157 @OptionalParam(name="reason") 158 TokenAndListParam theReason, 159 160 161 @Description(shortDefinition="") 162 @OptionalParam(name="special-arrangement") 163 TokenAndListParam theSpecial_arrangement, 164 165 166 @Description(shortDefinition="") 167 @OptionalParam(name="status") 168 TokenAndListParam theStatus, 169 170 171 @Description(shortDefinition="") 172 @OptionalParam(name="type") 173 TokenAndListParam theType, 174 175 @RawParam 176 Map<String, List<String>> theAdditionalRawParams, 177 178 @Description(shortDefinition="Only return resources which were last updated as specified by the given range") 179 @OptionalParam(name="_lastUpdated") 180 DateRangeParam theLastUpdated, 181 182 @IncludeParam 183 Set<Include> theIncludes, 184 185 @IncludeParam(reverse=true) 186 Set<Include> theRevIncludes, 187 188 @Sort 189 SortSpec theSort, 190 191 @ca.uhn.fhir.rest.annotation.Count 192 Integer theCount, 193 194 @ca.uhn.fhir.rest.annotation.Offset 195 Integer theOffset, 196 197 SummaryEnum theSummaryMode, 198 199 SearchTotalModeEnum theSearchTotalMode, 200 201 SearchContainedModeEnum theSearchContainedMode 202 203 ) { 204 startRequest(theServletRequest); 205 try { 206 SearchParameterMap paramMap = new SearchParameterMap(); 207 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter); 208 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent); 209 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText); 210 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag); 211 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity); 212 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile); 213 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource); 214 paramMap.add("_has", theHas); 215 paramMap.add("_id", the_id); 216 paramMap.add("appointment", theAppointment); 217 paramMap.add("condition", theCondition); 218 paramMap.add("date", theDate); 219 paramMap.add("episodeofcare", theEpisodeofcare); 220 paramMap.add("identifier", theIdentifier); 221 paramMap.add("incomingreferral", theIncomingreferral); 222 paramMap.add("indication", theIndication); 223 paramMap.add("length", theLength); 224 paramMap.add("location", theLocation); 225 paramMap.add("location-period", theLocation_period); 226 paramMap.add("part-of", thePart_of); 227 paramMap.add("participant", theParticipant); 228 paramMap.add("participant-type", theParticipant_type); 229 paramMap.add("patient", thePatient); 230 paramMap.add("practitioner", thePractitioner); 231 paramMap.add("procedure", theProcedure); 232 paramMap.add("reason", theReason); 233 paramMap.add("special-arrangement", theSpecial_arrangement); 234 paramMap.add("status", theStatus); 235 paramMap.add("type", theType); 236 paramMap.setRevIncludes(theRevIncludes); 237 paramMap.setLastUpdated(theLastUpdated); 238 paramMap.setIncludes(theIncludes); 239 paramMap.setSort(theSort); 240 paramMap.setCount(theCount); 241 paramMap.setOffset(theOffset); 242 paramMap.setSummaryMode(theSummaryMode); 243 paramMap.setSearchTotalMode(theSearchTotalMode); 244 paramMap.setSearchContainedMode(theSearchContainedMode); 245 246 getDao().translateRawParameters(theAdditionalRawParams, paramMap); 247 248 ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse); 249 return retVal; 250 } finally { 251 endRequest(theServletRequest); 252 } 253 } 254 255}