|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.supervision.manage.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
@ -17,6 +18,10 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
import java.util.function.Predicate;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
@ -45,19 +50,19 @@ public class ConfigTreatmentPlanManageServiceImpl implements ConfigTreatmentPlan
|
|
|
|
|
public IPage<? extends ConfigTreatmentPlan> queryPageList(Integer pageNum, Integer pageSize, Integer disposalMethod) {
|
|
|
|
|
LambdaQueryChainWrapper<ConfigTreatmentPlan> wrapper = configTreatmentPlanService.lambdaQuery()
|
|
|
|
|
.eq(Objects.nonNull(disposalMethod), ConfigTreatmentPlan::getDisposalMethod, disposalMethod)
|
|
|
|
|
.orderByAsc(ConfigTreatmentPlan::getCreateTime);
|
|
|
|
|
.orderByDesc(ConfigTreatmentPlan::getCreateTime);
|
|
|
|
|
|
|
|
|
|
return configTreatmentPlanService.page(new Page<>(pageNum, pageSize), wrapper.getWrapper());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ConfigTreatmentPlan saveTreatmentPlan(ConfigTreatmentPlan treatmentPlan) {
|
|
|
|
|
public ConfigTreatmentPlan saveTreatmentPlan(ConfigTreatmentPlan configTreatmentPlan) {
|
|
|
|
|
|
|
|
|
|
saveAssert(treatmentPlan);
|
|
|
|
|
saveAssert(configTreatmentPlan);
|
|
|
|
|
|
|
|
|
|
configTreatmentPlanService.save(treatmentPlan);
|
|
|
|
|
configTreatmentPlanService.save(configTreatmentPlan);
|
|
|
|
|
|
|
|
|
|
return treatmentPlan;
|
|
|
|
|
return configTreatmentPlan;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -88,6 +93,27 @@ public class ConfigTreatmentPlanManageServiceImpl implements ConfigTreatmentPlan
|
|
|
|
|
return configTreatmentPlanService.updateById(configDrug);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<ConfigTreatmentPlan> queryFirstMeasures(Integer disposalMethod,String disposalPlanId) {
|
|
|
|
|
List<ConfigTreatmentPlan> list = configTreatmentPlanService.lambdaQuery()
|
|
|
|
|
.eq(Objects.nonNull(disposalMethod), ConfigTreatmentPlan::getDisposalMethod, disposalMethod)
|
|
|
|
|
.eq(StrUtil.isNotEmpty(disposalPlanId), ConfigTreatmentPlan::getDisposalPlanId, disposalPlanId)
|
|
|
|
|
.list();
|
|
|
|
|
if (CollectionUtil.isEmpty(list)){
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list.stream().filter(distinctPredicate(item->StrUtil.join(",",
|
|
|
|
|
item.getDisposalMethod(),item.getDisposalPlanId(),item.getFirstMeasuresId())))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static <K> Predicate<K> distinctPredicate(Function<K,Object> function){
|
|
|
|
|
ConcurrentHashMap<Object, Boolean> map = new ConcurrentHashMap<>();
|
|
|
|
|
return (t)-> null == map.putIfAbsent(function.apply(t),true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void saveAssert(ConfigTreatmentPlan configDrug){
|
|
|
|
|
Assert.isTrue(StrUtil.isEmpty(configDrug.getId()),"id 不为空");
|
|
|
|
|
Assert.notNull(configDrug.getDisposalMethod(),"处置方式不允许为空");
|
|
|
|
|