DicWardMapper.xml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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.xinxin.topro.pubservice.mysqlmapper.DicWardMapper" >
  4. <resultMap id="BaseResultMap" type="com.xinxin.topro.pubservice.mysqlModel.DicWard" >
  5. <id column="DW_ID" property="dwId" jdbcType="INTEGER" />
  6. <result column="HI_ID" property="hiId" jdbcType="INTEGER" />
  7. <result column="DW_WardDm" property="dwWarddm" jdbcType="VARCHAR" />
  8. <result column="DW_WardName" property="dwWardname" jdbcType="VARCHAR" />
  9. <result column="DW_PinyinCode" property="dwPinyincode" jdbcType="VARCHAR" />
  10. <result column="DW_WubiCode" property="dwWubicode" jdbcType="VARCHAR" />
  11. <result column="DW_OtherCode" property="dwOthercode" jdbcType="VARCHAR" />
  12. <result column="UI_ID" property="uiId" jdbcType="VARCHAR" />
  13. <result column="DW_Date" property="dwDate" jdbcType="TIMESTAMP" />
  14. <result column="DW_Type" property="dwType" jdbcType="INTEGER" />
  15. <result column="DW_EngName" property="dwEngname" jdbcType="VARCHAR" />
  16. <result column="DW_MaxBed" property="dwMaxbed" jdbcType="INTEGER" />
  17. <result column="DW_Sord" property="dwSord" jdbcType="INTEGER" />
  18. <result column="DW_IsDel" property="dwIsdel" jdbcType="INTEGER" />
  19. </resultMap>
  20. <resultMap id="DeptResultMap" type="com.xinxin.topro.pubservice.sqlservermodel.Depart" >
  21. <result column="DivCode" property="departno" jdbcType="VARCHAR" />
  22. <result column="DivName" property="departname" jdbcType="VARCHAR" />
  23. </resultMap>
  24. <sql id="Base_Column_List" >
  25. DW_ID, HI_ID, DW_WardDm, DW_WardName, DW_PinyinCode, DW_WubiCode, DW_OtherCode, UI_ID,
  26. DW_Date, DW_Type, DW_EngName, DW_MaxBed, DW_Sord, DW_IsDel
  27. </sql>
  28. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  29. select
  30. <include refid="Base_Column_List" />
  31. from dic_ward
  32. where DW_ID = #{dwId,jdbcType=INTEGER}
  33. </select>
  34. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  35. delete from dic_ward
  36. where DW_ID = #{dwId,jdbcType=INTEGER}
  37. </delete>
  38. <insert id="insert" parameterType="com.xinxin.topro.pubservice.mysqlModel.DicWard" >
  39. insert into dic_ward (DW_ID, HI_ID, DW_WardDm,
  40. DW_WardName, DW_PinyinCode, DW_WubiCode,
  41. DW_OtherCode, UI_ID, DW_Date,
  42. DW_Type, DW_EngName, DW_MaxBed,
  43. DW_Sord, DW_IsDel)
  44. values (#{dwId,jdbcType=INTEGER}, #{hiId,jdbcType=INTEGER}, #{dwWarddm,jdbcType=VARCHAR},
  45. #{dwWardname,jdbcType=VARCHAR}, #{dwPinyincode,jdbcType=VARCHAR}, #{dwWubicode,jdbcType=VARCHAR},
  46. #{dwOthercode,jdbcType=VARCHAR}, #{uiId,jdbcType=VARCHAR}, #{dwDate,jdbcType=TIMESTAMP},
  47. #{dwType,jdbcType=INTEGER}, #{dwEngname,jdbcType=VARCHAR}, #{dwMaxbed,jdbcType=INTEGER},
  48. #{dwSord,jdbcType=INTEGER}, #{dwIsdel,jdbcType=INTEGER})
  49. </insert>
  50. <insert id="insertSelective" parameterType="com.xinxin.topro.pubservice.mysqlModel.DicWard" >
  51. insert into dic_ward
  52. <trim prefix="(" suffix=")" suffixOverrides="," >
  53. <if test="dwId != null" >
  54. DW_ID,
  55. </if>
  56. <if test="hiId != null" >
  57. HI_ID,
  58. </if>
  59. <if test="dwWarddm != null" >
  60. DW_WardDm,
  61. </if>
  62. <if test="dwWardname != null" >
  63. DW_WardName,
  64. </if>
  65. <if test="dwPinyincode != null" >
  66. DW_PinyinCode,
  67. </if>
  68. <if test="dwWubicode != null" >
  69. DW_WubiCode,
  70. </if>
  71. <if test="dwOthercode != null" >
  72. DW_OtherCode,
  73. </if>
  74. <if test="uiId != null" >
  75. UI_ID,
  76. </if>
  77. <if test="dwDate != null" >
  78. DW_Date,
  79. </if>
  80. <if test="dwType != null" >
  81. DW_Type,
  82. </if>
  83. <if test="dwEngname != null" >
  84. DW_EngName,
  85. </if>
  86. <if test="dwMaxbed != null" >
  87. DW_MaxBed,
  88. </if>
  89. <if test="dwSord != null" >
  90. DW_Sord,
  91. </if>
  92. <if test="dwIsdel != null" >
  93. DW_IsDel,
  94. </if>
  95. </trim>
  96. <trim prefix="values (" suffix=")" suffixOverrides="," >
  97. <if test="dwId != null" >
  98. #{dwId,jdbcType=INTEGER},
  99. </if>
  100. <if test="hiId != null" >
  101. #{hiId,jdbcType=INTEGER},
  102. </if>
  103. <if test="dwWarddm != null" >
  104. #{dwWarddm,jdbcType=VARCHAR},
  105. </if>
  106. <if test="dwWardname != null" >
  107. #{dwWardname,jdbcType=VARCHAR},
  108. </if>
  109. <if test="dwPinyincode != null" >
  110. #{dwPinyincode,jdbcType=VARCHAR},
  111. </if>
  112. <if test="dwWubicode != null" >
  113. #{dwWubicode,jdbcType=VARCHAR},
  114. </if>
  115. <if test="dwOthercode != null" >
  116. #{dwOthercode,jdbcType=VARCHAR},
  117. </if>
  118. <if test="uiId != null" >
  119. #{uiId,jdbcType=VARCHAR},
  120. </if>
  121. <if test="dwDate != null" >
  122. #{dwDate,jdbcType=TIMESTAMP},
  123. </if>
  124. <if test="dwType != null" >
  125. #{dwType,jdbcType=INTEGER},
  126. </if>
  127. <if test="dwEngname != null" >
  128. #{dwEngname,jdbcType=VARCHAR},
  129. </if>
  130. <if test="dwMaxbed != null" >
  131. #{dwMaxbed,jdbcType=INTEGER},
  132. </if>
  133. <if test="dwSord != null" >
  134. #{dwSord,jdbcType=INTEGER},
  135. </if>
  136. <if test="dwIsdel != null" >
  137. #{dwIsdel,jdbcType=INTEGER},
  138. </if>
  139. </trim>
  140. </insert>
  141. <update id="updateByPrimaryKeySelective" parameterType="com.xinxin.topro.pubservice.mysqlModel.DicWard" >
  142. update dic_ward
  143. <set >
  144. <if test="hiId != null" >
  145. HI_ID = #{hiId,jdbcType=INTEGER},
  146. </if>
  147. <if test="dwWarddm != null" >
  148. DW_WardDm = #{dwWarddm,jdbcType=VARCHAR},
  149. </if>
  150. <if test="dwWardname != null" >
  151. DW_WardName = #{dwWardname,jdbcType=VARCHAR},
  152. </if>
  153. <if test="dwPinyincode != null" >
  154. DW_PinyinCode = #{dwPinyincode,jdbcType=VARCHAR},
  155. </if>
  156. <if test="dwWubicode != null" >
  157. DW_WubiCode = #{dwWubicode,jdbcType=VARCHAR},
  158. </if>
  159. <if test="dwOthercode != null" >
  160. DW_OtherCode = #{dwOthercode,jdbcType=VARCHAR},
  161. </if>
  162. <if test="uiId != null" >
  163. UI_ID = #{uiId,jdbcType=VARCHAR},
  164. </if>
  165. <if test="dwDate != null" >
  166. DW_Date = #{dwDate,jdbcType=TIMESTAMP},
  167. </if>
  168. <if test="dwType != null" >
  169. DW_Type = #{dwType,jdbcType=INTEGER},
  170. </if>
  171. <if test="dwEngname != null" >
  172. DW_EngName = #{dwEngname,jdbcType=VARCHAR},
  173. </if>
  174. <if test="dwMaxbed != null" >
  175. DW_MaxBed = #{dwMaxbed,jdbcType=INTEGER},
  176. </if>
  177. <if test="dwSord != null" >
  178. DW_Sord = #{dwSord,jdbcType=INTEGER},
  179. </if>
  180. <if test="dwIsdel != null" >
  181. DW_IsDel = #{dwIsdel,jdbcType=INTEGER},
  182. </if>
  183. </set>
  184. where DW_ID = #{dwId,jdbcType=INTEGER}
  185. </update>
  186. <update id="updateByPrimaryKey" parameterType="com.xinxin.topro.pubservice.mysqlModel.DicWard" >
  187. update dic_ward
  188. set HI_ID = #{hiId,jdbcType=INTEGER},
  189. DW_WardDm = #{dwWarddm,jdbcType=VARCHAR},
  190. DW_WardName = #{dwWardname,jdbcType=VARCHAR},
  191. DW_PinyinCode = #{dwPinyincode,jdbcType=VARCHAR},
  192. DW_WubiCode = #{dwWubicode,jdbcType=VARCHAR},
  193. DW_OtherCode = #{dwOthercode,jdbcType=VARCHAR},
  194. UI_ID = #{uiId,jdbcType=VARCHAR},
  195. DW_Date = #{dwDate,jdbcType=TIMESTAMP},
  196. DW_Type = #{dwType,jdbcType=INTEGER},
  197. DW_EngName = #{dwEngname,jdbcType=VARCHAR},
  198. DW_MaxBed = #{dwMaxbed,jdbcType=INTEGER},
  199. DW_Sord = #{dwSord,jdbcType=INTEGER},
  200. DW_IsDel = #{dwIsdel,jdbcType=INTEGER}
  201. where DW_ID = #{dwId,jdbcType=INTEGER}
  202. </update>
  203. <select id="selectAllDivision" resultMap="DeptResultMap">
  204. select
  205. DD_DepDm departno , DD_DepName departname
  206. from dic_department
  207. </select>
  208. <select id="selectAllWards" resultMap="DeptResultMap">
  209. select
  210. DW_WardDm departno , DW_WardName departname
  211. from dic_ward
  212. </select>
  213. <select id="selectAuthorityWards" resultMap="DeptResultMap" >
  214. SELECT a.DW_WardDm departno,b.DW_WardName departname,a.SWP_IsDefault isDefault FROM sys_ward_permission a
  215. INNER JOIN dic_ward b on a.DW_WardDm = b.DW_WardDm and a.HI_ID = b.HI_ID
  216. where UI_Code = #{userCode,jdbcType=VARCHAR}
  217. and a.SWP_IsDel = 0 and b.DW_IsDel = 0
  218. <if test="hiid != null" >
  219. and a.HI_ID = #{hiid,jdbcType=INTEGER}
  220. </if>
  221. </select>
  222. <select id="selectAuthorityDivisions" resultMap="DeptResultMap" parameterType="java.lang.String" >
  223. SELECT a.DW_WardDm departno,b.DW_WardName departname FROM sys_ward_permission a
  224. INNER JOIN dic_ward b on a.DW_WardDm = b.DW_WardDm
  225. where UI_Code = #{userCode,jdbcType=VARCHAR}
  226. </select>
  227. <select id="selectEffectiveDeparts" resultMap="DeptResultMap" parameterType="java.lang.String" >
  228. select
  229. DD_DepDm departno , DD_DepName departname
  230. from dic_department WHERE DD_DepDm in (SELECT DD_DepDm from inp_patient WHERE DW_WardDm = #{departNo,jdbcType=VARCHAR} and IP_Status = #{status,jdbcType=VARCHAR} GROUP BY DD_DepDm)
  231. </select>
  232. <select id="selectAllWardsByHiId" resultMap="DeptResultMap">
  233. select
  234. DW_WardDm departno , DW_WardName departname
  235. from dic_ward
  236. where HI_ID = #{hiId,jdbcType=INTEGER}
  237. </select>
  238. <select id="selectAllHiId" resultMap="BaseResultMap">
  239. select
  240. <include refid="Base_Column_List" />
  241. from dic_ward
  242. where HI_ID in
  243. <foreach collection="list" item="item" separator="," index="index" open="(" close=")">
  244. #{item,jdbcType=INTEGER}
  245. </foreach>
  246. </select>
  247. <select id="selectAllWard" resultMap="BaseResultMap">
  248. select
  249. DW_WardDm, DW_WardName
  250. from dic_ward
  251. where DW_WardDm in
  252. <foreach collection="list" item="item" separator="," index="index" open="(" close=")">
  253. #{item,jdbcType=INTEGER}
  254. </foreach>
  255. </select>
  256. </mapper>