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
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.bestray.healthcareemr.ServiceImpl;
import com.bestray.healthcarecommonutil.exception.DataAccessException;
import com.bestray.healthcarecommonutil.exception.HealthCareException;
import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.serviceimpl.DoctorInformationServiceImpl;
import com.bestray.healthcarecommonutil.vo.TOutDoorBilling;
import com.bestray.healthcarecommonutil.vo.TPatient;
import com.bestray.healthcareemr.Dao.OutDoorBillingDao;
import com.bestray.healthcareemr.Service.OutDoorBillingService;
import com.bestray.healthcareinpatient.dao.InPatientChargeDao;
import com.bestray.healthcareinpatient.serviceimpl.InPatientChargeServiceImpl;
import java.text.SimpleDateFormat;
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 dell
*/
public class OutDoorBillingServiceImpl implements OutDoorBillingService{
@Autowired
private OutDoorBillingDao outDoorBillingDao;
private TOutDoorBilling outDoorBillingInvoiceNo;
private SimpleDateFormat sdf,sdf1;
public OutDoorBillingServiceImpl() {
sdf = new SimpleDateFormat("dd-MM-yyyy");
sdf1 = new SimpleDateFormat("yyyy-MM-dd");
}
@Override
public void saveOutDoorBilling(TOutDoorBilling outDoorBilling) throws ProcessingException {
System.out.println("inside billing serviceImpl");
try {
outDoorBillingDao.saveOutDoorBilling(outDoorBilling);
}catch(HibernateOptimisticLockingFailureException e){
Logger.getLogger(OutDoorBillingServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw e;
}catch(DataAccessException e){
Logger.getLogger(OutDoorBillingServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new ProcessingException();
}catch(Exception e){
Logger.getLogger(OutDoorBillingServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new HealthCareException("Error in Saving...");
}
}
@Override
public List<TOutDoorBilling> getBillingDetails() throws ProcessingException {
try{
return outDoorBillingDao.getBillingDetails();
}catch(DataAccessException e){
Logger.getLogger(UserSetupServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new ProcessingException();
}
}
@Override
public TPatient findPatientDetailsById(Long id) throws ProcessingException {
System.out.println("inside Billing ServiceImpl ----22222");
try{
return outDoorBillingDao.findPatientDetailsById(id);
}catch(DataAccessException e){
Logger.getLogger(OutDoorBillingServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new ProcessingException();
}
}
@Override
public TOutDoorBilling getChargeDetailById(long id) throws ProcessingException {
try {
return outDoorBillingDao.getChargeDetailById(id);
}catch(DataAccessException e){
Logger.getLogger(OutDoorBillingServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new ProcessingException();
}catch(Exception e){
Logger.getLogger(OutDoorBillingServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new HealthCareException("Error in populating Charge Detail...");
}
}
@Override
public void saveOutDoorBillingElse(TOutDoorBilling outDoorBilling) throws ProcessingException {
System.out.println("inside edit serviceImpl");
try {
outDoorBillingDao.saveOutDoorBillingElse(outDoorBilling);
}catch(HibernateOptimisticLockingFailureException e){
Logger.getLogger(OutDoorBillingServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw e;
}catch(DataAccessException e){
Logger.getLogger(OutDoorBillingServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new ProcessingException();
}catch(Exception e){
Logger.getLogger(OutDoorBillingServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new HealthCareException("Error in Saving...");
}
}
@Override
public String getInvoiceNo() throws ProcessingException {
System.out.println("inside invoice serviceimpl----------------");
try{
String InvoiceNo=outDoorBillingDao.getInvoiceNoToInsert();
/* long idpartnum=Integer.parseInt(InvoiceNo.substring(8));
idpartnum+=1;
String date = sdf.format(new Date());
date = date.substring(0,2)+date.substring(3,5)+date.substring(6);
if(idpartnum<10){
return String.valueOf(date+"0"+idpartnum);
}else{
return String.valueOf(date+idpartnum);
}*/
return InvoiceNo;
}catch(DataAccessException | NumberFormatException e){
throw new HealthCareException("Failed To Get The Max Patient Id");
}
}
}
|