@Test public void testUpdateIndividualProviderDto() { IndividualProviderDto individualProviderDto = mock(IndividualProviderDto.class); individualProviderService .updateIndividualProvider(individualProviderDto); verify(patientRepository).save(any(Patient.class)); }
@Override public void updateIndividualProvider( IndividualProviderDto individualProviderDto) { Patient patient = patientRepository .findByUsername(individualProviderDto.getUsername()); Set<IndividualProvider> individualProviders = patient .getIndividualProviders(); IndividualProvider individualProvider = null; for (IndividualProvider o : individualProviders) { if (o.getNpi().equals(individualProviderDto.getNpi())) { individualProvider = o; break; } } if (individualProvider == null) individualProvider = new IndividualProvider(); individualProvider.setFirstName(individualProviderDto.getFirstName()); individualProvider.setMiddleName(individualProviderDto.getMiddleName()); individualProvider.setLastName(individualProviderDto.getLastName()); individualProvider.setNamePrefix(individualProviderDto.getNamePrefix()); individualProvider.setNameSuffix(individualProviderDto.getNameSuffix()); individualProvider.setCredential(individualProviderDto.getCredential()); individualProvider.setNpi(individualProviderDto.getNpi()); individualProvider.setEntityType(individualProviderDto.getEntityType()); individualProvider.setFirstLineMailingAddress(individualProviderDto .getFirstLineMailingAddress()); individualProvider.setSecondLineMailingAddress(individualProviderDto .getSecondLineMailingAddress()); individualProvider.setMailingAddressCityName(individualProviderDto .getMailingAddressCityName()); individualProvider.setMailingAddressStateName(individualProviderDto .getMailingAddressStateName()); individualProvider.setMailingAddressPostalCode(individualProviderDto .getMailingAddressPostalCode()); individualProvider.setMailingAddressCountryCode(individualProviderDto .getMailingAddressCountryCode()); individualProvider .setMailingAddressTelephoneNumber(individualProviderDto .getMailingAddressTelephoneNumber()); individualProvider.setMailingAddressFaxNumber(individualProviderDto .getMailingAddressFaxNumber()); individualProvider .setFirstLinePracticeLocationAddress(individualProviderDto .getFirstLinePracticeLocationAddress()); individualProvider .setSecondLinePracticeLocationAddress(individualProviderDto .getSecondLinePracticeLocationAddress()); individualProvider .setPracticeLocationAddressCityName(individualProviderDto .getPracticeLocationAddressCityName()); individualProvider .setPracticeLocationAddressStateName(individualProviderDto .getPracticeLocationAddressStateName()); individualProvider .setPracticeLocationAddressPostalCode(individualProviderDto .getPracticeLocationAddressPostalCode()); individualProvider .setPracticeLocationAddressCountryCode(individualProviderDto .getPracticeLocationAddressCountryCode()); individualProvider .setPracticeLocationAddressTelephoneNumber(individualProviderDto .getPracticeLocationAddressTelephoneNumber()); individualProvider .setPracticeLocationAddressFaxNumber(individualProviderDto .getPracticeLocationAddressFaxNumber()); individualProvider.setEnumerationDate(individualProviderDto .getEnumerationDate()); individualProvider.setLastUpdateDate(individualProviderDto .getLastUpdateDate()); individualProvider.setProviderTaxonomyCode(individualProviderDto .getProviderTaxonomyCode()); individualProvider.setProviderTaxonomyDescription(individualProviderDto .getProviderTaxonomyDescription()); individualProviders.add(individualProvider); patient.setIndividualProviders(individualProviders); patientRepository.save(patient); }
IndividualProviderServiceImpl implements IndividualProviderService { @Override public void updateIndividualProvider( IndividualProviderDto individualProviderDto) { Patient patient = patientRepository .findByUsername(individualProviderDto.getUsername()); Set<IndividualProvider> individualProviders = patient .getIndividualProviders(); IndividualProvider individualProvider = null; for (IndividualProvider o : individualProviders) { if (o.getNpi().equals(individualProviderDto.getNpi())) { individualProvider = o; break; } } if (individualProvider == null) individualProvider = new IndividualProvider(); individualProvider.setFirstName(individualProviderDto.getFirstName()); individualProvider.setMiddleName(individualProviderDto.getMiddleName()); individualProvider.setLastName(individualProviderDto.getLastName()); individualProvider.setNamePrefix(individualProviderDto.getNamePrefix()); individualProvider.setNameSuffix(individualProviderDto.getNameSuffix()); individualProvider.setCredential(individualProviderDto.getCredential()); individualProvider.setNpi(individualProviderDto.getNpi()); individualProvider.setEntityType(individualProviderDto.getEntityType()); individualProvider.setFirstLineMailingAddress(individualProviderDto .getFirstLineMailingAddress()); individualProvider.setSecondLineMailingAddress(individualProviderDto .getSecondLineMailingAddress()); individualProvider.setMailingAddressCityName(individualProviderDto .getMailingAddressCityName()); individualProvider.setMailingAddressStateName(individualProviderDto .getMailingAddressStateName()); individualProvider.setMailingAddressPostalCode(individualProviderDto .getMailingAddressPostalCode()); individualProvider.setMailingAddressCountryCode(individualProviderDto .getMailingAddressCountryCode()); individualProvider .setMailingAddressTelephoneNumber(individualProviderDto .getMailingAddressTelephoneNumber()); individualProvider.setMailingAddressFaxNumber(individualProviderDto .getMailingAddressFaxNumber()); individualProvider .setFirstLinePracticeLocationAddress(individualProviderDto .getFirstLinePracticeLocationAddress()); individualProvider .setSecondLinePracticeLocationAddress(individualProviderDto .getSecondLinePracticeLocationAddress()); individualProvider .setPracticeLocationAddressCityName(individualProviderDto .getPracticeLocationAddressCityName()); individualProvider .setPracticeLocationAddressStateName(individualProviderDto .getPracticeLocationAddressStateName()); individualProvider .setPracticeLocationAddressPostalCode(individualProviderDto .getPracticeLocationAddressPostalCode()); individualProvider .setPracticeLocationAddressCountryCode(individualProviderDto .getPracticeLocationAddressCountryCode()); individualProvider .setPracticeLocationAddressTelephoneNumber(individualProviderDto .getPracticeLocationAddressTelephoneNumber()); individualProvider .setPracticeLocationAddressFaxNumber(individualProviderDto .getPracticeLocationAddressFaxNumber()); individualProvider.setEnumerationDate(individualProviderDto .getEnumerationDate()); individualProvider.setLastUpdateDate(individualProviderDto .getLastUpdateDate()); individualProvider.setProviderTaxonomyCode(individualProviderDto .getProviderTaxonomyCode()); individualProvider.setProviderTaxonomyDescription(individualProviderDto .getProviderTaxonomyDescription()); individualProviders.add(individualProvider); patient.setIndividualProviders(individualProviders); patientRepository.save(patient); } }
IndividualProviderServiceImpl implements IndividualProviderService { @Override public void updateIndividualProvider( IndividualProviderDto individualProviderDto) { Patient patient = patientRepository .findByUsername(individualProviderDto.getUsername()); Set<IndividualProvider> individualProviders = patient .getIndividualProviders(); IndividualProvider individualProvider = null; for (IndividualProvider o : individualProviders) { if (o.getNpi().equals(individualProviderDto.getNpi())) { individualProvider = o; break; } } if (individualProvider == null) individualProvider = new IndividualProvider(); individualProvider.setFirstName(individualProviderDto.getFirstName()); individualProvider.setMiddleName(individualProviderDto.getMiddleName()); individualProvider.setLastName(individualProviderDto.getLastName()); individualProvider.setNamePrefix(individualProviderDto.getNamePrefix()); individualProvider.setNameSuffix(individualProviderDto.getNameSuffix()); individualProvider.setCredential(individualProviderDto.getCredential()); individualProvider.setNpi(individualProviderDto.getNpi()); individualProvider.setEntityType(individualProviderDto.getEntityType()); individualProvider.setFirstLineMailingAddress(individualProviderDto .getFirstLineMailingAddress()); individualProvider.setSecondLineMailingAddress(individualProviderDto .getSecondLineMailingAddress()); individualProvider.setMailingAddressCityName(individualProviderDto .getMailingAddressCityName()); individualProvider.setMailingAddressStateName(individualProviderDto .getMailingAddressStateName()); individualProvider.setMailingAddressPostalCode(individualProviderDto .getMailingAddressPostalCode()); individualProvider.setMailingAddressCountryCode(individualProviderDto .getMailingAddressCountryCode()); individualProvider .setMailingAddressTelephoneNumber(individualProviderDto .getMailingAddressTelephoneNumber()); individualProvider.setMailingAddressFaxNumber(individualProviderDto .getMailingAddressFaxNumber()); individualProvider .setFirstLinePracticeLocationAddress(individualProviderDto .getFirstLinePracticeLocationAddress()); individualProvider .setSecondLinePracticeLocationAddress(individualProviderDto .getSecondLinePracticeLocationAddress()); individualProvider .setPracticeLocationAddressCityName(individualProviderDto .getPracticeLocationAddressCityName()); individualProvider .setPracticeLocationAddressStateName(individualProviderDto .getPracticeLocationAddressStateName()); individualProvider .setPracticeLocationAddressPostalCode(individualProviderDto .getPracticeLocationAddressPostalCode()); individualProvider .setPracticeLocationAddressCountryCode(individualProviderDto .getPracticeLocationAddressCountryCode()); individualProvider .setPracticeLocationAddressTelephoneNumber(individualProviderDto .getPracticeLocationAddressTelephoneNumber()); individualProvider .setPracticeLocationAddressFaxNumber(individualProviderDto .getPracticeLocationAddressFaxNumber()); individualProvider.setEnumerationDate(individualProviderDto .getEnumerationDate()); individualProvider.setLastUpdateDate(individualProviderDto .getLastUpdateDate()); individualProvider.setProviderTaxonomyCode(individualProviderDto .getProviderTaxonomyCode()); individualProvider.setProviderTaxonomyDescription(individualProviderDto .getProviderTaxonomyDescription()); individualProviders.add(individualProvider); patient.setIndividualProviders(individualProviders); patientRepository.save(patient); } IndividualProviderServiceImpl(
			IndividualProviderRepository individualProviderRepository,
			ModelMapper modelMapper, PatientRepository patientRepository); }
IndividualProviderServiceImpl implements IndividualProviderService { @Override public void updateIndividualProvider( IndividualProviderDto individualProviderDto) { Patient patient = patientRepository .findByUsername(individualProviderDto.getUsername()); Set<IndividualProvider> individualProviders = patient .getIndividualProviders(); IndividualProvider individualProvider = null; for (IndividualProvider o : individualProviders) { if (o.getNpi().equals(individualProviderDto.getNpi())) { individualProvider = o; break; } } if (individualProvider == null) individualProvider = new IndividualProvider(); individualProvider.setFirstName(individualProviderDto.getFirstName()); individualProvider.setMiddleName(individualProviderDto.getMiddleName()); individualProvider.setLastName(individualProviderDto.getLastName()); individualProvider.setNamePrefix(individualProviderDto.getNamePrefix()); individualProvider.setNameSuffix(individualProviderDto.getNameSuffix()); individualProvider.setCredential(individualProviderDto.getCredential()); individualProvider.setNpi(individualProviderDto.getNpi()); individualProvider.setEntityType(individualProviderDto.getEntityType()); individualProvider.setFirstLineMailingAddress(individualProviderDto .getFirstLineMailingAddress()); individualProvider.setSecondLineMailingAddress(individualProviderDto .getSecondLineMailingAddress()); individualProvider.setMailingAddressCityName(individualProviderDto .getMailingAddressCityName()); individualProvider.setMailingAddressStateName(individualProviderDto .getMailingAddressStateName()); individualProvider.setMailingAddressPostalCode(individualProviderDto .getMailingAddressPostalCode()); individualProvider.setMailingAddressCountryCode(individualProviderDto .getMailingAddressCountryCode()); individualProvider .setMailingAddressTelephoneNumber(individualProviderDto .getMailingAddressTelephoneNumber()); individualProvider.setMailingAddressFaxNumber(individualProviderDto .getMailingAddressFaxNumber()); individualProvider .setFirstLinePracticeLocationAddress(individualProviderDto .getFirstLinePracticeLocationAddress()); individualProvider .setSecondLinePracticeLocationAddress(individualProviderDto .getSecondLinePracticeLocationAddress()); individualProvider .setPracticeLocationAddressCityName(individualProviderDto .getPracticeLocationAddressCityName()); individualProvider .setPracticeLocationAddressStateName(individualProviderDto .getPracticeLocationAddressStateName()); individualProvider .setPracticeLocationAddressPostalCode(individualProviderDto .getPracticeLocationAddressPostalCode()); individualProvider .setPracticeLocationAddressCountryCode(individualProviderDto .getPracticeLocationAddressCountryCode()); individualProvider .setPracticeLocationAddressTelephoneNumber(individualProviderDto .getPracticeLocationAddressTelephoneNumber()); individualProvider .setPracticeLocationAddressFaxNumber(individualProviderDto .getPracticeLocationAddressFaxNumber()); individualProvider.setEnumerationDate(individualProviderDto .getEnumerationDate()); individualProvider.setLastUpdateDate(individualProviderDto .getLastUpdateDate()); individualProvider.setProviderTaxonomyCode(individualProviderDto .getProviderTaxonomyCode()); individualProvider.setProviderTaxonomyDescription(individualProviderDto .getProviderTaxonomyDescription()); individualProviders.add(individualProvider); patient.setIndividualProviders(individualProviders); patientRepository.save(patient); } IndividualProviderServiceImpl(
			IndividualProviderRepository individualProviderRepository,
			ModelMapper modelMapper, PatientRepository patientRepository); @Override long countAllIndividualProviders(); @Override void updateIndividualProvider(
			IndividualProviderDto individualProviderDto); @Override void deleteIndividualProvider(IndividualProvider individualProvider); @Override void deleteIndividualProviderDto(
			IndividualProviderDto individualProviderDto); @Override void deleteIndividualProviderDtoByPatientId(
			IndividualProviderDto individualProviderDto); @Override IndividualProvider findIndividualProviderByNpi(String npi); @Override IndividualProvider findIndividualProvider(Long id); @Override List<IndividualProvider> findAllIndividualProviders(); @Override List<IndividualProvider> findIndividualProviderEntries(
			int firstResult, int maxResults); @Override void saveIndividualProvider(IndividualProvider individualProvider); @Override IndividualProvider updateIndividualProvider(
			IndividualProvider individualProvider); @Override IndividualProvider addNewIndividualProvider(
			IndividualProviderDto individualProviderDto); @Override List<IndividualProviderDto> findAllIndividualProvidersDto(); @Override IndividualProviderDto findIndividualProviderDto(Long id); }
IndividualProviderServiceImpl implements IndividualProviderService { @Override public void updateIndividualProvider( IndividualProviderDto individualProviderDto) { Patient patient = patientRepository .findByUsername(individualProviderDto.getUsername()); Set<IndividualProvider> individualProviders = patient .getIndividualProviders(); IndividualProvider individualProvider = null; for (IndividualProvider o : individualProviders) { if (o.getNpi().equals(individualProviderDto.getNpi())) { individualProvider = o; break; } } if (individualProvider == null) individualProvider = new IndividualProvider(); individualProvider.setFirstName(individualProviderDto.getFirstName()); individualProvider.setMiddleName(individualProviderDto.getMiddleName()); individualProvider.setLastName(individualProviderDto.getLastName()); individualProvider.setNamePrefix(individualProviderDto.getNamePrefix()); individualProvider.setNameSuffix(individualProviderDto.getNameSuffix()); individualProvider.setCredential(individualProviderDto.getCredential()); individualProvider.setNpi(individualProviderDto.getNpi()); individualProvider.setEntityType(individualProviderDto.getEntityType()); individualProvider.setFirstLineMailingAddress(individualProviderDto .getFirstLineMailingAddress()); individualProvider.setSecondLineMailingAddress(individualProviderDto .getSecondLineMailingAddress()); individualProvider.setMailingAddressCityName(individualProviderDto .getMailingAddressCityName()); individualProvider.setMailingAddressStateName(individualProviderDto .getMailingAddressStateName()); individualProvider.setMailingAddressPostalCode(individualProviderDto .getMailingAddressPostalCode()); individualProvider.setMailingAddressCountryCode(individualProviderDto .getMailingAddressCountryCode()); individualProvider .setMailingAddressTelephoneNumber(individualProviderDto .getMailingAddressTelephoneNumber()); individualProvider.setMailingAddressFaxNumber(individualProviderDto .getMailingAddressFaxNumber()); individualProvider .setFirstLinePracticeLocationAddress(individualProviderDto .getFirstLinePracticeLocationAddress()); individualProvider .setSecondLinePracticeLocationAddress(individualProviderDto .getSecondLinePracticeLocationAddress()); individualProvider .setPracticeLocationAddressCityName(individualProviderDto .getPracticeLocationAddressCityName()); individualProvider .setPracticeLocationAddressStateName(individualProviderDto .getPracticeLocationAddressStateName()); individualProvider .setPracticeLocationAddressPostalCode(individualProviderDto .getPracticeLocationAddressPostalCode()); individualProvider .setPracticeLocationAddressCountryCode(individualProviderDto .getPracticeLocationAddressCountryCode()); individualProvider .setPracticeLocationAddressTelephoneNumber(individualProviderDto .getPracticeLocationAddressTelephoneNumber()); individualProvider .setPracticeLocationAddressFaxNumber(individualProviderDto .getPracticeLocationAddressFaxNumber()); individualProvider.setEnumerationDate(individualProviderDto .getEnumerationDate()); individualProvider.setLastUpdateDate(individualProviderDto .getLastUpdateDate()); individualProvider.setProviderTaxonomyCode(individualProviderDto .getProviderTaxonomyCode()); individualProvider.setProviderTaxonomyDescription(individualProviderDto .getProviderTaxonomyDescription()); individualProviders.add(individualProvider); patient.setIndividualProviders(individualProviders); patientRepository.save(patient); } IndividualProviderServiceImpl(
			IndividualProviderRepository individualProviderRepository,
			ModelMapper modelMapper, PatientRepository patientRepository); @Override long countAllIndividualProviders(); @Override void updateIndividualProvider(
			IndividualProviderDto individualProviderDto); @Override void deleteIndividualProvider(IndividualProvider individualProvider); @Override void deleteIndividualProviderDto(
			IndividualProviderDto individualProviderDto); @Override void deleteIndividualProviderDtoByPatientId(
			IndividualProviderDto individualProviderDto); @Override IndividualProvider findIndividualProviderByNpi(String npi); @Override IndividualProvider findIndividualProvider(Long id); @Override List<IndividualProvider> findAllIndividualProviders(); @Override List<IndividualProvider> findIndividualProviderEntries(
			int firstResult, int maxResults); @Override void saveIndividualProvider(IndividualProvider individualProvider); @Override IndividualProvider updateIndividualProvider(
			IndividualProvider individualProvider); @Override IndividualProvider addNewIndividualProvider(
			IndividualProviderDto individualProviderDto); @Override List<IndividualProviderDto> findAllIndividualProvidersDto(); @Override IndividualProviderDto findIndividualProviderDto(Long id);  }