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.searchparam.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  import ca.uhn.fhir.rest.api.SummaryEnum;
18  import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
19  
20  public class EncounterResourceProvider extends 
21  	BaseJpaResourceProviderEncounterDstu2
22  	{
23  
24  	@Override
25  	public Class<Encounter> getResourceType() {
26  		return Encounter.class;
27  	}
28  
29  	@Search(allowUnknownParams=true)
30  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
31  			javax.servlet.http.HttpServletRequest theServletRequest,
32  			javax.servlet.http.HttpServletResponse theServletResponse,
33  
34  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
35  			
36  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
37  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
38  			StringAndListParam theFtContent, 
39  
40  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
41  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
42  			StringAndListParam theFtText, 
43  
44  			@Description(shortDefinition="Search for resources which have the given tag")
45  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
46  			TokenAndListParam theSearchForTag, 
47  
48  			@Description(shortDefinition="Search for resources which have the given security labels")
49  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
50  			TokenAndListParam theSearchForSecurity, 
51    
52  			@Description(shortDefinition="Search for resources which have the given profile")
53  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
54  			UriAndListParam theSearchForProfile, 
55  
56  			@Description(shortDefinition="Return resources linked to by the given target")
57  			@OptionalParam(name="_has")
58  			HasAndListParam theHas, 
59  
60    
61  			@Description(shortDefinition="The ID of the resource")
62  			@OptionalParam(name="_id")
63  			StringAndListParam the_id, 
64    
65  			@Description(shortDefinition="The language of the resource")
66  			@OptionalParam(name="_language")
67  			StringAndListParam the_language, 
68    
69  			@Description(shortDefinition="")
70  			@OptionalParam(name="appointment", targetTypes={  } )
71  			ReferenceAndListParam theAppointment, 
72    
73  			@Description(shortDefinition="")
74  			@OptionalParam(name="condition", targetTypes={  } )
75  			ReferenceAndListParam theCondition, 
76    
77  			@Description(shortDefinition="A date within the period the Encounter lasted")
78  			@OptionalParam(name="date")
79  			DateRangeParam theDate, 
80    
81  			@Description(shortDefinition="")
82  			@OptionalParam(name="episodeofcare", targetTypes={  } )
83  			ReferenceAndListParam theEpisodeofcare, 
84    
85  			@Description(shortDefinition="")
86  			@OptionalParam(name="identifier")
87  			TokenAndListParam theIdentifier,
88    
89  			@Description(shortDefinition="")
90  			@OptionalParam(name="incomingreferral", targetTypes={  } )
91  			ReferenceAndListParam theIncomingreferral, 
92    
93  			@Description(shortDefinition="")
94  			@OptionalParam(name="indication", targetTypes={  } )
95  			ReferenceAndListParam theIndication, 
96    
97  			@Description(shortDefinition="Length of encounter in days")
98  			@OptionalParam(name="length")
99  			NumberAndListParam theLength, 
100   
101 			@Description(shortDefinition="")
102 			@OptionalParam(name="location", targetTypes={  } )
103 			ReferenceAndListParam theLocation, 
104   
105 			@Description(shortDefinition="")
106 			@OptionalParam(name="location-period")
107 			DateRangeParam theLocation_period, 
108   
109 			@Description(shortDefinition="")
110 			@OptionalParam(name="part-of", targetTypes={  } )
111 			ReferenceAndListParam thePart_of, 
112   
113 			@Description(shortDefinition="")
114 			@OptionalParam(name="participant", targetTypes={  } )
115 			ReferenceAndListParam theParticipant, 
116   
117 			@Description(shortDefinition="")
118 			@OptionalParam(name="participant-type")
119 			TokenAndListParam theParticipant_type,
120   
121 			@Description(shortDefinition="")
122 			@OptionalParam(name="patient", targetTypes={  } )
123 			ReferenceAndListParam thePatient, 
124   
125 			@Description(shortDefinition="")
126 			@OptionalParam(name="practitioner", targetTypes={  } )
127 			ReferenceAndListParam thePractitioner, 
128   
129 			@Description(shortDefinition="")
130 			@OptionalParam(name="procedure", targetTypes={  } )
131 			ReferenceAndListParam theProcedure, 
132   
133 			@Description(shortDefinition="")
134 			@OptionalParam(name="reason")
135 			TokenAndListParam theReason,
136   
137 			@Description(shortDefinition="")
138 			@OptionalParam(name="special-arrangement")
139 			TokenAndListParam theSpecial_arrangement,
140   
141 			@Description(shortDefinition="")
142 			@OptionalParam(name="status")
143 			TokenAndListParam theStatus,
144   
145 			@Description(shortDefinition="")
146 			@OptionalParam(name="type")
147 			TokenAndListParam theType,
148 
149 			@RawParam
150 			Map<String, List<String>> theAdditionalRawParams,
151 
152 			@IncludeParam(reverse=true)
153 			Set<Include> theRevIncludes,
154 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
155 			@OptionalParam(name="_lastUpdated")
156 			DateRangeParam theLastUpdated, 
157 
158 			@IncludeParam(allow= {
159 					"Encounter:appointment" , 					"Encounter:condition" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:indication" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:procedure" , 						"Encounter:appointment" , 					"Encounter:condition" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:indication" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:procedure" , 						"Encounter:appointment" , 					"Encounter:condition" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:indication" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:procedure" , 						"Encounter:appointment" , 					"Encounter:condition" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:indication" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:procedure" , 						"Encounter:appointment" , 					"Encounter:condition" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:indication" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:procedure" , 						"Encounter:appointment" , 					"Encounter:condition" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:indication" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:procedure" , 						"Encounter:appointment" , 					"Encounter:condition" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:indication" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:procedure" , 						"Encounter:appointment" , 					"Encounter:condition" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:indication" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:procedure" , 						"Encounter:appointment" , 					"Encounter:condition" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:indication" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:procedure" , 						"Encounter:appointment" , 					"Encounter:condition" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:indication" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:procedure" , 						"Encounter:appointment" , 					"Encounter:condition" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:indication" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:procedure" 					, "*"
160 			}) 
161 			Set<Include> theIncludes,
162 			
163 			@Sort 
164 			SortSpec theSort,
165 			
166 			@ca.uhn.fhir.rest.annotation.Count
167 			Integer theCount,
168 
169 			SummaryEnum theSummaryMode,
170 
171 			SearchTotalModeEnum theSearchTotalMode
172 
173 			) {
174 		startRequest(theServletRequest);
175 		try {
176 			SearchParameterMap paramMap = new SearchParameterMap();
177 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
178 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
179 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
180 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
181 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
182 			paramMap.add("_has", theHas);
183 			paramMap.add("_id", the_id);
184 			paramMap.add("_language", the_language);
185 			paramMap.add("appointment", theAppointment);
186 			paramMap.add("condition", theCondition);
187 			paramMap.add("date", theDate);
188 			paramMap.add("episodeofcare", theEpisodeofcare);
189 			paramMap.add("identifier", theIdentifier);
190 			paramMap.add("incomingreferral", theIncomingreferral);
191 			paramMap.add("indication", theIndication);
192 			paramMap.add("length", theLength);
193 			paramMap.add("location", theLocation);
194 			paramMap.add("location-period", theLocation_period);
195 			paramMap.add("part-of", thePart_of);
196 			paramMap.add("participant", theParticipant);
197 			paramMap.add("participant-type", theParticipant_type);
198 			paramMap.add("patient", thePatient);
199 			paramMap.add("practitioner", thePractitioner);
200 			paramMap.add("procedure", theProcedure);
201 			paramMap.add("reason", theReason);
202 			paramMap.add("special-arrangement", theSpecial_arrangement);
203 			paramMap.add("status", theStatus);
204 			paramMap.add("type", theType);
205 			paramMap.setRevIncludes(theRevIncludes);
206 			paramMap.setLastUpdated(theLastUpdated);
207 			paramMap.setIncludes(theIncludes);
208 			paramMap.setSort(theSort);
209 			paramMap.setCount(theCount);
210 			paramMap.setSummaryMode(theSummaryMode);
211 			paramMap.setSearchTotalMode(theSearchTotalMode);
212 
213 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
214 
215 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
216 			return retVal;
217 		} finally {
218 			endRequest(theServletRequest);
219 		}
220 	}
221 
222 }