ArRechomeMapper.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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.ArRechomeMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.ArRechome">
  6. <id column="BASYID" property="basyid" />
  7. <result column="BRBABH" property="brbabh" />
  8. <result column="YLFKLB" property="ylfklb" />
  9. <result column="BRBAXM" property="brbaxm" />
  10. <result column="BRBAXB" property="brbaxb" />
  11. <result column="BRCSRQ" property="brcsrq" />
  12. <result column="BRCSDZ" property="brcsdz" />
  13. <result column="BRDQNL" property="brdqnl" />
  14. <result column="BRNLDW" property="brnldw" />
  15. <result column="BRBAXX" property="brbaxx" />
  16. <result column="BRBARH" property="brbarh" />
  17. <result column="BRBAJG" property="brbajg" />
  18. <result column="BRBAMZ" property="brbamz" />
  19. <result column="BRHYZK" property="brhyzk" />
  20. <result column="BRBASF" property="brbasf" />
  21. <result column="BRSFZH" property="brsfzh" />
  22. <result column="BRBAGJ" property="brbagj" />
  23. <result column="HKDZQH" property="hkdzqh" />
  24. <result column="BRHKDZ" property="brhkdz" />
  25. <result column="HKDZYB" property="hkdzyb" />
  26. <result column="GZDWMC" property="gzdwmc" />
  27. <result column="GZDWDH" property="gzdwdh" />
  28. <result column="GZDWYB" property="gzdwyb" />
  29. <result column="LXDZQH" property="lxdzqh" />
  30. <result column="BRLXDZ" property="brlxdz" />
  31. <result column="BRLXDH" property="brlxdh" />
  32. <result column="LXDZYB" property="lxdzyb" />
  33. <result column="SFZFPB" property="sfzfpb" />
  34. <result column="BAZTPB" property="baztpb" />
  35. <result column="BALRRQ" property="balrrq" />
  36. <result column="LRRYID" property="lrryid" />
  37. <result column="XGYHDM" property="xgyhdm" />
  38. <result column="XGCZSJ" property="xgczsj" />
  39. <result column="BRJKKH" property="brjkkh" />
  40. <result column="BRBAZY" property="brbazy" />
  41. </resultMap>
  42. <!-- 住院记录列表 -->
  43. <select id="getBAZYList" parameterType="java.util.Map" resultType="com.diagbot.dto.BABLDTO">
  44. select
  45. t1.BRBAXM,t1.BASYID,t2.BRZYID
  46. from AR_RECHOME t1,BR_RECINHOS t2
  47. where t1.BASYID=t2.BASYID
  48. </select>
  49. <!-- 病案首页基础信息 -->
  50. <select id="getBABLDetail" parameterType="com.diagbot.vo.BABLVO" resultType="com.diagbot.dto.BABLDetailDTO">
  51. SELECT
  52. t1.BRBAXB,
  53. t1.BRBAXX,
  54. t1.BRBARH,
  55. t2.MJZZDMC,
  56. t2.ZYZYZDMC,
  57. t2.ZYQTZDMC
  58. FROM
  59. AR_RECHOME t1,
  60. (
  61. SELECT
  62. tt.BASYID,
  63. listAgg ( tt.MJZZDMC, ',' ) within GROUP ( ORDER BY tt.MJZZDMC ) AS MJZZDMC,
  64. listAgg ( tt.ZYZYZDMC, ',' ) within GROUP ( ORDER BY tt.ZYZYZDMC ) AS ZYZYZDMC,
  65. listAgg ( tt.ZYQTZDMC, ',' ) within GROUP ( ORDER BY tt.ZYQTZDMC ) AS ZYQTZDMC
  66. FROM
  67. (
  68. SELECT
  69. BASYID,
  70. ZDLBDM,
  71. ZCZDPB,
  72. CASE
  73. WHEN ZDLBDM = '1' THEN
  74. t.ZDJBMC
  75. END AS MJZZDMC,
  76. CASE
  77. WHEN ZDLBDM = '2'
  78. AND ZCZDPB = '1' THEN
  79. t.ZDJBMC
  80. END AS ZYZYZDMC,
  81. CASE
  82. WHEN ZDLBDM = '2'
  83. AND ZCZDPB = '2' THEN
  84. t.ZDJBMC
  85. END AS ZYQTZDMC
  86. FROM
  87. (
  88. SELECT
  89. BASYID,
  90. ZDLBDM,
  91. ZCZDPB,
  92. LISTAGG ( ZDJBMC, ',' ) within GROUP ( ORDER BY ZDJBMC ) ZDJBMC
  93. FROM
  94. BR_RECDIAGNOSE
  95. where 1=1
  96. <if test="basyid != null and basyid != ''">
  97. and BASYID=#{basyid}
  98. </if>
  99. GROUP BY
  100. BASYID,
  101. ZDLBDM,
  102. ZCZDPB
  103. ) t
  104. ) tt
  105. GROUP BY
  106. BASYID
  107. ) t2
  108. WHERE
  109. t1.BASYID = t2.BASYID
  110. <if test="basyid != null and basyid != ''">
  111. and t1.BASYID=#{basyid}
  112. </if>
  113. </select>
  114. </mapper>