KlDiagnoseBaseMapper.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.KlDiagnoseBaseMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.KlDiagnoseBase">
  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="description" property="description" />
  13. <result column="type" property="type" />
  14. <result column="min_operator" property="minOperator" />
  15. <result column="min_value" property="minValue" />
  16. <result column="min_unit" property="minUnit" />
  17. <result column="max_operator" property="maxOperator" />
  18. <result column="max_value" property="maxValue" />
  19. <result column="max_unit" property="maxUnit" />
  20. <result column="eq_operator" property="eqOperator" />
  21. <result column="eq_value" property="eqValue" />
  22. <result column="eq_unit" property="eqUnit" />
  23. </resultMap>
  24. <select id="getAllBaseDiagnose" resultType="com.diagbot.dto.BaseDiagnoseDTO">
  25. SELECT
  26. t.type baseType,
  27. t.max_operator baseMaxOperator,
  28. t.max_value baseMaxValue,
  29. t.max_unit baseMaxUnit,
  30. t.min_operator baseMinOperator,
  31. t.min_value baseMinValue,
  32. t.min_unit baseMinUnit,
  33. t.eq_operator baseEqOperator,
  34. t.eq_value baseEqValue,
  35. t.eq_unit baseEqUnit,
  36. t.conceptids baseConceptids,
  37. t.lib_name baseLibName,
  38. t.lib_type baseLibType,
  39. GROUP_CONCAT(t.id) ids
  40. FROM
  41. (
  42. SELECT
  43. t1.id,
  44. t1.type,
  45. t1.max_operator,
  46. t1.max_value,
  47. t1.max_unit,
  48. t1.min_operator,
  49. t1.min_value,
  50. t1.min_unit,
  51. t1.eq_operator,
  52. t1.eq_value,
  53. t1.eq_unit,
  54. IFNULL(t2.conceptids, 0) conceptids,
  55. IFNULL(t2.lib_name, '') lib_name,
  56. IFNULL(t2.lib_type, 0) lib_type
  57. FROM
  58. kl_diagnose_base t1
  59. LEFT JOIN (
  60. SELECT
  61. diagnose_base_id,
  62. lib_type,
  63. GROUP_CONCAT(
  64. concept_id
  65. ORDER BY
  66. concept_id
  67. ) conceptids,
  68. GROUP_CONCAT(
  69. lib_name
  70. ORDER BY
  71. concept_id SEPARATOR '#'
  72. ) lib_name
  73. FROM
  74. `kl_diagnose_base_relation` m,
  75. kl_concept c
  76. WHERE
  77. m.is_deleted = 'N'
  78. AND c.is_deleted = 'N'
  79. AND c. STATUS = 1
  80. AND m.concept_id = c.id
  81. GROUP BY m.diagnose_base_id, c.lib_type
  82. ) t2 ON t1.id = t2.diagnose_base_id
  83. WHERE
  84. t1.is_deleted = 'N'
  85. ) t
  86. GROUP BY
  87. t.type,
  88. t.max_operator,
  89. t.max_value,
  90. t.max_unit,
  91. t.min_operator,
  92. t.min_value,
  93. t.min_unit,
  94. t.eq_operator,
  95. t.eq_value,
  96. t.eq_unit,
  97. t.conceptids,
  98. t.lib_name
  99. </select>
  100. </mapper>