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  
17  public class DeviceRequestResourceProvider extends 
18  	JpaResourceProviderDstu3<DeviceRequest>
19  	{
20  
21  	@Override
22  	public Class<DeviceRequest> getResourceType() {
23  		return DeviceRequest.class;
24  	}
25  
26  	@Search(allowUnknownParams=true)
27  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
28  			javax.servlet.http.HttpServletRequest theServletRequest,
29  			javax.servlet.http.HttpServletResponse theServletResponse,
30  
31  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
32  			
33  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
34  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
35  			StringAndListParam theFtContent, 
36  
37  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
38  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
39  			StringAndListParam theFtText, 
40  
41  			@Description(shortDefinition="Search for resources which have the given tag")
42  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
43  			TokenAndListParam theSearchForTag, 
44  
45  			@Description(shortDefinition="Search for resources which have the given security labels")
46  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
47  			TokenAndListParam theSearchForSecurity, 
48    
49  			@Description(shortDefinition="Search for resources which have the given profile")
50  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
51  			UriAndListParam theSearchForProfile, 
52  
53  			@Description(shortDefinition="Return resources linked to by the given target")
54  			@OptionalParam(name="_has")
55  			HasAndListParam theHas, 
56  
57    
58  			@Description(shortDefinition="The ID of the resource")
59  			@OptionalParam(name="_id")
60  			TokenAndListParam the_id, 
61    
62  			@Description(shortDefinition="The language of the resource")
63  			@OptionalParam(name="_language")
64  			StringAndListParam the_language, 
65    
66  			@Description(shortDefinition="When the request transitioned to being actionable")
67  			@OptionalParam(name="authored-on")
68  			DateRangeParam theAuthored_on, 
69    
70  			@Description(shortDefinition="Plan/proposal/order fulfilled by this request")
71  			@OptionalParam(name="based-on", targetTypes={  } )
72  			ReferenceAndListParam theBased_on, 
73    
74  			@Description(shortDefinition="Code for what is being requested/ordered")
75  			@OptionalParam(name="code")
76  			TokenAndListParam theCode, 
77    
78  			@Description(shortDefinition="Protocol or definition followed by this request")
79  			@OptionalParam(name="definition", targetTypes={  } )
80  			ReferenceAndListParam theDefinition, 
81    
82  			@Description(shortDefinition="Reference to resource that is being requested/ordered")
83  			@OptionalParam(name="device", targetTypes={  } )
84  			ReferenceAndListParam theDevice, 
85    
86  			@Description(shortDefinition="Encounter or Episode during which request was created")
87  			@OptionalParam(name="encounter", targetTypes={  } )
88  			ReferenceAndListParam theEncounter, 
89    
90  			@Description(shortDefinition="When service should occur")
91  			@OptionalParam(name="event-date")
92  			DateRangeParam theEvent_date, 
93    
94  			@Description(shortDefinition="Composite request this is part of")
95  			@OptionalParam(name="group-identifier")
96  			TokenAndListParam theGroup_identifier, 
97    
98  			@Description(shortDefinition="Business identifier for request/order")
99  			@OptionalParam(name="identifier")
100 			TokenAndListParam theIdentifier, 
101   
102 			@Description(shortDefinition="proposal | plan | original-order |reflex-order")
103 			@OptionalParam(name="intent")
104 			TokenAndListParam theIntent, 
105   
106 			@Description(shortDefinition="Individual the service is ordered for")
107 			@OptionalParam(name="patient", targetTypes={  } )
108 			ReferenceAndListParam thePatient, 
109   
110 			@Description(shortDefinition="Desired performer for service")
111 			@OptionalParam(name="performer", targetTypes={  } )
112 			ReferenceAndListParam thePerformer, 
113   
114 			@Description(shortDefinition="Request takes the place of referenced completed or terminated requests")
115 			@OptionalParam(name="priorrequest", targetTypes={  } )
116 			ReferenceAndListParam thePriorrequest, 
117   
118 			@Description(shortDefinition="Who/what is requesting service ")
119 			@OptionalParam(name="requester", targetTypes={  } )
120 			ReferenceAndListParam theRequester, 
121   
122 			@Description(shortDefinition="entered-in-error | draft | active |suspended | completed ")
123 			@OptionalParam(name="status")
124 			TokenAndListParam theStatus, 
125   
126 			@Description(shortDefinition="Individual the service is ordered for")
127 			@OptionalParam(name="subject", targetTypes={  } )
128 			ReferenceAndListParam theSubject, 
129 
130 			@RawParam
131 			Map<String, List<String>> theAdditionalRawParams,
132 
133 			@IncludeParam(reverse=true)
134 			Set<Include> theRevIncludes,
135 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
136 			@OptionalParam(name="_lastUpdated")
137 			DateRangeParam theLastUpdated, 
138 
139 			@IncludeParam(allow= {
140 					"DeviceRequest:based-on" , 					"DeviceRequest:definition" , 					"DeviceRequest:device" , 					"DeviceRequest:encounter" , 					"DeviceRequest:patient" , 					"DeviceRequest:performer" , 					"DeviceRequest:priorrequest" , 					"DeviceRequest:requester" , 					"DeviceRequest:subject" , 						"DeviceRequest:based-on" , 					"DeviceRequest:definition" , 					"DeviceRequest:device" , 					"DeviceRequest:encounter" , 					"DeviceRequest:patient" , 					"DeviceRequest:performer" , 					"DeviceRequest:priorrequest" , 					"DeviceRequest:requester" , 					"DeviceRequest:subject" , 						"DeviceRequest:based-on" , 					"DeviceRequest:definition" , 					"DeviceRequest:device" , 					"DeviceRequest:encounter" , 					"DeviceRequest:patient" , 					"DeviceRequest:performer" , 					"DeviceRequest:priorrequest" , 					"DeviceRequest:requester" , 					"DeviceRequest:subject" , 						"DeviceRequest:based-on" , 					"DeviceRequest:definition" , 					"DeviceRequest:device" , 					"DeviceRequest:encounter" , 					"DeviceRequest:patient" , 					"DeviceRequest:performer" , 					"DeviceRequest:priorrequest" , 					"DeviceRequest:requester" , 					"DeviceRequest:subject" , 						"DeviceRequest:based-on" , 					"DeviceRequest:definition" , 					"DeviceRequest:device" , 					"DeviceRequest:encounter" , 					"DeviceRequest:patient" , 					"DeviceRequest:performer" , 					"DeviceRequest:priorrequest" , 					"DeviceRequest:requester" , 					"DeviceRequest:subject" , 						"DeviceRequest:based-on" , 					"DeviceRequest:definition" , 					"DeviceRequest:device" , 					"DeviceRequest:encounter" , 					"DeviceRequest:patient" , 					"DeviceRequest:performer" , 					"DeviceRequest:priorrequest" , 					"DeviceRequest:requester" , 					"DeviceRequest:subject" , 						"DeviceRequest:based-on" , 					"DeviceRequest:definition" , 					"DeviceRequest:device" , 					"DeviceRequest:encounter" , 					"DeviceRequest:patient" , 					"DeviceRequest:performer" , 					"DeviceRequest:priorrequest" , 					"DeviceRequest:requester" , 					"DeviceRequest:subject" , 						"DeviceRequest:based-on" , 					"DeviceRequest:definition" , 					"DeviceRequest:device" , 					"DeviceRequest:encounter" , 					"DeviceRequest:patient" , 					"DeviceRequest:performer" , 					"DeviceRequest:priorrequest" , 					"DeviceRequest:requester" , 					"DeviceRequest:subject" , 						"DeviceRequest:based-on" , 					"DeviceRequest:definition" , 					"DeviceRequest:device" , 					"DeviceRequest:encounter" , 					"DeviceRequest:patient" , 					"DeviceRequest:performer" , 					"DeviceRequest:priorrequest" , 					"DeviceRequest:requester" , 					"DeviceRequest:subject" 					, "*"
141 			}) 
142 			Set<Include> theIncludes,
143 			
144 			@Sort 
145 			SortSpec theSort,
146 			
147 			@ca.uhn.fhir.rest.annotation.Count
148 			Integer theCount
149 	) {
150 		startRequest(theServletRequest);
151 		try {
152 			SearchParameterMap paramMap = new SearchParameterMap();
153 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
154 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
155 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
156 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
157 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
158 			paramMap.add("_has", theHas);
159 			paramMap.add("_id", the_id);
160 			paramMap.add("_language", the_language);
161 			paramMap.add("authored-on", theAuthored_on);
162 			paramMap.add("based-on", theBased_on);
163 			paramMap.add("code", theCode);
164 			paramMap.add("definition", theDefinition);
165 			paramMap.add("device", theDevice);
166 			paramMap.add("encounter", theEncounter);
167 			paramMap.add("event-date", theEvent_date);
168 			paramMap.add("group-identifier", theGroup_identifier);
169 			paramMap.add("identifier", theIdentifier);
170 			paramMap.add("intent", theIntent);
171 			paramMap.add("patient", thePatient);
172 			paramMap.add("performer", thePerformer);
173 			paramMap.add("priorrequest", thePriorrequest);
174 			paramMap.add("requester", theRequester);
175 			paramMap.add("status", theStatus);
176 			paramMap.add("subject", theSubject);
177 			paramMap.setRevIncludes(theRevIncludes);
178 			paramMap.setLastUpdated(theLastUpdated);
179 			paramMap.setIncludes(theIncludes);
180 			paramMap.setSort(theSort);
181 			paramMap.setCount(theCount);
182 
183 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
184 
185 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
186 			return retVal;
187 		} finally {
188 			endRequest(theServletRequest);
189 		}
190 	}
191 
192 }