001
002package ca.uhn.fhir.jpa.rp.dstu3;
003
004import java.util.*;
005
006import org.apache.commons.lang3.StringUtils;
007
008import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
009import ca.uhn.fhir.model.api.Include;
010import ca.uhn.fhir.model.api.annotation.*;
011import org.hl7.fhir.dstu3.model.*;
012import ca.uhn.fhir.rest.annotation.*;
013import ca.uhn.fhir.rest.param.*;
014import ca.uhn.fhir.rest.api.SortSpec;
015import ca.uhn.fhir.rest.api.SummaryEnum;
016import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
017import ca.uhn.fhir.rest.api.SearchContainedModeEnum;
018
019public class ProcedureResourceProvider extends 
020        ca.uhn.fhir.jpa.provider.BaseJpaResourceProvider<Procedure>
021        {
022
023        @Override
024        public Class<Procedure> getResourceType() {
025                return Procedure.class;
026        }
027
028        @Search(allowUnknownParams=true)
029        public ca.uhn.fhir.rest.api.server.IBundleProvider search(
030                        jakarta.servlet.http.HttpServletRequest theServletRequest,
031                        jakarta.servlet.http.HttpServletResponse theServletResponse,
032
033                        ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
034
035                        @Description(shortDefinition="Search the contents of the resource's data using a filter")
036                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_FILTER)
037                        StringAndListParam theFtFilter,
038
039                        @Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
040                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
041                        StringAndListParam theFtContent, 
042
043                        @Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
044                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
045                        StringAndListParam theFtText, 
046
047                        @Description(shortDefinition="Search for resources which have the given tag")
048                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
049                        TokenAndListParam theSearchForTag, 
050
051                        @Description(shortDefinition="Search for resources which have the given security labels")
052                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
053                        TokenAndListParam theSearchForSecurity, 
054  
055                        @Description(shortDefinition="Search for resources which have the given profile")
056                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
057                        UriAndListParam theSearchForProfile,
058
059                        @Description(shortDefinition="Search the contents of the resource's data using a list")
060                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_LIST)
061                        StringAndListParam theList,
062
063                        @Description(shortDefinition="Search for resources which have the given source value (Resource.meta.source)")
064                        @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE)
065                        UriAndListParam theSearchForSource,
066
067                        @Description(shortDefinition="Return resources linked to by the given target")
068                        @OptionalParam(name="_has")
069                        HasAndListParam theHas, 
070
071   
072
073                        @Description(shortDefinition="The ID of the resource")
074                        @OptionalParam(name="_id")
075                        TokenAndListParam the_id,
076   
077
078                        @Description(shortDefinition="A request for this procedure")
079                        @OptionalParam(name="based-on", targetTypes={  } )
080                        ReferenceAndListParam theBased_on, 
081   
082
083                        @Description(shortDefinition="Classification of the procedure")
084                        @OptionalParam(name="category")
085                        TokenAndListParam theCategory,
086   
087
088                        @Description(shortDefinition="A code to identify a  procedure")
089                        @OptionalParam(name="code")
090                        TokenAndListParam theCode,
091   
092
093                        @Description(shortDefinition="Encounter or episode associated with the procedure")
094                        @OptionalParam(name="context", targetTypes={  } )
095                        ReferenceAndListParam theContext, 
096   
097
098                        @Description(shortDefinition="Date/Period the procedure was performed")
099                        @OptionalParam(name="date")
100                        DateRangeParam theDate, 
101   
102
103                        @Description(shortDefinition="Instantiates protocol or definition")
104                        @OptionalParam(name="definition", targetTypes={  } )
105                        ReferenceAndListParam theDefinition, 
106   
107
108                        @Description(shortDefinition="Search by encounter")
109                        @OptionalParam(name="encounter", targetTypes={  } )
110                        ReferenceAndListParam theEncounter, 
111   
112
113                        @Description(shortDefinition="A unique identifier for a procedure")
114                        @OptionalParam(name="identifier")
115                        TokenAndListParam theIdentifier,
116   
117
118                        @Description(shortDefinition="Where the procedure happened")
119                        @OptionalParam(name="location", targetTypes={  } )
120                        ReferenceAndListParam theLocation, 
121   
122
123                        @Description(shortDefinition="Part of referenced event")
124                        @OptionalParam(name="part-of", targetTypes={  } )
125                        ReferenceAndListParam thePart_of, 
126   
127
128                        @Description(shortDefinition="Search by subject - a patient")
129                        @OptionalParam(name="patient", targetTypes={  } )
130                        ReferenceAndListParam thePatient, 
131   
132
133                        @Description(shortDefinition="The reference to the practitioner")
134                        @OptionalParam(name="performer", targetTypes={  } )
135                        ReferenceAndListParam thePerformer, 
136   
137
138                        @Description(shortDefinition="preparation | in-progress | suspended | aborted | completed | entered-in-error | unknown")
139                        @OptionalParam(name="status")
140                        TokenAndListParam theStatus,
141   
142
143                        @Description(shortDefinition="Search by subject")
144                        @OptionalParam(name="subject", targetTypes={  } )
145                        ReferenceAndListParam theSubject, 
146
147                        @RawParam
148                        Map<String, List<String>> theAdditionalRawParams,
149
150                        @Description(shortDefinition="Only return resources which were last updated as specified by the given range")
151                        @OptionalParam(name="_lastUpdated")
152                        DateRangeParam theLastUpdated, 
153
154                        @IncludeParam
155                        Set<Include> theIncludes,
156
157                        @IncludeParam(reverse=true)
158                        Set<Include> theRevIncludes,
159
160                        @Sort
161                        SortSpec theSort,
162                        
163                        @ca.uhn.fhir.rest.annotation.Count
164                        Integer theCount,
165
166                        @ca.uhn.fhir.rest.annotation.Offset
167                        Integer theOffset,
168
169                        SummaryEnum theSummaryMode,
170
171                        SearchTotalModeEnum theSearchTotalMode,
172
173                        SearchContainedModeEnum theSearchContainedMode
174
175                        ) {
176                startRequest(theServletRequest);
177                try {
178                        SearchParameterMap paramMap = new SearchParameterMap();
179                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter);
180                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
181                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
182                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
183                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
184                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
185                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource);
186                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_LIST, theList);
187                        paramMap.add("_has", theHas);
188                        paramMap.add("_id", the_id);
189                        paramMap.add("based-on", theBased_on);
190                        paramMap.add("category", theCategory);
191                        paramMap.add("code", theCode);
192                        paramMap.add("context", theContext);
193                        paramMap.add("date", theDate);
194                        paramMap.add("definition", theDefinition);
195                        paramMap.add("encounter", theEncounter);
196                        paramMap.add("identifier", theIdentifier);
197                        paramMap.add("location", theLocation);
198                        paramMap.add("part-of", thePart_of);
199                        paramMap.add("patient", thePatient);
200                        paramMap.add("performer", thePerformer);
201                        paramMap.add("status", theStatus);
202                        paramMap.add("subject", theSubject);
203                        paramMap.setRevIncludes(theRevIncludes);
204                        paramMap.setLastUpdated(theLastUpdated);
205                        paramMap.setIncludes(theIncludes);
206                        paramMap.setSort(theSort);
207                        paramMap.setCount(theCount);
208                        paramMap.setOffset(theOffset);
209                        paramMap.setSummaryMode(theSummaryMode);
210                        paramMap.setSearchTotalMode(theSearchTotalMode);
211                        paramMap.setSearchContainedMode(theSearchContainedMode);
212
213                        getDao().translateRawParameters(theAdditionalRawParams, paramMap);
214
215                        ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
216                        return retVal;
217                } finally {
218                        endRequest(theServletRequest);
219                }
220        }
221
222}