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

Merge branch 'dev/KLBstand' into dev/precSR

gaodm 6 роки тому
батько
коміт
011e1a7e8e

+ 231 - 6
aipt-service/src/main/java/com/diagbot/facade/ClinicalFacade.java

@@ -7,29 +7,37 @@ import com.diagbot.client.bean.CalculateData;
 import com.diagbot.client.bean.GdbResponse;
 import com.diagbot.client.bean.Response;
 import com.diagbot.client.bean.ResponseData;
-import com.diagbot.dto.FeatureConceptDTO;
 import com.diagbot.dto.Lexeme;
 import com.diagbot.dto.LisResult;
 import com.diagbot.entity.ScaleContent;
-import com.diagbot.entity.SysLog;
 import com.diagbot.enums.ScaleTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.ScaleContentService;
-import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.vo.SearchVo;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestBody;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
  * <p>
- *  数据处理业务层
+ * 数据处理业务层
  * </p>
  *
  * @author Mark Huang
@@ -60,8 +68,11 @@ public class ClinicalFacade {
      */
     public ResponseData processClinicalData(@RequestBody SearchVo searchVo) {
         SearchVo sData = searchVo;
-
+        Map<String, List<Map<String, String>>> standWord = getStandWord();
         Response<List<Lexeme>> resp = nlpServiceClient.split(sData.getSymptom());
+        if (null != resp && null != resp.getData()) {
+            addStandWord(resp.getData(), standWord, sData);
+        }
 
         sData.setLisArr(processLis(sData.getLisArr()));
 
@@ -140,7 +151,6 @@ public class ClinicalFacade {
         return list;
     }
 
-
     public List<ScaleContent> getContent(String scaleName, String pushContent) {
         List<ScaleContent> list = scaleContentService.getContentByName(scaleName);
         for (ScaleContent scaleContent : list) {
@@ -180,4 +190,219 @@ public class ClinicalFacade {
         }
         return response;
     }
+
+    public SearchVo addStandWord(List<Lexeme> lexemes, Map<String, List<Map<String, String>>> standWords, SearchVo sData) {
+        List<Lexeme> feature = new ArrayList<>();
+        //收集分词结果中体征指标或体征指标值(数字)
+        for (int i = 0; i < lexemes.size(); i++) {
+            if (lexemes.get(i).getProperty().contains("33") || lexemes.get(i).getProperty().contains("28")
+                    || lexemes.get(i).getProperty().contains("2") || lexemes.get(i).getProperty().contains("9")
+                    ) {
+                feature.add(lexemes.get(i));
+            }
+        }
+        //根据收集到的分词结果把体征指标和对应体征指标值(数字)拼接
+        List<String> featureType = new ArrayList<>();
+        for (int i = 0; i < feature.size(); i++) {
+            boolean featureTypeState = true;
+            if (i < feature.size() - 2) {
+                if ((feature.get(i).getProperty().contains("33") && feature.get(i + 1).getProperty().contains("28")
+                        && feature.get(i + 2).getProperty().contains("2"))
+                        || (feature.get(i).getProperty().contains("33") && feature.get(i + 1).getProperty().contains("28")
+                        && feature.get(i + 2).getProperty().contains("9"))) {
+                    featureType.add(feature.get(i).getText() + "\t" + feature.get(i + 1).getText() + "\t"
+                            + feature.get(i + 2).getText());
+                    featureTypeState = false;
+                }
+            }
+            if (i < feature.size() - 1 && featureTypeState) {
+                if (feature.get(i).getProperty().contains("33") && feature.get(i + 1).getProperty().contains("28")) {
+                    featureType.add(feature.get(i).getText() + "\t" + feature.get(i + 1).getText());
+                }
+            }
+        }
+        //将标准词中体征指标值(数字)与分词结果中体征指标值(数字)比较
+        for (String f : featureType) {
+            String[] features = f.split("\t");
+            if (standWords.containsKey(features[0])) {
+                List<Map<String, String>> standWordList = standWords.get(features[0]);
+                for (Map<String, String> standWordMap : standWordList) {
+                    if (standWordMap.containsKey("op") && standWordMap.containsKey("unit")
+                            && standWordMap.containsKey("value")) {
+                        if (features.length == 2) {
+                            judgment(sData, features, features[0], standWordMap);
+                        } else {
+                            if (standWordMap.get("unit").equals(features[2])) {
+                                judgment(sData, features, features[0], standWordMap);
+                            }
+                        }
+                    } else if (standWordMap.containsKey("op") && standWordMap.containsKey("value")) {
+                        if (features.length == 2) {
+                            judgment(sData, features, features[0], standWordMap);
+                        }
+                    }
+                }
+            }
+        }
+        return sData;
+    }
+
+    //将标准词中体征指标值(数字)与分词结果中体征指标值(数字)比较
+    private void judgment(SearchVo sData, String[] features, String standWordKey, Map<String, String> standWordMap) {
+        if (standWordMap.get("op").contains(">=") || standWordMap.get("op").contains("≥")
+                || standWordMap.get("op").contains(">") || standWordMap.get("op").contains("大于")
+                || standWordMap.get("op").contains(">") || standWordMap.get("op").contains("大")) {
+            //单独处理  血压≥140/90mmHg   类似情况
+            if (features[1].contains("/")) {
+                if (standWordMap.get("value").contains("/")) {
+                    String[] feature = features[1].split("/");
+                    Integer featuresSBP = Integer.valueOf(feature[0]); //分词特征收缩压
+                    Integer featuresDBP = Integer.valueOf(feature[1]); //分词特征舒张压
+
+                    String[] values = standWordMap.get("value").split("/");
+                    Integer standWordSBP = Integer.valueOf(values[0]); //标准词收缩压
+                    Integer standWordDBP = Integer.valueOf(values[1]); //标准词舒张压
+                    if (featuresSBP > standWordSBP && featuresDBP > standWordDBP) {
+                        String standWord = standWordKey + standWordMap.get("op") + standWordMap.get("value") + standWordMap.get("unit") + "。";
+                        sData.setSymptom(sData.getSymptom() + standWord);
+                        System.out.println(sData.getSymptom());
+                    }
+                }
+            } else {
+                String num = getNum(standWordMap.get("value"));
+                if (Double.valueOf(getNum(features[1])) > Double.valueOf(num)) {
+                    String standWord = standWordKey + standWordMap.get("op") + standWordMap.get("value") + standWordMap.get("unit") + "。";
+                    sData.setSymptom(sData.getSymptom() + standWord);
+                    System.out.println(sData.getSymptom());
+
+                }
+            }
+        } else if (standWordMap.get("op").contains("<=") || standWordMap.get("op").contains("≤")
+                || standWordMap.get("op").contains("<") || standWordMap.get("op").contains("小于")
+                || standWordMap.get("op").contains("<") || standWordMap.get("op").contains("少于")
+                || standWordMap.get("op").contains("小")) {
+            //单独处理  血压小于90/60mmHg   类似情况
+            if (standWordMap.get("value").contains("/")) {
+                if (features[1].contains("/")) {
+                    String[] feature = features[1].split("/");
+                    Integer featuresSBP = Integer.valueOf(feature[0]); //收缩压
+                    Integer featuresDBP = Integer.valueOf(feature[1]); //舒张压
+
+                    String[] values = standWordMap.get("value").split("/");
+                    Integer standWordSBP = Integer.valueOf(values[0]); //收缩压
+                    Integer standWordDBP = Integer.valueOf(values[1]); //舒张压
+                    if (featuresSBP < standWordSBP && featuresDBP < standWordDBP) {
+                        String standWord = standWordKey + standWordMap.get("op") + standWordMap.get("value") + standWordMap.get("unit") + "。";
+                        sData.setSymptom(sData.getSymptom() + standWord);
+                        System.out.println(sData.getSymptom());
+                    }
+                }
+            } else {
+                String num = getNum(standWordMap.get("value"));
+                if (Double.valueOf(getNum(features[1])) < Double.valueOf(num)) {
+                    String standWord = standWordKey + standWordMap.get("op") + standWordMap.get("value") + standWordMap.get("unit") + "。";
+                    sData.setSymptom(sData.getSymptom() + standWord);
+                    System.out.println(sData.getSymptom());
+                }
+            }
+        }
+    }
+
+    private String getNum(String standWord) {
+        StringBuffer sb = new StringBuffer();
+        try {
+            for (String num : standWord.replaceAll("[^0-9]", ",").split(",")) {
+                if (num.length() > 0) {
+                    sb.append(num);
+                }
+            }
+        } catch (NumberFormatException e) {
+            e.printStackTrace();
+            System.out.println(e.getMessage() + "不是标准数字");
+        }
+        return sb.toString();
+    }
+
+    private Map<String, List<Map<String, String>>> getStandWord() {
+        Map<String, List<Map<String, String>>> standWordObj = new HashMap<>();
+        List<List<Lexeme>> splitStandWords = new ArrayList<>();
+        List<Lexeme> data = null;
+        BufferedReader reader = null;
+        InputStream inputStream = null;
+        String line = "";
+        try {
+            //file = ResourceUtils.getFile("classpath:standword.txt");
+            //            Resource resource = new ClassPathResource("standword.txt");
+            ClassPathResource classPathResource = new ClassPathResource("standword.txt");
+            inputStream = classPathResource.getInputStream();
+            //            file = resource.getFile();
+            reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
+            while ((line = reader.readLine()) != null) {
+                data = nlpServiceClient.split(line).getData();
+                splitStandWords.add(data);
+                //                standWord.add(line);
+            }
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                reader.close();
+                inputStream.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        List<Map<String, String>> standWordObjValList = null;
+        Map<String, String> standWordObjVal = null;
+        for (List<Lexeme> splitStandWord : splitStandWords) {
+            standWordObjValList = new ArrayList<>();
+            standWordObjVal = new HashMap<>();
+            int i = 0;
+            String standWordObjKey = "";
+            for (Lexeme lexeme : splitStandWord) {
+                i++;
+                if ("\uFEFF".equals(lexeme.getText()) || lexeme.getText().length() <= 0) {
+                    continue;
+                }
+                if (lexeme.getProperty().contains("1") || lexeme.getProperty().contains("5")
+                        || lexeme.getProperty().contains("33")) {
+                    if (!standWordObj.containsKey(lexeme.getText())) {
+                        standWordObj.put(lexeme.getText(), standWordObjValList);
+                    } else {
+                        standWordObjKey = lexeme.getText();
+                    }
+                } else if (lexeme.getProperty().contains("44")) {
+
+                    if (standWordObjVal.containsKey("op")) {
+                        standWordObjVal.put("op", standWordObjVal.get("op") + "," + lexeme.getText());
+                    } else {
+                        standWordObjVal.put("op", lexeme.getText());
+                    }
+                } else if (lexeme.getProperty().contains("13") || lexeme.getProperty().contains("28")) {
+                    if (standWordObjVal.containsKey("value")) {
+                        standWordObjVal.put("value", standWordObjVal.get("value") + "," + lexeme.getText());
+                    } else {
+                        standWordObjVal.put("value", lexeme.getText());
+                    }
+                } else if (lexeme.getProperty().contains("2") || lexeme.getProperty().contains("9")) {
+                    if (standWordObjVal.containsKey("unit")) {
+                        standWordObjVal.put("unit", standWordObjVal.get("unit") + "," + lexeme.getText());
+                    } else {
+                        standWordObjVal.put("unit", lexeme.getText());
+                    }
+                }
+                if (splitStandWord.size() == i) {
+                    if (standWordObj.containsKey(standWordObjKey)) {
+                        standWordObj.get(standWordObjKey).add(standWordObjVal);
+                    } else {
+                        standWordObjValList.add(standWordObjVal);
+                    }
+                }
+            }
+        }
+        return standWordObj;
+    }
+
 }

+ 13 - 2
aipt-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -246,6 +246,7 @@ public class ConceptFacade extends ConceptServiceImpl {
         List<ConceptRetrievalDTO> res = new ArrayList<>();
         List<Long> selfList = new ArrayList<>(); // 本体
         List<Long> subList = new ArrayList<>(); // 子项
+        List<String> conceptNameList = new ArrayList<>();//名称结果集保证数据唯一
         for (ConceptRetrievalDTO bean : conceptRetrievalDTOS) {
             if(StringUtil.isNotEmpty(bean.getParentName())) { // 重置showType
                 bean.setShowType(2L);
@@ -261,11 +262,13 @@ public class ConceptFacade extends ConceptServiceImpl {
             if(bean.getShowType().intValue() == 1) {
                 res.add(bean);
             } else if (bean.getShowType().intValue() == 2) {
-                if(!selfList.contains(bean.getParentId())) {
+                if(!selfList.contains(bean.getParentId()) && !conceptNameList.contains(bean.getParentName())) {
+                    conceptNameList.add(bean.getParentName());
                     res.add(bean);
                 }
             } else if (bean.getShowType().intValue() == 0) {
-                if(!selfList.contains(bean.getSelfId()) && !subList.contains(bean.getSelfId())) {
+                if(!selfList.contains(bean.getSelfId()) && !subList.contains(bean.getSelfId()) && !conceptNameList.contains(bean.getSelfName())) {
+                    conceptNameList.add(bean.getSelfName());
                     res.add(bean);
                 }
             }
@@ -292,6 +295,14 @@ public class ConceptFacade extends ConceptServiceImpl {
         RetrievalVO retrievalVO = new RetrievalVO();
         RetrievalDTO retrievalDTO = new RetrievalDTO();
         BeanUtil.copyProperties(getStaticKnowledgeVO,retrievalVO);
+        List<Integer> types = new ArrayList<>();
+        for (Integer type : getStaticKnowledgeVO.getTypes()) {
+            types.add(ParamConvertUtil.conceptConvert2Lib(type));
+        }
+        //设置类型为诊断、药品、化验、辅检
+        retrievalVO.setOtherType(types);
+        //如果为化验时设置子项类型
+        retrievalVO.setDetilType(LexiconTypeEnum.LIS_DETAILS.getKey());
         //获取标签信息
         List<ConceptRetrievalDTO> conceptRetrievalDTOList = this.retrivelConceptInfo(retrievalVO);
         List<RetrievalDTO> staticRetrievalList = new ArrayList<>();

+ 2 - 0
aipt-service/src/main/java/com/diagbot/vo/GetStaticKnowledgeVO.java

@@ -17,4 +17,6 @@ public class GetStaticKnowledgeVO {
     private String InputStr;
     //需要去重的id
     private List<Long> inputIds;
+    //指定类型
+    private List<Integer> types;
 }

+ 51 - 0
aipt-service/src/main/resources/standword.txt

@@ -0,0 +1,51 @@
+排便少于每周3次
+布氏征阳性
+附件活动性包块
+收缩压≥140mmHg
+收缩压大于140mmHg
+舒张压≥90mmHg
+舒张压大于90mmHg
+血压大于140mmHg
+悬壅垂水肿
+腰/臀比例>0.85
+血压≥140/90mmHg
+胎体
+不规则阴道出血/阴道出血
+下腹肿块/腹块
+心率大于100次/分
+口咽黏膜弥漫性充血肿胀
+悬壅垂水肿
+悬壅垂水肿
+血压小于90/60mmHg
+胸痛持续时间大于10分钟
+悬壅垂水肿
+电解质检查
+肺功能检查
+淋巴结细胞学检查
+腹部彩超
+膝关节痛风石
+触觉语颤增强
+晨僵≥30分钟
+BMI小于21
+体重指数小于21
+右上腹部饱满
+胃脱落细胞学检查
+肢体活动受限
+DBP>90mmHg
+SBP>140mmHg
+收缩压>140mmHg
+舒张压>90mmHg
+血压>140/90mmHg
+心率>90次/分
+R>20次/分
+体温<36℃
+体温>38℃
+R≥24次/分钟
+呼吸频率大于24次/分钟
+Hachinski缺血积分<4分
+Hachinski评分<4分
+HIS缺血指数<4分
+HIS评分<4分
+关节僵硬<30min
+晨僵<30min
+肢体苍白

+ 15 - 0
icss-service/src/main/java/com/diagbot/dto/OrderRetrivevalDTO.java

@@ -0,0 +1,15 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/6/27 13:23
+ */
+@Getter
+@Setter
+public class OrderRetrivevalDTO extends RetrievalDTO {
+    private Integer orderNo;//排序号
+}

+ 1 - 3
icss-service/src/main/java/com/diagbot/dto/PushDTO.java

@@ -20,11 +20,9 @@ public class PushDTO {
     private List<ConceptPushDTO> vital;
     private List<Long> vitalIds;
     private List<QuestionPushDTO> moduleVital;
-    private List<ConceptPushDTO> lab;
+    private List<QuestionPushDTO> lab;
     private List<ConceptPushDTO> pacs;
     private Map<String, List<ConceptPushDTO>> dis;
     private ConceptPushDTO dept;
     private List<MedicalIndication> medicalIndications;
-    /*private List<ScaleContent> scale;
-    private List<EvaluationDTO> evaluationModule;*/
 }

+ 52 - 14
icss-service/src/main/java/com/diagbot/facade/PushFacade.java

@@ -20,6 +20,7 @@ import com.diagbot.enums.FeatureTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.LisSourceEnum;
 import com.diagbot.enums.QuestionTypeEnum;
+import com.diagbot.enums.TagTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.util.BeanUtil;
@@ -29,8 +30,10 @@ import com.diagbot.util.RespDTOUtil;
 import com.diagbot.vo.LisResult;
 import com.diagbot.vo.PushKYJVO;
 import com.diagbot.vo.PushVO;
+import com.diagbot.vo.QuestionIds2VO;
 import com.diagbot.vo.QuestionVO;
 import com.google.common.collect.Lists;
+import org.aspectj.weaver.patterns.TypePatternQuestions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -144,14 +147,14 @@ public class PushFacade {
         }
         //化验  标签列表
         if (featureTypeSet.contains(String.valueOf(FeatureTypeEnum.Lis.getKey()))) {
-            List<ConceptPushDTO> labs = data.getLab();
+            List<QuestionPushDTO> labs = data.getLab();
             if (ListUtil.isNotEmpty(labs)) {
                 //公表项转套餐项
                 Map<String, List<String>> lisMapping = lisMappingFacade.getLisMappingByUniqueName();
                 List<String> nameList = Lists.newLinkedList();
                 Map<String, Long> lisMap = new LinkedHashMap<>();
-                List<ConceptPushDTO> lisDTO = Lists.newLinkedList();
-                for (ConceptPushDTO lab : labs) {
+                List<QuestionPushDTO> lisDTO = Lists.newLinkedList();
+                for (QuestionPushDTO lab : labs) {
                     if (ListUtil.isNotEmpty(lisMapping.get(lab.getName()))) {
                         //匹配出多个套餐项默认取第一个
                         String name = lisMapping.get(lab.getName()).get(0);
@@ -170,18 +173,16 @@ public class PushFacade {
                         lisMap = respDTO.data;
                     }
                 }
+                Map<String, QuestionDTO> questionDTOMap = addLisQuestion(nameList, pushVO.getAge(), pushVO.getSex());
                 for (String name : nameList) {
-                    ConceptPushDTO conceptPushDTO = new ConceptPushDTO();
-                    conceptPushDTO.setName(name);
-                    conceptPushDTO.setType(ConceptTypeEnum.Lis.getKey());
-                    conceptPushDTO.setLibType(12);
+                    QuestionPushDTO questionPushDTO = new QuestionPushDTO();
+                    QuestionDTO questionDTO = questionDTOMap.get(name);
+                    BeanUtil.copyProperties(questionDTO, questionPushDTO);
+                    questionPushDTO.setLibType(12);
                     if (lisMap.containsKey(name) && lisMap.get(name) != null) {
-                        conceptPushDTO.setConceptId(lisMap.get(name));
+                        questionPushDTO.setConceptId(lisMap.get(name));
                     }
-                    lisDTO.add(conceptPushDTO);
-                }
-                if (ListUtil.isNotEmpty(lisDTO)) {
-                    lisDTO = addQuestionId(lisDTO, ConceptTypeEnum.Lis.getKey());
+                    lisDTO.add(questionPushDTO);
                 }
                 pushDTO.setLab(lisDTO);
             }
@@ -307,7 +308,7 @@ public class PushFacade {
 
 
     /**
-     * 概念关联标签,添加标签id ——症状,化验
+     * 概念关联标签,添加标签id ——症状
      *
      * @param concepts
      * @param type
@@ -316,7 +317,13 @@ public class PushFacade {
     public List<ConceptPushDTO> addQuestionId(List<ConceptPushDTO> concepts, Integer type) {
         QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
         List<String> nameList = concepts.stream().map(concept -> concept.getName()).collect(Collectors.toList());
-        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).in("tag_name", nameList).eq("type", type);
+        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).eq("type", type);
+        //化验填写单匹配name
+        if (type.equals(ConceptTypeEnum.Lis.getKey())) {
+            questionInfoQueryWrapper.in("name", nameList);
+        } else {
+            questionInfoQueryWrapper.in("tag_name", nameList);
+        }
         List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
         if (ListUtil.isNotEmpty(questionInfoList)) {
             Map<String, QuestionInfo> questionInfoMap = EntityUtil.makeEntityMap(questionInfoList, "tagName");
@@ -328,4 +335,35 @@ public class PushFacade {
         }
         return concepts;
     }
+
+    /**
+     * 获取化验填写单
+     *
+     * @param nameList
+     * @param age
+     * @param sex
+     * @return
+     */
+    public Map<String, QuestionDTO> addLisQuestion(List<String> nameList, Integer age, Integer sex) {
+        Map<String, QuestionDTO> mapDTO = new LinkedHashMap<>();
+        QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
+        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
+                in("name", nameList).
+                eq("tag_type", TagTypeEnum.T7.getKey());
+        List<QuestionInfo> lisList = questionFacade.list(questionInfoQueryWrapper);
+        if (ListUtil.isNotEmpty(lisList)) {
+            List<Long> lisIds = lisList.stream().map(lis -> lis.getId()).collect(Collectors.toList());
+            QuestionIds2VO questionIds2VO = new QuestionIds2VO();
+            questionIds2VO.setAge(age);
+            questionIds2VO.setSexType(sex);
+            questionIds2VO.setIds(lisIds);
+            Map<Long, Object> questionDTOMap = questionFacade.getByIds(questionIds2VO);
+            for (Map.Entry<Long, Object> entry : questionDTOMap.entrySet()) {
+                QuestionDTO questionDTO = new QuestionDTO();
+                BeanUtil.copyProperties(entry.getValue(), questionDTO);
+                mapDTO.put(questionDTO.getName(), questionDTO);
+            }
+        }
+        return mapDTO;
+    }
 }

+ 31 - 8
icss-service/src/main/java/com/diagbot/facade/RetrievalFacade.java

@@ -3,15 +3,18 @@ package com.diagbot.facade;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.client.AiptServiceClient;
 import com.diagbot.dto.ConceptRetrievalDTO;
+import com.diagbot.dto.OrderRetrivevalDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.entity.QuestionInfo;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.QuestionTypeEnum;
+import com.diagbot.util.BeanUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.GetStaticKnowledgeVO;
+import com.diagbot.vo.GetStaticVO;
 import com.diagbot.vo.RetrievalVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -112,20 +115,24 @@ public class RetrievalFacade {
     /**
      * 静态知识标签检索
      *
-     * @param getStaticKnowledgeVO
+     * @param getStaticVO
      * @return
      */
-    public List<RetrievalDTO> getStaticKnowledge(GetStaticKnowledgeVO getStaticKnowledgeVO){
+    public List<RetrievalDTO> getStaticKnowledge(GetStaticVO getStaticVO){
+        GetStaticKnowledgeVO getStaticKnowledgeVO = new GetStaticKnowledgeVO();
+        BeanUtil.copyProperties(getStaticVO,getStaticKnowledgeVO);
+        //标签类型
+        List<String> questionNames = new ArrayList<>();
+        List<Integer> typeList = new ArrayList<>();//规定标签类型,只取诊断,化验,辅检,药品类型
+        typeList.add(QuestionTypeEnum.Disease.getKey());
+        typeList.add(QuestionTypeEnum.Drug.getKey());
+        typeList.add(QuestionTypeEnum.Lis.getKey());
+        typeList.add(QuestionTypeEnum.Pacs.getKey());
+        getStaticKnowledgeVO.setTypes(typeList);
         //调用aipt-service获取有静态知识的标签
         RespDTO<List<RetrievalDTO>> retrievalDTOList = aiptServiceClient.getStaticKnowledge(getStaticKnowledgeVO);
         RespDTOUtil.respNGDeal(retrievalDTOList,"获取静态知识失败");
         if(ListUtil.isNotEmpty(retrievalDTOList.data)){
-            List<String> questionNames = new ArrayList<>();
-            List<Integer> typeList = new ArrayList<>();//规定标签类型,只取诊断,化验,辅检,药品类型
-            typeList.add(QuestionTypeEnum.Disease.getKey());
-            typeList.add(QuestionTypeEnum.Pacs.getKey());
-            typeList.add(QuestionTypeEnum.Lis.getKey());
-            typeList.add(QuestionTypeEnum.Drug.getKey());
             for (RetrievalDTO retrievalDTOInfo : retrievalDTOList.data) {
                 if(typeList.contains(retrievalDTOInfo.getType())){
                     questionNames.add(retrievalDTOInfo.getName());
@@ -146,6 +153,22 @@ public class RetrievalFacade {
                 }
             }
         }
+        List<OrderRetrivevalDTO> orderRetrivevalDTOS = BeanUtil.listCopyTo(retrievalDTOList.data,OrderRetrivevalDTO.class);
+        //设置排序编号
+        for (OrderRetrivevalDTO orderRetrivevalDTO : orderRetrivevalDTOS) {
+            if(orderRetrivevalDTO.getType().intValue() == QuestionTypeEnum.Disease.getKey()){//诊断
+                orderRetrivevalDTO.setOrderNo(1);
+            }else if(orderRetrivevalDTO.getType().intValue() == QuestionTypeEnum.Drug.getKey()){//药品
+                orderRetrivevalDTO.setOrderNo(2);
+            }else if(orderRetrivevalDTO.getType().intValue() == QuestionTypeEnum.Lis.getKey()){//化验
+                orderRetrivevalDTO.setOrderNo(3);
+            }else {//辅检
+                orderRetrivevalDTO.setOrderNo(4);
+            }
+        }
+        //给结果排序:诊断 > 药品 > 化验 > 辅检
+        orderRetrivevalDTOS.sort((OrderRetrivevalDTO o1, OrderRetrivevalDTO o2) -> o1.getOrderNo().compareTo(o2.getOrderNo()));
+        retrievalDTOList.data = BeanUtil.listCopyTo(orderRetrivevalDTOS,RetrievalDTO.class);
         return retrievalDTOList.data;
     }
 }

+ 2 - 0
icss-service/src/main/java/com/diagbot/vo/GetStaticKnowledgeVO.java

@@ -17,4 +17,6 @@ public class GetStaticKnowledgeVO {
     private String InputStr;
     //需要去重的id
     private List<Long> inputIds;
+    //指定类型
+    private List<Integer> types;
 }

+ 20 - 0
icss-service/src/main/java/com/diagbot/vo/GetStaticVO.java

@@ -0,0 +1,20 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/6/27 13:35
+ */
+@Getter
+@Setter
+public class GetStaticVO {
+    //检索内容
+    private String InputStr;
+    //需要去重的id
+    private List<Long> inputIds;
+}

+ 3 - 3
icss-service/src/main/java/com/diagbot/web/RetrievalController.java

@@ -5,7 +5,7 @@ import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.facade.RetrievalFacade;
-import com.diagbot.vo.GetStaticKnowledgeVO;
+import com.diagbot.vo.GetStaticVO;
 import com.diagbot.vo.RetrievalVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -54,8 +54,8 @@ public class RetrievalController {
                     "inputIds:需要去重的id<br>")
     @PostMapping("/getStaticKnowledge")
     @SysLogger("getStaticKnowledge")
-    public RespDTO<List<RetrievalDTO>> getStaticKnowledge(@Valid @RequestBody GetStaticKnowledgeVO getStaticKnowledgeVO) {
-        List<RetrievalDTO> data = retrievalFacade.getStaticKnowledge(getStaticKnowledgeVO);
+    public RespDTO<List<RetrievalDTO>> getStaticKnowledge(@Valid @RequestBody GetStaticVO getStaticVO) {
+        List<RetrievalDTO> data = retrievalFacade.getStaticKnowledge(getStaticVO);
         return RespDTO.onSuc(data);
     }
 }

+ 25 - 0
icssman-service/src/main/java/com/diagbot/facade/QuestionFacade.java

@@ -466,6 +466,31 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
             paramMap.put("ids", Arrays.asList(ids.split(",")));
             paramMap.put("gmtModified", now);
             paramMap.put("modifier", person);
+
+            // 映射关系删除校验,如果有父项关联,不能删除
+            List<QuestionInfo> questionInfoList = getParentQuestion(Long.parseLong(id));
+            for (QuestionInfo questionInfo : questionInfoList) {
+                if (questionInfo.getTagType().equals(TagTypeEnum.T10.getKey())) {
+
+                }
+            }
+            if (ListUtil.isNotEmpty(questionInfoList)) {
+                StringBuffer sb = new StringBuffer();
+                sb.append("请先删除上级关联:");
+                for (QuestionInfo ques : questionInfoList) {
+                    if (ques.getTagType().equals(TagTypeEnum.T10.getKey())) {  // 既往史下特殊类型
+                        List<QuestionInfo> question2 = getParentQuestion(ques.getId());
+                        if (ListUtil.isNotEmpty(question2)) {
+                            sb.append("【" + question2.get(0).getTagName() + "】"); // 有且只有一个
+                        }
+                    } else {
+                        sb.append("【" + ques.getTagName() + "】");
+                    }
+                }
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                        sb.toString());
+            }
+
             //删除自身
             this.deleteByIds(paramMap);
             //删除明细