|
@@ -23,9 +23,53 @@
|
|
|
AND PATIENT_NAME LIKE CONCAT('%', #{patientName}, '%')
|
|
|
]]>
|
|
|
</if>
|
|
|
-<!-- <if test='startDate != null and startDate != "" and endDate != null and endDate != ""'> -->
|
|
|
+ <if test='state == "ALL"'>
|
|
|
+
|
|
|
+ <![CDATA[
|
|
|
+ AND (DATE_FORMAT(HOSPITALIZATION_DATE, '%Y-%m-%d') BETWEEN
|
|
|
+ ]]>
|
|
|
+
|
|
|
+ <choose>
|
|
|
+ <when test='startDate != null and startDate != ""'>#{startDate}</when>
|
|
|
+ <when test='startDate != null and startDate == ""'>'1900-01-01'</when>
|
|
|
+ <otherwise>'1900-01-01'</otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ <![CDATA[
|
|
|
+ AND
|
|
|
+ ]]>
|
|
|
+
|
|
|
+ <choose>
|
|
|
+ <when test='endDate != null and endDate != ""'>#{endDate}</when>
|
|
|
+ <when test='endDate != null and endDate == ""'>DATE_FORMAT( NOW(), '%Y-%m-%d' )</when>
|
|
|
+ <otherwise>DATE_FORMAT( NOW(), '%Y-%m-%d' )</otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ <![CDATA[
|
|
|
+ OR DATE_FORMAT(DISISOLATION_DATE, '%Y-%m-%d') BETWEEN
|
|
|
+ ]]>
|
|
|
+
|
|
|
+ <choose>
|
|
|
+ <when test='startDate != null and startDate != ""'>#{startDate}</when>
|
|
|
+ <when test='startDate != null and startDate == ""'>'1900-01-01'</when>
|
|
|
+ <otherwise>'1900-01-01'</otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ <![CDATA[
|
|
|
+ AND
|
|
|
+ ]]>
|
|
|
+
|
|
|
+ <choose>
|
|
|
+ <when test='endDate != null and endDate != ""'>#{endDate}</when>
|
|
|
+ <when test='endDate != null and endDate == ""'>DATE_FORMAT( NOW(), '%Y-%m-%d' )</when>
|
|
|
+ <otherwise>DATE_FORMAT( NOW(), '%Y-%m-%d' )</otherwise>
|
|
|
+ </choose>
|
|
|
+ <![CDATA[)]]>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test='state =="H"'>
|
|
|
<![CDATA[
|
|
|
- AND DATE_FORMAT(HOSPITALIZATION_DATE, '%Y-%m-%d') BETWEEN
|
|
|
+ AND DATE_FORMAT(HOSPITALIZATION_DATE, '%Y-%m-%d') BETWEEN
|
|
|
]]>
|
|
|
|
|
|
<choose>
|
|
@@ -33,18 +77,39 @@
|
|
|
<when test='startDate != null and startDate == ""'>'1900-01-01'</when>
|
|
|
<otherwise>'1900-01-01'</otherwise>
|
|
|
</choose>
|
|
|
+
|
|
|
+ <![CDATA[
|
|
|
+ AND
|
|
|
+ ]]>
|
|
|
+
|
|
|
+ <choose>
|
|
|
+ <when test='endDate != null and endDate != ""'>#{endDate}</when>
|
|
|
+ <when test='endDate != null and endDate == ""'>DATE_FORMAT( NOW(), '%Y-%m-%d' )</when>
|
|
|
+ <otherwise>DATE_FORMAT( NOW(), '%Y-%m-%d' )</otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test='state != "H" and state != "ALL"'>
|
|
|
+ <![CDATA[
|
|
|
+ AND DATE_FORMAT(DISISOLATION_DATE, '%Y-%m-%d') BETWEEN
|
|
|
+ ]]>
|
|
|
|
|
|
+ <choose>
|
|
|
+ <when test='startDate != null and startDate != ""'>#{startDate}</when>
|
|
|
+ <when test='startDate != null and startDate == ""'>'1900-01-01'</when>
|
|
|
+ <otherwise>'1900-01-01'</otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
<![CDATA[
|
|
|
- AND
|
|
|
- ]]>
|
|
|
-
|
|
|
+ AND
|
|
|
+ ]]>
|
|
|
+
|
|
|
<choose>
|
|
|
<when test='endDate != null and endDate != ""'>#{endDate}</when>
|
|
|
<when test='endDate != null and endDate == ""'>DATE_FORMAT( NOW(), '%Y-%m-%d' )</when>
|
|
|
<otherwise>DATE_FORMAT( NOW(), '%Y-%m-%d' )</otherwise>
|
|
|
</choose>
|
|
|
-
|
|
|
-<!-- </if> -->
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<select id="selectPatientList" parameterType="PatientDTO" resultType="PatientDTO">
|
|
@@ -74,23 +139,25 @@
|
|
|
FROM PATIENT_CARE
|
|
|
WHERE 1 = 1
|
|
|
]]>
|
|
|
- <if test='groupIdx != "1"'>
|
|
|
- <![CDATA[
|
|
|
- AND CENTER_CODE = #{centerCode}
|
|
|
- ]]>
|
|
|
- </if>
|
|
|
- <if test='state != "ALL"'>
|
|
|
- <![CDATA[
|
|
|
- AND STATE = #{state}
|
|
|
- ]]>
|
|
|
- </if>
|
|
|
- <if test='patientName != null and patientName != ""'>
|
|
|
- <![CDATA[
|
|
|
- AND PATIENT_NAME LIKE CONCAT('%', #{patientName}, '%')
|
|
|
- ]]>
|
|
|
- </if>
|
|
|
+ <if test='groupIdx != "1"'>
|
|
|
+ <![CDATA[
|
|
|
+ AND CENTER_CODE = #{centerCode}
|
|
|
+ ]]>
|
|
|
+ </if>
|
|
|
+ <if test='state != "ALL"'>
|
|
|
<![CDATA[
|
|
|
- AND DATE_FORMAT(HOSPITALIZATION_DATE, '%Y-%m-%d') BETWEEN
|
|
|
+ AND STATE = #{state}
|
|
|
+ ]]>
|
|
|
+ </if>
|
|
|
+ <if test='patientName != null and patientName != ""'>
|
|
|
+ <![CDATA[
|
|
|
+ AND PATIENT_NAME LIKE CONCAT('%', #{patientName}, '%')
|
|
|
+ ]]>
|
|
|
+ </if>
|
|
|
+ <if test='state == "ALL"'>
|
|
|
+
|
|
|
+ <![CDATA[
|
|
|
+ AND (DATE_FORMAT(HOSPITALIZATION_DATE, '%Y-%m-%d') BETWEEN
|
|
|
]]>
|
|
|
|
|
|
<choose>
|
|
@@ -98,26 +165,92 @@
|
|
|
<when test='startDate != null and startDate == ""'>'1900-01-01'</when>
|
|
|
<otherwise>'1900-01-01'</otherwise>
|
|
|
</choose>
|
|
|
+
|
|
|
+ <![CDATA[
|
|
|
+ AND
|
|
|
+ ]]>
|
|
|
+
|
|
|
+ <choose>
|
|
|
+ <when test='endDate != null and endDate != ""'>#{endDate}</when>
|
|
|
+ <when test='endDate != null and endDate == ""'>DATE_FORMAT( NOW(), '%Y-%m-%d' )</when>
|
|
|
+ <otherwise>DATE_FORMAT( NOW(), '%Y-%m-%d' )</otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ <![CDATA[
|
|
|
+ OR DATE_FORMAT(DISISOLATION_DATE, '%Y-%m-%d') BETWEEN
|
|
|
+ ]]>
|
|
|
|
|
|
+ <choose>
|
|
|
+ <when test='startDate != null and startDate != ""'>#{startDate}</when>
|
|
|
+ <when test='startDate != null and startDate == ""'>'1900-01-01'</when>
|
|
|
+ <otherwise>'1900-01-01'</otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
<![CDATA[
|
|
|
- AND
|
|
|
+ AND
|
|
|
]]>
|
|
|
-
|
|
|
+
|
|
|
<choose>
|
|
|
<when test='endDate != null and endDate != ""'>#{endDate}</when>
|
|
|
<when test='endDate != null and endDate == ""'>DATE_FORMAT( NOW(), '%Y-%m-%d' )</when>
|
|
|
<otherwise>DATE_FORMAT( NOW(), '%Y-%m-%d' )</otherwise>
|
|
|
</choose>
|
|
|
+ <![CDATA[)]]>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test='state =="H"'>
|
|
|
+ <![CDATA[
|
|
|
+ AND DATE_FORMAT(HOSPITALIZATION_DATE, '%Y-%m-%d') BETWEEN
|
|
|
+ ]]>
|
|
|
|
|
|
- <![CDATA[
|
|
|
- ORDER BY
|
|
|
- ]]>
|
|
|
+ <choose>
|
|
|
+ <when test='startDate != null and startDate != ""'>#{startDate}</when>
|
|
|
+ <when test='startDate != null and startDate == ""'>'1900-01-01'</when>
|
|
|
+ <otherwise>'1900-01-01'</otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ <![CDATA[
|
|
|
+ AND
|
|
|
+ ]]>
|
|
|
+
|
|
|
+ <choose>
|
|
|
+ <when test='endDate != null and endDate != ""'>#{endDate}</when>
|
|
|
+ <when test='endDate != null and endDate == ""'>DATE_FORMAT( NOW(), '%Y-%m-%d' )</when>
|
|
|
+ <otherwise>DATE_FORMAT( NOW(), '%Y-%m-%d' )</otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test='state != "H" and state != "ALL"'>
|
|
|
+ <![CDATA[
|
|
|
+ AND DATE_FORMAT(DISISOLATION_DATE, '%Y-%m-%d') BETWEEN
|
|
|
+ ]]>
|
|
|
+
|
|
|
+ <choose>
|
|
|
+ <when test='startDate != null and startDate != ""'>#{startDate}</when>
|
|
|
+ <when test='startDate != null and startDate == ""'>'1900-01-01'</when>
|
|
|
+ <otherwise>'1900-01-01'</otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ <![CDATA[
|
|
|
+ AND
|
|
|
+ ]]>
|
|
|
+
|
|
|
+ <choose>
|
|
|
+ <when test='endDate != null and endDate != ""'>#{endDate}</when>
|
|
|
+ <when test='endDate != null and endDate == ""'>DATE_FORMAT( NOW(), '%Y-%m-%d' )</when>
|
|
|
+ <otherwise>DATE_FORMAT( NOW(), '%Y-%m-%d' )</otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
|
|
|
- <if test='groupIdx == "1"'>
|
|
|
<![CDATA[
|
|
|
- center_code,
|
|
|
+ ORDER BY
|
|
|
]]>
|
|
|
- </if>
|
|
|
+
|
|
|
+ <if test='groupIdx == "1"'>
|
|
|
+ <![CDATA[
|
|
|
+ center_code,
|
|
|
+ ]]>
|
|
|
+ </if>
|
|
|
<![CDATA[
|
|
|
PATIENT_NAME ASC
|
|
|
LIMIT ${limit}, ${limitMax}
|