Subversion Repository Public Repository

Aurocare_27_07_2018

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

import com.bestray.healthcarecommonutil.exception.DataAccessException;
import com.bestray.healthcarecommonutil.exception.HealthCareException;
import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.vo.TAppointment;
import com.bestray.healthcarecommonutil.vo.TDoctorInformation;
import com.bestray.healthcarecommonutil.vo.TInpatentAdmission;
import com.bestray.healthcarecommonutil.vo.TPatient;
import com.bestray.healthcareinpatient.dao.AvailableInpatientDao;
import com.bestray.healthcareinpatient.service.AvailableInpatientService;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author User1
 */
@Transactional
@Service
public class AvailableInpatientServiceImpl implements AvailableInpatientService{
    
    @Autowired
    private AvailableInpatientDao availableInpatientDao;
    
    private SimpleDateFormat sdfDatetime = new SimpleDateFormat("dd-MM-yyyy hh:mm a");
    
    private SimpleDateFormat sdfDate = new SimpleDateFormat("dd-MM-yyyy");

    @Transactional(readOnly = true)
    public Vector<Vector<String>> getAdmittedInPatientList() throws ProcessingException {
        try {
            Vector<Vector<String>> AdmittedInPatientLists = new Vector<Vector<String>>();
            Vector<String> AdmittedInPatientVector;
            List<TInpatentAdmission> AdmittedInPatList;
            try {
                AdmittedInPatList = availableInpatientDao.getAdmittedInPatientList();
            }catch(DataAccessException e){
                Logger.getLogger(AvailableInpatientServiceImpl.class.getName()).log(Level.SEVERE, null, e);
                throw new ProcessingException();
            }
            for (TInpatentAdmission inpatAdmission : AdmittedInPatList) {
                AdmittedInPatientVector = new Vector<String>();
                AdmittedInPatientVector.add(String.valueOf(inpatAdmission.getId()));
                AdmittedInPatientVector.add(String.valueOf(inpatAdmission.getInpatientId()));
                TPatient patient = inpatAdmission.getPatientId();
                String patientFullName = null;
                if(patient.getPatientMName()!=null){
                    patientFullName = patient.getPatientFName()+" "+patient.getPatientMName()+" "+patient.getPatientLName();
                }else if(patient.getPatientMName()==null){
                    patientFullName = patient.getPatientFName()+" "+patient.getPatientLName();
                }
                AdmittedInPatientVector.add(patient.getPatientId());
                AdmittedInPatientVector.add(patientFullName);
                 
                AdmittedInPatientVector.add(inpatAdmission.getIpdNo());
                
                AdmittedInPatientVector.add(sdfDate.format(patient.getBirthDate()));
                TDoctorInformation doctor = inpatAdmission.getDoctorId();
                AdmittedInPatientVector.add(String.valueOf(doctor.getDoctor_name()));
                AdmittedInPatientVector.add(String.valueOf(doctor.getDoctor_department_id().getDepartmentName()));
                AdmittedInPatientVector.add(sdfDatetime.format(inpatAdmission.getAdmissionDate()));
                AdmittedInPatientVector.add(String.valueOf(inpatAdmission.getBedId().getRoom().getRoomNumber()));
                AdmittedInPatientVector.add(String.valueOf(inpatAdmission.getBedId().getBedNumber()));
                AdmittedInPatientLists.add(AdmittedInPatientVector);
            }
            return AdmittedInPatientLists;
        } catch (Exception ex) {
            Logger.getLogger(AvailableInpatientServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
            throw new HealthCareException("Error in populating appointments list");
        }
    }

    @Override
    public List<TInpatentAdmission> getInPatientList() throws ProcessingException {
        try {
            return availableInpatientDao.getAdmittedInPatientList();
        } catch(DataAccessException ex) {
            Logger.getLogger(AvailableInpatientServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
            throw new HealthCareException("Error in retriving list");
        }
    }
    
    @Override
    public List<TAppointment> getIPAppointmentListByDate(Date appointmentDate) throws ProcessingException {
        List<TAppointment> opAppointments = new ArrayList<TAppointment>();
        try {
             List<TAppointment> appointments = availableInpatientDao.findAppointmentListByDate(appointmentDate);
             for(TAppointment appt:appointments){
                 if(appt.getScheduleType().equalsIgnoreCase("In Patient")){
                     opAppointments.add(appt);
                 }
             }
             return opAppointments;
        }catch(DataAccessException e){
                Logger.getLogger(InpatientRoundingServiceImpl.class.getName()).log(Level.SEVERE, null, e);
                throw new ProcessingException();
        } catch (Exception ex) {
                Logger.getLogger(InpatientRoundingServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
                throw new HealthCareException("Error in populating appointments list");
        }
    }

    @Override
    public TAppointment getInPatientAppointmentByID(long appointmentID) throws ProcessingException {
        try {
            return availableInpatientDao.getInPatientAppointmentByID(appointmentID);
        } catch(DataAccessException ex) {
            Logger.getLogger(AvailableInpatientServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
            throw new HealthCareException("Error in retriving list");
        }
    }

    @Override
    public List<TInpatentAdmission> getDischargeIPListByDate(Date fromDate, Date toDate)throws ProcessingException {
        try {
            return availableInpatientDao.getDischargeIPListByDate(fromDate,toDate);
        } catch(DataAccessException ex) {
            Logger.getLogger(AvailableInpatientServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
            throw new HealthCareException("Error in retriving list");
        }
    }

    @Override
    public List<TInpatentAdmission> getAllAdmissionDateByPatient(TPatient patient) throws ProcessingException {
        try {
            return availableInpatientDao.getAllAdmissionDateByPatient(patient);
        } catch(DataAccessException ex) {
            Logger.getLogger(AvailableInpatientServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
            throw new HealthCareException("Error in retriving list");
        }
    }
}

Commits for Aurocare_27_07_2018/AuroCareHealthCareInPatient/src/main/java/com/bestray/healthcareinpatient/serviceimpl/AvailableInpatientServiceImpl.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Fri 27 Jul, 2018 07:21:55 +0000