Update logbook kinerja service

Penyesuaian perhitungan otomatis target skor dokter menjadi periodik
This commit is contained in:
salmanoersabhk 2022-09-16 20:43:47 +07:00
parent 7ac5c4fdde
commit 33f4e7d9cb
4 changed files with 29 additions and 14 deletions

View File

@ -21,13 +21,17 @@ public interface IndeksKinerjaDokterDao extends PagingAndSortingRepository<Indek
@Query("select new Map(ikid.noRec as noRec," + "ikid.bulan as bulan," + "ikid.unitKerjaId as unitKerjaId,"
+ "ikid.subunitKerjaId as subunitKerjaId," + "ikid.pegawaiId as pegawaiId," + "ikid.iki as iki,"
+ "ikid.skor as skor," + "ikid.skorDasar as skorDasar) " + "from IndeksKinerjaDokter ikid "
+ "where ikid.statusEnabled is true " + "and to_char(ikid.bulan,'yyyy') = :tahun")
List<Map<String, Object>> findAll(@Param("tahun") String tahun) throws JpaSystemException;
+ "where ikid.statusEnabled is true "
+ "and to_char(ikid.bulan,'yyyy-MM') between :bulanAwal and :bulanAkhir")
List<Map<String, Object>> findAll(@Param("bulanAwal") String bulanAwal, @Param("bulanAkhir") String bulanAkhir)
throws JpaSystemException;
@Query("select new Map(ikid.unitKerjaId as unitKerjaId," + "ikid.subunitKerjaId as subunitKerjaId,"
+ "coalesce(sum(ikid.skorDasar),0) as totalSkorDasar) " + "from IndeksKinerjaDokter ikid "
+ "where ikid.statusEnabled is true " + "and to_char(ikid.bulan,'yyyy') = :tahun "
+ "where ikid.statusEnabled is true "
+ "and to_char(ikid.bulan,'yyyy-MM') between :bulanAwal and :bulanAkhir "
+ "group by ikid.unitKerjaId, ikid.subunitKerjaId " + "order by ikid.unitKerjaId, ikid.subunitKerjaId")
List<Map<String, Object>> findTotalSkorByKelompokKerja(@Param("tahun") String tahun) throws JpaSystemException;
List<Map<String, Object>> findTotalSkorByKelompokKerja(@Param("bulanAwal") String bulanAwal,
@Param("bulanAkhir") String bulanAkhir) throws JpaSystemException;
}

View File

@ -58,7 +58,7 @@ public interface LogbookKinerjaService extends BaseVoService<LogbookKinerja, Log
public void autoVerifLogbookJamKerjaDokter(Date bulan);
public List<SkorDokterVO> hitungTargetSkorLogbookDokter(String tahun) throws ParseException;
public List<SkorDokterVO> hitungTargetSkorLogbookDokter(String bulanAwal, String bulanAkhir) throws ParseException;
public List<Double> findBobotJenisJabatan(Long periode, Integer idJabatan);

View File

@ -510,11 +510,20 @@ public class IkiDanRemunerasiServiceImpl extends BaseVoServiceImpl implements Ik
Date tglHitung = new Date();
LocalDate firstDayOfYear = LocalDate.now().with(TemporalAdjusters.firstDayOfYear());
Integer lastYear = LocalDate.now().minusYears(1).getYear();
LocalDate firstDate = LocalDate.now().minusYears(1).withMonth(1);
LocalDate lastDate = LocalDate.now().minusYears(1).withMonth(12);
if (LocalDate.now().getYear() == 2022) {
firstDate = LocalDate.now().withYear(2019).withMonth(5);
lastDate = LocalDate.now().withYear(2020).withMonth(4);
}
String bulanAwal = firstDate.getYear() + "-"
+ (firstDate.getMonthValue() < 10 ? "0" + firstDate.getMonthValue() : firstDate.getMonthValue());
String bulanAkhir = lastDate.getYear() + "-"
+ (lastDate.getMonthValue() < 10 ? "0" + lastDate.getMonthValue() : lastDate.getMonthValue());
List<Map<String, Object>> data = indeksKinerjaDokterDao.findAll(lastYear.toString());
List<Map<String, Object>> data = indeksKinerjaDokterDao.findAll(bulanAwal, bulanAkhir);
if (CommonUtil.isNotNullOrEmpty(data)) {
listSkorDokter = this.logbookKinerjaService.hitungTargetSkorLogbookDokter(lastYear.toString());
listSkorDokter = this.logbookKinerjaService.hitungTargetSkorLogbookDokter(bulanAwal, bulanAkhir);
}
for (Map<String, Object> map : data) {
@ -576,8 +585,8 @@ public class IkiDanRemunerasiServiceImpl extends BaseVoServiceImpl implements Ik
indeksKinerjaDokterDao.save(models);
List<Map<String, Object>> listTotalSkor = indeksKinerjaDokterDao
.findTotalSkorByKelompokKerja(lastYear.toString());
List<Map<String, Object>> listTotalSkor = indeksKinerjaDokterDao.findTotalSkorByKelompokKerja(bulanAwal,
bulanAkhir);
for (Map<String, Object> totalSkor : listTotalSkor) {
TargetSkorDokterVO vo = new TargetSkorDokterVO();
vo.setKdProfile((short) 0);

View File

@ -3289,14 +3289,16 @@ public class LogbookKinerjaServiceImpl extends BaseVoServiceImpl implements Logb
}
@Override
public List<SkorDokterVO> hitungTargetSkorLogbookDokter(String tahun) throws ParseException {
public List<SkorDokterVO> hitungTargetSkorLogbookDokter(String bulanAwal, String bulanAkhir) throws ParseException {
List<SkorDokterVO> result = new ArrayList<>();
DateFormat mf = new SimpleDateFormat("yyyy-MM");
DateTimeFormatter smf = DateTimeFormatter.ofPattern("yyyy-MM");
byte hitungTargetId = 1;
for (int bulan = 1; bulan <= 12; bulan++) {
List<SkorDokterVO> listRs = hitungSkorDokter(mf.parse(tahun + "-" + (bulan < 10 ? "0" + bulan : bulan)),
hitungTargetId);
java.time.LocalDate startDate = java.time.LocalDate.parse(bulanAwal + "-01");
java.time.LocalDate endDate = java.time.LocalDate.parse(bulanAkhir + "-01");
for (java.time.LocalDate date = startDate; date.isBefore(endDate); date = date.plusMonths(1)) {
List<SkorDokterVO> listRs = hitungSkorDokter(mf.parse(date.format(smf)), hitungTargetId);
result.addAll(listRs);
}