Parcourir la source

1、关系抽取对处理最多只到3层

louhr il y a 5 ans
Parent
commit
a6d917b192

+ 13 - 1
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcess.java

@@ -95,8 +95,20 @@ public class EntityProcess {
                 if (l.getId() == relation.getId()) {
                     if (!hasRelation(l.getId(), lemma.getId(), relationIds)) {
                         l.setRelationName(relation.getRelationName());
+
+                        List<Relation> childConnectEntityIdList = getConnectEntityList(l.getId(), relations);
+                        for (Lemma c_l : allLemmaList) {
+                            for (Relation c_relation : childConnectEntityIdList) {
+                                if (c_l.getId() == c_relation.getId()) {
+                                    if (!hasRelation(c_l.getId(), l.getId(), relationIds)) {
+                                        c_l.setRelationName(relation.getRelationName());
+                                        l.addRelationLemmas(c_l);
+                                    }
+                                }
+                            }
+                        }
                         lemma.addRelationLemmas(l);
-                        findRelationLemma(l, allLemmaList, relations, relationIds);
+//                        findRelationLemma(l, allLemmaList, relations, relationIds);
                     }
                 }
             }

+ 40 - 12
kernel/src/test/java/com/lantone/qc/kernel/ChangxDataImportApiTest.java

@@ -3,6 +3,7 @@ package com.lantone.qc.kernel;
 import com.lantone.qc.pub.jdbc.MysqlJdbc;
 import com.lantone.qc.pub.util.FastJsonUtils;
 import com.lantone.qc.pub.util.PropertiesUtil;
+import com.lantone.qc.trans.changx.util.CxXmlUtil;
 import com.lantone.qc.trans.changx.util.CxXmlUtilTemp;
 import com.lantone.qc.trans.taizhou.util.TzXmlUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -58,21 +59,48 @@ public class ChangxDataImportApiTest {
     }
 
     public static void main(String[] args) {
-        String patientId = "ZY010000661273";
-
+//        String patientId = "ZY010000661273";
+//
         ChangxDataImportApiTest test = new ChangxDataImportApiTest();
-        initTableMap();
-        //模块映射
-        test.loadModelHospital();
-        //患者信息
-        test.insertPatient(test.loadOraclePatients(tableMap.get("BR_INPATIENTINFO"), patientId));
+        test.dayevent();
+//        initTableMap();
+//        //模块映射
+//        test.loadModelHospital();
+//        //患者信息
+//        test.insertPatient(test.loadOraclePatients(tableMap.get("BR_INPATIENTINFO"), patientId));
 //        test.insertDoctor(test.loadOracleDoctorInfos(tableMap.get("GI_USERINFO"), tableMap.get("HI_DEPTINFO")));
 
-        //病人流水号获取    病历号--->id
-        Map<String, String> patientMap = test.loadPatients(hospitalId, patientId);
-        //model-->id
-        Map<String, String> modelMap = test.loadModel();
-        test.insertPatientText(patientMap, modelMap);
+//        //病人流水号获取    病历号--->id
+//        Map<String, String> patientMap = test.loadPatients(hospitalId, patientId);
+//        //model-->id
+//        Map<String, String> modelMap = test.loadModel();
+//        test.insertPatientText(patientMap, modelMap);
+    }
+
+    private void dayevent() {
+        MysqlJdbc mysqlJdbc = initMysqlJdbc();
+        Connection conn = mysqlJdbc.connect();
+        Statement st = null;
+        ResultSet rs = null;
+        String r1, r2;
+        Map<String, String> map = new HashMap<>();
+        try {
+            st = conn.createStatement();
+            String sql = "select t2.xml_text, t1.behospital_code from med_medical_record t1, med_medical_record_content t2 where t1.rec_id = t2.rec_id and t1.rec_title = '日常病程记录'";
+            rs = st.executeQuery(sql);
+            while (rs.next()) {
+                r1 = rs.getString(1);
+                r2 = rs.getString(2);
+                Map<String, String> xmlNodeValueMap = CxXmlUtil.firstLevelNodeValue(r1);
+                System.out.println(r2 + ":" + xmlNodeValueMap.get("日常病程记录++++文本框"));
+            }
+        } catch (SQLException sqle) {
+            sqle.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            mysqlJdbc.close(rs, st, conn);
+        }
     }
 
     private void insertPatient(List<Patient> patients) {