| | |
| | | d.device_id, |
| | | d.device_number, |
| | | d.device_name, |
| | | d.device_model, |
| | | d.check_time, |
| | | d.check_index, |
| | | d.check_method, |
| | |
| | | d.check_charger_user_id, |
| | | CASE WHEN d.check_charger_user='' or d.check_charger_user is null THEN u.name |
| | | ELSE d.check_charger_user END AS check_charger_user, |
| | | d.environment, |
| | | d.check_basis, |
| | | d.appearance_status, |
| | | d.running_status, |
| | | d.remark, |
| | | d.file_name, |
| | | d.file_url, |
| | |
| | | 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 |
| | | THEN 1 ELSE 0 END red_flag, |
| | | (select count(*) from device_examine_attachment a where a.plan_details_id = d.plan_details_id) attachment_count |
| | | 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 |