Procházet zdrojové kódy

获取questionId信息

zhoutg před 5 roky
rodič
revize
1067cf8554

+ 17 - 0
src/main/java/com/diagbot/dto/QuestionEntryDTO.java

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 返回标签和质控条目的映射内容
+ * @Author: ztg
+ * @Date: 2018/10/24 16:11
+ */
+@Getter
+@Setter
+public class QuestionEntryDTO {
+
+    private Long id;// id
+    private Long casesEntryId;//casesEntryId
+}

+ 3 - 0
src/main/java/com/diagbot/mapper/QcQuestionInfoMapper.java

@@ -1,6 +1,7 @@
 package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.dto.QuestionEntryDTO;
 import com.diagbot.entity.QcQuestionInfo;
 import com.diagbot.entity.wrapper.QuestionInfoWrapper;
 
@@ -19,4 +20,6 @@ public interface QcQuestionInfoMapper extends BaseMapper<QcQuestionInfo> {
 
     public List<QuestionInfoWrapper> getByQuestionMapping(Map map);
 
+    public List<QuestionEntryDTO> getByCaseEntryIds(Map map);
+
 }

+ 24 - 0
src/main/resources/mapper/QcQuestionInfoMapper.xml

@@ -43,4 +43,28 @@
             order by m.parent_question, m.order_no
         </if>
     </select>
+
+    <select id="getByCaseEntryIds" resultType="com.diagbot.dto.QuestionEntryDTO">
+        select * from (
+        select a.id,substring_index(substring_index(a.cases_entry_ids,',',b.help_topic_id+1),',',-1) cases_entry_id
+        from
+        qc_question_info a
+        join
+        <![CDATA[
+            mysql.help_topic b
+            on b.help_topic_id < (length(a.cases_entry_ids) - length(replace(a.cases_entry_ids,',',''))+1)
+        ]]>
+        where a.is_deleted = 'N'
+        <if test="hospitalId != null">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        order by a.ID) t
+        where t.cases_entry_id != ''
+        <if test="casesEntryIds != null and casesEntryIds.size > 0">
+            and t.cases_entry_id in
+            <foreach  collection="casesEntryIds" item="item" open="("  separator=","  close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
 </mapper>