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 EncounterResourceProvider extends 
19  	BaseJpaResourceProviderEncounterDstu2
20  	{
21  
22  	@Override
23  	public Class<Encounter> getResourceType() {
24  		return Encounter.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="")
68  			@OptionalParam(name="appointment", targetTypes={  } )
69  			ReferenceAndListParam theAppointment, 
70    
71  			@Description(shortDefinition="")
72  			@OptionalParam(name="condition", targetTypes={  } )
73  			ReferenceAndListParam theCondition, 
74    
75  			@Description(shortDefinition="A date within the period the Encounter lasted")
76  			@OptionalParam(name="date")
77  			DateRangeParam theDate, 
78    
79  			@Description(shortDefinition="")
80  			@OptionalParam(name="episodeofcare", targetTypes={  } )
81  			ReferenceAndListParam theEpisodeofcare, 
82    
83  			@Description(shortDefinition="")
84  			@OptionalParam(name="identifier")
85  			TokenAndListParam theIdentifier, 
86    
87  			@Description(shortDefinition="")
88  			@OptionalParam(name="incomingreferral", targetTypes={  } )
89  			ReferenceAndListParam theIncomingreferral, 
90    
91  			@Description(shortDefinition="")
92  			@OptionalParam(name="indication", targetTypes={  } )
93  			ReferenceAndListParam theIndication, 
94    
95  			@Description(shortDefinition="Length of encounter in days")
96  			@OptionalParam(name="length")
97  			NumberAndListParam theLength, 
98    
99  			@Description(shortDefinition="")
100 			@OptionalParam(name="location", targetTypes={  } )
101 			ReferenceAndListParam theLocation, 
102   
103 			@Description(shortDefinition="")
104 			@OptionalParam(name="location-period")
105 			DateRangeParam theLocation_period, 
106   
107 			@Description(shortDefinition="")
108 			@OptionalParam(name="part-of", targetTypes={  } )
109 			ReferenceAndListParam thePart_of, 
110   
111 			@Description(shortDefinition="")
112 			@OptionalParam(name="participant", targetTypes={  } )
113 			ReferenceAndListParam theParticipant, 
114   
115 			@Description(shortDefinition="")
116 			@OptionalParam(name="participant-type")
117 			TokenAndListParam theParticipant_type, 
118   
119 			@Description(shortDefinition="")
120 			@OptionalParam(name="patient", targetTypes={  } )
121 			ReferenceAndListParam thePatient, 
122   
123 			@Description(shortDefinition="")
124 			@OptionalParam(name="practitioner", targetTypes={  } )
125 			ReferenceAndListParam thePractitioner, 
126   
127 			@Description(shortDefinition="")
128 			@OptionalParam(name="procedure", targetTypes={  } )
129 			ReferenceAndListParam theProcedure, 
130   
131 			@Description(shortDefinition="")
132 			@OptionalParam(name="reason")
133 			TokenAndListParam theReason, 
134   
135 			@Description(shortDefinition="")
136 			@OptionalParam(name="special-arrangement")
137 			TokenAndListParam theSpecial_arrangement, 
138   
139 			@Description(shortDefinition="")
140 			@OptionalParam(name="status")
141 			TokenAndListParam theStatus, 
142   
143 			@Description(shortDefinition="")
144 			@OptionalParam(name="type")
145 			TokenAndListParam theType, 
146 
147 			@RawParam
148 			Map<String, List<String>> theAdditionalRawParams,
149 
150 			@IncludeParam(reverse=true)
151 			Set<Include> theRevIncludes,
152 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
153 			@OptionalParam(name="_lastUpdated")
154 			DateRangeParam theLastUpdated, 
155 
156 			@IncludeParam(allow= {
157 					"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" 					, "*"
158 			}) 
159 			Set<Include> theIncludes,
160 			
161 			@Sort 
162 			SortSpec theSort,
163 			
164 			@ca.uhn.fhir.rest.annotation.Count
165 			Integer theCount
166 	) {
167 		startRequest(theServletRequest);
168 		try {
169 			SearchParameterMap paramMap = new SearchParameterMap();
170 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
171 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
172 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
173 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
174 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
175 			paramMap.add("_has", theHas);
176 			paramMap.add("_id", the_id);
177 			paramMap.add("_language", the_language);
178 			paramMap.add("appointment", theAppointment);
179 			paramMap.add("condition", theCondition);
180 			paramMap.add("date", theDate);
181 			paramMap.add("episodeofcare", theEpisodeofcare);
182 			paramMap.add("identifier", theIdentifier);
183 			paramMap.add("incomingreferral", theIncomingreferral);
184 			paramMap.add("indication", theIndication);
185 			paramMap.add("length", theLength);
186 			paramMap.add("location", theLocation);
187 			paramMap.add("location-period", theLocation_period);
188 			paramMap.add("part-of", thePart_of);
189 			paramMap.add("participant", theParticipant);
190 			paramMap.add("participant-type", theParticipant_type);
191 			paramMap.add("patient", thePatient);
192 			paramMap.add("practitioner", thePractitioner);
193 			paramMap.add("procedure", theProcedure);
194 			paramMap.add("reason", theReason);
195 			paramMap.add("special-arrangement", theSpecial_arrangement);
196 			paramMap.add("status", theStatus);
197 			paramMap.add("type", theType);
198 			paramMap.setRevIncludes(theRevIncludes);
199 			paramMap.setLastUpdated(theLastUpdated);
200 			paramMap.setIncludes(theIncludes);
201 			paramMap.setSort(theSort);
202 			paramMap.setCount(theCount);
203 
204 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
205 
206 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
207 			return retVal;
208 		} finally {
209 			endRequest(theServletRequest);
210 		}
211 	}
212 
213 }