Browse Source

Merge remote-tracking branch 'origin/dev/icss' into dev/icss

zhoutg 6 years ago
parent
commit
67a9c5a959

+ 6 - 1
icss-service/src/main/java/com/diagbot/dto/GetTopPatientInfoDTO.java

@@ -45,7 +45,12 @@ public class GetTopPatientInfoDTO {
 	 */
 	@ApiModelProperty(value="医院科室id")
 	private Long hospitalDeptId;
-    
+	
+    /**
+	 * 自己科室id
+	 */
+	@ApiModelProperty(value="自己科室id")
+	private Long selfDeptId;
     
     /**
      * 医院科室编码

+ 3 - 3
icss-service/src/main/java/com/diagbot/vo/SaveInquiryVO.java

@@ -81,11 +81,11 @@ public class SaveInquiryVO {
     private String diagnose;
 
     /**
-     * 内容输入类型:1:结构化 2:文本模式
+     * 内容输入类型:0:结构化 1:文本模式,默认结构化
      */
-	@ApiModelProperty(value="内容输入类型:0:结构化 1:文本模式")
+	@ApiModelProperty(value="内容输入类型:0:结构化 1:文本模式,默认是0结构化")
 	@Range(min=0,max=1,message="内容输入类型必须是0、1")
-    private Integer sign=1;
+    private Integer sign=0;
 
     /**
      * 内容JSON字符串

+ 1 - 1
icss-service/src/main/resources/mapper/InquiryInfoMapper.xml

@@ -29,7 +29,7 @@
 		FROM icss_inquiry_info a JOIN icss_inquiry_detail b 
 		on a.id=b.inquiry_id
 		where a.hospital_id=#{hospitalId} and a.patient_id=#{patientId}
-		and b.type=3 and a.is_deleted='N' 
+		and a.sign=0 and b.type=3 and a.is_deleted='N' 
 		and b.is_deleted='N' 
 		group by a.id
 		ORDER BY a.gmt_create desc

+ 1 - 0
icss-service/src/main/resources/mapper/PatientInfoMapper.xml

@@ -44,6 +44,7 @@
 		a.`code` as hospitalCode,
 		a.`name` as hospitalName,
 		b.id as hospitalDeptId,
+		b.dept_id as selfDeptId,
 		b.`code` as hospitalDeptCode,
 		b.`name` as hospitalDeptName,
 		c.id as doctorId,

+ 24 - 0
icssman-service/src/main/java/com/diagbot/dto/RetrievalExcelImDTO.java

@@ -0,0 +1,24 @@
+/**
+ * 
+ */
+package com.diagbot.dto;
+
+import java.util.List;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description
+ * @author rgb
+ * @time 2018年12月19日下午2:06:21
+ */
+@ApiModel(value="同义词excel文件导入接口出参")
+@Getter
+@Setter
+public class RetrievalExcelImDTO {
+	
+	private List<String> messages;
+
+}

+ 29 - 6
icssman-service/src/main/java/com/diagbot/facade/IntroduceInfoFacade.java

@@ -12,6 +12,8 @@ import com.diagbot.entity.IntroduceInfo;
 import com.diagbot.entity.IntroduceMap;
 import com.diagbot.entity.QuestionInfo;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.IntroduceDetailService;
 import com.diagbot.service.IntroduceMapService;
 import com.diagbot.service.impl.IntroduceInfoServiceImpl;
@@ -62,11 +64,18 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
      */
     public Boolean saveIntroduce(IntroduceVO introduceVO) {
         IntroduceInfo introduceInfo = new IntroduceInfo();
-        if (!(introduceVO.getId() == null||introduceInfo.getId().equals(0))) {
+        if (!(introduceVO.getId() == null || introduceInfo.getId().equals(0))) {
             introduceInfo = this.getById(introduceVO.getId());
-            introduceInfo.setModifier(UserUtils.getCurrentPrincipleID());
-            introduceInfo.setGmtModified(DateUtil.now());
+            if (introduceInfo == null) {
+                throw new CommonException(CommonErrorCode.NOT_EXISTS, "提示信息不存在");
+            } else if (introduceInfo.getIsDeleted().equals(IsDeleteEnum.Y.getKey())) {
+                throw new CommonException(CommonErrorCode.NOT_EXISTS, "提示信息已删除");
+            } else {
+                introduceInfo.setModifier(UserUtils.getCurrentPrincipleID());
+                introduceInfo.setGmtModified(DateUtil.now());
+            }
         }
+
         Date now = DateUtil.now();
         String userId = UserUtils.getCurrentPrincipleID();
         introduceInfo.setCreator(userId);
@@ -94,8 +103,10 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
         for (IntroduceDetailVO detailVO : introduceVO.getDetailVOList()) {
             IntroduceDetail detail = new IntroduceDetail();
             detail.setIntroduceId(introduceInfo.getId());
-            detail.setCreator(UserUtils.getCurrentPrincipleID());
-            detail.setGmtCreate(DateUtil.now());
+            detail.setCreator(userId);
+            detail.setGmtCreate(now);
+            detail.setModifier(userId);
+            detail.setGmtModified(now);
             detail.setContent(detailVO.getContent());
             detail.setText(detailVO.getText());
             detail.setTitle(detailVO.getTitle());
@@ -109,8 +120,10 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
 
         //更新映射关系
         //删除已有映射关系
+        List<Long> questionIds = introduceVO.getMapVOList().stream().map(introduceMapVO -> introduceMapVO.getQuestionId()).collect(Collectors.toList());
+        Long introudceId = introduceInfo.getId();
         UpdateWrapper<IntroduceMap> introduceMapUpdateWrapper = new UpdateWrapper<>();
-        introduceMapUpdateWrapper.eq("introduce_id", introduceInfo.getId()).
+        introduceMapUpdateWrapper.and(i -> i.eq("introduce_id", introudceId).or().in("question_id", questionIds)).
                 eq("is_deleted", IsDeleteEnum.N.getKey()).
                 set("is_deleted", IsDeleteEnum.Y.getKey()).
                 set("modifier", UserUtils.getCurrentPrincipleID()).
@@ -122,6 +135,10 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
             IntroduceMap introduceMap = new IntroduceMap();
             BeanUtil.copyProperties(introduceMapVO, introduceMap);
             introduceMap.setIntroduceId(introduceInfo.getId());
+            introduceMap.setCreator(userId);
+            introduceMap.setGmtCreate(now);
+            introduceMap.setModifier(userId);
+            introduceMap.setGmtModified(now);
             introduceMapList.add(introduceMap);
         }
         introduceMapService.saveBatch(introduceMapList);
@@ -135,6 +152,12 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
      * @return
      */
     public Boolean deleteRecord(Long id) {
+        IntroduceInfo introduceInfo = this.getById(id);
+        if (introduceInfo == null) {
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "提示信息不存在");
+        } else if (introduceInfo.getIsDeleted().equals(IsDeleteEnum.Y.getKey())) {
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "提示信息已删除");
+        }
         //删除已有映射关系
         UpdateWrapper<IntroduceMap> introduceMapUpdateWrapper = new UpdateWrapper<>();
         introduceMapUpdateWrapper.eq("introduce_id", id).

+ 190 - 3
icssman-service/src/main/java/com/diagbot/facade/RetrievalFacade.java

@@ -1,27 +1,41 @@
 package com.diagbot.facade;
 
+import java.io.InputStream;
+import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
-import com.diagbot.enums.IsDeleteEnum;
+import org.apache.commons.lang.time.DateFormatUtils;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.client.UserServiceClient;
 import com.diagbot.dto.GetRetrievalsByTagDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.RetrievalExcelImDTO;
 import com.diagbot.dto.RetrievalListDTO;
+import com.diagbot.entity.QuestionInfo;
 import com.diagbot.entity.Retrieval;
 import com.diagbot.entity.RetrievalMapping;
+import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.RetrievalServiceImpl;
 import com.diagbot.util.DateUtil;
+import com.diagbot.util.StringUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.AddTagRetrievalDetailVO;
 import com.diagbot.vo.AddTagRetrievalVO;
@@ -40,6 +54,8 @@ public class RetrievalFacade extends RetrievalServiceImpl {
     @Autowired
     private RetrievalMappingFacade retrievalMappingFacade;
     @Autowired
+    private QuestionInfoFacade questionInfoFacade;
+    @Autowired
     private UserServiceClient userServiceClient;
 
     /**
@@ -80,6 +96,11 @@ public class RetrievalFacade extends RetrievalServiceImpl {
      * @return
      */
     public Boolean addTagRetrieval(AddTagRetrievalVO addTagRetrievalVO) {
+    	if(addTagRetrievalVO.getItemList().stream().distinct().count()!=addTagRetrievalVO.getItemList().size()){
+    		throw new CommonException(CommonErrorCode.RPC_ERROR,
+                    "同义词中存在重复数据!");
+    	}
+    	
     	Date now = DateUtil.now();
     	String userId = UserUtils.getCurrentPrincipleID();
     	
@@ -166,14 +187,180 @@ public class RetrievalFacade extends RetrievalServiceImpl {
 	 */
     public IPage<RetrievalListDTO> retrievalList(RetrievalListVO retrievalListVO) {
         IPage<RetrievalListDTO> ipage = this.getRetrievalList(retrievalListVO);
-        List<String> ids = ipage.getRecords().stream().map(i->i.getOperatorName()).collect(Collectors.toList());
+        
+        List<RetrievalListDTO> retrievalListDTOList = ipage.getRecords();
+        if(retrievalListDTOList.size()==0){
+        	return ipage;
+        }
+        
+        List<Long> questionIds = retrievalListDTOList.stream().map(i->i.getQuestionId()).collect(Collectors.toList());
+        
+        QueryWrapper<RetrievalMapping> retrievalMappingQe = new QueryWrapper<RetrievalMapping>();
+        retrievalMappingQe.in("question_id", questionIds);
+        List<RetrievalMapping> retrievalMappings = retrievalMappingFacade.list(retrievalMappingQe);
+        Map<Long,List<RetrievalMapping>> retrievalMappingListMap = retrievalMappings.stream().collect(Collectors.groupingBy(RetrievalMapping::getQuestionId));
+        
+        List<Long> retrievalIds = retrievalMappings.stream().map(i->i.getRetrievalId()).distinct().collect(Collectors.toList());
+        Map<Long,Retrieval> retrievalMap = this.listByIds(retrievalIds).stream().filter(i->i.getIsDeleted().equals("N")).collect(Collectors.toMap(Retrieval::getId,i->i));
+        
+        retrievalListDTOList.forEach(retrievalListDTO->{
+        	List<RetrievalMapping> retrievalMappingList = retrievalMappingListMap.get(retrievalListDTO.getQuestionId());
+        	retrievalMappingList = retrievalMappingList.stream().filter(i->retrievalMap.get(i.getRetrievalId())==null).sorted((t1,t2)->t2.getGmtModified().compareTo(t1.getGmtModified())).collect(Collectors.toList());
+        	retrievalListDTO.setOperatorName(retrievalMappingList.get(0).getModifier());
+        	retrievalListDTO.setRetrievalSelfName(retrievalMappingList.stream().filter(i->i.getShowType()==1&&i.getIsDeleted().equals("N")).map(i->retrievalMap.get(i.getRetrievalId()).getName()).collect(Collectors.joining()));
+        	retrievalListDTO.setRetrievalNames(retrievalMappingList.stream().filter(i->i.getShowType()==2&&i.getIsDeleted().equals("N")).map(i->retrievalMap.get(i.getRetrievalId()).getName()).collect(Collectors.joining()));
+        	retrievalListDTO.setRetrievalSonNames(retrievalMappingList.stream().filter(i->i.getShowType()==3&&i.getIsDeleted().equals("N")).map(i->retrievalMap.get(i.getRetrievalId()).getName()).collect(Collectors.joining()));
+        });
+        
+        List<String> ids = retrievalListDTOList.stream().map(i->i.getOperatorName()).collect(Collectors.toList());
         RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
         if (respDTO == null || !CommonErrorCode.OK.getCode().equals(respDTO.code)) {
             throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取用户信息失败");
         }
-        ipage.getRecords().forEach(i->i.setOperatorName(respDTO.data.get(i.getOperatorName())));
+        
+        retrievalListDTOList.forEach(i->i.setOperatorName(respDTO.data.get(i.getOperatorName())));
+        ipage.setRecords(retrievalListDTOList);
         return ipage;
     }
+    
+    /**
+     * 同义词excel文件导入
+     * @param file
+     * @return
+     */
+    public RetrievalExcelImDTO retrievalExcelIm(MultipartFile file){
+    	List<AddTagRetrievalVO> addTagRetrievalVOList = new ArrayList<>();
+    	List<String> messages = new ArrayList<>();
+    	InputStream inputStream = null;
+        Workbook wb = null;
+    	try{
+    		if(!file.isEmpty()){
+    			inputStream = file.getInputStream();
+                if(inputStream.available() > 512000){
+                    messages.add("文件最大支持500KB!");
+                }else{
+                	String fileName = file.getOriginalFilename();
+                	if(fileName.lastIndexOf(".") != -1){
+                		String type = fileName.substring(fileName.lastIndexOf("."));
+                        if (type.equals(".xls")) {
+                            wb = new HSSFWorkbook(inputStream);
+                        } else if (type.equals(".xlsx")) {
+                            wb = new XSSFWorkbook(inputStream);
+                        }
+                        if(wb!=null){
+                        	List<AddTagRetrievalDetailVO> detailList = new ArrayList<>();
+                        	Sheet sheet = wb.getSheetAt(0);
+                            int count = 0;
+                            String questionName,retrievalName,retrievalSpell,retrievalType;
+                            for(Row row : sheet){
+                            	count++;
+                            	if (count == 1||row==null) {
+                            		continue;
+                                }
+                            	questionName = getValue(row.getCell(0)).trim().replace(" ", "");
+                                retrievalName = getValue(row.getCell(1)).trim().replace(" ", "");
+                                retrievalSpell = getValue(row.getCell(2)).trim().replace(" ", "");
+                                retrievalType = getValue(row.getCell(3)).trim().replace(" ", "");
+                            	if(StringUtil.isEmpty(questionName) || StringUtil.isEmpty(retrievalName)
+                                        || StringUtil.isEmpty(retrievalSpell) || StringUtil.isEmpty(retrievalType)){
+                            		messages.add("第"+count+"行数据不完整!");
+                            		continue;
+                            	}
+                            	
+                            	AddTagRetrievalDetailVO addTagRetrievalDetailVO = new AddTagRetrievalDetailVO();
+                            	addTagRetrievalDetailVO.setQuestionName(questionName);
+                            	addTagRetrievalDetailVO.setRetrievalName(retrievalName);
+                            	addTagRetrievalDetailVO.setRetrievalSpell(retrievalSpell);
+                            	addTagRetrievalDetailVO.setRetrievalType(Integer.parseInt(retrievalType));
+                            	detailList.add(addTagRetrievalDetailVO);
+                            }
+                            
+                            if(detailList.size()>0){
+                            	List<String> questionNames = detailList.stream().map(i->i.getQuestionName()).distinct().collect(Collectors.toList());
+                            	QueryWrapper<QuestionInfo> questionInfoQe = new QueryWrapper<>();
+                            	questionInfoQe.in("tag_name",questionNames);
+                            	List<QuestionInfo> questionInfos = questionInfoFacade.list(questionInfoQe);
+                            	if(questionInfos.size()>0){
+                            		Map<String,Long> questionIdMap = questionInfos.stream().collect(Collectors.toMap(QuestionInfo::getTagName, i->i.getId()));
+                            		detailList.forEach(i->{
+                            			i.setQuestionId(questionIdMap.get(i.getQuestionName()));
+                            		});
+                            		Map<Long,List<AddTagRetrievalDetailVO>> detailMap = detailList.stream().collect(Collectors.groupingBy(AddTagRetrievalDetailVO::getQuestionId));
+                                    for(Long key : detailMap.keySet()){
+                                    	AddTagRetrievalVO addTagRetrievalVO = new AddTagRetrievalVO();
+                                    	addTagRetrievalVO.setQuestionId(key);
+                                    	addTagRetrievalVO.setItemList(detailMap.get(key));
+                                    	addTagRetrievalVOList.add(addTagRetrievalVO);
+                                    }
+                            	}
+                            }
+                        }else{
+                        	messages.add("非excel文件无法解析!");
+                        }
+                	}else{
+                		messages.add("未知文件无法解析!");
+                	}
+                }
+    		}else{
+    			messages.add("无文件上传!");
+    		}
+    	}catch(Exception e){
+    		messages.add("解析失败!");
+    	}finally{
+    		try{
+    			if(wb!=null){
+    				wb.close();
+    			}
+    			if(inputStream!=null){
+    				inputStream.close();
+    			}
+    		}catch(Exception e){
+    		}
+    	}
+    	
+    	addTagRetrievalVOList.forEach(i->{
+    		addTagRetrieval(i);
+    	});
+    	
+    	RetrievalExcelImDTO retrievalExcelImDTO = new RetrievalExcelImDTO();
+    	retrievalExcelImDTO.setMessages(messages);
+    	return null;
+    }
+    
+    @SuppressWarnings("deprecation")
+	private String getValue(Cell cell) {
+        try {
+            Object obj = null;
+            switch (cell.getCellTypeEnum()) {
+                case BOOLEAN:
+                    obj = cell.getBooleanCellValue();
+                    break;
+                case ERROR:
+                    obj = cell.getErrorCellValue();
+                    break;
+                case NUMERIC:
+                    if (HSSFDateUtil.isCellDateFormatted(cell)) {
+                        Date date = cell.getDateCellValue();
+                        obj = DateFormatUtils.format(date, "yyyy-MM-dd");
+                    } else {
+                        obj = cell.getNumericCellValue();
+                        DecimalFormat df = new DecimalFormat("0");
+                        obj = df.format(obj);
+                    }
+
+                    // obj = cell.getNumericCellValue();
+                    break;
+                case STRING:
+                    obj = cell.getStringCellValue();
+                    break;
+                default:
+                    break;
+            }
+            return obj.toString();
+        } catch (Exception e) {
+            return "";
+        }
+    }
 
 }

+ 37 - 0
icssman-service/src/main/java/com/diagbot/vo/AddTagRetrievalDetailVO.java

@@ -18,6 +18,18 @@ import lombok.Setter;
 @Setter
 public class AddTagRetrievalDetailVO {
 	
+	/**
+     * 标签id
+     */
+	@ApiModelProperty(value="标签id")
+	private Long questionId; 
+	
+	/**
+	 * 标签名称
+	 */
+	@ApiModelProperty(value="标签名称")
+	private String questionName;
+	
 	/**
 	 * 同义词名称
 	 */
@@ -38,5 +50,30 @@ public class AddTagRetrievalDetailVO {
 	@ApiModelProperty(value="同义词种类",required=true)
 	@NotNull(message="同义词种类必传")
 	private Integer retrievalType;
+
+	@Override
+	public boolean equals(Object obj) {
+		if(this==obj){
+			return true;
+		}
+		if(obj instanceof AddTagRetrievalDetailVO){
+			AddTagRetrievalDetailVO addTagRetrievalDetailVO = (AddTagRetrievalDetailVO)obj;
+			if(addTagRetrievalDetailVO.getRetrievalName().equals(this.retrievalName)
+					&&addTagRetrievalDetailVO.getRetrievalType()==this.retrievalType){
+				return true;
+			}else{
+				return false;
+			}
+		}else{
+			return false;
+		}
+	}
+
+	@Override
+	public int hashCode() {
+		return this.retrievalName.hashCode()+this.retrievalType;
+	}
+	
+	
 	
 }

+ 6 - 0
icssman-service/src/main/java/com/diagbot/vo/AddTagRetrievalVO.java

@@ -28,6 +28,12 @@ public class AddTagRetrievalVO {
 	@NotNull(message="标签id必传")
     private Long questionId;
 	
+	/**
+	 * 标签名称
+	 */
+	@ApiModelProperty(value="标签名称")
+	private String questionName;
+	
 	@Valid
 	@ApiModelProperty(value="同义词集合",required=true)
 	@NotEmpty(message="同义词必传")

+ 13 - 0
icssman-service/src/main/java/com/diagbot/web/RetrievalController.java

@@ -2,6 +2,7 @@ package com.diagbot.web;
 
 import java.util.List;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -9,12 +10,15 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.GetRetrievalsByTagDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.RetrievalExcelImDTO;
 import com.diagbot.dto.RetrievalListDTO;
 import com.diagbot.facade.RetrievalFacade;
 import com.diagbot.vo.AddTagRetrievalVO;
@@ -72,5 +76,14 @@ public class RetrievalController {
     	IPage<RetrievalListDTO> ipage = retrievalFacade.retrievalList(retrievalListVO);
 		return RespDTO.onSuc(ipage);
 	}
+    
+    @ApiOperation(value = "同义词excel文件导入[by:rengb]")
+    @PostMapping("/retrievalExcelIm")
+    @SysLogger("retrievalExcelIm")
+    @Transactional
+    public RespDTO<RetrievalExcelImDTO> retrievalExcelIm(@RequestParam("uploadfile") MultipartFile file,HttpServletRequest request) {
+        return RespDTO.onSuc(retrievalFacade.retrievalExcelIm(file));
+    }
+    
 
 }

+ 8 - 16
icssman-service/src/main/resources/mapper/RetrievalMapper.xml

@@ -39,24 +39,16 @@
 	
 	<select id="getRetrievalList" parameterType="com.diagbot.vo.RetrievalListVO" 
 		resultType="com.diagbot.dto.RetrievalListDTO">
-		SET sql_mode="";
 		SELECT
-		id as questionId,
-		tag_name as questionName,
-		creator as operatorName,
-		gmt_create as gmtOperate,
-		GROUP_CONCAT(CASE WHEN show_type=1 THEN `name` ELSE NULL END SEPARATOR '、') as retrievalSelfName,
-		GROUP_CONCAT(CASE WHEN show_type=2 THEN `name` ELSE NULL END SEPARATOR '、') as retrievalNames,
-		GROUP_CONCAT(CASE WHEN show_type=3 THEN `name` ELSE NULL END SEPARATOR '、') as retrievalSonNames
-		FROM
-		(SELECT
-		a.id,a.tag_name,b.creator,b.gmt_create,b.show_type,c.`name`
-		FROM icss_question_info a LEFT JOIN icss_retrieval_mapping b ON a.id=b.question_id
-		LEFT JOIN icss_retrieval c ON b.retrieval_id=c.id
-		WHERE a.is_deleted='N' AND b.is_deleted='N' AND c.is_deleted='N'
+		a.id as questionId,
+		a.tag_name as questionName,
+		MAX(b.gmt_modified) as gmtOperate
+		FROM icss_question_info a JOIN icss_retrieval_mapping b ON a.id=b.question_id
+		JOIN icss_retrieval c ON b.retrieval_id=c.id
+		WHERE a.is_deleted='N' AND c.is_deleted='N'
 		AND a.tag_name LIKE CONCAT('%',#{questionName},'%')
-		ORDER BY b.gmt_create DESC) t
-		GROUP BY t.id
+		GROUP BY a.id
+		ORDER BY gmtOperate DESC
 	</select>
 
 </mapper>