Explorar o código

其他值提醒检验

gaodm %!s(int64=4) %!d(string=hai) anos
pai
achega
7f2137ee3e

+ 54 - 14
src/main/java/com/diagbot/facade/ExportFacade.java

@@ -144,6 +144,7 @@ public class ExportFacade {
         List<ExportNode> nodes = new ArrayList<>();
         nodes.clear();
         nodes = exportNodeRepository.getDisease();
+        nodes.addAll(exportNodeRepository.getDisease2());
         import2MySql(nodes, 100);
         //药品通用名
         nodes.clear();
@@ -230,6 +231,7 @@ public class ExportFacade {
     private void import2MySql(List<ExportNode> nodes, Integer type) {
         List<KlLibraryInfo> libraryInfos = new ArrayList<>();
         List<String> names = new ArrayList<>();
+        List<ExportNode> importNodes = new ArrayList<>();
         klLibraryInfoService.remove(new QueryWrapper<KlLibraryInfo>().eq("type_id", type));
         klConceptService.remove(new QueryWrapper<KlConcept>().eq("lib_type", type));
         for (ExportNode exportNode : nodes) {
@@ -242,6 +244,7 @@ public class ExportFacade {
                 klLibraryInfo.setSpell(Cn2SpellUtil.converterToFirstSpell(exportNode.getName()));
                 libraryInfos.add(klLibraryInfo);
                 names.add(exportNode.getName());
+                importNodes.add(exportNode);
             }
 
         }
@@ -263,7 +266,7 @@ public class ExportFacade {
         if (type.equals(100)) {
             klConceptCommonService.remove(new QueryWrapper<KlConceptCommon>().eq("is_deleted", IsDeleteEnum.N.getKey()));
             klDiseaseService.remove(new QueryWrapper<KlDisease>().eq("is_deleted", IsDeleteEnum.N.getKey()));
-            Map<String, ExportNode> nodeMap = EntityUtil.makeEntityMap(nodes, "name");
+            Map<String, ExportNode> nodeMap = EntityUtil.makeEntityMap(importNodes, "name");
             List<KlConceptCommon> klConceptCommons = new ArrayList<>();
             List<KlDisease> klDiseases = new ArrayList<>();
             for (KlConcept klConcept : klConcepts) {
@@ -276,14 +279,12 @@ public class ExportFacade {
                     klConceptCommon.setSexType(Integer.valueOf(exportNode.getSex()));
                     String[] age = exportNode.getAgeRange().split("-");
                     klConceptCommon.setMinAge(Double.valueOf(age[0]));
-                    if (age.length == 1) {
-                        klConceptCommon.setMaxAge(200.0d);
-                    } else {
-                        klConceptCommon.setMaxAge(Double.valueOf(age[1]));
-                    }
-                    klDisease.setIcd10Code(exportNode.getIcd10Code());
+                    klConceptCommon.setMaxAge(Double.valueOf(age[1]));
                     klConceptCommons.add(klConceptCommon);
-                    klDiseases.add(klDisease);
+                    if (StringUtil.isNotBlank(exportNode.getIcd10Code())) {
+                        klDisease.setIcd10Code(exportNode.getIcd10Code());
+                        klDiseases.add(klDisease);
+                    }
                 }
             }
             klConceptCommonService.saveBatch(klConceptCommons);
@@ -481,9 +482,9 @@ public class ExportFacade {
         //危急值辅检
         //pacsCriticalValues(mapPath, map);
         //其他值提醒_化验
-        //lisOtherValues(mapPath, map);
+        lisOtherValues(mapPath, map);
         //其他值提醒_辅检
-        pacsOtherValues(mapPath, map);
+        //pacsOtherValues(mapPath, map);
         //其他值提醒_输血
         //transfusionOtherValues(mapPath, map);
         return null;
@@ -812,15 +813,54 @@ public class ExportFacade {
         for (ImportDataVO importDataVO : data) {
             if (null != map.get(importDataVO.getLisGBName() + "_108")) {
                 KlRule klRule = new KlRule();
-                klRule.setConceptId(map.get(importDataVO.getLisGBName() + "_112").getId());
+                klRule.setConceptId(map.get(importDataVO.getLisGBName() + "_108").getId());
                 klRule.setDescription("其他值提醒_化验_" + importDataVO.getLisGBName().trim());
                 klRule.setRuleType(4);
                 klRule.setHasSubCond(1);
                 klRuleService.save(klRule);
-                if (StringUtil.isNotBlank(importDataVO.getLisGBName())){
+                if (StringUtil.isNotBlank(importDataVO.getLisGBName())
+                        && StringUtil.isNotBlank(importDataVO.getSymbol())) {
                     KlRuleBase klRuleBase = new KlRuleBase();
-                    klRuleBase.setConceptId(map.get(importDataVO.getLisGBName() + "_112").getId());
-                    klRuleBase.setDescription(importDataVO.getOtherLisTipName());
+                    klRuleBase.setConceptId(map.get(importDataVO.getLisGBName() + "_108").getId());
+                    if (operator_lt.contains(importDataVO.getSymbol())) {
+                        klRuleBase.setType(2);
+                        klRuleBase.setMinOperator("<");
+                        klRuleBase.setMinValue(importDataVO.getValue().toString());
+                        if (StringUtil.isNotBlank(importDataVO.getUnit())) {
+                            klRuleBase.setMinUnit(importDataVO.getUnit().trim());
+                        }
+                    }
+                    if (operator_gt.contains(importDataVO.getSymbol())) {
+                        klRuleBase.setType(2);
+                        klRuleBase.setMaxOperator(">");
+                        klRuleBase.setMaxValue(importDataVO.getValue().toString());
+                        if (StringUtil.isNotBlank(importDataVO.getUnit())) {
+                            klRuleBase.setMaxUnit(importDataVO.getUnit().trim());
+                        }
+                    }
+                    klRuleBase.setDescription(importDataVO.getLisGBName() + importDataVO.getSymbol()
+                            + importDataVO.getValue() + importDataVO.getUnit());
+                    klRuleBaseService.save(klRuleBase);
+                    KlRuleCondition klRuleCondition = new KlRuleCondition();
+                    klRuleCondition.setGroupType(1);
+                    klRuleCondition.setRuleId(klRule.getId());
+                    klRuleCondition.setRuleBaseId(klRuleBase.getId());
+                    klRuleConditionService.save(klRuleCondition);
+                }
+                if (StringUtil.isNotBlank(importDataVO.getOtherTipNodeType())
+                        && StringUtil.isNotBlank(importDataVO.getOtherTipNodeName())) {
+                    KlRuleBase klRuleBase = new KlRuleBase();
+                    klRuleBase.setType(1);
+                    if (importDataVO.getOtherTipNodeType().equals("药品通用名称")) {
+                        klRuleBase.setConceptId(map.get(importDataVO.getOtherTipNodeName() + "_101").getId());
+                    } else if (importDataVO.getOtherTipNodeType().equals("医保疾病名称")) {
+                        klRuleBase.setConceptId(map.get(importDataVO.getOtherTipNodeName() + "_100").getId());
+                    } else if (importDataVO.getOtherTipNodeType().equals("禁忌人群")) {
+                        klRuleBase.setConceptId(map.get(importDataVO.getOtherTipNodeName() + "_117").getId());
+                    } else {
+
+                    }
+                    klRuleBase.setDescription(importDataVO.getOtherTipNodeType() + "_" + importDataVO.getOtherTipNodeName());
                     klRuleBaseService.save(klRuleBase);
                     KlRuleCondition klRuleCondition = new KlRuleCondition();
                     klRuleCondition.setGroupType(1);

+ 2 - 0
src/main/java/com/diagbot/repository/ExportNodeRepository.java

@@ -12,6 +12,8 @@ public interface ExportNodeRepository extends Neo4jRepository<ExportNodeInfo, Lo
 
     @Query("MATCH (n:`医保疾病名称`)-[]->(m:`医保ICD_10代码`)RETURN distinct trim(n.name) as name ,case when n.sex is not null then n.sex else '3' end as sex,case when n.age is not null then n.age else '0-200' end as ageRange,trim(m.name) as icd10Code")
     List<ExportNode> getDisease();
+    @Query("MATCH (n:`医保疾病名称`) RETURN distinct trim(n.name) as name ,case when n.sex is not null then n.sex else '3' end as sex,case when n.age is not null then n.age else '0-200' end as ageRange,\"\" as icd10Code")
+    List<ExportNode> getDisease2();
 
     @Query("MATCH (n:`药品通用名称`) RETURN distinct(trim(n.name)) as name")
     List<ExportNode> getDrug();