patientPHRHistory.xml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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.lemon.lifecenter.mapper.PatientPHRHistoryMapper">
  4. <insert id="insertPHRHistory" parameterType="PatientPHRHistoryDTO" useGeneratedKeys="true">
  5. <![CDATA[
  6. INSERT INTO patient_phr_history (patient_idx, phr_type, phr_value, recorded_by_name
  7. ]]>
  8. <if test='recordedById != null and recordedById != ""'>
  9. <![CDATA[
  10. , recorded_by_id
  11. ]]>
  12. </if>
  13. <![CDATA[
  14. , create_date)
  15. VALUE (#{patientIdx}, #{phrType}, #{phrValue}, #{recordedByName}
  16. ]]>
  17. <if test='recordedById != null and recordedById != ""'>
  18. <![CDATA[
  19. , #{recordedById}
  20. ]]>
  21. </if>
  22. <![CDATA[
  23. , NOW())
  24. ]]>
  25. </insert>
  26. <select id="selectPHRHistoryCount" parameterType="PatientPHRHistoryDTO" resultType="int">
  27. <![CDATA[
  28. SELECT count(*) AS total
  29. FROM patient_phr_history
  30. WHERE
  31. patient_idx = #{patientIdx}
  32. AND
  33. phr_type = #{phrType}
  34. ]]>
  35. </select>
  36. <select id="selectPHRHistoryList" parameterType="PatientPHRHistoryDTO" resultType="PatientPHRHistoryDTO">
  37. <![CDATA[
  38. SELECT create_date AS createDate,
  39. phr_value AS phrValue,
  40. recorded_by_name AS recordedByName
  41. FROM patient_phr_history
  42. WHERE
  43. patient_idx = #{patientIdx}
  44. AND
  45. phr_type = #{phrType}
  46. ORDER BY create_date DESC
  47. ]]>
  48. </select>
  49. </mapper>