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 MedicationAdministrationResourceProvider extends 
19  	JpaResourceProviderDstu2<MedicationAdministration>
20  	{
21  
22  	@Override
23  	public Class<MedicationAdministration> getResourceType() {
24  		return MedicationAdministration.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="Return administrations of this medication code")
68  			@OptionalParam(name="code")
69  			TokenAndListParam theCode, 
70    
71  			@Description(shortDefinition="Return administrations with this administration device identity")
72  			@OptionalParam(name="device", targetTypes={  } )
73  			ReferenceAndListParam theDevice, 
74    
75  			@Description(shortDefinition="Date administration happened (or did not happen)")
76  			@OptionalParam(name="effectivetime")
77  			DateRangeParam theEffectivetime, 
78    
79  			@Description(shortDefinition="Return administrations that share this encounter")
80  			@OptionalParam(name="encounter", targetTypes={  } )
81  			ReferenceAndListParam theEncounter, 
82    
83  			@Description(shortDefinition="Return administrations with this external identifier")
84  			@OptionalParam(name="identifier")
85  			TokenAndListParam theIdentifier, 
86    
87  			@Description(shortDefinition="Return administrations of this medication resource")
88  			@OptionalParam(name="medication", targetTypes={  } )
89  			ReferenceAndListParam theMedication, 
90    
91  			@Description(shortDefinition="Administrations that were not made")
92  			@OptionalParam(name="notgiven")
93  			TokenAndListParam theNotgiven, 
94    
95  			@Description(shortDefinition="The identity of a patient to list administrations  for")
96  			@OptionalParam(name="patient", targetTypes={  } )
97  			ReferenceAndListParam thePatient, 
98    
99  			@Description(shortDefinition="")
100 			@OptionalParam(name="practitioner", targetTypes={  } )
101 			ReferenceAndListParam thePractitioner, 
102   
103 			@Description(shortDefinition="The identity of a prescription to list administrations from")
104 			@OptionalParam(name="prescription", targetTypes={  } )
105 			ReferenceAndListParam thePrescription, 
106   
107 			@Description(shortDefinition="MedicationAdministration event status (for example one of active/paused/completed/nullified)")
108 			@OptionalParam(name="status")
109 			TokenAndListParam theStatus, 
110 
111 			@RawParam
112 			Map<String, List<String>> theAdditionalRawParams,
113 
114 			@IncludeParam(reverse=true)
115 			Set<Include> theRevIncludes,
116 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
117 			@OptionalParam(name="_lastUpdated")
118 			DateRangeParam theLastUpdated, 
119 
120 			@IncludeParam(allow= {
121 					"MedicationAdministration:device" , 					"MedicationAdministration:encounter" , 					"MedicationAdministration:medication" , 					"MedicationAdministration:patient" , 					"MedicationAdministration:practitioner" , 					"MedicationAdministration:prescription" , 						"MedicationAdministration:device" , 					"MedicationAdministration:encounter" , 					"MedicationAdministration:medication" , 					"MedicationAdministration:patient" , 					"MedicationAdministration:practitioner" , 					"MedicationAdministration:prescription" , 						"MedicationAdministration:device" , 					"MedicationAdministration:encounter" , 					"MedicationAdministration:medication" , 					"MedicationAdministration:patient" , 					"MedicationAdministration:practitioner" , 					"MedicationAdministration:prescription" , 						"MedicationAdministration:device" , 					"MedicationAdministration:encounter" , 					"MedicationAdministration:medication" , 					"MedicationAdministration:patient" , 					"MedicationAdministration:practitioner" , 					"MedicationAdministration:prescription" , 						"MedicationAdministration:device" , 					"MedicationAdministration:encounter" , 					"MedicationAdministration:medication" , 					"MedicationAdministration:patient" , 					"MedicationAdministration:practitioner" , 					"MedicationAdministration:prescription" , 						"MedicationAdministration:device" , 					"MedicationAdministration:encounter" , 					"MedicationAdministration:medication" , 					"MedicationAdministration:patient" , 					"MedicationAdministration:practitioner" , 					"MedicationAdministration:prescription" 					, "*"
122 			}) 
123 			Set<Include> theIncludes,
124 			
125 			@Sort 
126 			SortSpec theSort,
127 			
128 			@ca.uhn.fhir.rest.annotation.Count
129 			Integer theCount
130 	) {
131 		startRequest(theServletRequest);
132 		try {
133 			SearchParameterMap paramMap = new SearchParameterMap();
134 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
135 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
136 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
137 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
138 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
139 			paramMap.add("_has", theHas);
140 			paramMap.add("_id", the_id);
141 			paramMap.add("_language", the_language);
142 			paramMap.add("code", theCode);
143 			paramMap.add("device", theDevice);
144 			paramMap.add("effectivetime", theEffectivetime);
145 			paramMap.add("encounter", theEncounter);
146 			paramMap.add("identifier", theIdentifier);
147 			paramMap.add("medication", theMedication);
148 			paramMap.add("notgiven", theNotgiven);
149 			paramMap.add("patient", thePatient);
150 			paramMap.add("practitioner", thePractitioner);
151 			paramMap.add("prescription", thePrescription);
152 			paramMap.add("status", theStatus);
153 			paramMap.setRevIncludes(theRevIncludes);
154 			paramMap.setLastUpdated(theLastUpdated);
155 			paramMap.setIncludes(theIncludes);
156 			paramMap.setSort(theSort);
157 			paramMap.setCount(theCount);
158 
159 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
160 
161 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
162 			return retVal;
163 		} finally {
164 			endRequest(theServletRequest);
165 		}
166 	}
167 
168 }