|
|
|
@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@ -36,7 +37,25 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl
|
|
|
|
|
public List<DiseaseTreatmentPlanResVo> queryListByDiseaseId(String diseaseId) {
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(diseaseId,"疾病id不能为空");
|
|
|
|
|
return diseaseTreatmentPlanService.queryListByDiseaseId(diseaseId);
|
|
|
|
|
List<DiseaseTreatmentPlanResVo> diseaseTreatmentPlanResVos = diseaseTreatmentPlanService.queryListByDiseaseId(diseaseId);
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(diseaseTreatmentPlanResVos)){
|
|
|
|
|
return diseaseTreatmentPlanResVos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//添加关联的处置药物
|
|
|
|
|
List<String> treatmentPlanIdList = diseaseTreatmentPlanResVos.stream()
|
|
|
|
|
.map(DiseaseTreatmentPlanResVo::getTreatmentPlanId).distinct().collect(Collectors.toList());
|
|
|
|
|
List<DiseaseTreatmentPlanDrug> diseaseTreatmentPlanDrugList = diseaseTreatmentPlanDrugService.lambdaQuery()
|
|
|
|
|
.in(DiseaseTreatmentPlanDrug::getTreatmentPlanId, treatmentPlanIdList)
|
|
|
|
|
.eq(DiseaseTreatmentPlanDrug::getDiseaseId, diseaseId).list();
|
|
|
|
|
|
|
|
|
|
Map<String, List<DiseaseTreatmentPlanDrug>> group = diseaseTreatmentPlanDrugList.stream().collect(Collectors.groupingBy(DiseaseTreatmentPlanDrug::getTreatmentPlanId));
|
|
|
|
|
diseaseTreatmentPlanResVos.forEach(item->item.setDrugIds(
|
|
|
|
|
group.getOrDefault(item.getTreatmentPlanId(), CollUtil.newArrayList())
|
|
|
|
|
.stream().map(DiseaseTreatmentPlanDrug::getDrugId).collect(Collectors.toList())));
|
|
|
|
|
|
|
|
|
|
return diseaseTreatmentPlanResVos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|