|
1 | 1 | package uk.nhs.adaptors.gp2gp.ehr.mapper.diagnosticreport; |
2 | 2 |
|
3 | 3 | import static uk.nhs.adaptors.gp2gp.ehr.mapper.diagnosticreport.DiagnosticReportMapper.DUMMY_OBSERVATION_ID_PREFIX; |
4 | | -import static uk.nhs.adaptors.gp2gp.ehr.utils.CodeableConceptMappingUtils.hasCode; |
5 | 4 |
|
6 | 5 | import java.util.List; |
7 | 6 | import java.util.Objects; |
@@ -74,8 +73,6 @@ public class ObservationMapper { |
74 | 73 | private static final String RANGE_LOW_PREFIX = "Low: "; |
75 | 74 | private static final String RANGE_HIGH_PREFIX = "High: "; |
76 | 75 |
|
77 | | - private static final String COMMENT_NOTE_CODE = "37331000000100"; |
78 | | - |
79 | 76 | private static final String HL7_UNKNOWN_VALUE = "UNK"; |
80 | 77 | private static final String HAS_MEMBER_TYPE = "HASMEMBER"; |
81 | 78 |
|
@@ -364,7 +361,7 @@ private Optional<String> prepareNarrativeStatementForRelatedObservationComments( |
364 | 361 | } |
365 | 362 |
|
366 | 363 | private CommentType prepareCommentType(Observation observation) { |
367 | | - return hasCode(observation.getCode(), List.of(COMMENT_NOTE_CODE)) |
| 364 | + return DiagnosticReportMapper.isFilingComment(observation) |
368 | 365 | ? CommentType.USER_COMMENT : CommentType.AGGREGATE_COMMENT_SET; |
369 | 366 | } |
370 | 367 |
|
@@ -483,7 +480,7 @@ private DateTimeType resolveEffectiveDateTimeType(Observation observation) { |
483 | 480 | } |
484 | 481 |
|
485 | 482 | private boolean observationHasNonCommentNoteCode(Observation observation) { |
486 | | - return observation.hasCode() && !hasCode(observation.getCode(), List.of(COMMENT_NOTE_CODE)); |
| 483 | + return observation.hasCode() && !DiagnosticReportMapper.isFilingComment(observation); |
487 | 484 | } |
488 | 485 |
|
489 | 486 | private String prepareCodeElement(Observation observation) { |
@@ -546,7 +543,7 @@ private boolean hasValidType(Observation.ObservationRelatedComponent observation |
546 | 543 | } |
547 | 544 |
|
548 | 545 | private boolean hasValidComment(Observation observation) { |
549 | | - return observation.hasComment() && hasCode(observation.getCode(), List.of(COMMENT_NOTE_CODE)); |
| 546 | + return observation.hasComment() && DiagnosticReportMapper.isFilingComment(observation); |
550 | 547 | } |
551 | 548 |
|
552 | 549 | private MultiStatementObservationHolder createHolder(Observation observationAssociatedWithSpecimen) { |
|
0 commit comments