Quellcode durchsuchen

1、增加页面验证数据,提供归一前和归一后诊断数据
2、修改文本提取时间BUG
3、修改数据库插入特殊字符"'"

louhr vor 5 Jahren
Ursprung
Commit
2270246cb0

+ 10 - 0
common-service/src/main/java/org/diagbot/common/work/ResponseData.java

@@ -21,6 +21,8 @@ public class ResponseData {
     private List<FeatureRate> pacs = new ArrayList<>(10);
     private List<FeatureRate> history = new ArrayList<>(10);
 
+    private List<FeatureRate> beforeCombineDis = new ArrayList<>(10);
+
     private Map<String, Filnlly> treat = new HashMap<>();
     private List<FeatureRate> graphWords = new ArrayList<>(10);
     private List<MedicalIndication> medicalIndications;//量表和指标推送
@@ -150,4 +152,12 @@ public class ResponseData {
     public void setHistory(List<FeatureRate> history) {
         this.history = history;
     }
+
+    public List<FeatureRate> getBeforeCombineDis() {
+        return beforeCombineDis;
+    }
+
+    public void setBeforeCombineDis(List<FeatureRate> beforeCombineDis) {
+        this.beforeCombineDis = beforeCombineDis;
+    }
 }

+ 3 - 0
nlp/src/main/java/org/diagbot/nlp/feature/extract/CaseTokenTime.java

@@ -71,6 +71,9 @@ public class CaseTokenTime extends CaseToken {
 
                 if (time_value > 0) {
                     if ("年".equals(lexeme.getText()) || "年余".equals(lexeme.getText())) {
+                        if (time_value > 100) {
+                            time_value = 2018 - time_value;
+                        }
                         time_value = time_value * 365;
                     } else if ("月".equals(lexeme.getText()) || "月余".equals(lexeme.getText())) {
                         time_value = time_value * 30;

+ 12 - 2
public/src/main/java/org/diagbot/pub/jdbc/MysqlJdbc.java

@@ -131,6 +131,7 @@ public class MysqlJdbc {
             StringBuffer sb = new StringBuffer();
 
             int first_index = 0;
+            String val = "";
             for (int cursor = 0; cursor < data.size(); cursor ++) {
                 if (first_index > 0) {
                     sb.append(",");
@@ -142,7 +143,11 @@ public class MysqlJdbc {
                     }
                     if (data.get(cursor).get(columns[i]) != null) {
                         sb.append("'");
-                        sb.append(data.get(cursor).get(columns[i]));
+                        val = data.get(cursor).get(columns[i]).toString();
+                        if (val.indexOf("'") > -1) {
+                            val = val.replace("'", "\\'");
+                        }
+                        sb.append(val);
                         sb.append("'");
                     } else {
                         sb.append("''");
@@ -177,6 +182,7 @@ public class MysqlJdbc {
             conn.setAutoCommit(false);
             st = conn.createStatement();
             int batchIndex = 0;
+            String val = "";
             for (int cursor = 0; cursor < data.size(); cursor ++) {
                 String sql = joinInsetSql(table, columns);
                 sql += "(";
@@ -186,7 +192,11 @@ public class MysqlJdbc {
                     }
                     if (data.get(cursor).get(columns[i]) != null) {
                         sql += "'";
-                        sql += data.get(cursor).get(columns[i]);
+                        val = data.get(cursor).get(columns[i]).toString();
+                        if (val.indexOf("'") > -1) {
+                            val = val.replace("'", "\\'");
+                        }
+                        sql += val;
                         sql += "'";
                     } else {
                         sql += null;

+ 2 - 0
push-web/src/main/java/org/diagbot/push/controller/AlgorithmController.java

@@ -146,6 +146,8 @@ public class AlgorithmController extends BaseController {
             graphFeatureRates.addAll(disFeatureRates);
             bigDataResponseData.setDis(graphFeatureRates);
         }
+        //归一之前诊断信息
+        bigDataResponseData.setBeforeCombineDis(bigDataResponseData.getDis());
         //推送出的诊断信息作为参数传入知识图谱
         List<FeatureRate> pushDiags = new ArrayList<>();
         pushDiags.addAll(bigDataResponseData.getDis());

+ 49 - 14
push-web/src/main/resources/static/pages/algorithm/list.html

@@ -181,6 +181,31 @@
                     <!-- /.box -->
                 </div>
 
+                <div class="col-xs-4">
+                    <div class="box">
+                        <div class="box-header">
+                            <h3 class="box-title">归一前诊断信息</h3>&nbsp;&nbsp;<label id="before_combine_participle_diag"></label>
+                        </div>
+                        <!-- /.box-header -->
+                        <div class="box-body">
+                            <table id="before_combine_diag_list" class="table table-bordered table-striped">
+                                <thead>
+                                <tr>
+                                    <th>diag</th>
+                                    <th>dept</th>
+                                    <th>rate</th>
+                                </tr>
+                                </thead>
+                                <tbody>
+
+                                </tbody>
+                            </table>
+                        </div>
+                        <!-- /.box-body -->
+                    </div>
+                    <!-- /.box -->
+                </div>
+
                 <div class="col-xs-4">
                     <div class="box">
                         <div class="box-header">
@@ -206,6 +231,14 @@
                 </div>
                 <!-- /.col -->
 
+
+
+
+
+            </div>
+            <!-- /.row -->
+
+            <div class="row">
                 <div class="col-xs-4">
                     <div class="box">
                         <div class="box-header">
@@ -231,12 +264,6 @@
                 </div>
                 <!-- /.col -->
 
-
-
-            </div>
-            <!-- /.row -->
-
-            <div class="row">
                 <div class="col-xs-4">
                     <div class="box">
                         <div class="box-header">
@@ -367,18 +394,20 @@
         var symptom = $("#symptom").val();
         if (diag != '' && symptom == '') {
             $('#diag_list').html("");
+            $('#before_combine_diag_list').html("");
             startDiag('/algorithm/page_neural', '#symptom_list', '1', resourceType, '111', '1');
             startDiag('/algorithm/page_neural', '#vital_list', '3', resourceType, '131', '3');
             startDiag('/algorithm/page_neural', '#lis_list', '4', resourceType, '141', '4');
             startDiag('/algorithm/page_neural', '#pacs_list', '5', resourceType, '151', '5');
 
         } else {
-            startDiag('/algorithm/page_neural', '#symptom_list', '1', resourceType, '11', '1');
-            startDiag('/algorithm/page_neural', '#vital_list', '3', resourceType, '31', '3');
-            startDiag('/algorithm/page_neural', '#lis_list', '4', resourceType, '41', '4');
-            startDiag('/algorithm/page_neural', '#pacs_list', '5', resourceType, '51', '5');
-
-            startDiagMapping('/algorithm/page_neural', '#diag_list', '2', resourceType, '21', '2');
+//            startDiag('/algorithm/page_neural', '#symptom_list', '1', resourceType, '11', '1');
+//            startDiag('/algorithm/page_neural', '#vital_list', '3', resourceType, '31', '3');
+//            startDiag('/algorithm/page_neural', '#lis_list', '4', resourceType, '41', '4');
+//            startDiag('/algorithm/page_neural', '#pacs_list', '5', resourceType, '51', '5');
+//
+//            startDiagMapping('/algorithm/page_neural', '#diag_list', '2', resourceType, '21', '2');
+            startDiagMapping('/algorithm/page_neural', '#before_combine_diag_list', '2', resourceType, '21', '6');
         }
     }
 
@@ -485,7 +514,10 @@
                         $("#participle_pacs").html(json.data.participleSymptom);
                         json.data = json.data.pacs;
                     }
-
+                    if (tp == '6') {
+                        $("#before_combine_participle_diag").html(json.data.participleSymptom);
+                        json.data = json.data.beforeCombineDis;
+                    }
                     return json.data;
                 }
             }
@@ -601,7 +633,10 @@
                         $("#participle_pacs").html(json.data.participleSymptom);
                         json.data = json.data.pacs;
                     }
-
+                    if (tp == '6') {
+                        $("#before_combine_participle_diag").html(json.data.participleSymptom);
+                        json.data = json.data.beforeCombineDis;
+                    }
                     return json.data;
                 }
             }