| | |
| | | WHEN dd.review_status = 0 THEN 3 |
| | | WHEN dd.review_status = 1 THEN 2 |
| | | WHEN dd.record_contrast_id IS NOT NULL THEN 1 |
| | | ELSE 0 END record_contrast_status |
| | | ELSE 0 END record_contrast_status, |
| | | CASE WHEN dev.next_examine_date IS NOT NULL |
| | | AND dev.next_examine_date <= date_add(curdate(), interval 1 month) |
| | | AND (dev.last_examine_date IS NULL OR dev.last_examine_date < str_to_date(concat(left(d.check_time, 7), '-01'), '%Y-%m-%d')) |
| | | THEN 1 ELSE 0 END red_flag |
| | | from device_examine_plan_details d |
| | | left join user u on u.id = d.check_charger_user_id |
| | | left join device_examine_record dc on d.plan_details_id = dc.plan_details_id |
| | | left join device_examine_record_contrast dd on dd.plan_details_id = dc.plan_details_id |
| | | left join device_examine_record_contrast dd on dd.plan_details_id = d.plan_details_id |
| | | left join device dev on dev.id = d.device_id |
| | | order by check_time asc |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |