QcresultInfoMapper.xml 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  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.QcresultInfoMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.QcresultInfo">
  6. <id column="id" property="id" />
  7. <result column="behospital_code" property="behospitalCode" />
  8. <result column="hospital_id" property="hospitalId" />
  9. <result column="level" property="level" />
  10. <result column="score_res" property="scoreRes" />
  11. <result column="grade_type" property="gradeType" />
  12. <result column="is_deleted" property="isDeleted" />
  13. <result column="gmt_create" property="gmtCreate" />
  14. <result column="gmt_modified" property="gmtModified" />
  15. <result column="creator" property="creator" />
  16. <result column="modifier" property="modifier" />
  17. <result column="remark" property="remark" />
  18. </resultMap>
  19. <!-- 病历数统计 -->
  20. <select id="getQcresultSelectively" parameterType="com.diagbot.vo.QcresultFilterVO" resultType="int">
  21. SELECT
  22. count(1)
  23. FROM
  24. med_behospital_info a,
  25. med_home_page b,
  26. med_qcresult_info c
  27. WHERE
  28. a.hospital_id = b.hospital_id
  29. AND a.behospital_code = b.behospital_code
  30. AND a.hospital_id = c.hospital_id
  31. AND a.behospital_code = c.behospital_code
  32. AND a.is_deleted = 'N'
  33. AND b.is_deleted = 'N'
  34. AND c.is_deleted = 'N'
  35. <![CDATA[AND a.qc_type_id <>0 ]]>
  36. <if test="hospitalId != null and hospitalId != ''">
  37. AND a.hospital_id = #{hospitalId}
  38. </if>
  39. <if test="startDate != null and startDate != ''">
  40. <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
  41. </if>
  42. <if test="endDate != null and endDate != ''">
  43. <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
  44. </if>
  45. <if test="gradeType != null and gradeType != ''">
  46. AND c.grade_type = #{gradeType}
  47. </if>
  48. <if test="level != null and level != ''">
  49. AND c.level = #{level}
  50. </if>
  51. </select>
  52. <!-- 质控病历数统计 -->
  53. <select id="resultCount" parameterType="com.diagbot.vo.QcresultFilterVO" resultType="int">
  54. SELECT
  55. COUNT(*)
  56. FROM
  57. med_behospital_info a,
  58. med_home_page b,
  59. med_qcresult_info c
  60. WHERE
  61. a.is_deleted = 'N'
  62. AND b.is_deleted = 'N'
  63. AND c.is_deleted = 'N'
  64. AND a.hospital_id = b.hospital_id
  65. AND a.hospital_id = c.hospital_id
  66. AND a.behospital_code = b.behospital_code
  67. AND a.behospital_code = c.behospital_code
  68. <![CDATA[AND a.qc_type_id <>0 ]]>
  69. <if test="hospitalId != null and hospitalId != ''">
  70. AND a.hospital_id = #{hospitalId}
  71. </if>
  72. <if test="startDate != null and startDate != ''">
  73. <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
  74. </if>
  75. <if test="endDate != null and endDate != ''">
  76. <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
  77. </if>
  78. <if test="gradeType != null and gradeType != ''">
  79. AND c.grade_type = #{gradeType}
  80. </if>
  81. <if test="level != null and level != ''">
  82. AND c.level = #{level}
  83. </if>
  84. </select>
  85. <!-- 按科室统计质控病历数 -->
  86. <select id="levelPercentGroupByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.QcResultPercentDTO">
  87. SELECT
  88. a.beh_dept_id AS deptId,
  89. a.beh_dept_name AS deptName,
  90. count(*) AS totleNum,
  91. sum( c.`level` = '甲' ) AS firstLevelNum,
  92. sum( c.`level` = '乙' ) AS secondLevelNum,
  93. sum( c.`level` = '丙' ) AS thirdLevelNum,
  94. concat( ROUND( sum( c.`level` = '甲' )/ count(*)* 100, 2 ), '%' ) AS firstPercent,
  95. concat( ROUND( sum( c.`level` = '乙' )/ count(*)* 100, 2 ), '%' ) AS sencondPercent,
  96. concat( ROUND( sum( c.`level` = '丙' )/ count(*)* 100, 2 ), '%' ) AS thirdPercent
  97. FROM
  98. med_behospital_info a,
  99. med_home_page b,
  100. med_qcresult_info c
  101. WHERE
  102. a.is_deleted = 'N'
  103. AND b.is_deleted = 'N'
  104. AND c.is_deleted = 'N'
  105. AND a.hospital_id = b.hospital_id
  106. AND a.hospital_id = c.hospital_id
  107. AND a.behospital_code = b.behospital_code
  108. AND a.behospital_code = c.behospital_code
  109. <![CDATA[AND a.qc_type_id <>0 ]]>
  110. <if test="hospitalId != null and hospitalId != ''">
  111. AND a.hospital_id = #{hospitalId}
  112. </if>
  113. <if test="startDate != null and startDate != ''">
  114. <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
  115. </if>
  116. <if test="endDate != null and endDate != ''">
  117. <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
  118. </if>
  119. GROUP BY
  120. a.beh_dept_id,
  121. a.beh_dept_name
  122. </select>
  123. <!-- 按模块统计质控缺陷数 -->
  124. <select id="entryCountGroupByCase" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
  125. SELECT
  126. d.cases_id AS id,
  127. e.NAME AS name,
  128. count(*) AS num
  129. FROM
  130. med_behospital_info a,
  131. med_home_page b,
  132. med_qcresult_info c,
  133. med_qcresult_detail d,
  134. qc_cases e,
  135. qc_cases_entry f
  136. WHERE
  137. a.is_deleted = 'N'
  138. AND b.is_deleted = 'N'
  139. AND c.is_deleted = 'N'
  140. AND d.is_deleted = 'N'
  141. AND e.is_deleted = 'N'
  142. AND f.is_deleted = 'N'
  143. AND a.hospital_id = b.hospital_id
  144. AND a.hospital_id = c.hospital_id
  145. AND a.hospital_id = d.hospital_id
  146. AND a.behospital_code = b.behospital_code
  147. AND a.behospital_code = c.behospital_code
  148. AND a.behospital_code = d.behospital_code
  149. AND d.cases_id = e.id
  150. AND d.cases_entry_id = f.id
  151. AND e.id = f.cases_id
  152. <![CDATA[AND a.qc_type_id <>0 ]]>
  153. <if test="hospitalId != null and hospitalId != ''">
  154. AND a.hospital_id = #{hospitalId}
  155. </if>
  156. <if test="startDate != null and startDate != ''">
  157. <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
  158. </if>
  159. <if test="endDate != null and endDate != ''">
  160. <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
  161. </if>
  162. GROUP BY
  163. d.cases_id,
  164. e.`name`
  165. </select>
  166. <!-- 条目缺陷分组统计 -->
  167. <select id="entryCountGroupByEntry" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
  168. SELECT
  169. e.id,
  170. e.NAME,
  171. count(*) AS num
  172. FROM
  173. med_behospital_info a,
  174. med_home_page b,
  175. med_qcresult_info c,
  176. med_qcresult_detail d,
  177. qc_cases_entry e
  178. WHERE
  179. a.is_deleted = 'N'
  180. AND b.is_deleted = 'N'
  181. AND c.is_deleted = 'N'
  182. AND d.is_deleted = 'N'
  183. AND e.is_deleted = 'N'
  184. AND a.hospital_id = b.hospital_id
  185. AND a.hospital_id = c.hospital_id
  186. AND a.hospital_id = d.hospital_id
  187. AND a.behospital_code = b.behospital_code
  188. AND a.behospital_code = c.behospital_code
  189. AND a.behospital_code = d.behospital_code
  190. AND d.cases_id = e.cases_id
  191. AND d.cases_entry_id = e.id
  192. <![CDATA[AND a.qc_type_id <>0 ]]>
  193. <if test="hospitalId != null and hospitalId != ''">
  194. AND a.hospital_id = #{hospitalId}
  195. </if>
  196. <if test="startDate != null and startDate != ''">
  197. <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
  198. </if>
  199. <if test="endDate != null and endDate != ''">
  200. <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
  201. </if>
  202. GROUP BY
  203. e.id,
  204. e.NAME
  205. </select>
  206. <!-- 质控平均分按科室统计 -->
  207. <select id="getAverageScoreByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.AverageStatisticsDTO">
  208. SELECT
  209. a.beh_dept_id AS id,
  210. a.beh_dept_name AS name,
  211. ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 ) )), 2 ) AS totleValue,
  212. ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 ) ))/ count(*), 2 ) AS averageValue,
  213. count(*) AS num
  214. FROM
  215. med_behospital_info a,
  216. med_home_page b,
  217. med_qcresult_info c
  218. WHERE
  219. a.is_deleted = 'N'
  220. AND b.is_deleted = 'N'
  221. AND c.is_deleted = 'N'
  222. AND a.hospital_id = b.hospital_id
  223. AND a.hospital_id = c.hospital_id
  224. AND a.behospital_code = b.behospital_code
  225. AND a.behospital_code = c.behospital_code
  226. <![CDATA[AND a.qc_type_id <>0 ]]>
  227. <if test="hospitalId != null and hospitalId != ''">
  228. AND a.hospital_id = #{hospitalId}
  229. </if>
  230. <if test="startDate != null and startDate != ''">
  231. <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
  232. </if>
  233. <if test="endDate != null and endDate != ''">
  234. <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
  235. </if>
  236. GROUP BY
  237. a.beh_dept_id,
  238. a.beh_dept_name
  239. </select>
  240. <!-- 按科室统计质控病历数 -->
  241. <select id="resultCountByDept" parameterType="com.diagbot.vo.QcresultFilterVO" resultType="com.diagbot.dto.NumDTO">
  242. SELECT
  243. a.beh_dept_id AS id,
  244. a.beh_dept_name AS NAME,
  245. COUNT(*) AS num
  246. FROM
  247. med_behospital_info a,
  248. med_home_page b,
  249. med_qcresult_info c,
  250. sys_user_dept d
  251. WHERE
  252. a.is_deleted = 'N'
  253. AND b.is_deleted = 'N'
  254. AND c.is_deleted = 'N'
  255. AND d.is_deleted = 'N'
  256. AND a.hospital_id = b.hospital_id
  257. AND a.hospital_id = c.hospital_id
  258. AND a.hospital_id = d.hospital_id
  259. AND a.behospital_code = b.behospital_code
  260. AND a.behospital_code = c.behospital_code
  261. AND a.beh_dept_id = d.dept_id
  262. <![CDATA[AND a.qc_type_id <>0 ]]>
  263. <if test="userId!=null">
  264. AND d.user_id = #{userId}
  265. </if>
  266. <if test="hospitalId != null and hospitalId != ''">
  267. AND a.hospital_id = #{hospitalId}
  268. </if>
  269. <if test="startDate != null and startDate != ''">
  270. <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
  271. </if>
  272. <if test="endDate != null and endDate != ''">
  273. <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
  274. </if>
  275. <if test="gradeType != null and gradeType != ''">
  276. AND c.grade_type = #{gradeType}
  277. </if>
  278. <if test="level != null and level != ''">
  279. AND c.level = #{level}
  280. </if>
  281. GROUP BY
  282. a.beh_dept_id,
  283. a.beh_dept_name
  284. </select>
  285. <!-- 按模块统计质控缺陷数 -->
  286. <select id="entryCountGroupByCaseAndDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.DeptNumDTO">
  287. SELECT
  288. d.cases_id AS id,
  289. e.NAME AS NAME,
  290. a.beh_dept_id AS deptId,
  291. a.beh_dept_name AS deptName,
  292. count(*) AS num
  293. FROM
  294. med_behospital_info a,
  295. med_home_page b,
  296. med_qcresult_info c,
  297. med_qcresult_detail d,
  298. qc_cases e,
  299. qc_cases_entry f,
  300. sys_user_dept g
  301. WHERE
  302. a.is_deleted = 'N'
  303. AND b.is_deleted = 'N'
  304. AND c.is_deleted = 'N'
  305. AND d.is_deleted = 'N'
  306. AND e.is_deleted = 'N'
  307. AND f.is_deleted = 'N'
  308. AND g.is_deleted = 'N'
  309. AND a.hospital_id = b.hospital_id
  310. AND a.hospital_id = c.hospital_id
  311. AND a.hospital_id = d.hospital_id
  312. AND a.hospital_id = g.hospital_id
  313. AND a.behospital_code = b.behospital_code
  314. AND a.behospital_code = c.behospital_code
  315. AND a.behospital_code = d.behospital_code
  316. AND d.cases_id = e.id
  317. AND d.cases_entry_id = f.id
  318. AND e.id = f.cases_id
  319. AND a.beh_dept_id = g.dept_id
  320. <![CDATA[AND a.qc_type_id <>0 ]]>
  321. <if test="userId!=null">
  322. AND g.user_id = #{userId}
  323. </if>
  324. <if test="hospitalId != null and hospitalId != ''">
  325. AND a.hospital_id = #{hospitalId}
  326. </if>
  327. <if test="startDate != null and startDate != ''">
  328. <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
  329. </if>
  330. <if test="endDate != null and endDate != ''">
  331. <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
  332. </if>
  333. GROUP BY
  334. d.cases_id,
  335. e.`name`,
  336. a.beh_dept_id,
  337. a.beh_dept_name
  338. </select>
  339. <!-- 条目缺陷分组统计 -->
  340. <select id="entryCountGroupByEntryAndDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.DeptNumDTO">
  341. SELECT
  342. e.id,
  343. e.NAME,
  344. a.beh_dept_id AS deptId,
  345. a.beh_dept_name AS deptName,
  346. count(*) AS num
  347. FROM
  348. med_behospital_info a,
  349. med_home_page b,
  350. med_qcresult_info c,
  351. med_qcresult_detail d,
  352. qc_cases_entry e,
  353. sys_user_dept f
  354. WHERE
  355. a.is_deleted = 'N'
  356. AND b.is_deleted = 'N'
  357. AND c.is_deleted = 'N'
  358. AND d.is_deleted = 'N'
  359. AND e.is_deleted = 'N'
  360. AND f.is_deleted = 'N'
  361. AND a.hospital_id = b.hospital_id
  362. AND a.hospital_id = c.hospital_id
  363. AND a.hospital_id = d.hospital_id
  364. AND a.hospital_id = f.hospital_id
  365. AND a.behospital_code = b.behospital_code
  366. AND a.behospital_code = c.behospital_code
  367. AND a.behospital_code = d.behospital_code
  368. AND d.cases_id = e.cases_id
  369. AND d.cases_entry_id = e.id
  370. AND a.beh_dept_id = f.dept_id
  371. <![CDATA[AND a.qc_type_id <>0 ]]>
  372. <if test="userId!=null">
  373. AND f.user_id = #{userId}
  374. </if>
  375. <if test="hospitalId != null and hospitalId != ''">
  376. AND a.hospital_id = #{hospitalId}
  377. </if>
  378. <if test="startDate != null and startDate != ''">
  379. <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
  380. </if>
  381. <if test="endDate != null and endDate != ''">
  382. <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
  383. </if>
  384. GROUP BY
  385. e.id,
  386. e.NAME,
  387. a.beh_dept_id,
  388. a.beh_dept_name
  389. </select>
  390. <!-- 按模块统计质控缺陷数(分页) -->
  391. <select id="entryCountGroupByCasePage" resultType="com.diagbot.dto.NumDTO">
  392. SELECT
  393. t.id,
  394. t.`NAME`,
  395. t.num,
  396. t.totleNum,
  397. t.percent,
  398. t.percentStr
  399. FROM
  400. (
  401. SELECT
  402. t1.caseId AS id,
  403. t1.caseName AS NAME,
  404. t1.num AS num,
  405. t2.mrNum,
  406. t3.originalNum,
  407. t2.mrNum * t3.originalNum AS totleNum,
  408. ROUND( t1.num /( t2.mrNum * t3.originalNum ), 4 ) AS percent,
  409. CONCAT( ROUND( t1.num /( t2.mrNum * t3.originalNum )* 100, 2 ), '%' ) AS percentStr
  410. FROM
  411. (
  412. SELECT
  413. d.cases_id AS caseId,
  414. e.NAME AS caseName,
  415. count(*) AS num
  416. FROM
  417. med_behospital_info a,
  418. med_home_page b,
  419. med_qcresult_info c,
  420. med_qcresult_detail d,
  421. qc_cases e,
  422. qc_cases_entry f
  423. WHERE
  424. a.is_deleted = 'N'
  425. AND b.is_deleted = 'N'
  426. AND c.is_deleted = 'N'
  427. AND d.is_deleted = 'N'
  428. AND e.is_deleted = 'N'
  429. AND f.is_deleted = 'N'
  430. AND a.hospital_id = b.hospital_id
  431. AND a.hospital_id = c.hospital_id
  432. AND a.hospital_id = d.hospital_id
  433. AND a.behospital_code = b.behospital_code
  434. AND a.behospital_code = c.behospital_code
  435. AND a.behospital_code = d.behospital_code
  436. AND d.cases_id = e.id
  437. AND d.cases_entry_id = f.id
  438. AND e.id = f.cases_id
  439. <![CDATA[AND a.qc_type_id <>0 ]]>
  440. <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
  441. AND a.hospital_id = #{filterPageVO.hospitalId}
  442. </if>
  443. <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
  444. <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageVO.startDate})]]>
  445. </if>
  446. <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
  447. <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageVO.endDate})]]>
  448. </if>
  449. <if test="filterPageVO.name != null and filterPageVO.name != ''">
  450. AND e.name like CONCAT('%', #{filterPageVO.name},'%')
  451. </if>
  452. <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
  453. AND a.beh_dept_name like CONCAT('%', #{filterPageVO.deptName},'%')
  454. </if>
  455. GROUP BY
  456. d.cases_id,
  457. e.`name`
  458. ) t1,
  459. (
  460. SELECT
  461. COUNT(*) AS mrNum
  462. FROM
  463. med_behospital_info a,
  464. med_home_page b,
  465. med_qcresult_info c
  466. WHERE
  467. a.is_deleted = 'N'
  468. AND b.is_deleted = 'N'
  469. AND c.is_deleted = 'N'
  470. AND a.hospital_id = b.hospital_id
  471. AND a.hospital_id = c.hospital_id
  472. AND a.behospital_code = b.behospital_code
  473. AND a.behospital_code = c.behospital_code
  474. <![CDATA[AND a.qc_type_id <>0 ]]>
  475. <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
  476. AND a.hospital_id = #{filterPageVO.hospitalId}
  477. </if>
  478. <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
  479. <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageVO.startDate})]]>
  480. </if>
  481. <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
  482. <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageVO.endDate})]]>
  483. </if>
  484. <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
  485. AND a.beh_dept_name like CONCAT('%', #{filterPageVO.deptName},'%')
  486. </if>
  487. ) t2,
  488. (
  489. SELECT
  490. a.id AS caseId,
  491. a.NAME AS caseName,
  492. count(*) AS originalNum
  493. FROM
  494. qc_cases a,
  495. qc_cases_entry b
  496. WHERE
  497. a.is_deleted = 'N'
  498. AND b.is_deleted = 'N'
  499. AND a.id = b.cases_id
  500. <if test="filterPageVO.name != null and filterPageVO.name != ''">
  501. AND a.name like CONCAT('%', #{filterPageVO.name},'%')
  502. </if>
  503. GROUP BY
  504. a.id,
  505. a.`name`
  506. ) t3
  507. WHERE
  508. t1.caseId = t3.caseId
  509. AND t1.caseName = t3.caseName
  510. ORDER BY
  511. ROUND( t1.num /( t2.mrNum * t3.originalNum ), 4 ) DESC
  512. ) t
  513. </select>
  514. <!-- 缺陷详情(分页) -->
  515. <select id="entryCountGroupByEntryPage" resultType="com.diagbot.dto.CaseNumDTO">
  516. SELECT t.*
  517. FROM
  518. (SELECT
  519. t1.id,
  520. t1.NAME,
  521. t1.casesId,
  522. t1.casesName,
  523. count(*) AS num,
  524. t2.totleNum
  525. FROM
  526. (
  527. SELECT
  528. e.id AS id,
  529. e.NAME AS NAME,
  530. e.cases_id as casesId,
  531. e.cases_name as casesName
  532. FROM
  533. med_behospital_info a,
  534. med_home_page b,
  535. <if test="filterPageVO.casesId != null and filterPageVO.casesId ==243">
  536. med_qcresult_cases c,
  537. </if>
  538. <if test="filterPageVO.casesId == null or filterPageVO.casesId ==0">
  539. med_qcresult_info c,
  540. </if>
  541. med_qcresult_detail d,
  542. qc_cases_entry e
  543. WHERE
  544. a.is_deleted = 'N'
  545. AND b.is_deleted = 'N'
  546. AND c.is_deleted = 'N'
  547. AND d.is_deleted = 'N'
  548. and e.is_deleted='N'
  549. AND a.hospital_id = b.hospital_id
  550. AND a.hospital_id = c.hospital_id
  551. and a.hospital_id = d.hospital_id
  552. AND a.behospital_code = b.behospital_code
  553. AND a.behospital_code = c.behospital_code
  554. AND a.behospital_code = d.behospital_code
  555. <if test="filterPageVO.casesId != null and filterPageVO.casesId ==243">
  556. AND c.cases_id = d.cases_id
  557. </if>
  558. AND d.cases_id = e.cases_id
  559. AND d.cases_entry_id = e.id
  560. <![CDATA[AND a.qc_type_id <>0 ]]>
  561. <if test="filterPageVO.casesId != null and filterPageVO.casesId != 0">
  562. AND d.cases_id = #{filterPageVO.casesId}
  563. </if>
  564. <if test="filterPageVO.casesName != null and filterPageVO.casesName != ''">
  565. AND e.cases_name like CONCAT('%', #{filterPageVO.casesName},'%')
  566. </if>
  567. <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
  568. AND a.hospital_id = #{filterPageVO.hospitalId}
  569. </if>
  570. <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
  571. <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageVO.startDate})]]>
  572. </if>
  573. <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
  574. <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageVO.endDate})]]>
  575. </if>
  576. <if test="filterPageVO.name != null and filterPageVO.name != ''">
  577. AND e.name like CONCAT('%', #{filterPageVO.name},'%')
  578. </if>
  579. <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
  580. AND a.beh_dept_name like CONCAT('%', #{filterPageVO.deptName},'%')
  581. </if>
  582. ) t1,(
  583. SELECT
  584. count(*) AS totleNum
  585. FROM
  586. med_behospital_info a,
  587. med_home_page b,
  588. <if test="filterPageVO.casesId != null and filterPageVO.casesId ==243">
  589. med_qcresult_cases c,
  590. </if>
  591. <if test="filterPageVO.casesId == null or filterPageVO.casesId ==0">
  592. med_qcresult_info c,
  593. </if>
  594. med_qcresult_detail d,
  595. qc_cases_entry e
  596. WHERE
  597. a.is_deleted = 'N'
  598. AND b.is_deleted = 'N'
  599. AND c.is_deleted = 'N'
  600. AND d.is_deleted = 'N'
  601. and e.is_deleted='N'
  602. AND a.hospital_id = b.hospital_id
  603. AND a.hospital_id = c.hospital_id
  604. and a.hospital_id = d.hospital_id
  605. AND a.behospital_code = b.behospital_code
  606. AND a.behospital_code = c.behospital_code
  607. AND a.behospital_code = d.behospital_code
  608. <if test="filterPageVO.casesId != null and filterPageVO.casesId ==243">
  609. AND c.cases_id = d.cases_id
  610. </if>
  611. AND d.cases_id = e.cases_id
  612. AND d.cases_entry_id = e.id
  613. <![CDATA[AND a.qc_type_id <>0 ]]>
  614. <if test="filterPageVO.casesId != null and filterPageVO.casesId != 0">
  615. AND d.cases_id = #{filterPageVO.casesId}
  616. </if>
  617. <if test="filterPageVO.casesName != null and filterPageVO.casesName != ''">
  618. AND e.cases_name like CONCAT('%', #{filterPageVO.casesName},'%')
  619. </if>
  620. <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
  621. AND a.hospital_id = #{filterPageVO.hospitalId}
  622. </if>
  623. <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
  624. <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageVO.startDate})]]>
  625. </if>
  626. <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
  627. <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageVO.endDate})]]>
  628. </if>
  629. <if test="filterPageVO.name != null and filterPageVO.name != ''">
  630. AND e.name like CONCAT('%', #{filterPageVO.name},'%')
  631. </if>
  632. <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
  633. AND a.beh_dept_name like CONCAT('%', #{filterPageVO.deptName},'%')
  634. </if>
  635. ) t2
  636. GROUP BY
  637. t1.id,
  638. t1.NAME,
  639. t1.casesId,
  640. t1.casesName
  641. )t
  642. </select>
  643. <!-- 质控平均分按科室统计(分页) -->
  644. <select id="getAverageScoreByDeptPage" resultType="com.diagbot.dto.AverageStatisticsDTO">
  645. SELECT t.*
  646. FROM
  647. (SELECT
  648. a.beh_dept_id AS id,
  649. a.beh_dept_name AS name,
  650. ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 ) )), 2 ) AS totleValue,
  651. ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 ) ))/ count(*), 2 ) AS averageValue,
  652. count(*) AS num
  653. FROM
  654. med_behospital_info a,
  655. med_home_page b,
  656. med_qcresult_info c
  657. WHERE
  658. a.is_deleted = 'N'
  659. AND b.is_deleted = 'N'
  660. AND c.is_deleted = 'N'
  661. AND a.hospital_id = b.hospital_id
  662. AND a.hospital_id = c.hospital_id
  663. AND a.behospital_code = b.behospital_code
  664. AND a.behospital_code = c.behospital_code
  665. <![CDATA[AND a.qc_type_id <>0 ]]>
  666. <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
  667. AND a.hospital_id = #{filterPageVO.hospitalId}
  668. </if>
  669. <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
  670. <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageVO.startDate})]]>
  671. </if>
  672. <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
  673. <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageVO.endDate})]]>
  674. </if>
  675. <if test="filterPageVO.name != null and filterPageVO.name != ''">
  676. AND a.beh_dept_name like CONCAT('%', #{filterPageVO.name},'%')
  677. </if>
  678. GROUP BY
  679. a.beh_dept_id,
  680. a.beh_dept_name
  681. ORDER BY averageValue DESC ) t
  682. </select>
  683. <!-- 按科室统计质控病历数(分页) -->
  684. <select id="levelPercentGroupByDeptPage" resultType="com.diagbot.dto.QcResultPercentDTO">
  685. SELECT t.*
  686. FROM
  687. (SELECT
  688. a.beh_dept_id AS deptId,
  689. a.beh_dept_name AS deptName,
  690. count(*) AS totleNum,
  691. sum( c.`level` = '甲' ) AS firstLevelNum,
  692. sum( c.`level` = '乙' ) AS secondLevelNum,
  693. sum( c.`level` = '丙' ) AS thirdLevelNum,
  694. concat( ROUND( sum( c.`level` = '甲' )/ count(*)* 100, 2 ), '%' ) AS firstPercent,
  695. concat( ROUND( sum( c.`level` = '乙' )/ count(*)* 100, 2 ), '%' ) AS sencondPercent,
  696. concat( ROUND( sum( c.`level` = '丙' )/ count(*)* 100, 2 ), '%' ) AS thirdPercent
  697. FROM
  698. med_behospital_info a,
  699. med_home_page b,
  700. med_qcresult_info c
  701. WHERE
  702. a.is_deleted = 'N'
  703. AND b.is_deleted = 'N'
  704. AND c.is_deleted = 'N'
  705. AND a.hospital_id = b.hospital_id
  706. AND a.hospital_id = c.hospital_id
  707. AND a.behospital_code = b.behospital_code
  708. AND a.behospital_code = c.behospital_code
  709. <![CDATA[AND a.qc_type_id <>0 ]]>
  710. <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
  711. AND a.hospital_id = #{filterPageVO.hospitalId}
  712. </if>
  713. <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
  714. <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageVO.startDate})]]>
  715. </if>
  716. <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
  717. <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageVO.endDate})]]>
  718. </if>
  719. <if test="filterPageVO.name != null and filterPageVO.name != ''">
  720. AND a.beh_dept_name like CONCAT('%', #{filterPageVO.name},'%')
  721. </if>
  722. GROUP BY
  723. a.beh_dept_id,
  724. a.beh_dept_name
  725. order by ROUND( sum( c.`level` = '甲' )/ count(*)* 100, 2 ) DESC,
  726. ROUND( sum( c.`level` = '乙' )/ count(*)* 100, 2 ) DESC,
  727. ROUND( sum( c.`level` = '丙' )/ count(*)* 100, 2 ) DESC) t
  728. </select>
  729. <!-- 按模块统计质控缺陷数-科室(分页) -->
  730. <select id="entryCountGroupByCaseAndDeptPage" resultType="com.diagbot.dto.DeptNumDTO">
  731. SELECT
  732. t.id,
  733. t.`NAME`,
  734. t.num,
  735. t.totleNum,
  736. t.percent,
  737. t.percentStr
  738. FROM
  739. (
  740. SELECT
  741. t1.caseId AS id,
  742. t1.caseName AS NAME,
  743. t1.num AS num,
  744. t2.mrNum,
  745. t3.originalNum,
  746. t2.mrNum * t3.originalNum AS totleNum,
  747. ROUND( t1.num /( t2.mrNum * t3.originalNum ), 4 ) AS percent,
  748. CONCAT( ROUND( t1.num /( t2.mrNum * t3.originalNum )* 100, 2 ), '%' ) AS percentStr
  749. FROM
  750. (
  751. SELECT
  752. d.cases_id AS caseId,
  753. e.NAME AS caseName,
  754. a.beh_dept_id AS deptId,
  755. a.beh_dept_name AS deptName,
  756. count(*) AS num
  757. FROM
  758. med_behospital_info a,
  759. med_home_page b,
  760. med_qcresult_info c,
  761. med_qcresult_detail d,
  762. qc_cases e,
  763. qc_cases_entry f,
  764. sys_user_dept g
  765. WHERE
  766. a.is_deleted = 'N'
  767. AND b.is_deleted = 'N'
  768. AND c.is_deleted = 'N'
  769. AND d.is_deleted = 'N'
  770. AND e.is_deleted = 'N'
  771. AND f.is_deleted = 'N'
  772. AND g.is_deleted = 'N'
  773. AND a.hospital_id = b.hospital_id
  774. AND a.hospital_id = c.hospital_id
  775. AND a.hospital_id = d.hospital_id
  776. AND a.hospital_id = g.hospital_id
  777. AND a.behospital_code = b.behospital_code
  778. AND a.behospital_code = c.behospital_code
  779. AND a.behospital_code = d.behospital_code
  780. AND d.cases_id = e.id
  781. AND d.cases_entry_id = f.id
  782. AND e.id = f.cases_id
  783. AND a.beh_dept_id = g.dept_id
  784. <![CDATA[AND a.qc_type_id <>0 ]]>
  785. <if test="filterPageByDeptVO.userId!=null">
  786. AND g.user_id = #{filterPageByDeptVO.userId}
  787. </if>
  788. <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
  789. AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
  790. </if>
  791. <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
  792. <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageByDeptVO.startDate})]]>
  793. </if>
  794. <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
  795. <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageByDeptVO.endDate})]]>
  796. </if>
  797. <if test="filterPageByDeptVO.name != null and filterPageByDeptVO.name != ''">
  798. AND e.name like CONCAT('%', #{filterPageByDeptVO.name},'%')
  799. </if>
  800. <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
  801. AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
  802. </if>
  803. GROUP BY
  804. d.cases_id,
  805. e.`name`,
  806. a.beh_dept_id,
  807. a.beh_dept_name
  808. ) t1,
  809. (
  810. SELECT
  811. a.beh_dept_id AS deptId,
  812. a.beh_dept_name AS deptName,
  813. COUNT(*) AS mrNum
  814. FROM
  815. med_behospital_info a,
  816. med_home_page b,
  817. med_qcresult_info c,
  818. sys_user_dept d
  819. WHERE
  820. a.is_deleted = 'N'
  821. AND b.is_deleted = 'N'
  822. AND c.is_deleted = 'N'
  823. AND d.is_deleted = 'N'
  824. AND a.hospital_id = b.hospital_id
  825. AND a.hospital_id = c.hospital_id
  826. AND a.hospital_id = d.hospital_id
  827. AND a.behospital_code = b.behospital_code
  828. AND a.behospital_code = c.behospital_code
  829. AND a.beh_dept_id = d.dept_id
  830. <![CDATA[AND a.qc_type_id <>0 ]]>
  831. <if test="filterPageByDeptVO.userId!=null">
  832. AND d.user_id = #{filterPageByDeptVO.userId}
  833. </if>
  834. <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
  835. AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
  836. </if>
  837. <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
  838. <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageByDeptVO.startDate})]]>
  839. </if>
  840. <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
  841. <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageByDeptVO.endDate})]]>
  842. </if>
  843. <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
  844. AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
  845. </if>
  846. GROUP BY
  847. a.beh_dept_id,
  848. a.beh_dept_name
  849. ) t2,
  850. (
  851. SELECT
  852. a.id AS caseId,
  853. a.NAME AS caseName,
  854. count(*) AS originalNum
  855. FROM
  856. qc_cases a,
  857. qc_cases_entry b
  858. WHERE
  859. a.is_deleted = 'N'
  860. AND b.is_deleted = 'N'
  861. AND a.id = b.cases_id
  862. GROUP BY
  863. a.id,
  864. a.`name`
  865. ) t3
  866. WHERE
  867. t1.caseId = t3.caseId
  868. AND t1.caseName = t3.caseName
  869. AND t1.deptId = t2.deptId
  870. AND t1.deptName = t2.deptName
  871. ORDER BY
  872. ROUND( t1.num /( t2.mrNum * t3.originalNum ), 4 ) DESC
  873. ) t
  874. </select>
  875. <!-- 缺陷详情-科室(分页) -->
  876. <select id="entryCountGroupByEntryAndDeptPage" resultType="com.diagbot.dto.CaseAndDeptNumDTO">
  877. SELECT
  878. t.*
  879. FROM
  880. (
  881. SELECT
  882. t1.id,
  883. t1.NAME,
  884. t1.casesId,
  885. t1.casesName,
  886. t1.deptId,
  887. t1.deptName,
  888. count(*) AS num,
  889. t2.totleNum
  890. FROM
  891. (
  892. SELECT
  893. e.id,
  894. e.NAME,
  895. e.cases_id as casesId,
  896. e.cases_name as casesName,
  897. a.beh_dept_id AS deptId,
  898. a.beh_dept_name AS deptName
  899. FROM
  900. med_behospital_info a,
  901. med_home_page b,
  902. <if test="filterPageByDeptVO.casesId != null and filterPageByDeptVO.casesId ==243">
  903. med_qcresult_cases c,
  904. </if>
  905. <if test="filterPageByDeptVO.casesId == null or filterPageByDeptVO.casesId ==0">
  906. med_qcresult_info c,
  907. </if>
  908. med_qcresult_detail d,
  909. qc_cases_entry e,
  910. sys_user_dept f
  911. WHERE
  912. a.is_deleted = 'N'
  913. AND b.is_deleted = 'N'
  914. AND c.is_deleted = 'N'
  915. AND d.is_deleted = 'N'
  916. AND e.is_deleted = 'N'
  917. AND f.is_deleted = 'N'
  918. AND a.hospital_id = b.hospital_id
  919. AND a.hospital_id = c.hospital_id
  920. AND a.hospital_id = d.hospital_id
  921. AND a.hospital_id = f.hospital_id
  922. AND a.behospital_code = b.behospital_code
  923. AND a.behospital_code = c.behospital_code
  924. AND a.behospital_code = d.behospital_code
  925. <if test="filterPageByDeptVO.casesId != null and filterPageByDeptVO.casesId ==243">
  926. AND c.cases_id = d.cases_id
  927. </if>
  928. AND d.cases_id = e.cases_id
  929. AND d.cases_entry_id = e.id
  930. AND a.beh_dept_id = f.dept_id
  931. <![CDATA[AND a.qc_type_id <>0 ]]>
  932. <if test="filterPageByDeptVO.casesId != null and filterPageByDeptVO.casesId != 0">
  933. AND d.cases_id = #{filterPageByDeptVO.casesId}
  934. </if>
  935. <if test="filterPageByDeptVO.casesName != null and filterPageByDeptVO.casesName != ''">
  936. AND e.cases_name like CONCAT('%', #{filterPageByDeptVO.casesName},'%')
  937. </if>
  938. <if test="filterPageByDeptVO.userId!=null">
  939. AND f.user_id = #{filterPageByDeptVO.userId}
  940. </if>
  941. <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
  942. AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
  943. </if>
  944. <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
  945. <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageByDeptVO.startDate})]]>
  946. </if>
  947. <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
  948. <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageByDeptVO.endDate})]]>
  949. </if>
  950. <if test="filterPageByDeptVO.name != null and filterPageByDeptVO.name != ''">
  951. AND e.name like CONCAT('%', #{filterPageByDeptVO.name},'%')
  952. </if>
  953. <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
  954. AND a.beh_dept_name like CONCAT('%', #{filterPageByDeptVO.deptName},'%')
  955. </if>
  956. <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
  957. AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
  958. </if>
  959. ) t1,(
  960. SELECT
  961. count(*) AS totleNum
  962. FROM
  963. med_behospital_info a,
  964. med_home_page b,
  965. <if test="filterPageByDeptVO.casesId != null and filterPageByDeptVO.casesId ==243">
  966. med_qcresult_cases c,
  967. </if>
  968. <if test="filterPageByDeptVO.casesId == null or filterPageByDeptVO.casesId ==0">
  969. med_qcresult_info c,
  970. </if>
  971. med_qcresult_detail d,
  972. qc_cases_entry e,
  973. sys_user_dept f
  974. WHERE
  975. a.is_deleted = 'N'
  976. AND b.is_deleted = 'N'
  977. AND c.is_deleted = 'N'
  978. AND d.is_deleted = 'N'
  979. AND e.is_deleted = 'N'
  980. AND f.is_deleted = 'N'
  981. AND a.hospital_id = b.hospital_id
  982. AND a.hospital_id = c.hospital_id
  983. AND a.hospital_id = d.hospital_id
  984. AND a.hospital_id = f.hospital_id
  985. AND a.behospital_code = b.behospital_code
  986. AND a.behospital_code = c.behospital_code
  987. AND a.behospital_code = d.behospital_code
  988. <if test="filterPageByDeptVO.casesId != null and filterPageByDeptVO.casesId ==243">
  989. AND c.cases_id = d.cases_id
  990. </if>
  991. AND d.cases_id = e.cases_id
  992. AND d.cases_entry_id = e.id
  993. AND a.beh_dept_id = f.dept_id
  994. <![CDATA[AND a.qc_type_id <>0 ]]>
  995. <if test="filterPageByDeptVO.casesId != null and filterPageByDeptVO.casesId != 0">
  996. AND d.cases_id = #{filterPageByDeptVO.casesId}
  997. </if>
  998. <if test="filterPageByDeptVO.casesName != null and filterPageByDeptVO.casesName != ''">
  999. AND e.cases_name like CONCAT('%', #{filterPageByDeptVO.casesName},'%')
  1000. </if>
  1001. <if test="filterPageByDeptVO.userId!=null">
  1002. AND f.user_id = #{filterPageByDeptVO.userId}
  1003. </if>
  1004. <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
  1005. AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
  1006. </if>
  1007. <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
  1008. <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageByDeptVO.startDate})]]>
  1009. </if>
  1010. <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
  1011. <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageByDeptVO.endDate})]]>
  1012. </if>
  1013. <if test="filterPageByDeptVO.name != null and filterPageByDeptVO.name != ''">
  1014. AND e.name like CONCAT('%', #{filterPageByDeptVO.name},'%')
  1015. </if>
  1016. <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
  1017. AND a.beh_dept_name like CONCAT('%', #{filterPageByDeptVO.deptName},'%')
  1018. </if>
  1019. <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
  1020. AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
  1021. </if>
  1022. ) t2
  1023. GROUP BY
  1024. t1.id,
  1025. t1.NAME,
  1026. t1.casesId,
  1027. t1.casesName,
  1028. t1.deptId,
  1029. t1.deptName
  1030. )t
  1031. </select>
  1032. </mapper>