rgb 6 роки тому
батько
коміт
bf17b51936

+ 10 - 7
knowledgeman-service/src/main/java/com/diagbot/client/UserServiceClient.java

@@ -1,12 +1,14 @@
 package com.diagbot.client;
 
-import com.diagbot.client.hystrix.UserServiceHystrix;
-import com.diagbot.dto.RespDTO;
-import com.diagbot.entity.User;
+import java.util.List;
+import java.util.Map;
+
 import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import com.diagbot.client.hystrix.UserServiceHystrix;
+import com.diagbot.dto.RespDTO;
 
 
 /**
@@ -17,8 +19,9 @@ import org.springframework.web.bind.annotation.RequestHeader;
 @FeignClient(value = "user-service", fallback = UserServiceHystrix.class)
 public interface UserServiceClient {
 
-    @PostMapping(value = "/user/{username}")
-    RespDTO<User> getUser(@RequestHeader(value = "Authorization") String token, @PathVariable("username") String username);
+    @PostMapping(value = "/user/getUserInfoByIds")
+    RespDTO<Map<String, String>> getUserInfoByIds(@RequestBody List<String> ids);
+    
 }
 
 

+ 11 - 5
knowledgeman-service/src/main/java/com/diagbot/client/hystrix/UserServiceHystrix.java

@@ -1,9 +1,15 @@
 package com.diagbot.client.hystrix;
 
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
+
 import com.diagbot.client.UserServiceClient;
 import com.diagbot.dto.RespDTO;
-import com.diagbot.entity.User;
-import org.springframework.stereotype.Component;
+
+import lombok.extern.slf4j.Slf4j;
 
 
 /**
@@ -12,12 +18,12 @@ import org.springframework.stereotype.Component;
  * @time: 2018/8/6 9:52
  */
 @Component
+@Slf4j
 public class UserServiceHystrix implements UserServiceClient {
 
     @Override
-    public RespDTO<User> getUser(String token, String username) {
-        System.out.println(token);
-        System.out.println(username);
+    public RespDTO<Map<String, String>> getUserInfoByIds(@RequestBody List<String> ids) {
+        log.error("【hystrix】调用{}异常", "getUserInfoByIds");
         return null;
     }
 }

+ 19 - 1
knowledgeman-service/src/main/java/com/diagbot/dto/GetMedicalInfoDetailDTO.java

@@ -17,7 +17,19 @@ public class GetMedicalInfoDetailDTO {
      * 术语概念id
      */
 	@ApiModelProperty(value="术语概念id")
-    private Integer conceptId;
+    private Long conceptId;
+	
+	/**
+     * 术语概念名称
+     */
+	@ApiModelProperty(value="术语概念名称")
+    private String conceptName;
+	
+	/**
+     * 术语概念类型
+     */
+	@ApiModelProperty(value="术语概念类型")
+    private String conceptType;
 
     /**
      * 术语名称
@@ -42,6 +54,12 @@ public class GetMedicalInfoDetailDTO {
      */
 	@ApiModelProperty(value="术语类组")
     private String grp;
+	
+    /**
+     * 效用名称
+     */
+	@ApiModelProperty(value="效用名称")
+    private String function;
 
     /**
      * 性别:1:男, 2:女, 3:通用

+ 70 - 0
knowledgeman-service/src/main/java/com/diagbot/dto/GetMedicalInfoListDTO.java

@@ -0,0 +1,70 @@
+package com.diagbot.dto;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description
+ * @author rgb
+ * @time 2018年12月5日下午5:00:34
+ */
+@Getter
+@Setter
+public class GetMedicalInfoListDTO {
+	
+    /**
+     * 术语医学属性id
+     */
+	@ApiModelProperty(value="术语医学属性id")
+    private Long medicalId;
+    
+    /**
+     * 概念id
+     */
+	@ApiModelProperty(value="概念id")
+    private Long conceptId;
+    
+    /**
+     * 医学标准术语
+     */
+	@ApiModelProperty(value="医学标准术语")
+    private String libName;
+    
+    /**
+     * 术语类型
+     */
+	@ApiModelProperty(value="术语类型")
+    private String libType;
+    
+    /**
+     * 同义词
+     */
+	@ApiModelProperty(value="同义词")
+    private String otherNames;
+    
+    /**
+     * 操作人
+     */
+	@ApiModelProperty(value="操作人")
+    private String operName;
+    
+    /**
+     * 操作时间
+     */
+	@JsonFormat(timezone="GMT+8",pattern ="yyyy-MM-dd HH:mm")
+	@ApiModelProperty(value="操作时间")
+    private Date operTime;
+    
+    
+    
+    
+    
+    
+    
+
+}

+ 158 - 206
knowledgeman-service/src/main/java/com/diagbot/facade/MedicalFacade.java

@@ -4,6 +4,7 @@ import java.io.InputStream;
 import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -17,29 +18,31 @@ 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.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.multipart.MultipartFile;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.diagbot.dto.ConceptDTO;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.client.UserServiceClient;
 import com.diagbot.dto.GetMedicalInfoDetailDTO;
-import com.diagbot.dto.TypeDTO;
+import com.diagbot.dto.GetMedicalInfoListDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.Concept;
 import com.diagbot.entity.LibraryInfo;
 import com.diagbot.entity.Medical;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.service.MedicalService;
 import com.diagbot.service.impl.MedicalServiceImpl;
 import com.diagbot.util.BeanUtil;
+import com.diagbot.util.DateUtil;
 import com.diagbot.util.StringUtil;
-import com.diagbot.vo.AddConceptInfoDetailVO;
-import com.diagbot.vo.AddConceptInfoVO;
+import com.diagbot.util.UserUtils;
 import com.diagbot.vo.AddMedicalInfoVO;
-import com.diagbot.vo.AmendTermVo;
 import com.diagbot.vo.GetMedicalInfoDetailVO;
+import com.diagbot.vo.GetMedicalInfoListVO;
 import com.diagbot.vo.RemoveMedicalInfoVO;
-import com.diagbot.vo.TermVo;
-import com.diagbot.vo.TypeVo;
 
 /**
  * @Description: 术语临床信息查询业务层
@@ -53,6 +56,30 @@ public class MedicalFacade extends MedicalServiceImpl {
     private ConceptFacade conceptFacade;
     @Autowired
     private LibraryInfoFacade libraryInfoFacade;
+    @Autowired
+    @Qualifier("medicalServiceImpl")
+    private MedicalService medicalService;
+    @Autowired
+    private UserServiceClient userServiceClient;
+    
+    /**
+     * 获取医学术语命名列表
+     * @param getMedicalInfoListVO
+     * @return
+     */
+    public IPage<GetMedicalInfoListDTO> getMedicalInfoList(GetMedicalInfoListVO getMedicalInfoListVO) {
+    	IPage<GetMedicalInfoListDTO> ipage = this.baseMapper.getMedicalInfoList(getMedicalInfoListVO);
+    	List<String> ids = ipage.getRecords().stream().map(i->i.getOperName()).distinct().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.setOperName(respDTO.data.get(i.getOperName()));
+    	});
+        return ipage;
+    }
     
     /**
      * 医学术语命名删除
@@ -60,10 +87,15 @@ public class MedicalFacade extends MedicalServiceImpl {
      * @return
      */
     public Boolean removeMedicalInfo(RemoveMedicalInfoVO removeMedicalInfoVO) {
-    	QueryWrapper<Medical> medicalQe = new QueryWrapper<Medical>();
-    	medicalQe.eq("concept_id", removeMedicalInfoVO.getConceptId());
-    	remove(medicalQe);
-        return true;
+    	Medical medical = this.getById(removeMedicalInfoVO.getMedicalId());
+    	if(medical==null||medical.getIsDeleted().equals("Y")){
+    		throw new CommonException(CommonErrorCode.NOT_EXISTS);
+    	}
+    	
+    	medical.setIsDeleted("Y");
+    	medical.setModifier(UserUtils.getCurrentPrincipleID());
+    	medical.setGmtModified(DateUtil.now());
+        return updateById(medical);
     }
     
     /**
@@ -72,16 +104,25 @@ public class MedicalFacade extends MedicalServiceImpl {
      * @return
      */
     public GetMedicalInfoDetailDTO getMedicalInfoDetail(GetMedicalInfoDetailVO getMedicalInfoDetailVO){
-    	QueryWrapper<Medical> medicalQe = new QueryWrapper<Medical>();
-    	medicalQe.eq("concept_id", getMedicalInfoDetailVO.getConceptId());
-    	medicalQe.eq("is_deleted", "N");
-    	Medical medical = getOne(medicalQe);
-    	if(medical==null){
-    		return null;
+    	Medical medical = this.getById(getMedicalInfoDetailVO.getMedicalId());
+    	if(medical==null||medical.getIsDeleted().equals("Y")){
+    		throw new CommonException(CommonErrorCode.NOT_EXISTS);
     	}
     	
+    	QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<LibraryInfo>();
+		libraryInfoQe.eq("is_deleted", "N");
+		libraryInfoQe.eq("is_concept", "1");
+		libraryInfoQe.eq("concept_id", medical.getConceptId());
+		LibraryInfo libraryInfo = libraryInfoFacade.getOne(libraryInfoQe);
+		if(libraryInfo==null){
+			throw new CommonException(CommonErrorCode.RPC_ERROR,"术语医学属性所属概念不存在!");
+		}
+    	
     	GetMedicalInfoDetailDTO getMedicalInfoDetailDTO = new GetMedicalInfoDetailDTO();
     	BeanUtil.copyProperties(medical, getMedicalInfoDetailDTO);
+    	getMedicalInfoDetailDTO.setConceptName(libraryInfo.getName());
+    	getMedicalInfoDetailDTO.setConceptType(libraryInfo.getType());
+    	
     	return getMedicalInfoDetailDTO;
     }
     
@@ -91,30 +132,38 @@ public class MedicalFacade extends MedicalServiceImpl {
      * @return
      */
 	public Boolean addMedicalInfo(AddMedicalInfoVO addMedicalInfoVO){
-		String message = checkAddMedicalInfoVO(addMedicalInfoVO);
+		Map<String,Object> ckMap = checkAddMedicalInfoVO(addMedicalInfoVO);
+		Object message = ckMap.get("message");
 		if(message!=null){
-			throw new CommonException(CommonErrorCode.RPC_ERROR,message);
+			throw new CommonException(CommonErrorCode.RPC_ERROR,message.toString());
 		}
-		Medical medical = new Medical();
-		BeanUtil.copyProperties(addMedicalInfoVO, medical);
-		save(medical);
-    	return true;
+		return saveOrUpdate((Medical)(ckMap.get("medical")));
     }
 	
 	/**
 	 * 校验即将添加的数据
 	 * @param addMedicalInfoVO
-	 * @return
+	 * @return 返回map中,包含2个字段:message和medical,message-为空时,表示正常,取medical
 	 */
-	private String checkAddMedicalInfoVO(AddMedicalInfoVO addMedicalInfoVO){
+	private Map<String,Object> checkAddMedicalInfoVO(AddMedicalInfoVO addMedicalInfoVO){
+		Map<String,Object> retMap = new HashMap<>();
+		
 		QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<LibraryInfo>();
 		libraryInfoQe.eq("is_deleted", "N");
+		libraryInfoQe.eq("is_concept", "1");
 		libraryInfoQe.eq("name", addMedicalInfoVO.getConceptName());
 		libraryInfoQe.eq("type", addMedicalInfoVO.getConceptType());
-		libraryInfoQe.eq("is_concept", "1");
+		
 		LibraryInfo libraryInfo = libraryInfoFacade.getOne(libraryInfoQe);
 		if(libraryInfo==null){
-			return "概念不存在";
+			retMap.put("message", "术语概念名称不存在");
+			return retMap;
+		}
+		
+		Concept concept = conceptFacade.getById(libraryInfo.getConceptId());
+		if(concept==null||concept.getIsDeleted().equals("Y")){
+			retMap.put("message", "术语概念名称不存在");
+			return retMap;
 		}
 		
 		List<String> infoNames = new ArrayList<>();
@@ -125,21 +174,44 @@ public class MedicalFacade extends MedicalServiceImpl {
 		QueryWrapper<LibraryInfo> libraryInfoQe1 = new QueryWrapper<LibraryInfo>();
 		libraryInfoQe1.in("name", infoNames);
 		libraryInfoQe1.eq("is_concept", "1");
+		libraryInfoQe1.eq("is_deleted", "N");
 		Map<String,List<LibraryInfo>> libraryInfoListMap = libraryInfoFacade.list(libraryInfoQe1).stream().collect(Collectors.groupingBy(LibraryInfo::getName));
 		if(libraryInfoListMap.get(addMedicalInfoVO.getName()).size()==0){
-			return "术语名称不存在";
+			retMap.put("message", "术语名称不存在");
+			return retMap;
 		}
 		if(libraryInfoListMap.get(addMedicalInfoVO.getStdName()).size()==0){
-			return "术语标准名不存在";
+			retMap.put("message", "术语标准名不存在");
+			return retMap;
 		}
 		if(libraryInfoListMap.get(addMedicalInfoVO.getCateName()).size()==0){
-			return "术语小类名称不存在";
+			retMap.put("message", "术语小类名称不存在");
+			return retMap;
 		}
 		if(libraryInfoListMap.get(addMedicalInfoVO.getGrp()).size()==0){
-			return "术语类组不存在";
+			retMap.put("message", "术语类组不存在");
+			return retMap;
+		}
+		
+		String currentUser = UserUtils.getCurrentPrincipleID();
+		Date now = DateUtil.now();
+		QueryWrapper<Medical> medicalQe = new QueryWrapper<>();
+		medicalQe.eq("concept_id", libraryInfo.getConceptId());
+		Medical medical = this.getOne(medicalQe);
+		if(medical==null){
+			medical = new Medical();
+			medical.setCreator(currentUser);
+			medical.setGmtCreated(now);
 		}
+		medical.setIsDeleted("N");
+		medical.setModifier(currentUser);
+		medical.setGmtModified(now);
+		medical.setConceptId(libraryInfo.getConceptId());
+		BeanUtil.copyProperties(addMedicalInfoVO, medical);
 		
-		return null;
+		retMap.put("medical", medical);
+		
+		return retMap;
 	}
     
 	/**
@@ -147,7 +219,6 @@ public class MedicalFacade extends MedicalServiceImpl {
      * @param file
      * @return
      */
-    @SuppressWarnings("unchecked")
 	public Boolean medicalInfoExcelIm(MultipartFile file) {
         List<AddMedicalInfoVO> addMedicalInfoVOList = new ArrayList<>();
         StringBuffer sbf = new StringBuffer();
@@ -171,7 +242,8 @@ public class MedicalFacade extends MedicalServiceImpl {
                             
                             Sheet sheet = wb.getSheetAt(0);
                             int count = 0;
-                            String conceptName, conceptType, name, stdName, cateName, grp, gender, minAge, maxAge, bodypart, subBodypart, dept, code, note;
+                            String conceptName, conceptType, name, stdName, cateName, grp, gender, minAge, maxAge, bodypart, subBodypart, displayOrder, dept, code, note;
+                            Integer minAge_, maxAge_;
                             for (Row row : sheet) {
                                 count++;
                                 if (count == 1 || row == null) {
@@ -179,8 +251,8 @@ public class MedicalFacade extends MedicalServiceImpl {
                                 }
                                 conceptName = getValue(row.getCell(0)).trim().replace(" ", "");
                                 conceptType = getValue(row.getCell(1)).trim().replace(" ", "");
-                                name = getValue(row.getCell(1)).trim().replace(" ", "");
-                                stdName = getValue(row.getCell(2)).trim().replace(" ", "");
+                                name = getValue(row.getCell(2)).trim().replace(" ", "");
+                                stdName = getValue(row.getCell(3)).trim().replace(" ", "");
                                 cateName = getValue(row.getCell(4)).trim().replace(" ", "");
                                 grp = getValue(row.getCell(5)).trim().replace(" ", "");
                                 gender = getValue(row.getCell(6)).trim().replace(" ", "");
@@ -188,16 +260,18 @@ public class MedicalFacade extends MedicalServiceImpl {
                                 maxAge = getValue(row.getCell(8)).trim().replace(" ", "");
                                 bodypart = getValue(row.getCell(9)).trim().replace(" ", "");
                                 subBodypart = getValue(row.getCell(10)).trim().replace(" ", "");
-                                dept = getValue(row.getCell(11)).trim().replace(" ", "");
-                                code = getValue(row.getCell(12)).trim().replace(" ", "");
-                                note = getValue(row.getCell(13)).trim().replace(" ", "");
+                                displayOrder = getValue(row.getCell(11)).trim().replace(" ", "");
+                                dept = getValue(row.getCell(12)).trim().replace(" ", "");
+                                code = getValue(row.getCell(13)).trim().replace(" ", "");
+                                note = getValue(row.getCell(14)).trim().replace(" ", "");
                                 if(StringUtil.isEmpty(conceptName) && StringUtil.isEmpty(name)
                                         && StringUtil.isEmpty(stdName) && StringUtil.isEmpty(cateName)
                                         && StringUtil.isEmpty(grp) && StringUtil.isEmpty(gender)
                                         && StringUtil.isEmpty(minAge) && StringUtil.isEmpty(maxAge)
                                         && StringUtil.isEmpty(bodypart) && StringUtil.isEmpty(subBodypart)
-                                        && StringUtil.isEmpty(dept) && StringUtil.isEmpty(code)
-                                        && StringUtil.isEmpty(note) && StringUtil.isEmpty(conceptType)){
+                                        && StringUtil.isEmpty(displayOrder)&& StringUtil.isEmpty(dept) 
+                                        && StringUtil.isEmpty(code)&& StringUtil.isEmpty(note) 
+                                        && StringUtil.isEmpty(conceptType)){
                                 	continue;
                                 }
                                 if (StringUtil.isEmpty(conceptName) || StringUtil.isEmpty(name)
@@ -210,6 +284,11 @@ public class MedicalFacade extends MedicalServiceImpl {
                                     continue;
                                 }
                                 
+                                if(!gender.equals("1")&&!gender.equals("2")&&!gender.equals("3")){
+                                	sbf.append("第" + count + "行数据中性别非1、2、3;").append("<br/>");
+                                	continue;
+                                }
+                                
                                 AddMedicalInfoVO addMedicalInfoVO = new AddMedicalInfoVO();
                                 addMedicalInfoVO.setConceptName(conceptName);
                                 addMedicalInfoVO.setConceptType(conceptType);
@@ -220,9 +299,23 @@ public class MedicalFacade extends MedicalServiceImpl {
                                 addMedicalInfoVO.setGender(gender);
                                 addMedicalInfoVO.setBodypart(bodypart);
                                 addMedicalInfoVO.setSubBodypart(subBodypart);
+                                addMedicalInfoVO.setBodypart(displayOrder);
                                 addMedicalInfoVO.setDept(dept);
                                 addMedicalInfoVO.setCode(code);
                                 addMedicalInfoVO.setNote(note);
+                                try{
+                                	minAge_ = Integer.parseInt(minAge);
+                                	maxAge_ = Integer.parseInt(maxAge);
+                                }catch(Exception e){
+                                	minAge_ = null;
+                                	maxAge_ = null;
+                                }
+                                if(minAge_==null||maxAge_==null){
+                                	sbf.append("第" + count + "行数据中年龄非整数;").append("<br/>");
+                                	continue;
+                                }
+                                addMedicalInfoVO.setMinAge(minAge_);
+                            	addMedicalInfoVO.setMaxAge(maxAge_);
                                 addMedicalInfoVOList.add(addMedicalInfoVO);
                             }
                         } else {
@@ -249,24 +342,41 @@ public class MedicalFacade extends MedicalServiceImpl {
             }
         }
         
+        /*****************excel文件本身问题提醒************************/
         if(sbf.length()>0){
         	throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());
         }
         
-    	String message = null;
+        /****************excel文件中所有术语概念存在重复提示---术语概念名称和类型一样即重复***********************/
+        Map<String,List<AddMedicalInfoVO>> addMedicalInfoVOListMap = addMedicalInfoVOList.stream().collect(Collectors.groupingBy(AddMedicalInfoVO::getConceptName));
+        for(String key : addMedicalInfoVOListMap.keySet()){
+        	if(addMedicalInfoVOListMap.get(key).size()>1&&addMedicalInfoVOListMap.get(key).stream().map(i->i.getConceptType()).distinct().count()==1){
+        		sbf.append(key).append(" ");
+        	}
+        }
+        if(sbf.length()>0){
+        	sbf.append("(术语概念名称存在重复)");
+        	throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());
+        }
+        
+        /**************校验每一组数据,同时组装*************************/
+        List<Medical> saveOrUpdateMedicalList = new ArrayList<>();
+        Map<String,Object> ckMap = null;
+    	Object message = null;
     	for(AddMedicalInfoVO i : addMedicalInfoVOList){
-    		message = checkAddMedicalInfoVO(i); 
+    		ckMap = checkAddMedicalInfoVO(i); 
+    		message = ckMap.get("message");
     		if(message!=null){
-    			sbf.append(message).append("(").append(i.getConceptName()).append(")").append("<br/>");
+    			sbf.append(message.toString()).append("(").append(i.getConceptName()).append(")").append("<br/>");
+    		}else{
+    			saveOrUpdateMedicalList.add((Medical)(ckMap.get("medical")));
     		}
     	}
         if(sbf.length()>0){
         	throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());
         }
         
-        BeanUtil.listCopyTo(addMedicalInfoVOList, Medical.class);
-        
-        return true;
+        return medicalService.saveOrUpdateBatch(saveOrUpdateMedicalList);
     }
     
     @SuppressWarnings("deprecation")
@@ -303,162 +413,4 @@ public class MedicalFacade extends MedicalServiceImpl {
         }
     }
     
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-
-
-    /**
-     * 获取术语医学知识
-     *
-     * @param termVo
-     * @result ConceptDTO
-     */
-    public ConceptDTO getMedicalInfo(@RequestBody TermVo termVo) {
-        List<LibraryInfo> libraryInfos;
-        LibraryInfo libraryInfo;
-        List<Medical> medicals;
-
-        ConceptDTO conceptDTO = conceptFacade.getConcept(termVo);
-
-        if (conceptDTO != null) {
-            // 获取与医学术语的基本信息
-            QueryWrapper<LibraryInfo> query = new QueryWrapper<>();
-            query.eq("concept_id", conceptDTO.getId());
-            query.eq("is_concept", 1);
-            libraryInfos = libraryInfoFacade.list(query);
-
-            if (libraryInfos != null) {
-                libraryInfo = libraryInfos.get(0);
-                conceptDTO.setName(libraryInfo.getName());
-
-                // 获取与术语相关的医学知识
-                QueryWrapper<Medical> querymed = new QueryWrapper<>();
-                querymed.eq("concept_id", conceptDTO.getId());
-
-                medicals = list(querymed);
-
-                if (medicals != null) {
-                    conceptDTO.setMedicalInfo(medicals);
-                }
-            }
-        }
-
-        return conceptDTO;
-    }
-
-
-    /**
-     * 更新或添加术语医学信息
-     *
-     * @param amendTermVo
-     * @return ConceptDTO
-     */
-    public ConceptDTO upsertMedicalInfo(AmendTermVo amendTermVo) {
-        ConceptDTO conceptDTO = new ConceptDTO();
-
-//        Map<String, Object> map;
-        Medical medical;
-        List<Medical> medicals;
-
-        conceptDTO.setName(amendTermVo.getNewterm());
-        QueryWrapper<LibraryInfo> query = new QueryWrapper<>();
-        query.eq("name", amendTermVo.getNewterm());
-        query.eq("type", amendTermVo.getNewtype());
-        LibraryInfo libraryInfo = libraryInfoFacade.getOne(query);
-
-        if (amendTermVo.getMedicalInfo() != null && libraryInfo != null) {
-
-            conceptDTO.setLibId(libraryInfo.getId().intValue());
-            conceptDTO.setId(libraryInfo.getConceptId());
-            conceptDTO.setMedicalInfo(new ArrayList<>());
-
-            for (int i=0; i<amendTermVo.getMedicalInfo().size(); i++) {
-                medical = amendTermVo.getMedicalInfo().get(i);
-//                medical = amendTermVo.getMedicalInfo();
-
-//                map = new HashMap<>();
-//                map.put("name", amendTermVo.getNewterm());
-//                medicals = getMedicalInfo(map);
-
-                QueryWrapper<Medical> medquery = new QueryWrapper<>();
-                medquery.eq("name", amendTermVo.getNewterm());
-                medicals = list(medquery);
-
-                if (medicals.size() > 0) {
-                    Medical exist_medical = medicals.get(0);
-                    medical.setId(exist_medical.getId());
-                }
-                else {
-                    medical.setConceptId(libraryInfo.getConceptId());
-                }
-
-
-                this.saveOrUpdate(medical);
-
-//                amendTermVo.setMedicalInfo(medical);
-//                amendTermVo.getMedicalInfo().set(i, medical);
-                conceptDTO.getMedicalInfo().add(medical);
-            }
-        }
-
-        return conceptDTO;
-    }
-
-
-
-
-    /**
-     * 获取术语类型信息
-     *
-     * @param type
-     * @return TypeDTO
-     */
-    public TypeDTO getTypeInfo(String type) {
-        TypeDTO typeDTO = null;
-        TypeVo typeVo = new TypeVo();
-
-        try {
-            typeVo.setType(type);
-            List<TypeDTO> typelist = getTypeId(typeVo);
-
-            if (typelist.size() > 0) {
-                typeDTO = getTypeId(typeVo).get(0);
-            }
-        }
-        catch (Exception ex) {
-            ex.printStackTrace();
-        }
-        finally {
-            return typeDTO;
-        }
-    }
-
-    /**
-     * 清空医学术语信息表
-     *
-     */
-    public void deleteMedical() {
-        truncateMedical();
-    }
 }

+ 11 - 3
knowledgeman-service/src/main/java/com/diagbot/mapper/MedicalMapper.java

@@ -1,16 +1,18 @@
 package com.diagbot.mapper;
 
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.GetMedicalInfoListDTO;
 //import com.diagbot.dto.LibraryDTO;
 import com.diagbot.dto.MedicalDTO;
 import com.diagbot.dto.TypeDTO;
 import com.diagbot.entity.Medical;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.GetMedicalInfoListVO;
 import com.diagbot.vo.TypeVo;
 
-import java.util.List;
-
 /**
  * <p>
  *  Mapper 接口
@@ -20,6 +22,12 @@ import java.util.List;
  * @since 2019-01-16
  */
 public interface MedicalMapper extends BaseMapper<Medical> {
+	
+	
+	IPage<GetMedicalInfoListDTO> getMedicalInfoList(GetMedicalInfoListVO getMedicalInfoListVO);
+	
+	
+	
     /**
      * 获取所有术语医学信息
      *

+ 8 - 4
knowledgeman-service/src/main/java/com/diagbot/vo/AddMedicalInfoVO.java

@@ -19,17 +19,17 @@ public class AddMedicalInfoVO {
 	/**
      * 术语概念名称
      */
-	@NotBlank(message="术语概念名称必填")
+    @NotBlank(message="术语概念名称必填")
 	@ApiModelProperty(value="术语概念名称",required=true)
     private String conceptName;
 	
 	/**
      * 术语概念类型
      */
-	@NotBlank(message="术语概念类型必填")
+    @NotBlank(message="术语概念类型必填")
 	@ApiModelProperty(value="术语概念类型",required=true)
     private String conceptType;
-
+	
     /**
      * 术语名称
      */
@@ -58,6 +58,11 @@ public class AddMedicalInfoVO {
 	@ApiModelProperty(value="术语类组",required=true)
     private String grp;
 
+    /**
+     * 效用名称
+     */
+    private String function;
+	
     /**
      * 性别:1:男, 2:女, 3:通用
      */
@@ -118,5 +123,4 @@ public class AddMedicalInfoVO {
 	@ApiModelProperty(value="备注")
     private String note;
 	
-	
 }

+ 4 - 4
knowledgeman-service/src/main/java/com/diagbot/vo/GetMedicalInfoDetailVO.java

@@ -16,10 +16,10 @@ import lombok.Setter;
 public class GetMedicalInfoDetailVO {
     
     /**
-     * 概念id
+     * 术语医学属性id
      */
-	@ApiModelProperty(value="概念id",required=true)
-	@NotNull(message="概念id必传")
-    private Long conceptId;
+	@ApiModelProperty(value="术语医学属性id",required=true)
+	@NotNull(message="术语医学属性id必传")
+    private Long medicalId;
     
 }

+ 31 - 0
knowledgeman-service/src/main/java/com/diagbot/vo/GetMedicalInfoListVO.java

@@ -0,0 +1,31 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: Weixuan Huang
+ * @time: 2019/3/14 16:03
+ */
+@SuppressWarnings({ "serial", "rawtypes" })
+@Getter
+@Setter
+public class GetMedicalInfoListVO extends Page {
+    
+    /**
+     * 术语名称
+     */
+    @ApiModelProperty(value="术语名称")
+    private String name;
+
+    /**
+     * 术语类型
+     */
+    @ApiModelProperty(value="术语类型")
+    private String type;
+    
+}

+ 4 - 4
knowledgeman-service/src/main/java/com/diagbot/vo/RemoveMedicalInfoVO.java

@@ -16,10 +16,10 @@ import lombok.Setter;
 public class RemoveMedicalInfoVO {
     
     /**
-     * 概念id
+     * 术语医学属性id
      */
-	@ApiModelProperty(value="概念id",required=true)
-	@NotNull(message="概念id必传")
-    private Long conceptId;
+	@ApiModelProperty(value="术语医学属性id",required=true)
+	@NotNull(message="术语医学属性id必传")
+    private Long medicalId;
     
 }

+ 11 - 49
knowledgeman-service/src/main/java/com/diagbot/web/MedicalController.java

@@ -13,16 +13,16 @@ 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.ConceptDTO;
 import com.diagbot.dto.GetMedicalInfoDetailDTO;
+import com.diagbot.dto.GetMedicalInfoListDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.MedicalFacade;
 import com.diagbot.vo.AddMedicalInfoVO;
-import com.diagbot.vo.AmendTermVo;
 import com.diagbot.vo.GetMedicalInfoDetailVO;
+import com.diagbot.vo.GetMedicalInfoListVO;
 import com.diagbot.vo.RemoveMedicalInfoVO;
-import com.diagbot.vo.TermVo;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -42,7 +42,14 @@ import io.swagger.annotations.ApiOperation;
 public class MedicalController {
 	
     @Autowired
-    MedicalFacade medicalFacade;
+    private MedicalFacade medicalFacade;
+    
+    @ApiOperation(value = "获取术语医学属性列表[by:rengb]")
+    @PostMapping("/getMedicalInfoList")
+    @SysLogger("getMedicalInfoList")
+    public RespDTO<IPage<GetMedicalInfoListDTO>> getMedicalInfoList(@RequestBody GetMedicalInfoListVO getMedicalInfoListVO) {
+        return RespDTO.onSuc(medicalFacade.getMedicalInfoList(getMedicalInfoListVO));
+    }
     
     @ApiOperation(value = "术语医学属性删除[by:rengb]")
     @PostMapping("/removeMedicalInfo")
@@ -75,49 +82,4 @@ public class MedicalController {
         return RespDTO.onSuc(medicalFacade.medicalInfoExcelIm(file));
     }
     
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-
-
-    @ApiOperation(value = "术语医学知识查询",
-            notes = "Term:术语名称, 必填<br>Type:术语类型, 必填<br>")
-    @PostMapping("/getMedicalInfo")
-    @SysLogger("getMedicalInfo")
-    public RespDTO<ConceptDTO> getMedicalInfo(@Valid @RequestBody TermVo termvo) {
-        ConceptDTO data = medicalFacade.getMedicalInfo(termvo);
-
-        return RespDTO.onSuc(data);
-    }
-
-    /*
-    public RespDTO<ConceptDTO> getMedicalInfo(@Valid @RequestBody ConceptVo conceptVo) {
-        ConceptDTO data = medicalFacade.getMedicalInfo(conceptVo);
-
-        return RespDTO.onSuc(data);
-    }
-    */
-
-    @ApiOperation(value = "术语医学知识修改",
-            notes = "NewTerm: 新的术语名称, 必填<br/>NewType: 新的术语类型, 必填<br/>")
-    @PostMapping("/upsertMedicalInfo")
-    @SysLogger("upsertMedicalInfo")
-    public RespDTO<ConceptDTO> upsertMedicalInfo(@Valid @RequestBody AmendTermVo amendTermVo) {
-        ConceptDTO data = medicalFacade.upsertMedicalInfo(amendTermVo);
-
-        return RespDTO.onSuc(data);
-    }
 }

+ 24 - 0
knowledgeman-service/src/main/resources/mapper/MedicalMapper.xml

@@ -26,6 +26,30 @@
         <result column="code" property="code" />
         <result column="note" property="note" />
     </resultMap>
+    
+    <select id="getMedicalInfoList" resultType="com.diagbot.dto.GetMedicalInfoListDTO">
+    	SELECT * FROM 
+		(SELECT
+		a.id as medicalId,
+		b.id as conceptId,
+		a.gmt_modified as operTime,
+		a.modifier as operName,
+		GROUP_CONCAT(CASE WHEN b.lib_id=c.id THEN c.`name` ELSE NULL END) AS libName,
+		c.type AS libType,
+		GROUP_CONCAT(c.`name` ORDER BY c.id ASC SEPARATOR '、') as otherNames
+		FROM medical a JOIN concept b ON a.concept_id=b.id
+		JOIN library_info c on b.id=c.concept_id
+		WHERE a.is_deleted='N' AND b.is_deleted='N' AND c.is_deleted='N'
+		GROUP BY a.id) t
+		where 1=1
+		<if test="name!=null">
+			 AND otherNames like concat('%',#{name},'%')	
+		</if>
+		<if test="type!=null">
+            AND a.type = #{type}
+        </if>
+		ORDER BY operTime desc
+    </select>
 
 
     <select id="getTypeId" parameterType="com.diagbot.vo.TypeVo" resultType="com.diagbot.dto.TypeDTO">