|
@@ -139,6 +139,88 @@
|
|
|
FROM patient_care c LEFT JOIN patient_phr_latest p ON p.patient_idx = c.patient_idx
|
|
|
WHERE c.center_code = #{centerCode} AND c.state = 'H'
|
|
|
]]>
|
|
|
+ <if test="filterList != null and filterList.length > 0">
|
|
|
+ <![CDATA[
|
|
|
+ AND (
|
|
|
+ ]]>
|
|
|
+ <foreach item="filter" index="index" collection="filterList" separator="OR">
|
|
|
+ <choose>
|
|
|
+ <when test="filter == 'newPatient'" >
|
|
|
+ <![CDATA[
|
|
|
+ DATEDIFF(c.hospitalization_date, CURDATE()) = 0
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ <when test="filter == 'alarm'" >
|
|
|
+ <![CDATA[
|
|
|
+ p.temperature_alarm_yn = 'Y' OR oxygen_saturation_alarm_yn = 'Y' OR pulse_rate_alarm_yn = 'Y' OR high_blood_pressure_alarm_yn = 'Y' OR low_blood_pressure_alarm_yn = 'Y' OR blood_sugar_alarm_yn = 'Y'
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ <when test="filter == 'temperatureBlank' and timeCriterion == 'AM'" >
|
|
|
+ <![CDATA[
|
|
|
+ (p.temperature IS NULL) OR (DATEDIFF(p.temperature_create_date, CURDATE()) != 0)
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ <when test="filter == 'temperatureBlank' and timeCriterion == 'PM'" >
|
|
|
+ <![CDATA[
|
|
|
+ (p.temperature IS NULL) OR (DATEDIFF(p.temperature_create_date, CURDATE()) != 0 OR HOUR(p.temperature_create_date) < 12)
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ <when test="filter == 'bloodPressureBlank' and timeCriterion == 'AM'" >
|
|
|
+ <![CDATA[
|
|
|
+ (p.systolic_blood_pressure IS NULL OR diastolic_blood_pressure IS NULL) OR (DATEDIFF(p.systolic_blood_pressure_create_date, CURDATE()) != 0 OR DATEDIFF(p.diastolic_blood_pressure_create_date, CURDATE()) != 0)
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ <when test="filter == 'bloodPressureBlank' and timeCriterion == 'PM'" >
|
|
|
+ <![CDATA[
|
|
|
+ (p.systolic_blood_pressure IS NULL OR diastolic_blood_pressure IS NULL) OR (DATEDIFF(p.systolic_blood_pressure_create_date, CURDATE()) != 0 OR HOUR(p.systolic_blood_pressure_create_date) < 12 OR DATEDIFF(p.diastolic_blood_pressure_create_date, CURDATE()) != 0 OR HOUR(p.diastolic_blood_pressure_create_date) < 12)
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ <when test="filter == 'pulseRateBlank' and timeCriterion == 'AM'" >
|
|
|
+ <![CDATA[
|
|
|
+ (p.pulse_rate IS NULL) OR (DATEDIFF(p.pulse_rate_create_date, CURDATE()) != 0)
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ <when test="filter == 'pulseRateBlank' and timeCriterion == 'PM'" >
|
|
|
+ <![CDATA[
|
|
|
+ (p.pulse_rate IS NULL) OR (DATEDIFF(p.pulse_rate_create_date, CURDATE()) != 0 OR HOUR(p.pulse_rate_create_date) < 12)
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ <when test="filter == 'oxygenSaturationBlank' and timeCriterion == 'AM'" >
|
|
|
+ <![CDATA[
|
|
|
+ (p.oxygen_saturation IS NULL) OR (DATEDIFF(p.oxygen_saturation_create_date, CURDATE()) != 0)
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ <when test="filter == 'oxygenSaturationBlank' and timeCriterion == 'PM'" >
|
|
|
+ <![CDATA[
|
|
|
+ (p.oxygen_saturation IS NULL) OR (DATEDIFF(p.oxygen_saturation_create_date, CURDATE()) != 0 OR HOUR(p.oxygen_saturation_create_date) < 12)
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ <when test="filter == 'bloodSugarBlank' and timeCriterion == 'AM'" >
|
|
|
+ <![CDATA[
|
|
|
+ (p.blood_sugar IS NULL) OR (DATEDIFF(p.blood_sugar_create_date, CURDATE()) != 0)
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ <when test="filter == 'bloodSugarBlank' and timeCriterion == 'PM'" >
|
|
|
+ <![CDATA[
|
|
|
+ (p.blood_sugar IS NULL) OR (DATEDIFF(p.blood_sugar_create_date, CURDATE()) != 0 OR HOUR(p.blood_sugar_create_date) < 12)
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ <when test="filter == 'symptomBlank' and timeCriterion == 'AM'" >
|
|
|
+ <![CDATA[
|
|
|
+ DATEDIFF(p.symptom_create_date, CURDATE()) != 0
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ <when test="filter == 'symptomBlank' and timeCriterion == 'PM'" >
|
|
|
+ <![CDATA[
|
|
|
+ DATEDIFF(p.symptom_create_date, CURDATE()) != 0 OR HOUR(p.symptom_create_date) < 12
|
|
|
+ ]]>
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </foreach>
|
|
|
+ <![CDATA[
|
|
|
+ )
|
|
|
+ ]]>
|
|
|
+ </if>
|
|
|
<if test='searchText != null and searchText != ""'>
|
|
|
<![CDATA[
|
|
|
AND (c.patient_name LIKE CONCAT('%', #{searchText}, '%') OR c.room_number LIKE CONCAT('%', #{searchText}, '%'))
|