DrugConfigMapper.xml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.DrugConfigMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.DrugConfig">
  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. <result column="form" property="form" />
  17. </resultMap>
  18. <!-- 分页查询 -->
  19. <select id="getPage" resultType="com.diagbot.entity.DrugConfig">
  20. select a.*
  21. from tran_drug_config a
  22. where a.is_deleted='N'
  23. <if test="drugConfigPageVO.hospitalId!=null">
  24. and a.hospital_id=#{drugConfigPageVO.hospitalId}
  25. </if>
  26. <if test="drugConfigPageVO.hisName!=null and drugConfigPageVO.hisName!=''">
  27. and a.his_name like concat("%",#{drugConfigPageVO.hisName},"%")
  28. </if>
  29. <if test="drugConfigPageVO.uniqueName!=null and drugConfigPageVO.uniqueName!=''">
  30. and a.unique_name like concat("%",#{drugConfigPageVO.uniqueName},"%")
  31. </if>
  32. <if test="drugConfigPageVO.uniqueCode!=null and drugConfigPageVO.uniqueCode!=''">
  33. and a.unique_code like concat("%",#{drugConfigPageVO.uniqueCode},"%")
  34. </if>
  35. <if test="drugConfigPageVO.form!=null and drugConfigPageVO.form!=''">
  36. and a.form = #{drugConfigPageVO.form}
  37. </if>
  38. order by a.gmt_modified desc
  39. </select>
  40. <select id="getMedicinesIndex" resultType="com.diagbot.entity.DrugConfig"
  41. parameterType="com.diagbot.vo.RetrievalVO">
  42. SELECT DISTINCT u.his_name
  43. FROM(
  44. SELECT
  45. DISTINCT his_name
  46. FROM
  47. `tran_drug_config`
  48. WHERE
  49. is_deleted = "N"
  50. <if test="hospitalId!=null">
  51. and hospital_id=#{hospitalId}
  52. </if>
  53. <if test="inputStr!=null and inputStr!=''">
  54. and his_name = #{inputStr}
  55. </if>
  56. UNION
  57. SELECT
  58. DISTINCT his_name
  59. FROM
  60. `tran_drug_config`
  61. WHERE
  62. is_deleted = "N"
  63. <if test="hospitalId!=null">
  64. and hospital_id=#{hospitalId}
  65. </if>
  66. <if test="inputStr!=null and inputStr!=''">
  67. and his_name like concat(#{inputStr},"%")
  68. </if>
  69. UNION
  70. SELECT
  71. DISTINCT his_name
  72. FROM
  73. `tran_drug_config`
  74. WHERE
  75. is_deleted = "N"
  76. <if test="hospitalId!=null">
  77. and hospital_id=#{hospitalId}
  78. </if>
  79. <if test="inputStr!=null and inputStr!=''">
  80. and his_name like concat("%",#{inputStr},"%")
  81. </if>
  82. ) u LIMIT 100
  83. </select>
  84. </mapper>