@Test public void testGeneralizeSearchWithTwoSpecificCodedResultingInSameParentIcd10Kod() { final String matchingCode = "matching-code"; final String icd10KodTooSpecific1 = "M160"; final String icd10KodTooSpecific2 = "M161"; final String icd10KodGeneralized = "M16"; List<String> expected = Lists.newArrayList(icd10KodGeneralized); doReturn(Optional.of(buildDiagnosInformation(icd10KodGeneralized, matchingCode))) .when(repository) .findFirstByIcd10KodList_kod(eq(icd10KodGeneralized)); final IcfResponse icfInformationByIcd10Koder = icfService.findIcfInformationByIcd10Koder( Icd10KoderRequest.of(icd10KodTooSpecific1, icd10KodTooSpecific2, null)); assertThat(icfInformationByIcd10Koder).isNotNull(); assertThat(icfInformationByIcd10Koder.getGemensamma()).isNotNull(); assertThat(icfInformationByIcd10Koder.getGemensamma().getFunktionsNedsattningsKoder().getIcd10Koder()).isEqualTo(expected); assertThat(icfInformationByIcd10Koder.getGemensamma().getFunktionsNedsattningsKoder().getIcd10Koder()).hasSize(1); assertThat(icfInformationByIcd10Koder.getUnika()).hasSize(0); }
@Override @Transactional(readOnly = true) public IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest) { Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest), "Icd10KoderRequest can not be null"); Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest.getIcd10Kod1()), "Icd10KoderRequest must have an icfCode1"); final List<Tuple2<String, Optional<DiagnosInformation>>> collect = List.ofAll(icd10KoderRequest.getIcd10Codes()) .map(this::searchDiagnosInformationByIcd10Kod) .distinctBy(response -> response._1); return convertToResponse(collect); }
IcfServiceImpl extends FmbBaseService implements IcfService { @Override @Transactional(readOnly = true) public IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest) { Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest), "Icd10KoderRequest can not be null"); Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest.getIcd10Kod1()), "Icd10KoderRequest must have an icfCode1"); final List<Tuple2<String, Optional<DiagnosInformation>>> collect = List.ofAll(icd10KoderRequest.getIcd10Codes()) .map(this::searchDiagnosInformationByIcd10Kod) .distinctBy(response -> response._1); return convertToResponse(collect); } }
IcfServiceImpl extends FmbBaseService implements IcfService { @Override @Transactional(readOnly = true) public IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest) { Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest), "Icd10KoderRequest can not be null"); Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest.getIcd10Kod1()), "Icd10KoderRequest must have an icfCode1"); final List<Tuple2<String, Optional<DiagnosInformation>>> collect = List.ofAll(icd10KoderRequest.getIcd10Codes()) .map(this::searchDiagnosInformationByIcd10Kod) .distinctBy(response -> response._1); return convertToResponse(collect); } IcfServiceImpl(
        final IcfTextResource textResource,
        final DiagnosInformationRepository repository); }
IcfServiceImpl extends FmbBaseService implements IcfService { @Override @Transactional(readOnly = true) public IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest) { Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest), "Icd10KoderRequest can not be null"); Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest.getIcd10Kod1()), "Icd10KoderRequest must have an icfCode1"); final List<Tuple2<String, Optional<DiagnosInformation>>> collect = List.ofAll(icd10KoderRequest.getIcd10Codes()) .map(this::searchDiagnosInformationByIcd10Kod) .distinctBy(response -> response._1); return convertToResponse(collect); } IcfServiceImpl(
        final IcfTextResource textResource,
        final DiagnosInformationRepository repository); @Override @Transactional(readOnly = true) IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest); }
IcfServiceImpl extends FmbBaseService implements IcfService { @Override @Transactional(readOnly = true) public IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest) { Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest), "Icd10KoderRequest can not be null"); Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest.getIcd10Kod1()), "Icd10KoderRequest must have an icfCode1"); final List<Tuple2<String, Optional<DiagnosInformation>>> collect = List.ofAll(icd10KoderRequest.getIcd10Codes()) .map(this::searchDiagnosInformationByIcd10Kod) .distinctBy(response -> response._1); return convertToResponse(collect); } IcfServiceImpl(
        final IcfTextResource textResource,
        final DiagnosInformationRepository repository); @Override @Transactional(readOnly = true) IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest);  }