View Javadoc
1   
2   package ca.uhn.fhir.jpa.rp.dstu2;
3   
4   import java.util.*;
5   
6   import org.apache.commons.lang3.StringUtils;
7   
8   import ca.uhn.fhir.jpa.provider.*;
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 ca.uhn.fhir.model.dstu2.composite.*;
13  import ca.uhn.fhir.model.dstu2.resource.*; //
14  import ca.uhn.fhir.rest.annotation.*;
15  import ca.uhn.fhir.rest.param.*;
16  import ca.uhn.fhir.rest.api.SortSpec;
17  import ca.uhn.fhir.rest.api.SummaryEnum;
18  import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
19  
20  public class EpisodeOfCareResourceProvider extends 
21  	JpaResourceProviderDstu2<EpisodeOfCare>
22  	{
23  
24  	@Override
25  	public Class<EpisodeOfCare> getResourceType() {
26  		return EpisodeOfCare.class;
27  	}
28  
29  	@Search(allowUnknownParams=true)
30  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
31  			javax.servlet.http.HttpServletRequest theServletRequest,
32  			javax.servlet.http.HttpServletResponse theServletResponse,
33  
34  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
35  			
36  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
37  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
38  			StringAndListParam theFtContent, 
39  
40  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
41  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
42  			StringAndListParam theFtText, 
43  
44  			@Description(shortDefinition="Search for resources which have the given tag")
45  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
46  			TokenAndListParam theSearchForTag, 
47  
48  			@Description(shortDefinition="Search for resources which have the given security labels")
49  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
50  			TokenAndListParam theSearchForSecurity, 
51    
52  			@Description(shortDefinition="Search for resources which have the given profile")
53  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
54  			UriAndListParam theSearchForProfile, 
55  
56  			@Description(shortDefinition="Return resources linked to by the given target")
57  			@OptionalParam(name="_has")
58  			HasAndListParam theHas, 
59  
60    
61  			@Description(shortDefinition="The ID of the resource")
62  			@OptionalParam(name="_id")
63  			StringAndListParam the_id, 
64    
65  			@Description(shortDefinition="The language of the resource")
66  			@OptionalParam(name="_language")
67  			StringAndListParam the_language, 
68    
69  			@Description(shortDefinition="")
70  			@OptionalParam(name="care-manager", targetTypes={  } )
71  			ReferenceAndListParam theCare_manager, 
72    
73  			@Description(shortDefinition="")
74  			@OptionalParam(name="condition", targetTypes={  } )
75  			ReferenceAndListParam theCondition, 
76    
77  			@Description(shortDefinition="The provided date search value falls within the episode of care's period")
78  			@OptionalParam(name="date")
79  			DateRangeParam theDate, 
80    
81  			@Description(shortDefinition="")
82  			@OptionalParam(name="identifier")
83  			TokenAndListParam theIdentifier,
84    
85  			@Description(shortDefinition="Incoming Referral Request")
86  			@OptionalParam(name="incomingreferral", targetTypes={  } )
87  			ReferenceAndListParam theIncomingreferral, 
88    
89  			@Description(shortDefinition="The organization that has assumed the specific responsibilities of this EpisodeOfCare")
90  			@OptionalParam(name="organization", targetTypes={  } )
91  			ReferenceAndListParam theOrganization, 
92    
93  			@Description(shortDefinition="")
94  			@OptionalParam(name="patient", targetTypes={  } )
95  			ReferenceAndListParam thePatient, 
96    
97  			@Description(shortDefinition="The current status of the Episode of Care as provided (does not check the status history collection)")
98  			@OptionalParam(name="status")
99  			TokenAndListParam theStatus,
100   
101 			@Description(shortDefinition="A Practitioner or Organization allocated to the care team for this EpisodeOfCare")
102 			@OptionalParam(name="team-member", targetTypes={  } )
103 			ReferenceAndListParam theTeam_member, 
104   
105 			@Description(shortDefinition="")
106 			@OptionalParam(name="type")
107 			TokenAndListParam theType,
108 
109 			@RawParam
110 			Map<String, List<String>> theAdditionalRawParams,
111 
112 			@IncludeParam(reverse=true)
113 			Set<Include> theRevIncludes,
114 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
115 			@OptionalParam(name="_lastUpdated")
116 			DateRangeParam theLastUpdated, 
117 
118 			@IncludeParam(allow= {
119 					"EpisodeOfCare:care-manager" , 					"EpisodeOfCare:condition" , 					"EpisodeOfCare:incomingreferral" , 					"EpisodeOfCare:organization" , 					"EpisodeOfCare:patient" , 					"EpisodeOfCare:team-member" , 						"EpisodeOfCare:care-manager" , 					"EpisodeOfCare:condition" , 					"EpisodeOfCare:incomingreferral" , 					"EpisodeOfCare:organization" , 					"EpisodeOfCare:patient" , 					"EpisodeOfCare:team-member" , 						"EpisodeOfCare:care-manager" , 					"EpisodeOfCare:condition" , 					"EpisodeOfCare:incomingreferral" , 					"EpisodeOfCare:organization" , 					"EpisodeOfCare:patient" , 					"EpisodeOfCare:team-member" , 						"EpisodeOfCare:care-manager" , 					"EpisodeOfCare:condition" , 					"EpisodeOfCare:incomingreferral" , 					"EpisodeOfCare:organization" , 					"EpisodeOfCare:patient" , 					"EpisodeOfCare:team-member" , 						"EpisodeOfCare:care-manager" , 					"EpisodeOfCare:condition" , 					"EpisodeOfCare:incomingreferral" , 					"EpisodeOfCare:organization" , 					"EpisodeOfCare:patient" , 					"EpisodeOfCare:team-member" , 						"EpisodeOfCare:care-manager" , 					"EpisodeOfCare:condition" , 					"EpisodeOfCare:incomingreferral" , 					"EpisodeOfCare:organization" , 					"EpisodeOfCare:patient" , 					"EpisodeOfCare:team-member" 					, "*"
120 			}) 
121 			Set<Include> theIncludes,
122 			
123 			@Sort 
124 			SortSpec theSort,
125 			
126 			@ca.uhn.fhir.rest.annotation.Count
127 			Integer theCount,
128 
129 			SummaryEnum theSummaryMode,
130 
131 			SearchTotalModeEnum theSearchTotalMode
132 
133 			) {
134 		startRequest(theServletRequest);
135 		try {
136 			SearchParameterMap paramMap = new SearchParameterMap();
137 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
138 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
139 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
140 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
141 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
142 			paramMap.add("_has", theHas);
143 			paramMap.add("_id", the_id);
144 			paramMap.add("_language", the_language);
145 			paramMap.add("care-manager", theCare_manager);
146 			paramMap.add("condition", theCondition);
147 			paramMap.add("date", theDate);
148 			paramMap.add("identifier", theIdentifier);
149 			paramMap.add("incomingreferral", theIncomingreferral);
150 			paramMap.add("organization", theOrganization);
151 			paramMap.add("patient", thePatient);
152 			paramMap.add("status", theStatus);
153 			paramMap.add("team-member", theTeam_member);
154 			paramMap.add("type", theType);
155 			paramMap.setRevIncludes(theRevIncludes);
156 			paramMap.setLastUpdated(theLastUpdated);
157 			paramMap.setIncludes(theIncludes);
158 			paramMap.setSort(theSort);
159 			paramMap.setCount(theCount);
160 			paramMap.setSummaryMode(theSummaryMode);
161 			paramMap.setSearchTotalMode(theSearchTotalMode);
162 
163 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
164 
165 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
166 			return retVal;
167 		} finally {
168 			endRequest(theServletRequest);
169 		}
170 	}
171 
172 }