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