1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.lemon.lifecenter.mapper.PatientMemoMapper">
- <insert id="insertMemo" parameterType="PatientMemoDTO" useGeneratedKeys="true">
- <![CDATA[
- INSERT INTO patient_memo (patient_idx, contents, recorded_by_name, recorded_by_id, recorded_date, update_date, create_date)
- VALUE (#{patientIdx}, #{contents}, #{recordedByName}, #{recordedById}
- ]]>
- <choose>
- <when test='recordedDate != null and recordedDate != ""'>
- <![CDATA[
- , #{recordedDate}, NOW(), NOW())
- ]]>
- </when>
- <otherwise>
- <![CDATA[
- , NOW(), NOW(), NOW())
- ]]>
- </otherwise>
- </choose>
- </insert>
- <select id="selectMemoCount" parameterType="PatientMemoDTO" resultType="int">
- <![CDATA[
- SELECT count(*) AS total
- FROM patient_memo
- WHERE patient_idx = #{patientIdx}
- ]]>
- </select>
- <select id="selectMemoList" parameterType="PatientMemoDTO" resultType="PatientMemoDTO">
- <![CDATA[
- SELECT idx,
- update_date AS updateDate,
- create_date AS createDate,
- contents AS contents,
- recorded_by_id AS recordedById,
- recorded_by_name AS recordedByName,
- recorded_date AS recordedDate
- FROM patient_memo
- WHERE
- patient_idx = #{patientIdx}
- ORDER BY recorded_date DESC, idx DESC
- ]]>
- </select>
- <update id="updateMemo" parameterType="PatientMemoDTO">
- <![CDATA[
- UPDATE patient_memo
- SET contents = #{contents},
- update_date = NOW(),
- ]]>
- <choose>
- <when test='recordedDate != null and recordedDate != ""'>
- <![CDATA[
- recorded_date = #{recordedDate}
- ]]>
- </when>
- <otherwise>
- <![CDATA[
- recorded_date = NOW()
- ]]>
- </otherwise>
- </choose>
- <![CDATA[
- WHERE idx = #{idx}
- ]]>
- </update>
- <delete id="deleteMemo" parameterType="PatientMemoDTO">
- <![CDATA[
- DELETE
- FROM patient_memo
- WHERE idx = #{idx}
- ]]>
- </delete>
- </mapper>
|