Merge branch 'ade/logbook/rekap-logbook-tarif' into prod/base

This commit is contained in:
adesyawal 2025-10-03 22:06:35 +07:00
commit 749fb0fb53
5 changed files with 330 additions and 277 deletions

View File

@ -501,4 +501,9 @@ public interface MapPegawaiJabatanToUnitKerjaDao extends JpaRepository<MapPegawa
+ "where mj.statusEnabled is true " + "and skj.statusEnabled is true " + "and lower(skj.name) like 'kk%' " + "where mj.statusEnabled is true " + "and skj.statusEnabled is true " + "and lower(skj.name) like 'kk%' "
+ "and mj.pegawaiId = :pegawaiId") + "and mj.pegawaiId = :pegawaiId")
List<Integer> findKelompokKerjaByDokter(@Param("pegawaiId") Integer idPegawai); List<Integer> findKelompokKerjaByDokter(@Param("pegawaiId") Integer idPegawai);
@Query("select mj.pegawaiId from MapPegawaiJabatanToUnitKerja mj " + "inner join mj.pegawai pg "
+ "where mj.statusEnabled is true " + "and pg.statusEnabled is true "
+ "and mj.pegawaiId = :idPegawai " + "and pg.jenisPegawaiId = 1")
Set<Integer> findDokterByPegawaiId(@Param("idPegawai") Integer idPegawai);
} }

View File

@ -6,6 +6,6 @@ package com.jasamedika.medifirst2000.service;
* @since 25/04/2024 * @since 25/04/2024
*/ */
public interface LogbookRemunService { public interface LogbookRemunService {
/* Service ini digunakan untuk mendapatkan data rekap loggbook seluruh pegawai dengan data bulan now - 1 */
void generateRecap(); void generateRecap(Integer idPegawai);
} }

View File

@ -9,6 +9,8 @@ import com.jasamedika.medifirst2000.service.LogbookRemunService;
import com.jasamedika.medifirst2000.service.PelayananPasienService; import com.jasamedika.medifirst2000.service.PelayananPasienService;
import com.jasamedika.medifirst2000.service.RemunerasiService; import com.jasamedika.medifirst2000.service.RemunerasiService;
import com.jasamedika.medifirst2000.util.DateUtil; import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.CommonUtil;
import com.jasamedika.medifirst2000.util.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -62,19 +64,26 @@ public class LogbookRemunServiceImpl extends BaseVoServiceImpl implements Logboo
private MapJabatanProfesiDao mapJabatanProfesiDao; private MapJabatanProfesiDao mapJabatanProfesiDao;
@Override @Override
public void generateRecap() { public void generateRecap(Integer idPegawai) {
LOGGER.info("Start simpan rekapitulasi detail logbook dokter"); LOGGER.info("Start simpan rekapitulasi detail logbook dokter");
Set<Integer> listIdDokter = new HashSet<>();
LocalDate localDate = LocalDate.now().minusMonths(1); LocalDate localDate = LocalDate.now().minusMonths(1);
Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
Date tglAwal = DateUtil.startMonth(date); Date tglAwal = DateUtil.startMonth(date);
Date tglAkhir = DateUtil.endMonth(date); Date tglAkhir = DateUtil.endMonth(date);
Set<Integer> listIdDokter = mapPegawaiJabatanToUnitKerjaDao
.findDokterByUnitKerja(splitDataSettingDatafixed("listIdUnitKerjaKsm")); if (CommonUtil.isNotNullOrEmpty(idPegawai)) {
Set<Integer> getListIdDokter = mapPegawaiJabatanToUnitKerjaDao.findDokterByPegawaiId(idPegawai);
listIdDokter.addAll(getListIdDokter);
}else{
Set<Integer> getListIdDokter = mapPegawaiJabatanToUnitKerjaDao.findDokterByUnitKerja(splitDataSettingDatafixed("listIdUnitKerjaKsm"));
listIdDokter.addAll(getListIdDokter);
List<Integer> listTerapis = mapJabatanProfesiDao.findIdPegawaiByProfesiIn(Arrays.asList(TERAPI)); List<Integer> listTerapis = mapJabatanProfesiDao.findIdPegawaiByProfesiIn(Arrays.asList(TERAPI));
listIdDokter.addAll(listTerapis); listIdDokter.addAll(listTerapis);
if (!listIdDokter.isEmpty()) { }
// Delete untuk pembaharuan data
if (CommonUtil.isNotNullOrEmpty(listIdDokter)) {
deleteByPeriod(listIdDokter, tglAwal, tglAkhir); deleteByPeriod(listIdDokter, tglAwal, tglAkhir);
} }
saveRekapDetailLogbookDokter(listIdDokter, date); saveRekapDetailLogbookDokter(listIdDokter, date);
@ -120,7 +129,10 @@ public class LogbookRemunServiceImpl extends BaseVoServiceImpl implements Logboo
} else { } else {
kinerjaDokter = remunerasiService.logbookRemunTarifDokter(idPegawai, bulan, null); kinerjaDokter = remunerasiService.logbookRemunTarifDokter(idPegawai, bulan, null);
} }
if(!kinerjaDokter.isEmpty()){
List<Map<String, Object>> remun = (List<Map<String, Object>>) kinerjaDokter.get("data"); List<Map<String, Object>> remun = (List<Map<String, Object>>) kinerjaDokter.get("data");
if(!remun.isEmpty()){
for (Map<String, Object> map : remun) { for (Map<String, Object> map : remun) {
List<String> listNorecPelayananPasienPetugas = new ArrayList<>(); List<String> listNorecPelayananPasienPetugas = new ArrayList<>();
{ {
@ -177,6 +189,8 @@ public class LogbookRemunServiceImpl extends BaseVoServiceImpl implements Logboo
} }
} }
} }
}
}
{ {
List<Map<String, Object>> ffs; List<Map<String, Object>> ffs;
if (month.isBefore(oct24)) { if (month.isBefore(oct24)) {
@ -184,6 +198,8 @@ public class LogbookRemunServiceImpl extends BaseVoServiceImpl implements Logboo
} else { } else {
ffs = remunerasiService.logbookFfsTarifDokter(idPegawai, bulan, null); ffs = remunerasiService.logbookFfsTarifDokter(idPegawai, bulan, null);
} }
if(!ffs.isEmpty()){
for (Map<String, Object> fee : ffs) { for (Map<String, Object> fee : ffs) {
List<String> listNorecPelayananPasienPetugas = new ArrayList<>(); List<String> listNorecPelayananPasienPetugas = new ArrayList<>();
{ {
@ -241,6 +257,7 @@ public class LogbookRemunServiceImpl extends BaseVoServiceImpl implements Logboo
} }
} }
} }
}
{ {
List<Map<String, Object>> ffs; List<Map<String, Object>> ffs;
if (month.isBefore(oct24)) { if (month.isBefore(oct24)) {
@ -248,6 +265,8 @@ public class LogbookRemunServiceImpl extends BaseVoServiceImpl implements Logboo
} else { } else {
ffs = remunerasiService.logbookFfsLuarTarifDokter(idPegawai, bulan, null); ffs = remunerasiService.logbookFfsLuarTarifDokter(idPegawai, bulan, null);
} }
if(!ffs.isEmpty()){
for (Map<String, Object> fee : ffs) { for (Map<String, Object> fee : ffs) {
List<String> listNorecPelayananPasienPetugas = new ArrayList<>(); List<String> listNorecPelayananPasienPetugas = new ArrayList<>();
{ {
@ -305,6 +324,7 @@ public class LogbookRemunServiceImpl extends BaseVoServiceImpl implements Logboo
} }
} }
} }
}
{ {
List<Map<String, Object>> fixedPay; List<Map<String, Object>> fixedPay;
if (month.isBefore(oct24)) { if (month.isBefore(oct24)) {
@ -312,6 +332,8 @@ public class LogbookRemunServiceImpl extends BaseVoServiceImpl implements Logboo
} else { } else {
fixedPay = remunerasiService.logbookFixedPayDokter(idPegawai, bulan, null); fixedPay = remunerasiService.logbookFixedPayDokter(idPegawai, bulan, null);
} }
if(!fixedPay.isEmpty()){
for (Map<String, Object> pay : fixedPay) { for (Map<String, Object> pay : fixedPay) {
List<String> listNorecPelayananPasienPetugas = new ArrayList<>(); List<String> listNorecPelayananPasienPetugas = new ArrayList<>();
{ {
@ -367,6 +389,7 @@ public class LogbookRemunServiceImpl extends BaseVoServiceImpl implements Logboo
} }
} }
} }
}
{ {
List<Map<String, Object>> klaimMpp; List<Map<String, Object>> klaimMpp;
if (month.isBefore(oct24)) { if (month.isBefore(oct24)) {
@ -374,6 +397,8 @@ public class LogbookRemunServiceImpl extends BaseVoServiceImpl implements Logboo
} else { } else {
klaimMpp = remunerasiService.logbookKlaimMppDokter(idPegawai, bulan); klaimMpp = remunerasiService.logbookKlaimMppDokter(idPegawai, bulan);
} }
if(!klaimMpp.isEmpty()){
for (Map<String, Object> mpp : klaimMpp) { for (Map<String, Object> mpp : klaimMpp) {
List<String> listNorecPelayananPasienPetugas = new ArrayList<>(); List<String> listNorecPelayananPasienPetugas = new ArrayList<>();
{ {
@ -429,6 +454,7 @@ public class LogbookRemunServiceImpl extends BaseVoServiceImpl implements Logboo
} }
} }
} }
}
latch.countDown(); latch.countDown();
}); });
} }

View File

@ -199,9 +199,16 @@ public class LogbookTask {
LOGGER.info("Simpan rekapitulasi logbook dokter berhasil...!"); LOGGER.info("Simpan rekapitulasi logbook dokter berhasil...!");
} }
/*
@Scheduled(cron = "0 0 0 1-6 * ?") @Scheduled(cron = "0 0 0 1-6 * ?")
public void saveRekapDetailLogbookDokter() { public void saveRekapDetailLogbookDokter() {
logbookRemunService.generateRecap(); logbookRemunService.generateRecap();
} }
*/
@Scheduled(cron = "0 15 0 4-5 * ?")
public void saveRekapDetailLogbookDokter() {
logbookRemunService.generateRecap(null);
}
} }

View File

@ -11,6 +11,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -23,6 +24,7 @@ import static org.springframework.http.HttpStatus.ACCEPTED;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR; import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.POST; import static org.springframework.web.bind.annotation.RequestMethod.POST;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
/** /**
* @author Salman * @author Salman
@ -41,7 +43,7 @@ public class LogbookRemunController extends LocaleController<LogbookKinerjaVO> {
@RequestMapping(value = "/rekap", method = POST, produces = APPLICATION_JSON_VALUE) @RequestMapping(value = "/rekap", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<String> patchingRecapLogbook(HttpServletRequest request) { public ResponseEntity<String> patchingRecapLogbook(HttpServletRequest request) {
try { try {
logbookRemunService.generateRecap(); logbookRemunService.generateRecap(null);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse("The recap has been successfully generated", ACCEPTED, mapHeaderMessage); return getJsonResponse("The recap has been successfully generated", ACCEPTED, mapHeaderMessage);
} catch (ServiceVOException | JpaSystemException e) { } catch (ServiceVOException | JpaSystemException e) {
@ -51,4 +53,17 @@ public class LogbookRemunController extends LocaleController<LogbookKinerjaVO> {
} }
} }
@RequestMapping(value = "/rekap/by-pegawai/{idPegawai}", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<String> patchingRecapLogbook1(HttpServletRequest request, @PathVariable("idPegawai") Integer idPegawai) {
try {
//System.out.println(idPegawai);
logbookRemunService.generateRecap(idPegawai);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse("The recap has been successfully generated", ACCEPTED, mapHeaderMessage);
} catch (ServiceVOException | JpaSystemException e) {
LOGGER.error("Got Exception {} when generateRecap", e.getMessage());
mapHeaderMessage.put(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
}
} }