use of gov.cms.bfd.server.war.commons.Diagnosis.DiagnosisLabel in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method addDiagnosisCode.
/**
* @param eob the {@link ExplanationOfBenefit} to (possibly) modify
* @param diagnosis the {@link Diagnosis} to add, if it's not already present
* @return the {@link DiagnosisComponent#getSequence()} of the existing or newly-added entry
*/
static int addDiagnosisCode(ExplanationOfBenefit eob, Diagnosis diagnosis) {
Optional<DiagnosisComponent> existingDiagnosis = eob.getDiagnosis().stream().filter(d -> d.getDiagnosis() instanceof CodeableConcept).filter(d -> diagnosis.isContainedIn((CodeableConcept) d.getDiagnosis())).findAny();
if (existingDiagnosis.isPresent())
return existingDiagnosis.get().getSequenceElement().getValue();
DiagnosisComponent diagnosisComponent = new DiagnosisComponent().setSequence(eob.getDiagnosis().size() + 1);
diagnosisComponent.setDiagnosis(diagnosis.toCodeableConcept());
for (DiagnosisLabel diagnosisLabel : diagnosis.getLabels()) {
CodeableConcept diagnosisTypeConcept = createCodeableConcept(diagnosisLabel.getSystem(), diagnosisLabel.toCode());
diagnosisTypeConcept.getCodingFirstRep().setDisplay(diagnosisLabel.getDisplay());
diagnosisComponent.addType(diagnosisTypeConcept);
}
if (diagnosis.getPresentOnAdmission().isPresent()) {
diagnosisComponent.addExtension(createExtensionCoding(eob, CcwCodebookVariable.CLM_POA_IND_SW1, diagnosis.getPresentOnAdmission()));
}
eob.getDiagnosis().add(diagnosisComponent);
return diagnosisComponent.getSequenceElement().getValue();
}
use of gov.cms.bfd.server.war.commons.Diagnosis.DiagnosisLabel in project beneficiary-fhir-data by CMSgov.
the class DiagnosisUtilV2 method translateLabels.
/**
* Translates a list of {@link DiagnosisLabel} to an EOB type specific Coding based on the (@link
* ClaimTypeV2}.
*
* <p>In practice, the list will only ever be one {@link DiagnosisLabel}. The {@link Diagnosis}
* class allows multiple labels to be present, so we cover that case here. In V2, only a single
* label will ever be assigned.
*/
static CodeableConcept translateLabels(Set<DiagnosisLabel> labels, ClaimTypeV2 claimType) {
CodeableConcept diagType = new CodeableConcept();
List<Coding> codings = labels.stream().map(l -> translateLabelCode(l, claimType)).collect(Collectors.toList());
return diagType.setCoding(codings);
}
Aggregations