Update service pelayanan pasien

Penyesuaian validasi produk paket persalinan saja yang menggunankan kode voucher ibu
This commit is contained in:
Salman Manoe 2024-11-18 13:33:01 +07:00
parent 1c1ae2d23e
commit 7993077571
5 changed files with 53 additions and 47 deletions

View File

@ -13,9 +13,11 @@ import java.util.Set;
* @since 21 Sep 2023
*/
public interface MapProdukPaketDao extends JpaRepository<MapProdukPaket, String> {
@Query("select mpaket.paketId from MapProdukPaket mpaket")
Set<Integer> findPaketId();
@Query("select mpaket.produkEntriId from MapProdukPaket mpaket")
List<Integer> findProdukEntriId();
}

View File

@ -46,6 +46,7 @@ import static com.jasamedika.medifirst2000.constants.Master.Ruangan.*;
import static com.jasamedika.medifirst2000.constants.Master.SubUnitKerja.*;
import static com.jasamedika.medifirst2000.constants.Master.TipePegawai.PURNA_WAKTU;
import static com.jasamedika.medifirst2000.constants.Master.UnitKerja.KSM_OBGYN;
import static com.jasamedika.medifirst2000.entities.constant.TipePaket.PERSALINAN;
import static com.jasamedika.medifirst2000.enums.JenisMappingProdukPaket.PERAWAT;
import static com.jasamedika.medifirst2000.enums.JenisMappingProdukPaket.TINDAKAN_UTAMA;
@ -151,6 +152,9 @@ public class PelayananPasienServiceImpl extends BaseVoServiceImpl implements Pel
@Autowired
private MapJabatanProfesiDao mapJabatanProfesiDao;
@Autowired
private ProdukPaketDao produkPaketDao;
@Override
public Map<String, Object> savePelayananPasien(PelayananPasienVO vo) {
Map<String, Object> result = new HashMap<>();
@ -3663,6 +3667,7 @@ public class PelayananPasienServiceImpl extends BaseVoServiceImpl implements Pel
private void diskonPaket(String kodeVoucher, List<TagihanPendaftaranDto> dtoList) {
VoucherPaket voucher = getVoucher(kodeVoucher, false);
Optional<ProdukPaket> produkPaket = produkPaketDao.findById(voucher.getPaketId());
List<String> norecPelayanan = dtoList.stream().map(TagihanPendaftaranDto::getNoRec)
.collect(Collectors.toList());
List<PelayananPasien> byNorecPelayanan = pelayananPasienDao.findAll(norecPelayanan);
@ -3675,11 +3680,14 @@ 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))
|| (CommonUtil.isNullOrEmpty(ibuId) && !voucher.getPasienId().equals(pasienId)))
throw new ServiceVOException("Kode voucher tidak sesuai dengan pasien yang diperuntukkan");
p.setVoucherPaket(voucher);
pasienDaftarDao.save(p);
if (CommonUtil.isNotNullOrEmpty(produkPaket) && produkPaket.isPresent()
&& PERSALINAN.equals(produkPaket.get().getTipePaket())) {
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");
p.setVoucherPaket(voucher);
pasienDaftarDao.save(p);
}
});
}
{
@ -3945,15 +3953,19 @@ public class PelayananPasienServiceImpl extends BaseVoServiceImpl implements Pel
if (noRegistrasi.isEmpty())
throw new ServiceVOException("Nomor registrasi harus diisi");
VoucherPaket voucher = getVoucher(kodeVoucher, basicValidation);
Optional<ProdukPaket> produkPaket = produkPaketDao.findById(voucher.getPaketId());
PasienDaftar pendaftaran = pasienDaftarDao.findByNoRegistrasi(noRegistrasi);
String ibuNoCm = pendaftaran.getPasien().getReportDisplay();
Integer ibuId = null;
if (CommonUtil.isNotNullOrEmpty(ibuNoCm))
ibuId = pasienDao.findIdByNoCm(ibuNoCm);
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");
if (CommonUtil.isNotNullOrEmpty(produkPaket) && produkPaket.isPresent()
&& PERSALINAN.equals(produkPaket.get().getTipePaket())) {
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");
}
return voucher;
}

View File

@ -1,7 +1,6 @@
package com.jasamedika.medifirst2000.entities;
import com.jasamedika.medifirst2000.base.BaseTransaction;
import com.jasamedika.medifirst2000.entities.constant.JenisPaket;
import com.jasamedika.medifirst2000.enums.JenisMappingProdukPaket;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
@ -9,7 +8,6 @@ import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import static javax.persistence.EnumType.STRING;
import static javax.persistence.FetchType.LAZY;
@ -25,6 +23,7 @@ import static javax.persistence.FetchType.LAZY;
@Table(name = "mapprodukpaket_m", uniqueConstraints = {
@UniqueConstraint(columnNames = { "paketfk", "produkPaketfk" }), })
public class MapProdukPaket extends BaseTransaction {
@ManyToOne(fetch = LAZY)
@JoinColumn(name = "paketfk")
@NotNull(message = "Paket tidak boleh kosong")
@ -54,9 +53,4 @@ public class MapProdukPaket extends BaseTransaction {
@Caption(value = "Status Aktif")
private Boolean isAktif;
@Column(length = 30)
@Enumerated(STRING)
@Size(max = 30, message = "Jenis paket maksimal {max} karakter")
@Caption(value = "Jenis paket")
private JenisPaket jenisPaket;
}

View File

@ -3,7 +3,6 @@ package com.jasamedika.medifirst2000.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.jasamedika.medifirst2000.base.vo.BaseTransactionVO;
import com.jasamedika.medifirst2000.entities.ProdukDto;
import com.jasamedika.medifirst2000.entities.constant.JenisPaket;
import com.jasamedika.medifirst2000.enums.JenisMappingProdukPaket;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
@ -42,6 +41,4 @@ public class MapProdukPaketVO extends BaseTransactionVO {
@Caption(value = "Status Aktif")
private Boolean isAktif;
@Caption(value = "Jenis paket")
private JenisPaket jenisPaket;
}

View File

@ -59,11 +59,11 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException sve) {
LOGGER.error("Got exception {} when calculate indikator pelayanan", sve.getMessage());
LOGGER.error("Got ServiceVOException {} when calculate indikator pelayanan", sve.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, sve.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when calculate indikator pelayanan", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when calculate indikator pelayanan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
@ -78,11 +78,11 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
return RestUtil.getJsonResponse(result, HttpStatus.OK);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when validate nama produk", e.getMessage());
LOGGER.error("Got ServiceVOException {} when validate nama produk", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when validate nama produk", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when validate nama produk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
@ -95,11 +95,11 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
Map<String, Object> result = produkService.getMappingPaketToProduk(idMapping);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get mapping paket to produk", e.getMessage());
LOGGER.error("Got ServiceVOException {} when get mapping paket to produk", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get mapping paket to produk", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when get mapping paket to produk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
@ -113,11 +113,11 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException sve) {
LOGGER.error("Got exception {} when get all data paket to produk", sve.getMessage());
LOGGER.error("Got ServiceVOException {} when get all data paket to produk", sve.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, sve.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all data paket to produk", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when get all data paket to produk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
@ -131,11 +131,11 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException sve) {
LOGGER.error("Got exception {} when get all master satuan standar distinct on", sve.getMessage());
LOGGER.error("Got ServiceVOException {} when get all master satuan standar distinct on", sve.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, sve.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all master satuan standar distinct on", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when get all master satuan standar distinct on", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
@ -152,11 +152,11 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when klaim diskon karyawan", e.getMessage());
LOGGER.error("Got ServiceVOException {} when klaim diskon karyawan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when klaim diskon karyawan", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when klaim diskon karyawan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
@ -172,11 +172,11 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when klaim diskon karyawan", e.getMessage());
LOGGER.error("Got ServiceVOException {} when reset klaim diskon karyawan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when klaim diskon karyawan", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when reset klaim diskon karyawan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
@ -193,11 +193,11 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when check existing harga produk kelas", e.getMessage());
LOGGER.error("Got ServiceVOException {} when check existing harga produk kelas", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when check existing harga produk kelas", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when check existing harga produk kelas", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
@ -212,11 +212,11 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get daftar tagihan {}", e.getMessage(), noRegistrasi);
LOGGER.error("Got ServiceVOException {} when get daftar tagihan {}", e.getMessage(), noRegistrasi);
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get daftar tagihan {}", jse.getMessage(), noRegistrasi);
LOGGER.error("Got JpaSystemException {} when get daftar tagihan {}", jse.getMessage(), noRegistrasi);
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
@ -232,12 +232,12 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(dtoList, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when simpan diskon tagihan", e.getMessage());
LOGGER.error("Got ServiceVOException {} when simpan diskon tagihan", e.getMessage());
Map<String, String> error = new HashMap<>();
error.put("bad_request", e.getMessage());
return RestUtil.getJsonResponse(null, HttpStatus.BAD_REQUEST, error);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when simpan diskon tagihan", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when simpan diskon tagihan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
@ -251,12 +251,12 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(dto, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when batal diskon paket", e.getMessage());
LOGGER.error("Got ServiceVOException {} when batal diskon paket", e.getMessage());
Map<String, String> error = new HashMap<>();
error.put("bad_request", e.getMessage());
return RestUtil.getJsonResponse(null, HttpStatus.BAD_REQUEST, error);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when batal diskon paket", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when batal diskon paket", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
@ -271,12 +271,12 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(validVoucher, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when check voucher validity", e.getMessage());
LOGGER.error("Got ServiceVOException {} when check voucher validity", e.getMessage());
Map<String, String> error = new HashMap<>();
error.put("bad_request", e.getMessage());
return RestUtil.getJsonResponse(false, HttpStatus.BAD_REQUEST, error);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when check voucher validity", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when check voucher validity", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
@ -291,12 +291,12 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(vos, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when simpan mapping list produk paket", e.getMessage());
LOGGER.error("Got ServiceVOException {} when simpan mapping list produk paket", e.getMessage());
Map<String, String> error = new HashMap<>();
error.put("bad_request", e.getMessage());
return RestUtil.getJsonResponse(null, HttpStatus.BAD_REQUEST, error);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when simpan mapping list produk paket", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when simpan mapping list produk paket", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
@ -311,14 +311,15 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(vos, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when simpan mapping entri produk paket", e.getMessage());
LOGGER.error("Got ServiceVOException {} when simpan mapping entri produk paket", e.getMessage());
Map<String, String> error = new HashMap<>();
error.put("bad_request", e.getMessage());
return RestUtil.getJsonResponse(null, HttpStatus.BAD_REQUEST, error);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when simpan mapping entri produk paket", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when simpan mapping entri produk paket", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}