|
|
|
@ -43,15 +43,22 @@ public class TreatmentPlanServiceImpl implements TreatmentPlanService {
|
|
|
|
|
return treatmentPlanRecordService.save(treatmentPlanRecord);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* detail to @see com.supervision.service.impl.TreatmentPlanServiceImpl#queryTreatmentPlanDetails(java.lang.String)
|
|
|
|
|
* @param processId 流程id
|
|
|
|
|
* @param disposalPlanType 处置类型 0:药物 1:其他
|
|
|
|
|
* @return List<TreatmentPlanRecord>
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
@Override
|
|
|
|
|
public List<TreatmentPlanRecord> queryTreatmentPlanRecord(String processId, String disposalPlanType) {
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(processId,"流程id不允许为空");
|
|
|
|
|
|
|
|
|
|
return treatmentPlanRecordService.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, processId)
|
|
|
|
|
.eq("0".equals(disposalPlanType), TreatmentPlanRecord::getDisposalPlan, "2")
|
|
|
|
|
.in("1".equals(disposalPlanType), TreatmentPlanRecord::getDisposalPlan,
|
|
|
|
|
CollUtil.newArrayList("80fbb83669f39773")).list();
|
|
|
|
|
.eq("0".equals(disposalPlanType), TreatmentPlanRecord::getDisposalPlan, TreatmentPlanIdConstant.DRUG_ID)
|
|
|
|
|
.notIn("1".equals(disposalPlanType), TreatmentPlanRecord::getDisposalPlan,
|
|
|
|
|
CollUtil.newArrayList(TreatmentPlanIdConstant.DRUG_ID)).list();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -101,7 +108,7 @@ public class TreatmentPlanServiceImpl implements TreatmentPlanService {
|
|
|
|
|
@Override
|
|
|
|
|
public DealPlanResVO queryTreatmentPlanDetails(String processId) {
|
|
|
|
|
// 1. 查询处置计划记录
|
|
|
|
|
List<TreatmentPlanRecord> treatmentPlanRecordList = treatmentPlanRecordService.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, processId).list();
|
|
|
|
|
List<TreatmentPlanRecord> treatmentPlanRecordList = treatmentPlanRecordService.queryByProcessId(processId);
|
|
|
|
|
DealPlanResVO dealPlanResVO = new DealPlanResVO();
|
|
|
|
|
if (CollUtil.isEmpty(treatmentPlanRecordList)){
|
|
|
|
|
dealPlanResVO.setOtherTreatmentPlan(CollectionUtil.newArrayList());
|
|
|
|
@ -110,38 +117,7 @@ public class TreatmentPlanServiceImpl implements TreatmentPlanService {
|
|
|
|
|
}
|
|
|
|
|
dealPlanResVO.setUserTreatmentPlanType(CollUtil.getFirst(treatmentPlanRecordList).getDisposalMethod());
|
|
|
|
|
|
|
|
|
|
// 2. 填充处置计划属性名字段(处置计划名、一级措施)
|
|
|
|
|
List<String> treatmentPlanIds = treatmentPlanRecordList.stream().map(TreatmentPlanRecord::getTreatmentPlanId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
|
|
List<ConfigTreatmentPlan> configTreatmentPlans = new ArrayList<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(treatmentPlanIds)){
|
|
|
|
|
configTreatmentPlans = configTreatmentPlanService.listByIds(treatmentPlanIds);
|
|
|
|
|
}
|
|
|
|
|
Map<String, ConfigTreatmentPlan> configTreatmentPlanMap = configTreatmentPlans.stream().collect(Collectors.toMap(ConfigTreatmentPlan::getId, v -> v));
|
|
|
|
|
// 3.填充药物名
|
|
|
|
|
List<String> drugIds = treatmentPlanRecordList.stream().map(TreatmentPlanRecord::getDrugId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
|
|
List<ConfigDrug> configDrugs =new ArrayList<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(drugIds)){
|
|
|
|
|
configDrugs = configDrugService.listByIds(drugIds);
|
|
|
|
|
}
|
|
|
|
|
Map<String, ConfigDrug> configDrugMap = configDrugs.stream().collect(Collectors.toMap(ConfigDrug::getId, v -> v));
|
|
|
|
|
|
|
|
|
|
Map<String, List<TreatmentPlanRecord>> treatmentPlanIdMap = treatmentPlanRecordList.stream().map(item->BeanUtil.toBean(item,DealPlanResVO.TreatmentPlanResult.class))
|
|
|
|
|
.peek(item->{
|
|
|
|
|
if (StrUtil.isEmpty(item.getTreatmentPlanId())){
|
|
|
|
|
item.setDisposalPlanName("药物");
|
|
|
|
|
ConfigDrug configDrug = configDrugMap.get(item.getDrugId());
|
|
|
|
|
if (Objects.nonNull(configDrug)){
|
|
|
|
|
item.setDrugName(configDrug.getDrugName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
ConfigTreatmentPlan configTreatmentPlan = configTreatmentPlanMap.get(item.getTreatmentPlanId());
|
|
|
|
|
if (Objects.nonNull(configTreatmentPlan)){
|
|
|
|
|
item.setDisposalPlanName(configTreatmentPlan.getDisposalPlan());
|
|
|
|
|
item.setFirstMeasures(configTreatmentPlan.getFirstMeasures());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.groupingBy(v ->
|
|
|
|
|
Objects.isNull(v.getTreatmentPlanId()) ? "DRUG" :"OTHER"));
|
|
|
|
|
|
|
|
|
|