TranLogMapper.xml 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.TranLogMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.TranLog">
  6. <id column="id" property="id"/>
  7. <result column="is_deleted" property="isDeleted"/>
  8. <result column="gmt_create" property="gmtCreate"/>
  9. <result column="gmt_modified" property="gmtModified"/>
  10. <result column="creator" property="creator"/>
  11. <result column="modifier" property="modifier"/>
  12. <result column="patient_id" property="patientId"/>
  13. <result column="hospital_id" property="hospitalId"/>
  14. <result column="sub_hospital_code" property="subHospitalCode"/>
  15. <result column="sub_hospital_name" property="subHospitalName"/>
  16. <result column="scene_name" property="sceneName"/>
  17. <result column="params" property="params"/>
  18. <result column="result" property="result"/>
  19. <result column="gmt_req" property="gmtReq"/>
  20. <result column="gmt_resp" property="gmtResp"/>
  21. <result column="exec_time" property="execTime"/>
  22. <result column="success_flag" property="successFlag"/>
  23. </resultMap>
  24. <select id="getPage" resultType="com.diagbot.entity.TranLog">
  25. SELECT
  26. *
  27. FROM
  28. tran_log a
  29. WHERE
  30. a.is_deleted = 'N'
  31. <if test="tranLogPageVO.hospitalId != null">
  32. AND a.hospital_id = #{tranLogPageVO.hospitalId}
  33. </if>
  34. <if test="tranLogPageVO.deptName != null and tranLogPageVO.deptName !=''">
  35. AND a.dept_name = #{tranLogPageVO.deptName}
  36. </if>
  37. <if test="tranLogPageVO.patientId != null and tranLogPageVO.patientId != ''">
  38. AND a.patient_id LIKE CONCAT( '%', #{tranLogPageVO.patientId}, '%' )
  39. </if>
  40. <if test="tranLogPageVO.sceneName != null and tranLogPageVO.sceneName != ''">
  41. AND a.scene_name LIKE CONCAT( '%', #{tranLogPageVO.sceneName}, '%' )
  42. </if>
  43. <if test="tranLogPageVO.subHospitalName != null and tranLogPageVO.subHospitalName != ''">
  44. AND a.sub_hospital_name LIKE CONCAT( '%', #{tranLogPageVO.subHospitalName}, '%' )
  45. </if>
  46. <if test="tranLogPageVO.startGmtReq != null and tranLogPageVO.endGmtReq != null">
  47. AND DATE_FORMAT( a.gmt_req, '%Y-%m-%d %T' ) BETWEEN DATE_FORMAT(#{tranLogPageVO.startGmtReq}, '%Y-%m-%d %T'
  48. )
  49. AND DATE_FORMAT(#{tranLogPageVO.endGmtReq}, '%Y-%m-%d %T' )
  50. </if>
  51. <if test="tranLogPageVO.startGmtResp != null and tranLogPageVO.endGmtResp != null">
  52. AND DATE_FORMAT( a.gmt_resp, '%Y-%m-%d %T' ) BETWEEN DATE_FORMAT(#{tranLogPageVO.startGmtResp}, '%Y-%m-%d
  53. %T' )
  54. AND DATE_FORMAT(#{tranLogPageVO.endGmtResp}, '%Y-%m-%d %T' )
  55. </if>
  56. <if test="tranLogPageVO.successFlag != null">
  57. AND a.success_flag = #{tranLogPageVO.successFlag}
  58. </if>
  59. ORDER BY
  60. a.gmt_modified DESC
  61. </select>
  62. <select id="getStatisDeptAlls" resultType="com.diagbot.dto.TranDeptLogDTO">
  63. SELECT dept_name as deptName,
  64. COUNT(*) as sums
  65. FROM tran_log
  66. WHERE is_deleted = "N"
  67. <if test="hospitalId != null">
  68. AND hospital_id = #{hospitalId}
  69. </if>
  70. <if test="deptName != null and deptName !=''">
  71. AND dept_name = #{deptName}
  72. </if>
  73. <if test="startGmtReq != null and endGmtReq != null">
  74. AND DATE_FORMAT( gmt_req, '%Y-%m-%d %T' ) BETWEEN DATE_FORMAT(#{startGmtReq}, '%Y-%m-%d %T'
  75. )
  76. AND DATE_FORMAT(#{endGmtReq}, '%Y-%m-%d %T' )
  77. </if>
  78. GROUP BY dept_name order by sums desc
  79. </select>
  80. </mapper>