|
|
|
@ -1,12 +1,14 @@
|
|
|
|
|
package com.supervision.manage.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.supervision.exception.BusinessException;
|
|
|
|
|
import com.supervision.manage.service.DiseaseManageService;
|
|
|
|
|
import com.supervision.model.Disease;
|
|
|
|
|
import com.supervision.model.DiseaseAncillary;
|
|
|
|
|
import com.supervision.service.DiseaseService;
|
|
|
|
|
import com.supervision.vo.manage.DiseaseVo;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
@ -22,16 +24,8 @@ public class DiseaseManageServiceImpl implements DiseaseManageService {
|
|
|
|
|
@Override
|
|
|
|
|
public Disease saveDisease(Disease disease) {
|
|
|
|
|
|
|
|
|
|
if (StrUtil.hasEmpty(disease.getDiseaseName(),disease.getDiseaseNameAlias(),disease.getCode())){
|
|
|
|
|
throw new BusinessException("diseaseName,diseaseNameAlias,code is not allow empty");
|
|
|
|
|
}
|
|
|
|
|
if (CollUtil.isNotEmpty(this.queryByAnyCondition(disease.getCode(),disease.getDiseaseName(),
|
|
|
|
|
disease.getDiseaseNameAlias()))){
|
|
|
|
|
throw new BusinessException("类目编码: "+disease.getCode()+",或疾病名称: "+disease.getDiseaseName()+
|
|
|
|
|
",或疾病分类别名: "+disease.getDiseaseNameAlias()+" 已存在");
|
|
|
|
|
}
|
|
|
|
|
assertDisease(disease);
|
|
|
|
|
|
|
|
|
|
disease.setId(null);
|
|
|
|
|
disease.setStatus(0);
|
|
|
|
|
diseaseService.save(disease);
|
|
|
|
|
|
|
|
|
@ -42,9 +36,7 @@ public class DiseaseManageServiceImpl implements DiseaseManageService {
|
|
|
|
|
@Override
|
|
|
|
|
public boolean updateDisease(Disease disease) {
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(disease.getId())){
|
|
|
|
|
throw new BusinessException("id is not allow empty");
|
|
|
|
|
}
|
|
|
|
|
Assert.isTrue(StrUtil.isNotEmpty(disease.getId()),"id is not allow empty");
|
|
|
|
|
|
|
|
|
|
return diseaseService.updateById(disease);
|
|
|
|
|
|
|
|
|
@ -85,4 +77,21 @@ public class DiseaseManageServiceImpl implements DiseaseManageService {
|
|
|
|
|
return diseaseService.lambdaQuery().eq(Disease::getCode,code).list();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void assertDisease(Disease disease){
|
|
|
|
|
|
|
|
|
|
Assert.isNull(disease.getId(),"id 不为空");
|
|
|
|
|
|
|
|
|
|
Assert.isTrue(StrUtil.isNotEmpty(disease.getDiseaseName()),"疾病名称不能为空");
|
|
|
|
|
|
|
|
|
|
Assert.isTrue(StrUtil.isNotEmpty(disease.getDiseaseNameAlias()),"疾病别名不能为空");
|
|
|
|
|
|
|
|
|
|
Assert.isTrue(StrUtil.isNotEmpty(disease.getCode()),"疾病编码不能为空");
|
|
|
|
|
|
|
|
|
|
List<Disease> diseases = this.queryByAnyCondition(disease.getCode(), disease.getDiseaseName(), disease.getDiseaseNameAlias());
|
|
|
|
|
Assert.isTrue(CollUtil.isEmpty(diseases),"类目编码: {},或疾病名称: {},或疾病分类别名: {} 已存在",
|
|
|
|
|
disease.getCode(),disease.getDiseaseName(),disease.getDiseaseNameAlias());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|