Browse Source

检索bug,常用bug修复

wangyu 6 years ago
parent
commit
e25bef3ff4

+ 33 - 30
aipt-service/src/main/resources/mapper/ConceptMapper.xml

@@ -198,6 +198,7 @@
         WHERE
         t1.is_deleted = 'N'
         AND t2.is_deleted = 'N'
+        AND t3.is_deleted = 'N'
         AND t6.is_deleted = 'N'
         <if test="isStatic != null and isStatic == 1">
             AND t7.is_deleted = 'N'
@@ -212,15 +213,14 @@
             </foreach>
         </if>
         <if test="sexType == 3">
-            and (t3.sex_type in ('1','2','3') or t3.sex_type is null)
+            and t3.sex_type in ('1','2','3')
         </if>
         <if test="sexType != 3">
-            and (t3.sex_type in ('3',#{sexType}) or t3.sex_type is null)
+            and t3.sex_type in ('3',#{sexType})
         </if>
         <if test="age != null and age != ''">
-            AND (( <![CDATA[ t3.min_age <= #{age} ]]>
-            AND <![CDATA[ t3.max_age >= #{age} ]]>)
-            or (t3.min_age is null and t3.max_age is null))
+            AND <![CDATA[ t3.min_age <= #{age} ]]>
+            AND <![CDATA[ t3.max_age >= #{age} ]]>
         </if>
         <if test="inputIds != null and inputIds.size > 0">
             and t1.id not in
@@ -246,6 +246,7 @@
         WHERE
         t1.is_deleted = 'N'
         AND t2.is_deleted = 'N'
+        AND t3.is_deleted = 'N'
         AND t6.is_deleted = 'N'
         <if test="isStatic != null and isStatic == 1">
             AND t7.is_deleted = 'N'
@@ -260,15 +261,14 @@
             </foreach>
         </if>
         <if test="sexType == 3">
-            and (t3.sex_type in ('1','2','3') or t3.sex_type is null)
+            and t3.sex_type in ('1','2','3')
         </if>
         <if test="sexType != 3">
-            and (t3.sex_type in ('3',#{sexType}) or t3.sex_type is null)
+            and t3.sex_type in ('3',#{sexType})
         </if>
         <if test="age != null and age != ''">
-            AND (( <![CDATA[ t3.min_age <= #{age} ]]>
-            AND <![CDATA[ t3.max_age >= #{age} ]]>)
-            or (t3.min_age is null and t3.max_age is null))
+            AND <![CDATA[ t3.min_age <= #{age} ]]>
+            AND <![CDATA[ t3.max_age >= #{age} ]]>
         </if>
         <if test="inputIds != null and inputIds.size > 0">
             and t1.id not in
@@ -294,6 +294,7 @@
         WHERE
         t1.is_deleted = 'N'
         AND t2.is_deleted = 'N'
+        AND t3.is_deleted = 'N'
         AND t6.is_deleted = 'N'
         <if test="isStatic != null and isStatic == 1">
             AND t7.is_deleted = 'N'
@@ -308,15 +309,14 @@
             </foreach>
         </if>
         <if test="sexType == 3">
-            and (t3.sex_type in ('1','2','3') or t3.sex_type is null)
+            and t3.sex_type in ('1','2','3')
         </if>
         <if test="sexType != 3">
-            and (t3.sex_type in ('3',#{sexType}) or t3.sex_type is null)
+            and t3.sex_type in ('3',#{sexType})
         </if>
         <if test="age != null and age != ''">
-            AND (( <![CDATA[ t3.min_age <= #{age} ]]>
-            AND <![CDATA[ t3.max_age >= #{age} ]]>)
-            or (t3.min_age is null and t3.max_age is null))
+            AND <![CDATA[ t3.min_age <= #{age} ]]>
+            AND <![CDATA[ t3.max_age >= #{age} ]]>
         </if>
         <if test="inputIds != null and inputIds.size > 0">
             and t1.id not in
@@ -345,9 +345,11 @@
             WHERE
             t1.is_deleted = 'N'
             AND t2.is_deleted = 'N'
+            AND t3.is_deleted = 'N'
             AND t4.is_deleted = 'N'
             AND t5.is_deleted = 'N'
             AND t6.is_deleted = 'N'
+            AND t5.id = t3.concept_id
             <if test="isStatic != null and isStatic == 1">
                 AND t7.is_deleted = 'N'
             </if>
@@ -355,15 +357,14 @@
                 AND t1.lib_type = #{detilType}
             </if>
             <if test="sexType == 3">
-                and (t3.sex_type in ('1','2','3') or t3.sex_type is null)
+                and (t3.sex_type in ('1','2','3'))
             </if>
             <if test="sexType != 3">
-                and (t3.sex_type in ('3',#{sexType}) or t3.sex_type is null)
+                and (t3.sex_type in ('3',#{sexType}))
             </if>
             <if test="age != null and age != ''">
-                AND (( <![CDATA[ t3.min_age <= #{age} ]]>
-                AND <![CDATA[ t3.max_age >= #{age} ]]>)
-                or (t3.min_age is null and t3.max_age is null))
+                AND <![CDATA[ t3.min_age <= #{age} ]]>
+                AND <![CDATA[ t3.max_age >= #{age} ]]>
             </if>
             AND (t2.spell =  UPPER(#{InputStr}) OR t2.name =  #{InputStr})
             <if test="inputIds != null and inputIds.size > 0">
@@ -392,9 +393,11 @@
             WHERE
             t1.is_deleted = 'N'
             AND t2.is_deleted = 'N'
+            AND t3.is_deleted = 'N'
             AND t4.is_deleted = 'N'
             AND t5.is_deleted = 'N'
             AND t6.is_deleted = 'N'
+            AND t5.id = t3.concept_id
             <if test="isStatic != null and isStatic == 1">
                 AND t7.is_deleted = 'N'
             </if>
@@ -402,15 +405,14 @@
                 AND t1.lib_type = #{detilType}
             </if>
             <if test="sexType == 3">
-                and (t3.sex_type in ('1','2','3') or t3.sex_type is null)
+                and t3.sex_type in ('1','2','3')
             </if>
             <if test="sexType != 3">
-                and (t3.sex_type in ('3',#{sexType}) or t3.sex_type is null)
+                and t3.sex_type in ('3',#{sexType})
             </if>
             <if test="age != null and age != ''">
-                AND (( <![CDATA[ t3.min_age <= #{age} ]]>
-                AND <![CDATA[ t3.max_age >= #{age} ]]>)
-                or (t3.min_age is null and t3.max_age is null))
+                AND <![CDATA[ t3.min_age <= #{age} ]]>
+                AND <![CDATA[ t3.max_age >= #{age} ]]>
             </if>
             AND (t2.spell LIKE CONCAT(UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT( #{InputStr},'%'))
             <if test="inputIds != null and inputIds.size > 0">
@@ -439,9 +441,11 @@
             WHERE
             t1.is_deleted = 'N'
             AND t2.is_deleted = 'N'
+            AND t3.is_deleted = 'N'
             AND t4.is_deleted = 'N'
             AND t5.is_deleted = 'N'
             AND t6.is_deleted = 'N'
+            AND t5.id = t3.concept_id
             <if test="isStatic != null and isStatic == 1">
                 AND t7.is_deleted = 'N'
             </if>
@@ -449,15 +453,14 @@
                 AND t1.lib_type = #{detilType}
             </if>
             <if test="sexType == 3">
-                and (t3.sex_type in ('1','2','3') or t3.sex_type is null)
+                and t3.sex_type in ('1','2','3')
             </if>
             <if test="sexType != 3">
-                and (t3.sex_type in ('3',#{sexType}) or t3.sex_type is null)
+                and t3.sex_type in ('3',#{sexType})
             </if>
             <if test="age != null and age != ''">
-                AND (( <![CDATA[ t3.min_age <= #{age} ]]>
-                AND <![CDATA[ t3.max_age >= #{age} ]]>)
-                or (t3.min_age is null and t3.max_age is null))
+                AND <![CDATA[ t3.min_age <= #{age} ]]>
+                AND <![CDATA[ t3.max_age >= #{age} ]]>
             </if>
             AND (t2.spell LIKE CONCAT('%',UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT('%',#{InputStr},'%'))
             <if test="inputIds != null and inputIds.size > 0">

+ 9 - 9
icss-service/src/main/java/com/diagbot/facade/QuestionUsualFacade.java

@@ -75,16 +75,16 @@ public class QuestionUsualFacade extends QuestionUsualServiceImpl {
                     questionUsualDTO.setQuestionId(questionInfoMap.get(questionUsualDTO.getName()).getId());
                 }
             }
-            return questionUsualDTOList;
-        }
-        //如何没有匹配到questionId就移除
-        Iterator<QuestionUsualDTO> questionUsualDTOIterator = questionUsualDTOList.iterator();
-        while (questionUsualDTOIterator.hasNext()){
-            if(questionUsualDTOIterator.next().getQuestionId() == null
-                    && questionUsualVO.getType().intValue() != QuestionTypeEnum.Pacs.getKey()
-                    && questionUsualVO.getType().intValue() != QuestionTypeEnum.Disease.getKey()){
-                questionUsualDTOIterator.remove();
+            //如何没有匹配到questionId就移除
+            Iterator<QuestionUsualDTO> questionUsualDTOIterator = questionUsualDTOList.iterator();
+            while (questionUsualDTOIterator.hasNext()){
+                if(questionUsualDTOIterator.next().getQuestionId() == null
+                        && questionUsualVO.getType().intValue() != QuestionTypeEnum.Pacs.getKey()
+                        && questionUsualVO.getType().intValue() != QuestionTypeEnum.Disease.getKey()){
+                    questionUsualDTOIterator.remove();
+                }
             }
+            return questionUsualDTOList;
         }
         return questionUsualDTOList;
     }