Browse Source

术语修改

rgb 6 years ago
parent
commit
c4e8d939fd

+ 15 - 1
knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -24,9 +24,11 @@ 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.GetAllConceptDTO;
 import com.diagbot.dto.GetAllInformationDTO;
 import com.diagbot.dto.GetConceptInfoDetailDTO;
+import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.Concept;
 import com.diagbot.entity.LibraryDetail;
 import com.diagbot.entity.LibraryInfo;
@@ -67,6 +69,8 @@ public class ConceptFacade extends ConceptServiceImpl {
     @Autowired
     @Qualifier("libraryInfoServiceImpl")
     private LibraryInfoService libraryInfoService;
+    @Autowired
+    private UserServiceClient userServiceClient;
     
     /**
      * 获取所有医学术语命名
@@ -112,7 +116,17 @@ public class ConceptFacade extends ConceptServiceImpl {
      * @return
      */
     public IPage<GetAllInformationDTO> getAllInformation(GetAllInformationVO getAllInformationVO) {
-        return libraryinfoFacade.getAllInformation(getAllInformationVO);
+    	IPage<GetAllInformationDTO> ipage = libraryinfoFacade.getAllInformation(getAllInformationVO);
+    	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;
     }
     
     /**

+ 19 - 0
knowledgeman-service/src/main/java/com/diagbot/facade/MedicalFacade.java

@@ -28,6 +28,7 @@ import com.diagbot.client.UserServiceClient;
 import com.diagbot.dto.GetMedicalInfoDetailDTO;
 import com.diagbot.dto.GetMedicalInfoListDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.Bodypart;
 import com.diagbot.entity.Concept;
 import com.diagbot.entity.LibraryInfo;
 import com.diagbot.entity.Medical;
@@ -61,6 +62,8 @@ public class MedicalFacade extends MedicalServiceImpl {
     private MedicalService medicalService;
     @Autowired
     private UserServiceClient userServiceClient;
+    @Autowired
+    private BodypartFacade bodypartFacade;
     
     /**
      * 获取医学术语命名列表
@@ -69,6 +72,9 @@ public class MedicalFacade extends MedicalServiceImpl {
      */
     public IPage<GetMedicalInfoListDTO> getMedicalInfoList(GetMedicalInfoListVO getMedicalInfoListVO) {
     	IPage<GetMedicalInfoListDTO> ipage = this.baseMapper.getMedicalInfoList(getMedicalInfoListVO);
+    	if(ipage.getRecords().size()==0){
+    		return ipage;
+    	}
     	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)) {
@@ -193,6 +199,19 @@ public class MedicalFacade extends MedicalServiceImpl {
 			return retMap;
 		}
 		
+		QueryWrapper<Bodypart> bodypartQe = new QueryWrapper<>();
+		bodypartQe.eq("is_deleted", "N");
+		bodypartQe.eq("bodypart", addMedicalInfoVO.getBodypart());
+		if(bodypartFacade.list(bodypartQe).size()==0){
+			retMap.put("message", "一级部位不存在");
+			return retMap;
+		}
+		bodypartQe.eq("sub_bodypart", addMedicalInfoVO.getSubBodypart());
+		if(bodypartFacade.list(bodypartQe).size()==0){
+			retMap.put("message", "二级部位不存在");
+			return retMap;
+		}
+		
 		String currentUser = UserUtils.getCurrentPrincipleID();
 		Date now = DateUtil.now();
 		QueryWrapper<Medical> medicalQe = new QueryWrapper<>();

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

@@ -45,8 +45,8 @@
 		<if test="name!=null">
 			 AND otherNames like concat('%',#{name},'%')	
 		</if>
-		<if test="type!=null">
-            AND a.type = #{type}
+		<if test="type!=null and type!=''">
+            AND libType = #{type}
         </if>
 		ORDER BY operTime desc
     </select>