Przeglądaj źródła

1、出院小结医嘱需使用模型,但还需调整
2、危急值6小时内提醒修改、病历前后描述不一致调整
3、修改为阴性词必须在实体前面

louhr 5 lat temu
rodzic
commit
77743dfc53

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

@@ -129,7 +129,7 @@ public class BEH02980 extends QCCatalogue {
                 String dgname = jsonArray.getString(0);
                 /* 相似度分数 */
                 double likeRate = jsonArray.getDoubleValue(1);
-                if (likeRate > 0.85) {
+                if (likeRate > 0.99) {
                     matchSum++;
                     if (StringUtils.isEmpty(infoStr)) {
                         infoStr = negdiag;

+ 5 - 4
kernel/src/main/java/com/lantone/qc/kernel/catalogue/crisisvaluereport/CRI0382.java

@@ -65,15 +65,16 @@ public class CRI0382 extends QCCatalogue {
                 if (currentDate.getTime() - StringUtil.parseDateTime(reptTime, dateFormats).getTime() < timeCha) {
                     findCrisises.add(reptTime);
                 } else {
-                    crisisValueReportDocs.forEach(crisisValueReportDoc -> {
+                    for (CrisisValueReportDoc crisisValueReportDoc : crisisValueReportDocs) {
                         String recordTimeStr = crisisValueReportDoc.getStructureMap().get("记录时间");
                         String docReptContent = crisisValueReportDoc.getStructureMap().get("危急值记录内容");
-                        if (StringUtil.parseDateTime(recordTimeStr, dateFormats).getTime()
-                                - StringUtil.parseDateTime(reptTime, dateFormats).getTime() < timeCha
+                        if ((StringUtil.parseDateTime(recordTimeStr, dateFormats).getTime() - StringUtil.parseDateTime(reptTime, dateFormats).getTime()) > 0
+                                && (StringUtil.parseDateTime(recordTimeStr, dateFormats).getTime() - StringUtil.parseDateTime(reptTime, dateFormats).getTime()) < timeCha
                                 && docReptContent.contains(crisisName)) {
                             findCrisises.add(reptTime);
+                            break;
                         }
-                    });
+                    }
                 }
             }
         });

+ 16 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/LeaveHospitalAI.java

@@ -56,6 +56,10 @@ public class LeaveHospitalAI extends ModelAI {
                     putContent(crfContent, medicalTextType.get(1), dischargeDiag, Content.dischargeDiag);
                 }
             }
+            if (leaveHospitalDoc.getLeaveHospitalDoctorAdviceLabel() != null
+                    && StringUtils.isNotEmpty(leaveHospitalDoc.getLeaveHospitalDoctorAdviceLabel().getAiText())) {
+                putContent(crfContent, medicalTextType.get(0), leaveHospitalDoc.getLeaveHospitalDoctorAdviceLabel().getAiText(), Content.leaveHospitalDoctorAdvice);
+            }
             JSONObject midData = loadAI(inputInfo.isUseCrfCache(), inputInfo.getMedicalRecordInfoDoc().getStructureMap().get("behospitalCode"), crfContent, crfServiceClient);//crf返回数据
             if (midData.containsKey(Content.discharge)) {
                 putDischargeCrfData(midData.getJSONObject(Content.discharge), inputInfo);//出院小结
@@ -63,6 +67,9 @@ public class LeaveHospitalAI extends ModelAI {
             if (midData.containsKey(Content.dischargeDiag)) {
                 putDischargeCrfData(midData.getJSONObject(Content.dischargeDiag), inputInfo);//出院诊断
             }
+            if (midData.containsKey(Content.leaveHospitalDoctorAdvice)) {
+//                putLeaveHospitalDoctorAdviceCrfData(midData.getJSONObject(Content.leaveHospitalDoctorAdvice), inputInfo);//出院医嘱
+            }
         }
     }
 
@@ -91,4 +98,13 @@ public class LeaveHospitalAI extends ModelAI {
         //临床表现
         inputInfo.getLeaveHospitalDoc().setLeaveHospitalLabel(leaveHospitalLabel);
     }
+
+    /**
+     * 出院医嘱
+     *
+     * @param jsonObject
+     * @param inputInfo
+     */
+    public void putLeaveHospitalDoctorAdviceCrfData(JSONObject jsonObject, InputInfo inputInfo) {
+    }
 }

+ 2 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/model/Lemma.java

@@ -19,6 +19,8 @@ public class Lemma {
     private int id;
     private String text;
     private String position;
+    private int from;
+    private int to;
     private int len;
     private String property;
     private String relationName;

+ 2 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/model/Relation.java

@@ -13,5 +13,7 @@ import lombok.Setter;
 @Setter
 public class Relation {
     private int id;
+    private int from;
+    private int to;
     private String relationName;
 }

+ 12 - 4
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcess.java

@@ -177,12 +177,16 @@ public class EntityProcess {
             if (relationObjs.getIntValue("from") == entityId) {
                 Relation relation = new Relation();
                 relation.setId(relationObjs.getIntValue("to"));
+                relation.setFrom(relationObjs.getIntValue("from"));
+                relation.setTo(relationObjs.getIntValue("to"));
                 relation.setRelationName(relationObjs.getString("name"));
                 connectEntityList.add(relation);
             }
             if (relationObjs.getIntValue("to") == entityId) {
                 Relation relation = new Relation();
                 relation.setId(relationObjs.getIntValue("from"));
+                relation.setFrom(relationObjs.getIntValue("from"));
+                relation.setTo(relationObjs.getIntValue("to"));
                 relation.setRelationName(relationObjs.getString("name"));
                 connectEntityList.add(relation);
             }
@@ -191,16 +195,20 @@ public class EntityProcess {
     }
 
     /**
-     * 查找阴性表述
+     * 查找阴性表述, 阴性词需要在实体前面
      * @param detailLemma
      * @return
      */
     protected Negative findNegative(Lemma detailLemma) {
         for (Lemma lemma : detailLemma.getRelationLemmas()) {
             if (lemma.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
-                Negative negative = new Negative();
-                negative.setName(lemma.getText());
-                return negative;
+                if (StringUtils.isNotEmpty(lemma.getPosition()) && StringUtils.isNotEmpty(detailLemma.getPosition())) {
+                    if (Integer.parseInt(detailLemma.getPosition()) > Integer.parseInt(lemma.getPosition())) {
+                        Negative negative = new Negative();
+                        negative.setName(lemma.getText());
+                        return negative;
+                    }
+                }
             }
         }
         return null;

+ 1 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessLeaveHospital.java

@@ -11,6 +11,7 @@ import com.lantone.qc.pub.model.entity.Notes;
 import com.lantone.qc.pub.model.entity.OutcomeCure;
 import com.lantone.qc.pub.model.entity.OutcomeToBetter;
 import com.lantone.qc.pub.model.entity.PositiveFinding;
+import com.lantone.qc.pub.model.label.LeaveHospitalDoctorAdviceLabel;
 import com.lantone.qc.pub.model.label.LeaveHospitalLabel;
 
 import java.util.ArrayList;

+ 1 - 0
public/src/main/java/com/lantone/qc/pub/Content.java

@@ -167,6 +167,7 @@ public class Content {
     public static final String inStatus = "入院情况";
     public static final String out_status = "出院情况";
     public static final String dischargeDiag = "出院诊断";
+    public static final String leaveHospitalDoctorAdvice = "出院医嘱";
     public static final String dp_out = "损伤、中毒外部原因";
     public static final String pathologyDiagnose = "病理诊断";
     public static final String admitPath = "入院途径";

+ 1 - 0
public/src/main/java/com/lantone/qc/pub/model/doc/LeaveHospitalDoc.java

@@ -14,6 +14,7 @@ import lombok.Setter;
 @Setter
 public class LeaveHospitalDoc extends ModelDoc {
     private LeaveHospitalLabel leaveHospitalLabel;
+    private LeaveHospitalDoctorAdviceLabel leaveHospitalDoctorAdviceLabel;//出院医嘱
     private DiagLabel beHospitalizedLabel;//入院诊断
     private DiagLabel leaveDiagLabel;//出院诊断
 }

+ 20 - 0
public/src/main/java/com/lantone/qc/pub/model/label/LeaveHospitalDoctorAdviceLabel.java

@@ -0,0 +1,20 @@
+package com.lantone.qc.pub.model.label;
+
+import com.lantone.qc.pub.model.entity.*;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName : LeaveHospital
+ * @Description : 出院医嘱
+ * @Author : 楼辉荣
+ * @Date: 2020-03-18 15:51
+ */
+@Getter
+@Setter
+public class LeaveHospitalDoctorAdviceLabel extends GeneralLabel {
+    List<Medicine> medicines = new ArrayList<>();   //出院带药
+}

+ 9 - 0
trans/src/main/java/com/lantone/qc/trans/changx/ChangxLeaveHospitalDocTrans.java

@@ -2,11 +2,13 @@ package com.lantone.qc.trans.changx;
 
 import com.google.common.collect.Lists;
 import com.lantone.qc.pub.model.doc.LeaveHospitalDoc;
+import com.lantone.qc.pub.model.label.LeaveHospitalDoctorAdviceLabel;
 import com.lantone.qc.pub.model.vo.MedrecVo;
 import com.lantone.qc.trans.ModelDocTrans;
 import com.lantone.qc.dbanaly.facade.changx.CxXmlUtil;
 import com.lantone.qc.trans.comsis.ModelDocGenerate;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
+import org.apache.commons.lang3.StringUtils;
 
 import java.util.List;
 import java.util.Map;
@@ -27,6 +29,13 @@ public class ChangxLeaveHospitalDocTrans extends ModelDocTrans {
         sourceMap.put("rec_title=" + contentMap.get("recTitle").toString(), "");
         Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
         LeaveHospitalDoc leaveHospitalDoc = ModelDocGenerate.leaveHospitalDocGen(structureMap);
+
+        if (StringUtils.isNotEmpty(structureMap.get("出院医嘱"))) {
+            LeaveHospitalDoctorAdviceLabel leaveHospitalDoctorAdviceLabel = new LeaveHospitalDoctorAdviceLabel();
+            leaveHospitalDoctorAdviceLabel.setText(structureMap.get("出院医嘱"));
+            leaveHospitalDoctorAdviceLabel.setAiText(structureMap.get("出院医嘱"));
+            leaveHospitalDoc.setLeaveHospitalDoctorAdviceLabel(leaveHospitalDoctorAdviceLabel);
+        }
         leaveHospitalDoc.setText(CxXmlUtil.getXmlText(content));
         leaveHospitalDoc.setPageData((Map) structureMap);
         return leaveHospitalDoc;