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 ProcedureRequestResourceProvider extends 
20  	JpaResourceProviderDstu3<ProcedureRequest>
21  	{
22  
23  	@Override
24  	public Class<ProcedureRequest> getResourceType() {
25  		return ProcedureRequest.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="Date request signed")
69  			@OptionalParam(name="authored")
70  			DateRangeParam theAuthored, 
71    
72  			@Description(shortDefinition="What request fulfills")
73  			@OptionalParam(name="based-on", targetTypes={  } )
74  			ReferenceAndListParam theBased_on, 
75    
76  			@Description(shortDefinition="Where procedure is going to be done")
77  			@OptionalParam(name="body-site")
78  			TokenAndListParam theBody_site,
79    
80  			@Description(shortDefinition="What is being requested/ordered")
81  			@OptionalParam(name="code")
82  			TokenAndListParam theCode,
83    
84  			@Description(shortDefinition="Encounter or Episode during which request was created")
85  			@OptionalParam(name="context", targetTypes={  } )
86  			ReferenceAndListParam theContext, 
87    
88  			@Description(shortDefinition="Protocol or definition")
89  			@OptionalParam(name="definition", targetTypes={  } )
90  			ReferenceAndListParam theDefinition, 
91    
92  			@Description(shortDefinition="An encounter in which this request is made")
93  			@OptionalParam(name="encounter", targetTypes={  } )
94  			ReferenceAndListParam theEncounter, 
95    
96  			@Description(shortDefinition="Identifiers assigned to this order")
97  			@OptionalParam(name="identifier")
98  			TokenAndListParam theIdentifier,
99    
100 			@Description(shortDefinition="proposal | plan | order +")
101 			@OptionalParam(name="intent")
102 			TokenAndListParam theIntent,
103   
104 			@Description(shortDefinition="When procedure should occur")
105 			@OptionalParam(name="occurrence")
106 			DateRangeParam theOccurrence, 
107   
108 			@Description(shortDefinition="Search by subject - a patient")
109 			@OptionalParam(name="patient", targetTypes={  } )
110 			ReferenceAndListParam thePatient, 
111   
112 			@Description(shortDefinition="Requested perfomer")
113 			@OptionalParam(name="performer", targetTypes={  } )
114 			ReferenceAndListParam thePerformer, 
115   
116 			@Description(shortDefinition="Performer role")
117 			@OptionalParam(name="performer-type")
118 			TokenAndListParam thePerformer_type,
119   
120 			@Description(shortDefinition="routine | urgent | asap | stat")
121 			@OptionalParam(name="priority")
122 			TokenAndListParam thePriority,
123   
124 			@Description(shortDefinition="What request replaces")
125 			@OptionalParam(name="replaces", targetTypes={  } )
126 			ReferenceAndListParam theReplaces, 
127   
128 			@Description(shortDefinition="Individual making the request")
129 			@OptionalParam(name="requester", targetTypes={  } )
130 			ReferenceAndListParam theRequester, 
131   
132 			@Description(shortDefinition="Composite Request ID")
133 			@OptionalParam(name="requisition")
134 			TokenAndListParam theRequisition,
135   
136 			@Description(shortDefinition="Specimen to be tested")
137 			@OptionalParam(name="specimen", targetTypes={  } )
138 			ReferenceAndListParam theSpecimen, 
139   
140 			@Description(shortDefinition="draft | active | suspended | completed | entered-in-error | cancelled")
141 			@OptionalParam(name="status")
142 			TokenAndListParam theStatus,
143   
144 			@Description(shortDefinition="Search by subject")
145 			@OptionalParam(name="subject", targetTypes={  } )
146 			ReferenceAndListParam theSubject, 
147 
148 			@RawParam
149 			Map<String, List<String>> theAdditionalRawParams,
150 
151 			@IncludeParam(reverse=true)
152 			Set<Include> theRevIncludes,
153 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
154 			@OptionalParam(name="_lastUpdated")
155 			DateRangeParam theLastUpdated, 
156 
157 			@IncludeParam(allow= {
158 					"ProcedureRequest:based-on" , 					"ProcedureRequest:context" , 					"ProcedureRequest:definition" , 					"ProcedureRequest:encounter" , 					"ProcedureRequest:patient" , 					"ProcedureRequest:performer" , 					"ProcedureRequest:replaces" , 					"ProcedureRequest:requester" , 					"ProcedureRequest:specimen" , 					"ProcedureRequest:subject" , 						"ProcedureRequest:based-on" , 					"ProcedureRequest:context" , 					"ProcedureRequest:definition" , 					"ProcedureRequest:encounter" , 					"ProcedureRequest:patient" , 					"ProcedureRequest:performer" , 					"ProcedureRequest:replaces" , 					"ProcedureRequest:requester" , 					"ProcedureRequest:specimen" , 					"ProcedureRequest:subject" , 						"ProcedureRequest:based-on" , 					"ProcedureRequest:context" , 					"ProcedureRequest:definition" , 					"ProcedureRequest:encounter" , 					"ProcedureRequest:patient" , 					"ProcedureRequest:performer" , 					"ProcedureRequest:replaces" , 					"ProcedureRequest:requester" , 					"ProcedureRequest:specimen" , 					"ProcedureRequest:subject" , 						"ProcedureRequest:based-on" , 					"ProcedureRequest:context" , 					"ProcedureRequest:definition" , 					"ProcedureRequest:encounter" , 					"ProcedureRequest:patient" , 					"ProcedureRequest:performer" , 					"ProcedureRequest:replaces" , 					"ProcedureRequest:requester" , 					"ProcedureRequest:specimen" , 					"ProcedureRequest:subject" , 						"ProcedureRequest:based-on" , 					"ProcedureRequest:context" , 					"ProcedureRequest:definition" , 					"ProcedureRequest:encounter" , 					"ProcedureRequest:patient" , 					"ProcedureRequest:performer" , 					"ProcedureRequest:replaces" , 					"ProcedureRequest:requester" , 					"ProcedureRequest:specimen" , 					"ProcedureRequest:subject" , 						"ProcedureRequest:based-on" , 					"ProcedureRequest:context" , 					"ProcedureRequest:definition" , 					"ProcedureRequest:encounter" , 					"ProcedureRequest:patient" , 					"ProcedureRequest:performer" , 					"ProcedureRequest:replaces" , 					"ProcedureRequest:requester" , 					"ProcedureRequest:specimen" , 					"ProcedureRequest:subject" , 						"ProcedureRequest:based-on" , 					"ProcedureRequest:context" , 					"ProcedureRequest:definition" , 					"ProcedureRequest:encounter" , 					"ProcedureRequest:patient" , 					"ProcedureRequest:performer" , 					"ProcedureRequest:replaces" , 					"ProcedureRequest:requester" , 					"ProcedureRequest:specimen" , 					"ProcedureRequest:subject" , 						"ProcedureRequest:based-on" , 					"ProcedureRequest:context" , 					"ProcedureRequest:definition" , 					"ProcedureRequest:encounter" , 					"ProcedureRequest:patient" , 					"ProcedureRequest:performer" , 					"ProcedureRequest:replaces" , 					"ProcedureRequest:requester" , 					"ProcedureRequest:specimen" , 					"ProcedureRequest:subject" , 						"ProcedureRequest:based-on" , 					"ProcedureRequest:context" , 					"ProcedureRequest:definition" , 					"ProcedureRequest:encounter" , 					"ProcedureRequest:patient" , 					"ProcedureRequest:performer" , 					"ProcedureRequest:replaces" , 					"ProcedureRequest:requester" , 					"ProcedureRequest:specimen" , 					"ProcedureRequest:subject" , 						"ProcedureRequest:based-on" , 					"ProcedureRequest:context" , 					"ProcedureRequest:definition" , 					"ProcedureRequest:encounter" , 					"ProcedureRequest:patient" , 					"ProcedureRequest:performer" , 					"ProcedureRequest:replaces" , 					"ProcedureRequest:requester" , 					"ProcedureRequest:specimen" , 					"ProcedureRequest:subject" 					, "*"
159 			}) 
160 			Set<Include> theIncludes,
161 			
162 			@Sort 
163 			SortSpec theSort,
164 			
165 			@ca.uhn.fhir.rest.annotation.Count
166 			Integer theCount,
167 
168 			SummaryEnum theSummaryMode,
169 
170 			SearchTotalModeEnum theSearchTotalMode
171 
172 			) {
173 		startRequest(theServletRequest);
174 		try {
175 			SearchParameterMap paramMap = new SearchParameterMap();
176 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
177 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
178 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
179 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
180 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
181 			paramMap.add("_has", theHas);
182 			paramMap.add("_id", the_id);
183 			paramMap.add("_language", the_language);
184 			paramMap.add("authored", theAuthored);
185 			paramMap.add("based-on", theBased_on);
186 			paramMap.add("body-site", theBody_site);
187 			paramMap.add("code", theCode);
188 			paramMap.add("context", theContext);
189 			paramMap.add("definition", theDefinition);
190 			paramMap.add("encounter", theEncounter);
191 			paramMap.add("identifier", theIdentifier);
192 			paramMap.add("intent", theIntent);
193 			paramMap.add("occurrence", theOccurrence);
194 			paramMap.add("patient", thePatient);
195 			paramMap.add("performer", thePerformer);
196 			paramMap.add("performer-type", thePerformer_type);
197 			paramMap.add("priority", thePriority);
198 			paramMap.add("replaces", theReplaces);
199 			paramMap.add("requester", theRequester);
200 			paramMap.add("requisition", theRequisition);
201 			paramMap.add("specimen", theSpecimen);
202 			paramMap.add("status", theStatus);
203 			paramMap.add("subject", theSubject);
204 			paramMap.setRevIncludes(theRevIncludes);
205 			paramMap.setLastUpdated(theLastUpdated);
206 			paramMap.setIncludes(theIncludes);
207 			paramMap.setSort(theSort);
208 			paramMap.setCount(theCount);
209 			paramMap.setSummaryMode(theSummaryMode);
210 			paramMap.setSearchTotalMode(theSearchTotalMode);
211 
212 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
213 
214 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
215 			return retVal;
216 		} finally {
217 			endRequest(theServletRequest);
218 		}
219 	}
220 
221 }