Browse Source

Merge remote-tracking branch 'origin/master'

MarkHuang 4 years ago
parent
commit
74181d744d

+ 1 - 1
src/main/java/com/diagbot/enums/NeoEnum.java

@@ -21,7 +21,7 @@ public enum NeoEnum implements KeyedNamed {
     lis(8, "禁忌实验室检查"),
     pacs(9, "禁忌辅助检查"),
     disease(10, "禁忌疾病"),
-    group(11, "禁人群"),
+    group(11, "禁人群"),
     conflictmeds(12, "配伍禁忌"),
     vitals(13, "禁忌查体"),
     pacsDesc(14, "禁忌辅助检查描述"),

+ 31 - 27
src/main/java/com/diagbot/facade/TestFacade.java

@@ -67,7 +67,6 @@ public class TestFacade {
 
     /**
      * 测试导出
-     *
      */
     public static void exportExcel(HttpServletResponse response) {
         List<TestExport> testExportList = new ArrayList<>();
@@ -193,7 +192,7 @@ public class TestFacade {
                         symptom.append(bean.getNeoName()).append("”。");
                         indicationPushVO.setSymptom(symptom.toString());
                         break;
-                    case "7" : // 药品过敏原
+                    case "7": // 药品过敏原
                         StringBuffer pastStr = new StringBuffer("");
                         String name = bean.getNeoName();
                         List<String> drugAll = new ArrayList<>();
@@ -203,7 +202,7 @@ public class TestFacade {
                             drugAll.addAll(drugList);
                         } else if ("药品类别".equals(bean.getDrugType())) {
                             for (String s : drugList) {
-                                List<String> drugRedis = (List<String>)redisUtil.get(RedisEnum.drugType.getName() + s);
+                                List<String> drugRedis = (List<String>) redisUtil.get(RedisEnum.drugType.getName() + s);
                                 if (ListUtil.isNotEmpty(drugRedis)) {
                                     drugAll.addAll(drugRedis);
                                 }
@@ -237,7 +236,7 @@ public class TestFacade {
                                 indicationPushVO.setDiag(groupList);
                                 break;
                             case "月经期":
-                                indicationPushVO.setSymptom("月经第" +(int)(Math.random() * 30) + "天");
+                                indicationPushVO.setSymptom("月经第" + (int) (Math.random() * 30) + "天");
                                 break;
                             case "幼儿":
                                 indicationPushVO.setAgeNum(1D);
@@ -444,6 +443,13 @@ public class TestFacade {
                 item.setName(bean.getOtherTipNodeName());
                 diag.add(item);
                 indicationPushVO.setDiag(diag);
+            } else if ("禁忌人群".equals(bean.getOtherTipNodeType())) {
+                List<Item> groupList = new ArrayList<>();
+                Item group = new Item();
+                group.setName(bean.getOtherTipNodeName());
+                group.setUniqueName(bean.getOtherTipNodeName());
+                groupList.add(group);
+                indicationPushVO.setDiag(groupList);
             }
             List<Lis> lisList = new ArrayList<>();
             Lis lis = new Lis();
@@ -875,7 +881,7 @@ public class TestFacade {
             }
             //化验
             String lisAll = bean.getLisAll();
-            if(StringUtil.isNotBlank(lisAll)) {
+            if (StringUtil.isNotBlank(lisAll)) {
                 String[] physiquelisAll = lisAll.split(",");
                 for (int i = 0; i < physiquelisAll.length; i++) {
 
@@ -1083,8 +1089,10 @@ public class TestFacade {
             // 拼接返回数据
             for (int i = 0; i < list.size(); i++) {
                 Future<Map> future = list.get(i);
-                while(!future.isDone()); // 这一行代码很重要
-                List<String> obj = (List<String>)future.get().get("出错信息");
+                while (!future.isDone()) {
+                    ; // 这一行代码很重要
+                }
+                List<String> obj = (List<String>) future.get().get("出错信息");
                 if (ListUtil.isNotEmpty(obj)) {
                     errMsg.addAll(obj);
                 }
@@ -1158,20 +1166,16 @@ public class TestFacade {
         File newfile = new File(filePath);
         int bytesRead = 0;
         byte[] buffer = new byte[8192];
-        try
-        {
+        try {
             FileInputStream fis = new FileInputStream(newfile);
             OutputStream os = item.getOutputStream();
             while ((bytesRead = fis.read(buffer, 0, 8192))
-                    != -1)
-            {
+                    != -1) {
                 os.write(buffer, 0, bytesRead);
             }
             os.close();
             fis.close();
-        }
-        catch (IOException e)
-        {
+        } catch (IOException e) {
             e.printStackTrace();
         }
         return item;
@@ -1179,18 +1183,19 @@ public class TestFacade {
 
     /**
      * 随机获取0—size之间的一个数值
+     *
      * @param size
      * @return
      */
     public int getRandomNum(int size) {
-        return (int)(Math.random() * size);
+        return (int) (Math.random() * size);
     }
 
     /**
      * 将列表按列表总长度划分
      *
      * @param originList 数据
-     * @param num 份数
+     * @param num        份数
      * @param <T>
      * @return
      */
@@ -1215,11 +1220,10 @@ public class TestFacade {
         List<TestIndicationVO> newdata = ExcelUtils.importExcelMultiSheets(file, 0, 1, testLineVO.getSheetIndex(), TestIndicationVO.class);
 
         int size = data.size();
-        for (TestIndicationVO testIndicationVO: newdata) {
+        for (TestIndicationVO testIndicationVO : newdata) {
             if (testIndicationVO.getStandName().equals("标准名称")) {
                 size -= 1;
-            }
-            else {
+            } else {
                 int newid = Integer.parseInt(testIndicationVO.getIdNum()) + size;
                 testIndicationVO.setIdNum(String.valueOf(newid));
                 data.add(testIndicationVO);
@@ -1229,8 +1233,8 @@ public class TestFacade {
         List<Map<String, Object>> res = getExcel(data, testLineVO);
 
         String sheetname = "整合后";
-        List<String> header = Arrays.asList("序号","标准名称","","开单项类型","","","","内容标准名称","禁忌类型","","状态");
-        List<String> headerId = Arrays.asList("2","标准名称","","1实验室检查,\n2辅助检查名称,\n3手术和操作","套餐(大项)","明细(小项)","医学规则","内容标准名称","1性别,2实验室检查,3临床表现,4辅助检查名称描述,5疾病,6服用药品,7药物过敏原,8食物过敏原,9手术,10禁忌人群,11过敏原,12体征,13禁忌医疗器械及物品","系统拼接提示结果","");
+        List<String> header = Arrays.asList("序号", "标准名称", "", "开单项类型", "", "", "", "内容标准名称", "禁忌类型", "", "状态");
+        List<String> headerId = Arrays.asList("2", "标准名称", "", "1实验室检查,\n2辅助检查名称,\n3手术和操作", "套餐(大项)", "明细(小项)", "医学规则", "内容标准名称", "1性别,2实验室检查,3临床表现,4辅助检查名称描述,5疾病,6服用药品,7药物过敏原,8食物过敏原,9手术,10禁忌人群,11过敏原,12体征,13禁忌医疗器械及物品", "系统拼接提示结果", "");
         List<String> colheader = Arrays.asList("idnum", "stdname", "", "orderType", "", "", "", "neoName", "neoType", "", "status");
         ExcelUtils.exportExcel(sheetname, header, headerId, colheader, res);
         Map<String, Object> summary = new HashMap<>();
@@ -1259,7 +1263,7 @@ public class TestFacade {
             Map<String, Object> item = content.get(bean.getIdNum());
             item.put("item", bean);
 
-            if (null!=bean.getOrderType() && null!=bean.getNeoName()) {
+            if (null != bean.getOrderType() && null != bean.getNeoName()) {
                 if (bean.getOrderType().contains(xg) || bean.getNeoName().contains(xg)
                         || (StringUtil.isNotBlank(bean.getStatus()) && bean.getStatus().contains(xg))) {
                     item.put("status", xg);
@@ -1274,13 +1278,13 @@ public class TestFacade {
             Map<String, Object> item = content.get(id);
             Map<String, Object> detail = new HashMap<>();
             detail.put("idnum", id);
-            detail.put("stdname", ((TestIndicationVO)item.get("item")).getStandName());
-            detail.put("orderType", ((TestIndicationVO)item.get("item")).getOrderType());
-            detail.put("neoName", ((TestIndicationVO)item.get("item")).getNeoName());
-            detail.put("neoType", ((TestIndicationVO)item.get("item")).getNeoType());
+            detail.put("stdname", ((TestIndicationVO) item.get("item")).getStandName());
+            detail.put("orderType", ((TestIndicationVO) item.get("item")).getOrderType());
+            detail.put("neoName", ((TestIndicationVO) item.get("item")).getNeoName());
+            detail.put("neoType", ((TestIndicationVO) item.get("item")).getNeoType());
             detail.put("status", "");
 
-            if (null!=item.get("status")) {
+            if (null != item.get("status")) {
                 detail.put("status", item.get("status").toString());
             }
             res.add(detail);

+ 1 - 1
src/main/java/com/diagbot/process/BillProcess.java

@@ -269,7 +269,7 @@ public class BillProcess {
             // 服用药品(现病史一般情况后的药品)
             drugRule.bill(bill.getOralmeds(), allergyAll, bill, billMsgList, NeoEnum.oralmeds.getName());
 
-            // 禁人群
+            // 禁人群
             groupRule.bill(wordCrfDTO, bill, billMsgList, NeoEnum.group.getName());
 
             // 禁用辅助检查描述

+ 10 - 2
src/main/java/com/diagbot/process/OtherTipProcess.java

@@ -8,14 +8,18 @@ import com.diagbot.dto.OtherTipNeoDTO;
 import com.diagbot.dto.OtherTipPacsNeoDTO;
 import com.diagbot.dto.OtherTipTransfusionNeoDTO;
 import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.enums.NeoEnum;
 import com.diagbot.enums.TypeEnum;
+import com.diagbot.rule.GroupRule;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.MsgUtil;
 import com.diagbot.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -28,6 +32,8 @@ import java.util.stream.Collectors;
  */
 @Component
 public class OtherTipProcess {
+    @Autowired
+    GroupRule groupRule;
 
     /**
      * 处理业务——化验
@@ -43,13 +49,15 @@ public class OtherTipProcess {
 
             if (ListUtil.isNotEmpty(factor)) {
                 for (NodeNeoDTO nodeNeoDTO : factor) {
-                    Map map = null;
+                    Map map = new LinkedHashMap();
                     if (TypeEnum.disease.getName().equals(nodeNeoDTO.getTermtype())) { // 诊断
                         map = CoreUtil.compareNameWithNode(nodeNeoDTO, wordCrfDTO.getDiag());
                     } else if (TypeEnum.drug.getName().equals(nodeNeoDTO.getTermtype())) { // 药品
                         map = CoreUtil.compareNameWithNode(nodeNeoDTO, wordCrfDTO.getDrug());
+                    } else if (NeoEnum.group.getName().equals(nodeNeoDTO.getTermtype())) { // "禁忌人群"
+                        map = groupRule.gravidityRule(wordCrfDTO);
                     }
-                    if (map != null && (Boolean)map.get("flag") == true) {
+                    if (CoreUtil.getMapFlag(map) == true) {
                         String content = otherTipNeoDTO.getName() + otherTipNeoDTO.getDetailName();
                         if (StringUtil.isNotBlank(otherTipNeoDTO.getOtherValue())) {
                             content += otherTipNeoDTO.getOtherValue();

+ 46 - 24
src/main/java/com/diagbot/rule/GroupRule.java

@@ -5,10 +5,13 @@ import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.BillNeoMaxDTO;
 import com.diagbot.dto.NodeNeoDTO;
 import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.util.CoreUtil;
 import com.diagbot.util.MsgUtil;
 import org.springframework.stereotype.Component;
 
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -38,30 +41,8 @@ public class GroupRule {
 
             switch (node.getName()) {
                 case "妊娠":
-                    // 主诉、现病史、诊断包含“孕妇”,“妊娠”
-                    boolean flag = false;
-                    if (symptom.contains("孕妇") || chief.contains("孕妇")
-                            || symptom.contains("妊娠") || chief.contains("妊娠")) {
-                        flag = true;
-                    } else {
-                        // 主诉、现病史出现孕几周
-                        String regex = ".*孕.{1,4}周.*"; // 孕xx周
-                        if (symptom.matches(regex) || chief.matches(regex)) {
-                            flag = true;
-                        } else {
-                            List<Item> diag = wordCrfDTO.getDiag();
-                            for (Item item : diag) {
-                                // 诊断出现“孕几周”,孕字必须是第一个
-                                String regex1 = "孕.{1,4}周.*"; // 孕xx周
-                                if (item.getUniqueName().matches(regex1) || item.getUniqueName().contains("孕妇")
-                                        || item.getUniqueName().contains("妊娠")) {
-                                    flag = true;
-                                    break;
-                                }
-                            }
-                        }
-                    }
-                    if (flag) {
+                    Map map = gravidityRule(wordCrfDTO);
+                    if (CoreUtil.getMapFlag(map) == true) {
                         BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
                                 billNeoMaxDTO.getOrderName(), billNeoMaxDTO.getOrderStandName(),
                                 "妊娠", type, billNeoMaxDTO.getType());
@@ -105,4 +86,45 @@ public class GroupRule {
             }
         }
     }
+
+    /**
+     * 判断妊娠规则
+     *
+     * @param wordCrfDTO
+     * @return
+     */
+    public Map gravidityRule(WordCrfDTO wordCrfDTO) {
+        Map<String, Object> map = new LinkedHashMap<>();
+        // 妊娠目前从诊断里判断,包含“妊娠”
+        String symptom = wordCrfDTO.getSymptom(); // 现病史内容
+        String chief = wordCrfDTO.getChief(); // 主诉
+        // 主诉、现病史、诊断包含“孕妇”,“妊娠”
+        boolean flag = false;
+        if (symptom.contains("孕妇") || chief.contains("孕妇")
+                || symptom.contains("妊娠") || chief.contains("妊娠")) {
+            flag = true;
+        } else {
+            // 主诉、现病史出现孕几周
+            String regex = ".*孕.{1,4}周.*"; // 孕xx周
+            if (symptom.matches(regex) || chief.matches(regex)) {
+                flag = true;
+            } else {
+                List<Item> diag = wordCrfDTO.getDiag();
+                for (Item item : diag) {
+                    // 诊断出现“孕几周”,孕字必须是第一个
+                    String regex1 = "孕.{1,4}周.*"; // 孕xx周
+                    if (item.getUniqueName().matches(regex1) || item.getUniqueName().contains("孕妇")
+                            || item.getUniqueName().contains("妊娠")) {
+                        flag = true;
+                        break;
+                    }
+                }
+            }
+        }
+        if (flag) {
+            map.put("flag", flag);
+            map.put("msg", "妊娠");
+        }
+        return map;
+    }
 }

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

@@ -782,6 +782,19 @@ public class CoreUtil {
         return false;
     }
 
+    /**
+     * 获取mapflag值
+     *
+     * @param map
+     * @return
+     */
+    public static Boolean getMapFlag(Map map) {
+        if (map != null && map.get("flag") != null && (Boolean) map.get("flag") == true) {
+            return true;
+        }
+        return false;
+    }
+
     public static void main(String[] args) {
         String ageStr = ".545458";
         System.out.println(Double.parseDouble(ageStr));

+ 3 - 0
src/main/java/com/diagbot/util/MsgUtil.java

@@ -1,5 +1,6 @@
 package com.diagbot.util;
 import com.diagbot.dto.BillMsg;
+import com.diagbot.enums.NeoEnum;
 import com.diagbot.enums.TypeEnum;
 
 /**
@@ -143,6 +144,8 @@ public class MsgUtil {
             msg = String.format("该患者%s,患有%s,请留意", content, name);
         } else if (TypeEnum.drug.getName().equals(type)) {
             msg = String.format("该患者%s,已开%s,请留意", content, name);
+        } else if (NeoEnum.group.getName().equals(type)) {
+            msg = String.format("该患者%s,%s,请留意", content, name);
         }
         billMsg.setMsg(msg);
         billMsg.setContent(content);