feat: 广州市一检验报告同步job近期;优化分页

lianzhong-receive
wyb 3 months ago
parent e4dfed32f2
commit 3de32b4d7d

@ -28,20 +28,21 @@ public class GzFirstLabReportSyncJob {
@Resource
private BasicMapper basicMapper;
private AtomicBoolean isRunning = new AtomicBoolean(false);
private AtomicBoolean isAllRunning = new AtomicBoolean(false);
private AtomicBoolean isThreeRunning = new AtomicBoolean(false);
@Scheduled(cron = "0 0 3/12 * * ?")
public void syncLabReport() {
@Scheduled(cron = "0 0 3 1 * ?")
public void syncAllLabReport() {
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)) {
if (isAllRunning.compareAndSet(false, true)) {
try {
int offset = 0;
int limit = 1000;
while (true) {
log.info("广州市第一人民医院,同步已扫描患者检验报告患者参数查询startDisDateTime={}offset={}limit={}", startDisDateTime, offset, limit);
log.info("广州市第一人民医院,同步全部已扫描患者检验报告患者参数查询startDisDateTime={}offset={}limit={}", startDisDateTime, offset, limit);
List<Tbasic> tbasicList = basicMapper.getLabSyncBasicList(startDisDateTime, offset, limit);
if (CollUtil.isEmpty(tbasicList)) {
break;
@ -51,16 +52,53 @@ public class GzFirstLabReportSyncJob {
}
offset = offset + limit;
}
log.info("广州市第一人民医院,同步已扫描患者检验报告,同步完成!");
log.info("广州市第一人民医院,同步全部已扫描患者检验报告,同步完成!");
} catch (Exception ex) {
log.info("广州市第一人民医院,同步已扫描患者检验报告,出现异常:" + ex.getMessage(), ex);
log.info("广州市第一人民医院,同步全部已扫描患者检验报告,出现异常:" + ex.getMessage(), ex);
} finally {
isRunning.set(false);
isAllRunning.set(false);
}
} else {
log.warn("广州市第一人民医院,同步已扫描患者检验报告正在调度!");
log.warn("广州市第一人民医院,同步全部已扫描患者检验报告正在调度!");
}
}
@Scheduled(cron = "0 0,30 * * * ?")
public void syncThreeMonthLabReport() {
LocalDate today = LocalDate.now();
String startDisDateTime = today.minusMonths(3)+" 00:00:00";
String startDateTime = "2018-01-01 00:00:00";
String endDateTime = today + " 23:59:59";
if (isThreeRunning.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 {
isThreeRunning.set(false);
}
} else {
log.warn("广州市第一人民医院,同步部分已扫描患者检验报告正在调度!");
}
}
}

@ -199,23 +199,25 @@
</select>
<select id="getLabSyncBasicList" resultType="com.docus.demo.entity.Tbasic">
SELECT
patient_id,
admiss_times,
inpatient_no,
admiss_date,
`name`,
dis_date
FROM
docus_medicalrecord.t_basic
WHERE
dis_date >= #{startDisDateTime}
AND is_cancel = 0
AND scan_source = '1'
ORDER BY dis_date ASC
LIMIT ${offset},${limit}
SELECT patient_id,
admiss_times,
inpatient_no,
admiss_date,
`name`,
dis_date
FROM docus_medicalrecord.t_basic
WHERE patient_id in (
SELECT *
FROM (
SELECT patient_id
FROM docus_medicalrecord.t_basic
WHERE dis_date >= #{startDisDateTime}
AND is_cancel = 0
AND scan_source = '1'
ORDER BY dis_date ASC
LIMIT ${offset}, ${limit}
) t
)
</select>
<select id="getTbasicByAdmissId" resultType="com.docus.demo.entity.Tbasic">

Loading…
Cancel
Save