class-diagram.mermaid 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. classDiagram
  2. %% ===== 现有(复用/改造)=====
  3. class EnergyDimension {
  4. +Long id
  5. +String code
  6. +String name
  7. +String icon
  8. +String element
  9. +Integer status
  10. }
  11. class EnergyService {
  12. +Map~String,Object~ getOverview(Long memberId)
  13. }
  14. class HealthDimensionVO {
  15. +Long memberId
  16. +BigDecimal healthIndex
  17. +BigDecimal confidence
  18. +List~DimensionItem~ dimensions
  19. +Date updateTime
  20. +Boolean isAverage
  21. }
  22. class DimensionItem {
  23. +String dimension
  24. +String label
  25. +BigDecimal score
  26. +Integer percentile
  27. +String dataSource
  28. +Integer tier
  29. +String level
  30. +BigDecimal confidence
  31. +String dataSources
  32. +Integer sampleSize
  33. +String layerBreakdown
  34. }
  35. %% ===== 新增实体 =====
  36. class AssessmentMetric {
  37. +Long id
  38. +String metricCode
  39. +String dimension
  40. +String layer
  41. +BigDecimal weight
  42. +String direction
  43. +String normStrategy
  44. +BigDecimal requiredSample
  45. +String status
  46. }
  47. class AssessmentMetricNorm {
  48. +Long id
  49. +String metricCode
  50. +String gender
  51. +Integer ageMinMonths
  52. +Integer ageMaxMonths
  53. +BigDecimal mean
  54. +BigDecimal sd
  55. +Integer p05
  56. +Integer p50
  57. +Integer p95
  58. }
  59. class DimensionMeasure {
  60. +Long id
  61. +Long childId
  62. +String metricCode
  63. +String dimension
  64. +String layer
  65. +BigDecimal rawValue
  66. +String sourceType
  67. +String device
  68. +BigDecimal qualityScore
  69. +String modelVersion
  70. +Date measureTime
  71. +Integer validFlag
  72. }
  73. class DimensionScore {
  74. +Long id
  75. +Long childId
  76. +String dimension
  77. +BigDecimal score
  78. +BigDecimal confidence
  79. +Integer sampleSize
  80. +String dataSources
  81. +String layerBreakdown
  82. +Date computedAt
  83. }
  84. class HealthIndexSnapshot {
  85. +Long id
  86. +Long childId
  87. +BigDecimal totalHealthIndex
  88. +String dimensionJson
  89. +BigDecimal confidence
  90. +Date computedAt
  91. }
  92. class AssessmentReviewLog {
  93. +Long id
  94. +Long measureId
  95. +String reviewType
  96. +String result
  97. +Long reviewerId
  98. +Date reviewedAt
  99. }
  100. %% ===== 服务 / DTO =====
  101. class ScoringAlgorithm {
  102. +double dPrime(hits, fa, n)
  103. +double beta(hr, far)
  104. +double tScore(x, mean, sd, direction)
  105. +double aggregateDimension(items, norms)
  106. +double icc(sources)
  107. +double confidence(completeness, consistency)
  108. +Map renormalizeWeights(missing)
  109. }
  110. class NormService {
  111. +AssessmentMetricNorm getNorm(metricCode, gender, ageMonths)
  112. }
  113. class DimensionMeasureService {
  114. +Result submit(MeasureSubmitRequest)
  115. +List~DimensionMeasure~ list(childId, dimension)
  116. }
  117. class DimensionScoreService {
  118. +DimensionScore compute(childId, dimension)
  119. +DimensionScoreVO getLatest(childId, dimension)
  120. }
  121. class HealthIndexService {
  122. +HealthIndexSnapshot compute(childId)
  123. +HealthIndexVO getLatest(childId)
  124. }
  125. class DimensionAssessmentController {
  126. +Result submitMeasures()
  127. +Result getDimensionScore()
  128. +Result getHealthIndex()
  129. +Result recompute()
  130. }
  131. %% ===== 关系 =====
  132. AssessmentMetric "1" --> "0..*" AssessmentMetricNorm : 定义常模
  133. DimensionMeasure --> AssessmentMetric : 归属指标(metricCode)
  134. DimensionMeasureService ..> DimensionMeasure : CRUD
  135. DimensionScoreService ..> DimensionMeasure : 聚合
  136. DimensionScoreService ..> NormService : 取常模
  137. DimensionScoreService ..> ScoringAlgorithm : 计分
  138. HealthIndexService ..> DimensionScoreService : 取五维分
  139. HealthIndexService ..> ScoringAlgorithm : 聚合
  140. DimensionAssessmentController ..> DimensionMeasureService
  141. DimensionAssessmentController ..> DimensionScoreService
  142. DimensionAssessmentController ..> HealthIndexService
  143. EnergyService ..> HealthIndexService : 读取快照(替换healthIndex=0)
  144. HealthDimensionVO *-- DimensionItem
  145. EnergyService ..> HealthDimensionVO : 组装