|
|
|
@ -10,13 +10,16 @@ import com.supervision.model.DiseaseTreatmentPlan;
|
|
|
|
|
import com.supervision.model.DiseaseTreatmentPlanDrug;
|
|
|
|
|
import com.supervision.service.DiseaseTreatmentPlanDrugService;
|
|
|
|
|
import com.supervision.service.DiseaseTreatmentPlanService;
|
|
|
|
|
import com.supervision.vo.manage.DiseaseTreatmentPlanReqVo;
|
|
|
|
|
import com.supervision.vo.manage.DiseaseTreatmentPlanResVo;
|
|
|
|
|
import com.supervision.vo.manage.DiseaseTreatmentPlanTreeNode;
|
|
|
|
|
import com.supervision.vo.manage.TreatmentPlanTreeNode;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@ -37,7 +40,7 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public DiseaseTreatmentPlan saveTreatmentPlan(DiseaseTreatmentPlan diseaseTreatmentPlan) {
|
|
|
|
|
public DiseaseTreatmentPlan saveTreatmentPlan(DiseaseTreatmentPlanReqVo diseaseTreatmentPlan) {
|
|
|
|
|
|
|
|
|
|
assertDiseaseTreatmentPlan(diseaseTreatmentPlan);
|
|
|
|
|
|
|
|
|
@ -62,11 +65,6 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
@Override
|
|
|
|
|
public void batchSaveTreatmentPlan(List<DiseaseTreatmentPlan> diseaseTreatmentPlanList) {
|
|
|
|
|
Assert.notEmpty(diseaseTreatmentPlanList,"数据不能为空");
|
|
|
|
|
diseaseTreatmentPlanList.forEach(item->{
|
|
|
|
|
if (StrUtil.isEmpty(item.getTreatmentPlanId())){
|
|
|
|
|
item.setTreatmentPlanId(item.getPlanId());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
diseaseTreatmentPlanList.forEach(this::assertDiseaseTreatmentPlan);
|
|
|
|
|
|
|
|
|
|
diseaseTreatmentPlanService.saveBatch(diseaseTreatmentPlanList);
|
|
|
|
@ -110,6 +108,25 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
return rootNode.getChild();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor=Exception.class)
|
|
|
|
|
public boolean updateDiseaseTreatmentPlan(DiseaseTreatmentPlanReqVo diseaseTreatmentPlan) {
|
|
|
|
|
Assert.notEmpty(diseaseTreatmentPlan.getId(),"id允许为空");
|
|
|
|
|
|
|
|
|
|
DiseaseTreatmentPlan dtp = diseaseTreatmentPlanService.getById(diseaseTreatmentPlan.getId());
|
|
|
|
|
// 删除旧的数据
|
|
|
|
|
if (Objects.nonNull(dtp)){
|
|
|
|
|
diseaseTreatmentPlanService.removeById(diseaseTreatmentPlan.getId());
|
|
|
|
|
diseaseTreatmentPlanDrugService.lambdaUpdate()
|
|
|
|
|
.eq(DiseaseTreatmentPlanDrug::getTreatmentPlanId,dtp.getTreatmentPlanId())
|
|
|
|
|
.eq(DiseaseTreatmentPlanDrug::getDiseaseId,dtp.getDiseaseId()).remove();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
diseaseTreatmentPlan.setId(null);
|
|
|
|
|
this.saveTreatmentPlan(diseaseTreatmentPlan);
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void assertDiseaseTreatmentPlan(DiseaseTreatmentPlan diseaseTreatmentPlan){
|
|
|
|
@ -118,6 +135,6 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(diseaseTreatmentPlan.getDiseaseId(),"疾病id不能为空");
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(diseaseTreatmentPlan.getPlanId(),"处置计划id不能为空");
|
|
|
|
|
Assert.notEmpty(diseaseTreatmentPlan.getTreatmentPlanId(),"处置方式id不能为空");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|