Compare commits
129 Commits
master
...
prod/no-cr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d654f57aa | ||
|
|
fc5f8bdb45 | ||
|
|
b775493a0c | ||
|
|
61b2daafb3 | ||
|
|
f4a55fa2cc | ||
|
|
6066c6a5a3 | ||
|
|
4ff3045b21 | ||
|
|
02a03bbc6c | ||
|
|
00f6f37d3e | ||
|
|
66afd01420 | ||
|
|
85bd2c95e7 | ||
|
|
8a5b76f0ed | ||
|
|
a7fb1e9a6e | ||
|
|
d5aebe2d66 | ||
|
|
6aa395d55c | ||
|
|
99b0f5df54 | ||
|
|
9b99394bfd | ||
|
|
53424dfb4b | ||
|
|
461e592715 | ||
|
|
cac102ddc6 | ||
|
|
eca2a08098 | ||
|
|
981fcd317a | ||
|
|
9348eb7f61 | ||
|
|
d36009567b | ||
|
|
90786f576d | ||
|
|
08d58716af | ||
|
|
f7821dc975 | ||
|
|
67b83c5f53 | ||
|
|
2515501667 | ||
|
|
217d95a3d0 | ||
|
|
66a727d0bb | ||
|
|
e0c8841f23 | ||
|
|
6124533929 | ||
|
|
ed19402fc4 | ||
|
|
9a1eb9950d | ||
|
|
8e2a42826f | ||
|
|
6e7c6a844e | ||
|
|
f1de3ae3e7 | ||
|
|
aab95d203c | ||
|
|
b872d18aee | ||
|
|
adc645dcd6 | ||
|
|
893dd186f0 | ||
|
|
1f0f46f4f0 | ||
|
|
229a1ab207 | ||
|
|
eb9ee4bf15 | ||
|
|
7b55611a77 | ||
|
|
728f866219 | ||
|
|
916392cc2e | ||
|
|
edbda895aa | ||
|
|
77cea5e73e | ||
|
|
06725931ef | ||
|
|
b26eca13c3 | ||
|
|
cc9cea7097 | ||
|
|
e0c801bb81 | ||
|
|
69d43f67e7 | ||
|
|
9d17418de7 | ||
|
|
7b1764ac68 | ||
|
|
05cd99cd84 | ||
|
|
3e1186e568 | ||
|
|
f3132971e4 | ||
|
|
0ebb89756b | ||
|
|
8e99f3913c | ||
|
|
439f365f1b | ||
|
|
7af3521e59 | ||
|
|
d2d7b44463 | ||
|
|
0454a03546 | ||
|
|
8fbd28fbd9 | ||
|
|
c425dd6a6d | ||
|
|
da3aebc9e0 | ||
|
|
557b43ab26 | ||
|
|
85447f5a88 | ||
|
|
00c3da63ed | ||
|
|
183376472c | ||
|
|
2feacd8459 | ||
|
|
db45c927bb | ||
|
|
9ac1983f2b | ||
|
|
34d47239d9 | ||
|
|
21713798b6 | ||
|
|
f600bd510e | ||
|
|
2b7b244959 | ||
|
|
6846183176 | ||
|
|
a69dfbd67d | ||
|
|
5138607ca6 | ||
|
|
1ebb192353 | ||
|
|
29a9c5df6e | ||
|
|
fdcfbcea02 | ||
|
|
c2410a19b4 | ||
|
|
db074662ed | ||
|
|
443a6c46d5 | ||
|
|
5e0da8a200 | ||
|
|
c1078a11e3 | ||
|
|
6ab631d4f0 | ||
|
|
45b64c32bb | ||
|
|
c0cf1e3f22 | ||
|
|
0ee57d072b | ||
|
|
8ee1745ce2 | ||
|
|
6054dbbd1f | ||
|
|
154b83d670 | ||
|
|
d166e76d1e | ||
|
|
de2558da88 | ||
|
|
6259818c54 | ||
|
|
4aa2aa8be7 | ||
|
|
8665455fcd | ||
|
|
e461e4d3f9 | ||
|
|
37ab15387f | ||
|
|
ab19c4f8aa | ||
|
|
8c11648f73 | ||
|
|
8a96897e43 | ||
|
|
1c70e23b9e | ||
|
|
394b4c9491 | ||
|
|
94bf7ce91d | ||
|
|
f675b5ef5c | ||
|
|
59e11a4281 | ||
|
|
b8e02cf455 | ||
|
|
cddd3ce8aa | ||
|
|
fdc64e1a64 | ||
|
|
6b52bcaa8d | ||
|
|
e1b4d1d2fc | ||
|
|
b26fc737f8 | ||
|
|
a5664ae550 | ||
|
|
cc5ebc507f | ||
|
|
542b30edc4 | ||
|
|
3b57982de3 | ||
|
|
502cc894af | ||
|
|
efbd607ab5 | ||
|
|
093f27df32 | ||
|
|
dacddf98ec | ||
|
|
9483ad3e54 | ||
|
|
b61706ee5e |
@ -1,69 +0,0 @@
|
|||||||
package com.jasamedika.medifirst2000.task.schedule;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.jasamedika.medifirst2000.service.MigrasiPasienService;
|
|
||||||
import com.jasamedika.medifirst2000.util.CommonUtil;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.http.HttpEntity;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static com.jasamedika.medifirst2000.task.schedule.config.HeaderHandler.getHttpHeaders;
|
|
||||||
import static org.springframework.http.HttpMethod.GET;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author salmanoe
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 11/10/2023
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class MigrasiPasienTask {
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(MigrasiPasienTask.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RestTemplate restTemplate;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ObjectMapper objectMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MigrasiPasienService migrasiPasienService;
|
|
||||||
|
|
||||||
@Value("${app.etl.migrasi.pasien}")
|
|
||||||
String baseUrl;
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 18 * * ?")
|
|
||||||
public void newMigrate() {
|
|
||||||
LOGGER.info("Task MigrasiPasienTask.newMigrate {}", LocalDateTime.now());
|
|
||||||
|
|
||||||
migrasiPasienService.newMigrate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 0 * * ?")
|
|
||||||
public void setStatusTerkirim() throws URISyntaxException {
|
|
||||||
LOGGER.info("Task MigrasiPasienTask.setStatusTerkirim {}", LocalDateTime.now());
|
|
||||||
|
|
||||||
URI uri = new URI(baseUrl + "/no-rekam-medis");
|
|
||||||
HttpEntity<Object> entity = new HttpEntity<>(null, getHttpHeaders());
|
|
||||||
ResponseEntity<Object> exchange = restTemplate.exchange(uri, GET, entity, Object.class);
|
|
||||||
if (CommonUtil.isNotNullOrEmpty(exchange.getBody())) {
|
|
||||||
Map<String, Object> dto = objectMapper.convertValue(exchange.getBody(), HashMap.class);
|
|
||||||
if (CommonUtil.isNotNullOrEmpty(dto) && CommonUtil.isNotNullOrEmpty(dto.get("response"))) {
|
|
||||||
List<String> noRekamMedisList = objectMapper.convertValue(dto.get("response"), List.class);
|
|
||||||
migrasiPasienService.setStatus(noRekamMedisList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
package com.jasamedika.medifirst2000.task.schedule.config;
|
|
||||||
|
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
import static org.springframework.http.MediaType.APPLICATION_JSON;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Salman
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 29/07/2024
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class HeaderHandler {
|
|
||||||
|
|
||||||
public static HttpHeaders getHttpHeaders() {
|
|
||||||
HttpHeaders headers = new HttpHeaders();
|
|
||||||
headers.setAccept(Collections.singletonList(APPLICATION_JSON));
|
|
||||||
headers.setContentType(APPLICATION_JSON);
|
|
||||||
return headers;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
package com.jasamedika.medifirst2000.task.schedule.config;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.scheduling.TaskScheduler;
|
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Salman
|
|
||||||
* @since 12 Jul 2023
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@EnableScheduling
|
|
||||||
@ComponentScan("com.jasamedika.medifirst2000.task")
|
|
||||||
public class ScheduleTaskConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public TaskScheduler taskScheduler() {
|
|
||||||
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
|
|
||||||
threadPoolTaskScheduler.setPoolSize(50);
|
|
||||||
threadPoolTaskScheduler.setThreadNamePrefix("BridgingThreadPoolTaskScheduler");
|
|
||||||
return threadPoolTaskScheduler;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public ObjectMapper objectMapper() {
|
|
||||||
return new ObjectMapper();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public RestTemplate restTemplate() {
|
|
||||||
return new RestTemplate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -15,7 +15,7 @@
|
|||||||
</context-param>
|
</context-param>
|
||||||
<context-param>
|
<context-param>
|
||||||
<param-name>spring.profiles.default</param-name>
|
<param-name>spring.profiles.default</param-name>
|
||||||
<param-value>localhost</param-value>
|
<param-value>bridging</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
|
|
||||||
<listener>
|
<listener>
|
||||||
|
|||||||
@ -1,214 +0,0 @@
|
|||||||
package com.jasamedika.medifirst2000.task.schedule;
|
|
||||||
|
|
||||||
import com.jasamedika.medifirst2000.dao.*;
|
|
||||||
import com.jasamedika.medifirst2000.entities.KelompokPasien;
|
|
||||||
import com.jasamedika.medifirst2000.entities.Pegawai;
|
|
||||||
import com.jasamedika.medifirst2000.entities.RekapLogbookDokter;
|
|
||||||
import com.jasamedika.medifirst2000.service.LogbookRemunService;
|
|
||||||
import com.jasamedika.medifirst2000.service.PelayananPasienService;
|
|
||||||
import com.jasamedika.medifirst2000.service.RekapLogbookDokterService;
|
|
||||||
import com.jasamedika.medifirst2000.service.RemunerasiService;
|
|
||||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.YearMonth;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author salmanoe
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 07/11/2023
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class LogbookTask {
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(LogbookTask.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PelayananPasienPetugasDao pelayananPasienPetugasDao;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RekapLogbookDokterDao rekapLogbookDokterDao;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PelayananPasienService pelayananPasienService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RemunerasiService remunerasiService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RekapLogbookDokterService rekapLogbookDokterService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private LogbookRemunService logbookRemunService;
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 0 1-6 * ?")
|
|
||||||
public void saveRekapLogbookDokter() {
|
|
||||||
LOGGER.info("Start simpan rekapitulasi logbook dokter");
|
|
||||||
|
|
||||||
LocalDate localDate = LocalDate.now().minusMonths(1);
|
|
||||||
Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
|
||||||
Date tglAwal = DateUtil.startMonth(date);
|
|
||||||
Date tglAkhir = DateUtil.endMonth(date);
|
|
||||||
{
|
|
||||||
// Delete untuk pembaharuan data
|
|
||||||
rekapLogbookDokterService.deleteByPeriod(tglAwal, tglAkhir);
|
|
||||||
}
|
|
||||||
Set<Integer> idPegawaiByTglPelayanan = pelayananPasienPetugasDao.findPegawaiByTglPelayanan(tglAwal, tglAkhir);
|
|
||||||
DateFormat df = new SimpleDateFormat("yyyy-MM");
|
|
||||||
String bulan = df.format(date);
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
|
|
||||||
YearMonth oct24 = YearMonth.parse("2024-10", formatter);
|
|
||||||
YearMonth month = YearMonth.parse(bulan, formatter);
|
|
||||||
List<RekapLogbookDokter> models = new ArrayList<>();
|
|
||||||
idPegawaiByTglPelayanan.forEach(idPegawai -> {
|
|
||||||
{
|
|
||||||
Map<String, Object> kinerjaDokter;
|
|
||||||
if (month.isBefore(oct24)) {
|
|
||||||
kinerjaDokter = pelayananPasienService.logbookRemunTarifDokter(idPegawai, bulan, null);
|
|
||||||
} else {
|
|
||||||
kinerjaDokter = remunerasiService.logbookRemunTarifDokter(idPegawai, bulan, null);
|
|
||||||
}
|
|
||||||
List<Map<String, Object>> remun = (List<Map<String, Object>>) kinerjaDokter.get("data");
|
|
||||||
List<Integer> listIdKelompokPasien = new ArrayList<>();
|
|
||||||
remun.forEach(r -> {
|
|
||||||
if (!listIdKelompokPasien.contains(Integer.parseInt(r.get("idKelompokPasien").toString())))
|
|
||||||
listIdKelompokPasien.add(Integer.parseInt(r.get("idKelompokPasien").toString()));
|
|
||||||
});
|
|
||||||
listIdKelompokPasien.forEach(idKelompokPasien -> {
|
|
||||||
double jumlah = remun.stream().filter(r -> idKelompokPasien.equals(r.get("idKelompokPasien")))
|
|
||||||
.mapToDouble(r -> Double.parseDouble(r.get("jumlah").toString())).sum();
|
|
||||||
double hargaJasa = remun.stream().filter(r -> idKelompokPasien.equals(r.get("idKelompokPasien")))
|
|
||||||
.mapToDouble(r -> Double.parseDouble(r.get("jumlahHargaJasa").toString())).sum();
|
|
||||||
RekapLogbookDokter rekapLogbookDokter = new RekapLogbookDokter();
|
|
||||||
rekapLogbookDokter.setKdProfile((short) 0);
|
|
||||||
rekapLogbookDokter.setStatusEnabled(true);
|
|
||||||
Pegawai pegawai = new Pegawai();
|
|
||||||
pegawai.setId(idPegawai);
|
|
||||||
rekapLogbookDokter.setPegawai(pegawai);
|
|
||||||
rekapLogbookDokter.setJenisLogbook("JKN");
|
|
||||||
KelompokPasien kelompokPasien = new KelompokPasien();
|
|
||||||
kelompokPasien.setId(idKelompokPasien);
|
|
||||||
rekapLogbookDokter.setKelompokPasien(kelompokPasien);
|
|
||||||
rekapLogbookDokter.setBulan(date);
|
|
||||||
rekapLogbookDokter.setJumlah(jumlah);
|
|
||||||
rekapLogbookDokter.setCapaian(hargaJasa);
|
|
||||||
models.add(rekapLogbookDokter);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
{
|
|
||||||
List<Map<String, Object>> ffs;
|
|
||||||
if (month.isBefore(oct24)) {
|
|
||||||
ffs = pelayananPasienService.logbookFfsTarifDokter(idPegawai, bulan, null);
|
|
||||||
} else {
|
|
||||||
ffs = remunerasiService.logbookFfsTarifDokter(idPegawai, bulan, null);
|
|
||||||
}
|
|
||||||
List<String> listJenisRuangan = new ArrayList<>();
|
|
||||||
List<Integer> listIdKelompokPasien = new ArrayList<>();
|
|
||||||
ffs.forEach(r -> {
|
|
||||||
if (!listJenisRuangan.contains(r.get("jenisRuangan").toString()))
|
|
||||||
listJenisRuangan.add(r.get("jenisRuangan").toString());
|
|
||||||
if (!listIdKelompokPasien.contains(Integer.parseInt(r.get("idKelompokPasien").toString())))
|
|
||||||
listIdKelompokPasien.add(Integer.parseInt(r.get("idKelompokPasien").toString()));
|
|
||||||
});
|
|
||||||
listJenisRuangan.forEach(jenisRuangan -> listIdKelompokPasien.forEach(idKelompokPasien -> {
|
|
||||||
double jumlah = ffs.stream()
|
|
||||||
.filter(r -> jenisRuangan.equals(r.get("jenisRuangan"))
|
|
||||||
&& idKelompokPasien.equals(r.get("idKelompokPasien")))
|
|
||||||
.mapToDouble(r -> Double.parseDouble(r.get("jumlah").toString())).sum();
|
|
||||||
double hargaJasa = ffs.stream()
|
|
||||||
.filter(r -> jenisRuangan.equals(r.get("jenisRuangan"))
|
|
||||||
&& idKelompokPasien.equals(r.get("idKelompokPasien")))
|
|
||||||
.mapToDouble(r -> Double.parseDouble(r.get("jumlahHargaJasa").toString())).sum();
|
|
||||||
RekapLogbookDokter rekapLogbookDokter = new RekapLogbookDokter();
|
|
||||||
rekapLogbookDokter.setKdProfile((short) 0);
|
|
||||||
rekapLogbookDokter.setStatusEnabled(true);
|
|
||||||
Pegawai pegawai = new Pegawai();
|
|
||||||
pegawai.setId(idPegawai);
|
|
||||||
rekapLogbookDokter.setPegawai(pegawai);
|
|
||||||
rekapLogbookDokter.setJenisLogbook("NON_JKN");
|
|
||||||
rekapLogbookDokter.setJenisRuangan(jenisRuangan);
|
|
||||||
KelompokPasien kelompokPasien = new KelompokPasien();
|
|
||||||
kelompokPasien.setId(idKelompokPasien);
|
|
||||||
rekapLogbookDokter.setKelompokPasien(kelompokPasien);
|
|
||||||
rekapLogbookDokter.setBulan(date);
|
|
||||||
rekapLogbookDokter.setJumlah(jumlah);
|
|
||||||
rekapLogbookDokter.setCapaian(hargaJasa);
|
|
||||||
models.add(rekapLogbookDokter);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
List<Map<String, Object>> fixedPay;
|
|
||||||
if (month.isBefore(oct24)) {
|
|
||||||
fixedPay = pelayananPasienService.logbookFixedPayDokter(idPegawai, bulan, null);
|
|
||||||
} else {
|
|
||||||
fixedPay = remunerasiService.logbookFixedPayDokter(idPegawai, bulan, null);
|
|
||||||
}
|
|
||||||
List<String> listJenisRuangan = new ArrayList<>();
|
|
||||||
List<Integer> listIdKelompokPasien = new ArrayList<>();
|
|
||||||
List<String> listBulanIbuPulangRanap = new ArrayList<>();
|
|
||||||
fixedPay.forEach(r -> {
|
|
||||||
if (!listJenisRuangan.contains(r.get("jenisRuangan").toString()))
|
|
||||||
listJenisRuangan.add(r.get("jenisRuangan").toString());
|
|
||||||
if (!listIdKelompokPasien.contains(Integer.parseInt(r.get("idKelompokPasien").toString())))
|
|
||||||
listIdKelompokPasien.add(Integer.parseInt(r.get("idKelompokPasien").toString()));
|
|
||||||
if (!listBulanIbuPulangRanap.contains(r.get("bulanPulangIbu").toString()))
|
|
||||||
listBulanIbuPulangRanap.add(r.get("bulanPulangIbu").toString());
|
|
||||||
});
|
|
||||||
listJenisRuangan.forEach(jenisRuangan -> listIdKelompokPasien
|
|
||||||
.forEach(idKelompokPasien -> listBulanIbuPulangRanap.forEach(bulanIbuPulangRanap -> {
|
|
||||||
double jumlah = fixedPay.stream()
|
|
||||||
.filter(r -> jenisRuangan.equals(r.get("jenisRuangan"))
|
|
||||||
&& idKelompokPasien.equals(r.get("idKelompokPasien"))
|
|
||||||
&& bulanIbuPulangRanap.equals(r.get("bulanPulangIbu")))
|
|
||||||
.mapToDouble(r -> Double.parseDouble(r.get("jumlah").toString())).sum();
|
|
||||||
double hargaJasa = fixedPay.stream()
|
|
||||||
.filter(r -> jenisRuangan.equals(r.get("jenisRuangan"))
|
|
||||||
&& idKelompokPasien.equals(r.get("idKelompokPasien"))
|
|
||||||
&& bulanIbuPulangRanap.equals(r.get("bulanPulangIbu")))
|
|
||||||
.mapToDouble(r -> Double.parseDouble(r.get("jumlahHargaJasa").toString())).sum();
|
|
||||||
RekapLogbookDokter rekapLogbookDokter = new RekapLogbookDokter();
|
|
||||||
rekapLogbookDokter.setKdProfile((short) 0);
|
|
||||||
rekapLogbookDokter.setStatusEnabled(true);
|
|
||||||
Pegawai pegawai = new Pegawai();
|
|
||||||
pegawai.setId(idPegawai);
|
|
||||||
rekapLogbookDokter.setPegawai(pegawai);
|
|
||||||
rekapLogbookDokter.setJenisLogbook("FIXED_PAY");
|
|
||||||
rekapLogbookDokter.setJenisRuangan(jenisRuangan);
|
|
||||||
KelompokPasien kelompokPasien = new KelompokPasien();
|
|
||||||
kelompokPasien.setId(idKelompokPasien);
|
|
||||||
rekapLogbookDokter.setKelompokPasien(kelompokPasien);
|
|
||||||
rekapLogbookDokter.setBulanPulangIbu(bulanIbuPulangRanap);
|
|
||||||
rekapLogbookDokter.setBulan(date);
|
|
||||||
rekapLogbookDokter.setJumlah(jumlah);
|
|
||||||
rekapLogbookDokter.setCapaian(hargaJasa);
|
|
||||||
models.add(rekapLogbookDokter);
|
|
||||||
})));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
rekapLogbookDokterDao.save(models);
|
|
||||||
|
|
||||||
LOGGER.info("Simpan rekapitulasi logbook dokter berhasil...!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@Scheduled(cron = "0 0 0 1-6 * ?")
|
|
||||||
public void saveRekapDetailLogbookDokter() {
|
|
||||||
logbookRemunService.generateRecap();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 15 0 4-5 * ?")
|
|
||||||
public void saveRekapDetailLogbookDokter() {
|
|
||||||
logbookRemunService.generateRecap(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,135 +0,0 @@
|
|||||||
package com.jasamedika.medifirst2000.task.schedule;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.jasamedika.medifirst2000.dao.PasienDao;
|
|
||||||
import com.jasamedika.medifirst2000.dto.PesertaBpjsDto;
|
|
||||||
import com.jasamedika.medifirst2000.entities.Pasien;
|
|
||||||
import com.jasamedika.medifirst2000.util.CommonUtil;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.HttpEntity;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static org.springframework.http.HttpMethod.GET;
|
|
||||||
import static org.springframework.http.HttpStatus.CREATED;
|
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author salmanoe
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 11/10/2023
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class PasienTask {
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(PasienTask.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ObjectMapper objectMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RestTemplate restTemplate;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PasienDao pasienDao;
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 0 * * *")
|
|
||||||
public void nikPesertaBpjs() {
|
|
||||||
LOGGER.info("Task PasienTask.nikPesertaBpjs {}", LocalDateTime.now());
|
|
||||||
|
|
||||||
adjustNikPesertaBpjs();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
private void adjustNikPesertaBpjs() {
|
|
||||||
LOGGER.info("Adjusting NIK Peserta BPJS {}", LocalDateTime.now());
|
|
||||||
|
|
||||||
List<PesertaBpjsDto> listDtoUpdate = new ArrayList<>();
|
|
||||||
List<PesertaBpjsDto> listDtoNotUpdate = new ArrayList<>();
|
|
||||||
List<Pasien> pasienValidBpjs = pasienDao.findByValidBpjs();
|
|
||||||
for (Pasien pasien : pasienValidBpjs) {
|
|
||||||
try {
|
|
||||||
PesertaBpjsDto pesertaBpjsDto = cekKepesertaan(pasien.getNoBpjs());
|
|
||||||
if (pesertaBpjsDto.getKdProfile() == 0)
|
|
||||||
listDtoUpdate.add(pesertaBpjsDto);
|
|
||||||
if (pesertaBpjsDto.getKdProfile() == 1)
|
|
||||||
listDtoNotUpdate.add(pesertaBpjsDto);
|
|
||||||
|
|
||||||
Thread.sleep((long) (Math.random() * 1000 * 8));
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.error("Error adjusting NIK Peserta BPJS {} -> {}", pasien.getNoBpjs(), e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
List<String> listNoKartu = listDtoUpdate.stream().map(PesertaBpjsDto::getNoKartu)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
List<Pasien> availableValid = pasienValidBpjs.stream()
|
|
||||||
.filter(pasien -> listNoKartu.contains(pasien.getNoBpjs())).collect(Collectors.toList());
|
|
||||||
availableValid.forEach(pasien -> {
|
|
||||||
Optional<PesertaBpjsDto> first = listDtoUpdate.stream()
|
|
||||||
.filter(dto -> pasien.getNoBpjs().equals(dto.getNoKartu())).findFirst();
|
|
||||||
first.ifPresent(dto -> {
|
|
||||||
pasien.setKdProfile(dto.getKdProfile());
|
|
||||||
pasien.setNoIdentitas(dto.getNik());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if (CommonUtil.isNotNullOrEmpty(availableValid)) {
|
|
||||||
LOGGER.info("Save available valid data");
|
|
||||||
|
|
||||||
pasienDao.save(availableValid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
List<String> listNoKartu = listDtoNotUpdate.stream().map(PesertaBpjsDto::getNoKartu)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
List<Pasien> availableValid = pasienValidBpjs.stream()
|
|
||||||
.filter(pasien -> listNoKartu.contains(pasien.getNoBpjs())).collect(Collectors.toList());
|
|
||||||
availableValid.forEach(pasien -> {
|
|
||||||
Optional<PesertaBpjsDto> first = listDtoNotUpdate.stream()
|
|
||||||
.filter(dto -> pasien.getNoBpjs().equals(dto.getNoKartu())).findFirst();
|
|
||||||
first.ifPresent(dto -> pasien.setKdProfile(dto.getKdProfile()));
|
|
||||||
});
|
|
||||||
if (CommonUtil.isNotNullOrEmpty(availableValid)) {
|
|
||||||
LOGGER.info("Flag kdProfile can not update");
|
|
||||||
|
|
||||||
pasienDao.save(availableValid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private PesertaBpjsDto cekKepesertaan(String noKartu) {
|
|
||||||
try {
|
|
||||||
LOGGER.info("Cek kepesertaan BPJS {} {}", noKartu, LocalDateTime.now());
|
|
||||||
|
|
||||||
URI uri = new URI("https://daftar.rsabhk.co.id/api/data/pasien/jaminan/bpjs/cek-kepesertaan/" + noKartu);
|
|
||||||
HttpEntity<Object> request = new HttpEntity<>(null);
|
|
||||||
ResponseEntity<Object> response = restTemplate.exchange(uri, GET, request, Object.class);
|
|
||||||
if (OK.equals(response.getStatusCode()) || CREATED.equals(response.getStatusCode())) {
|
|
||||||
Map<String, Object> responseBody = objectMapper.convertValue(response.getBody(), Map.class);
|
|
||||||
Map<String, Object> responseMap = objectMapper.convertValue(responseBody.get("response"),
|
|
||||||
HashMap.class);
|
|
||||||
Map<String, Object> responsePeserta = objectMapper.convertValue(responseMap.get("peserta"),
|
|
||||||
HashMap.class);
|
|
||||||
return PesertaBpjsDto.builder().noKartu(responsePeserta.get("noKartu").toString())
|
|
||||||
.nik(responsePeserta.get("nik").toString()).kdProfile((short) 0).build();
|
|
||||||
} else {
|
|
||||||
LOGGER.error("Error handshake cek kepesertaan BPJS {}", response.getStatusCode().getReasonPhrase());
|
|
||||||
|
|
||||||
return PesertaBpjsDto.builder().noKartu(noKartu).kdProfile((short) 1).build();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.error("Error cek kepesertaan BPJS {}", e.getMessage());
|
|
||||||
|
|
||||||
return PesertaBpjsDto.builder().noKartu(noKartu).kdProfile((short) 1).build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
package com.jasamedika.medifirst2000.task.schedule.config;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.scheduling.TaskScheduler;
|
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Salman
|
|
||||||
* @since 12 Jul 2023
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@EnableScheduling
|
|
||||||
@ComponentScan("com.jasamedika.medifirst2000.task")
|
|
||||||
public class ScheduleTaskConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public TaskScheduler taskScheduler() {
|
|
||||||
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
|
|
||||||
threadPoolTaskScheduler.setPoolSize(75);
|
|
||||||
threadPoolTaskScheduler.setThreadNamePrefix("PelayananThreadPoolTaskScheduler");
|
|
||||||
return threadPoolTaskScheduler;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public ObjectMapper objectMapper() {
|
|
||||||
return new ObjectMapper();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public RestTemplate restTemplate() {
|
|
||||||
return new RestTemplate();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
package com.jasamedika.medifirst2000.task.schedule;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import com.jasamedika.medifirst2000.service.KalenderService;
|
|
||||||
import com.jasamedika.medifirst2000.service.PegawaiJadwalKerjaService;
|
|
||||||
import com.jasamedika.medifirst2000.service.SlipGajiService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Salman
|
|
||||||
* @since 12 Jul 2023
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class ScheduleTask {
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ScheduleTask.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private KalenderService kalenderService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PegawaiJadwalKerjaService pegawaiJadwalKerjaService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SlipGajiService slipGajiService;
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 23 30 6 ?")
|
|
||||||
public void generateKalender() {
|
|
||||||
LOGGER.info("Generate kalender tahun {}",
|
|
||||||
LocalDate.now().plusYears(1).format(DateTimeFormatter.ofPattern("yyyy")));
|
|
||||||
|
|
||||||
kalenderService.generateAndSaveKalender();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 0 1 * ?")
|
|
||||||
public void genarateJadwalPegawaiNonShift() {
|
|
||||||
LOGGER.info("Generate jadwal pegawai bulan {}", LocalDate.now().format(DateTimeFormatter.ofPattern("MM-yyyy")));
|
|
||||||
|
|
||||||
pegawaiJadwalKerjaService.autoSaveJadwalKerjaNonShift();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 0 1 * ?")
|
|
||||||
public void templateSlipGajiTask() {
|
|
||||||
LOGGER.info("Initiate template slip gaji bulan {}",
|
|
||||||
LocalDate.now().format(DateTimeFormatter.ofPattern("MM-yyyy")));
|
|
||||||
|
|
||||||
slipGajiService.init();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
package com.jasamedika.medifirst2000.task.schedule.config;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.scheduling.TaskScheduler;
|
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Salman
|
|
||||||
* @since 12 Jul 2023
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@EnableScheduling
|
|
||||||
@ComponentScan("com.jasamedika.medifirst2000.task")
|
|
||||||
public class ScheduleTaskConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public TaskScheduler taskScheduler() {
|
|
||||||
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
|
|
||||||
threadPoolTaskScheduler.setPoolSize(5);
|
|
||||||
threadPoolTaskScheduler.setThreadNamePrefix("SdmThreadPoolTaskScheduler");
|
|
||||||
return threadPoolTaskScheduler;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user