
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 ImagingStudyResourceProvider extends 022 JpaResourceProviderDstu2<ImagingStudy> 023 { 024 025 @Override 026 public Class<ImagingStudy> getResourceType() { 027 return ImagingStudy.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="The accession identifier for the study") 077 @OptionalParam(name="accession") 078 TokenAndListParam theAccession, 079 080 081 @Description(shortDefinition="The body site studied") 082 @OptionalParam(name="bodysite") 083 TokenAndListParam theBodysite, 084 085 086 @Description(shortDefinition="The type of the instance") 087 @OptionalParam(name="dicom-class") 088 UriAndListParam theDicom_class, 089 090 091 @Description(shortDefinition="The modality of the series") 092 @OptionalParam(name="modality") 093 TokenAndListParam theModality, 094 095 096 @Description(shortDefinition="The order for the image") 097 @OptionalParam(name="order", targetTypes={ } ) 098 ReferenceAndListParam theOrder, 099 100 101 @Description(shortDefinition="Who the study is about") 102 @OptionalParam(name="patient", targetTypes={ } ) 103 ReferenceAndListParam thePatient, 104 105 106 @Description(shortDefinition="The identifier of the series of images") 107 @OptionalParam(name="series") 108 UriAndListParam theSeries, 109 110 111 @Description(shortDefinition="When the study was started") 112 @OptionalParam(name="started") 113 DateRangeParam theStarted, 114 115 116 @Description(shortDefinition="The study identifier for the image") 117 @OptionalParam(name="study") 118 UriAndListParam theStudy, 119 120 121 @Description(shortDefinition="The instance unique identifier") 122 @OptionalParam(name="uid") 123 UriAndListParam theUid, 124 125 @RawParam 126 Map<String, List<String>> theAdditionalRawParams, 127 128 @Description(shortDefinition="Only return resources which were last updated as specified by the given range") 129 @OptionalParam(name="_lastUpdated") 130 DateRangeParam theLastUpdated, 131 132 @IncludeParam 133 Set<Include> theIncludes, 134 135 @IncludeParam(reverse=true) 136 Set<Include> theRevIncludes, 137 138 @Sort 139 SortSpec theSort, 140 141 @ca.uhn.fhir.rest.annotation.Count 142 Integer theCount, 143 144 @ca.uhn.fhir.rest.annotation.Offset 145 Integer theOffset, 146 147 SummaryEnum theSummaryMode, 148 149 SearchTotalModeEnum theSearchTotalMode, 150 151 SearchContainedModeEnum theSearchContainedMode 152 153 ) { 154 startRequest(theServletRequest); 155 try { 156 SearchParameterMap paramMap = new SearchParameterMap(); 157 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter); 158 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent); 159 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText); 160 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag); 161 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity); 162 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile); 163 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource); 164 paramMap.add("_has", theHas); 165 paramMap.add("_id", the_id); 166 paramMap.add("accession", theAccession); 167 paramMap.add("bodysite", theBodysite); 168 paramMap.add("dicom-class", theDicom_class); 169 paramMap.add("modality", theModality); 170 paramMap.add("order", theOrder); 171 paramMap.add("patient", thePatient); 172 paramMap.add("series", theSeries); 173 paramMap.add("started", theStarted); 174 paramMap.add("study", theStudy); 175 paramMap.add("uid", theUid); 176 paramMap.setRevIncludes(theRevIncludes); 177 paramMap.setLastUpdated(theLastUpdated); 178 paramMap.setIncludes(theIncludes); 179 paramMap.setSort(theSort); 180 paramMap.setCount(theCount); 181 paramMap.setOffset(theOffset); 182 paramMap.setSummaryMode(theSummaryMode); 183 paramMap.setSearchTotalMode(theSearchTotalMode); 184 paramMap.setSearchContainedMode(theSearchContainedMode); 185 186 getDao().translateRawParameters(theAdditionalRawParams, paramMap); 187 188 ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse); 189 return retVal; 190 } finally { 191 endRequest(theServletRequest); 192 } 193 } 194 195}