imp:按天同步

lianzhong-receive
wyb 3 days ago
parent 801d986052
commit 34654712d2

@ -34,23 +34,24 @@ public class GzFirstLabReportSyncJob {
@Scheduled(cron = "0 0 3 1 * ?")
public void syncAllLabReport() {
LocalDate today = LocalDate.now();
String startDisDateTime = "2018-01-01 00:00:00";
LocalDate syncDisDate = LocalDate.parse("2018-01-01");
String startDateTime = "2018-01-01 00:00:00";
String endDateTime = today + " 23:59:59";
if (isAllRunning.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);
while (!syncDisDate.isAfter(today)) {
String syncDisDateStr = syncDisDate.toString();
log.info("广州市第一人民医院,同步全部已扫描患者检验报告,同步出院日期:{}", syncDisDateStr);
List<Tbasic> tbasicList = basicMapper.getLabSyncBasicListByDate(syncDisDateStr + " 00:00:00", syncDisDateStr + " 23:59:59");
if (CollUtil.isNotEmpty(tbasicList)) {
for (Tbasic tbasic : tbasicList) {
iWebService.syncInspection(tbasic, startDateTime, endDateTime);
}
}
offset = offset + limit;
syncDisDate = syncDisDate.plusDays(1);
}
log.info("广州市第一人民医院,同步全部已扫描患者检验报告,同步完成!");
} catch (Exception ex) {
@ -65,11 +66,10 @@ public class GzFirstLabReportSyncJob {
}
@Scheduled(cron = "0 0,30 * * * ?")
public void syncThreeMonthLabReport() {
LocalDate today = LocalDate.now();
String startDisDateTime = today.minusMonths(3)+" 00:00:00";
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)) {
@ -100,5 +100,4 @@ public class GzFirstLabReportSyncJob {
}
}

@ -31,6 +31,8 @@ public interface BasicMapper {
List<Tbasic> getLabSyncBasicList(@Param("startDisDateTime") String startDisDateTime, @Param("offset") int offset, @Param("limit") int limit);
List<Tbasic> getLabSyncBasicListByDate(@Param("startDisDateTime") String startDisDateTime,@Param("endDisDateTime") String endDisDateTime);
void updateScanStatus(@Param("pid")String pid);
@ -60,4 +62,5 @@ public interface BasicMapper {
int updateNotArchive(@Param("patientId")String patientId);
}

@ -220,6 +220,20 @@
)
</select>
<select id="getLabSyncBasicListByDate" 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 between #{startDisDateTime} and #{endDisDateTime}
AND is_cancel = 0
AND scan_source = '1'
ORDER BY dis_date ASC
</select>
<select id="getTbasicByAdmissId" resultType="com.docus.demo.entity.Tbasic">
select patient_id,
ph,

Loading…
Cancel
Save