فهرست منبع

修改性别过滤代码

louhr 6 سال پیش
والد
کامیت
86ccd45cd5

+ 12 - 0
bigdata-web/src/main/java/org/diagbot/bigdata/work/ParamsDataProxy.java

@@ -44,6 +44,18 @@ public class ParamsDataProxy {
             searchData.setAge_start(searchData.getAge() - 5);
             searchData.setAge_end(searchData.getAge() + 5);
         }
+        //修改性别代码
+        if (!StringUtils.isEmpty(searchData.getSex())) {
+            if ("M".equals(searchData.getSex())) {
+                searchData.setSex("1");
+            } else if ("F".equals(searchData.getSex())) {
+                searchData.setSex("2");
+            } else {
+                searchData.setSex("3");
+            }
+        } else {
+            searchData.setSex("3");
+        }
         //默认查询门诊数据
         if (StringUtils.isEmpty(searchData.getResourceType())) {
             searchData.setResourceType(BigDataConstants.resource_type_o);

+ 2 - 2
bigdata-web/src/main/java/org/diagbot/bigdata/work/ResultDataProxy.java

@@ -42,8 +42,8 @@ public class ResultDataProxy {
             if (filterMap != null) {
                 ResultMappingFilter filter = filterMap.get(entry.getKey());
                 if (filter != null) {
-                    if (filter.getSex() != null && !StringUtils.isEmpty(searchData.getSex()) && !"A".equals(searchData.getSex())
-                            && filter.getSex().equals(searchData.getSex())) {      //性别过滤
+                    if (filter.getSex() != null && !StringUtils.isEmpty(searchData.getSex()) && !"3".equals(searchData.getSex()) && !"3".equals(filter.getSex())
+                            && !filter.getSex().equals(searchData.getSex())) {      //性别过滤
                         continue;
                     }
                     //年龄过滤

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 2804 - 0
bigdata-web/src/main/resources/doc_result_mapping_filter.dict


+ 10 - 15
bigdata-web/src/test/java/org/diagbot/CacheFileManagerTest.java

@@ -48,29 +48,24 @@ public class CacheFileManagerTest {
 //            }
 //            fw.close();
             //疾病科室
-//            String sql = "SELECT k1.lib_name diag_name, k2.lib_name dept_name FROM kl_concept_common kcc, kl_concept k1, kl_concept k2 " +
-//                    "where kcc.concept_id = k1.id and kcc.dept_id = k2.id " +
-//                    "and k1.lib_type = 18 and kcc.dept_id  is not null";
-            String sql = "SELECT lib_name FROM kl_concept WHERE is_deleted = 'N' AND lib_type = 70 AND lib_name regexp '[0-9]'";
+            String sql = "SELECT k1.lib_name diag_name, k2.lib_name dept_name FROM kl_concept_common kcc, kl_concept k1, kl_concept k2 " +
+                    "where kcc.concept_id = k1.id and kcc.dept_id = k2.id " +
+                    "and k1.lib_type = 18 and kcc.dept_id  is not null";
             st = conn.createStatement();
             rs = st.executeQuery(sql);
-//            List<Map.Entry<String, String>> libraryList = rsToMap(rs, true);
+            List<Map.Entry<String, String>> libraryList = rsToMap(rs, true);
 
-            FileWriter fw = new FileWriter(path + "src/main/resources/kl_result_mapping_standword.dict");
-//            for (Map.Entry<String, String> entry : libraryList) {
-//                fw.write(encrypDES.encrytor(entry.getKey() + "|" + entry.getValue()));
-//                fw.write("\n");
-//            }
-            while (rs.next()){
-                fw.write(encrypDES.encrytor(rs.getString(1)));
+            FileWriter fw = new FileWriter(path + "src/main/resources/doc_result_mapping_diag.dict");
+            for (Map.Entry<String, String> entry : libraryList) {
+                fw.write(encrypDES.encrytor(entry.getKey() + "|" + entry.getValue()));
                 fw.write("\n");
             }
             fw.close();
             //性别年龄
-            /*sql = "SELECT k1.lib_name, k1.lib_type, kcc.sex_type, kcc.min_age, kcc.max_age " +
+            sql = "SELECT k1.lib_name, k1.lib_type, kcc.sex_type, kcc.min_age, kcc.max_age " +
                     "FROM kl_concept_common kcc, kl_concept k1 " +
                     "where kcc.concept_id = k1.id " +
-                    "and k1.lib_type in (1, 18) and kcc.dept_id  is not null;";
+                    "and k1.lib_type in (1, 18)";
             st = conn.createStatement();
             rs = st.executeQuery(sql);
             fw = new FileWriter(path + "src/main/resources/doc_result_mapping_filter.dict");
@@ -88,7 +83,7 @@ public class CacheFileManagerTest {
                 fw.write(encrypDES.encrytor(r1 + "|" + r2 + "|" + r3 + "|" + r4 + "|" + r5));
                 fw.write("\n");
             }
-            fw.close();*/
+            fw.close();
 
         } catch (IOException ioe) {
             ioe.printStackTrace();