Selaa lähdekoodia

危急值导入

gaodm 4 vuotta sitten
vanhempi
commit
48520da73d

+ 64 - 5
src/main/java/com/diagbot/facade/ExportFacade.java

@@ -228,6 +228,8 @@ public class ExportFacade {
     private void import2MySql(List<ExportNode> nodes, Integer type) {
         List<KlLibraryInfo> libraryInfos = new ArrayList<>();
         List<String> names = new ArrayList<>();
+        klLibraryInfoService.remove(new QueryWrapper<KlLibraryInfo>().eq("type_id", type));
+        klConceptService.remove(new QueryWrapper<KlConcept>().eq("lib_type", type));
         for (ExportNode exportNode : nodes) {
             if (StringUtil.isNotBlank(exportNode.getName())
                     && !names.contains(exportNode.getName())) {
@@ -257,6 +259,8 @@ public class ExportFacade {
         }
         klLibraryInfoService.updateBatchById(libraryInfos);
         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");
             List<KlConceptCommon> klConceptCommons = new ArrayList<>();
             List<KlDisease> klDiseases = new ArrayList<>();
@@ -420,13 +424,69 @@ public class ExportFacade {
         //高危药品
         //drugHighRisk(mapPath, map);
         //高危手术
-        optHighRisk(mapPath, map);
+        //optHighRisk(mapPath, map);
+        //危急值化验
+        //lisCriticalValues(mapPath, map);
+        //危急值辅检
+        pacsCriticalValues(mapPath, map);
         return null;
     }
 
-    private void optHighRisk(Map<String, String> mapPath, Map<String, KlConcept> map) {
+    private void lisCriticalValues(Map<String, String> mapPath, Map<String, KlConcept> map) {
+        MultipartFile file = null;
+        file = testFacade.getMulFileByPath(mapPath.get("【危急值_化验】"));
+        List<ImportDataVO> data = ExcelUtils.importExcel(file, 0, 1, ImportDataVO.class);
+        List<String> lis = new ArrayList<>();
+        for (ImportDataVO importDataVO : data) {
+            if (StringUtil.isNotBlank(importDataVO.getLisGBName())) {
+                String lisStr = importDataVO.getLisGBName().trim();
+                if (StringUtil.isNotBlank(importDataVO.getCriticalAge())) {
+                    lisStr = lisStr + "_" + importDataVO.getCriticalAge().trim();
+                }
+                if (!lis.contains(lisStr)
+                        && (null != map.get(importDataVO.getLisGBName().trim() + "_108"))) {
+                    lis.add(lisStr);
+                    KlRule klRule = new KlRule();
+                    klRule.setConceptId(map.get(importDataVO.getLisGBName().trim() + "_108").getId());
+                    klRule.setDescription("危急值_化验_" + lisStr);
+                    klRule.setRuleType(3);
+                    klRule.setHasSubCond(0);
+                    klRuleService.save(klRule);
+                    KlRuleBase klRuleBase = new KlRuleBase();
+                    klRuleBase.setType(1);
+                    klRuleBaseService.save(klRuleBase);
+                    KlRuleCondition klRuleCondition = new KlRuleCondition();
+                    klRuleCondition.setGroupType(1);
+                    klRuleCondition.setRuleId(klRule.getId());
+                    klRuleCondition.setRuleBaseId(klRuleBase.getId());
+                    klRuleConditionService.save(klRuleCondition);
+                }
+            }
+        }
+        log.info("危急值_化验" + lis.size());
+    }
+
+    private void pacsCriticalValues(Map<String, String> mapPath, Map<String, KlConcept> map) {
         MultipartFile file = null;
+        file = testFacade.getMulFileByPath(mapPath.get("【危急值_辅检】"));
+        List<ImportDataVO> data = ExcelUtils.importExcel(file, 0, 1, ImportDataVO.class);
+        Integer cnt = 0;
+        for (ImportDataVO importDataVO : data) {
+            if (null != map.get(importDataVO.getRuleText().trim() + "_112")) {
+                KlRule klRule = new KlRule();
+                klRule.setConceptId(map.get(importDataVO.getRuleText().trim() + "_112").getId());
+                klRule.setDescription("危急值_辅检_" + importDataVO.getRuleText().trim());
+                klRule.setRuleType(3);
+                klRule.setHasSubCond(0);
+                klRuleService.save(klRule);
+                cnt++;
+            }
+        }
+        log.info("危急值_辅检" + cnt);
+    }
 
+    private void optHighRisk(Map<String, String> mapPath, Map<String, KlConcept> map) {
+        MultipartFile file = null;
         file = testFacade.getMulFileByPath(mapPath.get("【高危手术整合】"));
         List<ImportDataVO> data = ExcelUtils.importExcel(file, 0, 1, ImportDataVO.class);
         List<String> opt = new ArrayList<>();
@@ -438,7 +498,7 @@ public class ExportFacade {
                     opt.add(importDataVO.getOperationName().trim());
                     KlRule klRule = new KlRule();
                     klRule.setConceptId(map.get(importDataVO.getOperationName().trim() + "_106").getId());
-                    klRule.setDescription("高危手术" + importDataVO.getOperationName().trim() + importDataVO.getOperationLevel().trim());
+                    klRule.setDescription("高危手术_" + importDataVO.getOperationName().trim() + importDataVO.getOperationLevel().trim());
                     klRule.setRuleType(2);
                     if (importDataVO.getOperationLevel().trim().equals("2")) {
                         klRule.setHasSubCond(1);
@@ -475,7 +535,6 @@ public class ExportFacade {
 
     private void drugHighRisk(Map<String, String> mapPath, Map<String, KlConcept> map) {
         MultipartFile file = null;
-
         file = testFacade.getMulFileByPath(mapPath.get("【高危药品】"));
         List<ImportDataVO> data = ExcelUtils.importExcel(file, 0, 1, ImportDataVO.class);
         List<String> drugs = new ArrayList<>();
@@ -488,7 +547,7 @@ public class ExportFacade {
                     drugs.add(importDataVO.getDrugHighRisk().trim());
                     KlRule klRule = new KlRule();
                     klRule.setConceptId(map.get(importDataVO.getDrugHighRisk().trim() + "_101").getId());
-                    klRule.setDescription("高危药品" + importDataVO.getDrugHighRisk().trim());
+                    klRule.setDescription("高危药品_" + importDataVO.getDrugHighRisk().trim());
                     klRule.setRuleType(2);
                     klRule.setMsg(importDataVO.getDrugLevel().trim());
                     klRule.setHasSubCond(1);

+ 4 - 0
src/main/java/com/diagbot/vo/ImportDataVO.java

@@ -36,6 +36,8 @@ public class ImportDataVO {
     private Double criticalMax;
     @Excel(name="参考对象")
     private String criticalAge;
+    @Excel(name="阴性阳性")
+    private String criticalNegative;
     @Excel(name="手术级别")
     private String operationLevel;
     @Excel(name="药品高危级别")
@@ -72,6 +74,8 @@ public class ImportDataVO {
     private String pacsDescHas;
     @Excel(name="性别")
     private String sexStr;
+    @Excel(name="单位")
+    private String unit;
 
     @Excel(name="生命体征及查体")
     private String physique;