-- 检查 study_info 表中的数据情况
USE `pacsonline_new`;

-- 1. 查看总数据量
SELECT COUNT(*) as total_count FROM study_info;

-- 2. 查看各治理状态的数据量
SELECT
    govern_status,
    CASE govern_status
        WHEN 0 THEN '未治理'
        WHEN 1 THEN '已治理'
        WHEN 2 THEN '治理中'
        ELSE '未知'
    END as status_name,
    COUNT(*) as count
FROM study_info
GROUP BY govern_status;

-- 3. 查看已治理的数据（前10条）
SELECT
    study_id,
    study_instance_uid,
    patient_id,
    modality,
    study_date,
    institution_id,
    govern_status,
    upload_time
FROM study_info
WHERE govern_status = 1
ORDER BY upload_time DESC
LIMIT 10;

-- 4. 查看机构信息
SELECT
    id,
    institution_name,
    institution_code
FROM institution
LIMIT 10;
