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 DiagnosticReportResourceProvider extends 
19  	JpaResourceProviderDstu2<DiagnosticReport>
20  	{
21  
22  	@Override
23  	public Class<DiagnosticReport> getResourceType() {
24  		return DiagnosticReport.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="Which diagnostic discipline/department created the report")
68  			@OptionalParam(name="category")
69  			TokenAndListParam theCategory, 
70    
71  			@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")
72  			@OptionalParam(name="code")
73  			TokenAndListParam theCode, 
74    
75  			@Description(shortDefinition="The clinically relevant time of the report")
76  			@OptionalParam(name="date")
77  			DateRangeParam theDate, 
78    
79  			@Description(shortDefinition="A coded diagnosis on the report")
80  			@OptionalParam(name="diagnosis")
81  			TokenAndListParam theDiagnosis, 
82    
83  			@Description(shortDefinition="The Encounter when the order was made")
84  			@OptionalParam(name="encounter", targetTypes={  } )
85  			ReferenceAndListParam theEncounter, 
86    
87  			@Description(shortDefinition="An identifier for the report")
88  			@OptionalParam(name="identifier")
89  			TokenAndListParam theIdentifier, 
90    
91  			@Description(shortDefinition="A reference to the image source.")
92  			@OptionalParam(name="image", targetTypes={  } )
93  			ReferenceAndListParam theImage, 
94    
95  			@Description(shortDefinition="When the report was issued")
96  			@OptionalParam(name="issued")
97  			DateRangeParam theIssued, 
98    
99  			@Description(shortDefinition="The subject of the report if a patient")
100 			@OptionalParam(name="patient", targetTypes={  } )
101 			ReferenceAndListParam thePatient, 
102   
103 			@Description(shortDefinition="Who was the source of the report (organization)")
104 			@OptionalParam(name="performer", targetTypes={  } )
105 			ReferenceAndListParam thePerformer, 
106   
107 			@Description(shortDefinition="Reference to the test or procedure request.")
108 			@OptionalParam(name="request", targetTypes={  } )
109 			ReferenceAndListParam theRequest, 
110   
111 			@Description(shortDefinition="Link to an atomic result (observation resource)")
112 			@OptionalParam(name="result", targetTypes={  } )
113 			ReferenceAndListParam theResult, 
114   
115 			@Description(shortDefinition="The specimen details")
116 			@OptionalParam(name="specimen", targetTypes={  } )
117 			ReferenceAndListParam theSpecimen, 
118   
119 			@Description(shortDefinition="The status of the report")
120 			@OptionalParam(name="status")
121 			TokenAndListParam theStatus, 
122   
123 			@Description(shortDefinition="The subject of the report")
124 			@OptionalParam(name="subject", targetTypes={  } )
125 			ReferenceAndListParam theSubject, 
126 
127 			@RawParam
128 			Map<String, List<String>> theAdditionalRawParams,
129 
130 			@IncludeParam(reverse=true)
131 			Set<Include> theRevIncludes,
132 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
133 			@OptionalParam(name="_lastUpdated")
134 			DateRangeParam theLastUpdated, 
135 
136 			@IncludeParam(allow= {
137 					"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" 					, "*"
138 			}) 
139 			Set<Include> theIncludes,
140 			
141 			@Sort 
142 			SortSpec theSort,
143 			
144 			@ca.uhn.fhir.rest.annotation.Count
145 			Integer theCount
146 	) {
147 		startRequest(theServletRequest);
148 		try {
149 			SearchParameterMap paramMap = new SearchParameterMap();
150 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
151 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
152 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
153 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
154 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
155 			paramMap.add("_has", theHas);
156 			paramMap.add("_id", the_id);
157 			paramMap.add("_language", the_language);
158 			paramMap.add("category", theCategory);
159 			paramMap.add("code", theCode);
160 			paramMap.add("date", theDate);
161 			paramMap.add("diagnosis", theDiagnosis);
162 			paramMap.add("encounter", theEncounter);
163 			paramMap.add("identifier", theIdentifier);
164 			paramMap.add("image", theImage);
165 			paramMap.add("issued", theIssued);
166 			paramMap.add("patient", thePatient);
167 			paramMap.add("performer", thePerformer);
168 			paramMap.add("request", theRequest);
169 			paramMap.add("result", theResult);
170 			paramMap.add("specimen", theSpecimen);
171 			paramMap.add("status", theStatus);
172 			paramMap.add("subject", theSubject);
173 			paramMap.setRevIncludes(theRevIncludes);
174 			paramMap.setLastUpdated(theLastUpdated);
175 			paramMap.setIncludes(theIncludes);
176 			paramMap.setSort(theSort);
177 			paramMap.setCount(theCount);
178 
179 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
180 
181 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
182 			return retVal;
183 		} finally {
184 			endRequest(theServletRequest);
185 		}
186 	}
187 
188 }