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
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.bestray.healthcareinpatient.serviceimpl;
import com.bestray.healthcarecommonutil.dao.BedMasterDao;
import com.bestray.healthcarecommonutil.exception.DataAccessException;
import com.bestray.healthcarecommonutil.exception.HealthCareException;
import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.vo.TBedMaster;
import com.bestray.healthcarecommonutil.vo.TEncounterHistoryVisit;
import com.bestray.healthcarecommonutil.vo.TEncounterMedication;
import com.bestray.healthcarecommonutil.vo.TEncounterProcedure;
import com.bestray.healthcarecommonutil.vo.TInpatentAdmission;
import com.bestray.healthcarecommonutil.vo.TPatient;
import com.bestray.healthcarecommonutil.vo.TPatientEncounter;
import com.bestray.healthcareinpatient.dao.InPatientAdmissionDao;
import com.bestray.healthcareinpatient.dao.InPatientDischargeDao;
import com.bestray.healthcareinpatient.dao.InpatientRoundingDao;
import com.bestray.healthcareinpatient.service.InPatientDischargeService;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException;
/**
*
* @author User1
*/
public class InPatientDischargeServiceImpl implements InPatientDischargeService{
@Autowired
private InPatientDischargeDao inPatientDischargeDao;
@Autowired
private InPatientAdmissionDao inPatientAdmissionDao;
@Autowired
private BedMasterDao bedMasterDao;
@Autowired
private InpatientRoundingDao inpatientRoundingDao;
@Override
public List<TEncounterMedication> getInPatientMedicationForDischarge(TPatientEncounter encounter) throws ProcessingException {
try{
return inPatientDischargeDao.getInPatientMedicationForDischarge(encounter);
}catch (DataAccessException ex) {
Logger.getLogger(InPatientDischargeServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
throw new ProcessingException();
}catch(Exception e){
Logger.getLogger(InPatientDischargeServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new HealthCareException("Error in retriving...");
}
}
@Override
public List<TEncounterProcedure> getInPatientProcedureForDischarge(TPatientEncounter encounter) throws ProcessingException {
try{
return inPatientDischargeDao.getInPatientProcedureForDischarge(encounter);
}catch (DataAccessException ex) {
Logger.getLogger(InPatientDischargeServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
throw new ProcessingException();
}catch(Exception e){
Logger.getLogger(InPatientDischargeServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new HealthCareException("Error in retriving...");
}
}
@Override
public void dischargeInPatient(TInpatentAdmission inPatientAdmission) throws ProcessingException {
try{
TBedMaster bed = inPatientAdmission.getBedId();
bed.setAllocationStatus("UNALLOCATED");
bedMasterDao.updateBedMaster(bed);
TBedMaster updtaedBed = bedMasterDao.getBedDetailsById(bed.getId());
inPatientAdmission.setBedId(updtaedBed);
inPatientAdmission.setInpatientStatus("DISCHARGED");
inPatientAdmissionDao.updateInPatientAdmission(inPatientAdmission);
/*List<TInpatentAdmission> inPatientIds = inPatientAdmissionDao.getUndischargedInPatient(inPatientAdmission.getPatientId());
for(TInpatentAdmission inpatAdd:inPatientIds ){
inpatAdd.setInpatientStatus("DISCHARGED");
inPatientAdmissionDao.updateInPatientAdmission(inpatAdd);
}*/
}catch(HibernateOptimisticLockingFailureException e){
Logger.getLogger(InPatientDischargeServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw e;
}catch(DataAccessException e){
Logger.getLogger(InPatientDischargeServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new ProcessingException();
}catch(Exception e){
Logger.getLogger(InPatientDischargeServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new HealthCareException("Error in Saving...");
}
}
@Override
public void saveEncounterHistoryVisit(TEncounterHistoryVisit encounterHistoryVisit) throws ProcessingException, HibernateOptimisticLockingFailureException {
try{
inpatientRoundingDao.saveEncounterHistoryVisit(encounterHistoryVisit);
TPatientEncounter ipEnc = encounterHistoryVisit.getEncounterVisitHistory();
ipEnc.setEncStatus("Closed");
inpatientRoundingDao.saveIPEncounter(ipEnc);
}catch(HibernateOptimisticLockingFailureException e){
Logger.getLogger(InPatientDischargeServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw e;
}catch(DataAccessException e){
Logger.getLogger(InPatientDischargeServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new ProcessingException();
}catch(Exception e){
Logger.getLogger(InPatientDischargeServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new HealthCareException("Error in Saving...");
}
}
@Override
public List<TPatientEncounter> getCloseEncountersByPatient(TPatient patientId) throws ProcessingException {
try{
return inPatientDischargeDao.getCloseEncountersByPatient(patientId);
}catch (DataAccessException ex) {
Logger.getLogger(InPatientDischargeServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
throw new ProcessingException();
}catch(Exception e){
Logger.getLogger(InPatientDischargeServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new HealthCareException("Error in retriving...");
}
}
}
|