ScaleConfigMapper.xml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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.ScaleConfigMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.ScaleConfig">
  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="hospital_id" property="hospitalId" />
  13. <result column="his_name" property="hisName" />
  14. <result column="unique_name" property="uniqueName" />
  15. <result column="unique_code" property="uniqueCode" />
  16. </resultMap>
  17. <!-- 分页查询 -->
  18. <select id="getPage" resultType="com.diagbot.entity.ScaleConfig">
  19. select a.*
  20. from tran_scale_config a
  21. where a.is_deleted='N'
  22. <if test="scaleConfigPageVO.hospitalId!=null">
  23. and a.hospital_id=#{scaleConfigPageVO.hospitalId}
  24. </if>
  25. <if test="scaleConfigPageVO.hisName!=null and scaleConfigPageVO.hisName!=''">
  26. and a.his_name like concat("%",#{scaleConfigPageVO.hisName},"%")
  27. </if>
  28. <if test="scaleConfigPageVO.uniqueName!=null and scaleConfigPageVO.uniqueName!=''">
  29. and a.unique_name like concat("%",#{scaleConfigPageVO.uniqueName},"%")
  30. </if>
  31. <if test="scaleConfigPageVO.uniqueCode!=null and scaleConfigPageVO.uniqueCode!=''">
  32. and a.unique_code like concat("%",#{scaleConfigPageVO.uniqueCode},"%")
  33. </if>
  34. order by a.gmt_modified desc
  35. </select>
  36. <!-- 各医院映射关系数列表 -->
  37. <select id="getRelationNumPage" resultType="com.diagbot.dto.HosRelationNumDTO">
  38. SELECT
  39. a.id,
  40. a.NAME,
  41. sum( b.id IS NOT NULL ) AS num
  42. FROM
  43. tran_hospital_info a
  44. LEFT JOIN tran_scale_config b ON a.id = b.hospital_id
  45. AND b.is_deleted = 'N'
  46. WHERE
  47. a.is_deleted = 'N'
  48. GROUP BY
  49. a.id
  50. </select>
  51. </mapper>