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 DiagnosticOrderResourceProvider extends 
19  	JpaResourceProviderDstu2<DiagnosticOrder>
20  	{
21  
22  	@Override
23  	public Class<DiagnosticOrder> getResourceType() {
24  		return DiagnosticOrder.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="actor", targetTypes={  } )
69  			ReferenceAndListParam theActor, 
70    
71  			@Description(shortDefinition="")
72  			@OptionalParam(name="bodysite")
73  			TokenAndListParam theBodysite, 
74    
75  			@Description(shortDefinition="")
76  			@OptionalParam(name="code")
77  			TokenAndListParam theCode, 
78    
79  			@Description(shortDefinition="")
80  			@OptionalParam(name="encounter", targetTypes={  } )
81  			ReferenceAndListParam theEncounter, 
82    
83  			@Description(shortDefinition="")
84  			@OptionalParam(name="event-date")
85  			DateRangeParam theEvent_date, 
86    
87  			@Description(shortDefinition="")
88  			@OptionalParam(name="event-status")
89  			TokenAndListParam theEvent_status, 
90    
91  			@Description(shortDefinition="A combination of past-status and date")
92  			@OptionalParam(name="event-status-event-date", compositeTypes= { TokenParam.class, DateParam.class })
93  			CompositeAndListParam<TokenParam, DateParam> theEvent_status_event_date,
94    
95  			@Description(shortDefinition="")
96  			@OptionalParam(name="identifier")
97  			TokenAndListParam theIdentifier, 
98    
99  			@Description(shortDefinition="")
100 			@OptionalParam(name="item-date")
101 			DateRangeParam theItem_date, 
102   
103 			@Description(shortDefinition="")
104 			@OptionalParam(name="item-past-status")
105 			TokenAndListParam theItem_past_status, 
106   
107 			@Description(shortDefinition="A combination of item-past-status and item-date")
108 			@OptionalParam(name="item-past-status-item-date", compositeTypes= { TokenParam.class, DateParam.class })
109 			CompositeAndListParam<TokenParam, DateParam> theItem_past_status_item_date,
110   
111 			@Description(shortDefinition="")
112 			@OptionalParam(name="item-status")
113 			TokenAndListParam theItem_status, 
114   
115 			@Description(shortDefinition="")
116 			@OptionalParam(name="orderer", targetTypes={  } )
117 			ReferenceAndListParam theOrderer, 
118   
119 			@Description(shortDefinition="")
120 			@OptionalParam(name="patient", targetTypes={  } )
121 			ReferenceAndListParam thePatient, 
122   
123 			@Description(shortDefinition="")
124 			@OptionalParam(name="specimen", targetTypes={  } )
125 			ReferenceAndListParam theSpecimen, 
126   
127 			@Description(shortDefinition="")
128 			@OptionalParam(name="status")
129 			TokenAndListParam theStatus, 
130   
131 			@Description(shortDefinition="")
132 			@OptionalParam(name="subject", targetTypes={  } )
133 			ReferenceAndListParam theSubject, 
134 
135 			@RawParam
136 			Map<String, List<String>> theAdditionalRawParams,
137 
138 			@IncludeParam(reverse=true)
139 			Set<Include> theRevIncludes,
140 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
141 			@OptionalParam(name="_lastUpdated")
142 			DateRangeParam theLastUpdated, 
143 
144 			@IncludeParam(allow= {
145 					"DiagnosticOrder:actor" , 					"DiagnosticOrder:encounter" , 					"DiagnosticOrder:orderer" , 					"DiagnosticOrder:patient" , 					"DiagnosticOrder:specimen" , 					"DiagnosticOrder:subject" , 						"DiagnosticOrder:actor" , 					"DiagnosticOrder:encounter" , 					"DiagnosticOrder:orderer" , 					"DiagnosticOrder:patient" , 					"DiagnosticOrder:specimen" , 					"DiagnosticOrder:subject" , 						"DiagnosticOrder:actor" , 					"DiagnosticOrder:encounter" , 					"DiagnosticOrder:orderer" , 					"DiagnosticOrder:patient" , 					"DiagnosticOrder:specimen" , 					"DiagnosticOrder:subject" , 						"DiagnosticOrder:actor" , 					"DiagnosticOrder:encounter" , 					"DiagnosticOrder:orderer" , 					"DiagnosticOrder:patient" , 					"DiagnosticOrder:specimen" , 					"DiagnosticOrder:subject" , 						"DiagnosticOrder:actor" , 					"DiagnosticOrder:encounter" , 					"DiagnosticOrder:orderer" , 					"DiagnosticOrder:patient" , 					"DiagnosticOrder:specimen" , 					"DiagnosticOrder:subject" , 						"DiagnosticOrder:actor" , 					"DiagnosticOrder:encounter" , 					"DiagnosticOrder:orderer" , 					"DiagnosticOrder:patient" , 					"DiagnosticOrder:specimen" , 					"DiagnosticOrder:subject" 					, "*"
146 			}) 
147 			Set<Include> theIncludes,
148 			
149 			@Sort 
150 			SortSpec theSort,
151 			
152 			@ca.uhn.fhir.rest.annotation.Count
153 			Integer theCount
154 	) {
155 		startRequest(theServletRequest);
156 		try {
157 			SearchParameterMap paramMap = new SearchParameterMap();
158 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
159 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
160 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
161 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
162 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
163 			paramMap.add("_has", theHas);
164 			paramMap.add("_id", the_id);
165 			paramMap.add("_language", the_language);
166 			paramMap.add("actor", theActor);
167 			paramMap.add("bodysite", theBodysite);
168 			paramMap.add("code", theCode);
169 			paramMap.add("encounter", theEncounter);
170 			paramMap.add("event-date", theEvent_date);
171 			paramMap.add("event-status", theEvent_status);
172 			paramMap.add("event-status-event-date", theEvent_status_event_date);
173 			paramMap.add("identifier", theIdentifier);
174 			paramMap.add("item-date", theItem_date);
175 			paramMap.add("item-past-status", theItem_past_status);
176 			paramMap.add("item-past-status-item-date", theItem_past_status_item_date);
177 			paramMap.add("item-status", theItem_status);
178 			paramMap.add("orderer", theOrderer);
179 			paramMap.add("patient", thePatient);
180 			paramMap.add("specimen", theSpecimen);
181 			paramMap.add("status", theStatus);
182 			paramMap.add("subject", theSubject);
183 			paramMap.setRevIncludes(theRevIncludes);
184 			paramMap.setLastUpdated(theLastUpdated);
185 			paramMap.setIncludes(theIncludes);
186 			paramMap.setSort(theSort);
187 			paramMap.setCount(theCount);
188 
189 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
190 
191 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
192 			return retVal;
193 		} finally {
194 			endRequest(theServletRequest);
195 		}
196 	}
197 
198 }