浏览代码

抗生素使用指征不明确添加逻辑:从入院记录和查房记录找体温,大于37.3度不报错

hujing 4 年之前
父节点
当前提交
9bde172420
共有 1 个文件被更改,包括 43 次插入8 次删除
  1. 43 8
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03044.java

+ 43 - 8
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03044.java

@@ -7,6 +7,7 @@ import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
 import com.lantone.qc.pub.model.doc.LisDoc;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
@@ -78,9 +79,9 @@ public class THR03044 extends QCCatalogue {
             return;
         }
 
-        //体温大于38度也不报错
-        double temperature = getTemperature(inputInfo);
-        if (temperature > 38) {
+        //体温大于37.3度也不报错
+        boolean fever = isFever(inputInfo);
+        if (fever) {
             return;
         }
 
@@ -227,8 +228,10 @@ public class THR03044 extends QCCatalogue {
         return b;
     }
 
-    private double getTemperature(InputInfo inputInfo) {
+    private boolean isFever(InputInfo inputInfo) {
         double temp = 0d;
+        boolean rever = false;
+        //入院记录找体温是否大于37.3℃
         BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
         if (beHospitalizedDoc != null) {
             Map<String, String> beHStructureMap = beHospitalizedDoc.getStructureMap();
@@ -238,13 +241,45 @@ public class THR03044 extends QCCatalogue {
             }
             String special = beHStructureMap.get("专科小结");
             if (temp == 0 && StringUtil.isNotBlank(special)) {
-                Pattern p = Pattern.compile("T[1-9]\\d*\\.?\\d*℃");
-                Matcher matcher = p.matcher(special);
-                if (matcher.find()) {
-                    temp = Double.parseDouble(getNum(matcher.group(0)));
+                temp = getTemperature(special);
+            }
+            if (temp > 37.3) {
+                return true;
+            }
+        }
+
+        //查房记录找体温是否大于37.3℃
+        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+        if (threeLevelWardDocs.size() > 0) {
+            List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
+            List<String> content = allDoctorWradDocs
+                    .stream()
+                    .map(ThreeLevelWardDoc::getStructureMap)
+                    .map(x -> x.get("病情记录"))
+                    .collect(Collectors.toList());
+
+            for (String str : content) {
+                temp = getTemperature(str);
+                if (temp > 37.3) {
+                    return true;
                 }
             }
         }
+        return false;
+    }
+
+    /**
+     * 从文本中取体温
+     * @param content 文本
+     * @return
+     */
+    private double getTemperature(String content) {
+        double temp = 0d;
+        Pattern p = Pattern.compile("[1-9]\\d*\\.?\\d*℃");
+        Matcher matcher = p.matcher(content);
+        if (matcher.find()) {
+            temp = Double.parseDouble(getNum(matcher.group(0)));
+        }
         return temp;
     }
 }