zhaops преди 5 години
родител
ревизия
cfeaaf015d

+ 3 - 0
bi-service/src/main/java/com/diagbot/client/KnowledgemanServiceClient.java

@@ -18,4 +18,7 @@ import java.util.List;
 public interface KnowledgemanServiceClient {
     @PostMapping("/conceptDetail/conceptDetailBI")
     RespDTO<List<BIItemDTO>> conceptDetailBI();
+
+    @PostMapping("/concept/queryLibTypeCou")
+    RespDTO<List<BIItemDTO>> queryLibTypeCou();
 }

+ 6 - 0
bi-service/src/main/java/com/diagbot/client/hystrix/KnowledgemanServiceHystrix.java

@@ -22,4 +22,10 @@ public class KnowledgemanServiceHystrix implements KnowledgemanServiceClient {
         log.error("【hystrix】调用{}异常", "conceptDetailBI");
         return null;
     }
+
+    @Override
+    public RespDTO<List<BIItemDTO>> queryLibTypeCou() {
+        log.error("【hystrix】调用{}异常", "queryLibTypeCou");
+        return null;
+    }
 }

+ 4 - 0
bi-service/src/main/java/com/diagbot/facade/StatisticsFacade.java

@@ -43,6 +43,10 @@ public class StatisticsFacade {
         }
 
         //术语统计
+        RespDTO<List<BIItemDTO>> conceptResp = knowledgemanServiceClient.queryLibTypeCou();
+        if (RespDTOUtil.respIsOK(conceptResp)) {
+            biItemDTOList.addAll(conceptResp.data);
+        }
 
         Map<String, List<BIItemDTO>> map = EntityUtil.makeEntityListMap(biItemDTOList, "moduleName");
         bidto.setDiagnose(getBIModuleDTO(map, StatisticsTypeEnum.DIAGNOSE.getKey()));

+ 2 - 0
bi-service/src/main/java/com/diagbot/web/StatisticsController.java

@@ -6,6 +6,7 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.StatisticsFacade;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
 @SuppressWarnings("unchecked")
 @Api(value = "BI-统计相关API", tags = { "BI-统计相关API" })
 public class StatisticsController {
+    @Autowired
     StatisticsFacade statisticsFacade;
 
     @ApiOperation(value = "数据统计[by:zhaops]", notes = "")

+ 1 - 0
knowledgeman-service/src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -41,6 +41,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/versionInfo/getVersionInfoOuter").permitAll()
                 .antMatchers("/diagnose/initNeo").permitAll()
                 .antMatchers("/conceptDetail/conceptDetailBI").permitAll()
+                .antMatchers("/concept/queryLibTypeCou").permitAll()
                 .antMatchers("/**").authenticated();
 //                .antMatchers("/**").permitAll();
     }

+ 1 - 0
knowledgeman-service/src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -104,6 +104,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/versionInfo/getVersionInfoOuter", request)
                 || matchers("/diagnose/initNeo", request)
                 || matchers("/conceptDetail/conceptDetailBI", request)
+                || matchers("/concept/queryLibTypeCou", request)
                 || matchers("/", request)) {
             return true;
         }

+ 1 - 71
knowledgeman-service/src/main/java/com/diagbot/facade/ConceptDetailFacade.java

@@ -179,77 +179,7 @@ public class ConceptDetailFacade extends ConceptDetailServiceImpl {
      * @return
      */
     public List<BIItemDTO> conceptDetailBI() {
-        List<BIItemDTO> retList = Lists.newLinkedList();
-
-        QueryWrapper<Concept> conceptQueryWrapper = new QueryWrapper<>();
-        QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
-        conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
-        List<ConceptDetail> conceptDetailList = this.list(conceptDetailQueryWrapper);
-        List<Long> conceptIds = conceptDetailList.stream().map(i -> i.getConceptId()).distinct().collect(Collectors.toList());
-        Integer totleCount = 0;
-        Integer diseaseCount = 0;
-        Integer lisTableCount = 0;
-        Integer pacsItemCount = 0;
-        Integer drugCount = 0;
-        if (ListUtil.isNotEmpty(conceptIds)) {
-            //静态知识总数
-            conceptQueryWrapper
-                    .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .in("id", conceptIds);
-            List<Concept> concepts = conceptFacade.list(conceptQueryWrapper);
-            if (ListUtil.isNotEmpty(concepts)) {
-                //静态知识总数
-                totleCount = concepts.size();
-                Map<Long, List<Concept>> groupByLibTypeMap = EntityUtil.makeEntityListMap(concepts, "libType");
-                //疾病
-                if (groupByLibTypeMap.get(Long.valueOf(LexiconTypeEnum.DIAGNOSIS.getKey())) != null) {
-                    diseaseCount = groupByLibTypeMap.get(Long.valueOf(LexiconTypeEnum.DIAGNOSIS.getKey())).size();
-                }
-                //化验公表项
-                if (groupByLibTypeMap.get(Long.valueOf(LexiconTypeEnum.LIS_TABLES.getKey())) != null) {
-                    lisTableCount = groupByLibTypeMap.get(Long.valueOf(LexiconTypeEnum.LIS_TABLES.getKey())).size();
-                }
-                //辅检项目
-                if (groupByLibTypeMap.get(Long.valueOf(LexiconTypeEnum.PACS_ITEMS.getKey())) != null) {
-                    pacsItemCount = groupByLibTypeMap.get(Long.valueOf(LexiconTypeEnum.PACS_ITEMS.getKey())).size();
-                }
-                //药品通用名
-                if (groupByLibTypeMap.get(Long.valueOf(LexiconTypeEnum.DRUGS.getKey())) != null) {
-                    drugCount = groupByLibTypeMap.get(Long.valueOf(LexiconTypeEnum.DRUGS.getKey())).size();
-                }
-            }
-        }
-
-        BIItemDTO totle = new BIItemDTO();
-        totle.setModuleName("静态知识");
-        totle.setItemName("静态知识总数");
-        totle.setCount(totleCount);
-        retList.add(totle);
-
-        BIItemDTO disease = new BIItemDTO();
-        disease.setModuleName("静态知识");
-        disease.setItemName("疾病");
-        disease.setCount(diseaseCount);
-        retList.add(disease);
-
-        BIItemDTO lisTable = new BIItemDTO();
-        lisTable.setModuleName("静态知识");
-        lisTable.setItemName("化验公表项");
-        lisTable.setCount(lisTableCount);
-        retList.add(lisTable);
-
-        BIItemDTO pacs = new BIItemDTO();
-        pacs.setModuleName("静态知识");
-        pacs.setItemName("辅检项目");
-        pacs.setCount(pacsItemCount);
-        retList.add(pacs);
-
-        BIItemDTO drug = new BIItemDTO();
-        drug.setModuleName("静态知识");
-        drug.setItemName("药品通用名");
-        drug.setCount(drugCount);
-        retList.add(drug);
-
+        List<BIItemDTO> retList = conceptDetailService.conDetailCount();
         return retList;
     }
 }

+ 9 - 1
knowledgeman-service/src/main/java/com/diagbot/mapper/ConceptDetailMapper.java

@@ -2,6 +2,7 @@ package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.BIItemDTO;
 import com.diagbot.dto.GetConceptDetailListDTO;
 import com.diagbot.dto.ConceptDetailDTO;
 import com.diagbot.dto.ConceptIndexDTO;
@@ -32,5 +33,12 @@ public interface ConceptDetailMapper extends BaseMapper<ConceptDetail> {
 	 * @return
 	 */
 	public List<ConceptIndexDTO> index(ConceptIndexVO conceptIndexVO);
-   
+
+	/**
+	 * 统计
+	 *
+	 * @return
+	 */
+	public List<BIItemDTO> conDetailCount();
+
 }

+ 8 - 0
knowledgeman-service/src/main/java/com/diagbot/service/ConceptDetailService.java

@@ -1,6 +1,7 @@
 package com.diagbot.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.BIItemDTO;
 import com.diagbot.dto.ConceptDetailDTO;
 import com.diagbot.dto.ConceptIndexDTO;
 import com.diagbot.entity.ConceptDetail;
@@ -34,4 +35,11 @@ public interface ConceptDetailService extends IService<ConceptDetail> {
      * @return
      */
     public List<ConceptIndexDTO> index(ConceptIndexVO conceptIndexVO);
+
+    /**
+     * 统计
+     *
+     * @return
+     */
+    public List<BIItemDTO> conDetailCount();
 }

+ 12 - 0
knowledgeman-service/src/main/java/com/diagbot/service/impl/ConceptDetailServiceImpl.java

@@ -1,5 +1,6 @@
 package com.diagbot.service.impl;
 
+import com.diagbot.dto.BIItemDTO;
 import com.diagbot.dto.ConceptDetailDTO;
 import com.diagbot.dto.ConceptIndexDTO;
 import com.diagbot.entity.ConceptDetail;
@@ -33,4 +34,15 @@ public class ConceptDetailServiceImpl extends ServiceImpl<ConceptDetailMapper, C
     public List<ConceptIndexDTO> index(ConceptIndexVO conceptIndexVO) {
         return baseMapper.index(conceptIndexVO);
     }
+
+
+    /**
+     * 统计
+     *
+     * @return
+     */
+    @Override
+    public List<BIItemDTO> conDetailCount() {
+        return baseMapper.conDetailCount();
+    }
 }

+ 36 - 0
knowledgeman-service/src/main/resources/mapper/ConceptDetailMapper.xml

@@ -59,4 +59,40 @@
         </if>
 		ORDER BY a.gmt_modified DESC
     </select>
+
+    <select id="conDetailCount" resultType="com.diagbot.dto.BIItemDTO">
+        SELECT
+            "静态知识" AS moduleName,
+            "静态知识总数" AS itemName,
+            count(DISTINCT kc.id) AS count
+        FROM
+            kl_concept kc,
+            kl_concept_detail kcd
+        WHERE
+            kc.is_deleted = 'N'
+            AND kcd.is_deleted = 'N'
+            AND kc.id = kcd.concept_id
+
+        UNION
+
+        SELECT DISTINCT
+            "静态知识" AS moduleName,
+            CASE
+            WHEN t2.lib_type = 18 THEN '疾病'
+            WHEN t2.lib_type = 46 THEN '化验公表项'
+            WHEN t2.lib_type = 16 THEN '辅检项目'
+            WHEN t2.lib_type = 10 THEN '药品通用名'
+            ELSE ''
+            END AS itemName,
+            COUNT(t2.id) AS count
+        FROM
+            (SELECT DISTINCT concept_id FROM kl_concept_detail WHERE is_deleted = "N") t1,
+            kl_concept t2
+        WHERE
+            t1.concept_id = t2.id
+            AND t2.is_deleted = "N"
+            AND t2.lib_type IN (18, 46, 16, 10)
+        GROUP BY
+            lib_type
+    </select>
 </mapper>

+ 1 - 1
precman-service/src/main/java/com/diagbot/facade/CountFacade.java

@@ -30,7 +30,7 @@ public class CountFacade {
         int symptomNum = questionFacade.count(new QueryWrapper<QuestionInfo>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("type", QuestionTypeEnum.Symptom.getKey())
-                .eq("tag_type", TagTypeEnum.T6.getKey())
+                .eq("tag_type", TagTypeEnum.T4.getKey())
         );
         biItemDTO.setModuleName("智能预问诊");
         biItemDTO.setItemName("预问诊症状条目");