Forráskód Böngészése

诊断性别和年龄校验

yuchengwei 3 hónapja
szülő
commit
7816b24176

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

@@ -31,6 +31,9 @@ public class OtherTipFacade {
         // 其他值提醒——化验
         otherTipProcess.processLis(wordCrfDTO, res);
 
+        // 其他值提醒——检验诊断性别和年龄
+        otherTipProcess.processDiagnosticCheckGender(wordCrfDTO, res);
+
         // 其他值提醒——辅检
         otherTipProcess.processPacs(wordCrfDTO, res);
 

+ 4 - 1
src/main/java/com/diagbot/mapper/KlConceptCommonMapper.java

@@ -2,6 +2,9 @@ package com.diagbot.mapper;
 
 import com.diagbot.entity.KlConceptCommon;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @since 2021-01-21
  */
 public interface KlConceptCommonMapper extends BaseMapper<KlConceptCommon> {
-
+    List<KlConceptCommon> searchCollectionConceptCommon(@Param("conceptIds") List<Long> conceptIds);
 }

+ 2 - 0
src/main/java/com/diagbot/mapper/KlConceptMapper.java

@@ -39,6 +39,8 @@ public interface KlConceptMapper extends BaseMapper<KlConcept> {
 
     List<GetAllForRelationDTO> searchCollectionConcept(SearchCollectionConceptVO searchCollectionConceptVO);
 
+    List<GetAllForRelationDTO> searchCollectionConceptNew(SearchCollectionConceptVO searchCollectionConceptVO);
+
     List<GatherDTO> getGather(GatherVO gatherVO);
 
     IPage<DiseaseIndexDTO> findDiseaeByCode(@Param("diseaseIndexPageVO") DiseaseIndexPageVO diseaseIndexPageVO);

+ 69 - 6
src/main/java/com/diagbot/process/OtherTipProcess.java

@@ -3,17 +3,15 @@ package com.diagbot.process;
 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.BillMsg;
-import com.diagbot.dto.IndicationDTO;
-import com.diagbot.dto.RuleBaseDTO;
-import com.diagbot.dto.RuleConditionDTO;
-import com.diagbot.dto.RuleExtDTO;
-import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.dto.*;
+import com.diagbot.entity.KlConceptCommon;
 import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RedisEnum;
 import com.diagbot.enums.RuleTypeEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.facade.CommonFacade;
+import com.diagbot.facade.KlConceptCommonFacade;
+import com.diagbot.facade.KlConceptFacade;
 import com.diagbot.model.entity.PacsNum;
 import com.diagbot.model.label.PacsLabel;
 import com.diagbot.rule.AgeRule;
@@ -30,12 +28,16 @@ import com.diagbot.util.ReflectUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.ItemExt;
 import com.diagbot.vo.RuleVO;
+import com.diagbot.vo.SearchCollectionConceptVO;
 import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 其他提示总入口
@@ -60,6 +62,11 @@ public class OtherTipProcess {
     @Autowired
     AgeRule ageRule;
 
+    @Autowired
+    KlConceptFacade klConceptFacade;
+    @Autowired
+    KlConceptCommonFacade klConceptCommonFacade;
+
     /**
      * 处理业务——化验
      *
@@ -87,6 +94,62 @@ 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.searchCollectionConceptNew(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);
+            }
+
+            if (wordCrfDTO.getAgeNum() < klConceptCommon.getMinAge()  || wordCrfDTO.getAgeNum() > klConceptCommon.getMaxAge()) {
+                String diagName = diagNameMap.get(diagConceptIdNameMap.get(klConceptCommon.getConceptId()));
+                String msg = "患者年龄是" + wordCrfDTO.getAge() + "," + diagName + "与年龄不符";
+                BillMsg billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.other.getName(), msg, null, null, null);
+                CoreUtil.addBeanToList(otherList, billMsg);
+            }
+        }
+
+    }
+
     /**
      * 处理业务——辅检
      *

+ 4 - 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,5 @@ import com.diagbot.entity.KlConceptCommon;
  */
 public interface KlConceptCommonService extends IService<KlConceptCommon> {
 
+    List<KlConceptCommon> getKlConceptCommonByConceptIdsNew(@Param("conceptIds") List<Long> collect);
 }

+ 3 - 0
src/main/java/com/diagbot/service/KlConceptService.java

@@ -49,6 +49,9 @@ public interface KlConceptService extends IService<KlConcept> {
     //查找(集合模块术语)
     List<GetAllForRelationDTO> searchCollectionConcept(SearchCollectionConceptVO searchCollectionConceptVO);
 
+    List<GetAllForRelationDTO> searchCollectionConceptNew(SearchCollectionConceptVO searchCollectionConceptVO);
+
+
     List<GatherDTO> getGather(GatherVO gatherVO);
 
     //通过编码查询疾病

+ 7 - 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>
  * 概念通用扩展表 服务实现类
@@ -16,5 +18,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.searchCollectionConceptCommon(collect);
+    }
 
 }

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

@@ -66,6 +66,11 @@ public class KlConceptServiceImpl extends ServiceImpl<KlConceptMapper, KlConcept
         return baseMapper.searchCollectionConcept(searchCollectionConceptVO);
     }
 
+    @Override
+    public List<GetAllForRelationDTO> searchCollectionConceptNew(SearchCollectionConceptVO searchCollectionConceptVO) {
+        return baseMapper.searchCollectionConceptNew(searchCollectionConceptVO);
+    }
+
     @Override
     public List<GatherDTO> getGather(GatherVO gatherVO) {
         return baseMapper.getGather(gatherVO);

+ 11 - 0
src/main/resources/mapper/KlConceptCommonMapper.xml

@@ -17,4 +17,15 @@
         <result column="remark" property="remark" />
     </resultMap>
 
+    <select id="searchCollectionConceptCommon" parameterType="java.util.List"
+            resultMap="BaseResultMap">
+        select *
+        from kl_concept_common kcc
+        where kcc.is_deleted = 'N'
+        and kcc.concept_id in
+        <foreach collection="conceptIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
 </mapper>

+ 14 - 0
src/main/resources/mapper/KlConceptMapper.xml

@@ -998,6 +998,20 @@
         LIMIT 100
     </select>
 
+    <select id="searchCollectionConceptNew" parameterType="com.diagbot.vo.SearchCollectionConceptVO"
+            resultType="com.diagbot.dto.GetAllForRelationDTO">
+        select kc.id AS conceptId,
+        kc.lib_name AS conceptName,
+        kc.lib_type AS libType,
+        kc.lib_name AS conceptNameType
+        from kl_concept kc
+        where kc.status = 1
+        and kc.lib_name in
+        <foreach collection="names" item="name" open="(" separator="," close=")">
+            #{name}
+        </foreach>
+    </select>
+
     <select id="indexByApproval" resultType="com.diagbot.dto.IndexBatchDTO">
         SELECT
         t1.approvalNum,