package com.train.service; import com.train.common.Result; import com.train.entity.TrainPractitionerProfile; import java.util.List; import java.util.Map; /** * 人员档案服务(服务人员工作助手 · 健康服务人员助手) * * 职责:我的档案(懒建档)、档案详情(脱敏)、档案列表(脱敏分页)。 * 脱敏规则:display_name 落库即脱敏(张*三);电话 138****1234;地址截断。 * 权限:mine 为本人;detail/adminList 在 Service 层做角色校验(admin 或 org 成员可查)。 */ public interface PractitionerService { /** 我的档案:懒建档(不存在则用 train_user 基础信息建默认档案)并返回脱敏详情 */ Result> mine(Long userId); /** * 档案详情(脱敏):本人 / admin / 任一机构 active 成员可查。 * * @param userId 当前登录用户(user token) * @param isAdmin 管理后台 token 注入(JwtInterceptor) * @param targetUserId 被查档案 owner=train_user.id */ Result> detail(Long userId, Boolean isAdmin, Long targetUserId); /** * 档案列表(脱敏分页):admin 全量;org 成员需传 body.orgId 且按机构过滤。 * * @param userId 当前登录用户(user token) * @param isAdmin 管理后台 token 注入 * @param body {keyword?, level?, authLevel?, orgId?, page=1, size=20} */ Result> adminList(Long userId, Boolean isAdmin, Map body); /** 懒建档:按 user_id 查档案,不存在则创建默认档案(幂等,供各域复用) */ TrainPractitionerProfile ensureProfile(Long userId); /** * 档案资质审批(仅 admin):pending→approved,置 approved_by/approved_at。 * 幂等:已 approved 返回既有状态不报错。用于晋升解锁闸口前置(profile.status=approved 资质生效)。 * * @param operatorId 操作人(admin token 注入 adminId) * @param isAdmin 管理后台 token 注入 * @param targetUserId 被审批档案 owner=train_user.id */ Result> approveProfile(Long operatorId, Boolean isAdmin, Long targetUserId); /** * 新增资质证书(用户端,仅本人)。 * body: {licenseType, licenseNo, issuer, issuedAt, expireAt?, fileId?, fileUrl?} * verify_status=pending;唯一键 uk(user_id,license_type,license_no) 重复返回「该资质已存在」。 * 出参: Result */ Result addLicense(Long userId, Map body); /** * 我的资质证书列表(仅本人,含 verify_status)。 * 出参: Result>> */ Result>> listLicenses(Long userId); /** * 管理端-资质证书分页(仅 admin)。 * body: {userId?, verifyStatus?, page=1, size=20} * 出参: {total, page, size, list:[TrainPractitionerLicense]} */ Result> adminLicenseList(Long userId, Boolean isAdmin, Map body); /** * 管理端-资质证书核验(仅 admin)。 * body: {licenseId, approved(boolean), rejectReason?} * approved=true → verified;false → rejected。置 verified_by/verified_at/remark。 * 出参: Result */ Result verifyLicense(Long operatorId, Boolean isAdmin, Map body); }