@Test public void testMap_when_mapping_OrganizationalProvidersDisclosureIsMadeTo() { Consent consent = new Consent(); setDataBasicConsent(consent); Set<ConsentOrganizationalProviderDisclosureIsMadeTo> OrganizationalProvidersDisclosureIsMadeTo = new HashSet<ConsentOrganizationalProviderDisclosureIsMadeTo>(); List<OrganizationalProvider> orgProviders = setDataOrgProviders(); for (OrganizationalProvider organizationalProvider : orgProviders) { ConsentOrganizationalProviderDisclosureIsMadeTo consentOrganizationalProviderDisclosureIsMadeTo = new ConsentOrganizationalProviderDisclosureIsMadeTo( organizationalProvider); OrganizationalProvidersDisclosureIsMadeTo .add(consentOrganizationalProviderDisclosureIsMadeTo); } consent.setOrganizationalProvidersDisclosureIsMadeTo(OrganizationalProvidersDisclosureIsMadeTo); ConsentDto consentDto = sut.map(consent); assertEquals(consent.getProvidersDisclosureIsMadeTo().getClass(), consentDto.getProvidersDisclosureIsMadeTo().getClass()); assertEquals(consent.getProvidersDisclosureIsMadeTo().size(), consentDto.getProvidersDisclosureIsMadeTo().size()); for (ConsentOrganizationalProviderDisclosureIsMadeTo pdmt : consent .getOrganizationalProvidersDisclosureIsMadeTo()) { String consentNpi = pdmt.getOrganizationalProvider().getNpi(); for (OrganizationalProviderDto organizationalProvidersDisclosureIsMadeTo : consentDto .getOrganizationalProvidersDisclosureIsMadeTo()) { String consentDtoNpi = organizationalProvidersDisclosureIsMadeTo .getNpi(); if (!consentNpi.equalsIgnoreCase(consentDtoNpi)) { continue; } assertEquals(pdmt.getOrganizationalProvider().getOrgName(), organizationalProvidersDisclosureIsMadeTo.getOrgName()); assertEquals(pdmt.getOrganizationalProvider() .getPracticeLocationAddressCityName(), organizationalProvidersDisclosureIsMadeTo .getPracticeLocationAddressCityName()); assertEquals(pdmt.getOrganizationalProvider() .getPracticeLocationAddressStateName(), organizationalProvidersDisclosureIsMadeTo .getPracticeLocationAddressStateName()); assertEquals(pdmt.getOrganizationalProvider() .getPracticeLocationAddressCountryCode(), organizationalProvidersDisclosureIsMadeTo .getPracticeLocationAddressCountryCode()); assertEquals(pdmt.getOrganizationalProvider() .getSecondLinePracticeLocationAddress(), organizationalProvidersDisclosureIsMadeTo .getSecondLinePracticeLocationAddress()); assertEquals(pdmt.getOrganizationalProvider() .getPracticeLocationAddressPostalCode(), organizationalProvidersDisclosureIsMadeTo .getPracticeLocationAddressPostalCode()); assertEquals(pdmt.getOrganizationalProvider() .getPracticeLocationAddressStateName(), organizationalProvidersDisclosureIsMadeTo .getPracticeLocationAddressStateName()); } } }
@Override public ConsentDto map(Consent consent) { ConsentDto consentDto = new ConsentDto(); consentDto.setConsentReferenceid(consent.getConsentReferenceId()); PatientDto patientDto = modelMapper.map(consent.getPatient(), PatientDto.class); consentDto.setPatientDto(patientDto); if (consent.getLegalRepresentative() != null) { PatientDto legalRepresentativeDto = modelMapper.map( consent.getLegalRepresentative(), PatientDto.class); consentDto.setLegalRepresentative(legalRepresentativeDto); } Set<IndividualProviderDto> indiprovidersPermittedToDisclose = new HashSet<IndividualProviderDto>(); for (ConsentIndividualProviderPermittedToDisclose pptd : consent .getProvidersPermittedToDisclose()) { IndividualProviderDto iptd = modelMapper.map( pptd.getIndividualProvider(), IndividualProviderDto.class); indiprovidersPermittedToDisclose.add(iptd); } consentDto .setProvidersPermittedToDisclose(indiprovidersPermittedToDisclose); Set<IndividualProviderDto> indiprovidersDisclosureIsMadeTo = new HashSet<IndividualProviderDto>(); for (ConsentIndividualProviderDisclosureIsMadeTo pdmt : consent .getProvidersDisclosureIsMadeTo()) { IndividualProviderDto iptd2 = modelMapper.map( pdmt.getIndividualProvider(), IndividualProviderDto.class); indiprovidersDisclosureIsMadeTo.add(iptd2); } consentDto .setProvidersDisclosureIsMadeTo(indiprovidersDisclosureIsMadeTo); Set<OrganizationalProviderDto> orgaprovidersPermittedToDisclose = new HashSet<OrganizationalProviderDto>(); for (ConsentOrganizationalProviderPermittedToDisclose coptd : consent .getOrganizationalProvidersPermittedToDisclose()) { OrganizationalProviderDto optd = modelMapper.map( coptd.getOrganizationalProvider(), OrganizationalProviderDto.class); orgaprovidersPermittedToDisclose.add(optd); } consentDto .setOrganizationalProvidersPermittedToDisclose(orgaprovidersPermittedToDisclose); Set<OrganizationalProviderDto> orgaprovidersDisclosureIsMadeTo = new HashSet<OrganizationalProviderDto>(); for (ConsentOrganizationalProviderDisclosureIsMadeTo opdmt : consent .getOrganizationalProvidersDisclosureIsMadeTo()) { OrganizationalProviderDto optd2 = modelMapper.map( opdmt.getOrganizationalProvider(), OrganizationalProviderDto.class); orgaprovidersDisclosureIsMadeTo.add(optd2); } consentDto .setOrganizationalProvidersDisclosureIsMadeTo(orgaprovidersDisclosureIsMadeTo); Set<TypeCodesDto> consentDoNotShareClinicalDocumentTypeCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareClinicalDocumentTypeCode item : consent .getDoNotShareClinicalDocumentTypeCodes()) { TypeCodesDto tcd = new TypeCodesDto(); tcd.setDisplayName(item.getClinicalDocumentTypeCode() .getDisplayName()); tcd.setCode(item.getClinicalDocumentTypeCode().getCode()); tcd.setCodeSystem(item.getClinicalDocumentTypeCode() .getCodeSystem()); tcd.setCodeSystemName(item.getClinicalDocumentTypeCode() .getCodeSystemName()); consentDoNotShareClinicalDocumentTypeCode.add(tcd); } consentDto .setDoNotShareClinicalDocumentTypeCodes(consentDoNotShareClinicalDocumentTypeCode); Set<TypeCodesDto> consentDoNotShareClinicalDocumentSectionTypeCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareClinicalDocumentSectionTypeCode item : consent .getDoNotShareClinicalDocumentSectionTypeCodes()) { TypeCodesDto tcd1 = new TypeCodesDto(); tcd1.setDisplayName(item.getMedicalSection().getName()); tcd1.setCode(item.getMedicalSection().getCode()); tcd1.setCodeSystem(null); tcd1.setCodeSystemName(null); consentDoNotShareClinicalDocumentSectionTypeCode.add(tcd1); } consentDto .setDoNotShareClinicalDocumentSectionTypeCodes(consentDoNotShareClinicalDocumentSectionTypeCode); Set<TypeCodesDto> consentDoNotShareSensitivityPolicyCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareSensitivityPolicyCode item : consent .getDoNotShareSensitivityPolicyCodes()) { TypeCodesDto tcd2 = new TypeCodesDto(); tcd2.setDisplayName(item.getValueSetCategory().getName()); tcd2.setCode(item.getValueSetCategory().getCode()); tcd2.setCodeSystem(null); tcd2.setCodeSystemName(null); consentDoNotShareSensitivityPolicyCode.add(tcd2); } consentDto .setDoNotShareSensitivityPolicyCodes(consentDoNotShareSensitivityPolicyCode); Set<TypeCodesDto> consentShareForPurposeOfUseCode = new HashSet<TypeCodesDto>(); for (ConsentShareForPurposeOfUseCode item : consent .getShareForPurposeOfUseCodes()) { TypeCodesDto tcd3 = new TypeCodesDto(); tcd3.setDisplayName(item.getPurposeOfUseCode().getDisplayName()); tcd3.setCode(item.getPurposeOfUseCode().getCode()); tcd3.setCodeSystem(item.getPurposeOfUseCode().getCodeSystem()); tcd3.setCodeSystemName(item.getPurposeOfUseCode() .getCodeSystemName()); consentShareForPurposeOfUseCode.add(tcd3); } consentDto .setShareForPurposeOfUseCodes(consentShareForPurposeOfUseCode); Set<TypeCodesDto> consentDoNotShareClinicalConceptCodes = new HashSet<TypeCodesDto>(); for (ClinicalConceptCode item : consent .getDoNotShareClinicalConceptCodes()) { TypeCodesDto tcd4 = new TypeCodesDto(); tcd4.setDisplayName(item.getDisplayName()); tcd4.setCode(item.getCode()); tcd4.setCodeSystem(item.getCodeSystem()); tcd4.setCodeSystemName(item.getCodeSystemName()); consentDoNotShareClinicalConceptCodes.add(tcd4); } consentDto .setDoNotShareClinicalConceptCodes(consentDoNotShareClinicalConceptCodes); consentDto.setConsentStart(consent.getStartDate()); consentDto.setConsentEnd(consent.getEndDate()); consentDto.setSignedDate(consent.getSignedDate()); consentDto.setVersion(consent.getVersion()); consentDto.setRevocationDate(consent.getRevocationDate()); return consentDto; }
ConsentExportMapperImpl implements ConsentExportMapper { @Override public ConsentDto map(Consent consent) { ConsentDto consentDto = new ConsentDto(); consentDto.setConsentReferenceid(consent.getConsentReferenceId()); PatientDto patientDto = modelMapper.map(consent.getPatient(), PatientDto.class); consentDto.setPatientDto(patientDto); if (consent.getLegalRepresentative() != null) { PatientDto legalRepresentativeDto = modelMapper.map( consent.getLegalRepresentative(), PatientDto.class); consentDto.setLegalRepresentative(legalRepresentativeDto); } Set<IndividualProviderDto> indiprovidersPermittedToDisclose = new HashSet<IndividualProviderDto>(); for (ConsentIndividualProviderPermittedToDisclose pptd : consent .getProvidersPermittedToDisclose()) { IndividualProviderDto iptd = modelMapper.map( pptd.getIndividualProvider(), IndividualProviderDto.class); indiprovidersPermittedToDisclose.add(iptd); } consentDto .setProvidersPermittedToDisclose(indiprovidersPermittedToDisclose); Set<IndividualProviderDto> indiprovidersDisclosureIsMadeTo = new HashSet<IndividualProviderDto>(); for (ConsentIndividualProviderDisclosureIsMadeTo pdmt : consent .getProvidersDisclosureIsMadeTo()) { IndividualProviderDto iptd2 = modelMapper.map( pdmt.getIndividualProvider(), IndividualProviderDto.class); indiprovidersDisclosureIsMadeTo.add(iptd2); } consentDto .setProvidersDisclosureIsMadeTo(indiprovidersDisclosureIsMadeTo); Set<OrganizationalProviderDto> orgaprovidersPermittedToDisclose = new HashSet<OrganizationalProviderDto>(); for (ConsentOrganizationalProviderPermittedToDisclose coptd : consent .getOrganizationalProvidersPermittedToDisclose()) { OrganizationalProviderDto optd = modelMapper.map( coptd.getOrganizationalProvider(), OrganizationalProviderDto.class); orgaprovidersPermittedToDisclose.add(optd); } consentDto .setOrganizationalProvidersPermittedToDisclose(orgaprovidersPermittedToDisclose); Set<OrganizationalProviderDto> orgaprovidersDisclosureIsMadeTo = new HashSet<OrganizationalProviderDto>(); for (ConsentOrganizationalProviderDisclosureIsMadeTo opdmt : consent .getOrganizationalProvidersDisclosureIsMadeTo()) { OrganizationalProviderDto optd2 = modelMapper.map( opdmt.getOrganizationalProvider(), OrganizationalProviderDto.class); orgaprovidersDisclosureIsMadeTo.add(optd2); } consentDto .setOrganizationalProvidersDisclosureIsMadeTo(orgaprovidersDisclosureIsMadeTo); Set<TypeCodesDto> consentDoNotShareClinicalDocumentTypeCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareClinicalDocumentTypeCode item : consent .getDoNotShareClinicalDocumentTypeCodes()) { TypeCodesDto tcd = new TypeCodesDto(); tcd.setDisplayName(item.getClinicalDocumentTypeCode() .getDisplayName()); tcd.setCode(item.getClinicalDocumentTypeCode().getCode()); tcd.setCodeSystem(item.getClinicalDocumentTypeCode() .getCodeSystem()); tcd.setCodeSystemName(item.getClinicalDocumentTypeCode() .getCodeSystemName()); consentDoNotShareClinicalDocumentTypeCode.add(tcd); } consentDto .setDoNotShareClinicalDocumentTypeCodes(consentDoNotShareClinicalDocumentTypeCode); Set<TypeCodesDto> consentDoNotShareClinicalDocumentSectionTypeCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareClinicalDocumentSectionTypeCode item : consent .getDoNotShareClinicalDocumentSectionTypeCodes()) { TypeCodesDto tcd1 = new TypeCodesDto(); tcd1.setDisplayName(item.getMedicalSection().getName()); tcd1.setCode(item.getMedicalSection().getCode()); tcd1.setCodeSystem(null); tcd1.setCodeSystemName(null); consentDoNotShareClinicalDocumentSectionTypeCode.add(tcd1); } consentDto .setDoNotShareClinicalDocumentSectionTypeCodes(consentDoNotShareClinicalDocumentSectionTypeCode); Set<TypeCodesDto> consentDoNotShareSensitivityPolicyCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareSensitivityPolicyCode item : consent .getDoNotShareSensitivityPolicyCodes()) { TypeCodesDto tcd2 = new TypeCodesDto(); tcd2.setDisplayName(item.getValueSetCategory().getName()); tcd2.setCode(item.getValueSetCategory().getCode()); tcd2.setCodeSystem(null); tcd2.setCodeSystemName(null); consentDoNotShareSensitivityPolicyCode.add(tcd2); } consentDto .setDoNotShareSensitivityPolicyCodes(consentDoNotShareSensitivityPolicyCode); Set<TypeCodesDto> consentShareForPurposeOfUseCode = new HashSet<TypeCodesDto>(); for (ConsentShareForPurposeOfUseCode item : consent .getShareForPurposeOfUseCodes()) { TypeCodesDto tcd3 = new TypeCodesDto(); tcd3.setDisplayName(item.getPurposeOfUseCode().getDisplayName()); tcd3.setCode(item.getPurposeOfUseCode().getCode()); tcd3.setCodeSystem(item.getPurposeOfUseCode().getCodeSystem()); tcd3.setCodeSystemName(item.getPurposeOfUseCode() .getCodeSystemName()); consentShareForPurposeOfUseCode.add(tcd3); } consentDto .setShareForPurposeOfUseCodes(consentShareForPurposeOfUseCode); Set<TypeCodesDto> consentDoNotShareClinicalConceptCodes = new HashSet<TypeCodesDto>(); for (ClinicalConceptCode item : consent .getDoNotShareClinicalConceptCodes()) { TypeCodesDto tcd4 = new TypeCodesDto(); tcd4.setDisplayName(item.getDisplayName()); tcd4.setCode(item.getCode()); tcd4.setCodeSystem(item.getCodeSystem()); tcd4.setCodeSystemName(item.getCodeSystemName()); consentDoNotShareClinicalConceptCodes.add(tcd4); } consentDto .setDoNotShareClinicalConceptCodes(consentDoNotShareClinicalConceptCodes); consentDto.setConsentStart(consent.getStartDate()); consentDto.setConsentEnd(consent.getEndDate()); consentDto.setSignedDate(consent.getSignedDate()); consentDto.setVersion(consent.getVersion()); consentDto.setRevocationDate(consent.getRevocationDate()); return consentDto; } }
ConsentExportMapperImpl implements ConsentExportMapper { @Override public ConsentDto map(Consent consent) { ConsentDto consentDto = new ConsentDto(); consentDto.setConsentReferenceid(consent.getConsentReferenceId()); PatientDto patientDto = modelMapper.map(consent.getPatient(), PatientDto.class); consentDto.setPatientDto(patientDto); if (consent.getLegalRepresentative() != null) { PatientDto legalRepresentativeDto = modelMapper.map( consent.getLegalRepresentative(), PatientDto.class); consentDto.setLegalRepresentative(legalRepresentativeDto); } Set<IndividualProviderDto> indiprovidersPermittedToDisclose = new HashSet<IndividualProviderDto>(); for (ConsentIndividualProviderPermittedToDisclose pptd : consent .getProvidersPermittedToDisclose()) { IndividualProviderDto iptd = modelMapper.map( pptd.getIndividualProvider(), IndividualProviderDto.class); indiprovidersPermittedToDisclose.add(iptd); } consentDto .setProvidersPermittedToDisclose(indiprovidersPermittedToDisclose); Set<IndividualProviderDto> indiprovidersDisclosureIsMadeTo = new HashSet<IndividualProviderDto>(); for (ConsentIndividualProviderDisclosureIsMadeTo pdmt : consent .getProvidersDisclosureIsMadeTo()) { IndividualProviderDto iptd2 = modelMapper.map( pdmt.getIndividualProvider(), IndividualProviderDto.class); indiprovidersDisclosureIsMadeTo.add(iptd2); } consentDto .setProvidersDisclosureIsMadeTo(indiprovidersDisclosureIsMadeTo); Set<OrganizationalProviderDto> orgaprovidersPermittedToDisclose = new HashSet<OrganizationalProviderDto>(); for (ConsentOrganizationalProviderPermittedToDisclose coptd : consent .getOrganizationalProvidersPermittedToDisclose()) { OrganizationalProviderDto optd = modelMapper.map( coptd.getOrganizationalProvider(), OrganizationalProviderDto.class); orgaprovidersPermittedToDisclose.add(optd); } consentDto .setOrganizationalProvidersPermittedToDisclose(orgaprovidersPermittedToDisclose); Set<OrganizationalProviderDto> orgaprovidersDisclosureIsMadeTo = new HashSet<OrganizationalProviderDto>(); for (ConsentOrganizationalProviderDisclosureIsMadeTo opdmt : consent .getOrganizationalProvidersDisclosureIsMadeTo()) { OrganizationalProviderDto optd2 = modelMapper.map( opdmt.getOrganizationalProvider(), OrganizationalProviderDto.class); orgaprovidersDisclosureIsMadeTo.add(optd2); } consentDto .setOrganizationalProvidersDisclosureIsMadeTo(orgaprovidersDisclosureIsMadeTo); Set<TypeCodesDto> consentDoNotShareClinicalDocumentTypeCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareClinicalDocumentTypeCode item : consent .getDoNotShareClinicalDocumentTypeCodes()) { TypeCodesDto tcd = new TypeCodesDto(); tcd.setDisplayName(item.getClinicalDocumentTypeCode() .getDisplayName()); tcd.setCode(item.getClinicalDocumentTypeCode().getCode()); tcd.setCodeSystem(item.getClinicalDocumentTypeCode() .getCodeSystem()); tcd.setCodeSystemName(item.getClinicalDocumentTypeCode() .getCodeSystemName()); consentDoNotShareClinicalDocumentTypeCode.add(tcd); } consentDto .setDoNotShareClinicalDocumentTypeCodes(consentDoNotShareClinicalDocumentTypeCode); Set<TypeCodesDto> consentDoNotShareClinicalDocumentSectionTypeCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareClinicalDocumentSectionTypeCode item : consent .getDoNotShareClinicalDocumentSectionTypeCodes()) { TypeCodesDto tcd1 = new TypeCodesDto(); tcd1.setDisplayName(item.getMedicalSection().getName()); tcd1.setCode(item.getMedicalSection().getCode()); tcd1.setCodeSystem(null); tcd1.setCodeSystemName(null); consentDoNotShareClinicalDocumentSectionTypeCode.add(tcd1); } consentDto .setDoNotShareClinicalDocumentSectionTypeCodes(consentDoNotShareClinicalDocumentSectionTypeCode); Set<TypeCodesDto> consentDoNotShareSensitivityPolicyCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareSensitivityPolicyCode item : consent .getDoNotShareSensitivityPolicyCodes()) { TypeCodesDto tcd2 = new TypeCodesDto(); tcd2.setDisplayName(item.getValueSetCategory().getName()); tcd2.setCode(item.getValueSetCategory().getCode()); tcd2.setCodeSystem(null); tcd2.setCodeSystemName(null); consentDoNotShareSensitivityPolicyCode.add(tcd2); } consentDto .setDoNotShareSensitivityPolicyCodes(consentDoNotShareSensitivityPolicyCode); Set<TypeCodesDto> consentShareForPurposeOfUseCode = new HashSet<TypeCodesDto>(); for (ConsentShareForPurposeOfUseCode item : consent .getShareForPurposeOfUseCodes()) { TypeCodesDto tcd3 = new TypeCodesDto(); tcd3.setDisplayName(item.getPurposeOfUseCode().getDisplayName()); tcd3.setCode(item.getPurposeOfUseCode().getCode()); tcd3.setCodeSystem(item.getPurposeOfUseCode().getCodeSystem()); tcd3.setCodeSystemName(item.getPurposeOfUseCode() .getCodeSystemName()); consentShareForPurposeOfUseCode.add(tcd3); } consentDto .setShareForPurposeOfUseCodes(consentShareForPurposeOfUseCode); Set<TypeCodesDto> consentDoNotShareClinicalConceptCodes = new HashSet<TypeCodesDto>(); for (ClinicalConceptCode item : consent .getDoNotShareClinicalConceptCodes()) { TypeCodesDto tcd4 = new TypeCodesDto(); tcd4.setDisplayName(item.getDisplayName()); tcd4.setCode(item.getCode()); tcd4.setCodeSystem(item.getCodeSystem()); tcd4.setCodeSystemName(item.getCodeSystemName()); consentDoNotShareClinicalConceptCodes.add(tcd4); } consentDto .setDoNotShareClinicalConceptCodes(consentDoNotShareClinicalConceptCodes); consentDto.setConsentStart(consent.getStartDate()); consentDto.setConsentEnd(consent.getEndDate()); consentDto.setSignedDate(consent.getSignedDate()); consentDto.setVersion(consent.getVersion()); consentDto.setRevocationDate(consent.getRevocationDate()); return consentDto; } ConsentExportMapperImpl(ModelMapper modelMapper); }
ConsentExportMapperImpl implements ConsentExportMapper { @Override public ConsentDto map(Consent consent) { ConsentDto consentDto = new ConsentDto(); consentDto.setConsentReferenceid(consent.getConsentReferenceId()); PatientDto patientDto = modelMapper.map(consent.getPatient(), PatientDto.class); consentDto.setPatientDto(patientDto); if (consent.getLegalRepresentative() != null) { PatientDto legalRepresentativeDto = modelMapper.map( consent.getLegalRepresentative(), PatientDto.class); consentDto.setLegalRepresentative(legalRepresentativeDto); } Set<IndividualProviderDto> indiprovidersPermittedToDisclose = new HashSet<IndividualProviderDto>(); for (ConsentIndividualProviderPermittedToDisclose pptd : consent .getProvidersPermittedToDisclose()) { IndividualProviderDto iptd = modelMapper.map( pptd.getIndividualProvider(), IndividualProviderDto.class); indiprovidersPermittedToDisclose.add(iptd); } consentDto .setProvidersPermittedToDisclose(indiprovidersPermittedToDisclose); Set<IndividualProviderDto> indiprovidersDisclosureIsMadeTo = new HashSet<IndividualProviderDto>(); for (ConsentIndividualProviderDisclosureIsMadeTo pdmt : consent .getProvidersDisclosureIsMadeTo()) { IndividualProviderDto iptd2 = modelMapper.map( pdmt.getIndividualProvider(), IndividualProviderDto.class); indiprovidersDisclosureIsMadeTo.add(iptd2); } consentDto .setProvidersDisclosureIsMadeTo(indiprovidersDisclosureIsMadeTo); Set<OrganizationalProviderDto> orgaprovidersPermittedToDisclose = new HashSet<OrganizationalProviderDto>(); for (ConsentOrganizationalProviderPermittedToDisclose coptd : consent .getOrganizationalProvidersPermittedToDisclose()) { OrganizationalProviderDto optd = modelMapper.map( coptd.getOrganizationalProvider(), OrganizationalProviderDto.class); orgaprovidersPermittedToDisclose.add(optd); } consentDto .setOrganizationalProvidersPermittedToDisclose(orgaprovidersPermittedToDisclose); Set<OrganizationalProviderDto> orgaprovidersDisclosureIsMadeTo = new HashSet<OrganizationalProviderDto>(); for (ConsentOrganizationalProviderDisclosureIsMadeTo opdmt : consent .getOrganizationalProvidersDisclosureIsMadeTo()) { OrganizationalProviderDto optd2 = modelMapper.map( opdmt.getOrganizationalProvider(), OrganizationalProviderDto.class); orgaprovidersDisclosureIsMadeTo.add(optd2); } consentDto .setOrganizationalProvidersDisclosureIsMadeTo(orgaprovidersDisclosureIsMadeTo); Set<TypeCodesDto> consentDoNotShareClinicalDocumentTypeCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareClinicalDocumentTypeCode item : consent .getDoNotShareClinicalDocumentTypeCodes()) { TypeCodesDto tcd = new TypeCodesDto(); tcd.setDisplayName(item.getClinicalDocumentTypeCode() .getDisplayName()); tcd.setCode(item.getClinicalDocumentTypeCode().getCode()); tcd.setCodeSystem(item.getClinicalDocumentTypeCode() .getCodeSystem()); tcd.setCodeSystemName(item.getClinicalDocumentTypeCode() .getCodeSystemName()); consentDoNotShareClinicalDocumentTypeCode.add(tcd); } consentDto .setDoNotShareClinicalDocumentTypeCodes(consentDoNotShareClinicalDocumentTypeCode); Set<TypeCodesDto> consentDoNotShareClinicalDocumentSectionTypeCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareClinicalDocumentSectionTypeCode item : consent .getDoNotShareClinicalDocumentSectionTypeCodes()) { TypeCodesDto tcd1 = new TypeCodesDto(); tcd1.setDisplayName(item.getMedicalSection().getName()); tcd1.setCode(item.getMedicalSection().getCode()); tcd1.setCodeSystem(null); tcd1.setCodeSystemName(null); consentDoNotShareClinicalDocumentSectionTypeCode.add(tcd1); } consentDto .setDoNotShareClinicalDocumentSectionTypeCodes(consentDoNotShareClinicalDocumentSectionTypeCode); Set<TypeCodesDto> consentDoNotShareSensitivityPolicyCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareSensitivityPolicyCode item : consent .getDoNotShareSensitivityPolicyCodes()) { TypeCodesDto tcd2 = new TypeCodesDto(); tcd2.setDisplayName(item.getValueSetCategory().getName()); tcd2.setCode(item.getValueSetCategory().getCode()); tcd2.setCodeSystem(null); tcd2.setCodeSystemName(null); consentDoNotShareSensitivityPolicyCode.add(tcd2); } consentDto .setDoNotShareSensitivityPolicyCodes(consentDoNotShareSensitivityPolicyCode); Set<TypeCodesDto> consentShareForPurposeOfUseCode = new HashSet<TypeCodesDto>(); for (ConsentShareForPurposeOfUseCode item : consent .getShareForPurposeOfUseCodes()) { TypeCodesDto tcd3 = new TypeCodesDto(); tcd3.setDisplayName(item.getPurposeOfUseCode().getDisplayName()); tcd3.setCode(item.getPurposeOfUseCode().getCode()); tcd3.setCodeSystem(item.getPurposeOfUseCode().getCodeSystem()); tcd3.setCodeSystemName(item.getPurposeOfUseCode() .getCodeSystemName()); consentShareForPurposeOfUseCode.add(tcd3); } consentDto .setShareForPurposeOfUseCodes(consentShareForPurposeOfUseCode); Set<TypeCodesDto> consentDoNotShareClinicalConceptCodes = new HashSet<TypeCodesDto>(); for (ClinicalConceptCode item : consent .getDoNotShareClinicalConceptCodes()) { TypeCodesDto tcd4 = new TypeCodesDto(); tcd4.setDisplayName(item.getDisplayName()); tcd4.setCode(item.getCode()); tcd4.setCodeSystem(item.getCodeSystem()); tcd4.setCodeSystemName(item.getCodeSystemName()); consentDoNotShareClinicalConceptCodes.add(tcd4); } consentDto .setDoNotShareClinicalConceptCodes(consentDoNotShareClinicalConceptCodes); consentDto.setConsentStart(consent.getStartDate()); consentDto.setConsentEnd(consent.getEndDate()); consentDto.setSignedDate(consent.getSignedDate()); consentDto.setVersion(consent.getVersion()); consentDto.setRevocationDate(consent.getRevocationDate()); return consentDto; } ConsentExportMapperImpl(ModelMapper modelMapper); @Override ConsentDto map(Consent consent); ModelMapper getModelMapper(); void setModelMapper(ModelMapper modelMapper); }
ConsentExportMapperImpl implements ConsentExportMapper { @Override public ConsentDto map(Consent consent) { ConsentDto consentDto = new ConsentDto(); consentDto.setConsentReferenceid(consent.getConsentReferenceId()); PatientDto patientDto = modelMapper.map(consent.getPatient(), PatientDto.class); consentDto.setPatientDto(patientDto); if (consent.getLegalRepresentative() != null) { PatientDto legalRepresentativeDto = modelMapper.map( consent.getLegalRepresentative(), PatientDto.class); consentDto.setLegalRepresentative(legalRepresentativeDto); } Set<IndividualProviderDto> indiprovidersPermittedToDisclose = new HashSet<IndividualProviderDto>(); for (ConsentIndividualProviderPermittedToDisclose pptd : consent .getProvidersPermittedToDisclose()) { IndividualProviderDto iptd = modelMapper.map( pptd.getIndividualProvider(), IndividualProviderDto.class); indiprovidersPermittedToDisclose.add(iptd); } consentDto .setProvidersPermittedToDisclose(indiprovidersPermittedToDisclose); Set<IndividualProviderDto> indiprovidersDisclosureIsMadeTo = new HashSet<IndividualProviderDto>(); for (ConsentIndividualProviderDisclosureIsMadeTo pdmt : consent .getProvidersDisclosureIsMadeTo()) { IndividualProviderDto iptd2 = modelMapper.map( pdmt.getIndividualProvider(), IndividualProviderDto.class); indiprovidersDisclosureIsMadeTo.add(iptd2); } consentDto .setProvidersDisclosureIsMadeTo(indiprovidersDisclosureIsMadeTo); Set<OrganizationalProviderDto> orgaprovidersPermittedToDisclose = new HashSet<OrganizationalProviderDto>(); for (ConsentOrganizationalProviderPermittedToDisclose coptd : consent .getOrganizationalProvidersPermittedToDisclose()) { OrganizationalProviderDto optd = modelMapper.map( coptd.getOrganizationalProvider(), OrganizationalProviderDto.class); orgaprovidersPermittedToDisclose.add(optd); } consentDto .setOrganizationalProvidersPermittedToDisclose(orgaprovidersPermittedToDisclose); Set<OrganizationalProviderDto> orgaprovidersDisclosureIsMadeTo = new HashSet<OrganizationalProviderDto>(); for (ConsentOrganizationalProviderDisclosureIsMadeTo opdmt : consent .getOrganizationalProvidersDisclosureIsMadeTo()) { OrganizationalProviderDto optd2 = modelMapper.map( opdmt.getOrganizationalProvider(), OrganizationalProviderDto.class); orgaprovidersDisclosureIsMadeTo.add(optd2); } consentDto .setOrganizationalProvidersDisclosureIsMadeTo(orgaprovidersDisclosureIsMadeTo); Set<TypeCodesDto> consentDoNotShareClinicalDocumentTypeCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareClinicalDocumentTypeCode item : consent .getDoNotShareClinicalDocumentTypeCodes()) { TypeCodesDto tcd = new TypeCodesDto(); tcd.setDisplayName(item.getClinicalDocumentTypeCode() .getDisplayName()); tcd.setCode(item.getClinicalDocumentTypeCode().getCode()); tcd.setCodeSystem(item.getClinicalDocumentTypeCode() .getCodeSystem()); tcd.setCodeSystemName(item.getClinicalDocumentTypeCode() .getCodeSystemName()); consentDoNotShareClinicalDocumentTypeCode.add(tcd); } consentDto .setDoNotShareClinicalDocumentTypeCodes(consentDoNotShareClinicalDocumentTypeCode); Set<TypeCodesDto> consentDoNotShareClinicalDocumentSectionTypeCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareClinicalDocumentSectionTypeCode item : consent .getDoNotShareClinicalDocumentSectionTypeCodes()) { TypeCodesDto tcd1 = new TypeCodesDto(); tcd1.setDisplayName(item.getMedicalSection().getName()); tcd1.setCode(item.getMedicalSection().getCode()); tcd1.setCodeSystem(null); tcd1.setCodeSystemName(null); consentDoNotShareClinicalDocumentSectionTypeCode.add(tcd1); } consentDto .setDoNotShareClinicalDocumentSectionTypeCodes(consentDoNotShareClinicalDocumentSectionTypeCode); Set<TypeCodesDto> consentDoNotShareSensitivityPolicyCode = new HashSet<TypeCodesDto>(); for (ConsentDoNotShareSensitivityPolicyCode item : consent .getDoNotShareSensitivityPolicyCodes()) { TypeCodesDto tcd2 = new TypeCodesDto(); tcd2.setDisplayName(item.getValueSetCategory().getName()); tcd2.setCode(item.getValueSetCategory().getCode()); tcd2.setCodeSystem(null); tcd2.setCodeSystemName(null); consentDoNotShareSensitivityPolicyCode.add(tcd2); } consentDto .setDoNotShareSensitivityPolicyCodes(consentDoNotShareSensitivityPolicyCode); Set<TypeCodesDto> consentShareForPurposeOfUseCode = new HashSet<TypeCodesDto>(); for (ConsentShareForPurposeOfUseCode item : consent .getShareForPurposeOfUseCodes()) { TypeCodesDto tcd3 = new TypeCodesDto(); tcd3.setDisplayName(item.getPurposeOfUseCode().getDisplayName()); tcd3.setCode(item.getPurposeOfUseCode().getCode()); tcd3.setCodeSystem(item.getPurposeOfUseCode().getCodeSystem()); tcd3.setCodeSystemName(item.getPurposeOfUseCode() .getCodeSystemName()); consentShareForPurposeOfUseCode.add(tcd3); } consentDto .setShareForPurposeOfUseCodes(consentShareForPurposeOfUseCode); Set<TypeCodesDto> consentDoNotShareClinicalConceptCodes = new HashSet<TypeCodesDto>(); for (ClinicalConceptCode item : consent .getDoNotShareClinicalConceptCodes()) { TypeCodesDto tcd4 = new TypeCodesDto(); tcd4.setDisplayName(item.getDisplayName()); tcd4.setCode(item.getCode()); tcd4.setCodeSystem(item.getCodeSystem()); tcd4.setCodeSystemName(item.getCodeSystemName()); consentDoNotShareClinicalConceptCodes.add(tcd4); } consentDto .setDoNotShareClinicalConceptCodes(consentDoNotShareClinicalConceptCodes); consentDto.setConsentStart(consent.getStartDate()); consentDto.setConsentEnd(consent.getEndDate()); consentDto.setSignedDate(consent.getSignedDate()); consentDto.setVersion(consent.getVersion()); consentDto.setRevocationDate(consent.getRevocationDate()); return consentDto; } ConsentExportMapperImpl(ModelMapper modelMapper); @Override ConsentDto map(Consent consent); ModelMapper getModelMapper(); void setModelMapper(ModelMapper modelMapper);  }