001package ca.uhn.fhir.jpa.provider;
002
003/*
004 * #%L
005 * HAPI FHIR JPA Server
006 * %%
007 * Copyright (C) 2014 - 2022 Smile CDR, Inc.
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 *
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 *
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoEncounter;
024import ca.uhn.fhir.jpa.model.util.JpaConstants;
025import ca.uhn.fhir.model.api.annotation.Description;
026import ca.uhn.fhir.model.dstu2.resource.Encounter;
027import ca.uhn.fhir.model.valueset.BundleTypeEnum;
028import ca.uhn.fhir.rest.annotation.IdParam;
029import ca.uhn.fhir.rest.annotation.Operation;
030import ca.uhn.fhir.rest.annotation.OperationParam;
031import ca.uhn.fhir.rest.annotation.Sort;
032import ca.uhn.fhir.rest.api.Constants;
033import ca.uhn.fhir.rest.api.SortSpec;
034import ca.uhn.fhir.rest.api.server.IBundleProvider;
035import ca.uhn.fhir.rest.param.DateRangeParam;
036
037public class BaseJpaResourceProviderEncounterDstu2 extends JpaResourceProviderDstu2<Encounter> {
038
039        /**
040         * Encounter/123/$everything
041         */
042        @Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
043        public IBundleProvider EncounterInstanceEverything(
044
045                        javax.servlet.http.HttpServletRequest theServletRequest,
046
047                        @IdParam
048                        ca.uhn.fhir.model.primitive.IdDt theId,
049
050                        @Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the size of those pages.")
051                        @OperationParam(name = Constants.PARAM_COUNT)
052                        ca.uhn.fhir.model.primitive.UnsignedIntDt theCount,
053
054                        @Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the offset when fetching a page.")
055                        @OperationParam(name = Constants.PARAM_OFFSET)
056                        ca.uhn.fhir.model.primitive.UnsignedIntDt theOffset,
057
058                        @Description(shortDefinition="Only return resources which were last updated as specified by the given range")
059                        @OperationParam(name = Constants.PARAM_LASTUPDATED, min=0, max=1)
060                        DateRangeParam theLastUpdated,
061
062                        @Sort
063                        SortSpec theSortSpec
064                        ) {
065
066                startRequest(theServletRequest);
067                try {
068                        return ((IFhirResourceDaoEncounter<Encounter>)getDao()).encounterInstanceEverything(theServletRequest, theId, theCount, theOffset, theLastUpdated, theSortSpec);
069                } finally {
070                        endRequest(theServletRequest);
071                }}
072
073                /**
074                 * /Encounter/$everything
075                 */
076                @Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType=BundleTypeEnum.SEARCHSET)
077                public IBundleProvider EncounterTypeEverything(
078
079                                javax.servlet.http.HttpServletRequest theServletRequest,
080
081                                @Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the size of those pages.")
082                                @OperationParam(name = Constants.PARAM_COUNT)
083                                ca.uhn.fhir.model.primitive.UnsignedIntDt theCount,
084
085                                @Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the offset when fetching a page.")
086                                @OperationParam(name = Constants.PARAM_OFFSET)
087                                ca.uhn.fhir.model.primitive.UnsignedIntDt theOffset,
088
089                                @Description(shortDefinition="Only return resources which were last updated as specified by the given range")
090                                @OperationParam(name = Constants.PARAM_LASTUPDATED, min=0, max=1)
091                                DateRangeParam theLastUpdated,
092
093                                @Sort
094                                SortSpec theSortSpec
095                                ) {
096
097                        startRequest(theServletRequest);
098                        try {
099                                return ((IFhirResourceDaoEncounter<Encounter>)getDao()).encounterTypeEverything(theServletRequest, theCount, theOffset,theLastUpdated, theSortSpec);
100                        } finally {
101                                endRequest(theServletRequest);
102                        }
103
104        }
105
106}