|
@@ -2,8 +2,10 @@ package com.nb.web.service.bus.hospital;
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.date.DateUnit;
|
|
import cn.hutool.core.date.DateUnit;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.cron.CronUtil;
|
|
import cn.hutool.cron.CronUtil;
|
|
@@ -107,6 +109,9 @@ public class HospitalManager {
|
|
|
PatientMonitorQuery query = new PatientMonitorQuery();
|
|
PatientMonitorQuery query = new PatientMonitorQuery();
|
|
|
query.setTenantId(this.getHospitalId());
|
|
query.setTenantId(this.getHospitalId());
|
|
|
List<PatientMonitorResult> patientMonitorResults = patientService.selectAll(query);
|
|
List<PatientMonitorResult> patientMonitorResults = patientService.selectAll(query);
|
|
|
|
|
+ if(CollectionUtil.isEmpty(patientMonitorResults)){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
|
patientMonitorResults
|
|
patientMonitorResults
|
|
|
.stream()
|
|
.stream()
|
|
@@ -249,17 +254,25 @@ public class HospitalManager {
|
|
|
* @return void
|
|
* @return void
|
|
|
*/
|
|
*/
|
|
|
public void refreshUpdateConfig(HisUpdateEntity updateConfig){
|
|
public void refreshUpdateConfig(HisUpdateEntity updateConfig){
|
|
|
- if(updateConfig==null
|
|
|
|
|
- ||!Boolean.TRUE.equals(updateConfig.getEnable())
|
|
|
|
|
- ||null==updateConfig.getInterval()
|
|
|
|
|
- ||updateConfig.getInterval()<0){
|
|
|
|
|
|
|
+ if(ObjectUtil.isNull(updateConfig)||ObjectUtil.isNull(updateConfig.getInterval())){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!Boolean.TRUE.equals(updateConfig.getEnable())||updateConfig.getInterval()<0){
|
|
|
if(hisSchedule !=null&&!hisSchedule.isCancelled()){
|
|
if(hisSchedule !=null&&!hisSchedule.isCancelled()){
|
|
|
//如果有定时任务正在运行,则关闭
|
|
//如果有定时任务正在运行,则关闭
|
|
|
hisSchedule.cancel(true);
|
|
hisSchedule.cancel(true);
|
|
|
}
|
|
}
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- hisSchedule = singleHisExecutor.scheduleAtFixedRate(this::scheduleHis, 0, updateConfig.getInterval(),TimeUnit.MINUTES);
|
|
|
|
|
|
|
+ //参数未改变
|
|
|
|
|
+ if(ObjectUtil.equals(this.getUpdateConfig().getInterval(),updateConfig.getInterval())){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }else {
|
|
|
|
|
+ //取消上次循环
|
|
|
|
|
+ hisSchedule.cancel(true);
|
|
|
|
|
+ hisSchedule = singleHisExecutor.scheduleAtFixedRate(this::scheduleHis, 0, updateConfig.getInterval(),TimeUnit.MINUTES);
|
|
|
|
|
+ }
|
|
|
|
|
+ this.updateConfig=updateConfig;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|