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;
|
||||
if (CommonUtil.isNotNullOrEmpty(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");
|
||||
} else if (!voucher.getPasienId().equals(pasienId)) {
|
||||
throw new ServiceVOException("Kode voucher tidak sesuai dengan pasien yang diperuntukkan");
|
||||
}
|
||||
p.setVoucherPaket(voucher);
|
||||
pasienDaftarDao.save(p);
|
||||
});
|
||||
@ -2302,11 +2300,9 @@ public class PelayananPasienServiceImpl extends BaseVoServiceImpl implements Pel
|
||||
Integer ibuId = null;
|
||||
if (CommonUtil.isNotNullOrEmpty(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");
|
||||
} else if (!voucher.getPasienId().equals(pasienId)) {
|
||||
throw new ServiceVOException("Kode voucher tidak sesuai dengan pasien yang diperuntukkan");
|
||||
}
|
||||
p.setVoucherPaket(voucher);
|
||||
pasienDaftarDao.save(p);
|
||||
});
|
||||
@ -2509,6 +2505,8 @@ public class PelayananPasienServiceImpl extends BaseVoServiceImpl implements Pel
|
||||
@Override
|
||||
public boolean isValidVoucher(String kodeVoucher, String noRegistrasi) {
|
||||
VoucherPaket voucher = getVoucher(kodeVoucher, noRegistrasi, false);
|
||||
if (voucher.getIsSelesai())
|
||||
throw new ServiceVOException("Kode voucher sudah selesai digunakan");
|
||||
List<PasienDaftar> listPendaftaranLain = pasienDaftarDao
|
||||
.findByPasienAndVoucherAndNoRegistrasiNot(voucher.getPasienId(), kodeVoucher, noRegistrasi);
|
||||
listPendaftaranLain.forEach(p -> {
|
||||
@ -2558,12 +2556,10 @@ public class PelayananPasienServiceImpl extends BaseVoServiceImpl implements Pel
|
||||
Integer ibuId = null;
|
||||
if (CommonUtil.isNotNullOrEmpty(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");
|
||||
} else if (CommonUtil.isNotNullOrEmpty(pendaftaran)
|
||||
&& !pendaftaran.getPasien().getId().equals(voucher.getPasienId())) {
|
||||
throw new ServiceVOException("Kode voucher tidak sesuai dengan pasien yang diperuntukkan");
|
||||
}
|
||||
return voucher;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user