Browse Source

诊断合理性校验-性别

yuchengwei 3 months ago
parent
commit
fa388d0a41

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

@@ -49,6 +49,9 @@ public class OtherTipFacade {
         // 特殊规则——传染病发病周期提示
         otherTipProcess.processInfectiousDisease(wordCrfDTO, res);
 
+        // 特殊规则——检验性别不符提示
+        otherTipProcess.processDiagnosticCheckGender(wordCrfDTO, res);
+
         // 结果去重处理
         commonFacade.dealMsg(res.getOtherList());
     }

+ 53 - 0
src/main/java/com/diagbot/process/OtherTipProcess.java

@@ -5,6 +5,7 @@ import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.biz.push.entity.Scale;
 import com.diagbot.dto.*;
+import com.diagbot.entity.KlConceptCommon;
 import com.diagbot.entity.KlDiagHospital;
 import com.diagbot.entity.KlDisease;
 import com.diagbot.entity.KlDrug;
@@ -70,6 +71,9 @@ public class OtherTipProcess {
     @Autowired
     private KlDiseaseFacade klDiseaseFacade;
 
+    @Autowired
+    private KlConceptCommonFacade klConceptCommonFacade;
+
     private static final List<String> professionalTitles = Arrays.asList("医师","主治医师","副主任医师","主任医师");
 
 
@@ -449,6 +453,55 @@ public class OtherTipProcess {
 
     }
 
+    /**
+     * 处理业务——诊断性别合理性校验
+     *
+     * @param wordCrfDTO
+     * @param res
+     */
+    public void processDiagnosticCheckGender(WordCrfDTO wordCrfDTO, IndicationDTO res) {
+        List<BillMsg> otherList = res.getOtherList();
+        // 诊断
+        List<Item> diagItems = wordCrfDTO.getDiag();
+        if (ListUtil.isEmpty(diagItems)) {
+            return;
+        }
+
+        Map<String, String> diagNameMap = diagItems.stream().collect(Collectors.toMap(Item::getUniqueName, Item::getName));
+
+        List<String> uniqueNames = diagItems.stream().map(Item::getUniqueName).collect(Collectors.toList());
+
+        SearchCollectionConceptVO searchCollectionConceptVO = new SearchCollectionConceptVO();
+        searchCollectionConceptVO.setNames(uniqueNames);
+        List<GetAllForRelationDTO> getAllForRelationDTOS = klConceptFacade.searchCollectionConceptFacNew(searchCollectionConceptVO);
+
+        if (ListUtil.isEmpty(getAllForRelationDTOS)) {
+            return;
+        }
+
+        Map<Long,String> diagConceptIdNameMap = getAllForRelationDTOS.stream()
+                .collect(Collectors.toMap(GetAllForRelationDTO::getConceptId ,GetAllForRelationDTO::getConceptName));
+
+        List<Long> conceptIds = getAllForRelationDTOS.stream().map(GetAllForRelationDTO::getConceptId).collect(Collectors.toList());
+
+
+        List<KlConceptCommon> conceptCommons = klConceptCommonFacade.getKlConceptCommonByConceptIdsNew(conceptIds);
+
+        if (ListUtil.isEmpty(conceptCommons)) {
+            return;
+        }
+
+        for (KlConceptCommon klConceptCommon : conceptCommons) {
+            if (klConceptCommon.getSexType() != 3 && !Objects.equals(klConceptCommon.getSexType(), wordCrfDTO.getSex())) {
+                String diagName = diagNameMap.get(diagConceptIdNameMap.get(klConceptCommon.getConceptId()));
+                String msg = diagName + "是" + (klConceptCommon.getSexType() == 1 ? "男" : "女") + "性诊断,与当前性别不符";
+                BillMsg billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.other.getName(), msg, null, null, null);
+                CoreUtil.addBeanToList(otherList, billMsg);
+            }
+        }
+
+    }
+
     private static void specialDrugTip(Map<Integer, List<KlDrug>> drugGradeListMap, Map<Long, String> drugConceptIdNameMap, Map<String, String> drugNameMap, List<BillMsg> otherList) {
         List<Long> specialConceptIds = drugGradeListMap.get(2).stream().map(KlDrug::getConceptId).collect(Collectors.toList());
         List<String> specialUniqueNames = specialConceptIds.stream().map(drugConceptIdNameMap::get).collect(Collectors.toList());

+ 5 - 0
src/main/java/com/diagbot/service/KlConceptCommonService.java

@@ -2,6 +2,9 @@ package com.diagbot.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.entity.KlConceptCommon;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +16,6 @@ import com.diagbot.entity.KlConceptCommon;
  */
 public interface KlConceptCommonService extends IService<KlConceptCommon> {
 
+    List<KlConceptCommon> getKlConceptCommonByConceptIdsNew(@Param("conceptIds") List<Long> collect);
+
 }

+ 8 - 1
src/main/java/com/diagbot/service/impl/KlConceptCommonServiceImpl.java

@@ -1,11 +1,13 @@
 package com.diagbot.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.entity.KlConceptCommon;
 import com.diagbot.mapper.KlConceptCommonMapper;
 import com.diagbot.service.KlConceptCommonService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 概念通用扩展表 服务实现类
@@ -17,4 +19,9 @@ import org.springframework.stereotype.Service;
 @Service
 public class KlConceptCommonServiceImpl extends ServiceImpl<KlConceptCommonMapper, KlConceptCommon> implements KlConceptCommonService {
 
+
+    @Override
+    public List<KlConceptCommon> getKlConceptCommonByConceptIdsNew(List<Long> collect) {
+        return this.baseMapper.selectBatchIds(collect);
+    }
 }