private int getDoctorSessionValue() { int sessionVal = 0; Doctor doctor = doctorService.get(Long.parseLong(doctorID)); SessionPayment sp = spService.getSpExistPatient(id); for (DoctorSession ds : sp.getListOfSession()) { if (ds.getDoctor().getId() == doctor.getId()) { sessionVal += ds.getSum(); } } return sessionVal; }
public List<Doctor> getDoctors() { try { SessionPayment sp = spService.getSpExistPatient(id); if (sp == null) return null; List<Doctor> doctors = new LinkedList<Doctor>(); List<DoctorSession> list = sp.getListOfSession(); for (DoctorSession ds : list) { if (!doctors.contains(ds.getDoctor())) { doctors.add(ds.getDoctor()); } } if (doctors.isEmpty()) return null; else return doctors; } catch (Exception e) { return null; } }
public int checkVal() { Doctor doctor = doctorService.get(Long.parseLong(doctorID)); SessionPayment sp = spService.getSpExistPatient(id); int sessionVal = 0; for (DoctorSession ds : sp.getListOfSession()) { if (ds.getDoctor().getId() == doctor.getId()) { sessionVal += ds.getSum(); } } int paymentVal = 0; for (Payment p : sp.getListOfPayment()) { Doctor doctor1 = paymentService.get(p.getId()).getDoctor(); if (doctor1 != null) if (doctor1.getId() == doctor.getId()) { paymentVal += p.getValue(); } } return sessionVal - paymentVal; }