View Javadoc
1   
2   package ca.uhn.fhir.jpa.rp.dstu3;
3   
4   import java.util.*;
5   
6   import org.apache.commons.lang3.StringUtils;
7   
8   import ca.uhn.fhir.jpa.provider.dstu3.*;
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 org.hl7.fhir.dstu3.model.*;
13  import ca.uhn.fhir.rest.annotation.*;
14  import ca.uhn.fhir.rest.param.*;
15  import ca.uhn.fhir.rest.api.SortSpec;
16  import ca.uhn.fhir.rest.api.SummaryEnum;
17  import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
18  
19  public class EncounterResourceProvider extends 
20  	BaseJpaResourceProviderEncounterDstu3
21  	{
22  
23  	@Override
24  	public Class<Encounter> getResourceType() {
25  		return Encounter.class;
26  	}
27  
28  	@Search(allowUnknownParams=true)
29  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
30  			javax.servlet.http.HttpServletRequest theServletRequest,
31  			javax.servlet.http.HttpServletResponse theServletResponse,
32  
33  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
34  			
35  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
36  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
37  			StringAndListParam theFtContent, 
38  
39  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
40  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
41  			StringAndListParam theFtText, 
42  
43  			@Description(shortDefinition="Search for resources which have the given tag")
44  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
45  			TokenAndListParam theSearchForTag, 
46  
47  			@Description(shortDefinition="Search for resources which have the given security labels")
48  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
49  			TokenAndListParam theSearchForSecurity, 
50    
51  			@Description(shortDefinition="Search for resources which have the given profile")
52  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
53  			UriAndListParam theSearchForProfile, 
54  
55  			@Description(shortDefinition="Return resources linked to by the given target")
56  			@OptionalParam(name="_has")
57  			HasAndListParam theHas, 
58  
59    
60  			@Description(shortDefinition="The ID of the resource")
61  			@OptionalParam(name="_id")
62  			TokenAndListParam the_id,
63    
64  			@Description(shortDefinition="The language of the resource")
65  			@OptionalParam(name="_language")
66  			StringAndListParam the_language, 
67    
68  			@Description(shortDefinition="The appointment that scheduled this encounter")
69  			@OptionalParam(name="appointment", targetTypes={  } )
70  			ReferenceAndListParam theAppointment, 
71    
72  			@Description(shortDefinition="inpatient | outpatient | ambulatory | emergency +")
73  			@OptionalParam(name="class")
74  			TokenAndListParam theClass,
75    
76  			@Description(shortDefinition="A date within the period the Encounter lasted")
77  			@OptionalParam(name="date")
78  			DateRangeParam theDate, 
79    
80  			@Description(shortDefinition="Reason the encounter takes place (resource)")
81  			@OptionalParam(name="diagnosis", targetTypes={  } )
82  			ReferenceAndListParam theDiagnosis, 
83    
84  			@Description(shortDefinition="Episode(s) of care that this encounter should be recorded against")
85  			@OptionalParam(name="episodeofcare", targetTypes={  } )
86  			ReferenceAndListParam theEpisodeofcare, 
87    
88  			@Description(shortDefinition="Identifier(s) by which this encounter is known")
89  			@OptionalParam(name="identifier")
90  			TokenAndListParam theIdentifier,
91    
92  			@Description(shortDefinition="The ReferralRequest that initiated this encounter")
93  			@OptionalParam(name="incomingreferral", targetTypes={  } )
94  			ReferenceAndListParam theIncomingreferral, 
95    
96  			@Description(shortDefinition="Length of encounter in days")
97  			@OptionalParam(name="length")
98  			NumberAndListParam theLength, 
99    
100 			@Description(shortDefinition="Location the encounter takes place")
101 			@OptionalParam(name="location", targetTypes={  } )
102 			ReferenceAndListParam theLocation, 
103   
104 			@Description(shortDefinition="Time period during which the patient was present at the location")
105 			@OptionalParam(name="location-period")
106 			DateRangeParam theLocation_period, 
107   
108 			@Description(shortDefinition="Another Encounter this encounter is part of")
109 			@OptionalParam(name="part-of", targetTypes={  } )
110 			ReferenceAndListParam thePart_of, 
111   
112 			@Description(shortDefinition="Persons involved in the encounter other than the patient")
113 			@OptionalParam(name="participant", targetTypes={  } )
114 			ReferenceAndListParam theParticipant, 
115   
116 			@Description(shortDefinition="Role of participant in encounter")
117 			@OptionalParam(name="participant-type")
118 			TokenAndListParam theParticipant_type,
119   
120 			@Description(shortDefinition="The patient ro group present at the encounter")
121 			@OptionalParam(name="patient", targetTypes={  } )
122 			ReferenceAndListParam thePatient, 
123   
124 			@Description(shortDefinition="Persons involved in the encounter other than the patient")
125 			@OptionalParam(name="practitioner", targetTypes={  } )
126 			ReferenceAndListParam thePractitioner, 
127   
128 			@Description(shortDefinition="Reason the encounter takes place (code)")
129 			@OptionalParam(name="reason")
130 			TokenAndListParam theReason,
131   
132 			@Description(shortDefinition="The custodian organization of this Encounter record")
133 			@OptionalParam(name="service-provider", targetTypes={  } )
134 			ReferenceAndListParam theService_provider, 
135   
136 			@Description(shortDefinition="Wheelchair, translator, stretcher, etc.")
137 			@OptionalParam(name="special-arrangement")
138 			TokenAndListParam theSpecial_arrangement,
139   
140 			@Description(shortDefinition="planned | arrived | triaged | in-progress | onleave | finished | cancelled +")
141 			@OptionalParam(name="status")
142 			TokenAndListParam theStatus,
143   
144 			@Description(shortDefinition="The patient ro group present at the encounter")
145 			@OptionalParam(name="subject", targetTypes={  } )
146 			ReferenceAndListParam theSubject, 
147   
148 			@Description(shortDefinition="Specific type of encounter")
149 			@OptionalParam(name="type")
150 			TokenAndListParam theType,
151 
152 			@RawParam
153 			Map<String, List<String>> theAdditionalRawParams,
154 
155 			@IncludeParam(reverse=true)
156 			Set<Include> theRevIncludes,
157 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
158 			@OptionalParam(name="_lastUpdated")
159 			DateRangeParam theLastUpdated, 
160 
161 			@IncludeParam(allow= {
162 					"Encounter:appointment" , 					"Encounter:diagnosis" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:service-provider" , 					"Encounter:subject" , 						"Encounter:appointment" , 					"Encounter:diagnosis" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:service-provider" , 					"Encounter:subject" , 						"Encounter:appointment" , 					"Encounter:diagnosis" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:service-provider" , 					"Encounter:subject" , 						"Encounter:appointment" , 					"Encounter:diagnosis" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:service-provider" , 					"Encounter:subject" , 						"Encounter:appointment" , 					"Encounter:diagnosis" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:service-provider" , 					"Encounter:subject" , 						"Encounter:appointment" , 					"Encounter:diagnosis" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:service-provider" , 					"Encounter:subject" , 						"Encounter:appointment" , 					"Encounter:diagnosis" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:service-provider" , 					"Encounter:subject" , 						"Encounter:appointment" , 					"Encounter:diagnosis" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:service-provider" , 					"Encounter:subject" , 						"Encounter:appointment" , 					"Encounter:diagnosis" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:service-provider" , 					"Encounter:subject" , 						"Encounter:appointment" , 					"Encounter:diagnosis" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:service-provider" , 					"Encounter:subject" , 						"Encounter:appointment" , 					"Encounter:diagnosis" , 					"Encounter:episodeofcare" , 					"Encounter:incomingreferral" , 					"Encounter:location" , 					"Encounter:part-of" , 					"Encounter:participant" , 					"Encounter:patient" , 					"Encounter:practitioner" , 					"Encounter:service-provider" , 					"Encounter:subject" 					, "*"
163 			}) 
164 			Set<Include> theIncludes,
165 			
166 			@Sort 
167 			SortSpec theSort,
168 			
169 			@ca.uhn.fhir.rest.annotation.Count
170 			Integer theCount,
171 
172 			SummaryEnum theSummaryMode,
173 
174 			SearchTotalModeEnum theSearchTotalMode
175 
176 			) {
177 		startRequest(theServletRequest);
178 		try {
179 			SearchParameterMap paramMap = new SearchParameterMap();
180 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
181 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
182 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
183 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
184 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
185 			paramMap.add("_has", theHas);
186 			paramMap.add("_id", the_id);
187 			paramMap.add("_language", the_language);
188 			paramMap.add("appointment", theAppointment);
189 			paramMap.add("class", theClass);
190 			paramMap.add("date", theDate);
191 			paramMap.add("diagnosis", theDiagnosis);
192 			paramMap.add("episodeofcare", theEpisodeofcare);
193 			paramMap.add("identifier", theIdentifier);
194 			paramMap.add("incomingreferral", theIncomingreferral);
195 			paramMap.add("length", theLength);
196 			paramMap.add("location", theLocation);
197 			paramMap.add("location-period", theLocation_period);
198 			paramMap.add("part-of", thePart_of);
199 			paramMap.add("participant", theParticipant);
200 			paramMap.add("participant-type", theParticipant_type);
201 			paramMap.add("patient", thePatient);
202 			paramMap.add("practitioner", thePractitioner);
203 			paramMap.add("reason", theReason);
204 			paramMap.add("service-provider", theService_provider);
205 			paramMap.add("special-arrangement", theSpecial_arrangement);
206 			paramMap.add("status", theStatus);
207 			paramMap.add("subject", theSubject);
208 			paramMap.add("type", theType);
209 			paramMap.setRevIncludes(theRevIncludes);
210 			paramMap.setLastUpdated(theLastUpdated);
211 			paramMap.setIncludes(theIncludes);
212 			paramMap.setSort(theSort);
213 			paramMap.setCount(theCount);
214 			paramMap.setSummaryMode(theSummaryMode);
215 			paramMap.setSearchTotalMode(theSearchTotalMode);
216 
217 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
218 
219 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
220 			return retVal;
221 		} finally {
222 			endRequest(theServletRequest);
223 		}
224 	}
225 
226 }