DeptConfigMapper.xml 2.4 KB

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