Selaa lähdekoodia

Merge remote-tracking branch 'origin/push-dev-edite' into push-debug

# Conflicts:
#	graphdb/src/main/java/org/diagbot/service/impl/KnowledgeServiceImpl.java
kongwz 5 vuotta sitten
vanhempi
commit
bdb6a2ed80

+ 1 - 1
graphdb/src/main/java/org/diagbot/service/KnowledgeService.java

@@ -59,6 +59,6 @@ public interface KnowledgeService {
     //批量插入
     RespDTO<Boolean> batchInsertDis();
     //图谱bi统计
-    Map<String,Long> neoBi();
+    List<BiDetail> neoBi();
 
 }

+ 53 - 64
graphdb/src/main/java/org/diagbot/service/impl/KnowledgeServiceImpl.java

@@ -28,7 +28,10 @@ import org.springframework.data.domain.Sort;
 import org.springframework.stereotype.Service;
 
 import java.math.RoundingMode;
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
 import java.text.NumberFormat;
 import java.util.*;
 
@@ -50,11 +53,12 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
     private ScaleRepository scaleRepository;
     @Autowired
     private KnowledgeMapper knowledgeMapper;
-
+    @Autowired
+    private BiRepository biRepository;
     private List<BaseNode> baseNodes;
-    private String user = "root";
-    private String password = "lantone";
-    private String url = "jdbc:mysql://192.168.2.236:3306/med?useUnicode=true&characterEncoding=UTF-8";
+    private String user = "teamdata";
+    private String password = "jiO2rfnYhg";
+    private String url = "jdbc:mysql://192.168.2.121:3306/med?useUnicode=true&characterEncoding=UTF-8";
     private Pageable pageable;
     /**
      * 处理症状节点相关的申请
@@ -396,7 +400,7 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
         List<String> bigdataDiagList = new LinkedList<>();//大数据诊断
         if (bigdataDiagFeature.size() > 0) {
             for (FeatureRate fe : bigdataDiagFeature) {
-                if ("neo4j".equals(fe.getSource()) && (fe.getDesc().contains("确诊") || fe.getDesc().contains("拟诊"))) {
+                if ("neo4j".equals(fe.getSource()) && fe.getDesc().contains("确诊")) {
                     neo4jDiagList.add(fe.getFeatureName());
                 } else if (fe.getDesc() == null) {
                     bigdataDiagList.add(fe.getFeatureName());
@@ -1462,8 +1466,8 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
         Statement st = null;
         ResultSet rs = null;
         try {
-            String type, code ,standard,relation,unique_name,result,formula,name;
-            String sql = "SELECT diagnose_id,dis_name,`type`,`code`,standard,relation,unique_name,result,formula FROM `kl_diagnose_detail` where diagnose_id = "+disId+"  and is_deleted = 'N'";
+            String type, code ,standard,relation,result,formula,name;
+            String sql = "SELECT diagnose_id,dis_name,`type`,`code`,standard,relation,result,formula FROM `kl_diagnose_detail` where diagnose_id = "+disId+"  and is_deleted = 'N'";
             st = connection.createStatement();
             rs = st.executeQuery(sql);
             while (rs.next()){
@@ -1472,7 +1476,6 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
                 code = rs.getString("code");
                 standard = rs.getString("standard");
                 relation = rs.getString("relation");
-                unique_name = rs.getString("unique_name");
                 result = rs.getString("result");
                 formula = rs.getString("formula");
                 name = Type.getName(Integer.parseInt(type));
@@ -1481,7 +1484,6 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
                 content.put("code",code);
                 content.put("standard",standard);
                 content.put("relation",relation);
-                content.put("unique_name",unique_name);
                 content.put("result",result);
                 content.put("formula",formula);
                 contentList.add(content);
@@ -1568,9 +1570,9 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
         ResultSet rs = null;
         try {
             String tongName, type,  isConcept,stand;
-            String sql = "SELECT a.name,a.type_id,a.is_concept, b.lib_name  from kl_library_info a, kl_concept b\n" +
-                    " where a.is_deleted = 'N' and b.is_deleted = 'N' and a.concept_id = b.id\n" +
-                    " and a.type_id in (1,5,12,13,14,16,17,18,35,70)";
+            String sql = "SELECT name, type_id,is_concept,IF(is_concept=1,a.name,(select lib_name from kl_concept b where b.id = a.concept_id) ) lib_name \n" +
+                    "from kl_library_info a where  a.is_deleted = 'N'\n" +
+                    "and type_id in (1,5,12,13,14,16,17,18,35,70)";
             st = connection.createStatement();
             rs = st.executeQuery(sql);
             Map<String,String> detail =null;
@@ -1705,15 +1707,6 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
                 }else if(ni.contains("任七")){
                     path = 7;
                     rel = "任七";
-                }else if(ni.contains("任八")){
-                    path = 8;
-                    rel = "任八";
-                }else if(ni.contains("任九")){
-                    path = 9;
-                    rel = "任九";
-                }else if(ni.contains("任十")){
-                    path = 10;
-                    rel = "任十";
                 }else {
                     path = 1;
                     rel = "任一";
@@ -1798,7 +1791,6 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
             String typeName = row.get("typeName");//类型对应的中文名
             String standard = row.get("standard");//标准词
             String relation = row.get("relation");//关联词
-            String unique_name = row.get("unique_name");//公表项
             String result = row.get("result");//结果
             if(StringUtils.isNotEmpty(type)){
                 String[] split =null;
@@ -1966,22 +1958,9 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
                         }
                     }
                 } else if("3".equals(type)){ //处理化验
-                    String lis = "";//大项
-                    if(StringUtils.isNotEmpty(unique_name)){
-                        //创建化验公表项
-                        diseaseRepository.mergePublicLIS_1(unique_name);
-                        //疾病和化验公表项创建推荐关系
-                        diseaseRepository.mergeRelationLIS_1(disId,unique_name);
-                       if(StringUtils.isNotEmpty(result)){
-                           lis = standard;
-
-                       }else {
-                           lis = unique_name;
-                       }
-                    }
-
+                    String lis = "";
                     //查找化验大项的标准词
-                   /* standWord = searchStandWord(standard,type,ciKu);
+                    standWord = searchStandWord(standard,type,ciKu);
                     if(StringUtils.isNotEmpty(standWord)){
                         if(StringUtils.isNotEmpty(relation) && standard.equals(relation)){
                             lis = standWord;
@@ -1993,30 +1972,22 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
                                 //查找化验小项的标准词
                                 lis = standWord+"--"+searchStandWord(relation,type,ciKu);
                             }
-                        }
-                    }*/
 
+                        }
+                    }
 
-                    //创建大项名
+                    //创建公表
                     diseaseRepository.mergePublicLIS(lis);
-                    //疾病推荐化验大项
+                    //疾病推荐化验公表
                     diseaseRepository.mergeRelationLIS(disId,lis);
                     //处理化验结果
-                    if(StringUtils.isNotEmpty(result) && StringUtils.isNotEmpty(unique_name)){
+                    if(StringUtils.isNotEmpty(result)){
                         lisResultSplit = result.split("、");
                         if(lisResultSplit != null && lisResultSplit.length>0){
                             //化验结果找标准词
                             for (String lisRs:lisResultSplit) {
                                 if(StringUtils.isNotEmpty(lisRs)){
-                                    //创建化验结果节点
-                                    diseaseRepository.mergeLISRESULT(lisRs);
-                                    //大项和化验结果创建关系
-                                    diseaseRepository.mergeRelationPublicLIS(lis,lisRs);
-                                    //化验结果和对应的codeCondition创建关系
-                                    diseaseRepository.mergeRelationCondiLisRes(disName+code,lisRs);
-                                    //化验大项和化验公表项创建关系
-                                    diseaseRepository.mergeRelationPublicAndLIS(lis,unique_name);
-                                    /*lisResult = searchStandWord(lisRs,"resultLis",ciKu);
+                                    lisResult = searchStandWord(lisRs,"resultLis",ciKu);
                                     if(StringUtils.isNotEmpty(lisResult)){
                                         //创建化验结果节点
                                         diseaseRepository.mergeLISRESULT(lisResult);
@@ -2024,7 +1995,7 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
                                         diseaseRepository.mergeRelationPublicLIS(lis,lisResult);
                                         //化验结果和对应的codeCondition创建关系
                                         diseaseRepository.mergeRelationCondiLisRes(disName+code,lisResult);
-                                    }*/
+                                    }
 
                                 }
                             }
@@ -2154,7 +2125,7 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
             if(disList != null && disList.size()>0){
                 for (Long disId:disList) {
                    respDTO = this.updateNeo(respDTO, disId, connect, ciKu);
-                   this.updateDate(connect,disId);
+
                 }
             }
             connect.close();
@@ -2164,16 +2135,33 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
 
         return respDTO;
     }
-    public void updateDate(Connection connection,Long disId) {
-        String sql = "UPDATE `kl_diagnose` set neo_update='1970-01-01 12:00:00' where id=?";
-        try {
-            PreparedStatement preparedStatement = connection.prepareStatement(sql);
-            preparedStatement.setLong(1,disId);
-            int i = preparedStatement.executeUpdate();
-            preparedStatement.close();
-        } catch (SQLException e) {
-            e.printStackTrace();
-        }
+
+    @Override
+    public List<BiDetail> neoBi() {
+        List<BiDetail> biDetailList = new ArrayList<>();
+        Long disCount = biRepository.diagnoseCount();
+        Long childCount = biRepository.childCount();
+        Long scaleCount = biRepository.scaleCount();
+        BiDetail dis = new BiDetail();
+        dis.setModuleName("疾病");
+        dis.setItemName("疾病总数");
+        dis.setCount(disCount);
+        BiDetail child = new BiDetail();
+        child.setModuleName("儿科疾病");
+        child.setItemName("儿科疾病总数");
+        child.setCount(childCount);
+        BiDetail scale = new BiDetail();
+        scale.setModuleName("量表");
+        scale.setItemName("量表总数");
+        scale.setCount(scaleCount);
+        biDetailList.add(dis);
+        biDetailList.add(child);
+        biDetailList.add(scale);
+        return biDetailList;
+    }
+
+    public void updateDate(Connection connection,Long disId){
+        String sql = "UPDATE `kl_diagnose` set neo_update='1970-01-01 12:00:00' where id="+disId+";";
     }
     public List<Long> getDisList(Connection connection){
         List<Long> disIds = new ArrayList<>();
@@ -2252,6 +2240,7 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
     }
 
 
+
     public Pageable getPageable(PageVo pageVo) {
         if (pageVo.getSize() > 0) {
             if (pageVo.getSort_key() != null && pageVo.getSort_direct() != null) {

+ 31 - 0
graphdb/src/main/java/org/diagbot/vo/domain/BiDetail.java

@@ -0,0 +1,31 @@
+package org.diagbot.vo.domain;
+
+public class BiDetail {
+    private String moduleName;
+    private String itemName;
+    private Long count;
+
+    public String getModuleName() {
+        return moduleName;
+    }
+
+    public void setModuleName(String moduleName) {
+        this.moduleName = moduleName;
+    }
+
+    public String getItemName() {
+        return itemName;
+    }
+
+    public void setItemName(String itemName) {
+        this.itemName = itemName;
+    }
+
+    public Long getCount() {
+        return count;
+    }
+
+    public void setCount(Long count) {
+        this.count = count;
+    }
+}

+ 2 - 2
graphdb/src/main/java/org/diagbot/web/KnowledgeController.java

@@ -218,8 +218,8 @@ public class KnowledgeController {
      * @return
      */
     @RequestMapping("/neoStatistics")
-    public Map<String,Long> biCount(){
-        Map<String, Long> biCount = knowledgeService.neoBi();
+    public List<BiDetail> biCount(){
+        List<BiDetail> biCount = knowledgeService.neoBi();
         return biCount;
     }
 }