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