Переглянути джерело

Merge remote-tracking branch 'origin/shaoyf/dev-wsy' into shaoyf/dev

# Conflicts:
#	kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03071.java
wangsy 4 роки тому
батько
коміт
33b9370dfa

+ 4 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0001.java

@@ -33,6 +33,10 @@ public class BEH0001 extends QCCatalogue {
             return;
         }
         String chiefText = chiefLabel.getText();
+        if(StringUtil.isBlank(chiefText)){
+            status.set("0");
+            return;
+        }
         if (StringUtil.isNotBlank(chiefText) && (chiefText.contains("检查") || chiefText.contains("术后") || chiefText.contains("药物"))) {
             status.set("0");
             return;

+ 5 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR02985.java

@@ -72,7 +72,8 @@ public class THR02985 extends QCCatalogue {
             String drugName = adviceDoc.get("医嘱项目名称");
             String startDateStr = adviceDoc.get("医嘱开始时间");
             if (StringUtil.isNotBlank(drugName)) {
-                startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+//                startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+                startDate = StringUtil.parseDateTime(startDateStr);
                 if (antibioticDateTimes.get(drugName).get(startDate) > 0) {
                     continue;   //一天内同一抗生素开过多次的抗生素直接过滤
                 }
@@ -210,7 +211,7 @@ public class THR02985 extends QCCatalogue {
                 }
             }
             if (StringUtil.isNotBlank(missDrug) && !modelFind && CatalogueUtil.compareTime(doctorAdviceDate, new Date(), 48 * 60L)) {
-                infoAppend(sb, drugs, DateUtil.formatDate(doctorAdviceDate));
+                infoAppend(sb, drugs, DateUtil.formatDateTime(doctorAdviceDate));
                 data.put(doctorAdviceDate, splitDrugs.toString().replaceAll("[\\[\\]]", ""));
             }
         }
@@ -235,7 +236,8 @@ public class THR02985 extends QCCatalogue {
         for (Map<String, String> structMap : docAdvStruct) {
             drugName = structMap.get("医嘱项目名称");
             startDateStr = structMap.get("医嘱开始时间");
-            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+//            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+            startDate = StringUtil.parseDateTime(startDateStr);
             if (antibioticDateTimes.containsKey(drugName)) {
                 Map<Date, Integer> map = antibioticDateTimes.get(drugName);
                 if (map.containsKey(startDate)) {

+ 5 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR02986.java

@@ -75,7 +75,8 @@ public class THR02986 extends QCCatalogue {
                 if (Arrays.asList(JS).contains(drugName)) {
                     continue;
                 }
-                startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+//                startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+                startDate = StringUtil.parseDateTime(startDateStr);
                 if (antibioticDateTimes.get(drugName).get(startDate) > 0) {
                     continue;   //一天内同一激素开过多次的激素直接过滤
                 }
@@ -207,7 +208,7 @@ public class THR02986 extends QCCatalogue {
             }
 
             if (StringUtil.isNotBlank(missDrug) && !modelFind && CatalogueUtil.compareTime(doctorAdviceDate, new Date(), 48 * 60L)) {
-                infoAppend(sb, splitDrugs.toString().replaceAll("[\\[\\]]", ""), DateUtil.formatDate(doctorAdviceDate));
+                infoAppend(sb, splitDrugs.toString().replaceAll("[\\[\\]]", ""), DateUtil.formatDateTime(doctorAdviceDate));
                 data.put(doctorAdviceDate, splitDrugs.toString().replaceAll("[\\[\\]]", ""));
             }
         }
@@ -232,7 +233,8 @@ public class THR02986 extends QCCatalogue {
         for (Map<String, String> structMap : docAdvStruct) {
             drugName = structMap.get("医嘱项目名称");
             startDateStr = structMap.get("医嘱开始时间");
-            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+//            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+            startDate = StringUtil.parseDateTime(startDateStr);
             if (antibioticDateTimes.containsKey(drugName)) {
                 Map<Date, Integer> map = antibioticDateTimes.get(drugName);
                 if (map.containsKey(startDate)) {

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03070.java

@@ -193,7 +193,7 @@ public class THR03070 extends QCCatalogue {
     private void infoAppend(StringBuffer sb, String repNm, Map<String, String> abnormalMap) {
         for (Map.Entry<String, String> map : abnormalMap.entrySet()) {
             if (repNm.equals(map.getKey())) {
-                sb.append(repNm).append("(").append(DateUtil.formatDate(StringUtil.parseDateTime(map.getValue()))).append(")").append("、");
+                sb.append(repNm).append("(").append(DateUtil.formatDateTime(StringUtil.parseDateTime(map.getValue()))).append(")").append("、");
             }
         }
     }

+ 6 - 5
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03071.java

@@ -2,7 +2,6 @@ package com.lantone.qc.kernel.catalogue.threelevelward;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.model.InputInfo;
@@ -129,10 +128,12 @@ public class THR03071 extends QCCatalogue {
      * @param reptNm
      * @param pacsDate
      */
-    private void infoAppend(StringBuffer sb, String reptNm, Map<String, Set<String>> pacsDate) {
-        if (pacsDate.containsKey(reptNm)) {
-            for (String date : pacsDate.get(reptNm)) {
-                sb.append(reptNm).append("(").append(DateUtil.formatDate(StringUtil.parseDateTime(date))).append(")").append("、");
+    private void infoAppend(StringBuffer sb, String reptNm, Map<String, List<String>> pacsDate) {
+        for (Map.Entry<String, List<String>> map : pacsDate.entrySet()) {
+            if (reptNm.equals(map.getKey())) {
+                for (String date : map.getValue()) {
+                    sb.append(reptNm).append("(").append(DateUtil.formatDateTime(StringUtil.parseDateTime(date))).append(")").append("-");
+                }
             }
         }
     }

+ 5 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03076.java

@@ -81,7 +81,8 @@ public class THR03076 extends QCCatalogue {
             drugName = structMap.get("医嘱项目名称");
             value = structMap.get("医嘱单次剂量");
             startDateStr = structMap.get("医嘱开始时间");
-            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+//            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+            startDate = StringUtil.parseDateTime(startDateStr);
             if (extData != null && extData.containsKey(startDate) && extData.get(startDate).equals(drugName)) {
                 continue;   //THR02985  医嘱有抗生素使用病程无记录,规则中没报未记录的抗生素继续走这条规则,报未记录的抗生素过滤
             }
@@ -187,7 +188,7 @@ public class THR03076 extends QCCatalogue {
                             if (wardUsage.size() == 0) {
                                 match = true;
                             }
-                            adDateStr = DateUtil.formatDate(adDate);
+                            adDateStr = DateUtil.formatDateTime(adDate);
                             if (!match && wardUsage.size() > 0 && !sb.toString().contains(drugKey + "(" + adDateStr + ")")) {
                                 infoAppend(sb, ai.getKey(), adDateStr);
                                 break;
@@ -218,7 +219,8 @@ public class THR03076 extends QCCatalogue {
         for (Map<String, String> structMap : docAdvStruct) {
             drugName = structMap.get("医嘱项目名称");
             startDateStr = structMap.get("医嘱开始时间");
-            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+//            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+            startDate = StringUtil.parseDateTime(startDateStr);
             if (antibioticDateTimes.containsKey(drugName)) {
                 Map<Date, Integer> map = antibioticDateTimes.get(drugName);
                 if (map.containsKey(startDate)) {

+ 5 - 4
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03077.java

@@ -80,8 +80,8 @@ public class THR03077 extends QCCatalogue {
             drugName = structMap.get("医嘱项目名称");
             value = structMap.get("医嘱单次剂量");
             startDateStr = structMap.get("医嘱开始时间");
-            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
-
+//            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+            startDate = StringUtil.parseDateTime(startDateStr);
             if (StringUtil.isNotBlank(drugName)) {
                 if (antibioticDateTimes.get(drugName).get(startDate) > 0) {
                     continue;   //一天内同一抗生素开过多次的抗生素直接过滤
@@ -269,7 +269,7 @@ public class THR03077 extends QCCatalogue {
                 dateList = drug.getValue();
                 for (String date_miss : dateList) {
                     String[] date_miss_nfo = date_miss.split("=");
-                    strBuf.append(DateUtil.formatDate(StringUtil.parseDateTime(date_miss_nfo[1]))).append(",").append(date_miss_nfo[2]).append("、");
+                    strBuf.append(DateUtil.formatDateTime(StringUtil.parseDateTime(date_miss_nfo[1]))).append(",").append(date_miss_nfo[2]).append("、");
                 }
             }
 
@@ -298,7 +298,8 @@ public class THR03077 extends QCCatalogue {
         for (Map<String, String> structMap : docAdvStruct) {
             drugName = structMap.get("医嘱项目名称");
             startDateStr = structMap.get("医嘱开始时间");
-            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+//            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+            startDate = StringUtil.parseDateTime(startDateStr);
             if (antibioticDateTimes.containsKey(drugName)) {
                 Map<Date, Integer> map = antibioticDateTimes.get(drugName);
                 if (map.containsKey(startDate)) {

+ 48 - 3
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessDrug.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.lantone.qc.kernel.structure.ai.model.EntityEnum;
 import com.lantone.qc.kernel.structure.ai.model.Lemma;
 import com.lantone.qc.pub.model.entity.*;
+import org.apache.commons.beanutils.BeanUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
@@ -20,10 +21,15 @@ public class EntityProcessDrug extends EntityProcess {
         //药物
         List<Drug> drugs = new ArrayList<>();
         try {
-            List<Lemma> DrugLemmas = createEntityTree(aiOut, EntityEnum.DRUG.toString());
-            for (Lemma lemma : DrugLemmas) {
+            List<Lemma> drugLemmas = createEntityTree(aiOut, EntityEnum.DRUG.toString());
+            List<Lemma> consumptionLemmas = createEntityTree(aiOut, EntityEnum.CONSUMPTION.toString().split("-")[0]);
+            List<Lemma> usageWardRoundLemmas = createEntityTree(aiOut, EntityEnum.USAGE_WARD_ROUND.toString());
+            List<Lemma> frequencyLemmas = createEntityTree(aiOut, EntityEnum.FREQUENCY.toString());
+            List<Lemma> stopLemmas = createEntityTree(aiOut, EntityEnum.STOP.toString());
+            List<Lemma> reasonsForAntibioticLemmas = createEntityTree(aiOut, EntityEnum.REASONS_FOR_ANTIBIOTIC.toString());
+            for (Lemma lemma : drugLemmas) {
                 int lemmaPosition = Integer.parseInt(lemma.getPosition());
-                if (content.substring(Math.max(0, lemmaPosition - 10), lemmaPosition).contains("暂停")){
+                if (content.substring(Math.max(0, lemmaPosition - 10), lemmaPosition).contains("暂停")) {
                     continue;
                 }
                 Drug drug = new Drug();
@@ -33,6 +39,26 @@ public class EntityProcessDrug extends EntityProcess {
                 drug.setFrequency(findTAfter(lemma, new Frequency(), EntityEnum.FREQUENCY.toString()));
                 drug.setStop(findTAfter(lemma, new Stop(), EntityEnum.STOP.toString()));
                 drug.setReasonsForAntibiotic(findTAfter(lemma, new ReasonsForAntibiotic(), EntityEnum.REASONS_FOR_ANTIBIOTIC.toString()));
+                //用量
+                if (drug.getConsumption() == null) {
+                    drug.setConsumption(setDrugs(consumptionLemmas, lemma, new Consumption()));
+                }
+                //用法
+                if (drug.getUsageWardRound() == null) {
+                    drug.setUsageWardRound(setDrugs(usageWardRoundLemmas, lemma, new UsageWardRound()));
+                }
+                //频率
+                if (drug.getFrequency() == null) {
+                    drug.setFrequency(setDrugs(frequencyLemmas, lemma, new Frequency()));
+                }
+                //停用
+                if (drug.getStop() == null) {
+                    drug.setStop(setDrugs(stopLemmas, lemma, new Stop()));
+                }
+                //抗生素使用原因
+                if (drug.getReasonsForAntibiotic() == null) {
+                    drug.setReasonsForAntibiotic(setDrugs(reasonsForAntibioticLemmas, lemma, new ReasonsForAntibiotic()));
+                }
                 drugs.add(drug);
             }
         } catch (Exception e) {
@@ -41,4 +67,23 @@ public class EntityProcessDrug extends EntityProcess {
         }
         return drugs;
     }
+
+    /**
+     * 模型抓取抗生素信息为空的时候判断是否在20个字节之内
+     *
+     * @param Lemmas
+     * @param lemma
+     * @param t
+     * @return
+     * @throws Exception
+     */
+    private <T> T setDrugs(List<Lemma> Lemmas, Lemma lemma, T t) throws Exception {
+        for (Lemma lem : Lemmas) {
+            if (Integer.parseInt(lem.getPosition()) - Integer.parseInt(lemma.getPosition()) <= 20) {
+                BeanUtils.copyProperty(t, "name", lemma.getText());
+                return t;
+            }
+        }
+        return null;
+    }
 }