Browse Source

数据库中词库数据解密

hujing 5 years ago
parent
commit
877ef0095b

+ 26 - 13
common-push/src/main/java/org/diagbot/common/push/cache/CacheFileManager.java

@@ -1,5 +1,6 @@
 package org.diagbot.common.push.cache;
 
+import org.diagbot.common.push.util.CryptUtil;
 import org.diagbot.pub.jdbc.MysqlJdbc;
 import org.diagbot.pub.utils.PropertiesUtil;
 import org.diagbot.pub.utils.security.EncrypDES;
@@ -87,9 +88,11 @@ public class CacheFileManager {
             String r2;
             String r3;
             while (rs.next()) {
-                r1 = rs.getString(1);
+//                r1 = rs.getString(1);
+                r1 = CryptUtil.decrypt_char(rs.getString(1));
                 r2 = rs.getString(2);
-                r3 = rs.getString(4);
+                r3 = CryptUtil.decrypt_char(rs.getString(4));
+//                r3 = rs.getString(4);
                 if (idMap.get(r1) == null) {
                     idMap.put(r1, r2);
                     nameMap.put(r1, r3);
@@ -121,8 +124,10 @@ public class CacheFileManager {
 
             fw = new FileWriter(path + "synonym.dict");
             while (rs.next()) {
-                r1 = rs.getString(1);
-                r2 = rs.getString(2);
+//                r1 = rs.getString(1);
+//                r2 = rs.getString(2);
+                r1 = CryptUtil.decrypt_char(rs.getString(1));
+                r2 = CryptUtil.decrypt_char(StringUtils.isEmpty(rs.getString(2))?"":rs.getString(2));
                 r3 = rs.getString(3);
                 fw.write(encrypDES.encrytor(r1 + "|" + r2 + "|" + r3));
                 fw.write("\n");
@@ -205,7 +210,8 @@ public class CacheFileManager {
             FileWriter fw = new FileWriter(path + "graph_diag_classify.dict");
             String r2, r3;
             while (rs.next()) {
-                r2 = rs.getString(1);//疾病名称
+//                r2 = rs.getString(1);//疾病名称
+                r2 = CryptUtil.decrypt_char(rs.getString(1));//疾病名称
                 r3 = rs.getString(2);//疾病类别
                 fw.write(encrypDES.encrytor(r2 + "|" + r3));
                 fw.write("\n");
@@ -221,7 +227,8 @@ public class CacheFileManager {
             fw = new FileWriter(path + "graph_sex_age_filter.dict");
             String r1, r4, r5;
             while (rs.next()) {
-                r1 = rs.getString(1);//术语名称
+//                r1 = rs.getString(1);//术语名称
+                r1 = CryptUtil.decrypt_char(rs.getString(1));//术语名称
                 r2 = rs.getString(3);//sexType 1:男 2:女 3:都可以
                 r3 = rs.getString(4);//min_age
                 r4 = rs.getString(5);//max_age
@@ -242,8 +249,10 @@ public class CacheFileManager {
             rs = st.executeQuery(sql);
             fw = new FileWriter(path + "graph_vital_convert.dict");
             while (rs.next()) {
-                r1 = rs.getString(1);//体征结果
-                r2 = rs.getString(2);//体征指标
+//                r1 = rs.getString(1);//体征结果
+//                r2 = rs.getString(2);//体征指标
+                r1 = CryptUtil.decrypt_char(rs.getString(1));//体征结果
+                r2 = CryptUtil.decrypt_char(rs.getString(2));//体征指标
                 fw.write(encrypDES.encrytor(r1 + "|" + r2));
                 fw.write("\n");
             }
@@ -318,7 +327,8 @@ public class CacheFileManager {
 
             String r1, r2, r3, r4, r5;
             while (rs.next()) {
-                r1 = rs.getString(1);
+//                r1 = rs.getString(1);
+                r1 = CryptUtil.decrypt_char(rs.getString(1));
                 r2 = rs.getString(2);
                 r3 = rs.getString(3);
                 r4 = rs.getString(4);
@@ -337,7 +347,7 @@ public class CacheFileManager {
 
             fw = new FileWriter(path + "bigdata_value_analyze.dict");
             while (rs.next()) {
-                fw.write(encrypDES.encrytor(rs.getString(1)));
+                fw.write(encrypDES.encrytor(CryptUtil.decrypt_char(rs.getString(1))));
                 fw.write("\n");
             }
             fw.close();
@@ -458,7 +468,8 @@ public class CacheFileManager {
             rs = st.executeQuery(sql);
             fw = new FileWriter(path + "bigdata_lpv_sex_age_filter.dict");//化验辅检体征相关文件
             while (rs.next()) {
-                r1 = rs.getString(1);
+//                r1 = rs.getString(1);
+                r1 = CryptUtil.decrypt_char(rs.getString(1));
                 r2 = rs.getString(2);
                 r3 = rs.getString(3);
                 r4 = rs.getString(4);
@@ -520,8 +531,10 @@ public class CacheFileManager {
         String r2 = "";
         Map<String, String> libraryMap = new HashMap<>(10);
         while (rs.next()) {
-            r1 = rs.getString(1);
-            r2 = rs.getString(2);
+//            r1 = rs.getString(1);
+//            r2 = rs.getString(2);
+            r1 = CryptUtil.decrypt_char(rs.getString(1));
+            r2 = CryptUtil.decrypt_char(rs.getString(2));
             if (libraryMap.get(r1) == null) {
                 libraryMap.put(r1, r2);
             } else if (isJoin && libraryMap.get(r1) != null) {