Pārlūkot izejas kodu

诊断依据后台维护,批量插入

kongwz 5 gadi atpakaļ
vecāks
revīzija
1c3400565f

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

@@ -56,5 +56,7 @@ public interface KnowledgeService {
     RespDTO updateNeoDisease(NeoParamVO singleDisease);
     //删除图谱
     RespDTO deleteNeoDisease(NeoParamVO singleDisease);
+    //批量插入
+    RespDTO<Boolean> batchInsertDis(List<Long> idList);
 
 }

+ 23 - 2
graphdb/src/main/java/org/diagbot/service/impl/KnowledgeServiceImpl.java

@@ -1423,6 +1423,10 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
     public RespDTO updateNeoDisease(NeoParamVO singleDisease) {
         RespDTO respDTO = RespDTO.onSuc(true);;
         Long disId = singleDisease.getId();
+        RespDTO respDTO1 = this.updateNeo(respDTO, disId);
+        return respDTO1;
+    }
+    public RespDTO updateNeo(RespDTO respDTO,Long disId){
         //先删除
         this.neo4jDelete(disId);
         String disName = this.getDisName(disId);
@@ -1454,7 +1458,7 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
         ResultSet rs = null;
         try {
             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+"";
+            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 = conn.createStatement();
             rs = st.executeQuery(sql);
             while (rs.next()){
@@ -1599,7 +1603,7 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
         conn = this.getConn();
         String name="";
         try {
-            String sql = "SELECT dis_name FROM `kl_diagnose_detail` where diagnose_id = "+disId+"";
+            String sql = "SELECT dis_name FROM `kl_diagnose_detail` where diagnose_id = "+disId+" and is_deleted = 'N'";
             st = conn.createStatement();
             rs = st.executeQuery(sql);
             while (rs.next()) {
@@ -2086,6 +2090,23 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
         }
     }
 
+    /**
+     * 批量插入
+     * @param idList
+     * @return
+     */
+    @Override
+    public RespDTO<Boolean> batchInsertDis(List<Long> idList) {
+        RespDTO<Boolean> respDTO = new RespDTO<>();
+        if(idList.size()>0){
+            for (Long disID:idList) {
+                this.neo4jDelete(disID);
+                respDTO = this.updateNeo(respDTO, disID);
+            }
+        }
+        return respDTO;
+    }
+
     /**
      * 获取一个诊断依据的全部code
      * @param disId

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

@@ -206,4 +206,9 @@ public class KnowledgeController {
         RespDTO respDTO = knowledgeService.updateNeoDisease(disease);
         return respDTO;
     }
+    @RequestMapping("/batchInsert")
+    public RespDTO batchInsert( @RequestBody List<Long> idList){
+        RespDTO respDTO = knowledgeService.batchInsertDis(idList);
+        return respDTO;
+    }
 }