check_exam_data.sql 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. -- 检查指定机构和时间范围内的已治理数据
  2. USE `pacsonline_new`;
  3. -- 查询 INST001 机构在 2025-12-01 到 2025-12-31 之间的已治理数据
  4. SELECT
  5. study_id,
  6. patient_id,
  7. modality,
  8. study_date,
  9. institution_id,
  10. govern_status,
  11. upload_time
  12. FROM study_info
  13. WHERE institution_id = 'INST001'
  14. AND study_date >= '2025-12-01'
  15. AND study_date <= '2025-12-31'
  16. AND govern_status = 1
  17. ORDER BY upload_time DESC;
  18. -- 查询 INST001 机构的所有已治理数据(不限时间)
  19. SELECT COUNT(*) as count
  20. FROM study_info
  21. WHERE institution_id = 'INST001'
  22. AND govern_status = 1;
  23. -- 查询所有已治理的数据(不限机构和时间)
  24. SELECT
  25. institution_id,
  26. COUNT(*) as count,
  27. MIN(study_date) as min_date,
  28. MAX(study_date) as max_date
  29. FROM study_info
  30. WHERE govern_status = 1
  31. GROUP BY institution_id;
  32. -- 查询所有数据(不限治理状态)
  33. SELECT
  34. institution_id,
  35. govern_status,
  36. COUNT(*) as count
  37. FROM study_info
  38. GROUP BY institution_id, govern_status
  39. ORDER BY institution_id, govern_status;
  40. -- 如果没有已治理的数据,可以执行以下语句将一些数据设置为已治理
  41. -- UPDATE study_info SET govern_status = 1 WHERE institution_id = 'INST001' LIMIT 10;