penambahan hitung capaian persentase ketepatan kehadiran entri cppt sebagia daftar hadir dpjp
This commit is contained in:
parent
82f3af59d4
commit
ad31a6545e
@ -17,7 +17,7 @@ public interface CatatanPerkembanganPasienTerintegrasiService
|
|||||||
|
|
||||||
List<Map<String, Object>> findDokter(Integer idKsm, Integer idKk, Integer idDr) throws JpaSystemException;
|
List<Map<String, Object>> findDokter(Integer idKsm, Integer idKk, Integer idDr) throws JpaSystemException;
|
||||||
|
|
||||||
List<Map<String, Object>> findPresensiVisiteDokter(Integer idKsm, Integer idKk, Integer idDr, Long periode)
|
Map<String, Object> findPresensiVisiteDokter(Integer idKsm, Integer idKk, Integer idDr, Long periode)
|
||||||
throws JpaSystemException;
|
throws JpaSystemException;
|
||||||
|
|
||||||
Map<String, Object> findPresensiVisiteDokter(Integer idPegawai, Long bulan) throws JpaSystemException;
|
Map<String, Object> findPresensiVisiteDokter(Integer idPegawai, Long bulan) throws JpaSystemException;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package com.jasamedika.medifirst2000.service.impl;
|
package com.jasamedika.medifirst2000.service.impl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
@ -71,6 +73,27 @@ public class CatatanPerkembanganPasienTerintegrasiServiceImpl extends BaseVoServ
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MapPegawaiJabatanToUnitKerjaDao mapJabatanDao;
|
private MapPegawaiJabatanToUnitKerjaDao mapJabatanDao;
|
||||||
|
|
||||||
|
public Double getCapaianPresensiCppt(List<CatatanPerkembanganPasienTerintegrasi> data, Integer idDokter,
|
||||||
|
Integer days) {
|
||||||
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
DateFormat hf = new SimpleDateFormat("HH:mm:ss");
|
||||||
|
|
||||||
|
double totCapaian = 0.0;
|
||||||
|
for (CatatanPerkembanganPasienTerintegrasi cppt : data) {
|
||||||
|
if (idDokter.equals(cppt.getPegawai().getId())) {
|
||||||
|
LocalDateTime tenthOClock = LocalDateTime.of(LocalDate.parse(df.format(cppt.getTglInput())),
|
||||||
|
LocalTime.of(10, 0, 0, 0));
|
||||||
|
LocalDateTime tglInput = LocalDateTime.of(LocalDate.parse(df.format(cppt.getTglInput())),
|
||||||
|
LocalTime.parse(hf.format(cppt.getTglInput())));
|
||||||
|
if (tglInput.isBefore(tenthOClock) || tglInput.equals(tenthOClock)) {
|
||||||
|
totCapaian += 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return totCapaian / days;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CatatanPerkembanganPasienTerintegrasiVO add(CatatanPerkembanganPasienTerintegrasiVO vo)
|
public CatatanPerkembanganPasienTerintegrasiVO add(CatatanPerkembanganPasienTerintegrasiVO vo)
|
||||||
throws JpaSystemException, ServiceVOException {
|
throws JpaSystemException, ServiceVOException {
|
||||||
@ -214,9 +237,10 @@ public class CatatanPerkembanganPasienTerintegrasiServiceImpl extends BaseVoServ
|
|||||||
* @return presensi visite dokter
|
* @return presensi visite dokter
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> findPresensiVisiteDokter(Integer idKsm, Integer idKk, Integer idDr, Long periode)
|
public Map<String, Object> findPresensiVisiteDokter(Integer idKsm, Integer idKk, Integer idDr, Long periode)
|
||||||
throws JpaSystemException {
|
throws JpaSystemException {
|
||||||
List<Map<String, Object>> result = new ArrayList<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
List<Map<String, Object>> resultDetail = new ArrayList<>();
|
||||||
List<Map<String, Object>> dataInit = new ArrayList<>();
|
List<Map<String, Object>> dataInit = new ArrayList<>();
|
||||||
|
|
||||||
List<Integer> listIdDokter = new ArrayList<>();
|
List<Integer> listIdDokter = new ArrayList<>();
|
||||||
@ -253,11 +277,18 @@ public class CatatanPerkembanganPasienTerintegrasiServiceImpl extends BaseVoServ
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int daysOfMonth = listTgl.size();
|
||||||
|
Double persenTepatHadir = 0.0;
|
||||||
if (CommonUtil.isNotNullOrEmpty(listIdDokter)) {
|
if (CommonUtil.isNotNullOrEmpty(listIdDokter)) {
|
||||||
List<CatatanPerkembanganPasienTerintegrasi> rawData = cpptDao.findPresensiCPPT(listIdDokter, strStartDate,
|
List<CatatanPerkembanganPasienTerintegrasi> rawData = cpptDao.findPresensiCPPT(listIdDokter, strStartDate,
|
||||||
strEndDate);
|
strEndDate);
|
||||||
for (Map<String, Object> map : dataInit) {
|
if (CommonUtil.isNotNullOrEmpty(idDr)) {
|
||||||
|
for (Integer idDokter : listIdDokter) {
|
||||||
|
persenTepatHadir = getCapaianPresensiCppt(rawData, idDokter, daysOfMonth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Map<String, Object> map : dataInit) {
|
||||||
Map<String, Object> mapRs = new HashMap<>();
|
Map<String, Object> mapRs = new HashMap<>();
|
||||||
mapRs.put("cpptId", null);
|
mapRs.put("cpptId", null);
|
||||||
mapRs.put("tglInput", null);
|
mapRs.put("tglInput", null);
|
||||||
@ -289,9 +320,11 @@ public class CatatanPerkembanganPasienTerintegrasiServiceImpl extends BaseVoServ
|
|||||||
}
|
}
|
||||||
mapRs.putAll(map);
|
mapRs.putAll(map);
|
||||||
|
|
||||||
result.add(mapRs);
|
resultDetail.add(mapRs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
result.put("persenTepatHadir", new BigDecimal(persenTepatHadir).setScale(2, RoundingMode.HALF_UP));
|
||||||
|
result.put("detail", resultDetail);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -302,7 +335,6 @@ public class CatatanPerkembanganPasienTerintegrasiServiceImpl extends BaseVoServ
|
|||||||
Date endDate = CommonUtil.lastDayOfMonth(bulan);
|
Date endDate = CommonUtil.lastDayOfMonth(bulan);
|
||||||
|
|
||||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
DateFormat hf = new SimpleDateFormat("HH:mm:ss");
|
|
||||||
|
|
||||||
String strStartDate = df.format(startDate);
|
String strStartDate = df.format(startDate);
|
||||||
String strEndDate = df.format(endDate);
|
String strEndDate = df.format(endDate);
|
||||||
@ -323,20 +355,8 @@ public class CatatanPerkembanganPasienTerintegrasiServiceImpl extends BaseVoServ
|
|||||||
List<CatatanPerkembanganPasienTerintegrasi> rawData = cpptDao.findPresensiCPPT(listIdDokter, strStartDate,
|
List<CatatanPerkembanganPasienTerintegrasi> rawData = cpptDao.findPresensiCPPT(listIdDokter, strStartDate,
|
||||||
strEndDate);
|
strEndDate);
|
||||||
for (Map<String, Object> dokter : listDokter) {
|
for (Map<String, Object> dokter : listDokter) {
|
||||||
double totCapaian = 0.0;
|
dokter.put("rataCapaian",
|
||||||
for (CatatanPerkembanganPasienTerintegrasi cppt : rawData) {
|
getCapaianPresensiCppt(rawData, Integer.valueOf(dokter.get("pegawaiId").toString()), daysOfMonth));
|
||||||
if (dokter.get("pegawaiId").equals(cppt.getPegawai().getId())) {
|
|
||||||
LocalDateTime tenthOClock = LocalDateTime.of(LocalDate.parse(df.format(cppt.getTglInput())),
|
|
||||||
LocalTime.of(10, 0, 0, 0));
|
|
||||||
LocalDateTime tglInput = LocalDateTime.of(LocalDate.parse(df.format(cppt.getTglInput())),
|
|
||||||
LocalTime.parse(hf.format(cppt.getTglInput())));
|
|
||||||
if (tglInput.isBefore(tenthOClock) || tglInput.equals(tenthOClock)) {
|
|
||||||
totCapaian += 100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
double avgCapaian = totCapaian / daysOfMonth;
|
|
||||||
dokter.put("rataCapaian", avgCapaian);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return listDokter.get(0);
|
return listDokter.get(0);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user