Subversion Repository Public Repository

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
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
/*
 * 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.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.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{

    @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 TEncounterMedication getEncounterMedicationById(Long encmedid) throws DataAccessException {
        try{
            return getHibernateTemplate().get(TEncounterMedication.class, encmedid);
        }catch(Exception e){
            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();
        }
    }

    @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 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 KNH_Project/HealthCareInPatient/src/main/java/com/bestray/healthcareinpatient/daoimpl/InpatientRoundingDaoImpl.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Fri 27 Jul, 2018 13:29:42 +0000