web:新增 queryTreatmentPlanDetails 接口

dev_2.0.0
xueqingkun 1 year ago
parent fa432a1d48
commit 1a9abe1494

@ -0,0 +1,5 @@
package com.supervision.constant;
public interface TreatmentPlanIdConstant {
String DRUG_ID = "8055ef3412a69f95";
}

@ -26,7 +26,7 @@ public class TreatmentPlanRecord implements Serializable {
private String processId;
/**
* id
* id id
*/
private String treatmentPlanId;
@ -36,9 +36,9 @@ public class TreatmentPlanRecord implements Serializable {
private Integer disposalMethod;
/**
* (0: 1: 2: 3: 4: 5: 6: 7: )
*
*/
private Integer disposalPlan;
private String disposalPlan;
/**
*

@ -8,7 +8,7 @@
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="processId" column="process_id" jdbcType="VARCHAR"/>
<result property="disposalMethod" column="disposal_method" jdbcType="INTEGER"/>
<result property="disposalPlan" column="disposal_plan" jdbcType="INTEGER"/>
<result property="disposalPlan" column="disposal_plan" jdbcType="VARCHAR"/>
<result property="firstMeasures" column="first_measures" jdbcType="VARCHAR"/>
<result property="drugId" column="drug_id" jdbcType="VARCHAR"/>
<result property="drugName" column="drug_name" jdbcType="VARCHAR"/>

@ -2,6 +2,7 @@ package com.supervision.controller;
import com.supervision.model.ConfigDrug;
import com.supervision.model.TreatmentPlanRecord;
import com.supervision.pojo.vo.DealPlanResVO;
import com.supervision.service.TreatmentPlanService;
import com.supervision.vo.manage.TreatmentPlanTreeNode;
import io.swagger.annotations.Api;
@ -63,6 +64,13 @@ public class TreatmentPlanController {
return treatmentPlanService.queryTreatmentPlanRecord(processId, disposalPlanType);
}
@ApiOperation("查询处置计划详情")
@GetMapping("/record/queryDetails")
public DealPlanResVO queryTreatmentPlanDetails(@ApiParam("流程实例id") @RequestParam("processId") String processId) {
return treatmentPlanService.queryTreatmentPlanDetails(processId);
}
@ApiOperation("查询药品列表")
@GetMapping("/getDrugList")

@ -14,9 +14,9 @@ public class DealPlanResVO {
private Integer userTreatmentPlanType;
@ApiModelProperty("处置方案列表")
private List<TreatmentPlanResult> drugTreatmentPlan;
private List<? extends TreatmentPlanRecord> drugTreatmentPlan;
private List<TreatmentPlanResult> otherTreatmentPlan;
private List<? extends TreatmentPlanRecord> otherTreatmentPlan;
@Data
@ -26,5 +26,8 @@ public class DealPlanResVO {
@ApiModelProperty("结果标识 0:错误 1:正确")
private Integer flag;
@ApiModelProperty("处置计划名")
private String disposalPlanName;
}
}

@ -2,6 +2,7 @@ package com.supervision.service;
import com.supervision.model.ConfigDrug;
import com.supervision.model.TreatmentPlanRecord;
import com.supervision.pojo.vo.DealPlanResVO;
import com.supervision.vo.manage.TreatmentPlanTreeNode;
import java.util.List;
@ -20,4 +21,6 @@ public interface TreatmentPlanService {
List<ConfigDrug> getDrugList();
List<TreatmentPlanTreeNode> queryTree(Integer disposalMethod);
DealPlanResVO queryTreatmentPlanDetails(String processId);
}

@ -4,6 +4,7 @@ package com.supervision.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.supervision.constant.TreatmentPlanIdConstant;
import com.supervision.exception.BusinessException;
import com.supervision.model.*;
import com.supervision.model.Process;
@ -126,9 +127,10 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
ArrayList<DealPlanResVO.TreatmentPlanResult> otherTreatmentPlanResults = new ArrayList<>();
for (TreatmentPlanRecord treatmentPlanRecord : treatmentPlanRecordList) {
DealPlanResVO.TreatmentPlanResult bean = BeanUtil.toBean(treatmentPlanRecord, DealPlanResVO.TreatmentPlanResult.class);
boolean flag = bean.getDisposalPlan().equals(1) ? drugIds.contains(bean.getDrugId()) : planIds.contains(bean.getTreatmentPlanId());
//药物id 8055ef3412a69f95
boolean flag = bean.getDisposalPlan().equals(TreatmentPlanIdConstant.DRUG_ID) ? drugIds.contains(bean.getDrugId()) : planIds.contains(bean.getTreatmentPlanId());
bean.setFlag(flag ? 1 : 0);
if (bean.getDisposalPlan().equals(1)) {
if (bean.getDisposalPlan().equals(TreatmentPlanIdConstant.DRUG_ID)) {
drugTreatmentPlanResults.add(bean);
} else {
otherTreatmentPlanResults.add(bean);

@ -1,13 +1,17 @@
package com.supervision.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import com.supervision.constant.TreatmentPlanIdConstant;
import com.supervision.controller.TreatmentPlanController;
import com.supervision.model.ConfigDrug;
import com.supervision.model.ConfigTreatmentPlan;
import com.supervision.model.Process;
import com.supervision.model.TreatmentPlanRecord;
import com.supervision.pojo.vo.DealPlanResVO;
import com.supervision.service.*;
import com.supervision.vo.manage.TreatmentPlanTreeNode;
import lombok.RequiredArgsConstructor;
@ -15,8 +19,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.sql.Struct;
import java.util.Collection;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Service
@ -47,7 +51,7 @@ public class TreatmentPlanServiceImpl implements TreatmentPlanService {
return treatmentPlanRecordService.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, processId)
.eq("0".equals(disposalPlanType), TreatmentPlanRecord::getDisposalPlan, "2")
.in("1".equals(disposalPlanType), TreatmentPlanRecord::getDisposalPlan,
CollUtil.newArrayList("1","3","4","5","6","7")).list();
CollUtil.newArrayList("80fbb83669f39773")).list();
}
@Override
@ -94,10 +98,62 @@ public class TreatmentPlanServiceImpl implements TreatmentPlanService {
return configTreatmentPlanService.queryTree(disposalMethod);
}
@Override
public DealPlanResVO queryTreatmentPlanDetails(String processId) {
// 1. 查询处置计划记录
List<TreatmentPlanRecord> treatmentPlanRecordList = treatmentPlanRecordService.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, processId).list();
DealPlanResVO dealPlanResVO = new DealPlanResVO();
if (CollUtil.isEmpty(treatmentPlanRecordList)){
dealPlanResVO.setOtherTreatmentPlan(CollectionUtil.newArrayList());
dealPlanResVO.setDrugTreatmentPlan(CollectionUtil.newArrayList());
return dealPlanResVO;
}
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"));
dealPlanResVO.setDrugTreatmentPlan(treatmentPlanIdMap.getOrDefault("DRUG", CollUtil.newArrayList()));
dealPlanResVO.setOtherTreatmentPlan(treatmentPlanIdMap.getOrDefault("OTHER", CollUtil.newArrayList()));
return dealPlanResVO;
}
private void assertSaveTreatmentPlanRecord(TreatmentPlanRecord record){
Assert.notEmpty(record.getProcessId(),"流程id不能为空");
Assert.notNull(record.getDisposalMethod(),"处置方式不能为为空");
Assert.notNull(record.getDisposalPlan(),"处置计划不能为空");
//Assert.notNull(record.getDisposalPlan(),"处置计划不能为空");
if (StrUtil.isEmpty(record.getTreatmentPlanId())){
Assert.notEmpty(record.getDrugId(),"药物id不能为空");
}

Loading…
Cancel
Save