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 MedicationRequestResourceProvider extends 
18  	JpaResourceProviderDstu3<MedicationRequest>
19  	{
20  
21  	@Override
22  	public Class<MedicationRequest> getResourceType() {
23  		return MedicationRequest.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="Return prescriptions written on this date")
67  			@OptionalParam(name="authoredon")
68  			DateRangeParam theAuthoredon, 
69    
70  			@Description(shortDefinition="Returns prescriptions with different categories")
71  			@OptionalParam(name="category")
72  			TokenAndListParam theCategory, 
73    
74  			@Description(shortDefinition="Return prescriptions of this medication code")
75  			@OptionalParam(name="code")
76  			TokenAndListParam theCode, 
77    
78  			@Description(shortDefinition="Return prescriptions with this encounter or episode of care identifier")
79  			@OptionalParam(name="context", targetTypes={  } )
80  			ReferenceAndListParam theContext, 
81    
82  			@Description(shortDefinition="Returns medication request to be administered on a specific date")
83  			@OptionalParam(name="date")
84  			DateRangeParam theDate, 
85    
86  			@Description(shortDefinition="Return prescriptions with this external identifier")
87  			@OptionalParam(name="identifier")
88  			TokenAndListParam theIdentifier, 
89    
90  			@Description(shortDefinition="Returns prescriptions intended to be dispensed by this Organization")
91  			@OptionalParam(name="intended-dispenser", targetTypes={  } )
92  			ReferenceAndListParam theIntended_dispenser, 
93    
94  			@Description(shortDefinition="Returns prescriptions with different intents")
95  			@OptionalParam(name="intent")
96  			TokenAndListParam theIntent, 
97    
98  			@Description(shortDefinition="Return prescriptions of this medication reference")
99  			@OptionalParam(name="medication", targetTypes={  } )
100 			ReferenceAndListParam theMedication, 
101   
102 			@Description(shortDefinition="Returns prescriptions for a specific patient")
103 			@OptionalParam(name="patient", targetTypes={  } )
104 			ReferenceAndListParam thePatient, 
105   
106 			@Description(shortDefinition="Returns prescriptions with different priorities")
107 			@OptionalParam(name="priority")
108 			TokenAndListParam thePriority, 
109   
110 			@Description(shortDefinition="Returns prescriptions prescribed by this prescriber")
111 			@OptionalParam(name="requester", targetTypes={  } )
112 			ReferenceAndListParam theRequester, 
113   
114 			@Description(shortDefinition="Status of the prescription")
115 			@OptionalParam(name="status")
116 			TokenAndListParam theStatus, 
117   
118 			@Description(shortDefinition="The identity of a patient to list orders  for")
119 			@OptionalParam(name="subject", targetTypes={  } )
120 			ReferenceAndListParam theSubject, 
121 
122 			@RawParam
123 			Map<String, List<String>> theAdditionalRawParams,
124 
125 			@IncludeParam(reverse=true)
126 			Set<Include> theRevIncludes,
127 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
128 			@OptionalParam(name="_lastUpdated")
129 			DateRangeParam theLastUpdated, 
130 
131 			@IncludeParam(allow= {
132 					"MedicationRequest:context" , 					"MedicationRequest:intended-dispenser" , 					"MedicationRequest:medication" , 					"MedicationRequest:patient" , 					"MedicationRequest:requester" , 					"MedicationRequest:subject" , 						"MedicationRequest:context" , 					"MedicationRequest:intended-dispenser" , 					"MedicationRequest:medication" , 					"MedicationRequest:patient" , 					"MedicationRequest:requester" , 					"MedicationRequest:subject" , 						"MedicationRequest:context" , 					"MedicationRequest:intended-dispenser" , 					"MedicationRequest:medication" , 					"MedicationRequest:patient" , 					"MedicationRequest:requester" , 					"MedicationRequest:subject" , 						"MedicationRequest:context" , 					"MedicationRequest:intended-dispenser" , 					"MedicationRequest:medication" , 					"MedicationRequest:patient" , 					"MedicationRequest:requester" , 					"MedicationRequest:subject" , 						"MedicationRequest:context" , 					"MedicationRequest:intended-dispenser" , 					"MedicationRequest:medication" , 					"MedicationRequest:patient" , 					"MedicationRequest:requester" , 					"MedicationRequest:subject" , 						"MedicationRequest:context" , 					"MedicationRequest:intended-dispenser" , 					"MedicationRequest:medication" , 					"MedicationRequest:patient" , 					"MedicationRequest:requester" , 					"MedicationRequest:subject" 					, "*"
133 			}) 
134 			Set<Include> theIncludes,
135 			
136 			@Sort 
137 			SortSpec theSort,
138 			
139 			@ca.uhn.fhir.rest.annotation.Count
140 			Integer theCount
141 	) {
142 		startRequest(theServletRequest);
143 		try {
144 			SearchParameterMap paramMap = new SearchParameterMap();
145 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
146 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
147 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
148 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
149 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
150 			paramMap.add("_has", theHas);
151 			paramMap.add("_id", the_id);
152 			paramMap.add("_language", the_language);
153 			paramMap.add("authoredon", theAuthoredon);
154 			paramMap.add("category", theCategory);
155 			paramMap.add("code", theCode);
156 			paramMap.add("context", theContext);
157 			paramMap.add("date", theDate);
158 			paramMap.add("identifier", theIdentifier);
159 			paramMap.add("intended-dispenser", theIntended_dispenser);
160 			paramMap.add("intent", theIntent);
161 			paramMap.add("medication", theMedication);
162 			paramMap.add("patient", thePatient);
163 			paramMap.add("priority", thePriority);
164 			paramMap.add("requester", theRequester);
165 			paramMap.add("status", theStatus);
166 			paramMap.add("subject", theSubject);
167 			paramMap.setRevIncludes(theRevIncludes);
168 			paramMap.setLastUpdated(theLastUpdated);
169 			paramMap.setIncludes(theIncludes);
170 			paramMap.setSort(theSort);
171 			paramMap.setCount(theCount);
172 
173 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
174 
175 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
176 			return retVal;
177 		} finally {
178 			endRequest(theServletRequest);
179 		}
180 	}
181 
182 }