Bläddra i källkod

Merge remote-tracking branch 'origin/dev-1.2' into dev

hujing 5 år sedan
förälder
incheckning
0ad8a1a77a

+ 4 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0011.java

@@ -17,7 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 /**
  * @ClassName : BEH0011
@@ -46,7 +48,7 @@ public class BEH0011 extends QCCatalogue {
             status.set("0");
             return;
         }
-        List<String> presentPastDiags = new ArrayList<>();
+        Set<String> presentPastDiags = new HashSet<>();
         if (presentLabel != null) {
             List<GeneralDesc> generals = presentLabel.getGenerals();
             if (generals.size() > 0) {
@@ -115,7 +117,7 @@ public class BEH0011 extends QCCatalogue {
          */
     }
 
-    private void addDiagHospitalName(List<String> presentPastDiag, List<Diag> pastDiags) {
+    private void addDiagHospitalName(Set<String> presentPastDiag, List<Diag> pastDiags) {
         for (Diag pastDiag : pastDiags) {
             if (pastDiag.getNegative() != null) {
                 continue;

+ 106 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH02980.java

@@ -0,0 +1,106 @@
+package com.lantone.qc.kernel.catalogue.behospitalized;
+
+import com.alibaba.fastjson.JSONArray;
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.client.ChiefPresentSimilarityServiceClient;
+import com.lantone.qc.kernel.structure.ai.ModelAI;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.entity.Diag;
+import com.lantone.qc.pub.model.entity.GeneralDesc;
+import com.lantone.qc.pub.model.label.DiagLabel;
+import com.lantone.qc.pub.model.label.PastLabel;
+import com.lantone.qc.pub.model.label.PresentLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * @ClassName : BEH02980
+ * @Description : 病历前后描述不一致
+ * @Author : Mark
+ * @Date: 2020-06-23 11:02
+ */
+@Component
+public class BEH02980 extends QCCatalogue {
+    @Autowired
+    ChiefPresentSimilarityServiceClient chiefPresentSimilarityServiceClient;
+
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
+        DiagLabel initialDiagLabel = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel();
+        PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
+
+        List<String> pos_diags = new ArrayList<>();
+        List<String> neg_diags = new ArrayList<>();
+        List<String> present_neg_diags = new ArrayList<>();
+        List<String> past_neg_diags = new ArrayList<>();
+
+        if (presentLabel != null) {
+            present_neg_diags = extract_diags(presentLabel.getDiags(), pos_diags, neg_diags);
+        }
+        if (pastLabel != null) {
+            past_neg_diags = extract_diags(pastLabel.getDiags(), pos_diags, neg_diags);
+        }
+        if (initialDiagLabel != null) {
+            extract_diags(initialDiagLabel.getDiags(), pos_diags, neg_diags);
+        }
+
+        String infoStr = "";
+        int matchSum = 0;
+        ModelAI modelAI = new ModelAI();
+
+        for (String negdiag : neg_diags) {
+            JSONArray jsonArray = modelAI.loadChiefPresentSimilarAI(negdiag, pos_diags, false
+                    , "diagnose", chiefPresentSimilarityServiceClient);
+            if (jsonArray.size() == 2) {
+                /* 相似度最高症状 */
+                String dgname = jsonArray.getString(0);
+                /* 相似度分数 */
+                double likeRate = jsonArray.getDoubleValue(1);
+                if (likeRate > 0.85) {
+                    matchSum++;
+                    if (present_neg_diags.indexOf(negdiag)>=0) {
+                        infoStr = "现病史:\t" + negdiag;
+                    }
+                    else if (past_neg_diags.indexOf(negdiag)>=0) {
+                        infoStr = "既往史:\t" + negdiag;
+                    }
+                    break;
+                }
+            }
+        }
+        info.set(infoStr);
+        if (matchSum > 0) {
+            status.set("-1");
+        }
+
+    }
+
+
+    private List<String> extract_diags(List<Diag> diags, List<String> pos_diags, List<String> neg_diags ) {
+        List<String> dgs = new ArrayList<>();
+        for (Diag dg:diags) {
+            String dgname = dg.getHospitalDiagName();
+            if (dg.getNegative()==null) {
+                if (pos_diags.indexOf(dgname)==-1) {
+                    pos_diags.add(dgname);
+                }
+            }
+            else {
+                if (neg_diags.indexOf(dgname)==-1) {
+                    neg_diags.add(dgname);
+                    dgs.add(dgname);
+                }
+            }
+        }
+
+        return dgs;
+    }
+
+}

+ 4 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC0095.java

@@ -17,7 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 /**
  * @ClassName : FIRC0095
@@ -43,7 +45,7 @@ public class FIRC0095 extends QCCatalogue {
             status.set("0");
             return;
         }
-        List<String> presentPastDiags = new ArrayList<>();
+        Set<String> presentPastDiags = new HashSet<>();
         if (presentLabel != null) {
             List<GeneralDesc> generals = presentLabel.getGenerals();
             if (generals.size() > 0) {
@@ -112,7 +114,7 @@ public class FIRC0095 extends QCCatalogue {
          */
     }
 
-    private void addDiagHospitalName(List<String> presentPastDiag, List<Diag> pastDiags) {
+    private void addDiagHospitalName(Set<String> presentPastDiag, List<Diag> pastDiags) {
         for (Diag pastDiag : pastDiags) {
             if (pastDiag.getNegative() != null) {
                 continue;