|
@@ -0,0 +1,74 @@
|
|
|
+package com.diagbot.facade;
|
|
|
+
|
|
|
+import com.diagbot.client.KnowledgemanServiceClient;
|
|
|
+import com.diagbot.client.PrecmanServiceClient;
|
|
|
+import com.diagbot.dto.BIDTO;
|
|
|
+import com.diagbot.dto.BIItemDTO;
|
|
|
+import com.diagbot.dto.BIModuleDTO;
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.enums.StatisticsTypeEnum;
|
|
|
+import com.diagbot.util.EntityUtil;
|
|
|
+import com.diagbot.util.RespDTOUtil;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:
|
|
|
+ * @Author:zhaops
|
|
|
+ * @time: 2019/10/15 16:23
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class StatisticsFacade {
|
|
|
+ @Autowired
|
|
|
+ private KnowledgemanServiceClient knowledgemanServiceClient;
|
|
|
+ @Autowired
|
|
|
+ private PrecmanServiceClient precmanServiceClient;
|
|
|
+
|
|
|
+ public BIDTO count() {
|
|
|
+ BIDTO bidto = new BIDTO();
|
|
|
+ List<BIItemDTO> biItemDTOList = Lists.newLinkedList();
|
|
|
+ //静态知识统计
|
|
|
+ RespDTO<List<BIItemDTO>> cdResp = knowledgemanServiceClient.conceptDetailBI();
|
|
|
+ if (RespDTOUtil.respIsOK(cdResp)) {
|
|
|
+ biItemDTOList.addAll(cdResp.data);
|
|
|
+ }
|
|
|
+ //预问诊统计
|
|
|
+ RespDTO<BIItemDTO> precResp = precmanServiceClient.getCount();
|
|
|
+ if (RespDTOUtil.respIsOK(precResp)) {
|
|
|
+ biItemDTOList.add(precResp.data);
|
|
|
+ }
|
|
|
+
|
|
|
+ //术语统计
|
|
|
+
|
|
|
+ Map<String, List<BIItemDTO>> map = EntityUtil.makeEntityListMap(biItemDTOList, "moduleName");
|
|
|
+ bidto.setDiagnose(getBIModuleDTO(map, StatisticsTypeEnum.DIAGNOSE.getKey()));
|
|
|
+ bidto.setSymptom(getBIModuleDTO(map, StatisticsTypeEnum.SYMPTOM.getKey()));
|
|
|
+ bidto.setVital(getBIModuleDTO(map, StatisticsTypeEnum.VITAL.getKey()));
|
|
|
+ bidto.setLis(getBIModuleDTO(map, StatisticsTypeEnum.LIS.getKey()));
|
|
|
+ bidto.setPacs(getBIModuleDTO(map, StatisticsTypeEnum.PACS.getKey()));
|
|
|
+ bidto.setDrug(getBIModuleDTO(map, StatisticsTypeEnum.DRUG.getKey()));
|
|
|
+ bidto.setOperation(getBIModuleDTO(map, StatisticsTypeEnum.OPERATION.getKey()));
|
|
|
+ bidto.setGauge(getBIModuleDTO(map, StatisticsTypeEnum.GAUGE.getKey()));
|
|
|
+ bidto.setPrec(getBIModuleDTO(map, StatisticsTypeEnum.PREC.getKey()));
|
|
|
+ bidto.setTreat(getBIModuleDTO(map, StatisticsTypeEnum.TREAT.getKey()));
|
|
|
+ bidto.setConceptDetail(getBIModuleDTO(map, StatisticsTypeEnum.CONCEPT_DETAIL.getKey()));
|
|
|
+
|
|
|
+ return bidto;
|
|
|
+ }
|
|
|
+
|
|
|
+ public BIModuleDTO getBIModuleDTO(Map<String, List<BIItemDTO>> map, Integer key) {
|
|
|
+ if (map.get(StatisticsTypeEnum.getName(key)) != null) {
|
|
|
+ BIModuleDTO biModuleDTO = new BIModuleDTO();
|
|
|
+ biModuleDTO.setModuleName(StatisticsTypeEnum.getName(key));
|
|
|
+ biModuleDTO.setItems(map.get(StatisticsTypeEnum.getName(key)));
|
|
|
+ return biModuleDTO;
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|