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.searchparam.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  import ca.uhn.fhir.rest.api.SummaryEnum;
18  import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
19  
20  public class DiagnosticReportResourceProvider extends 
21  	JpaResourceProviderDstu2<DiagnosticReport>
22  	{
23  
24  	@Override
25  	public Class<DiagnosticReport> getResourceType() {
26  		return DiagnosticReport.class;
27  	}
28  
29  	@Search(allowUnknownParams=true)
30  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
31  			javax.servlet.http.HttpServletRequest theServletRequest,
32  			javax.servlet.http.HttpServletResponse theServletResponse,
33  
34  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
35  			
36  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
37  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
38  			StringAndListParam theFtContent, 
39  
40  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
41  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
42  			StringAndListParam theFtText, 
43  
44  			@Description(shortDefinition="Search for resources which have the given tag")
45  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
46  			TokenAndListParam theSearchForTag, 
47  
48  			@Description(shortDefinition="Search for resources which have the given security labels")
49  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
50  			TokenAndListParam theSearchForSecurity, 
51    
52  			@Description(shortDefinition="Search for resources which have the given profile")
53  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
54  			UriAndListParam theSearchForProfile, 
55  
56  			@Description(shortDefinition="Return resources linked to by the given target")
57  			@OptionalParam(name="_has")
58  			HasAndListParam theHas, 
59  
60    
61  			@Description(shortDefinition="The ID of the resource")
62  			@OptionalParam(name="_id")
63  			StringAndListParam the_id, 
64    
65  			@Description(shortDefinition="The language of the resource")
66  			@OptionalParam(name="_language")
67  			StringAndListParam the_language, 
68    
69  			@Description(shortDefinition="Which diagnostic discipline/department created the report")
70  			@OptionalParam(name="category")
71  			TokenAndListParam theCategory,
72    
73  			@Description(shortDefinition="The code for the report as a whole, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result")
74  			@OptionalParam(name="code")
75  			TokenAndListParam theCode,
76    
77  			@Description(shortDefinition="The clinically relevant time of the report")
78  			@OptionalParam(name="date")
79  			DateRangeParam theDate, 
80    
81  			@Description(shortDefinition="A coded diagnosis on the report")
82  			@OptionalParam(name="diagnosis")
83  			TokenAndListParam theDiagnosis,
84    
85  			@Description(shortDefinition="The Encounter when the order was made")
86  			@OptionalParam(name="encounter", targetTypes={  } )
87  			ReferenceAndListParam theEncounter, 
88    
89  			@Description(shortDefinition="An identifier for the report")
90  			@OptionalParam(name="identifier")
91  			TokenAndListParam theIdentifier,
92    
93  			@Description(shortDefinition="A reference to the image source.")
94  			@OptionalParam(name="image", targetTypes={  } )
95  			ReferenceAndListParam theImage, 
96    
97  			@Description(shortDefinition="When the report was issued")
98  			@OptionalParam(name="issued")
99  			DateRangeParam theIssued, 
100   
101 			@Description(shortDefinition="The subject of the report if a patient")
102 			@OptionalParam(name="patient", targetTypes={  } )
103 			ReferenceAndListParam thePatient, 
104   
105 			@Description(shortDefinition="Who was the source of the report (organization)")
106 			@OptionalParam(name="performer", targetTypes={  } )
107 			ReferenceAndListParam thePerformer, 
108   
109 			@Description(shortDefinition="Reference to the test or procedure request.")
110 			@OptionalParam(name="request", targetTypes={  } )
111 			ReferenceAndListParam theRequest, 
112   
113 			@Description(shortDefinition="Link to an atomic result (observation resource)")
114 			@OptionalParam(name="result", targetTypes={  } )
115 			ReferenceAndListParam theResult, 
116   
117 			@Description(shortDefinition="The specimen details")
118 			@OptionalParam(name="specimen", targetTypes={  } )
119 			ReferenceAndListParam theSpecimen, 
120   
121 			@Description(shortDefinition="The status of the report")
122 			@OptionalParam(name="status")
123 			TokenAndListParam theStatus,
124   
125 			@Description(shortDefinition="The subject of the report")
126 			@OptionalParam(name="subject", targetTypes={  } )
127 			ReferenceAndListParam theSubject, 
128 
129 			@RawParam
130 			Map<String, List<String>> theAdditionalRawParams,
131 
132 			@IncludeParam(reverse=true)
133 			Set<Include> theRevIncludes,
134 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
135 			@OptionalParam(name="_lastUpdated")
136 			DateRangeParam theLastUpdated, 
137 
138 			@IncludeParam(allow= {
139 					"DiagnosticReport:encounter" , 					"DiagnosticReport:image" , 					"DiagnosticReport:patient" , 					"DiagnosticReport:performer" , 					"DiagnosticReport:request" , 					"DiagnosticReport:result" , 					"DiagnosticReport:specimen" , 					"DiagnosticReport:subject" , 						"DiagnosticReport:encounter" , 					"DiagnosticReport:image" , 					"DiagnosticReport:patient" , 					"DiagnosticReport:performer" , 					"DiagnosticReport:request" , 					"DiagnosticReport:result" , 					"DiagnosticReport:specimen" , 					"DiagnosticReport:subject" , 						"DiagnosticReport:encounter" , 					"DiagnosticReport:image" , 					"DiagnosticReport:patient" , 					"DiagnosticReport:performer" , 					"DiagnosticReport:request" , 					"DiagnosticReport:result" , 					"DiagnosticReport:specimen" , 					"DiagnosticReport:subject" , 						"DiagnosticReport:encounter" , 					"DiagnosticReport:image" , 					"DiagnosticReport:patient" , 					"DiagnosticReport:performer" , 					"DiagnosticReport:request" , 					"DiagnosticReport:result" , 					"DiagnosticReport:specimen" , 					"DiagnosticReport:subject" , 						"DiagnosticReport:encounter" , 					"DiagnosticReport:image" , 					"DiagnosticReport:patient" , 					"DiagnosticReport:performer" , 					"DiagnosticReport:request" , 					"DiagnosticReport:result" , 					"DiagnosticReport:specimen" , 					"DiagnosticReport:subject" , 						"DiagnosticReport:encounter" , 					"DiagnosticReport:image" , 					"DiagnosticReport:patient" , 					"DiagnosticReport:performer" , 					"DiagnosticReport:request" , 					"DiagnosticReport:result" , 					"DiagnosticReport:specimen" , 					"DiagnosticReport:subject" , 						"DiagnosticReport:encounter" , 					"DiagnosticReport:image" , 					"DiagnosticReport:patient" , 					"DiagnosticReport:performer" , 					"DiagnosticReport:request" , 					"DiagnosticReport:result" , 					"DiagnosticReport:specimen" , 					"DiagnosticReport:subject" , 						"DiagnosticReport:encounter" , 					"DiagnosticReport:image" , 					"DiagnosticReport:patient" , 					"DiagnosticReport:performer" , 					"DiagnosticReport:request" , 					"DiagnosticReport:result" , 					"DiagnosticReport:specimen" , 					"DiagnosticReport:subject" 					, "*"
140 			}) 
141 			Set<Include> theIncludes,
142 			
143 			@Sort 
144 			SortSpec theSort,
145 			
146 			@ca.uhn.fhir.rest.annotation.Count
147 			Integer theCount,
148 
149 			SummaryEnum theSummaryMode,
150 
151 			SearchTotalModeEnum theSearchTotalMode
152 
153 			) {
154 		startRequest(theServletRequest);
155 		try {
156 			SearchParameterMap paramMap = new SearchParameterMap();
157 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
158 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
159 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
160 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
161 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
162 			paramMap.add("_has", theHas);
163 			paramMap.add("_id", the_id);
164 			paramMap.add("_language", the_language);
165 			paramMap.add("category", theCategory);
166 			paramMap.add("code", theCode);
167 			paramMap.add("date", theDate);
168 			paramMap.add("diagnosis", theDiagnosis);
169 			paramMap.add("encounter", theEncounter);
170 			paramMap.add("identifier", theIdentifier);
171 			paramMap.add("image", theImage);
172 			paramMap.add("issued", theIssued);
173 			paramMap.add("patient", thePatient);
174 			paramMap.add("performer", thePerformer);
175 			paramMap.add("request", theRequest);
176 			paramMap.add("result", theResult);
177 			paramMap.add("specimen", theSpecimen);
178 			paramMap.add("status", theStatus);
179 			paramMap.add("subject", theSubject);
180 			paramMap.setRevIncludes(theRevIncludes);
181 			paramMap.setLastUpdated(theLastUpdated);
182 			paramMap.setIncludes(theIncludes);
183 			paramMap.setSort(theSort);
184 			paramMap.setCount(theCount);
185 			paramMap.setSummaryMode(theSummaryMode);
186 			paramMap.setSearchTotalMode(theSearchTotalMode);
187 
188 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
189 
190 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
191 			return retVal;
192 		} finally {
193 			endRequest(theServletRequest);
194 		}
195 	}
196 
197 }