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
package com.bestray.security.controller;

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.security.Authority;
import com.bestray.model.security.DepartmentMaster;
import com.bestray.model.security.PharmacyMaster;
import com.bestray.model.security.SpecialityMaster;
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;

@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);
	    }
	    
   
	    //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.daleteSpeciality(id);
	    		return new ResponseEntity(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);
	    }
	    
	    
	    //editSpeciality
	    @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);
	    }
	    
	    //deleteSpeciality
	    @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);
	    }
}

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

Diff revisions: vs.
Revision Author Commited Message
2 girijabapi picture girijabapi Thu 11 Oct, 2018 04:44:08 +0000

initial commit