Subversion Repository Public Repository

emr_demo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
package com.bestray.security.controller;

import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bestray.model.entity.SpecialityMaster;
import com.bestray.model.security.Authority;
import com.bestray.model.entity.DepartmentMaster;
import com.bestray.model.entity.ExpenditureMaster;
import com.bestray.model.entity.LabMaster;
import com.bestray.model.entity.PharmacyMaster;
import com.bestray.security.repository.UserRepository;
import com.bestray.security.repository.DepartmentRepository;
import com.bestray.security.repository.SpecialityRepository;
import com.bestray.security.service.FacilityMasterService;
import com.bestray.security.service.JwtUserDetailsService;
import com.fasterxml.jackson.core.JsonProcessingException;

@RestController
public class FacilitySetupController {
	
	    @Autowired
		private DepartmentRepository departmentRepository;
	    @Autowired
	    private SpecialityRepository specialityRepository;
	    @Autowired
	    @Qualifier("jwtUserDetailsService")
	    private UserDetailsService userDetailsService;
	    @Autowired
	    private FacilityMasterService facilityMasterService;
	    
	    //saveDepartment
	    @RequestMapping(value = "${jwt.route.user.department.path}",method = RequestMethod.POST)
	    public ResponseEntity saveDepartment(@RequestBody DepartmentMaster departmentMaster) throws RoleExceptionHandler, ExceptionHandler_update{

	          System.out.println();
	          System.out.println();
	          facilityMasterService.saveDepartment(departmentMaster);
 
	  	return new ResponseEntity(departmentMaster,HttpStatus.OK);
	    }
	    
	    //editDepartment
	    @RequestMapping(value = "${jwt.route.departmentupdate.path}",method = RequestMethod.PUT)
	    public ResponseEntity editDepartment(@PathVariable("id")String id,@RequestBody DepartmentMaster departmentMaster) throws RoleExceptionHandler, ExceptionHandler_update{
             DepartmentMaster dept_master=new DepartmentMaster();
	         dept_master.setDepartmentName(departmentMaster.getDepartmentName());
	         dept_master.setDepartmentAddress(departmentMaster.getDepartmentAddress());
	         dept_master.setDepartmentphoneno(departmentMaster.getDepartmentphoneno());
	         dept_master.setDepartmentZipcode(departmentMaster.getDepartmentZipcode());
	         
	  		 facilityMasterService.editDepartment(dept_master, id);

	  	       return new ResponseEntity(departmentMaster,HttpStatus.OK);
	    }
	    
	    
	    //deleteDepartment
	    @RequestMapping(value = "${jwt.route.departmentdelete.path}", method = RequestMethod.DELETE)
	    public ResponseEntity deleteDepartment(@PathVariable("id")String id) throws AuthenticationException, ExceptionHandler_delete{
	    	facilityMasterService.deleteDepartment(id);
	    		return new ResponseEntity(HttpStatus.OK);
	    }
	    
	    //searchDepartment
	    @RequestMapping(value = "${jwt.route.departmentsearch.path}", method = RequestMethod.POST)
	    public ResponseEntity searchDepartment(@QueryParam("name") String name) throws AuthenticationException, ExceptionHandler_delete, JsonProcessingException{
	    	System.out.println("name->"+name);
	    	String json=facilityMasterService.searchDepartment();
	    		return new ResponseEntity(json,HttpStatus.OK);
	    }
	    
	    
   
	    //saveSpeciality
	    @RequestMapping(value = "${jwt.route.user.speciality.path}",method = RequestMethod.POST)
	    public ResponseEntity saveSpeciality(@RequestBody SpecialityMaster speciality) throws RoleExceptionHandler, ExceptionHandler_update{

	          System.out.println("speciality-->"+speciality.getSpecialityName());
	          System.out.println();
	  		  facilityMasterService.saveSpeciality(speciality);
	  		  System.out.println("2speciality-->"+speciality.getSpecialityName());
	      
	  	       return new ResponseEntity(HttpStatus.OK);
	    }
	    
	    
	    //editSpeciality
	    @RequestMapping(value = "${jwt.route.specialityupdate.path}",method = RequestMethod.PUT)
	    public ResponseEntity editSpecialty(@PathVariable("id")String id,@RequestBody SpecialityMaster speciality) throws RoleExceptionHandler, ExceptionHandler_update{
	    	SpecialityMaster spec_master=new SpecialityMaster();
	    	spec_master.setSpecialityName(speciality.getSpecialityName());
	  		facilityMasterService.editSpeciality(spec_master, id);
	  	    return new ResponseEntity(speciality,HttpStatus.OK);
	    }
	    
	    
	    //deleteSpeciality
	    @RequestMapping(value = "${jwt.route.specialitydelete.path}", method = RequestMethod.DELETE)
	    public ResponseEntity deleteSpeciality(@PathVariable("id")String id) throws AuthenticationException, ExceptionHandler_delete{
	    	facilityMasterService.delateSpeciality(id);
	    		return new ResponseEntity(HttpStatus.OK);
	    }
	    
	    
	    //searchSpecility
	    @RequestMapping(value = "${jwt.route.specialitysearch.path}", method = RequestMethod.POST)
	    public ResponseEntity searchSpeciality() throws AuthenticationException, ExceptionHandler_delete, JsonProcessingException{
	    	String json=facilityMasterService.searchSpeciality();
	    		return new ResponseEntity(json,HttpStatus.OK);
	    }
	    
	    //savePharmacy
	    @RequestMapping(value = "${jwt.route.user.pharmacy.path}",method = RequestMethod.POST)
	    public ResponseEntity savePharmacy(@RequestBody PharmacyMaster pharmacyMaster) throws RoleExceptionHandler, ExceptionHandler_update{
 
	  		  facilityMasterService.savePharmacy(pharmacyMaster);
	  		 // System.out.println("2speciality-->"+speciality.getSpecialityName());
	      
	  	       return new ResponseEntity(pharmacyMaster,HttpStatus.OK);
	    }
	    
	    
	    //editPharmacy
	    @RequestMapping(value = "${jwt.route.pharmacyupdate.path}",method = RequestMethod.PUT)
	    public ResponseEntity editPharmacy(@PathVariable("id")String id,@RequestBody PharmacyMaster pharmacyMaster) throws RoleExceptionHandler, ExceptionHandler_update{
	    	PharmacyMaster pharmacy_new=new PharmacyMaster();
	    	pharmacy_new.setPharmacyName(pharmacyMaster.getPharmacyName());
	    	pharmacy_new.setPharmacyAddress(pharmacyMaster.getPharmacyAddress());
	    	pharmacy_new.setPharmacyPhonenumber(pharmacyMaster.getPharmacyPhonenumber());
	    	pharmacy_new.setPharmacyZipcode(pharmacyMaster.getPharmacyZipcode());
	  		facilityMasterService.editPharmacy(pharmacy_new, id);
	  	    return new ResponseEntity(pharmacy_new,HttpStatus.OK);
	    }
	    
	    //deletePharmacy
	    @RequestMapping(value = "${jwt.route.pharmacydelete.path}", method = RequestMethod.DELETE)
	    public ResponseEntity deletePharmacy(@PathVariable("id")String id) throws AuthenticationException, ExceptionHandler_delete{
	    	facilityMasterService.daletePharmacy(id);
	    		return new ResponseEntity(HttpStatus.OK);
	    }
	    
	    
	  //searchPharmacy
	    @RequestMapping(value = "${jwt.route.pharmacysearch.path}", method = RequestMethod.POST)
	    public ResponseEntity searchPharmacy() throws AuthenticationException, ExceptionHandler_delete, JsonProcessingException{
	    	String json=facilityMasterService.searchPharmacy();
	    		return new ResponseEntity(json,HttpStatus.OK);
	    }
	    
	    //saveLab
	    @RequestMapping(value = "${jwt.route.user.lab.path}",method = RequestMethod.POST)
	    public ResponseEntity saveLab(@RequestBody LabMaster labMaster) throws RoleExceptionHandler, ExceptionHandler_update{
 
	  		  facilityMasterService.saveLab(labMaster);
	  		 // System.out.println("2speciality-->"+speciality.getSpecialityName());
	      
	  	       return new ResponseEntity(labMaster,HttpStatus.OK);
	    }
	    
	    
	    //editLab
	    @RequestMapping(value = "${jwt.route.labupdate.path}",method = RequestMethod.PUT)
	    public ResponseEntity editLab(@PathVariable("id")String id,@RequestBody LabMaster labMaster) throws RoleExceptionHandler, ExceptionHandler_update{
	    	LabMaster lab_new=new LabMaster();
	    	lab_new.setLabName(labMaster.getLabName());
	    	lab_new.setLabAddress(labMaster.getLabAddress());
	    	lab_new.setLabPhonenumber(labMaster.getLabPhonenumber());
	    	lab_new.setLabZipcode(labMaster.getLabZipcode());
	  		facilityMasterService.editLab(lab_new, id);
	  	    return new ResponseEntity(lab_new,HttpStatus.OK);
	    }
	    
	    //deletePharmacy
	    @RequestMapping(value = "${jwt.route.labdelete.path}", method = RequestMethod.DELETE)
	    public ResponseEntity deleteLab(@PathVariable("id")String id) throws AuthenticationException, ExceptionHandler_delete{
	    	facilityMasterService.delateLab(id);
	    		return new ResponseEntity(HttpStatus.OK);
	    }
	    
	    
	  //searchPharmacy
	    @RequestMapping(value = "${jwt.route.labsearch.path}", method = RequestMethod.POST)
	    public ResponseEntity searchLab() throws AuthenticationException, ExceptionHandler_delete, JsonProcessingException{
	    	String json=facilityMasterService.searchLab();
	    		return new ResponseEntity(json,HttpStatus.OK);
	    }
	    
	    
	    //saveExpenditure
	    @RequestMapping(value = "${jwt.route.user.expenditure.path}",method = RequestMethod.POST)
	    public ResponseEntity saveExpenditure(@RequestBody ExpenditureMaster expenditureMaster) throws RoleExceptionHandler, ExceptionHandler_update{
 
	  		  facilityMasterService.saveExpenditure(expenditureMaster);
	  		 // System.out.println("2speciality-->"+speciality.getSpecialityName());
	      
	  	       return new ResponseEntity(expenditureMaster,HttpStatus.OK);
	    }
	    
	    //editExpenditure
	    @RequestMapping(value = "${jwt.route.expenditureupdate.path}",method = RequestMethod.PUT)
	    public ResponseEntity editExpenditure(@PathVariable("id")String id,@RequestBody ExpenditureMaster expenditure) throws RoleExceptionHandler, ExceptionHandler_update{
	    	ExpenditureMaster expenditure_new=new ExpenditureMaster();
	    	expenditure_new.setAmount(expenditure.getAmount());
	    	expenditure_new.setExpenditureType(expenditure.getExpenditureType());
	    	expenditure_new.setExpenditure_note(expenditure.getExpenditure_note());
	    	expenditure_new.setExpenditureDate(expenditure.getExpenditureDate());
	  		facilityMasterService.editExpenditure(expenditure_new, id);
	  	    return new ResponseEntity(expenditure_new,HttpStatus.OK);
	    }
	    
	    //deleteExpenditure
	    @RequestMapping(value = "${jwt.route.expendituredelete.path}", method = RequestMethod.DELETE)
	    public ResponseEntity deleteExpenditure(@PathVariable("id")String id) throws AuthenticationException, ExceptionHandler_delete{
	    	facilityMasterService.deleteExpenditure(id);
	    		return new ResponseEntity(HttpStatus.OK);
	    }
	    
//	  //searchExpenditure
//	    @RequestMapping(value = "${jwt.route.labsearch.path}", method = RequestMethod.POST)
//	    public ResponseEntity searchExpenditure() throws AuthenticationException, ExceptionHandler_delete, JsonProcessingException{
//	    	String json=facilityMasterService.searchExpenditure();
//	    		return new ResponseEntity(json,HttpStatus.OK);
//	    }
}

Commits for emr_demo/web_emr - Copy/src/main/java/com/bestray/security/controller/FacilitySetupController.java

Diff revisions: vs.
Revision Author Commited Message
4 Diff Diff girijabapi picture girijabapi Tue 23 Oct, 2018 06:23:53 +0000

adding labMaster
adding expenditure

2 girijabapi picture girijabapi Thu 11 Oct, 2018 04:44:08 +0000

initial commit