BizQuestionAnswerMapper.xml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="cn.tr.module.smart.common.repository.BizQuestionAnswerRepository">
  6. <select id="selectWebQuestionAnswerList" resultType="cn.tr.module.smart.web.vo.BizWebQuestionAnswerVO">
  7. SELECT
  8. bcr.id as id,
  9. bcr.patient_name as patientName,
  10. bcr.clinic_name as clinicName,
  11. bcr.dept_id as deptId,
  12. bcr.dept_name as deptName,
  13. bcr.clinic_start_time as clinicStartTime,
  14. bcr.clinic_end_time as clinicEndTime,
  15. bqa.id as answerId,
  16. bqa.question_type as questionType,
  17. bcr.patient_code as patientCode,
  18. bcr.create_time as create_time,
  19. bcr.create_by as create_by,
  20. bcr.update_time as update_time,
  21. bcr.update_by as update_by,
  22. bcr.patient_age as patientAge,
  23. bcr.patient_gender as patientGender,
  24. bcr.image_url as imageUrl
  25. FROM
  26. biz_clinic_room bcr
  27. JOIN biz_question_answer bqa ON bcr.ID = bqa.clinic_id
  28. JOIN biz_clinic_room_doctor_user bcrmu ON bcr.ID = bcrmu.clinic_room_id
  29. <where>
  30. <if test="query.condition != null">
  31. AND bcr.patient_name like concat('%',#{query.condition,jdbcType=VARCHAR},'%')
  32. OR bcr.clinic_name like concat('%',#{query.condition,jdbcType=VARCHAR},'%')
  33. </if>
  34. <if test="query.clinicTime != null and query.clinicTime.size() > 0">
  35. AND bcr.clinic_start_time &gt;= #{query.clinicTime[0]}
  36. </if>
  37. <if test="query.clinicTime != null and query.clinicTime.size() > 1">
  38. AND bcr.clinic_start_time &lt;= #{query.clinicTime[1]}
  39. </if>
  40. <if test="query.questionType != null">
  41. AND bqa.question_type = #{query.questionType}
  42. </if>
  43. <if test="query.deptId != null">
  44. AND bcr.dept_id = #{query.deptId}
  45. </if>
  46. <if test="query.userId != null">
  47. AND bcrmu.user_id = #{query.userId}
  48. </if>
  49. </where>
  50. </select>
  51. <select id="selectAnswerByClinicList"
  52. resultType="cn.tr.module.smart.web.dto.BizWebQuestionAnswerByClinicIdDTO">
  53. SELECT
  54. bqa.id AS questionId,
  55. bqg.name AS groupName,
  56. bqa.send_time as sendTime,
  57. bqa.answer_time as answerTime,
  58. bqa.id as answerId
  59. FROM
  60. biz_question_answer bqa
  61. JOIN biz_question_group bqg ON bqa.question_group_id = bqg.id
  62. <where>
  63. bqa.deleted = 0
  64. <if test="query.clinicId != null">
  65. AND bqa.clinic_id = #{query.clinicId}
  66. </if>
  67. <if test="query.questionType != null">
  68. AND bqa.question_type = #{query.questionType}
  69. </if>
  70. </where>
  71. </select>
  72. </mapper>