web:代码调整

dev_2.0.0
xueqingkun 2 years ago
parent a97dfd599f
commit 8e0704a60e

@ -12,7 +12,7 @@ import java.util.List;
*/ */
public interface TreatmentPlanRecordService extends IService<TreatmentPlanRecord> { public interface TreatmentPlanRecordService extends IService<TreatmentPlanRecord> {
List<TreatmentPlanRecord> queryByProcessId(String processId); List<? extends TreatmentPlanRecord> queryByProcessId(String processId);
} }

@ -1,7 +1,9 @@
package com.supervision.service.impl; package com.supervision.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.supervision.constant.TreatmentPlanIdConstant;
import com.supervision.model.ConfigDrug; import com.supervision.model.ConfigDrug;
import com.supervision.model.ConfigTreatmentPlan; import com.supervision.model.ConfigTreatmentPlan;
import com.supervision.model.TreatmentPlanRecord; import com.supervision.model.TreatmentPlanRecord;
@ -9,6 +11,7 @@ import com.supervision.service.ConfigDrugService;
import com.supervision.service.ConfigTreatmentPlanService; import com.supervision.service.ConfigTreatmentPlanService;
import com.supervision.service.TreatmentPlanRecordService; import com.supervision.service.TreatmentPlanRecordService;
import com.supervision.mapper.TreatmentPlanRecordMapper; import com.supervision.mapper.TreatmentPlanRecordMapper;
import com.supervision.vo.ask.TreatmentPlanRecordVo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -29,7 +32,7 @@ public class TreatmentPlanRecordServiceImpl extends ServiceImpl<TreatmentPlanRec
private final ConfigDrugService configDrugService; private final ConfigDrugService configDrugService;
@Override @Override
public List<TreatmentPlanRecord> queryByProcessId(String processId) { public List<? extends TreatmentPlanRecord> queryByProcessId(String processId) {
// 1. 查询处置计划记录 // 1. 查询处置计划记录
List<TreatmentPlanRecord> treatmentPlanRecordList = super.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, processId).list(); List<TreatmentPlanRecord> treatmentPlanRecordList = super.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, processId).list();
@ -52,19 +55,24 @@ public class TreatmentPlanRecordServiceImpl extends ServiceImpl<TreatmentPlanRec
} }
Map<String, ConfigDrug> configDrugMap = configDrugs.stream().collect(Collectors.toMap(ConfigDrug::getId, v -> v)); Map<String, ConfigDrug> configDrugMap = configDrugs.stream().collect(Collectors.toMap(ConfigDrug::getId, v -> v));
List<TreatmentPlanRecordVo> result = new ArrayList<>();
for (TreatmentPlanRecord treatmentPlan : treatmentPlanRecordList) { for (TreatmentPlanRecord treatmentPlan : treatmentPlanRecordList) {
TreatmentPlanRecordVo bean = BeanUtil.toBean(treatmentPlan, TreatmentPlanRecordVo.class);
ConfigTreatmentPlan configTreatmentPlan = configTreatmentPlanMap.get(treatmentPlan.getTreatmentPlanId()); ConfigTreatmentPlan configTreatmentPlan = configTreatmentPlanMap.get(treatmentPlan.getTreatmentPlanId());
if (null != configTreatmentPlan){ if (null != configTreatmentPlan){
treatmentPlan.setDisposalPlan(configTreatmentPlan.getDisposalPlan()); bean.setDisposalPlan(configTreatmentPlan.getDisposalPlanId());
treatmentPlan.setFirstMeasures(configTreatmentPlan.getFirstMeasures()); bean.setDisposalPlanName(configTreatmentPlan.getDisposalPlan());
bean.setFirstMeasures(configTreatmentPlan.getFirstMeasures());
} }
ConfigDrug configDrug = configDrugMap.get(treatmentPlan.getDrugId()); ConfigDrug configDrug = configDrugMap.get(treatmentPlan.getDrugId());
if (null != configDrug){ if (null != configDrug){
treatmentPlan.setDisposalPlan("药物"); bean.setDisposalPlan(TreatmentPlanIdConstant.DRUG_ID);
treatmentPlan.setDrugName(configDrug.getDrugName()); bean.setDisposalPlanName("药物");
bean.setDrugName(configDrug.getDrugName());
} }
result.add(bean);
} }
return treatmentPlanRecordList; return result;
} }
} }

@ -0,0 +1,16 @@
package com.supervision.vo.ask;
import com.supervision.model.TreatmentPlanRecord;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class TreatmentPlanRecordVo extends TreatmentPlanRecord {
@ApiModelProperty("结果标识 0:错误 1:正确")
private Integer flag;
@ApiModelProperty("处置计划名")
private String disposalPlanName;
}

@ -3,7 +3,6 @@ package com.supervision.pojo.vo;
import com.supervision.model.TreatmentPlanRecord; import com.supervision.model.TreatmentPlanRecord;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List; import java.util.List;
@ -18,16 +17,4 @@ public class DealPlanResVO {
private List<? extends TreatmentPlanRecord> otherTreatmentPlan; private List<? extends TreatmentPlanRecord> otherTreatmentPlan;
@Data
@EqualsAndHashCode(callSuper = true)
public static class TreatmentPlanResult extends TreatmentPlanRecord {
@ApiModelProperty("结果标识 0:错误 1:正确")
private Integer flag;
@ApiModelProperty("处置计划名")
private String disposalPlanName;
}
} }

@ -9,6 +9,7 @@ import com.supervision.model.*;
import com.supervision.model.Process; import com.supervision.model.Process;
import com.supervision.pojo.vo.*; import com.supervision.pojo.vo.*;
import com.supervision.service.*; import com.supervision.service.*;
import com.supervision.vo.ask.TreatmentPlanRecordVo;
import com.supervision.vo.manage.DiseaseTreatmentPlanResVo; import com.supervision.vo.manage.DiseaseTreatmentPlanResVo;
import com.supervision.vo.result.AncillaryRecordByResultDAO; import com.supervision.vo.result.AncillaryRecordByResultDAO;
import com.supervision.vo.result.PhysicalRecordByResultDAO; import com.supervision.vo.result.PhysicalRecordByResultDAO;
@ -78,7 +79,7 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
DealPlanResVO dealPlanResVO = new DealPlanResVO(); DealPlanResVO dealPlanResVO = new DealPlanResVO();
// 1. 查询处置计划记录 // 1. 查询处置计划记录
List<TreatmentPlanRecord> treatmentPlanRecordList = treatmentPlanRecordService.queryByProcessId(processId); List<? extends TreatmentPlanRecord> treatmentPlanRecordList = treatmentPlanRecordService.queryByProcessId(processId);
if (CollectionUtil.isEmpty(treatmentPlanRecordList)) { if (CollectionUtil.isEmpty(treatmentPlanRecordList)) {
return dealPlanResVO; return dealPlanResVO;
} }
@ -92,10 +93,10 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
List<String> drugIds = diseaseTreatmentPlanDrugList.stream().map(DiseaseTreatmentPlanDrug::getDrugId).distinct().collect(Collectors.toList()); List<String> drugIds = diseaseTreatmentPlanDrugList.stream().map(DiseaseTreatmentPlanDrug::getDrugId).distinct().collect(Collectors.toList());
// 4. 组装数据 // 4. 组装数据
ArrayList<DealPlanResVO.TreatmentPlanResult> drugTreatmentPlanResults = new ArrayList<>(); ArrayList<TreatmentPlanRecordVo> drugTreatmentPlanResults = new ArrayList<>();
ArrayList<DealPlanResVO.TreatmentPlanResult> otherTreatmentPlanResults = new ArrayList<>(); ArrayList<TreatmentPlanRecordVo> otherTreatmentPlanResults = new ArrayList<>();
for (TreatmentPlanRecord treatmentPlanRecord : treatmentPlanRecordList) { for (TreatmentPlanRecord treatmentPlanRecord : treatmentPlanRecordList) {
DealPlanResVO.TreatmentPlanResult bean = BeanUtil.toBean(treatmentPlanRecord, DealPlanResVO.TreatmentPlanResult.class); TreatmentPlanRecordVo bean = BeanUtil.toBean(treatmentPlanRecord, TreatmentPlanRecordVo.class);
boolean flag = StrUtil.isNotEmpty(bean.getDrugId()) ? drugIds.contains(bean.getDrugId()) : planIds.contains(bean.getTreatmentPlanId()); boolean flag = StrUtil.isNotEmpty(bean.getDrugId()) ? drugIds.contains(bean.getDrugId()) : planIds.contains(bean.getTreatmentPlanId());
bean.setFlag(flag ? 1 : 0); bean.setFlag(flag ? 1 : 0);
if (StrUtil.isNotEmpty(bean.getDrugId())) { if (StrUtil.isNotEmpty(bean.getDrugId())) {

@ -13,6 +13,7 @@ import com.supervision.model.Process;
import com.supervision.model.TreatmentPlanRecord; import com.supervision.model.TreatmentPlanRecord;
import com.supervision.pojo.vo.DealPlanResVO; import com.supervision.pojo.vo.DealPlanResVO;
import com.supervision.service.*; import com.supervision.service.*;
import com.supervision.vo.ask.TreatmentPlanRecordVo;
import com.supervision.vo.manage.TreatmentPlanTreeNode; import com.supervision.vo.manage.TreatmentPlanTreeNode;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -108,7 +109,7 @@ public class TreatmentPlanServiceImpl implements TreatmentPlanService {
@Override @Override
public DealPlanResVO queryTreatmentPlanDetails(String processId) { public DealPlanResVO queryTreatmentPlanDetails(String processId) {
// 1. 查询处置计划记录 // 1. 查询处置计划记录
List<TreatmentPlanRecord> treatmentPlanRecordList = treatmentPlanRecordService.queryByProcessId(processId); List<? extends TreatmentPlanRecord> treatmentPlanRecordList = treatmentPlanRecordService.queryByProcessId(processId);
DealPlanResVO dealPlanResVO = new DealPlanResVO(); DealPlanResVO dealPlanResVO = new DealPlanResVO();
if (CollUtil.isEmpty(treatmentPlanRecordList)){ if (CollUtil.isEmpty(treatmentPlanRecordList)){
dealPlanResVO.setOtherTreatmentPlan(CollectionUtil.newArrayList()); dealPlanResVO.setOtherTreatmentPlan(CollectionUtil.newArrayList());
@ -117,7 +118,7 @@ public class TreatmentPlanServiceImpl implements TreatmentPlanService {
} }
dealPlanResVO.setUserTreatmentPlanType(CollUtil.getFirst(treatmentPlanRecordList).getDisposalMethod()); dealPlanResVO.setUserTreatmentPlanType(CollUtil.getFirst(treatmentPlanRecordList).getDisposalMethod());
Map<String, List<TreatmentPlanRecord>> treatmentPlanIdMap = treatmentPlanRecordList.stream().map(item->BeanUtil.toBean(item,DealPlanResVO.TreatmentPlanResult.class)) Map<String, List<TreatmentPlanRecord>> treatmentPlanIdMap = treatmentPlanRecordList.stream().map(item->BeanUtil.toBean(item, TreatmentPlanRecordVo.class))
.collect(Collectors.groupingBy(v -> .collect(Collectors.groupingBy(v ->
Objects.isNull(v.getTreatmentPlanId()) ? "DRUG" :"OTHER")); Objects.isNull(v.getTreatmentPlanId()) ? "DRUG" :"OTHER"));

Loading…
Cancel
Save