Subversion Repository Public Repository

Satyam

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
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.healthcareemr.DaoImpl;

import com.bestray.healthcarecommonutil.exception.DataAccessException;
import com.bestray.healthcarecommonutil.vo.TAppointment;
import com.bestray.healthcarecommonutil.vo.TDepartmentMaster;
import com.bestray.healthcarecommonutil.vo.TDoctorInformation;
import com.bestray.healthcarecommonutil.vo.TPatient;
import com.bestray.healthcareemr.Dao.AppointmentDao;
import com.bestray.healthcareemr.Vo.TOpdNumbers;
import java.util.Date;
import java.util.List;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

// TODO: Auto-generated Javadoc
/**
 * The Class AppointmentDaoImpl.
 *
 * @author sumitHome
 */
@Repository
public class AppointmentDaoImpl extends HibernateDaoSupport implements AppointmentDao{
    
    @Autowired
    public void init(SessionFactory sessionfactory) {
        setSessionFactory(sessionfactory);
    }
    /* 
    /* (non-Javadoc)
     * @see com.bestray.healthcareemr.Dao.AppointmentDao#findAllAppointmentList(java.util.Date, java.lang.Integer)
     */
    @Override
    public List<TAppointment> findAllAppointmentList(Date dt,TDoctorInformation doctorId)throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("findAllAppointmentList",dt,doctorId);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    /* (non-Javadoc)
     * @see com.bestray.healthcareemr.Dao.AppointmentDao#updateAppointmentDetails(com.bestray.healthcareemr.Vo.TAppointment)
     */
    @Override
    public void updateAppointmentDetails(TAppointment appointment)throws DataAccessException,HibernateOptimisticLockingFailureException {
        try{
            getHibernateTemplate().update(appointment);
        }catch(HibernateOptimisticLockingFailureException  e){
            throw e;
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    /* (non-Javadoc)
     * @see com.bestray.healthcareemr.Dao.AppointmentDao#saveAppointmentDetails(com.bestray.healthcareemr.Vo.TAppointment)
     */
    @Override
    public void saveAppointmentDetails(TAppointment appointment)throws DataAccessException,HibernateOptimisticLockingFailureException {
        try{             
            getHibernateTemplate().save(appointment);            
        }catch(Exception e){
           throw new DataAccessException();
        }
    }

    /* (non-Javadoc)
     * @see com.bestray.healthcareemr.Dao.AppointmentDao#findAppointmentListByPatient(java.lang.Long)
     */
    @Override
    public List<TAppointment> findAppointmentListByPatient(TPatient patientId)throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("findAppointmentListByPatient",patientId);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    /* (non-Javadoc)
     * @see com.bestray.healthcareemr.Dao.AppointmentDao#findAppointmentDetailsById(java.lang.Long)
     */
    @Override
    public TAppointment findAppointmentDetailsById(Long appointmentID)throws DataAccessException {
        try{
            return getHibernateTemplate().get(TAppointment.class, appointmentID);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    /* (non-Javadoc)
     * @see com.bestray.healthcareemr.Dao.AppointmentDao#findAppointmentListByDate(java.util.Date)
     */
    @Override
    public List<TAppointment> findAppointmentListByDate(Date appointmentDate)throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("findAppointmentListByDate",appointmentDate);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }
    
    /* (non-Javadoc)
     * @see com.bestray.healthcareemr.Dao.AppointmentDao#saveAllAppointments(java.util.List)
     */
    @Override
    public void saveAllAppointments(List<TAppointment> appointments) throws DataAccessException{
         try{            
            getHibernateTemplate().saveOrUpdateAll(appointments);            
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    /* (non-Javadoc)
     * @see com.bestray.healthcareemr.Dao.AppointmentDao#findPreviousAppointments(java.lang.Long, java.util.Date, java.lang.Long, java.lang.Integer, java.lang.String)
     */
    @Override
    public List<TAppointment> findPreviousAppointments(TPatient patientId, Date AppointmentDate, TDepartmentMaster departmentId, TDoctorInformation doctorName, String visitType) throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("findPreviousAppointments",patientId ,AppointmentDate ,departmentId ,doctorName ,visitType );
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    /* (non-Javadoc)
     * @see com.bestray.healthcareemr.Dao.AppointmentDao#findAppointmentListByDoctor(java.util.Date, java.lang.Long, java.lang.Integer)
     */
    @Override
    public List<TAppointment> findAppointmentListByDoctor(Date appointmentDate, TDepartmentMaster departmentId, TDoctorInformation doctorId) throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("findAppointmentListByDoctor",appointmentDate,departmentId,doctorId);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    /* (non-Javadoc)
     * @see com.bestray.healthcareemr.Dao.AppointmentDao#findAppointmentListByDepartment(java.util.Date, java.lang.Long)
     */
    @Override
    public List<TAppointment> findAppointmentListByDepartment(Date appointmentDate, TDepartmentMaster departmentId) throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("findAppointmentListByDepartment",appointmentDate,departmentId);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    /* (non-Javadoc)
     * @see com.bestray.healthcareemr.Dao.AppointmentDao#getMaxOpdNumber()
     */
    @Override
    public TOpdNumbers getMaxOpdNumber(Date date) throws DataAccessException {
        try{
            List<TOpdNumbers> opdList = getHibernateTemplate().findByNamedQuery("findMaxOpd",date);
            return (opdList.isEmpty())?null:opdList.get(0);
        }catch(Exception e){
            e.printStackTrace();
            throw new DataAccessException();
        }
    }

    /* (non-Javadoc)
     * @see com.bestray.healthcareemr.Dao.AppointmentDao#saveOpdDetail(com.bestray.healthcareemr.Vo.TOpdNumbers)
     */
    @Override
    public void saveOpdDetail(TOpdNumbers opdnumber) throws DataAccessException {
        try{             
            getHibernateTemplate().save(opdnumber);            
        }catch(Exception e){
           throw new DataAccessException();
        }
    }

    /* (non-Javadoc)
     * @see com.bestray.healthcareemr.Dao.AppointmentDao#getVisitOccurance(java.lang.Long)
     */
    @Override
    public int getVisitOccurance(TPatient patient) throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("findVisitOccuranceByPatient",patient).size();
        }catch(Exception e){
            throw new DataAccessException();
        }
    }
    
     @Override
    public List<TAppointment> showAppointmentList(Date date, String month,int monthyear,int year,TDepartmentMaster dept) throws DataAccessException {
        try{
            if(dept!=null){
                return getHibernateTemplate().findByNamedQuery("getAppointmentListByDeptWise",date,month,monthyear,year,dept);
            }else{
                return getHibernateTemplate().findByNamedQuery("getAppointmentList",date,month,monthyear,year);
            }
        }catch(Exception e){
            throw new DataAccessException();
        }
    }
     
}

Commits for Satyam/AuroCareEMR/src/main/java/com/bestray/healthcareemr/DaoImpl/AppointmentDaoImpl.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Fri 20 Jul, 2018 05:59:17 +0000