Update PelayananPasienServiceImpl.java
validasi voucher untuk pasien anak dan pemasangan validasi selesai paket
This commit is contained in:
parent
2f9cb2a7cd
commit
854b783c5a
@ -2283,11 +2283,9 @@ public class PelayananPasienServiceImpl extends BaseVoServiceImpl implements Pel
|
|||||||
Integer ibuId = null;
|
Integer ibuId = null;
|
||||||
if (CommonUtil.isNotNullOrEmpty(ibuNoCm))
|
if (CommonUtil.isNotNullOrEmpty(ibuNoCm))
|
||||||
ibuId = pasienDao.findIdByNoCm(ibuNoCm);
|
ibuId = pasienDao.findIdByNoCm(ibuNoCm);
|
||||||
if (CommonUtil.isNotNullOrEmpty(ibuId) && !voucher.getPasienId().equals(ibuId)) {
|
if ((CommonUtil.isNotNullOrEmpty(ibuId) && !voucher.getPasienId().equals(ibuId))
|
||||||
|
|| (CommonUtil.isNullOrEmpty(ibuId) && !voucher.getPasienId().equals(pasienId)))
|
||||||
throw new ServiceVOException("Kode voucher tidak sesuai dengan pasien yang diperuntukkan");
|
throw new ServiceVOException("Kode voucher tidak sesuai dengan pasien yang diperuntukkan");
|
||||||
} else if (!voucher.getPasienId().equals(pasienId)) {
|
|
||||||
throw new ServiceVOException("Kode voucher tidak sesuai dengan pasien yang diperuntukkan");
|
|
||||||
}
|
|
||||||
p.setVoucherPaket(voucher);
|
p.setVoucherPaket(voucher);
|
||||||
pasienDaftarDao.save(p);
|
pasienDaftarDao.save(p);
|
||||||
});
|
});
|
||||||
@ -2302,11 +2300,9 @@ public class PelayananPasienServiceImpl extends BaseVoServiceImpl implements Pel
|
|||||||
Integer ibuId = null;
|
Integer ibuId = null;
|
||||||
if (CommonUtil.isNotNullOrEmpty(ibuNoCm))
|
if (CommonUtil.isNotNullOrEmpty(ibuNoCm))
|
||||||
ibuId = pasienDao.findIdByNoCm(ibuNoCm);
|
ibuId = pasienDao.findIdByNoCm(ibuNoCm);
|
||||||
if (CommonUtil.isNotNullOrEmpty(ibuId) && !voucher.getPasienId().equals(ibuId)) {
|
if ((CommonUtil.isNotNullOrEmpty(ibuId) && !voucher.getPasienId().equals(ibuId))
|
||||||
|
|| (CommonUtil.isNullOrEmpty(ibuId) && !voucher.getPasienId().equals(pasienId)))
|
||||||
throw new ServiceVOException("Kode voucher tidak sesuai dengan pasien yang diperuntukkan");
|
throw new ServiceVOException("Kode voucher tidak sesuai dengan pasien yang diperuntukkan");
|
||||||
} else if (!voucher.getPasienId().equals(pasienId)) {
|
|
||||||
throw new ServiceVOException("Kode voucher tidak sesuai dengan pasien yang diperuntukkan");
|
|
||||||
}
|
|
||||||
p.setVoucherPaket(voucher);
|
p.setVoucherPaket(voucher);
|
||||||
pasienDaftarDao.save(p);
|
pasienDaftarDao.save(p);
|
||||||
});
|
});
|
||||||
@ -2509,6 +2505,8 @@ public class PelayananPasienServiceImpl extends BaseVoServiceImpl implements Pel
|
|||||||
@Override
|
@Override
|
||||||
public boolean isValidVoucher(String kodeVoucher, String noRegistrasi) {
|
public boolean isValidVoucher(String kodeVoucher, String noRegistrasi) {
|
||||||
VoucherPaket voucher = getVoucher(kodeVoucher, noRegistrasi, false);
|
VoucherPaket voucher = getVoucher(kodeVoucher, noRegistrasi, false);
|
||||||
|
if (voucher.getIsSelesai())
|
||||||
|
throw new ServiceVOException("Kode voucher sudah selesai digunakan");
|
||||||
List<PasienDaftar> listPendaftaranLain = pasienDaftarDao
|
List<PasienDaftar> listPendaftaranLain = pasienDaftarDao
|
||||||
.findByPasienAndVoucherAndNoRegistrasiNot(voucher.getPasienId(), kodeVoucher, noRegistrasi);
|
.findByPasienAndVoucherAndNoRegistrasiNot(voucher.getPasienId(), kodeVoucher, noRegistrasi);
|
||||||
listPendaftaranLain.forEach(p -> {
|
listPendaftaranLain.forEach(p -> {
|
||||||
@ -2558,12 +2556,10 @@ public class PelayananPasienServiceImpl extends BaseVoServiceImpl implements Pel
|
|||||||
Integer ibuId = null;
|
Integer ibuId = null;
|
||||||
if (CommonUtil.isNotNullOrEmpty(ibuNoCm))
|
if (CommonUtil.isNotNullOrEmpty(ibuNoCm))
|
||||||
ibuId = pasienDao.findIdByNoCm(ibuNoCm);
|
ibuId = pasienDao.findIdByNoCm(ibuNoCm);
|
||||||
if (CommonUtil.isNotNullOrEmpty(ibuId) && !voucher.getPasienId().equals(ibuId)) {
|
if ((CommonUtil.isNotNullOrEmpty(ibuId) && !voucher.getPasienId().equals(ibuId))
|
||||||
|
|| (CommonUtil.isNullOrEmpty(ibuId) && CommonUtil.isNotNullOrEmpty(pendaftaran)
|
||||||
|
&& !pendaftaran.getPasien().getId().equals(voucher.getPasienId())))
|
||||||
throw new ServiceVOException("Kode voucher tidak sesuai dengan pasien yang diperuntukkan");
|
throw new ServiceVOException("Kode voucher tidak sesuai dengan pasien yang diperuntukkan");
|
||||||
} else if (CommonUtil.isNotNullOrEmpty(pendaftaran)
|
|
||||||
&& !pendaftaran.getPasien().getId().equals(voucher.getPasienId())) {
|
|
||||||
throw new ServiceVOException("Kode voucher tidak sesuai dengan pasien yang diperuntukkan");
|
|
||||||
}
|
|
||||||
return voucher;
|
return voucher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user