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  import ca.uhn.fhir.rest.api.SummaryEnum;
17  import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
18  
19  public class ImagingStudyResourceProvider extends 
20  	JpaResourceProviderDstu3<ImagingStudy>
21  	{
22  
23  	@Override
24  	public Class<ImagingStudy> getResourceType() {
25  		return ImagingStudy.class;
26  	}
27  
28  	@Search(allowUnknownParams=true)
29  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
30  			javax.servlet.http.HttpServletRequest theServletRequest,
31  			javax.servlet.http.HttpServletResponse theServletResponse,
32  
33  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
34  			
35  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
36  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
37  			StringAndListParam theFtContent, 
38  
39  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
40  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
41  			StringAndListParam theFtText, 
42  
43  			@Description(shortDefinition="Search for resources which have the given tag")
44  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
45  			TokenAndListParam theSearchForTag, 
46  
47  			@Description(shortDefinition="Search for resources which have the given security labels")
48  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
49  			TokenAndListParam theSearchForSecurity, 
50    
51  			@Description(shortDefinition="Search for resources which have the given profile")
52  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
53  			UriAndListParam theSearchForProfile, 
54  
55  			@Description(shortDefinition="Return resources linked to by the given target")
56  			@OptionalParam(name="_has")
57  			HasAndListParam theHas, 
58  
59    
60  			@Description(shortDefinition="The ID of the resource")
61  			@OptionalParam(name="_id")
62  			TokenAndListParam the_id,
63    
64  			@Description(shortDefinition="The language of the resource")
65  			@OptionalParam(name="_language")
66  			StringAndListParam the_language, 
67    
68  			@Description(shortDefinition="The accession identifier for the study")
69  			@OptionalParam(name="accession")
70  			TokenAndListParam theAccession,
71    
72  			@Description(shortDefinition="The order for the image")
73  			@OptionalParam(name="basedon", targetTypes={  } )
74  			ReferenceAndListParam theBasedon, 
75    
76  			@Description(shortDefinition="The body site studied")
77  			@OptionalParam(name="bodysite")
78  			TokenAndListParam theBodysite,
79    
80  			@Description(shortDefinition="The context of the study")
81  			@OptionalParam(name="context", targetTypes={  } )
82  			ReferenceAndListParam theContext, 
83    
84  			@Description(shortDefinition="The type of the instance")
85  			@OptionalParam(name="dicom-class")
86  			UriAndListParam theDicom_class, 
87    
88  			@Description(shortDefinition="The endpoint for te study or series")
89  			@OptionalParam(name="endpoint", targetTypes={  } )
90  			ReferenceAndListParam theEndpoint, 
91    
92  			@Description(shortDefinition="Other identifiers for the Study")
93  			@OptionalParam(name="identifier")
94  			TokenAndListParam theIdentifier,
95    
96  			@Description(shortDefinition="The modality of the series")
97  			@OptionalParam(name="modality")
98  			TokenAndListParam theModality,
99    
100 			@Description(shortDefinition="Who the study is about")
101 			@OptionalParam(name="patient", targetTypes={  } )
102 			ReferenceAndListParam thePatient, 
103   
104 			@Description(shortDefinition="The person who performed the study")
105 			@OptionalParam(name="performer", targetTypes={  } )
106 			ReferenceAndListParam thePerformer, 
107   
108 			@Description(shortDefinition="The reason for the study")
109 			@OptionalParam(name="reason")
110 			TokenAndListParam theReason,
111   
112 			@Description(shortDefinition="The identifier of the series of images")
113 			@OptionalParam(name="series")
114 			UriAndListParam theSeries, 
115   
116 			@Description(shortDefinition="When the study was started")
117 			@OptionalParam(name="started")
118 			DateRangeParam theStarted, 
119   
120 			@Description(shortDefinition="The study identifier for the image")
121 			@OptionalParam(name="study")
122 			UriAndListParam theStudy, 
123   
124 			@Description(shortDefinition="The instance unique identifier")
125 			@OptionalParam(name="uid")
126 			UriAndListParam theUid, 
127 
128 			@RawParam
129 			Map<String, List<String>> theAdditionalRawParams,
130 
131 			@IncludeParam(reverse=true)
132 			Set<Include> theRevIncludes,
133 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
134 			@OptionalParam(name="_lastUpdated")
135 			DateRangeParam theLastUpdated, 
136 
137 			@IncludeParam(allow= {
138 					"ImagingStudy:basedon" , 					"ImagingStudy:context" , 					"ImagingStudy:endpoint" , 					"ImagingStudy:patient" , 					"ImagingStudy:performer" , 						"ImagingStudy:basedon" , 					"ImagingStudy:context" , 					"ImagingStudy:endpoint" , 					"ImagingStudy:patient" , 					"ImagingStudy:performer" , 						"ImagingStudy:basedon" , 					"ImagingStudy:context" , 					"ImagingStudy:endpoint" , 					"ImagingStudy:patient" , 					"ImagingStudy:performer" , 						"ImagingStudy:basedon" , 					"ImagingStudy:context" , 					"ImagingStudy:endpoint" , 					"ImagingStudy:patient" , 					"ImagingStudy:performer" , 						"ImagingStudy:basedon" , 					"ImagingStudy:context" , 					"ImagingStudy:endpoint" , 					"ImagingStudy:patient" , 					"ImagingStudy:performer" 					, "*"
139 			}) 
140 			Set<Include> theIncludes,
141 			
142 			@Sort 
143 			SortSpec theSort,
144 			
145 			@ca.uhn.fhir.rest.annotation.Count
146 			Integer theCount,
147 
148 			SummaryEnum theSummaryMode,
149 
150 			SearchTotalModeEnum theSearchTotalMode
151 
152 			) {
153 		startRequest(theServletRequest);
154 		try {
155 			SearchParameterMap paramMap = new SearchParameterMap();
156 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
157 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
158 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
159 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
160 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
161 			paramMap.add("_has", theHas);
162 			paramMap.add("_id", the_id);
163 			paramMap.add("_language", the_language);
164 			paramMap.add("accession", theAccession);
165 			paramMap.add("basedon", theBasedon);
166 			paramMap.add("bodysite", theBodysite);
167 			paramMap.add("context", theContext);
168 			paramMap.add("dicom-class", theDicom_class);
169 			paramMap.add("endpoint", theEndpoint);
170 			paramMap.add("identifier", theIdentifier);
171 			paramMap.add("modality", theModality);
172 			paramMap.add("patient", thePatient);
173 			paramMap.add("performer", thePerformer);
174 			paramMap.add("reason", theReason);
175 			paramMap.add("series", theSeries);
176 			paramMap.add("started", theStarted);
177 			paramMap.add("study", theStudy);
178 			paramMap.add("uid", theUid);
179 			paramMap.setRevIncludes(theRevIncludes);
180 			paramMap.setLastUpdated(theLastUpdated);
181 			paramMap.setIncludes(theIncludes);
182 			paramMap.setSort(theSort);
183 			paramMap.setCount(theCount);
184 			paramMap.setSummaryMode(theSummaryMode);
185 			paramMap.setSearchTotalMode(theSearchTotalMode);
186 
187 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
188 
189 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
190 			return retVal;
191 		} finally {
192 			endRequest(theServletRequest);
193 		}
194 	}
195 
196 }