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

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

@ -28,20 +28,21 @@ public class GzFirstLabReportSyncJob {
@Resource @Resource
private BasicMapper basicMapper; 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 * * ?") @Scheduled(cron = "0 0 3 1 * ?")
public void syncLabReport() { public void syncAllLabReport() {
LocalDate today = LocalDate.now(); LocalDate today = LocalDate.now();
String startDisDateTime = "2018-01-01 00:00:00"; String startDisDateTime = "2018-01-01 00:00:00";
String startDateTime = "2018-01-01 00:00:00"; String startDateTime = "2018-01-01 00:00:00";
String endDateTime = today + " 23:59:59"; String endDateTime = today + " 23:59:59";
if (isRunning.compareAndSet(false, true)) { if (isAllRunning.compareAndSet(false, true)) {
try { try {
int offset = 0; int offset = 0;
int limit = 1000; int limit = 1000;
while (true) { 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); List<Tbasic> tbasicList = basicMapper.getLabSyncBasicList(startDisDateTime, offset, limit);
if (CollUtil.isEmpty(tbasicList)) { if (CollUtil.isEmpty(tbasicList)) {
break; break;
@ -51,16 +52,53 @@ public class GzFirstLabReportSyncJob {
} }
offset = offset + limit; offset = offset + limit;
} }
log.info("广州市第一人民医院,同步已扫描患者检验报告,同步完成!"); log.info("广州市第一人民医院,同步全部已扫描患者检验报告,同步完成!");
} catch (Exception ex) { } catch (Exception ex) {
log.info("广州市第一人民医院,同步已扫描患者检验报告,出现异常:" + ex.getMessage(), ex); log.info("广州市第一人民医院,同步全部已扫描患者检验报告,出现异常:" + ex.getMessage(), ex);
} finally { } finally {
isRunning.set(false); isAllRunning.set(false);
} }
} else { } 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>
<select id="getLabSyncBasicList" resultType="com.docus.demo.entity.Tbasic"> <select id="getLabSyncBasicList" resultType="com.docus.demo.entity.Tbasic">
SELECT SELECT patient_id,
patient_id,
admiss_times, admiss_times,
inpatient_no, inpatient_no,
admiss_date, admiss_date,
`name`, `name`,
dis_date dis_date
FROM FROM docus_medicalrecord.t_basic
docus_medicalrecord.t_basic WHERE patient_id in (
WHERE SELECT *
dis_date >= #{startDisDateTime} FROM (
SELECT patient_id
FROM docus_medicalrecord.t_basic
WHERE dis_date >= #{startDisDateTime}
AND is_cancel = 0 AND is_cancel = 0
AND scan_source = '1' AND scan_source = '1'
ORDER BY dis_date ASC ORDER BY dis_date ASC
LIMIT ${offset}, ${limit} LIMIT ${offset}, ${limit}
) t
)
</select> </select>
<select id="getTbasicByAdmissId" resultType="com.docus.demo.entity.Tbasic"> <select id="getTbasicByAdmissId" resultType="com.docus.demo.entity.Tbasic">

Loading…
Cancel
Save