web:代码调整

dev_2.0.0
xueqingkun 1 year ago
parent a97dfd599f
commit 8e0704a60e

@ -12,7 +12,7 @@ import java.util.List;
*/
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;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.supervision.constant.TreatmentPlanIdConstant;
import com.supervision.model.ConfigDrug;
import com.supervision.model.ConfigTreatmentPlan;
import com.supervision.model.TreatmentPlanRecord;
@ -9,6 +11,7 @@ import com.supervision.service.ConfigDrugService;
import com.supervision.service.ConfigTreatmentPlanService;
import com.supervision.service.TreatmentPlanRecordService;
import com.supervision.mapper.TreatmentPlanRecordMapper;
import com.supervision.vo.ask.TreatmentPlanRecordVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@ -29,7 +32,7 @@ public class TreatmentPlanRecordServiceImpl extends ServiceImpl<TreatmentPlanRec
private final ConfigDrugService configDrugService;
@Override
public List<TreatmentPlanRecord> queryByProcessId(String processId) {
public List<? extends TreatmentPlanRecord> queryByProcessId(String processId) {
// 1. 查询处置计划记录
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));
List<TreatmentPlanRecordVo> result = new ArrayList<>();
for (TreatmentPlanRecord treatmentPlan : treatmentPlanRecordList) {
TreatmentPlanRecordVo bean = BeanUtil.toBean(treatmentPlan, TreatmentPlanRecordVo.class);
ConfigTreatmentPlan configTreatmentPlan = configTreatmentPlanMap.get(treatmentPlan.getTreatmentPlanId());
if (null != configTreatmentPlan){
treatmentPlan.setDisposalPlan(configTreatmentPlan.getDisposalPlan());
treatmentPlan.setFirstMeasures(configTreatmentPlan.getFirstMeasures());
bean.setDisposalPlan(configTreatmentPlan.getDisposalPlanId());
bean.setDisposalPlanName(configTreatmentPlan.getDisposalPlan());
bean.setFirstMeasures(configTreatmentPlan.getFirstMeasures());
}
ConfigDrug configDrug = configDrugMap.get(treatmentPlan.getDrugId());
if (null != configDrug){
treatmentPlan.setDisposalPlan("药物");
treatmentPlan.setDrugName(configDrug.getDrugName());
bean.setDisposalPlan(TreatmentPlanIdConstant.DRUG_ID);
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 io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@ -18,16 +17,4 @@ public class DealPlanResVO {
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.pojo.vo.*;
import com.supervision.service.*;
import com.supervision.vo.ask.TreatmentPlanRecordVo;
import com.supervision.vo.manage.DiseaseTreatmentPlanResVo;
import com.supervision.vo.result.AncillaryRecordByResultDAO;
import com.supervision.vo.result.PhysicalRecordByResultDAO;
@ -78,7 +79,7 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
DealPlanResVO dealPlanResVO = new DealPlanResVO();
// 1. 查询处置计划记录
List<TreatmentPlanRecord> treatmentPlanRecordList = treatmentPlanRecordService.queryByProcessId(processId);
List<? extends TreatmentPlanRecord> treatmentPlanRecordList = treatmentPlanRecordService.queryByProcessId(processId);
if (CollectionUtil.isEmpty(treatmentPlanRecordList)) {
return dealPlanResVO;
}
@ -92,10 +93,10 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
List<String> drugIds = diseaseTreatmentPlanDrugList.stream().map(DiseaseTreatmentPlanDrug::getDrugId).distinct().collect(Collectors.toList());
// 4. 组装数据
ArrayList<DealPlanResVO.TreatmentPlanResult> drugTreatmentPlanResults = new ArrayList<>();
ArrayList<DealPlanResVO.TreatmentPlanResult> otherTreatmentPlanResults = new ArrayList<>();
ArrayList<TreatmentPlanRecordVo> drugTreatmentPlanResults = new ArrayList<>();
ArrayList<TreatmentPlanRecordVo> otherTreatmentPlanResults = new ArrayList<>();
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());
bean.setFlag(flag ? 1 : 0);
if (StrUtil.isNotEmpty(bean.getDrugId())) {

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

Loading…
Cancel
Save