|
|
|
@ -0,0 +1,66 @@
|
|
|
|
|
package com.docus.demo.job;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import com.docus.demo.entity.Tbasic;
|
|
|
|
|
import com.docus.demo.facade.IWebService;
|
|
|
|
|
import com.docus.demo.mapper.mysql.BasicMapper;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author YongBin Wen
|
|
|
|
|
* @date 2025/4/23 0023 17:13
|
|
|
|
|
*/
|
|
|
|
|
@Component
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class GzFirstLabReportSyncJob {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IWebService iWebService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private BasicMapper basicMapper;
|
|
|
|
|
|
|
|
|
|
private AtomicBoolean isRunning = new AtomicBoolean(false);
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0 0/8 * * ?")
|
|
|
|
|
public void syncOneMonthData() {
|
|
|
|
|
LocalDate today = LocalDate.now();
|
|
|
|
|
String startDisDateTime = "2018-01-01 00:00:00";
|
|
|
|
|
String startDateTime = "2018-01-01 00:00:00";
|
|
|
|
|
String endDateTime = today + " 23:59:59";
|
|
|
|
|
if (isRunning.compareAndSet(false, true)) {
|
|
|
|
|
try {
|
|
|
|
|
int offset = 0;
|
|
|
|
|
int limit = 1000;
|
|
|
|
|
while (true) {
|
|
|
|
|
log.info("广州市第一人民医院,同步已扫描患者检验报告,患者参数查询,startDisDateTime={},offset={},limit={}", startDisDateTime, offset, limit);
|
|
|
|
|
List<Tbasic> tbasicList = basicMapper.getLabSyncBasicList(startDisDateTime, offset, limit);
|
|
|
|
|
if (CollUtil.isEmpty(tbasicList)) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
for (Tbasic tbasic : tbasicList) {
|
|
|
|
|
iWebService.syncInspection(tbasic, startDateTime, endDateTime);
|
|
|
|
|
}
|
|
|
|
|
offset = offset + limit;
|
|
|
|
|
}
|
|
|
|
|
log.info("广州市第一人民医院,同步已扫描患者检验报告,同步完成!");
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.info("广州市第一人民医院,同步已扫描患者检验报告,出现异常:" + ex.getMessage(), ex);
|
|
|
|
|
} finally {
|
|
|
|
|
isRunning.set(false);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
log.warn("广州市第一人民医院,同步已扫描患者检验报告正在调度!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|