package com.ruoyi.web.modules.diagnosis.support;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.ruoyi.web.modules.diagnosis.domain.BizMedicalResource;
import com.ruoyi.web.modules.diagnosis.mapper.BizMedicalResourceMapper;

/**
 * 解析当前登录用户绑定的诊疗机构资源 ID。
 */
@Component
public class OrgProviderResolver
{
    @Autowired
    private BizMedicalResourceMapper bizMedicalResourceMapper;

    public Long resolveProviderId(Long sysUserId)
    {
        if (sysUserId == null)
        {
            return null;
        }
        BizMedicalResource resource = DiagnosisPageHelperGuard.withoutPaging(
                () -> bizMedicalResourceMapper.selectOrgResourceBySysUserId(sysUserId));
        return resource == null ? null : resource.getId();
    }
}
