MedClickInfoMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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.MedClickInfoMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.MedClickInfo">
  6. <id column="id" property="id"/>
  7. <result column="hospital_id" property="hospitalId"/>
  8. <result column="dept_id" property="deptId"/>
  9. <result column="dept_name" property="deptName"/>
  10. <result column="doctor_id" property="doctorId"/>
  11. <result column="doctor_name" property="doctorName"/>
  12. <result column="opt_type" property="optType"/>
  13. <result column="qcresult_info_id" property="qcresultInfoId"/>
  14. <result column="behospital_code" property="behospitalCode"/>
  15. <result column="is_deleted" property="isDeleted"/>
  16. <result column="gmt_create" property="gmtCreate"/>
  17. <result column="gmt_modified" property="gmtModified"/>
  18. <result column="creator" property="creator"/>
  19. <result column="modifier" property="modifier"/>
  20. </resultMap>
  21. <resultMap id="entryDefectImproveMap" type="com.diagbot.dto.EntryDefectImprove">
  22. <result column="deptId" property="deptId"/>
  23. <result column="deptName" property="deptName"/>
  24. <collection property="behospitalCodeInfos"
  25. ofType="com.diagbot.dto.BehospitalCodeInfo">
  26. <result column="behospitalCode" property="behospitalCode"/>
  27. <collection property="qcResultDetailInfos" ofType="com.diagbot.dto.QcResultDetailInfo">
  28. <result column="CasesEntryIds" property="CasesEntryIds"/>
  29. </collection>
  30. </collection>
  31. </resultMap>
  32. <resultMap id="ExportExcelMap" type="com.diagbot.dto.ExportExcelDTO">
  33. <result column="deptName" property="behDeptName"/>
  34. <result column="avgScore" property="avgScore"/>
  35. <collection property="excelBehospitalDTOS"
  36. ofType="com.diagbot.dto.ExportExcelBehospitalDTO">
  37. <result column="doctorName" property="doctorName"/>
  38. <result column="NAME" property="patName"/>
  39. <result column="behospitalCode" property="behospitalCode"/>
  40. <result column="behospitalDate" property="behospitalDate"/>
  41. <result column="leaveHospitalDate" property="leaveHospitalDate"/>
  42. <result column="scoreRes" property="score"/>
  43. <result column="scoreBn" property="scoreBn"/>
  44. <collection property="exportExcelCaseDTOS" ofType="com.diagbot.dto.ExportExcelCaseDTO">
  45. <result column="casesName" property="caseName"/>
  46. <collection property="exportExcelMsgDTOS"
  47. ofType="com.diagbot.dto.ExportExcelMsgDTO">
  48. <result column="entryName" property="msg"/>
  49. </collection>
  50. </collection>
  51. </collection>
  52. </resultMap>
  53. <resultMap id="entryDefectImproveInnerMap" type="com.diagbot.dto.EntryDefectImproveInner">
  54. <result column="behDeptName" property="behDeptName"/>
  55. <collection property="behospitalCodeInfos" ofType="com.diagbot.dto.BehospitalCodeDetail">
  56. <result column="behospitalCode" property="behospitalCode"/>
  57. <result column="name" property="name"/>
  58. <result column="fileCode" property="fileCode"/>
  59. <result column="behospitalDate" property="behospitalDate"/>
  60. <result column="leaveHospitalDate" property="leaveHospitalDate"/>
  61. <result column="doctorName" property="doctorName"/>
  62. <result column="age" property="age"/>
  63. <result column="level" property="level"/>
  64. <result column="scoreRes" property="scoreRes"/>
  65. <result column="gradeTime" property="gradeTime"/>
  66. <collection property="qcResultDetailInfos" ofType="com.diagbot.dto.QcResultDetailInfo">
  67. <result column="CasesEntryIds" property="CasesEntryIds"/>
  68. </collection>
  69. </collection>
  70. </resultMap>
  71. <resultMap id="entryDefectImproveInnerExportMap" type="com.diagbot.dto.EntryDefectImproveInnerExport">
  72. <result column="deptId" property="deptId"/>
  73. <result column="deptName" property="deptName"/>
  74. <collection property="entryDefectImproveInnerDoctors" ofType="com.diagbot.dto.EntryDefectImproveInnerDoctor">
  75. <result column="doctorId" property="doctorId"/>
  76. <result column="doctorName" property="doctorName"/>
  77. <collection property="behospitalCodeInfos" ofType="com.diagbot.dto.BehospitalCodeInfo">
  78. <result column="behospitalCode" property="behospitalCode"/>
  79. <collection property="qcResultDetailInfos" ofType="com.diagbot.dto.QcResultDetailInfo">
  80. <result column="CasesEntryIds" property="CasesEntryIds"/>
  81. </collection>
  82. </collection>
  83. </collection>
  84. </resultMap>
  85. <select id="getQcClick" resultType="com.diagbot.dto.GetQcClickDTO">
  86. SELECT
  87. a.dept_id AS deptId,
  88. a.dept_name AS deptName,
  89. sum(a.opt_type = 0) AS singleModeNum,
  90. sum(a.opt_type = 1) AS totalModeNum
  91. FROM
  92. med_click_info a
  93. where
  94. a.is_deleted = 'N'
  95. <if test="hospitalId != null">
  96. and a.hospital_id = #{hospitalId}
  97. </if>
  98. <if test="deptName != null and deptName != ''">
  99. and a.dept_name like CONCAT('%',#{deptName},'%')
  100. </if>
  101. <if test="startDate != null">
  102. <![CDATA[ and a.gmt_create >= #{startDate}]]>
  103. </if>
  104. <if test="endDate != null">
  105. <![CDATA[ and a.gmt_create < #{endDate}]]>
  106. </if>
  107. group by
  108. a.dept_id,
  109. a.dept_name
  110. <if test="asc != null and asc !=''">
  111. order by
  112. <choose>
  113. <when test='asc=="singleModeNum"'>singleModeNum asc</when>
  114. <when test='asc=="totalModeNum"'>totalModeNum asc</when>
  115. </choose>
  116. </if>
  117. <if test="desc != null and desc !=''">
  118. order by
  119. <choose>
  120. <when test='desc=="singleModeNum"'>singleModeNum desc</when>
  121. <when test='desc=="totalModeNum"'>totalModeNum desc</when>
  122. </choose>
  123. </if>
  124. </select>
  125. <select id="getQcClickInnerPage" resultType="com.diagbot.dto.GetQcClickInnerPageDTO">
  126. SELECT
  127. a.dept_id as deptId,
  128. a.dept_name as deptName,
  129. a.doctor_id AS doctorId,
  130. a.doctor_name AS doctorName,
  131. count(case when a.opt_type = 0 then 1 end) AS singleModeNum,
  132. count(case when a.opt_type = 1 then 1 end) AS totalModeNum
  133. FROM
  134. med_click_info a
  135. where
  136. a.is_deleted = 'N'
  137. <if test="hospitalId != null">
  138. and a.hospital_id = #{hospitalId}
  139. </if>
  140. <if test="deptName != null and deptName != ''">
  141. and a.dept_name =#{deptName}
  142. </if>
  143. <if test="deptId != null and deptId != ''">
  144. and a.dept_id= #{deptId}
  145. </if>
  146. <if test="doctorId != null and doctorId != ''">
  147. and a.doctor_id like CONCAT('%',#{doctorId},'%')
  148. </if>
  149. <if test="doctorName != null and doctorName != ''">
  150. and a.doctor_name like CONCAT('%',#{doctorName},'%')
  151. </if>
  152. <if test="startDate != null">
  153. <![CDATA[ and a.gmt_create >= #{startDate}]]>
  154. </if>
  155. <if test="endDate != null">
  156. <![CDATA[ and a.gmt_create < #{endDate}]]>
  157. </if>
  158. group by
  159. a.dept_id,
  160. a.dept_name,
  161. a.doctor_id,
  162. a.doctor_name
  163. </select>
  164. <select id="getEntryInfo" resultType="com.diagbot.dto.GetEntryInfoDTO">
  165. SELECT
  166. a.id AS casesId,
  167. a. NAME AS casesName,
  168. b.id AS entryId,
  169. b. NAME AS entryName
  170. FROM
  171. qc_cases a,
  172. qc_cases_entry b
  173. WHERE
  174. a.is_deleted = 'N'
  175. AND b.is_deleted = 'N'
  176. AND a.id = b.cases_id
  177. </select>
  178. <select id="getEntryDefectImprove" resultMap="entryDefectImproveMap">
  179. SELECT
  180. b.hospital_id as hospitalId,
  181. b.beh_dept_id as deptId,
  182. b.beh_dept_name as deptName,
  183. b.behospital_code as behospitalCode,
  184. ifnull(a.cases_entry_ids,0) as casesEntryIds
  185. FROM
  186. med_qcresult_click a,
  187. med_behospital_info b
  188. WHERE
  189. a.is_deleted = 'N'
  190. AND b.is_deleted = 'N'
  191. AND a.hospital_id =b.hospital_id
  192. AND a.behospital_code =b.behospital_code
  193. <if test="hospitalId != null and hospitalId != ''">
  194. AND b.hospital_id = #{hospitalId}
  195. </if>
  196. <if test="deptName != null and deptName != ''">
  197. and b.beh_dept_name like CONCAT('%',#{deptName},'%')
  198. </if>
  199. <if test="startDate != null and startDate != ''">
  200. <![CDATA[ AND a.gmt_create >= #{startDate}]]>
  201. </if>
  202. <if test="endDate != null and endDate != ''">
  203. <![CDATA[ AND a.gmt_create <= #{endDate}]]>
  204. </if>
  205. order by a.gmt_create
  206. </select>
  207. <select id="getEntryDefectImproveInner" resultMap="entryDefectImproveInnerMap">
  208. SELECT
  209. t.*,
  210. IF( n.age IS NULL,NULL,CONCAT(ifnull(n.age, ''),ifnull(n.age_unit, ''))) AS age
  211. from (
  212. SELECT
  213. b.hospital_id as hospitalId,
  214. b.beh_dept_id as deptId,
  215. b.beh_dept_name as behDeptName,
  216. b.file_code AS fileCode,
  217. b.behospital_code as behospitalCode,
  218. b.name,
  219. b.behospital_date AS behospitalDate,
  220. b.leave_hospital_date AS leaveHospitalDate,
  221. b.doctor_id AS doctorId,
  222. b.doctor_name AS doctorName,
  223. ifnull(c. level, '未评分') AS `level`,
  224. c.score_res AS scoreRes,
  225. c.gmt_create AS gradeTime,
  226. ifnull(a.cases_entry_ids,0) as casesEntryIds
  227. FROM
  228. med_qcresult_click a,
  229. med_behospital_info b,
  230. med_qcresult_info c
  231. WHERE
  232. a.is_deleted = 'N'
  233. AND b.is_deleted = 'N'
  234. AND c.is_deleted = 'N'
  235. AND a.hospital_id =b.hospital_id
  236. AND a.hospital_id =c.hospital_id
  237. AND a.behospital_code =b.behospital_code
  238. AND a.behospital_code =c.behospital_code
  239. <if test="hospitalId != null and hospitalId != ''">
  240. AND b.hospital_id = #{hospitalId}
  241. </if>
  242. <if test="deptId != null and deptId != ''">
  243. and b.beh_dept_id = #{deptId}
  244. </if>
  245. <if test="deptName != null and deptName != ''">
  246. and b.beh_dept_name = #{deptName}
  247. </if>
  248. <if test="patName != null and patName != ''">
  249. and b.name like CONCAT('%',#{patName},'%')
  250. </if>
  251. <if test="behospitalCode != null and behospitalCode != ''">
  252. and b.behospital_code like CONCAT('%',#{behospitalCode},'%')
  253. </if>
  254. <if test="doctorId != null and doctorId != ''">
  255. and b.doctor_id like CONCAT('%',#{doctorId},'%')
  256. </if>
  257. <if test="doctorName != null and doctorName != ''">
  258. and b.doctor_name like CONCAT('%',#{doctorName},'%')
  259. </if>
  260. <if test="level != null and level != ''">
  261. and c.level = #{level}
  262. </if>
  263. <if test="startDate != null and startDate != ''">
  264. <![CDATA[ AND a.gmt_create >= #{startDate}]]>
  265. </if>
  266. <if test="endDate != null and endDate != ''">
  267. <![CDATA[ AND a.gmt_create <= #{endDate}]]>
  268. </if>
  269. order by a.gmt_create
  270. )t LEFT JOIN med_home_page n
  271. ON t.hospitalId = n.hospital_id
  272. AND t.behospitalCode = n.behospital_code
  273. AND n.is_deleted = 'N'
  274. </select>
  275. <select id="getEntryDefectImproveDept" resultMap="entryDefectImproveInnerExportMap">
  276. SELECT
  277. b.hospital_id as hospitalId,
  278. b.beh_dept_id as deptId,
  279. b.beh_dept_name as deptName,
  280. b.behospital_code as behospitalCode,
  281. b.doctor_id AS doctorId,
  282. b.doctor_name AS doctorName,
  283. ifnull(a.cases_entry_ids,0) as casesEntryIds
  284. FROM
  285. med_qcresult_click a,
  286. med_behospital_info b
  287. WHERE
  288. a.is_deleted = 'N'
  289. AND b.is_deleted = 'N'
  290. AND a.hospital_id =b.hospital_id
  291. AND a.behospital_code =b.behospital_code
  292. <if test="hospitalId != null and hospitalId != ''">
  293. AND b.hospital_id = #{hospitalId}
  294. </if>
  295. <if test="deptId != null and deptId != ''">
  296. and b.beh_dept_id = #{deptId}
  297. </if>
  298. <if test="deptName != null and deptName != ''">
  299. and b.beh_dept_name = #{deptName}
  300. </if>
  301. <if test="doctorId != null and doctorId != ''">
  302. and b.doctor_id like CONCAT('%',#{doctorId},'%')
  303. </if>
  304. <if test="doctorName != null and doctorName != ''">
  305. and b.doctor_name like CONCAT('%',#{doctorName},'%')
  306. </if>
  307. <if test="startDate != null and startDate != ''">
  308. <![CDATA[ AND a.gmt_create >= #{startDate}]]>
  309. </if>
  310. <if test="endDate != null and endDate != ''">
  311. <![CDATA[ AND a.gmt_create <= #{endDate}]]>
  312. </if>
  313. order by a.gmt_create
  314. </select>
  315. </mapper>