|
@@ -1,5 +1,6 @@ |
1 |
1 |
|
package com.bestray.security.controller; |
2 |
2 |
|
|
|
3 |
+ |
import javax.ws.rs.QueryParam; |
3 |
4 |
|
import javax.ws.rs.core.Response; |
4 |
5 |
|
|
5 |
6 |
|
import org.springframework.beans.factory.annotation.Autowired; |
|
@@ -13,15 +14,18 @@ |
13 |
14 |
|
import org.springframework.web.bind.annotation.RequestMethod; |
14 |
15 |
|
import org.springframework.web.bind.annotation.RestController; |
15 |
16 |
|
|
|
17 |
+ |
import com.bestray.model.entity.SpecialityMaster; |
16 |
18 |
|
import com.bestray.model.security.Authority; |
17 |
|
- |
import com.bestray.model.security.DepartmentMaster; |
18 |
|
- |
import com.bestray.model.security.PharmacyMaster; |
19 |
|
- |
import com.bestray.model.security.SpecialityMaster; |
|
19 |
+ |
import com.bestray.model.entity.DepartmentMaster; |
|
20 |
+ |
import com.bestray.model.entity.ExpenditureMaster; |
|
21 |
+ |
import com.bestray.model.entity.LabMaster; |
|
22 |
+ |
import com.bestray.model.entity.PharmacyMaster; |
20 |
23 |
|
import com.bestray.security.repository.UserRepository; |
21 |
24 |
|
import com.bestray.security.repository.DepartmentRepository; |
22 |
25 |
|
import com.bestray.security.repository.SpecialityRepository; |
23 |
26 |
|
import com.bestray.security.service.FacilityMasterService; |
24 |
27 |
|
import com.bestray.security.service.JwtUserDetailsService; |
|
28 |
+ |
import com.fasterxml.jackson.core.JsonProcessingException; |
25 |
29 |
|
|
26 |
30 |
|
@RestController |
27 |
31 |
|
public class FacilitySetupController { |
|
@@ -69,6 +73,15 @@ |
69 |
73 |
|
return new ResponseEntity(HttpStatus.OK); |
70 |
74 |
|
} |
71 |
75 |
|
|
|
76 |
+ |
//searchDepartment |
|
77 |
+ |
@RequestMapping(value = "${jwt.route.departmentsearch.path}", method = RequestMethod.POST) |
|
78 |
+ |
public ResponseEntity searchDepartment(@QueryParam("name") String name) throws AuthenticationException, ExceptionHandler_delete, JsonProcessingException{ |
|
79 |
+ |
System.out.println("name->"+name); |
|
80 |
+ |
String json=facilityMasterService.searchDepartment(); |
|
81 |
+ |
return new ResponseEntity(json,HttpStatus.OK); |
|
82 |
+ |
} |
|
83 |
+ |
|
|
84 |
+ |
|
72 |
85 |
|
|
73 |
86 |
|
//saveSpeciality |
74 |
87 |
|
@RequestMapping(value = "${jwt.route.user.speciality.path}",method = RequestMethod.POST) |
|
@@ -96,10 +109,18 @@ |
96 |
109 |
|
//deleteSpeciality |
97 |
110 |
|
@RequestMapping(value = "${jwt.route.specialitydelete.path}", method = RequestMethod.DELETE) |
98 |
111 |
|
public ResponseEntity deleteSpeciality(@PathVariable("id")String id) throws AuthenticationException, ExceptionHandler_delete{ |
99 |
|
- |
facilityMasterService.daleteSpeciality(id); |
|
112 |
+ |
facilityMasterService.delateSpeciality(id); |
100 |
113 |
|
return new ResponseEntity(HttpStatus.OK); |
101 |
114 |
|
} |
102 |
115 |
|
|
|
116 |
+ |
|
|
117 |
+ |
//searchSpecility |
|
118 |
+ |
@RequestMapping(value = "${jwt.route.specialitysearch.path}", method = RequestMethod.POST) |
|
119 |
+ |
public ResponseEntity searchSpeciality() throws AuthenticationException, ExceptionHandler_delete, JsonProcessingException{ |
|
120 |
+ |
String json=facilityMasterService.searchSpeciality(); |
|
121 |
+ |
return new ResponseEntity(json,HttpStatus.OK); |
|
122 |
+ |
} |
|
123 |
+ |
|
103 |
124 |
|
//savePharmacy |
104 |
125 |
|
@RequestMapping(value = "${jwt.route.user.pharmacy.path}",method = RequestMethod.POST) |
105 |
126 |
|
public ResponseEntity savePharmacy(@RequestBody PharmacyMaster pharmacyMaster) throws RoleExceptionHandler, ExceptionHandler_update{ |
|
@@ -111,7 +132,7 @@ |
111 |
132 |
|
} |
112 |
133 |
|
|
113 |
134 |
|
|
114 |
|
- |
//editSpeciality |
|
135 |
+ |
//editPharmacy |
115 |
136 |
|
@RequestMapping(value = "${jwt.route.pharmacyupdate.path}",method = RequestMethod.PUT) |
116 |
137 |
|
public ResponseEntity editPharmacy(@PathVariable("id")String id,@RequestBody PharmacyMaster pharmacyMaster) throws RoleExceptionHandler, ExceptionHandler_update{ |
117 |
138 |
|
PharmacyMaster pharmacy_new=new PharmacyMaster(); |
|
@@ -123,10 +144,93 @@ |
123 |
144 |
|
return new ResponseEntity(pharmacy_new,HttpStatus.OK); |
124 |
145 |
|
} |
125 |
146 |
|
|
126 |
|
- |
//deleteSpeciality |
|
147 |
+ |
//deletePharmacy |
127 |
148 |
|
@RequestMapping(value = "${jwt.route.pharmacydelete.path}", method = RequestMethod.DELETE) |
128 |
149 |
|
public ResponseEntity deletePharmacy(@PathVariable("id")String id) throws AuthenticationException, ExceptionHandler_delete{ |
129 |
150 |
|
facilityMasterService.daletePharmacy(id); |
130 |
151 |
|
return new ResponseEntity(HttpStatus.OK); |
131 |
152 |
|
} |
|
153 |
+ |
|
|
154 |
+ |
|
|
155 |
+ |
//searchPharmacy |
|
156 |
+ |
@RequestMapping(value = "${jwt.route.pharmacysearch.path}", method = RequestMethod.POST) |
|
157 |
+ |
public ResponseEntity searchPharmacy() throws AuthenticationException, ExceptionHandler_delete, JsonProcessingException{ |
|
158 |
+ |
String json=facilityMasterService.searchPharmacy(); |
|
159 |
+ |
return new ResponseEntity(json,HttpStatus.OK); |
|
160 |
+ |
} |
|
161 |
+ |
|
|
162 |
+ |
//saveLab |
|
163 |
+ |
@RequestMapping(value = "${jwt.route.user.lab.path}",method = RequestMethod.POST) |
|
164 |
+ |
public ResponseEntity saveLab(@RequestBody LabMaster labMaster) throws RoleExceptionHandler, ExceptionHandler_update{ |
|
165 |
+ |
|
|
166 |
+ |
facilityMasterService.saveLab(labMaster); |
|
167 |
+ |
// System.out.println("2speciality-->"+speciality.getSpecialityName()); |
|
168 |
+ |
|
|
169 |
+ |
return new ResponseEntity(labMaster,HttpStatus.OK); |
|
170 |
+ |
} |
|
171 |
+ |
|
|
172 |
+ |
|
|
173 |
+ |
//editLab |
|
174 |
+ |
@RequestMapping(value = "${jwt.route.labupdate.path}",method = RequestMethod.PUT) |
|
175 |
+ |
public ResponseEntity editLab(@PathVariable("id")String id,@RequestBody LabMaster labMaster) throws RoleExceptionHandler, ExceptionHandler_update{ |
|
176 |
+ |
LabMaster lab_new=new LabMaster(); |
|
177 |
+ |
lab_new.setLabName(labMaster.getLabName()); |
|
178 |
+ |
lab_new.setLabAddress(labMaster.getLabAddress()); |
|
179 |
+ |
lab_new.setLabPhonenumber(labMaster.getLabPhonenumber()); |
|
180 |
+ |
lab_new.setLabZipcode(labMaster.getLabZipcode()); |
|
181 |
+ |
facilityMasterService.editLab(lab_new, id); |
|
182 |
+ |
return new ResponseEntity(lab_new,HttpStatus.OK); |
|
183 |
+ |
} |
|
184 |
+ |
|
|
185 |
+ |
//deletePharmacy |
|
186 |
+ |
@RequestMapping(value = "${jwt.route.labdelete.path}", method = RequestMethod.DELETE) |
|
187 |
+ |
public ResponseEntity deleteLab(@PathVariable("id")String id) throws AuthenticationException, ExceptionHandler_delete{ |
|
188 |
+ |
facilityMasterService.delateLab(id); |
|
189 |
+ |
return new ResponseEntity(HttpStatus.OK); |
|
190 |
+ |
} |
|
191 |
+ |
|
|
192 |
+ |
|
|
193 |
+ |
//searchPharmacy |
|
194 |
+ |
@RequestMapping(value = "${jwt.route.labsearch.path}", method = RequestMethod.POST) |
|
195 |
+ |
public ResponseEntity searchLab() throws AuthenticationException, ExceptionHandler_delete, JsonProcessingException{ |
|
196 |
+ |
String json=facilityMasterService.searchLab(); |
|
197 |
+ |
return new ResponseEntity(json,HttpStatus.OK); |
|
198 |
+ |
} |
|
199 |
+ |
|
|
200 |
+ |
|
|
201 |
+ |
//saveExpenditure |
|
202 |
+ |
@RequestMapping(value = "${jwt.route.user.expenditure.path}",method = RequestMethod.POST) |
|
203 |
+ |
public ResponseEntity saveExpenditure(@RequestBody ExpenditureMaster expenditureMaster) throws RoleExceptionHandler, ExceptionHandler_update{ |
|
204 |
+ |
|
|
205 |
+ |
facilityMasterService.saveExpenditure(expenditureMaster); |
|
206 |
+ |
// System.out.println("2speciality-->"+speciality.getSpecialityName()); |
|
207 |
+ |
|
|
208 |
+ |
return new ResponseEntity(expenditureMaster,HttpStatus.OK); |
|
209 |
+ |
} |
|
210 |
+ |
|
|
211 |
+ |
//editExpenditure |
|
212 |
+ |
@RequestMapping(value = "${jwt.route.expenditureupdate.path}",method = RequestMethod.PUT) |
|
213 |
+ |
public ResponseEntity editExpenditure(@PathVariable("id")String id,@RequestBody ExpenditureMaster expenditure) throws RoleExceptionHandler, ExceptionHandler_update{ |
|
214 |
+ |
ExpenditureMaster expenditure_new=new ExpenditureMaster(); |
|
215 |
+ |
expenditure_new.setAmount(expenditure.getAmount()); |
|
216 |
+ |
expenditure_new.setExpenditureType(expenditure.getExpenditureType()); |
|
217 |
+ |
expenditure_new.setExpenditure_note(expenditure.getExpenditure_note()); |
|
218 |
+ |
expenditure_new.setExpenditureDate(expenditure.getExpenditureDate()); |
|
219 |
+ |
facilityMasterService.editExpenditure(expenditure_new, id); |
|
220 |
+ |
return new ResponseEntity(expenditure_new,HttpStatus.OK); |
|
221 |
+ |
} |
|
222 |
+ |
|
|
223 |
+ |
//deleteExpenditure |
|
224 |
+ |
@RequestMapping(value = "${jwt.route.expendituredelete.path}", method = RequestMethod.DELETE) |
|
225 |
+ |
public ResponseEntity deleteExpenditure(@PathVariable("id")String id) throws AuthenticationException, ExceptionHandler_delete{ |
|
226 |
+ |
facilityMasterService.deleteExpenditure(id); |
|
227 |
+ |
return new ResponseEntity(HttpStatus.OK); |
|
228 |
+ |
} |
|
229 |
+ |
|
|
230 |
+ |
// //searchExpenditure |
|
231 |
+ |
// @RequestMapping(value = "${jwt.route.labsearch.path}", method = RequestMethod.POST) |
|
232 |
+ |
// public ResponseEntity searchExpenditure() throws AuthenticationException, ExceptionHandler_delete, JsonProcessingException{ |
|
233 |
+ |
// String json=facilityMasterService.searchExpenditure(); |
|
234 |
+ |
// return new ResponseEntity(json,HttpStatus.OK); |
|
235 |
+ |
// } |
132 |
236 |
|
} |