View Javadoc
1   
2   package ca.uhn.fhir.jpa.rp.r4;
3   
4   import java.util.*;
5   
6   import org.apache.commons.lang3.StringUtils;
7   
8   import ca.uhn.fhir.jpa.provider.r4.*;
9   import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
10  import ca.uhn.fhir.model.api.Include;
11  import ca.uhn.fhir.model.api.annotation.*;
12  import org.hl7.fhir.r4.model.*;
13  import ca.uhn.fhir.rest.annotation.*;
14  import ca.uhn.fhir.rest.param.*;
15  import ca.uhn.fhir.rest.api.SortSpec;
16  import ca.uhn.fhir.rest.api.SummaryEnum;
17  import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
18  
19  public class RelatedPersonResourceProvider extends 
20  	JpaResourceProviderR4<RelatedPerson>
21  	{
22  
23  	@Override
24  	public Class<RelatedPerson> getResourceType() {
25  		return RelatedPerson.class;
26  	}
27  
28  	@Search(allowUnknownParams=true)
29  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
30  			javax.servlet.http.HttpServletRequest theServletRequest,
31  			javax.servlet.http.HttpServletResponse theServletResponse,
32  
33  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
34  
35  			@Description(shortDefinition="Search the contents of the resource's data using a filter")
36  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_FILTER)
37  			StringAndListParam theFtFilter,
38  
39  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
40  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
41  			StringAndListParam theFtContent, 
42  
43  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
44  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
45  			StringAndListParam theFtText, 
46  
47  			@Description(shortDefinition="Search for resources which have the given tag")
48  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
49  			TokenAndListParam theSearchForTag, 
50  
51  			@Description(shortDefinition="Search for resources which have the given security labels")
52  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
53  			TokenAndListParam theSearchForSecurity, 
54    
55  			@Description(shortDefinition="Search for resources which have the given profile")
56  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
57  			UriAndListParam theSearchForProfile, 
58  
59  			@Description(shortDefinition="Return resources linked to by the given target")
60  			@OptionalParam(name="_has")
61  			HasAndListParam theHas, 
62  
63    
64  			@Description(shortDefinition="The ID of the resource")
65  			@OptionalParam(name="_id")
66  			TokenAndListParam the_id,
67    
68  			@Description(shortDefinition="The language of the resource")
69  			@OptionalParam(name="_language")
70  			StringAndListParam the_language, 
71    
72  			@Description(shortDefinition="Indicates if the related person record is active")
73  			@OptionalParam(name="active")
74  			TokenAndListParam theActive,
75    
76  			@Description(shortDefinition="A server defined search that may match any of the string fields in the Address, including line, city, district, state, country, postalCode, and/or text")
77  			@OptionalParam(name="address")
78  			StringAndListParam theAddress, 
79    
80  			@Description(shortDefinition="A city specified in an address")
81  			@OptionalParam(name="address-city")
82  			StringAndListParam theAddress_city, 
83    
84  			@Description(shortDefinition="A country specified in an address")
85  			@OptionalParam(name="address-country")
86  			StringAndListParam theAddress_country, 
87    
88  			@Description(shortDefinition="A postal code specified in an address")
89  			@OptionalParam(name="address-postalcode")
90  			StringAndListParam theAddress_postalcode, 
91    
92  			@Description(shortDefinition="A state specified in an address")
93  			@OptionalParam(name="address-state")
94  			StringAndListParam theAddress_state, 
95    
96  			@Description(shortDefinition="A use code specified in an address")
97  			@OptionalParam(name="address-use")
98  			TokenAndListParam theAddress_use,
99    
100 			@Description(shortDefinition="The Related Person's date of birth")
101 			@OptionalParam(name="birthdate")
102 			DateRangeParam theBirthdate, 
103   
104 			@Description(shortDefinition="A value in an email contact")
105 			@OptionalParam(name="email")
106 			TokenAndListParam theEmail,
107   
108 			@Description(shortDefinition="Gender of the related person")
109 			@OptionalParam(name="gender")
110 			TokenAndListParam theGender,
111   
112 			@Description(shortDefinition="An Identifier of the RelatedPerson")
113 			@OptionalParam(name="identifier")
114 			TokenAndListParam theIdentifier,
115   
116 			@Description(shortDefinition="A server defined search that may match any of the string fields in the HumanName, including family, give, prefix, suffix, suffix, and/or text")
117 			@OptionalParam(name="name")
118 			StringAndListParam theName, 
119   
120 			@Description(shortDefinition="The patient this related person is related to")
121 			@OptionalParam(name="patient", targetTypes={  } )
122 			ReferenceAndListParam thePatient, 
123   
124 			@Description(shortDefinition="A value in a phone contact")
125 			@OptionalParam(name="phone")
126 			TokenAndListParam thePhone,
127   
128 			@Description(shortDefinition="A portion of name using some kind of phonetic matching algorithm")
129 			@OptionalParam(name="phonetic")
130 			StringAndListParam thePhonetic, 
131   
132 			@Description(shortDefinition="The relationship between the patient and the relatedperson")
133 			@OptionalParam(name="relationship")
134 			TokenAndListParam theRelationship,
135   
136 			@Description(shortDefinition="The value in any kind of contact")
137 			@OptionalParam(name="telecom")
138 			TokenAndListParam theTelecom,
139 
140 			@RawParam
141 			Map<String, List<String>> theAdditionalRawParams,
142 
143 			@IncludeParam(reverse=true)
144 			Set<Include> theRevIncludes,
145 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
146 			@OptionalParam(name="_lastUpdated")
147 			DateRangeParam theLastUpdated, 
148 
149 			@IncludeParam(allow= {
150 					"RelatedPerson:patient" 					, "*"
151 			}) 
152 			Set<Include> theIncludes,
153 			
154 			@Sort 
155 			SortSpec theSort,
156 			
157 			@ca.uhn.fhir.rest.annotation.Count
158 			Integer theCount,
159 
160 			SummaryEnum theSummaryMode,
161 
162 			SearchTotalModeEnum theSearchTotalMode
163 
164 			) {
165 		startRequest(theServletRequest);
166 		try {
167 			SearchParameterMap paramMap = new SearchParameterMap();
168 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter);
169 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
170 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
171 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
172 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
173 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
174 			paramMap.add("_has", theHas);
175 			paramMap.add("_id", the_id);
176 			paramMap.add("_language", the_language);
177 			paramMap.add("active", theActive);
178 			paramMap.add("address", theAddress);
179 			paramMap.add("address-city", theAddress_city);
180 			paramMap.add("address-country", theAddress_country);
181 			paramMap.add("address-postalcode", theAddress_postalcode);
182 			paramMap.add("address-state", theAddress_state);
183 			paramMap.add("address-use", theAddress_use);
184 			paramMap.add("birthdate", theBirthdate);
185 			paramMap.add("email", theEmail);
186 			paramMap.add("gender", theGender);
187 			paramMap.add("identifier", theIdentifier);
188 			paramMap.add("name", theName);
189 			paramMap.add("patient", thePatient);
190 			paramMap.add("phone", thePhone);
191 			paramMap.add("phonetic", thePhonetic);
192 			paramMap.add("relationship", theRelationship);
193 			paramMap.add("telecom", theTelecom);
194 			paramMap.setRevIncludes(theRevIncludes);
195 			paramMap.setLastUpdated(theLastUpdated);
196 			paramMap.setIncludes(theIncludes);
197 			paramMap.setSort(theSort);
198 			paramMap.setCount(theCount);
199 			paramMap.setSummaryMode(theSummaryMode);
200 			paramMap.setSearchTotalMode(theSearchTotalMode);
201 
202 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
203 
204 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
205 			return retVal;
206 		} finally {
207 			endRequest(theServletRequest);
208 		}
209 	}
210 
211 }