DivisionMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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.sqlservermapper.DivisionMapper" >
  4. <resultMap id="BaseResultMap" type="com.xinxin.topro.pubservice.sqlservermodel.Division" >
  5. <id column="DivNo" property="divno" jdbcType="VARCHAR" />
  6. <result column="DivCode" property="divcode" jdbcType="VARCHAR" />
  7. <result column="DivName" property="divname" jdbcType="VARCHAR" />
  8. <result column="DivEngName" property="divengname" jdbcType="VARCHAR" />
  9. <result column="DeptNo" property="deptno" jdbcType="VARCHAR" />
  10. <result column="IsVirtual" property="isvirtual" jdbcType="BIT" />
  11. <result column="IsConsultation" property="isconsultation" jdbcType="BIT" />
  12. <result column="DivType" property="divtype" jdbcType="VARCHAR" />
  13. <result column="UpdateUser" property="updateuser" jdbcType="VARCHAR" />
  14. <result column="UpdateTime" property="updatetime" jdbcType="TIMESTAMP" />
  15. <result column="Keyword1" property="keyword1" jdbcType="VARCHAR" />
  16. <result column="Keyword2" property="keyword2" jdbcType="VARCHAR" />
  17. <result column="Keyword3" property="keyword3" jdbcType="VARCHAR" />
  18. <result column="IsIss" property="isiss" jdbcType="INTEGER" />
  19. <result column="OpdUseType" property="opdusetype" jdbcType="VARCHAR" />
  20. <result column="InpUseType" property="inpusetype" jdbcType="VARCHAR" />
  21. <result column="EmgUseType" property="emgusetype" jdbcType="VARCHAR" />
  22. <result column="Zone" property="zone" jdbcType="VARCHAR" />
  23. <result column="OpdDrugDays" property="opddrugdays" jdbcType="INTEGER" />
  24. <result column="MedDivNo" property="meddivno" jdbcType="VARCHAR" />
  25. </resultMap>
  26. <resultMap id="DeptResultMap" type="com.xinxin.topro.pubservice.sqlservermodel.Depart" >
  27. <result column="DivCode" property="departno" jdbcType="VARCHAR" />
  28. <result column="DivName" property="departname" jdbcType="VARCHAR" />
  29. </resultMap>
  30. <sql id="Base_Column_List" >
  31. DivNo, DivCode, DivName, DivEngName, DeptNo, IsVirtual, IsConsultation, DivType,
  32. UpdateUser, UpdateTime, Keyword1, Keyword2, Keyword3, IsIss, OpdUseType, InpUseType,
  33. EmgUseType, Zone, OpdDrugDays, MedDivNo
  34. </sql>
  35. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  36. select
  37. <include refid="Base_Column_List" />
  38. from Division
  39. where DivNo = #{divno,jdbcType=VARCHAR}
  40. </select>
  41. <select id="selectAuthorityDivisions" resultMap="DeptResultMap" parameterType="java.lang.String" >
  42. select DISTINCT
  43. DivNo departno ,DivDepartName departname
  44. from EmpDivision a INNER JOIN Employee b on a.empno = b.empno where a.DivDepartFlag = '科室' and EmpCode = #{userCode,jdbcType=VARCHAR}
  45. </select>
  46. <select id="selectAllDivision" resultMap="DeptResultMap">
  47. select
  48. DivNo departno , divName departname
  49. from Division
  50. </select>
  51. <select id="selectAuthorityWards" resultMap="DeptResultMap" parameterType="java.lang.String" >
  52. select DISTINCT
  53. DivNo departno ,DivDepartName departname
  54. from EmpDivision a INNER JOIN Employee b on a.empno = b.empno where a.DivDepartFlag = '病区' and EmpCode = #{userCode,jdbcType=VARCHAR}
  55. </select>
  56. <select id="selectAllWards" resultMap="DeptResultMap">
  57. select
  58. departno , departname
  59. from V_WARD
  60. </select>
  61. <select id="selectEffectiveDeparts" resultMap="DeptResultMap" parameterType="java.lang.String" >
  62. select
  63. DivNo departno , divName departname
  64. from Division WHERE DivNo in (SELECT DivNo from InPatient WHERE departNo = #{departNo,jdbcType=VARCHAR} and inHospitalStatus = #{status,jdbcType=VARCHAR} GROUP BY DivNo)
  65. </select>
  66. <select id="selectAll" resultMap="DeptResultMap" parameterType="java.lang.String" >
  67. select
  68. departno , departname
  69. from Depart
  70. </select>
  71. <select id="selectByName" resultMap="DeptResultMap" parameterType="java.lang.String" >
  72. select
  73. departno , departname
  74. from Depart where departName like CONCAT(#{departName,jdbcType=VARCHAR},'%')
  75. </select>
  76. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  77. delete from Division
  78. where DivNo = #{divno,jdbcType=VARCHAR}
  79. </delete>
  80. <insert id="insert" parameterType="com.xinxin.topro.pubservice.sqlservermodel.Division" >
  81. insert into Division (DivNo, DivCode, DivName,
  82. DivEngName, DeptNo, IsVirtual,
  83. IsConsultation, DivType, UpdateUser,
  84. UpdateTime, Keyword1, Keyword2,
  85. Keyword3, IsIss, OpdUseType,
  86. InpUseType, EmgUseType, Zone,
  87. OpdDrugDays, MedDivNo)
  88. values (#{divno,jdbcType=VARCHAR}, #{divcode,jdbcType=VARCHAR}, #{divname,jdbcType=VARCHAR},
  89. #{divengname,jdbcType=VARCHAR}, #{deptno,jdbcType=VARCHAR}, #{isvirtual,jdbcType=BIT},
  90. #{isconsultation,jdbcType=BIT}, #{divtype,jdbcType=VARCHAR}, #{updateuser,jdbcType=VARCHAR},
  91. #{updatetime,jdbcType=TIMESTAMP}, #{keyword1,jdbcType=VARCHAR}, #{keyword2,jdbcType=VARCHAR},
  92. #{keyword3,jdbcType=VARCHAR}, #{isiss,jdbcType=INTEGER}, #{opdusetype,jdbcType=VARCHAR},
  93. #{inpusetype,jdbcType=VARCHAR}, #{emgusetype,jdbcType=VARCHAR}, #{zone,jdbcType=VARCHAR},
  94. #{opddrugdays,jdbcType=INTEGER}, #{meddivno,jdbcType=VARCHAR})
  95. </insert>
  96. <insert id="insertSelective" parameterType="com.xinxin.topro.pubservice.sqlservermodel.Division" >
  97. insert into Division
  98. <trim prefix="(" suffix=")" suffixOverrides="," >
  99. <if test="divno != null" >
  100. DivNo,
  101. </if>
  102. <if test="divcode != null" >
  103. DivCode,
  104. </if>
  105. <if test="divname != null" >
  106. DivName,
  107. </if>
  108. <if test="divengname != null" >
  109. DivEngName,
  110. </if>
  111. <if test="deptno != null" >
  112. DeptNo,
  113. </if>
  114. <if test="isvirtual != null" >
  115. IsVirtual,
  116. </if>
  117. <if test="isconsultation != null" >
  118. IsConsultation,
  119. </if>
  120. <if test="divtype != null" >
  121. DivType,
  122. </if>
  123. <if test="updateuser != null" >
  124. UpdateUser,
  125. </if>
  126. <if test="updatetime != null" >
  127. UpdateTime,
  128. </if>
  129. <if test="keyword1 != null" >
  130. Keyword1,
  131. </if>
  132. <if test="keyword2 != null" >
  133. Keyword2,
  134. </if>
  135. <if test="keyword3 != null" >
  136. Keyword3,
  137. </if>
  138. <if test="isiss != null" >
  139. IsIss,
  140. </if>
  141. <if test="opdusetype != null" >
  142. OpdUseType,
  143. </if>
  144. <if test="inpusetype != null" >
  145. InpUseType,
  146. </if>
  147. <if test="emgusetype != null" >
  148. EmgUseType,
  149. </if>
  150. <if test="zone != null" >
  151. Zone,
  152. </if>
  153. <if test="opddrugdays != null" >
  154. OpdDrugDays,
  155. </if>
  156. <if test="meddivno != null" >
  157. MedDivNo,
  158. </if>
  159. </trim>
  160. <trim prefix="values (" suffix=")" suffixOverrides="," >
  161. <if test="divno != null" >
  162. #{divno,jdbcType=VARCHAR},
  163. </if>
  164. <if test="divcode != null" >
  165. #{divcode,jdbcType=VARCHAR},
  166. </if>
  167. <if test="divname != null" >
  168. #{divname,jdbcType=VARCHAR},
  169. </if>
  170. <if test="divengname != null" >
  171. #{divengname,jdbcType=VARCHAR},
  172. </if>
  173. <if test="deptno != null" >
  174. #{deptno,jdbcType=VARCHAR},
  175. </if>
  176. <if test="isvirtual != null" >
  177. #{isvirtual,jdbcType=BIT},
  178. </if>
  179. <if test="isconsultation != null" >
  180. #{isconsultation,jdbcType=BIT},
  181. </if>
  182. <if test="divtype != null" >
  183. #{divtype,jdbcType=VARCHAR},
  184. </if>
  185. <if test="updateuser != null" >
  186. #{updateuser,jdbcType=VARCHAR},
  187. </if>
  188. <if test="updatetime != null" >
  189. #{updatetime,jdbcType=TIMESTAMP},
  190. </if>
  191. <if test="keyword1 != null" >
  192. #{keyword1,jdbcType=VARCHAR},
  193. </if>
  194. <if test="keyword2 != null" >
  195. #{keyword2,jdbcType=VARCHAR},
  196. </if>
  197. <if test="keyword3 != null" >
  198. #{keyword3,jdbcType=VARCHAR},
  199. </if>
  200. <if test="isiss != null" >
  201. #{isiss,jdbcType=INTEGER},
  202. </if>
  203. <if test="opdusetype != null" >
  204. #{opdusetype,jdbcType=VARCHAR},
  205. </if>
  206. <if test="inpusetype != null" >
  207. #{inpusetype,jdbcType=VARCHAR},
  208. </if>
  209. <if test="emgusetype != null" >
  210. #{emgusetype,jdbcType=VARCHAR},
  211. </if>
  212. <if test="zone != null" >
  213. #{zone,jdbcType=VARCHAR},
  214. </if>
  215. <if test="opddrugdays != null" >
  216. #{opddrugdays,jdbcType=INTEGER},
  217. </if>
  218. <if test="meddivno != null" >
  219. #{meddivno,jdbcType=VARCHAR},
  220. </if>
  221. </trim>
  222. </insert>
  223. <update id="updateByPrimaryKeySelective" parameterType="com.xinxin.topro.pubservice.sqlservermodel.Division" >
  224. update Division
  225. <set >
  226. <if test="divcode != null" >
  227. DivCode = #{divcode,jdbcType=VARCHAR},
  228. </if>
  229. <if test="divname != null" >
  230. DivName = #{divname,jdbcType=VARCHAR},
  231. </if>
  232. <if test="divengname != null" >
  233. DivEngName = #{divengname,jdbcType=VARCHAR},
  234. </if>
  235. <if test="deptno != null" >
  236. DeptNo = #{deptno,jdbcType=VARCHAR},
  237. </if>
  238. <if test="isvirtual != null" >
  239. IsVirtual = #{isvirtual,jdbcType=BIT},
  240. </if>
  241. <if test="isconsultation != null" >
  242. IsConsultation = #{isconsultation,jdbcType=BIT},
  243. </if>
  244. <if test="divtype != null" >
  245. DivType = #{divtype,jdbcType=VARCHAR},
  246. </if>
  247. <if test="updateuser != null" >
  248. UpdateUser = #{updateuser,jdbcType=VARCHAR},
  249. </if>
  250. <if test="updatetime != null" >
  251. UpdateTime = #{updatetime,jdbcType=TIMESTAMP},
  252. </if>
  253. <if test="keyword1 != null" >
  254. Keyword1 = #{keyword1,jdbcType=VARCHAR},
  255. </if>
  256. <if test="keyword2 != null" >
  257. Keyword2 = #{keyword2,jdbcType=VARCHAR},
  258. </if>
  259. <if test="keyword3 != null" >
  260. Keyword3 = #{keyword3,jdbcType=VARCHAR},
  261. </if>
  262. <if test="isiss != null" >
  263. IsIss = #{isiss,jdbcType=INTEGER},
  264. </if>
  265. <if test="opdusetype != null" >
  266. OpdUseType = #{opdusetype,jdbcType=VARCHAR},
  267. </if>
  268. <if test="inpusetype != null" >
  269. InpUseType = #{inpusetype,jdbcType=VARCHAR},
  270. </if>
  271. <if test="emgusetype != null" >
  272. EmgUseType = #{emgusetype,jdbcType=VARCHAR},
  273. </if>
  274. <if test="zone != null" >
  275. Zone = #{zone,jdbcType=VARCHAR},
  276. </if>
  277. <if test="opddrugdays != null" >
  278. OpdDrugDays = #{opddrugdays,jdbcType=INTEGER},
  279. </if>
  280. <if test="meddivno != null" >
  281. MedDivNo = #{meddivno,jdbcType=VARCHAR},
  282. </if>
  283. </set>
  284. where DivNo = #{divno,jdbcType=VARCHAR}
  285. </update>
  286. <update id="updateByPrimaryKey" parameterType="com.xinxin.topro.pubservice.sqlservermodel.Division" >
  287. update Division
  288. set DivCode = #{divcode,jdbcType=VARCHAR},
  289. DivName = #{divname,jdbcType=VARCHAR},
  290. DivEngName = #{divengname,jdbcType=VARCHAR},
  291. DeptNo = #{deptno,jdbcType=VARCHAR},
  292. IsVirtual = #{isvirtual,jdbcType=BIT},
  293. IsConsultation = #{isconsultation,jdbcType=BIT},
  294. DivType = #{divtype,jdbcType=VARCHAR},
  295. UpdateUser = #{updateuser,jdbcType=VARCHAR},
  296. UpdateTime = #{updatetime,jdbcType=TIMESTAMP},
  297. Keyword1 = #{keyword1,jdbcType=VARCHAR},
  298. Keyword2 = #{keyword2,jdbcType=VARCHAR},
  299. Keyword3 = #{keyword3,jdbcType=VARCHAR},
  300. IsIss = #{isiss,jdbcType=INTEGER},
  301. OpdUseType = #{opdusetype,jdbcType=VARCHAR},
  302. InpUseType = #{inpusetype,jdbcType=VARCHAR},
  303. EmgUseType = #{emgusetype,jdbcType=VARCHAR},
  304. Zone = #{zone,jdbcType=VARCHAR},
  305. OpdDrugDays = #{opddrugdays,jdbcType=INTEGER},
  306. MedDivNo = #{meddivno,jdbcType=VARCHAR}
  307. where DivNo = #{divno,jdbcType=VARCHAR}
  308. </update>
  309. </mapper>