KNH_Project
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
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.bestray.healthcareemr.Controller;
import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.vo.TBedMaster;
import com.bestray.healthcarecommonutil.service.BedMasterService;
import com.bestray.healthcarecommonutil.vo.TRoomMaster;
import java.util.List;
import java.util.Vector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException;
import org.springframework.stereotype.Controller;
/**
*
* @author dell
*/
@Controller
public class BedMasterController {
@Autowired
private BedMasterService bedMasterService;
public void saveBedMaster(TBedMaster roomMaster)throws ProcessingException,HibernateOptimisticLockingFailureException {
try{
bedMasterService.saveBedMaster(roomMaster);
}catch( HibernateOptimisticLockingFailureException | ProcessingException e){
throw e;
}
}
public Vector<Vector<String>> getBedsList(String expr,int min,int max)throws ProcessingException {
try{
return bedMasterService.getBedsList(expr,min,max);
}catch(ProcessingException e){
throw e;
}
}
public void deleteBedMaster(Long bedId)throws ProcessingException,IllegalArgumentException {
try{
bedMasterService.deleteBedMaster(bedId);
}catch( IllegalArgumentException | ProcessingException e){
throw e;
}
}
public TBedMaster getBedValues(Long bedId)throws ProcessingException {
try{
return bedMasterService.getBedDetailsById(bedId);
}catch(ProcessingException e){
throw e;
}
}
public int numberOfBedRecords(String expr)throws ProcessingException {
try{
return bedMasterService.numberOfBedRecords(expr);
}catch(ProcessingException e){
throw e;
}
}
public Vector<TBedMaster> getAllBeds() throws ProcessingException {
try{
Vector beds = new Vector();
TBedMaster bed ;
List<TBedMaster> bedList = bedMasterService.findAllBeds();
for(TBedMaster bm:bedList){
bed = new TBedMaster();
bed.setId(bm.getId());
bed.setBedNumber(bm.getBedNumber());
beds.addElement(bed);
}
return beds;
}catch(ProcessingException e){
throw e;
}
}
public boolean isBedAvailable(String bedNumber,TRoomMaster room)throws ProcessingException {
boolean flag =false;
try{
List<TBedMaster> bedNumbers = bedMasterService.findAllBedsByRoom(room);
for(TBedMaster bed:bedNumbers){
if(bed.getBedNumber().equalsIgnoreCase(bedNumber)){
flag = true;
}
}
return flag;
}catch(ProcessingException e){
throw e;
}
}
public int bedsAvailableByRoom(TRoomMaster room)throws ProcessingException {
try{
return bedMasterService.findAllBedsByRoom(room).size();
}catch(ProcessingException e){
throw e;
}
}
}
|
Revision |
Author |
Commited |
Message |
1
|
girijabapi
|
Fri 27 Jul, 2018 13:29:42 +0000 |
|