| | |
| | | SEPARATOR ';' |
| | | ) AS insProductItem, |
| | | u.name , |
| | | l.laboratory_name |
| | | l.laboratory_name, |
| | | cmr.next_calibration_date nextCalibrationDateTwo, |
| | | CASE |
| | | WHEN cmr.next_calibration_date IS NULL THEN 0 |
| | | WHEN cmr.next_calibration_date BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 45 DAY) THEN 1 |
| | | ELSE 0 |
| | | END AS status |
| | | FROM |
| | | device d |
| | | LEFT JOIN `user` u ON u.id = d.equipment_manager |
| | | LEFT JOIN laboratory l ON l.id = d.subordinate_departments_id |
| | | LEFT JOIN device_metric_record cmr ON d.id = cmr.device_id |
| | | LEFT JOIN (SELECT |
| | | device_id, |
| | | type, |
| | | MAX(next_calibration_date) AS next_calibration_date |
| | | FROM |
| | | device_metric_record |
| | | GROUP BY |
| | | device_id )cmr ON d.id = cmr.device_id |
| | | LEFT JOIN structure_item_parameter sip ON FIND_IN_SET(sip.id, d.ins_product_ids) |
| | | <where> |
| | | <if test="laboratoryNameIsNull != null and laboratoryNameIsNull == true"> |
| | |
| | | </where> |
| | | GROUP BY |
| | | d.id, |
| | | u.name, l.laboratory_name |
| | | u.name, l.laboratory_name,cmr.next_calibration_date,status |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |