瀏覽代碼

1.修改查询量表所有数据的接口 GraphController-->scale Neo4jApi-->getScale"

hujing 6 年之前
父節點
當前提交
a256727883

+ 11 - 0
common-service/src/main/java/org/diagbot/common/work/SearchData.java

@@ -34,6 +34,9 @@ public class SearchData {
     //大数据推送诊断结果信息
     protected List<FeatureRate> pushDiags = new ArrayList<>();
 
+    //量表
+    protected String scaleName = "";
+
     //模型
     protected String algorithmClassifyValue;
     //推送条件
@@ -199,6 +202,14 @@ public class SearchData {
         this.other = other;
     }
 
+    public String getScaleName() {
+        return scaleName;
+    }
+
+    public void setScaleName(String scaleName) {
+        this.scaleName = scaleName;
+    }
+
     public String getAlgorithmClassifyValue() {
         return algorithmClassifyValue;
     }

+ 17 - 1
graph-web/src/main/java/org/diagbot/graphWeb/controller/GraphController.java

@@ -2,6 +2,8 @@ package org.diagbot.graphWeb.controller;
 
 import com.alibaba.fastjson.JSONObject;
 import org.diagbot.graph.javabean.GdbResponse;
+import org.diagbot.graph.jdbc.DriverManager;
+import org.diagbot.graph.jdbc.Neo4jAPI;
 import org.diagbot.graphWeb.dao.BackResponse;
 import org.diagbot.graphWeb.work.GraphCalculate;
 import org.diagbot.graphWeb.work.HighRiskCalculate;
@@ -15,6 +17,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+
+import static org.diagbot.graph.jdbc.DriverManager.propertiesUtil;
 
 @Controller
 @RequestMapping("/graph")
@@ -28,13 +33,15 @@ public class GraphController {
         response.setData(responseData);
         return response;
     }
+
     @RequestMapping(value = "/highRisk", method = RequestMethod.POST)
     @ResponseBody
-    public  Response<GdbResponse> getHighRisk(HttpServletRequest request, @RequestBody SearchData searchData) throws Exception {
+    public Response<GdbResponse> getHighRisk(HttpServletRequest request, @RequestBody SearchData searchData) throws Exception {
         HighRiskCalculate highRiskCalculate = new HighRiskCalculate();
         Response<GdbResponse> gdbResponseResponse = highRiskCalculate.calculateHighRisk(request, searchData);
         return gdbResponseResponse;
     }
+
     @RequestMapping(value = "/lisPacs", method = RequestMethod.POST)
     @ResponseBody
     public Response<ResponseData> lisPacsData(HttpServletRequest request, @RequestBody SearchData searchData) throws Exception {
@@ -44,5 +51,14 @@ public class GraphController {
         response.setData(responseData);
         return response;
     }
+
+    @RequestMapping(value = "/scale", method = RequestMethod.POST)
+    @ResponseBody
+    public Map<String, Object> scale(HttpServletRequest request, @RequestBody SearchData searchData) throws Exception {
+        Neo4jAPI neo4jAPI = new Neo4jAPI(DriverManager.newDrive("192.168.2.233","neo4j","root"));
+        String scaleName = searchData.getScaleName();
+        Map<String, Object> scale = neo4jAPI.getScale(scaleName);
+        return scale;
+    }
 }
 

+ 3 - 3
graph/src/main/java/org/diagbot/graph/jdbc/Neo4jAPI.java

@@ -1623,7 +1623,7 @@ public class Neo4jAPI {
         Map<String, Object> scale = new LinkedHashMap<>();
 
         try {
-            String query = "match (m:Scale)-[r]->(n) WHERE m.name=~'.*" + scaleName + ".*' return m.type";
+            String query = "match (m:Scale) WHERE m.name=~'.*" + scaleName + ".*' return m.type";
             Rset = session.run(query);
             String type = Rset.next().get("m.type").toString().replace("\"", "");
             if ("NoCalc".equals(type)) {
@@ -1663,10 +1663,10 @@ public class Neo4jAPI {
 
         try {
             String query1 = "match (m:Scale)-[r1]->(n1)-[r2]->(n2) WHERE m.name=~'.*" + scaleName + ".*' return n1.name,r1.score,n2.name," +
-                    "r2.score,n2.type,r2.p order by n2.type,toInt(r2.p)";
+                    "r2.score,n2.type,r2.p order by toInt(r2.p),n2.type";
 
             String query2 = "match (m:Scale)-[r1]->(n1)-[r2]->(n2)-[r3]->(n3) WHERE m.name=~'.*" + scaleName + ".*' return n1.name,r1.score,n2.name," +
-                    "r2.score,n3.name,r3.score,r3.p,n3.type order by n2.type,toInt(r2.p)";
+                    "r2.score,n3.name,r3.score,r3.p,n3.type order by toInt(r2.p),n2.type";
             writeLog(query1);
             Rset1 = session.run(query1);
             Rset2 = session.run(query2);

+ 0 - 58
graph/src/main/java/org/diagbot/graph/util/HttpServletRequestUtil.java

@@ -1,58 +0,0 @@
-package org.diagbot.graph.util;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @Description: 将请求转换成基本数据类型
- * @Author: HUJING
- * @Date: 2019/3/26 16:51
- * @Version 1.0
- */
-public class HttpServletRequestUtil {
-    public static int getInt(HttpServletRequest request,String key){
-        try {
-            return Integer.decode(request.getParameter(key));
-        } catch (Exception e){
-            return -1;
-        }
-    }
-
-    public static long getLong(HttpServletRequest request,String key){
-        try {
-            return Long.valueOf(request.getParameter(key));
-        } catch (Exception e){
-            return -1;
-        }
-    }
-
-    public static Double getDouble(HttpServletRequest request,String key){
-        try {
-            return Double.valueOf(request.getParameter(key));
-        } catch (Exception e){
-            return -1d;
-        }
-    }
-
-    public static boolean getBoolean(HttpServletRequest request,String key){
-        try {
-            return Boolean.valueOf(request.getParameter(key));
-        } catch (Exception e){
-            return false;
-        }
-    }
-
-    public static String getString(HttpServletRequest request,String key){
-        try {
-            String result = request.getParameter(key);
-            if (result != null){
-                result = result.trim();
-            }
-            if ("".equals(result)){
-                result = null;
-            }
-            return result;
-        } catch (Exception e){
-            return null;
-        }
-    }
-}