BizDeviceMapper.xml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.BizDeviceRepository">
  6. <resultMap id="deviceDto" type="cn.tr.module.smart.common.dto.BizDeviceDTO">
  7. <result property="deviceId" column="device_id"/>
  8. <result property="deviceType" column="device_type"/>
  9. <result property="patientName" column="patient_name"/>
  10. <result property="continueDose" column="continue_dose"/>
  11. <result property="totalDose" column="total_dose"/>
  12. <result property="remainDose" column="remain_dose"/>
  13. <result property="pcaTotalCount" column="pca_total_count"/>
  14. <result property="pcaInvalidCount" column="pca_invalid_count"/>
  15. <result property="pcaValidCount" column="pca_valid_count"/>
  16. <result property="electricQuantity" column="electric_quantity"/>
  17. </resultMap>
  18. <select id="selectDeviceList" resultMap="deviceDto">
  19. SELECT
  20. bd.device_id,
  21. bih.device_type,
  22. bcr.patient_name,
  23. bih.continue_dose,
  24. bih.total_dose,
  25. bih.remain_dose,
  26. bih.pca_total_count,
  27. bih.pca_invalid_count,
  28. bih.pca_valid_count,
  29. bih.electric_quantity
  30. FROM
  31. biz_device bd
  32. left JOIN biz_infusion_history bih ON bd.infusion_id = bih.ID
  33. left JOIN biz_infusion_clinic bic ON bih.ID = bic.infusion_id
  34. left JOIN biz_clinic_room bcr ON bic.clinic_id = bcr.ID
  35. <where>
  36. <if test="query.deviceType != null and query.deviceType != ''">
  37. and bih.device_type = #{query.deviceType}
  38. </if>
  39. <if test="query.patientName != null and query.patientName != ''">
  40. and bcr.patient_name like concat('%',#{query.patientName},'%')
  41. </if>
  42. </where>
  43. order by bih.last_upload_time desc
  44. </select>
  45. </mapper>