PractitionerService.java 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package com.train.service;
  2. import com.train.common.Result;
  3. import com.train.entity.TrainPractitionerProfile;
  4. import java.util.List;
  5. import java.util.Map;
  6. /**
  7. * 人员档案服务(服务人员工作助手 · 健康服务人员助手)
  8. *
  9. * 职责:我的档案(懒建档)、档案详情(脱敏)、档案列表(脱敏分页)。
  10. * 脱敏规则:display_name 落库即脱敏(张*三);电话 138****1234;地址截断。
  11. * 权限:mine 为本人;detail/adminList 在 Service 层做角色校验(admin 或 org 成员可查)。
  12. */
  13. public interface PractitionerService {
  14. /** 我的档案:懒建档(不存在则用 train_user 基础信息建默认档案)并返回脱敏详情 */
  15. Result<Map<String, Object>> mine(Long userId);
  16. /**
  17. * 档案详情(脱敏):本人 / admin / 任一机构 active 成员可查。
  18. *
  19. * @param userId 当前登录用户(user token)
  20. * @param isAdmin 管理后台 token 注入(JwtInterceptor)
  21. * @param targetUserId 被查档案 owner=train_user.id
  22. */
  23. Result<Map<String, Object>> detail(Long userId, Boolean isAdmin, Long targetUserId);
  24. /**
  25. * 档案列表(脱敏分页):admin 全量;org 成员需传 body.orgId 且按机构过滤。
  26. *
  27. * @param userId 当前登录用户(user token)
  28. * @param isAdmin 管理后台 token 注入
  29. * @param body {keyword?, level?, authLevel?, orgId?, page=1, size=20}
  30. */
  31. Result<Map<String, Object>> adminList(Long userId, Boolean isAdmin, Map<String, Object> body);
  32. /** 懒建档:按 user_id 查档案,不存在则创建默认档案(幂等,供各域复用) */
  33. TrainPractitionerProfile ensureProfile(Long userId);
  34. /**
  35. * 档案资质审批(仅 admin):pending→approved,置 approved_by/approved_at。
  36. * 幂等:已 approved 返回既有状态不报错。用于晋升解锁闸口前置(profile.status=approved 资质生效)。
  37. *
  38. * @param operatorId 操作人(admin token 注入 adminId)
  39. * @param isAdmin 管理后台 token 注入
  40. * @param targetUserId 被审批档案 owner=train_user.id
  41. */
  42. Result<Map<String, Object>> approveProfile(Long operatorId, Boolean isAdmin, Long targetUserId);
  43. /**
  44. * 新增资质证书(用户端,仅本人)。
  45. * body: {licenseType, licenseNo, issuer, issuedAt, expireAt?, fileId?, fileUrl?}
  46. * verify_status=pending;唯一键 uk(user_id,license_type,license_no) 重复返回「该资质已存在」。
  47. * 出参: Result<Long licenseId>
  48. */
  49. Result<Long> addLicense(Long userId, Map<String, Object> body);
  50. /**
  51. * 我的资质证书列表(仅本人,含 verify_status)。
  52. * 出参: Result<List<Map<String, Object>>>
  53. */
  54. Result<List<Map<String, Object>>> listLicenses(Long userId);
  55. /**
  56. * 管理端-资质证书分页(仅 admin)。
  57. * body: {userId?, verifyStatus?, page=1, size=20}
  58. * 出参: {total, page, size, list:[TrainPractitionerLicense]}
  59. */
  60. Result<Map<String, Object>> adminLicenseList(Long userId, Boolean isAdmin, Map<String, Object> body);
  61. /**
  62. * 管理端-资质证书核验(仅 admin)。
  63. * body: {licenseId, approved(boolean), rejectReason?}
  64. * approved=true → verified;false → rejected。置 verified_by/verified_at/remark。
  65. * 出参: Result<Boolean>
  66. */
  67. Result<Boolean> verifyLicense(Long operatorId, Boolean isAdmin, Map<String, Object> body);
  68. }