Explorar o código

河北演示项目历史病历、检查、问诊模板添加

wangsy hai 8 meses
pai
achega
53666114f0

+ 3 - 0
doc/022.20241031/cdss_init.sql

@@ -0,0 +1,3 @@
+use `cdss`;
+
+INSERT INTO `cdss`.`sys_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES (152, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 10, '症状', '12', 0, 12, '静态知识类型');

+ 10 - 0
doc/022.20241031/med2021_init.sql

@@ -0,0 +1,10 @@
+USE `med_2021`;
+
+INSERT INTO `med_2021`.`kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES (1389, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 10, '症状', '12', 2, 12, '静态知识类型');
+INSERT INTO `med_2021`.`kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES (1390, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 51, '12', '1', 1, 0, '诊断关联的静态信息类型');
+
+INSERT INTO `med_2021`.`kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES (76, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '历史病例', 412, 0, 0, 0, '');
+INSERT INTO `med_2021`.`kl_lexicon_relationship` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `remark`) VALUES (18, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '历史病例', 517, '');
+
+INSERT INTO `med_2021`.`kl_lexicon_relationship` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `remark`) VALUES (19, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '疾病相关鉴别检查项目', 518, '');
+INSERT INTO `med_2021`.`kl_lexicon_relationship` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `remark`) VALUES (22, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '疾病相关合并症检查项目', 519, '');

+ 1 - 0
doc/022.20241031/user_init.sql

@@ -0,0 +1 @@
+use `sys-user`;

+ 4 - 1
src/main/java/com/diagbot/dto/PushDTO.java

@@ -23,7 +23,8 @@ public class PushDTO {
     // 检验
     private List<PushBaseDTO> lis = Lists.newArrayList();
     // 检查
-    private List<PushBaseDTO> pacs = Lists.newArrayList();
+//    private List<PushBaseDTO> pacs = Lists.newArrayList();
+    private Map<String, List<PushBaseDTO>> pacs = new LinkedHashMap<>();
     // 手术
     private List<PushBaseDTO> operations = Lists.newArrayList();
     // 药品
@@ -42,6 +43,8 @@ public class PushDTO {
     private List<TreatDTO> treat = Lists.newArrayList();
     //经典病例
     private List<PushBaseDTO> classicCase = Lists.newArrayList();
+    //历史病例
+    private List<PushBaseDTO> historicalCases = Lists.newArrayList();
 
     // 记录调试信息
     private Map<String, Object> debug = new LinkedHashMap<>();

+ 5 - 3
src/main/java/com/diagbot/enums/PushRelationTypeEnum.java

@@ -13,14 +13,16 @@ public enum PushRelationTypeEnum {
     SYMPTOMSEC(502L, "疾病相关次症状"),
     VITAL(503L, "疾病相关体格检查结果"),
     LIS(504L, "疾病相关实验室检查套餐"),
-    PACS(505L, "疾病相关辅助检查项目"),
+    PACS(505L, "一般检查"),
     DRUG(506L, "疾病相关药物治疗"),
     OPERATION(507L, "疾病相关手术治疗"),
     DIFFDIAGNOSE(508L, "疾病相关鉴别诊断"),
     SCALE(509L, "疾病相关量表"),
     NURSE(510L, "疾病相关护理"),
-    CLASSICCASE(516L, "经典病例");
-
+    CLASSICCASE(516L, "经典病例"),
+    HISTORICALCASE(517L, "历史病例"),
+    IDENTIFICATIONCHECK(518L,"鉴别检查"),
+    COMORBIDITYCHECK(519L,"合并症检查");
     @Setter
     private long key;
 

+ 3 - 0
src/main/java/com/diagbot/facade/MedRetrievalFacade.java

@@ -352,6 +352,9 @@ public class MedRetrievalFacade {
             KlDisease klDisease = klDiseaseFacade.lambdaQuery()
                     .eq(KlDisease::getConceptId, klConcept.getId())
                     .one();
+            if (klDisease == null){
+                continue;
+            }
             dto.setId(klConcept.getId());
             dto.setName(klConcept.getLibName());
             dto.setCode(klDisease.getIcd10Code());

+ 110 - 9
src/main/java/com/diagbot/process/PushProcess.java

@@ -180,6 +180,43 @@ public class PushProcess {
             Map<Long, List<String>> items = klRelationFacade.getItemByDiseaseMap(diseaseItemVO);
             Map<Long, List<DiseaseItemDTO>> infos = klRelationFacade.getInfoByDiseaseMap(diseaseItemVO);
             if (MapUtils.isNotEmpty(items)) {
+                if (ruleTypeList.contains("6")) {
+                    Map<String, List<PushBaseDTO>> classificationPacs = new LinkedHashMap<>();
+                    // 将infos中键值为505的数据取出
+                    if(ListUtil.isNotEmpty(items.get(PushRelationTypeEnum.PACS.getKey()))){
+                        List<PushBaseDTO> pushBasePacs = new ArrayList<>();
+                        infos.get(PushRelationTypeEnum.PACS.getKey()).forEach(x -> {
+                            PushBaseDTO pushBaseDTO = new PushBaseDTO();
+                            pushBaseDTO.setName(x.getItemName());
+                            pushBasePacs.add(pushBaseDTO);
+                        });
+                        classificationPacs.put(PushRelationTypeEnum.PACS.getName(),pushBasePacs);
+                    }
+                    //518
+                    if(ListUtil.isNotEmpty(items.get(PushRelationTypeEnum.IDENTIFICATIONCHECK.getKey()))){
+                        List<PushBaseDTO> pushBasePacs = new ArrayList<>();
+                        infos.get(PushRelationTypeEnum.IDENTIFICATIONCHECK.getKey()).forEach(x -> {
+                            PushBaseDTO pushBaseDTO = new PushBaseDTO();
+                            pushBaseDTO.setName(x.getItemName());
+                            pushBasePacs.add(pushBaseDTO);
+                        });
+                        classificationPacs.put(PushRelationTypeEnum.IDENTIFICATIONCHECK.getName(),pushBasePacs);
+                    }
+                    //519
+                    if(ListUtil.isNotEmpty(items.get(PushRelationTypeEnum.COMORBIDITYCHECK.getKey()))){
+                        List<PushBaseDTO> pushBasePacs = new ArrayList<>();
+                        infos.get(PushRelationTypeEnum.COMORBIDITYCHECK.getKey()).forEach(x -> {
+                            PushBaseDTO pushBaseDTO = new PushBaseDTO();
+                            pushBaseDTO.setName(x.getItemName());
+                            pushBasePacs.add(pushBaseDTO);
+                        });
+                        classificationPacs.put(PushRelationTypeEnum.COMORBIDITYCHECK.getName(),pushBasePacs);
+                    }
+                    if (MapUtils.isNotEmpty(classificationPacs)) {
+                        pushDTO.getPacs().putAll(classificationPacs);
+                    }
+                }
+
                 if (ruleTypeList.contains("8") && ListUtil.isNotEmpty(items.get(PushRelationTypeEnum.DRUG.getKey()))) {
                     // 将infos中键值为506的数据取出,以drugC聚合,如果drugC为空,则给map中的key赋值为“其他”,“其他”放在最后
                     Map<String, List<PushBaseDTO>> unclassifiedDrugs = new LinkedHashMap<>();
@@ -228,6 +265,14 @@ public class PushProcess {
                         return pushBaseDTO;
                     }).collect(Collectors.toList()));
                 }
+                //历史病例
+                if (ruleTypeList.contains("15") && ListUtil.isNotEmpty(items.get(PushRelationTypeEnum.HISTORICALCASE.getKey()))) {
+                    pushDTO.setHistoricalCases(items.get(PushRelationTypeEnum.HISTORICALCASE.getKey()).stream().map(x -> {
+                        PushBaseDTO pushBaseDTO = new PushBaseDTO();
+                        pushBaseDTO.setName(x);
+                        return pushBaseDTO;
+                    }).collect(Collectors.toList()));
+                }
             }
         }
         //        if (reverseInfoByDisName != null) {
@@ -341,7 +386,7 @@ public class PushProcess {
         if (ListUtil.isNotEmpty(pushDTO.getSymptom())
                 || ListUtil.isNotEmpty(pushDTO.getVital())
                 || ListUtil.isNotEmpty(pushDTO.getLis())
-                || ListUtil.isNotEmpty(pushDTO.getPacs())
+                || MapUtils.isNotEmpty(pushDTO.getPacs())
                 || (pushDTO.getDis() != null && pushDTO.getDis().size() > 0)
                 || ListUtil.isNotEmpty(pushDTO.getComplications())) {
             return false;
@@ -685,7 +730,7 @@ public class PushProcess {
             if (map.get(LexiconEnum.PacsName.getKey()) != null) {
                 List<String> list = map.get(LexiconEnum.PacsName.getKey()).stream().map(r -> r.getSonName()).collect(Collectors.toList());
                 CoreUtil.removeRepeat(list, filterMap.get(StandConvertEnum.pacs.toString())); // 过滤界面已有
-                pushDTO.setPacs(generatePushBaseDTO(list, length)); // 放入对象返回
+                pushDTO.setPacs(generatePushBaseMapDTO(list, length)); // 放入对象返回
             }
         }
         // 鉴别诊断, 注意这个类型与其他类型不一样
@@ -755,6 +800,30 @@ public class PushProcess {
         return pushBaseDTOList;
     }
 
+    /**
+     * 将名称列表生成推送返回类型
+     *
+     * @param nameList
+     * @param length   最长个数, -1:无限制
+     * @return
+     */
+    public Map<String,List<PushBaseDTO>> generatePushBaseMapDTO(List<String> nameList, int length) {
+        Map<String,List<PushBaseDTO>> map = new HashMap<>();
+        List<PushBaseDTO> pushBaseDTOList = Lists.newArrayList();
+        if (ListUtil.isNotEmpty(nameList)) {
+            for (int i = 0; i < nameList.size(); i++) {
+                if (length != -1 && pushBaseDTOList.size() >= length) {
+                    break;
+                }
+                PushBaseDTO pushBaseDTO = new PushBaseDTO();
+                pushBaseDTO.setName(nameList.get(i));
+                pushBaseDTOList.add(pushBaseDTO);
+            }
+        }
+        map.put("疾病相关辅助检查项目",pushBaseDTOList);
+        return map;
+    }
+
     /**
      * 生成反推的入参
      *
@@ -863,16 +932,31 @@ public class PushProcess {
                 }
             }
         }
-        // 辅检
-        if (ruleTypeList.contains("6")) {
-            if (ListUtil.isNotEmpty(reversePush.getPacs())) {
-                List<String> pacses = reversePush.getPacs().stream().map(x -> x.getName()).collect(Collectors.toList());
-                if (pacses.size() > 0) {
-                    List<PushBaseDTO> filterpacs = getPackagePushBaseDTO(typeWords, pacses, StandConvertEnum.pacs);
-                    pushDTO.setPacs(filterpacs.subList(0, filterpacs.size() >= length ? length : filterpacs.size()));
+        if (ruleTypeList.contains("8")) {
+            if (reversePush.getTreat() != null && ListUtil.isNotEmpty(reversePush.getTreat().get(MedicalAdviceEnum.drug.getName()))) {
+                List<String> drugs = reversePush.getTreat().get(MedicalAdviceEnum.drug.getName()).stream().map(x -> x.getName()).collect(Collectors.toList());
+                /*reversePush.stream().filter(x ->x.getTreat() != null && ListUtil.isNotEmpty(x.getTreat().get(MedicalAdviceEnum.drug.getName())))
+                        .forEach(x -> {
+                            List<String> drugList = x.getTreat().get(MedicalAdviceEnum.drug.getName()).stream().map(y -> y.getName()).collect(Collectors.toList());
+                            drugs.removeAll(drugList);
+                            drugs.addAll(drugList);
+                        });*/
+                if (drugs.size() > 0) {
+                    List<PushBaseDTO> filterdrugs = getPackagePushBaseDTO(typeWords, drugs, StandConvertEnum.drug);
+                    pushDTO.setMedicines(filterdrugs.subList(0, filterdrugs.size() >= length ? length : filterdrugs.size()));
                 }
             }
         }
+        // 辅检
+//        if (ruleTypeList.contains("6")) {
+//            if (ListUtil.isNotEmpty(reversePush.getPacs())) {
+//                List<String> pacses = reversePush.getPacs().stream().map(x -> x.getName()).collect(Collectors.toList());
+//                if (pacses.size() > 0) {
+//                    Map<String,List<PushBaseDTO>> filterpacs = getPackagePushBaseMapDTO(typeWords, pacses, StandConvertEnum.pacs);
+//                    pushDTO.setPacs(filterpacs);
+//                }
+//            }
+//        }
         // 药品
         if (ruleTypeList.contains("8")) {
             if (reversePush.getTreat() != null && ListUtil.isNotEmpty(reversePush.getTreat().get(MedicalAdviceEnum.drug.getName()))) {
@@ -937,6 +1021,23 @@ public class PushProcess {
                 }).collect(Collectors.toList());
         return symptomPush;
     }
+
+    private Map<String,List<PushBaseDTO>> getPackagePushBaseMapDTO(Map<String, List<String>> typeWords, List<String> symptoms, StandConvertEnum symptom) {
+
+        Map<String,List<PushBaseDTO>> map = new HashMap<>();
+        List<PushBaseDTO> symptomPush = symptoms.stream()
+                .map(x -> {
+                    x = ListUtil.isNotEmpty(typeWords.get(symptom.toString())) ? !typeWords.get(symptom.toString()).contains(x) ? x : "" : x;
+                    return x;
+                }).filter(x -> StringUtils.isNotBlank(x)).map(x -> {
+                    PushBaseDTO pushBaseDTO = new PushBaseDTO();
+                    pushBaseDTO.setName(x);
+                    return pushBaseDTO;
+                }).collect(Collectors.toList());
+        map.put("疾病相关辅助检查项目",symptomPush);
+        return map;
+    }
+
     private List<PushBaseDTO> getPackagePushBaseDTO(List<String> symptoms) {
         List<PushBaseDTO> symptomPush = new ArrayList<>();
         if(ListUtil.isNotEmpty(symptoms)){

+ 1 - 1
src/main/resources/mapper/KlRelationMapper.xml

@@ -103,7 +103,7 @@
                     AND t1.id = t2.start_id
                     AND t3.id = t2.end_id
                     AND t2.id = t4.t_relation_id
-                    AND t2.relation_id IN (501,502,503,504,505,506,507,508,509,510,516)
+                    AND t2.relation_id IN (501,502,503,504,505,506,507,508,509,510,516,517,518,519)
                     AND t1.lib_name = #{diseaseName}
                     AND t1.`status` = 1
                     AND t3.`status` = 1