use of org.hl7.fhir.r4.model.Claim.DiagnosisComponent 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 org.hl7.fhir.r4.model.Claim.DiagnosisComponent in project beneficiary-fhir-data by CMSgov.
the class DMEClaimTransformerV2Test method shouldHaveDiagnosesMembers.
@Test
public void shouldHaveDiagnosesMembers() {
DiagnosisComponent diag1 = TransformerTestUtilsV2.findDiagnosisByCode("R5555", eob.getDiagnosis());
DiagnosisComponent cmp1 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag1.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R5555", null), new Coding("http://terminology.hl7.org/CodeSystem/ex-diagnosistype", "principal", "Principal Diagnosis"), null, null);
assertTrue(cmp1.equalsDeep(diag1));
DiagnosisComponent diag2 = TransformerTestUtilsV2.findDiagnosisByCode("R6666", eob.getDiagnosis());
DiagnosisComponent cmp2 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag2.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R6666", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "other", "Other"), null, null);
assertTrue(cmp2.equalsDeep(diag2));
DiagnosisComponent diag3 = TransformerTestUtilsV2.findDiagnosisByCode("G6666", eob.getDiagnosis());
DiagnosisComponent cmp3 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag3.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "G6666", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "secondary", "Secondary"), null, null);
assertTrue(cmp3.equalsDeep(diag3));
}
use of org.hl7.fhir.r4.model.Claim.DiagnosisComponent in project beneficiary-fhir-data by CMSgov.
the class CarrierClaimTransformerV2Test method shouldHaveDiagnosesMembers.
@Test
public void shouldHaveDiagnosesMembers() {
DiagnosisComponent diag1 = TransformerTestUtilsV2.findDiagnosisByCode("H5555", eob.getDiagnosis());
DiagnosisComponent cmp1 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag1.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "H5555", null), new Coding("http://terminology.hl7.org/CodeSystem/ex-diagnosistype", "principal", "principal"), null, null);
assertTrue(cmp1.equalsDeep(diag1));
DiagnosisComponent diag2 = TransformerTestUtilsV2.findDiagnosisByCode("H8888", eob.getDiagnosis());
DiagnosisComponent cmp2 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag2.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "H8888", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "secondary", "Secondary"), null, null);
assertTrue(cmp2.equalsDeep(diag2));
DiagnosisComponent diag3 = TransformerTestUtilsV2.findDiagnosisByCode("H66666", eob.getDiagnosis());
DiagnosisComponent cmp3 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag3.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "H66666", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "secondary", "Secondary"), null, null);
assertTrue(cmp3.equalsDeep(diag3));
DiagnosisComponent diag4 = TransformerTestUtilsV2.findDiagnosisByCode("H77777", eob.getDiagnosis());
DiagnosisComponent cmp4 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag4.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "H77777", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "secondary", "Secondary"), null, null);
assertTrue(cmp4.equalsDeep(diag4));
DiagnosisComponent diag5 = TransformerTestUtilsV2.findDiagnosisByCode("H12345", eob.getDiagnosis());
DiagnosisComponent cmp5 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag5.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "H12345", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "secondary", "Secondary"), null, null);
assertTrue(cmp5.equalsDeep(diag5));
}
use of org.hl7.fhir.r4.model.Claim.DiagnosisComponent in project beneficiary-fhir-data by CMSgov.
the class HospiceClaimTransformerV2Test method shouldHaveAllDiagnosis.
@Test
public void shouldHaveAllDiagnosis() {
List<DiagnosisComponent> expected = eob.getDiagnosis();
assertEquals(4, expected.size());
DiagnosisComponent diag1 = TransformerTestUtilsV2.findDiagnosisByCode("R5555", eob.getDiagnosis());
DiagnosisComponent cmp1 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag1.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-9-cm", "R5555", null), new Coding("http://terminology.hl7.org/CodeSystem/ex-diagnosistype", "principal", "Principal Diagnosis"), null, null);
assertTrue(cmp1.equalsDeep(diag1));
DiagnosisComponent diag2 = TransformerTestUtilsV2.findDiagnosisByCode("R6666", eob.getDiagnosis());
DiagnosisComponent cmp2 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag2.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R6666", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "other", "Other"), null, null);
assertTrue(cmp2.equalsDeep(diag2));
DiagnosisComponent diag3 = TransformerTestUtilsV2.findDiagnosisByCode("R2222", eob.getDiagnosis());
DiagnosisComponent cmp3 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag3.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R2222", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "externalcauseofinjury", "External Cause of Injury"), null, null);
assertTrue(cmp3.equalsDeep(diag3));
DiagnosisComponent diag4 = TransformerTestUtilsV2.findDiagnosisByCode("R3333", eob.getDiagnosis());
DiagnosisComponent cmp4 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag4.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R3333", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "externalcauseofinjury", "External Cause of Injury"), null, null);
assertTrue(cmp3.equalsDeep(diag3));
}
use of org.hl7.fhir.r4.model.Claim.DiagnosisComponent in project beneficiary-fhir-data by CMSgov.
the class InpatientClaimTransformerV2Test method shouldHaveDiagnosesMembers.
@Test
public void shouldHaveDiagnosesMembers() {
DiagnosisComponent diag1 = TransformerTestUtilsV2.findDiagnosisByCode("R4444", eob.getDiagnosis());
DiagnosisComponent cmp1 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag1.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R4444", null), new Coding("http://terminology.hl7.org/CodeSystem/ex-diagnosistype", "admitting", "Admitting Diagnosis"), null, null);
assertTrue(cmp1.equalsDeep(diag1));
DiagnosisComponent diag2 = TransformerTestUtilsV2.findDiagnosisByCode("R5555", eob.getDiagnosis());
DiagnosisComponent cmp2 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag2.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R5555", null), new Coding("http://terminology.hl7.org/CodeSystem/ex-diagnosistype", "principal", "Principal Diagnosis"), 1, "Y");
assertTrue(cmp2.equalsDeep(diag2));
DiagnosisComponent diag3 = TransformerTestUtilsV2.findDiagnosisByCode("A7777", eob.getDiagnosis());
DiagnosisComponent cmp3 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag3.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "A7777", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "other", "Other"), 2, "N");
assertTrue(cmp3.equalsDeep(diag3));
DiagnosisComponent diag4 = TransformerTestUtilsV2.findDiagnosisByCode("R8888", eob.getDiagnosis());
DiagnosisComponent cmp4 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag4.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R8888", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "other", "Other"), 3, "N");
assertTrue(cmp4.equalsDeep(diag4));
DiagnosisComponent diag5 = TransformerTestUtilsV2.findDiagnosisByCode("K71234", eob.getDiagnosis());
DiagnosisComponent cmp5 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag5.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "K71234", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "other", "Other"), 4, "N");
assertTrue(cmp5.equalsDeep(diag5));
DiagnosisComponent diag6 = TransformerTestUtilsV2.findDiagnosisByCode("7840", eob.getDiagnosis());
DiagnosisComponent cmp6 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag6.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "7840", "HEADACHE"), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "other", "Other"), 5, "N");
assertTrue(cmp6.equalsDeep(diag6));
DiagnosisComponent diag7 = TransformerTestUtilsV2.findDiagnosisByCode("R2222", eob.getDiagnosis());
DiagnosisComponent cmp7 = TransformerTestUtilsV2.createExDiagnosis(// Order doesn't matter
diag7.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R2222", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "externalcauseofinjury", "External Cause of Injury"), 1, "N");
assertTrue(cmp7.equalsDeep(diag7));
DiagnosisComponent diag8 = TransformerTestUtilsV2.findDiagnosisByCode("R3333", eob.getDiagnosis());
DiagnosisComponent cmp8 = TransformerTestUtilsV2.createExDiagnosis(// Order doesn't matter
diag8.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R3333", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "externalcauseofinjury", "External Cause of Injury"), 2, "Y");
assertTrue(cmp8.equalsDeep(diag8));
}
Aggregations