zhoutg 3 lat temu
rodzic
commit
f3c59c877a

+ 7 - 6
src/main/java/com/diagbot/dto/WordCrfDTO.java

@@ -3,6 +3,7 @@ package com.diagbot.dto;
 import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.biz.push.entity.Pacs;
+import com.diagbot.biz.push.entity.Scale;
 import com.diagbot.model.label.ChiefLabel;
 import com.diagbot.model.label.DiagLabel;
 import com.diagbot.model.label.FamilyLabel;
@@ -66,13 +67,9 @@ public class WordCrfDTO {
     private DiagLabel diagLabel = new DiagLabel();
 
     /*******************************************入参数据拷贝开始******************************/
-    /**
-     * 选中诊断
-     */
+    // 选中诊断
     private Item diseaseName;
-    /**
-     * 选中手术
-     */
+    // 选中手术
     private Item operationName;
      // 诊断
     private List<Item> diag = new ArrayList<>();
@@ -90,6 +87,10 @@ public class WordCrfDTO {
     private List<ItemExt> transfusionOrder = new ArrayList<>();
     // 输血记录
     private List<ItemExt> transfusion = new ArrayList<>();
+    // 其他医嘱
+    private List<Item> otherAdvice = new ArrayList<>();
+    // 量表结果
+    private List<Scale> scale = new ArrayList<>();
     /*******************************************入参数据拷贝结束******************************/
     // 化验
     // private LisLabel lisLabel;

+ 6 - 0
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -162,6 +162,12 @@ public class CommonFacade {
         if (StringUtil.isNotBlank(searchData.getVital())) {
             wordCrfDTO.setVital(searchData.getVital());
         }
+        if (ListUtil.isNotEmpty(searchData.getOtherAdvice())) {
+            wordCrfDTO.setOtherAdvice(searchData.getOtherAdvice());
+        }
+        if (ListUtil.isNotEmpty(searchData.getScale())) {
+            wordCrfDTO.setScale(searchData.getScale());
+        }
 
         // 模型处理数据
         aiAnalyze.aiProcess(searchData, wordCrfDTO);

+ 3 - 0
src/main/java/com/diagbot/facade/OtherTipFacade.java

@@ -37,6 +37,9 @@ public class OtherTipFacade {
         // 其他值提醒——输血
         otherTipProcess.processTransfusion(wordCrfDTO, res);
 
+        // TODO 特殊规则
+
+
         // 结果去重处理
         commonFacade.dealMsg(res.getOtherList());
     }

+ 91 - 0
src/main/java/com/diagbot/process/OtherTipProcess.java

@@ -2,6 +2,7 @@ package com.diagbot.process;
 
 import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
+import com.diagbot.biz.push.entity.Scale;
 import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.RuleBaseDTO;
@@ -17,11 +18,17 @@ import com.diagbot.rule.CommonRule;
 import com.diagbot.rule.GroupRule;
 import com.diagbot.rule.LisRule;
 import com.diagbot.rule.PacsRule;
+import com.diagbot.util.CoreUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.ReflectUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.RuleVO;
+import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -125,6 +132,90 @@ public class OtherTipProcess {
         }
     }
 
+    /**
+     * 处理业务——特殊规则
+     *
+     * @param wordCrfDTO
+     * @param res
+     */
+    public void processSpecial(WordCrfDTO wordCrfDTO, IndicationDTO res) {
+        // 判断VTE评估结果和出血风险结果
+        List<Scale> scaleList = wordCrfDTO.getScale();
+        // VTE评估结果
+        String vteResult = "";
+        // VTE出血风险
+        String vteBlood = "";
+        if (ListUtil.isNotEmpty(scaleList)) {
+            for (Scale scale : scaleList) {
+                String result = scale.getResult();
+                if (StringUtil.isNotBlank(result)) {
+                    if (result.matches("高危|中危|极高危")) {
+                        vteResult = result;
+                    } else if (result.matches("有|无")) {
+                        vteBlood = result;
+                    }
+                }
+            }
+        }
+        // 是否有药物医嘱
+        Boolean drugAdviceFlag = false;
+        // 是否有机械医嘱
+        Boolean mechanicalAdviceFlag = false;
+        List<String> drugNameList = Lists.newArrayList("普通肝素");
+        List<String> mechanicalNameList = Lists.newArrayList("普通肝素");
+        // VTE评估结果 和 VTE出血风险都有值
+        if (StringUtil.isNotBlank(vteResult) && StringUtil.isNotBlank(vteBlood)) {
+            // 获取药品医嘱
+            drugAdviceFlag = hasAdvice(wordCrfDTO.getDrug(), drugNameList);
+            // 获取机械医嘱
+            if (!drugAdviceFlag) {
+                mechanicalAdviceFlag = hasAdvice(wordCrfDTO.getOtherAdvice(), mechanicalNameList);
+            }
+            // 无药物医嘱且无机械医嘱,拼接提示语
+            if (!drugAdviceFlag && !mechanicalAdviceFlag) {
+                String msg = "该患者VTE评估为中/高危,伴有出血风险,建议开机械预防医嘱";
+                if (vteBlood.matches("有")) {
+
+                } else if (vteBlood.matches("无")) {
+                    msg = "该患者VTE评估为中/高危,无出血风险,建议开药物或机械预防医嘱";
+                    
+                }
+            }
+        }
+    }
+
+    /**
+     * 是否有效医嘱
+     *
+     * @param tList
+     * @param nameList
+     * @param <T>
+     * @return
+     */
+    public <T> Boolean hasAdvice(List<T> tList, List<String> nameList) {
+        Boolean hasAdviceFlag = false;
+        if (ListUtil.isEmpty(tList) || ListUtil.isEmpty(nameList)) {
+            return hasAdviceFlag;
+        }
+        for (T item : tList) {
+            String name = ReflectUtil.getProperty(item, "name");
+            if (StringUtil.isNotBlank(name)) {
+                if (nameList.contains(name)) {
+                    // 开单时间
+                    String dateValue = ReflectUtil.getProperty(item, "dateValue");
+                    // 当前时间
+                    String curDate = DateUtil.formatDateTime(new Date());
+                    int flag = CoreUtil.compareTime(dateValue, curDate, 60L * 24 * 6, true, false);
+                    if (flag == 1) {
+                        hasAdviceFlag = true;
+                        break;
+                    }
+                }
+            }
+        }
+        return hasAdviceFlag;
+    }
+
     /**
      * 获取其他值提醒入参——辅检
      *

+ 48 - 0
src/main/java/com/diagbot/util/CoreUtil.java

@@ -1242,6 +1242,54 @@ public class CoreUtil {
         return flag;
     }
 
+    /**
+     * 时间差值(endDateStr - startDateStr)和指定分钟数进行比较
+     *
+     * @param startDateStr 开始时间
+     * @param endDateStr   结束时间
+     * @param minute       分钟
+     * @param hasEqual     是否包含等于
+     * @param abs          是否加绝对值
+     * @return 返回值:-1:无法比较或出错,0:时间差超出范围,1:时间差在范围内
+     */
+    public static int compareTime(String startDateStr, String endDateStr, Long minute, boolean hasEqual, boolean abs) {
+        int flag = -1;
+        if (StringUtil.isBlank(startDateStr) || StringUtil.isBlank(endDateStr)) {
+            return flag;
+        }
+        try {
+            Date startDate = CatalogueUtil.parseStringDate(startDateStr);
+            Date endDate = CatalogueUtil.parseStringDate(endDateStr);
+            Long timeStart = startDate.getTime();
+            Long timeEnd = endDate.getTime();
+            Long timeDiff = timeEnd - timeStart;// 时间差
+            // 是否加绝对值
+            if (abs) {
+                timeDiff = Math.abs(timeDiff);// 时间差绝对值
+            } else {
+                if (timeDiff < 0) {
+                    return flag;
+                }
+            }
+            if (hasEqual) {
+                if (timeDiff >= minute * 1000 * 60) {
+                    flag = 0;
+                } else {
+                    flag = 1;
+                }
+            } else {
+                if (timeDiff > minute * 1000 * 60) {
+                    flag = 0;
+                } else {
+                    flag = 1;
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return flag;
+    }
+
     /**
      * 比较时间,endDateStr >= startDateStr
      * @param startDateStr