|
@@ -0,0 +1,58 @@
|
|
|
+package com.diagbot.facade;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.diagbot.dto.GetAllBodypartDTO;
|
|
|
+import com.diagbot.entity.Bodypart;
|
|
|
+import com.diagbot.service.impl.BodypartServiceImpl;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.vo.GetAllBodypartVO;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description: 部位业务层
|
|
|
+ * @author: Weixuan Huang
|
|
|
+ * @time: 2019/1/16 14:17
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class BodypartFacade extends BodypartServiceImpl {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取所有部位
|
|
|
+ * @param getAllBodypartVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<GetAllBodypartDTO> getAllBodypart(GetAllBodypartVO getAllBodypartVO){
|
|
|
+ QueryWrapper<Bodypart> bodypartQe = new QueryWrapper<>();
|
|
|
+ bodypartQe.eq("is_deleted", "N");
|
|
|
+ if(StringUtil.isNotBlank(getAllBodypartVO.getBodypart())){
|
|
|
+ bodypartQe.like("bodypart", getAllBodypartVO.getBodypart());
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotBlank(getAllBodypartVO.getSubBodypart())){
|
|
|
+ bodypartQe.like("sub_bodypart", getAllBodypartVO.getSubBodypart());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<GetAllBodypartDTO> getAllBodypartDTOList = new ArrayList<>();
|
|
|
+ list(bodypartQe).forEach(i->{
|
|
|
+ GetAllBodypartDTO getAllBodypartDTO = new GetAllBodypartDTO();
|
|
|
+ if(getAllBodypartVO.getLevel()==1){
|
|
|
+ getAllBodypartDTO.setName(i.getBodypart());
|
|
|
+ getAllBodypartDTO.setOrderNo(i.getOrder());
|
|
|
+ }else{
|
|
|
+ getAllBodypartDTO.setName(i.getSubBodypart());
|
|
|
+ getAllBodypartDTO.setOrderNo(i.getSubOrder());
|
|
|
+ }
|
|
|
+ getAllBodypartDTOList.add(getAllBodypartDTO);
|
|
|
+ });
|
|
|
+
|
|
|
+ return getAllBodypartDTOList.stream().distinct().sorted((a,b)->{
|
|
|
+ return a.getOrderNo()-b.getOrderNo();
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|