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 ImmunizationResourceProvider extends 
022        JpaResourceProviderDstu2<Immunization>
023        {
024
025        @Override
026        public Class<Immunization> getResourceType() {
027                return Immunization.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="Vaccination  (non)-Administration Date")
077                        @OptionalParam(name="date")
078                        DateRangeParam theDate, 
079   
080
081                        @Description(shortDefinition="")
082                        @OptionalParam(name="dose-sequence")
083                        NumberAndListParam theDose_sequence, 
084   
085
086                        @Description(shortDefinition="")
087                        @OptionalParam(name="identifier")
088                        TokenAndListParam theIdentifier,
089   
090
091                        @Description(shortDefinition="The service delivery location or facility in which the vaccine was / was to be administered")
092                        @OptionalParam(name="location", targetTypes={  } )
093                        ReferenceAndListParam theLocation, 
094   
095
096                        @Description(shortDefinition="Vaccine Lot Number")
097                        @OptionalParam(name="lot-number")
098                        StringAndListParam theLot_number, 
099   
100
101                        @Description(shortDefinition="Vaccine Manufacturer")
102                        @OptionalParam(name="manufacturer", targetTypes={  } )
103                        ReferenceAndListParam theManufacturer, 
104   
105
106                        @Description(shortDefinition="Administrations which were not given")
107                        @OptionalParam(name="notgiven")
108                        TokenAndListParam theNotgiven,
109   
110
111                        @Description(shortDefinition="The patient for the vaccination record")
112                        @OptionalParam(name="patient", targetTypes={  } )
113                        ReferenceAndListParam thePatient, 
114   
115
116                        @Description(shortDefinition="The practitioner who administered the vaccination")
117                        @OptionalParam(name="performer", targetTypes={  } )
118                        ReferenceAndListParam thePerformer, 
119   
120
121                        @Description(shortDefinition="")
122                        @OptionalParam(name="reaction", targetTypes={  } )
123                        ReferenceAndListParam theReaction, 
124   
125
126                        @Description(shortDefinition="")
127                        @OptionalParam(name="reaction-date")
128                        DateRangeParam theReaction_date, 
129   
130
131                        @Description(shortDefinition="")
132                        @OptionalParam(name="reason")
133                        TokenAndListParam theReason,
134   
135
136                        @Description(shortDefinition="Explanation of reason vaccination was not administered")
137                        @OptionalParam(name="reason-not-given")
138                        TokenAndListParam theReason_not_given,
139   
140
141                        @Description(shortDefinition="The practitioner who ordered the vaccination")
142                        @OptionalParam(name="requester", targetTypes={  } )
143                        ReferenceAndListParam theRequester, 
144   
145
146                        @Description(shortDefinition="Immunization event status")
147                        @OptionalParam(name="status")
148                        TokenAndListParam theStatus,
149   
150
151                        @Description(shortDefinition="Vaccine Product Administered")
152                        @OptionalParam(name="vaccine-code")
153                        TokenAndListParam theVaccine_code,
154
155                        @RawParam
156                        Map<String, List<String>> theAdditionalRawParams,
157
158                        @Description(shortDefinition="Only return resources which were last updated as specified by the given range")
159                        @OptionalParam(name="_lastUpdated")
160                        DateRangeParam theLastUpdated, 
161
162                        @IncludeParam
163                        Set<Include> theIncludes,
164
165                        @IncludeParam(reverse=true)
166                        Set<Include> theRevIncludes,
167
168                        @Sort
169                        SortSpec theSort,
170                        
171                        @ca.uhn.fhir.rest.annotation.Count
172                        Integer theCount,
173
174                        @ca.uhn.fhir.rest.annotation.Offset
175                        Integer theOffset,
176
177                        SummaryEnum theSummaryMode,
178
179                        SearchTotalModeEnum theSearchTotalMode,
180
181                        SearchContainedModeEnum theSearchContainedMode
182
183                        ) {
184                startRequest(theServletRequest);
185                try {
186                        SearchParameterMap paramMap = new SearchParameterMap();
187                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter);
188                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
189                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
190                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
191                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
192                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
193                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource);
194                        paramMap.add("_has", theHas);
195                        paramMap.add("_id", the_id);
196                        paramMap.add("date", theDate);
197                        paramMap.add("dose-sequence", theDose_sequence);
198                        paramMap.add("identifier", theIdentifier);
199                        paramMap.add("location", theLocation);
200                        paramMap.add("lot-number", theLot_number);
201                        paramMap.add("manufacturer", theManufacturer);
202                        paramMap.add("notgiven", theNotgiven);
203                        paramMap.add("patient", thePatient);
204                        paramMap.add("performer", thePerformer);
205                        paramMap.add("reaction", theReaction);
206                        paramMap.add("reaction-date", theReaction_date);
207                        paramMap.add("reason", theReason);
208                        paramMap.add("reason-not-given", theReason_not_given);
209                        paramMap.add("requester", theRequester);
210                        paramMap.add("status", theStatus);
211                        paramMap.add("vaccine-code", theVaccine_code);
212                        paramMap.setRevIncludes(theRevIncludes);
213                        paramMap.setLastUpdated(theLastUpdated);
214                        paramMap.setIncludes(theIncludes);
215                        paramMap.setSort(theSort);
216                        paramMap.setCount(theCount);
217                        paramMap.setOffset(theOffset);
218                        paramMap.setSummaryMode(theSummaryMode);
219                        paramMap.setSearchTotalMode(theSearchTotalMode);
220                        paramMap.setSearchContainedMode(theSearchContainedMode);
221
222                        getDao().translateRawParameters(theAdditionalRawParams, paramMap);
223
224                        ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
225                        return retVal;
226                } finally {
227                        endRequest(theServletRequest);
228                }
229        }
230
231}