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