浏览代码

术语映射bug修正

zhaops 4 年之前
父节点
当前提交
cdc84ecbb9

+ 7 - 2
cdssman-service/src/main/java/com/diagbot/entity/DeptConfig.java

@@ -4,11 +4,16 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
+import org.bouncycastle.math.ec.custom.sec.SecT113Field;
 
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
 import java.util.Objects;
 import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
+import java.util.function.Predicate;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -201,13 +206,13 @@ public class DeptConfig implements Serializable {
                 && Objects.equals(isDeleted, deptConfig.isDeleted)
                 && Objects.equals(isDeleted, deptConfig.isDeleted)
                 && Objects.equals(hospitalId, deptConfig.hospitalId)
                 && Objects.equals(hospitalId, deptConfig.hospitalId)
                 && Objects.equals(hisName, deptConfig.hisName)
                 && Objects.equals(hisName, deptConfig.hisName)
-                && Objects.equals(hisCode, deptConfig.hisCode)
+                //&& Objects.equals(hisCode, deptConfig.hisCode)
                 && Objects.equals(uniqueName, deptConfig.uniqueName)
                 && Objects.equals(uniqueName, deptConfig.uniqueName)
                 && Objects.equals(uniqueCode, deptConfig.uniqueCode);
                 && Objects.equals(uniqueCode, deptConfig.uniqueCode);
     }
     }
 
 
     @Override
     @Override
     public int hashCode() {
     public int hashCode() {
-        return Objects.hash(id, isDeleted, hospitalId, hisName, hisCode, uniqueName, uniqueCode);
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
     }
     }
 }
 }

+ 35 - 10
cdssman-service/src/main/java/com/diagbot/facade/DeptConfigFacade.java

@@ -64,6 +64,13 @@ public class DeptConfigFacade {
                 .eq("hospital_id", deptConfig.getHospitalId())
                 .eq("hospital_id", deptConfig.getHospitalId())
                 .eq("his_name", deptConfig.getHisName())
                 .eq("his_name", deptConfig.getHisName())
                 .eq("unique_name", deptConfig.getUniqueName());
                 .eq("unique_name", deptConfig.getUniqueName());
+       /* if (StringUtil.isNotBlank(deptConfig.getHisCode())) {
+            queryWrapper.eq("his_code", deptConfig.getHisCode());
+        } else {
+            queryWrapper.and(i -> i.isNull("his_code")
+                    .or()
+                    .eq("his_code", ""));
+        }*/
         DeptConfig oldRecord = deptConfigService.getOne(queryWrapper, false);
         DeptConfig oldRecord = deptConfigService.getOne(queryWrapper, false);
         if (deptConfig.getId() == null
         if (deptConfig.getId() == null
                 && oldRecord != null) {
                 && oldRecord != null) {
@@ -93,6 +100,13 @@ public class DeptConfigFacade {
                 .eq("hospital_id", deptConfig.getHospitalId())
                 .eq("hospital_id", deptConfig.getHospitalId())
                 .eq("his_name", deptConfig.getHisName())
                 .eq("his_name", deptConfig.getHisName())
                 .eq("unique_name", deptConfig.getUniqueName());
                 .eq("unique_name", deptConfig.getUniqueName());
+        /*if (StringUtil.isNotBlank(deptConfig.getHisCode())) {
+            queryWrapper.eq("his_code", deptConfig.getHisCode());
+        } else {
+            queryWrapper.and(i -> i.isNull("his_code")
+                    .or()
+                    .eq("his_code", ""));
+        }*/
         DeptConfig oldRecord = deptConfigService.getOne(queryWrapper, false);
         DeptConfig oldRecord = deptConfigService.getOne(queryWrapper, false);
         if (deptConfig.getId() == null
         if (deptConfig.getId() == null
                 && oldRecord != null) {
                 && oldRecord != null) {
@@ -158,14 +172,14 @@ public class DeptConfigFacade {
         // 验证数据是否已存在,已存在的先删除
         // 验证数据是否已存在,已存在的先删除
         // 没id的删除重新插入,有id的更新
         // 没id的删除重新插入,有id的更新
         List<Long> deleteIds = Lists.newLinkedList();
         List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, Long>> configMap
+        Map<String, Map<String, List<Long>>> configMap
                 = getConfigMap(hospitalId, null, null);
                 = getConfigMap(hospitalId, null, null);
         deptConfigList.forEach(deptConfig -> {
         deptConfigList.forEach(deptConfig -> {
             deptConfig.setModifier(userId);
             deptConfig.setModifier(userId);
             deptConfig.setGmtModified(now);
             deptConfig.setGmtModified(now);
             if (deptConfig.getId() == null) {
             if (deptConfig.getId() == null) {
                 if (configMap.containsKey(deptConfig.getHisName())) {
                 if (configMap.containsKey(deptConfig.getHisName())) {
-                    deleteIds.add(configMap.get(deptConfig.getHisName()).get(deptConfig.getUniqueName()));
+                    deleteIds.addAll(configMap.get(deptConfig.getHisName()).get(deptConfig.getUniqueName()));
                 }
                 }
                 deptConfig.setCreator(userId);
                 deptConfig.setCreator(userId);
                 deptConfig.setGmtCreate(now);
                 deptConfig.setGmtCreate(now);
@@ -296,7 +310,7 @@ public class DeptConfigFacade {
         // 验证数据是否已存在,已存在的先删除
         // 验证数据是否已存在,已存在的先删除
         // 没id的删除重新插入,有id的更新
         // 没id的删除重新插入,有id的更新
         List<Long> deleteIds = Lists.newLinkedList();
         List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, Long>> configMap
+        Map<String, Map<String, List<Long>>> configMap
                 = getConfigMap(Long.valueOf(hospitalId), null, null);
                 = getConfigMap(Long.valueOf(hospitalId), null, null);
         deptConfigList.forEach(deptConfig -> {
         deptConfigList.forEach(deptConfig -> {
             deptConfig.setHospitalId(hospitalId);
             deptConfig.setHospitalId(hospitalId);
@@ -304,7 +318,7 @@ public class DeptConfigFacade {
             deptConfig.setGmtModified(now);
             deptConfig.setGmtModified(now);
             if (deptConfig.getId() == null) {
             if (deptConfig.getId() == null) {
                 if (configMap.containsKey(deptConfig.getHisName())) {
                 if (configMap.containsKey(deptConfig.getHisName())) {
-                    deleteIds.add(configMap.get(deptConfig.getHisName()).get(deptConfig.getUniqueName()));
+                    deleteIds.addAll(configMap.get(deptConfig.getHisName()).get(deptConfig.getUniqueName()));
                 }
                 }
                 deptConfig.setCreator(userId);
                 deptConfig.setCreator(userId);
                 deptConfig.setGmtCreate(now);
                 deptConfig.setGmtCreate(now);
@@ -352,7 +366,6 @@ public class DeptConfigFacade {
         return true;
         return true;
     }
     }
 
 
-
     /**
     /**
      * 获取映射关系-公表名
      * 获取映射关系-公表名
      *
      *
@@ -361,8 +374,8 @@ public class DeptConfigFacade {
      * @param uniqueNames
      * @param uniqueNames
      * @return
      * @return
      */
      */
-    public Map<String, Map<String, Long>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, Long>> retMap = new HashMap<>();
+    public Map<String, Map<String, List<Long>>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+        Map<String, Map<String, List<Long>>> retMap = new HashMap<>();
         QueryWrapper<DeptConfig> queryWrapper = new QueryWrapper<>();
         QueryWrapper<DeptConfig> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("hospital_id", hospitalId);
                 .eq("hospital_id", hospitalId);
@@ -379,7 +392,12 @@ public class DeptConfigFacade {
         Map<String, List<DeptConfig>> configMap = EntityUtil.makeEntityListMap(records, "hisName");
         Map<String, List<DeptConfig>> configMap = EntityUtil.makeEntityListMap(records, "hisName");
         for (Map.Entry<String, List<DeptConfig>> entry : configMap.entrySet()) {
         for (Map.Entry<String, List<DeptConfig>> entry : configMap.entrySet()) {
             if (ListUtil.isNotEmpty(entry.getValue())) {
             if (ListUtil.isNotEmpty(entry.getValue())) {
-                retMap.put(entry.getKey(), EntityUtil.makeMapWithKeyValue(entry.getValue(), "uniqueName", "id"));
+                Map<String, List<DeptConfig>> subMap = EntityUtil.makeEntityListMap(entry.getValue(), "uniqueName");
+                Map<String, List<Long>> subIdMap = new HashMap<>();
+                for (Map.Entry<String, List<DeptConfig>> subEntry : subMap.entrySet()) {
+                    subIdMap.put(subEntry.getKey(), subEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
+                }
+                retMap.put(entry.getKey(), subIdMap);
             }
             }
         }
         }
         return retMap;
         return retMap;
@@ -423,10 +441,11 @@ public class DeptConfigFacade {
 
 
     /**
     /**
      * 导入数据预匹配
      * 导入数据预匹配
+     *
      * @param file
      * @param file
      * @param response
      * @param response
      */
      */
-    public void precDataMatch(MultipartFile file,HttpServletResponse response) {
+    public void precDataMatch(MultipartFile file, HttpServletResponse response) {
         List<DeptConfig> retList = Lists.newLinkedList();
         List<DeptConfig> retList = Lists.newLinkedList();
         List<DeptConfig> originList = ExcelUtils.importExcel(file, 0, 1, DeptConfig.class);
         List<DeptConfig> originList = ExcelUtils.importExcel(file, 0, 1, DeptConfig.class);
         Map<String, List<DeptConfig>> allMap = getAll();
         Map<String, List<DeptConfig>> allMap = getAll();
@@ -459,6 +478,7 @@ public class DeptConfigFacade {
                     boolean flag = false;
                     boolean flag = false;
                     for (DeptConfig item : items) {
                     for (DeptConfig item : items) {
                         if (uniqueNames.contains(item.getUniqueName())) {
                         if (uniqueNames.contains(item.getUniqueName())) {
+                            item.setHisCode(originItem.getHisCode());
                             retList.add(item);
                             retList.add(item);
                             flag = true;
                             flag = true;
                         }
                         }
@@ -472,15 +492,20 @@ public class DeptConfigFacade {
             }
             }
         }
         }
 
 
+        retList = retList.stream()
+                .distinct()
+                .collect(Collectors.toList());
+
         String fileName = "科室关联数据(预匹配).xls";
         String fileName = "科室关联数据(预匹配).xls";
         ExcelUtils.exportExcel(retList, null, "sheet1", DeptConfig.class, fileName, response, 12.8f);
         ExcelUtils.exportExcel(retList, null, "sheet1", DeptConfig.class, fileName, response, 12.8f);
     }
     }
 
 
     /**
     /**
      * 获取所有医院映射数据
      * 获取所有医院映射数据
+     *
      * @return
      * @return
      */
      */
-    public Map<String,List<DeptConfig>> getAll() {
+    public Map<String, List<DeptConfig>> getAll() {
         Map<String, List<DeptConfig>> retMap = new HashMap<>();
         Map<String, List<DeptConfig>> retMap = new HashMap<>();
         List<DeptConfig> records = deptConfigService.list();
         List<DeptConfig> records = deptConfigService.list();
         if (ListUtil.isEmpty(records)) {
         if (ListUtil.isEmpty(records)) {

+ 4 - 0
cdssman-service/src/main/java/com/diagbot/facade/DiseaseConfigFacade.java

@@ -459,6 +459,10 @@ public class DiseaseConfigFacade {
             }
             }
         }
         }
 
 
+        retList = retList.stream()
+                .distinct()
+                .collect(Collectors.toList());
+
         String fileName = "诊断关联数据(预匹配).xls";
         String fileName = "诊断关联数据(预匹配).xls";
         ExcelUtils.exportExcel(retList, null, "sheet1", DiseaseConfig.class, fileName, response, 12.8f);
         ExcelUtils.exportExcel(retList, null, "sheet1", DiseaseConfig.class, fileName, response, 12.8f);
     }
     }

+ 18 - 0
cdssman-service/src/main/java/com/diagbot/facade/DrugConfigFacade.java

@@ -646,6 +646,14 @@ public class DrugConfigFacade {
         List<DrugConfig> originList = ExcelUtils.importExcel(file, 1, 1, DrugConfig.class);
         List<DrugConfig> originList = ExcelUtils.importExcel(file, 1, 1, DrugConfig.class);
         Map<String, List<DrugConfig>> allMap = getAll();
         Map<String, List<DrugConfig>> allMap = getAll();
 
 
+        //药品剂型
+        List<DictionaryInfoDTO> dicTypeMappingList = dictionaryFacade.getListByGroupType(9);
+        List<String> formList = dicTypeMappingList.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getName()))
+                .map(i -> i.getName())
+                .distinct()
+                .collect(Collectors.toList());
+
         //去除空格
         //去除空格
         originList.forEach(item -> {
         originList.forEach(item -> {
             item.setHisName(item.getHisName().trim());
             item.setHisName(item.getHisName().trim());
@@ -674,11 +682,17 @@ public class DrugConfigFacade {
                     boolean flag = false;
                     boolean flag = false;
                     for (DrugConfig item : items) {
                     for (DrugConfig item : items) {
                         if (uniqueNames.contains(item.getUniqueName())) {
                         if (uniqueNames.contains(item.getUniqueName())) {
+                            if (!formList.contains(item.getForm())) {
+                                item.setForm("");
+                            }
                             retList.add(item);
                             retList.add(item);
                             flag = true;
                             flag = true;
                         }
                         }
                     }
                     }
                     if (!flag) {
                     if (!flag) {
+                        if (!formList.contains(originItem.getForm())) {
+                            originItem.setForm("");
+                        }
                         retList.add(originItem);
                         retList.add(originItem);
                     }
                     }
                 } else {
                 } else {
@@ -687,6 +701,10 @@ public class DrugConfigFacade {
             }
             }
         }
         }
 
 
+        retList = retList.stream()
+                .distinct()
+                .collect(Collectors.toList());
+
         String fileName = "药品关联数据(预匹配).xls";
         String fileName = "药品关联数据(预匹配).xls";
         ExcelUtils.exportExcel(retList, getFrom(), "sheet1", DrugConfig.class, fileName, response, 12.8f);
         ExcelUtils.exportExcel(retList, getFrom(), "sheet1", DrugConfig.class, fileName, response, 12.8f);
     }
     }

+ 5 - 0
cdssman-service/src/main/java/com/diagbot/facade/LisConfigFacade.java

@@ -549,6 +549,11 @@ public class LisConfigFacade{
                 }
                 }
             }
             }
         }
         }
+
+        retList = retList.stream()
+                .distinct()
+                .collect(Collectors.toList());
+
         String fileName = "检验关联数据(预匹配).xls";
         String fileName = "检验关联数据(预匹配).xls";
         ExcelUtils.exportExcel(retList, null, "sheet1", LisConfig.class, fileName, response, 12.8f);
         ExcelUtils.exportExcel(retList, null, "sheet1", LisConfig.class, fileName, response, 12.8f);
     }
     }

+ 3 - 0
cdssman-service/src/main/java/com/diagbot/facade/OperationConfigFacade.java

@@ -468,6 +468,9 @@ public class OperationConfigFacade {
             }
             }
         }
         }
 
 
+        retList = retList.stream()
+                .distinct()
+                .collect(Collectors.toList());
 
 
         String fileName = "手术和操作关联数据(预匹配).xls";
         String fileName = "手术和操作关联数据(预匹配).xls";
         ExcelUtils.exportExcel(retList, null, "sheet1", OperationConfig.class, fileName, response, 12.8f);
         ExcelUtils.exportExcel(retList, null, "sheet1", OperationConfig.class, fileName, response, 12.8f);

+ 4 - 0
cdssman-service/src/main/java/com/diagbot/facade/PacsConfigFacade.java

@@ -466,6 +466,10 @@ public class PacsConfigFacade {
             }
             }
         }
         }
 
 
+        retList = retList.stream()
+                .distinct()
+                .collect(Collectors.toList());
+
         String fileName = "检查关联数据(预匹配).xls";
         String fileName = "检查关联数据(预匹配).xls";
         ExcelUtils.exportExcel(retList, null, "sheet1", PacsConfig.class, fileName, response, 12.8f);
         ExcelUtils.exportExcel(retList, null, "sheet1", PacsConfig.class, fileName, response, 12.8f);
     }
     }

+ 4 - 0
cdssman-service/src/main/java/com/diagbot/facade/TransfusionConfigFacade.java

@@ -457,6 +457,10 @@ public class TransfusionConfigFacade {
             }
             }
         }
         }
 
 
+        retList = retList.stream()
+                .distinct()
+                .collect(Collectors.toList());
+
         String fileName = "输血关联数据(预匹配).xls";
         String fileName = "输血关联数据(预匹配).xls";
         ExcelUtils.exportExcel(retList, null, "sheet1", TransfusionConfig.class, fileName, response, 12.8f);
         ExcelUtils.exportExcel(retList, null, "sheet1", TransfusionConfig.class, fileName, response, 12.8f);
     }
     }