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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.healthcareinpatient.daoimpl;

import com.bestray.healthcarecommonutil.exception.DataAccessException;
import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.vo.TAnesthesiaDetails;
import com.bestray.healthcarecommonutil.vo.TDiagnosisMaster;
import com.bestray.healthcarecommonutil.vo.TEncounterDiagnosis;
import com.bestray.healthcarecommonutil.vo.TEncounterHistoryVisit;
import com.bestray.healthcarecommonutil.vo.TEncounterMedication;
import com.bestray.healthcarecommonutil.vo.TEncounterProcedure;
import com.bestray.healthcarecommonutil.vo.TEncounterVitalSign;
import com.bestray.healthcarecommonutil.vo.TPatEncToDo;
import com.bestray.healthcarecommonutil.vo.TPatient;
import com.bestray.healthcarecommonutil.vo.TPatientEncounter;
import com.bestray.healthcareinpatient.dao.InpatientRoundingDao;
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;

/**
 *
 * @author user3
 */
@Repository
public class InpatientRoundingDaoImpl extends HibernateDaoSupport implements InpatientRoundingDao{
private TEncounterVitalSign encounterVitalSign;
    @Autowired
    public void init(SessionFactory sessionfactory) {
        setSessionFactory(sessionfactory);
    }
    
    @Override
    public TPatientEncounter getIPEncounterByPatient(TPatient patient) throws DataAccessException {
        try{
            List<TPatientEncounter> enc = getHibernateTemplate().findByNamedQuery("getIPEncounterByPatient", patient);
            return enc.size()>0?enc.get(0):null;
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    /*@Override
    public TPatientEncounter createIPEncounter(TPatientEncounter enc) throws DataAccessException,HibernateOptimisticLockingFailureException {
        try{ 
            getHibernateTemplate().saveOrUpdate(enc);
            return enc;
        }catch(HibernateOptimisticLockingFailureException e){
            throw e;
        }catch(Exception e){
            throw new DataAccessException();
        }
    }*/

    @Override
    public TEncounterMedication saveMedication(TEncounterMedication encounterMedication) throws DataAccessException,HibernateOptimisticLockingFailureException {
        try{ 
            getHibernateTemplate().saveOrUpdate(encounterMedication);
            return encounterMedication;
        }catch(HibernateOptimisticLockingFailureException e){
            throw e;
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public List<TEncounterMedication> getEncounterMedication(TPatientEncounter encounter,int status) throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("medicationbyenc", encounter,status);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }
    
    @Override
    public List<TEncounterMedication> getEncounterMedicationByEncIdnType(TPatientEncounter encounter,String type) throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("medicationByEncidnType", encounter,type);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }
     @Override
     public List<TEncounterProcedure>  getEncounterProcedureByEncIdnType(TPatientEncounter encounter,String type) throws DataAccessException{
         try{
            return getHibernateTemplate().findByNamedQuery("procedureByEncidnType", encounter,type);
        }catch(Exception e){
            throw new DataAccessException();
        }
     }
     
     @Override
    public List<TEncounterVitalSign> getEncounterVitalsignByEncIdnType(TPatientEncounter encounter,String type) throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("vitalSignByEncidnType", encounter,type);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public TEncounterMedication getEncounterMedicationById(Long encmedid) throws DataAccessException {
        try{
            return getHibernateTemplate().get(TEncounterMedication.class, encmedid);
        }catch(Exception e){
            e.printStackTrace();
            throw new DataAccessException();
        }
    }

   /* @Override
    public TEncounterMedication reorderMedication(TEncounterMedication encmed) throws DataAccessException {
        throw new UnsupportedOperationException("Not supported yet.");
    }*/

    @Override
    public TPatientEncounter getEncounterById(Long encid) throws DataAccessException {
        try{
            return getHibernateTemplate().get(TPatientEncounter.class, encid);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public TEncounterProcedure saveProcedure(TEncounterProcedure encounterProcedure) throws DataAccessException,HibernateOptimisticLockingFailureException {
        try{ 
            getHibernateTemplate().saveOrUpdate(encounterProcedure);
            return encounterProcedure;
        }catch(HibernateOptimisticLockingFailureException e){
            throw e;
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public List<TEncounterProcedure> getEncounterProcedure(TPatientEncounter encounter) throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("procedurebyenc", encounter);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public TEncounterProcedure getEncProcedure(Long encprocid) throws DataAccessException {
        try{
            return getHibernateTemplate().get(TEncounterProcedure.class, encprocid);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public void deleteEncProc(TEncounterProcedure encproc) throws DataAccessException {
        try{
            getHibernateTemplate().delete(encproc);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public TPatientEncounter saveIPEncounter(TPatientEncounter inpatenc) throws DataAccessException {
        try{
            getHibernateTemplate().saveOrUpdate(inpatenc);
            return inpatenc;
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public TPatEncToDo saveToDo(TPatEncToDo encounterToDo) throws DataAccessException, HibernateOptimisticLockingFailureException {
        try{ 
            getHibernateTemplate().saveOrUpdate(encounterToDo);
            return encounterToDo;
        }catch(HibernateOptimisticLockingFailureException e){
            throw e;
        }catch(Exception e){
            throw new DataAccessException();
        }
    }
//Prasanta
    @Override
    public void saveVitalSign(TEncounterVitalSign encounterVitalSign) throws ProcessingException, HibernateOptimisticLockingFailureException {
        try{ 
            getHibernateTemplate().saveOrUpdate(encounterVitalSign);
        }catch(HibernateOptimisticLockingFailureException e){
            throw e;
        }catch(Exception e){
            throw new ProcessingException();
        }
    }
    public void saveAnesthesiaDetails(TAnesthesiaDetails anesthesiaDetails) throws DataAccessException, HibernateOptimisticLockingFailureException {
        try{ 
            getHibernateTemplate().saveOrUpdate(anesthesiaDetails);
            
        }catch(HibernateOptimisticLockingFailureException e){
            throw e;
        }catch(Exception e){
            throw new DataAccessException();
        }
    }
    public List<TEncounterVitalSign> getAllVitalSignsForPatient(TPatientEncounter encounter) throws DataAccessException{
        try{
            return getHibernateTemplate().findByNamedQuery("getVitalSignListByInpatientId",encounter);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }
     public TEncounterVitalSign  getVitalsignDetailById(long id)throws ProcessingException {
        try{ 
        return getHibernateTemplate().get(TEncounterVitalSign.class,id);             
        }catch(HibernateOptimisticLockingFailureException e){
            throw e;
        }catch(Exception e){
            e.printStackTrace();
            throw new ProcessingException();
        }
    }
     public TAnesthesiaDetails  getAnesthesiaDetailById(long id)throws DataAccessException {
        try{ 
        return getHibernateTemplate().get(TAnesthesiaDetails.class,id);             
        }catch(HibernateOptimisticLockingFailureException e){
            e.printStackTrace();
            throw e;
        }catch(Exception e){
            e.printStackTrace();
            throw new DataAccessException();
        } 
     }
     public List<TAnesthesiaDetails> getAllAnesthesiaDetailsForPatient(TPatientEncounter encounter) throws DataAccessException{
       try{
            return getHibernateTemplate().findByNamedQuery("getAnesthesiaListByInpatientId",encounter);
        }catch(Exception e){
            e.printStackTrace();
            throw new DataAccessException();
        }  
     }
    @Override
    public List<TPatEncToDo> getTasksForEncounter(TPatientEncounter encounter) throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("tasksbyenc", encounter);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public TPatEncToDo getEncTask(Long enctaskid) throws DataAccessException {
        try{
            return getHibernateTemplate().get(TPatEncToDo.class, enctaskid);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public void deleteEncTask(TPatEncToDo enctodo) throws DataAccessException {
        try{
            getHibernateTemplate().delete(enctodo);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }
    @Override
    public void deleteAnesthesiaDetails(TAnesthesiaDetails anesthesiaDetails) throws DataAccessException {
        try{
            getHibernateTemplate().delete(anesthesiaDetails);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }
    @Override
    public void deleteEncounterMedication(TEncounterMedication encmed) throws DataAccessException{
       try{
            getHibernateTemplate().delete(encmed);
        }catch(Exception e){
            throw new DataAccessException();
        } 
    }
    @Override
    public void deleteEncounterProcedure(TEncounterProcedure encProc)throws DataAccessException{
        try{
            getHibernateTemplate().delete(encProc);
        }catch(Exception e){
            throw new DataAccessException();
        } 
    }
    
     @Override
    public void  deleteEncounterVitalSign(TEncounterVitalSign encVitalSign)throws DataAccessException{
        try{
            getHibernateTemplate().delete(encVitalSign);
        }catch(Exception e){
            e.printStackTrace();
            throw new DataAccessException();
        } 
    }
    @Override
    public void saveEncounterHistoryVisit(TEncounterHistoryVisit encounterHistoryVisit) throws DataAccessException,HibernateOptimisticLockingFailureException {
        try{ 
            getHibernateTemplate().save(encounterHistoryVisit);
        }catch(HibernateOptimisticLockingFailureException e){
            throw e;
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public List<TDiagnosisMaster> getDiagnosis(String expr) throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("findAllDiagnosisList","%"+expr+"%","%"+expr+"%");
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public TEncounterDiagnosis saveDiagnosis(TEncounterDiagnosis encounterDiagnosis) throws DataAccessException {
        try{ 
            getHibernateTemplate().saveOrUpdate(encounterDiagnosis);
            return encounterDiagnosis;
        }catch(HibernateOptimisticLockingFailureException e){
            throw e;
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public List<TEncounterDiagnosis> getEncounterDiagnosis(TPatientEncounter encounter) throws DataAccessException {
        try{
            return getHibernateTemplate().findByNamedQuery("diagnosisbyenc", encounter);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }

    @Override
    public void deleteEncDiag(TEncounterDiagnosis ediag) throws DataAccessException {
        try{
            getHibernateTemplate().delete(ediag);
        }catch(Exception e){
            throw new DataAccessException();
        }
    }
    
}

Commits for Satyam/AuroCareHealthCareInPatient/src/main/java/com/bestray/healthcareinpatient/daoimpl/InpatientRoundingDaoImpl.java

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