ConceptDetailMapper.xml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.diagbot.mapper.ConceptDetailMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.ConceptDetail">
  6. <id column="id" property="id" />
  7. <result column="is_deleted" property="isDeleted" />
  8. <result column="gmt_create" property="gmtCreate" />
  9. <result column="gmt_modified" property="gmtModified" />
  10. <result column="creator" property="creator" />
  11. <result column="modifier" property="modifier" />
  12. <result column="concept_id" property="conceptId" />
  13. <result column="title" property="title" />
  14. <result column="content" property="content" />
  15. <result column="text" property="text" />
  16. <result column="order_no" property="orderNo" />
  17. <result column="position" property="position" />
  18. <result column="is_reason" property="isReason" />
  19. </resultMap>
  20. <select id="getConceptDetailList" resultType="com.diagbot.dto.GetConceptDetailListDTO">
  21. SELECT a.concept_id concept_id, b.lib_name,b.lib_type as typeId, group_concat(title) title, a.is_deleted, a.modifier, a.gmt_modified
  22. FROM kl_concept_detail a ,kl_concept b
  23. WHERE b.is_deleted='N' and a.concept_id=b.id
  24. <if test="conceptName!=null and conceptName!=''">
  25. and b.`lib_name` like concat('%',#{conceptName},'%')
  26. </if>
  27. <if test="status!=null and status!=''">
  28. and a.is_deleted = #{status}
  29. </if>
  30. <if test="libType!=null">
  31. and b.lib_type=#{libType}
  32. </if>
  33. group by a.concept_id
  34. ORDER BY a.is_deleted ASC, a.gmt_modified DESC
  35. </select>
  36. <select id="getByParam" resultType="com.diagbot.dto.ConceptDetailDTO">
  37. SELECT a.*,b.lib_name FROM `kl_concept_detail` a, `kl_concept` b
  38. where a.is_deleted = 'N' and b.is_deleted = 'N' and b.id = a.concept_id
  39. and a.concept_id = #{conceptId}
  40. ORDER BY a.order_no
  41. </select>
  42. <select id="index" resultType="com.diagbot.dto.ConceptIndexDTO">
  43. SELECT
  44. DISTINCT
  45. a.id AS conceptId,
  46. a.lib_name AS name,
  47. a.lib_type AS typeId
  48. FROM kl_concept a LEFT JOIN kl_concept_detail b
  49. ON a.id=b.concept_id
  50. WHERE a.is_deleted='N' and b.id IS NULL
  51. <if test="name != null and name != ''">
  52. AND a.lib_name like concat('%',#{name} ,'%' )
  53. </if>
  54. AND a.lib_type not in(12,13,14)
  55. ORDER BY a.gmt_modified DESC
  56. </select>
  57. <select id="conDetailCount" resultType="com.diagbot.dto.BIItemDTO">
  58. SELECT
  59. "静态知识" AS moduleName,
  60. "静态知识总数" AS itemName,
  61. count(DISTINCT kc.id) AS count
  62. FROM
  63. kl_concept kc,
  64. kl_concept_detail kcd
  65. WHERE
  66. kc.is_deleted = 'N'
  67. AND kcd.is_deleted = 'N'
  68. AND kc.id = kcd.concept_id
  69. UNION
  70. SELECT DISTINCT
  71. "静态知识" AS moduleName,
  72. CASE
  73. WHEN t2.lib_type = 18 THEN '疾病'
  74. WHEN t2.lib_type = 46 THEN '化验公表项'
  75. WHEN t2.lib_type = 16 THEN '辅检项目'
  76. WHEN t2.lib_type = 10 THEN '药品通用名'
  77. ELSE ''
  78. END AS itemName,
  79. COUNT(t2.id) AS count
  80. FROM
  81. (SELECT DISTINCT concept_id FROM kl_concept_detail WHERE is_deleted = "N") t1,
  82. kl_concept t2
  83. WHERE
  84. t1.concept_id = t2.id
  85. AND t2.is_deleted = "N"
  86. AND t2.lib_type IN (18, 46, 16, 10)
  87. GROUP BY
  88. lib_type
  89. </select>
  90. </mapper>