瀏覽代碼

接口测试

zhoutg 4 年之前
父節點
當前提交
851914886b

+ 28 - 22
src/main/java/com/diagbot/facade/TestFacade.java

@@ -77,7 +77,7 @@ public class TestFacade {
             IndicationPushVO indicationPushVO = new IndicationPushVO();
             indicationPushVO.setRuleType("2");
             indicationPushVO.setIdNum(bean.getIdNum());
-            if (StringUtil.isBlank(bean.getStandName()) || bean.getNeoName().startsWith("本品")) {
+            if (StringUtil.isBlank(bean.getStandName()) || bean.getNeoName().contains("本品")) {
                 continue;
             }
             if (StringUtil.isNotBlank(bean.getOrderType())) {
@@ -171,40 +171,29 @@ public class TestFacade {
                         symptom.append(bean.getNeoName()).append("。");
                         indicationPushVO.setSymptom(symptom.toString());
                         break;
-                    case "10": // 禁忌人群
-                        switch (bean.getNeoName()) {
-                            case "妊娠":
-                                List<Item> groupList = new ArrayList<>();
-                                Item group = new Item();
-                                group.setName(bean.getNeoName());
-                                group.setUniqueName(bean.getNeoName());
-                                groupList.add(group);
-                                indicationPushVO.setDiag(groupList);
-                                break;
-                            case "月经期":
-                                indicationPushVO.setSymptom("月经第" +(int)(Math.random() * 30) + "天");
-                                break;
-                            default:
-                                continue;
-                        }
-                        break;
                     case "7" : // 药品过敏原
                         StringBuffer pastStr = new StringBuffer("");
+                        String name = bean.getNeoName();
+                        // 随机取其中一条
+                        if (name.contains(";") || name.contains(";")) {
+                            String[] nameArr = name.split(";|;");
+                            name = nameArr[getRandomNum(nameArr.length)];
+                        }
                         if ("药品通用名称".equals(bean.getDrugType())) {
-                            pastStr.append("有“").append(bean.getNeoName()).append("”过敏。");
+                            pastStr.append("对“").append(name).append("”过敏。");
                             indicationPushVO.setPasts(pastStr.toString());
                         } else if ("药品类别".equals(bean.getDrugType())) {
-                            List<String> drugList = (List<String>)redisUtil.get(RedisEnum.drugType.getName() + bean.getNeoName());
+                            List<String> drugList = (List<String>)redisUtil.get(RedisEnum.drugType.getName() + name);
                             if (ListUtil.isNotEmpty(drugList)) {
                                 if (testLineVO.isGetOne()) {
-                                    pastStr.append("“").append(drugList.get(getRandomNum(drugList.size()))).append("”过敏。");
+                                    pastStr.append("对“").append(drugList.get(getRandomNum(drugList.size()))).append("”过敏。");
                                     indicationPushVO.setPasts(pastStr.toString());
                                 } else {
                                     for (String s : drugList) {
                                         pastStr = new StringBuffer("");
                                         IndicationPushVO indicationPushCopy = new IndicationPushVO();
                                         BeanUtil.copyProperties(indicationPushVO, indicationPushCopy);
-                                        pastStr.append("“").append(s).append("”过敏。");
+                                        pastStr.append("“").append(s).append("”过敏。");
                                         indicationPushCopy.setPasts(pastStr.toString());
                                         indicationPushCopy.setMsg("过敏药品【" + s + "】");
                                         indicationPushVOList.add(indicationPushCopy);
@@ -214,6 +203,23 @@ public class TestFacade {
                             }
                         }
                         break;
+                    case "10": // 禁忌人群
+                        switch (bean.getNeoName()) {
+                            case "妊娠":
+                                List<Item> groupList = new ArrayList<>();
+                                Item group = new Item();
+                                group.setName(bean.getNeoName());
+                                group.setUniqueName(bean.getNeoName());
+                                groupList.add(group);
+                                indicationPushVO.setDiag(groupList);
+                                break;
+                            case "月经期":
+                                indicationPushVO.setSymptom("月经第" +(int)(Math.random() * 30) + "天");
+                                break;
+                            default:
+                                continue;
+                        }
+                        break;
                     case "12": // 体征
                         StringBuffer sbVital = new StringBuffer();
                         String[] vitalArr = bean.getNeoName().split(",");

+ 5 - 4
src/main/java/com/diagbot/model/ai/process/EntityProcessPast.java

@@ -5,6 +5,7 @@ import com.diagbot.model.ai.model.EntityEnum;
 import com.diagbot.model.ai.model.Lemma;
 import com.diagbot.model.entity.*;
 import com.diagbot.model.label.PastLabel;
+import com.diagbot.util.CoreUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
@@ -124,8 +125,8 @@ public class EntityProcessPast extends EntityProcess {
                     //药物过敏史
                     if (relationLemma.getProperty().equals(EntityEnum.DRUG_ALLERGY.toString())) {
                         AllergyMedicine allergyMedicine = new AllergyMedicine();
-                        allergyMedicine.setName(relationLemma.getText());
-                        allergyMedicine.setStandName(relationLemma.getText());
+                        allergyMedicine.setName(CoreUtil.replaceStartPunctuation(relationLemma.getText()));
+                        allergyMedicine.setStandName(CoreUtil.replaceStartPunctuation(relationLemma.getText()));
                         allergyMedicine.setNegative(findNegative(relationLemma));//阴性
                         allergyMedicine.setPd(findPD(relationLemma));//时间
                         allergyMedicine.setDegree(findT(relationLemma, new Degree(), EntityEnum.TREND.toString()));//程度
@@ -151,8 +152,8 @@ public class EntityProcessPast extends EntityProcess {
             List<Lemma> allergyMedicineLemmas = createEntityTree(aiOut, EntityEnum.DRUG_ALLERGY.toString());
             for (Lemma lemma : allergyMedicineLemmas) {
                 AllergyMedicine allergyMedicine = new AllergyMedicine();
-                allergyMedicine.setName(lemma.getText());
-                allergyMedicine.setStandName(lemma.getText());
+                allergyMedicine.setName(CoreUtil.replaceStartPunctuation(lemma.getText()));
+                allergyMedicine.setStandName(CoreUtil.replaceStartPunctuation(lemma.getText()));
                 if (lemma.isHaveChildren()) {
                     allergyMedicine.setNegative(findNegative(lemma));
                     allergyMedicine.setPd(findPD(lemma));//时间

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

@@ -242,7 +242,7 @@ public class BillProcess {
             // 临床表现
             commonRule.compareNameWithBill(bill.getClinicfindings(), clinicals, bill, billMsgList, NeoEnum.clinicfindings.getName());
 
-            // 手术(既往史、现病史)
+            // 手术(既往史、现病史、医嘱手术)
             commonRule.compareNameWithBill(bill.getOperations(), operations_all, bill, billMsgList, NeoEnum.operations.getName());
 
             // 禁忌过敏药品(既往史)

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

@@ -686,4 +686,17 @@ public class CoreUtil {
         BigDecimal bg = new BigDecimal(String.valueOf(ageStr));
         return bg.setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
     }
+
+    /**
+     * 替换首位的标点符号(例如:既往史提取“铁)
+     *
+     * @param str
+     * @return
+     */
+    public static String replaceStartPunctuation(String str) {
+        if (str.startsWith("“")) {
+            return str.replaceFirst("“", "");
+        }
+        return str;
+    }
 }

+ 2 - 0
src/main/java/com/diagbot/vo/TestLineVO.java

@@ -1,5 +1,6 @@
 package com.diagbot.vo;
 
+import io.swagger.annotations.ApiParam;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -23,5 +24,6 @@ public class TestLineVO implements Serializable {
     private int sheetIndex = 0;
 
     // true 表示随机取一条,false表示取全部
+    @ApiParam(defaultValue = "true")
     private boolean getOne = false;
 }