perbaikan dan penyesuaian diskon pegawai dan keluarga pegawai untuk konsultasi rawat jalan dan test PCR covid-19
This commit is contained in:
parent
0ad1511676
commit
da4612662e
@ -158,8 +158,22 @@ public interface PelayananPasienDao extends PagingAndSortingRepository<Pelayanan
|
||||
List<Map<String, Object>> getDataPendapatan(@Param("idJenisPegawai") int idJenisPegawai,
|
||||
@Param("tglAwal") Date tglAwal, @Param("tglAkhir") Date tglAkhir);
|
||||
|
||||
@Query("select pp from PelayananPasien pp " + "inner join pp.pasienDaftar apd " + "inner join apd.pasienDaftar pd "
|
||||
+ "where pp.strukFk is null " + "and pd.noRegistrasi = :noRegistrasi " + "order by pp.produkId")
|
||||
Iterable<PelayananPasien> findLayananTagihan(@Param("noRegistrasi") String noRegistrasi);
|
||||
@Query("select new Map(pp.noRec as noRec,"
|
||||
+ "(case when :jenisDiskon = 1 and pr.id in (:listProdukId) and coalesce(pp.hargaDiscount,0) >= pp.hargaJual then coalesce(pp.hargaDiscount,0) "
|
||||
+ "when :jenisDiskon = 1 and pr.id in (:listProdukId) and coalesce(pp.hargaDiscount,0) < pp.hargaJual then pp.hargaJual "
|
||||
+ "when :jenisDiskon = 1 and lower(pr.namaProduk) like '%konsul%' and ru.departemenId = 18 and coalesce(pp.hargaDiscount,0) >= pp.hargaJual then coalesce(pp.hargaDiscount,0) "
|
||||
+ "when :jenisDiskon = 1 and lower(pr.namaProduk) like '%konsul%' and ru.departemenId = 18 and coalesce(pp.hargaDiscount,0) < pp.hargaJual then pp.hargaJual "
|
||||
+ "when :jenisDiskon = 2 and lower(pr.namaProduk) like '%konsul%' and ru.departemenId = 18 and coalesce(pp.hargaDiscount,0) >= (pp.hargaJual/2) then coalesce(pp.hargaDiscount,0) "
|
||||
+ "when :jenisDiskon = 2 and lower(pr.namaProduk) like '%konsul%' and ru.departemenId = 18 and coalesce(pp.hargaDiscount,0) < (pp.hargaJual/2) then (pp.hargaJual/2) "
|
||||
+ "when :jenisDiskon in (1,2) and pp.strukResepId is not null and coalesce(pp.hargaDiscount,0) >= (pp.hargaJual/10) then coalesce(pp.hargaDiscount,0) "
|
||||
+ "when :jenisDiskon in (1,2) and pp.strukResepId is not null and coalesce(pp.hargaDiscount,0) < (pp.hargaJual/10) then (pp.hargaJual/10) "
|
||||
+ "when :jenisDiskon in (1,2) and coalesce(pp.hargaDiscount,0) >= (pp.hargaJual/2) then coalesce(pp.hargaDiscount,0) "
|
||||
+ "when :jenisDiskon in (1,2) and coalesce(pp.hargaDiscount,0) < (pp.hargaJual/2) then (pp.hargaJual/2) "
|
||||
+ "else coalesce(pp.hargaDiscount,0) end) as hargaDiskon) " + "from PelayananPasien pp "
|
||||
+ "left join pp.pasienDaftar apd " + "left join apd.pasienDaftar pd " + "left join pp.produk pr "
|
||||
+ "left join pd.ruangan ru " + "where pp.strukFk is null " + "and pd.noRegistrasi = :noRegistrasi "
|
||||
+ "order by pp.produkId")
|
||||
List<Map<String, Object>> findLayananTagihan(@Param("noRegistrasi") String noRegistrasi,
|
||||
@Param("jenisDiskon") Integer jenisDiskon, @Param("listProdukId") List<Integer> listIdProduk);
|
||||
|
||||
}
|
||||
|
||||
@ -16,6 +16,6 @@ public interface PelayananPasienService {
|
||||
|
||||
List<Map<String, Object>> hitungRemunerasiDokterDenganFfs(String tglAwal, String tglAkhir);
|
||||
|
||||
List<String> updateKlaimDiskonKaryawan(String noRegistrasi, Double totalKlaim);
|
||||
List<String> updateKlaimDiskonKaryawan(String noRegistrasi, Double totalKlaim, Integer jenisDiskon);
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package com.jasamedika.medifirst2000.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
@ -257,29 +255,22 @@ public class PelayananPasienServiceImpl extends BaseVoServiceImpl implements Pel
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> updateKlaimDiskonKaryawan(String noRegistrasi, Double totalKlaim) {
|
||||
public List<String> updateKlaimDiskonKaryawan(String noRegistrasi, Double totalKlaim, Integer jenisDiskon) {
|
||||
List<String> result = new ArrayList<>();
|
||||
double totalTagihan = 0.0;
|
||||
|
||||
Iterable<PelayananPasien> data = pelayananPasienDao.findLayananTagihan(noRegistrasi);
|
||||
List<Integer> listIdProdukDiskonPegawai = splitDataSettingDatafixed("listProdukDiskonPegawai");
|
||||
|
||||
for (PelayananPasien pp : data) {
|
||||
totalTagihan += hitungKomponenTagihan(pp);
|
||||
}
|
||||
if (totalKlaim >= totalTagihan) {
|
||||
for (PelayananPasien pp : data) {
|
||||
pp.setHargaDiscount(pp.getHargaJual());
|
||||
}
|
||||
} else {
|
||||
for (PelayananPasien pp : data) {
|
||||
pp.setHargaDiscount(pp.getHargaDiscount() + (totalKlaim / totalTagihan * hitungKomponenTagihan(pp)) / pp.getJumlah());
|
||||
if (pp.getHargaDiscount() > pp.getHargaJual()) {
|
||||
pp.setHargaDiscount(pp.getHargaJual());
|
||||
}
|
||||
}
|
||||
List<Map<String, Object>> data = pelayananPasienDao.findLayananTagihan(noRegistrasi, jenisDiskon,
|
||||
listIdProdukDiskonPegawai);
|
||||
|
||||
List<PelayananPasien> models = new ArrayList<>();
|
||||
for (Map<String, Object> map : data) {
|
||||
PelayananPasien pp = pelayananPasienDao.findOne(map.get("noRec").toString());
|
||||
pp.setHargaDiscount(Double.valueOf(map.get("hargaDiskon").toString()));
|
||||
models.add(pp);
|
||||
}
|
||||
|
||||
Iterable<PelayananPasien> resultModels = pelayananPasienDao.save(data);
|
||||
Iterable<PelayananPasien> resultModels = pelayananPasienDao.save(models);
|
||||
if (CommonUtil.isNotNullOrEmpty(resultModels)) {
|
||||
for (PelayananPasien pp : resultModels) {
|
||||
result.add(pp.getNoRec());
|
||||
@ -289,10 +280,4 @@ public class PelayananPasienServiceImpl extends BaseVoServiceImpl implements Pel
|
||||
return result;
|
||||
}
|
||||
|
||||
public Double hitungKomponenTagihan(PelayananPasien pp) {
|
||||
return ((pp.getHargaJual() == null ? 0.0 : pp.getHargaJual())
|
||||
- (pp.getHargaDiscount() == null ? 0.0 : pp.getHargaDiscount()))
|
||||
* (pp.getJumlah() == null ? 0.0 : pp.getJumlah()) + (pp.getJasa() == null ? 0.0 : pp.getJasa());
|
||||
}
|
||||
|
||||
}
|
||||
@ -361,9 +361,11 @@ public class PelayananController extends LocaleController<PelayananPasienVO> {
|
||||
@RequestMapping(value = "/klaim-diskon-karyawan", method = RequestMethod.GET)
|
||||
public ResponseEntity<List<String>> updateKlaimDiskonKaryawan(HttpServletRequest request,
|
||||
@RequestParam(value = "noRegistrasi", required = true) String noRegistrasi,
|
||||
@RequestParam(value = "totalKlaim", required = true) Double totalKlaim) {
|
||||
@RequestParam(value = "totalKlaim", required = true) Double totalKlaim,
|
||||
@RequestParam(value = "jenisDiskon", required = true) Integer jenisDiskon) {
|
||||
try {
|
||||
List<String> result = pelayananPasienService.updateKlaimDiskonKaryawan(noRegistrasi, totalKlaim);
|
||||
List<String> result = pelayananPasienService.updateKlaimDiskonKaryawan(noRegistrasi, totalKlaim,
|
||||
jenisDiskon);
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user