├── pcm ├── src │ ├── main │ │ ├── resources │ │ │ ├── i18n │ │ │ │ └── messages │ │ │ │ │ ├── messages_cn.properties │ │ │ │ │ ├── messages.properties │ │ │ │ │ ├── header_messages_cn.properties │ │ │ │ │ ├── header_messages.properties │ │ │ │ │ ├── sidebar_messages.properties │ │ │ │ │ ├── sidebar_messages_cn.properties │ │ │ │ │ ├── list_consent_messages.properties │ │ │ │ │ └── list_consent_messages_cn.properties │ │ │ ├── META-INF │ │ │ │ └── services │ │ │ │ │ ├── javax.xml.ws.spi.Provider │ │ │ │ │ ├── javax.xml.xpath.XPathFactory │ │ │ │ │ └── javax.xml.transform.TransformerFactory │ │ │ ├── db │ │ │ │ └── migration │ │ │ │ │ ├── V2.1.2__Remove emergency from purpose of use.sql │ │ │ │ │ ├── V4.0.0__Add created_date_time field to consent table.sql │ │ │ │ │ ├── V6.1.1__Alter Table patient to increase the length of username.sql │ │ │ │ │ ├── V6.2.0__Alter Table patient audit to increase the length of username.sql │ │ │ │ │ ├── V4.0.1__Add created_date_time field to consent_aud table.sql │ │ │ │ │ ├── V3.0.0__Remove medication information categories.sql │ │ │ │ │ ├── V6.3.5__Remove sensitive categories without valuesets.sql │ │ │ │ │ ├── V4.1.6__Add status column in attested consent and attested consent revocation tables.sql │ │ │ │ │ ├── V4.1.5__Drop spring security authorities and users tables.sql │ │ │ │ │ ├── V6.3.0__Remove_Not_Null_Constrain_On_attester_middle_name_Field.sql │ │ │ │ │ ├── V4.1.0__Add new consent_terms_versions table.sql │ │ │ │ │ ├── V4.1.7__Insert disabled record into consent_terms_versions table.sql │ │ │ │ │ ├── V4.1.1__Add new consent_revocation_terms_versions table.sql │ │ │ │ │ ├── V4.1.8__Insert disabled record into consent_revocation_terms_versions table.sql │ │ │ │ │ ├── V1.0.2__Administrative gender code lookup data.sql │ │ │ │ │ ├── V4.1.9__Move status column from attested consent and attested consent revoke tables to consent tables.sql │ │ │ │ │ ├── V2.1.0__Add display order and govern type columns in valueset category.sql │ │ │ │ │ ├── V1.0.9__Ethnic group code lookup data.sql │ │ │ │ │ ├── V5.0.0__Create and insert revisionTypeCode.sql │ │ │ │ │ ├── V4.2.0__Remove signedpdfconsent and signedpdfconsent_revocation tables.sql │ │ │ │ │ ├── V1.0.14__Legal representative type code lookup data.sql │ │ │ │ │ ├── V2.1.3__Add descriptions in purpose of use code.sql │ │ │ │ │ ├── V1.0.21__Product form code lookup data.sql │ │ │ │ │ ├── V4.1.2__Insert record into consent_terms_versions table.sql │ │ │ │ │ ├── V1.0.8__Country code lookup data.sql │ │ │ │ │ ├── V1.0.1__Address use code lookup data.sql │ │ │ │ │ ├── V1.0.35__Telecom use code lookup data.sql │ │ │ │ │ ├── V1.0.3__Body site code lookup data.sql │ │ │ │ │ ├── V1.0.19__Problem status code lookup data.sql │ │ │ │ │ ├── V1.0.34__Target site code lookup data.sql │ │ │ │ │ ├── V1.0.20__Procedure status code lookup data.sql │ │ │ │ │ ├── V1.0.16__Medication status code lookup data.sql │ │ │ │ │ ├── V1.0.31__Social history status code lookup data.sql │ │ │ │ │ ├── V1.0.23__Purpose of use code lookup data.sql │ │ │ │ │ ├── V1.0.13__Language proficiency code lookup data.sql │ │ │ │ │ ├── V1.0.7__Consent directive type code lookup data.sql │ │ │ │ │ ├── V1.0.29__Route code lookup data.sql │ │ │ │ │ ├── V2.0.0__Create staff individual and organizational provider.sql │ │ │ │ │ ├── V1.1.0__Add unique constraints to valueset schema.sql │ │ │ │ │ ├── V1.0.10__Facility type code lookup data.sql │ │ │ │ │ ├── V1.0.12__Language code lookup data.sql │ │ │ │ │ ├── V1.0.28__Result status code lookup data.sql │ │ │ │ │ ├── V1.0.6__Confidentiality code lookup data.sql │ │ │ │ │ ├── V1.0.24__Race code lookup data.sql │ │ │ │ │ ├── V1.0.11__Language ability code lookup data.sql │ │ │ │ │ ├── V1.3.0__Tinyint to BIT 1 changes.sql │ │ │ │ │ ├── V1.0.18__Privacy law policy code lookup data.sql │ │ │ │ │ ├── V6.3.6__Drop unecessary columns in individual and organizational providers.sql │ │ │ │ │ ├── V6.3.2__Add not null constraint to attested_consent and attested_consent_revocationt.sql │ │ │ │ │ ├── V1.0.36__Unit of measure code lookup data.sql │ │ │ │ │ ├── V6.0.1__Add missing audit related fields to attested_consent, attested_consent_aud, attested_consent_revocation, and attested_consent_revocation_aud.sql │ │ │ │ │ ├── V1.0.27__Result interpretation code lookup data.sql │ │ │ │ │ ├── V1.2.0__Add unique constraints to consent and patient.sql │ │ │ │ │ ├── V6.3.3__Rename foreign key column names.sql │ │ │ │ │ ├── V1.0.5__Clinical document type code lookup data.sql │ │ │ │ │ ├── V4.1.3__Insert record into consent_revocation_terms_versions table.sql │ │ │ │ │ ├── V1.0.15__Marital status code lookup data.sql │ │ │ │ │ ├── V6.3.1__Insert new record into consent_revocation_terms_versions table.sql │ │ │ │ │ ├── V1.0.30__Sensitivity policy code lookup data.sql │ │ │ │ │ └── V1.0.32__Social history type code lookup data.sql │ │ │ ├── schema │ │ │ │ └── cdar2c32 │ │ │ │ │ └── infrastructure │ │ │ │ │ └── cda │ │ │ │ │ ├── NIST_Disclaimer.doc │ │ │ │ │ └── C32_CDA.xsd │ │ │ ├── activity │ │ │ │ └── PatientActivityHistory.sql │ │ │ ├── bootstrap.yml │ │ │ └── templates │ │ │ │ ├── account-updated-template.html │ │ │ │ └── user-profile-updated-template.html │ │ ├── java │ │ │ └── gov │ │ │ │ └── samhsa │ │ │ │ └── c2s │ │ │ │ ├── vss │ │ │ │ ├── VssBasePackageMarkerInterface.java │ │ │ │ ├── service │ │ │ │ │ ├── DuplicateConceptCodeException.java │ │ │ │ │ ├── ConceptCodeNotFoundException.java │ │ │ │ │ ├── CodeSystemNotFoundException.java │ │ │ │ │ ├── CodeSystemVersionNotFoundException.java │ │ │ │ │ ├── dto │ │ │ │ │ │ ├── MedicalSectionDto.java │ │ │ │ │ │ ├── ValueSetCategoryDto.java │ │ │ │ │ │ ├── ConceptCodeAndCodeSystemOidDto.java │ │ │ │ │ │ ├── ValueSetVSCDto.java │ │ │ │ │ │ ├── ValueSetQueryDto.java │ │ │ │ │ │ ├── CSVersionsDto.java │ │ │ │ │ │ ├── ValueSetLookUpDto.java │ │ │ │ │ │ ├── ValueSetQueryListDto.java │ │ │ │ │ │ ├── CodeSystemVersionCSDto.java │ │ │ │ │ │ ├── CodeSystemDto.java │ │ │ │ │ │ ├── ConceptCodeVSCSDto.java │ │ │ │ │ │ └── CodeSystemVersionDto.java │ │ │ │ │ ├── ValueSetNotFoundException.java │ │ │ │ │ ├── ValueSetCategoryNotFoundException.java │ │ │ │ │ ├── InvalidCSVException.java │ │ │ │ │ ├── ValueSetLookupService.java │ │ │ │ │ └── CodeSystemService.java │ │ │ │ └── config │ │ │ │ │ └── VssProperties.java │ │ │ │ └── pcm │ │ │ │ ├── domain │ │ │ │ ├── PcmDomainBasePackageMarkerInterface.java │ │ │ │ ├── SecurityEvent.java │ │ │ │ ├── reference │ │ │ │ │ └── RevisionTypeCode.java │ │ │ │ ├── consent │ │ │ │ │ ├── ConsentTermsVersionsRepository.java │ │ │ │ │ ├── ConsentRevocationTermsVersionsRepository.java │ │ │ │ │ ├── ConsentTermsVersions.java │ │ │ │ │ └── ConsentRevocationTermsVersions.java │ │ │ │ └── DomainEvent.java │ │ │ │ ├── service │ │ │ │ ├── dto │ │ │ │ │ ├── HasId.java │ │ │ │ │ ├── AttestedDto.java │ │ │ │ │ ├── RevocationDto.java │ │ │ │ │ ├── AttestationDto.java │ │ │ │ │ ├── CCDDto.java │ │ │ │ │ ├── XacmlDto.java │ │ │ │ │ ├── RecentPatientDto.java │ │ │ │ │ ├── OpenIDConnectUserInfoDto.java │ │ │ │ │ ├── ConsentRevocationTermsVersionsDto.java │ │ │ │ │ └── ActivityHistoryListDto.java │ │ │ │ ├── exception │ │ │ │ │ ├── AttestedConsentException.java │ │ │ │ │ ├── AttestedConsentRevocationException.java │ │ │ │ │ ├── ConsentTermsVersionNotFoundException.java │ │ │ │ │ ├── ConsentRevocationTermsVersionNotFoundException.java │ │ │ │ │ ├── ProviderNotFoundException.java │ │ │ │ │ ├── ConflictingConsentException.java │ │ │ │ │ ├── OversizedFileException.java │ │ │ │ │ ├── ProviderAlreadyInUseException.java │ │ │ │ │ ├── InvalidFileExtensionException.java │ │ │ │ │ ├── CannotDeleteProviderException.java │ │ │ │ │ ├── InvalidClinicalDocumentException.java │ │ │ │ │ ├── InvalidDeleteDocumentRequestException.java │ │ │ │ │ ├── InvalidConsentDatesException.java │ │ │ │ │ ├── CannotDeleteConsentException.java │ │ │ │ │ ├── MissingPurposeOfUseException.java │ │ │ │ │ ├── TooManyProvidersSelectedException.java │ │ │ │ │ ├── ConsentNotBelongingToPatientException.java │ │ │ │ │ ├── UnprocessableConsentAddRequestException.java │ │ │ │ │ ├── CannotDeserializeProviderResultException.java │ │ │ │ │ ├── XacmlNotFoundException.java │ │ │ │ │ ├── ViewActivitiesException.java │ │ │ │ │ ├── PatientNotFoundException.java │ │ │ │ │ ├── InternalServerErrorException.java │ │ │ │ │ ├── ConsentPdfGenerationException.java │ │ │ │ │ └── ConsentRevocationPdfGenerationException.java │ │ │ │ ├── consentexport │ │ │ │ │ └── ConsentExportMapper.java │ │ │ │ ├── consent │ │ │ │ │ ├── ConsentStatus.java │ │ │ │ │ ├── ConsentCheckService.java │ │ │ │ │ ├── ConsentRevocationTermsVersionsService.java │ │ │ │ │ └── PolicyIdService.java │ │ │ │ ├── userinfo │ │ │ │ │ └── OpenIDConnectUserInfoService.java │ │ │ │ ├── fhir │ │ │ │ │ ├── FhirPatientService.java │ │ │ │ │ ├── FhirConsentService.java │ │ │ │ │ └── FHIRFormatErrorException.java │ │ │ │ ├── pdf │ │ │ │ │ ├── ConsentRevocationPdfGenerator.java │ │ │ │ │ └── ConsentPdfGenerator.java │ │ │ │ └── audit │ │ │ │ │ ├── ActivityHistoryQueryInfo.java │ │ │ │ │ └── ActivityHistoryRowMapper.java │ │ │ │ ├── infrastructure │ │ │ │ ├── pdfbox │ │ │ │ │ ├── TextAlignment.java │ │ │ │ │ ├── PdfBoxPageSize.java │ │ │ │ │ ├── PdfBoxFont.java │ │ │ │ │ ├── Column.java │ │ │ │ │ ├── PdfBoxStyle.java │ │ │ │ │ ├── TableAttribute.java │ │ │ │ │ └── Paragraph.java │ │ │ │ ├── pagination │ │ │ │ │ ├── SetQueryInfoMapping.java │ │ │ │ │ ├── JdbcPagingRepository.java │ │ │ │ │ ├── JdbcPagingException.java │ │ │ │ │ └── sql │ │ │ │ │ │ └── SqlFromClause.java │ │ │ │ ├── securityevent │ │ │ │ │ ├── SecurityPredicateKey.java │ │ │ │ │ ├── UserCreatedEvent.java │ │ │ │ │ ├── AuthenticationFailedEvent.java │ │ │ │ │ ├── SecurityAuditVerb.java │ │ │ │ │ ├── UnauthorizedAccessAttemptedEvent.java │ │ │ │ │ ├── MaliciousFileDetectedEvent.java │ │ │ │ │ ├── FileUploadedEvent.java │ │ │ │ │ └── FileDownloadedEvent.java │ │ │ │ ├── dto │ │ │ │ │ ├── EntityType.java │ │ │ │ │ ├── ClinicalDocumentValidationRequest.java │ │ │ │ │ └── ClinicalDocumentValidationResult.java │ │ │ │ ├── SqlScriptProvider.java │ │ │ │ ├── security │ │ │ │ │ ├── InfectedFileException.java │ │ │ │ │ └── ClamAVClientNotAvailableException.java │ │ │ │ ├── PhrService.java │ │ │ │ ├── eventlistener │ │ │ │ │ ├── LoggingSessionDestroyedEventListener.java │ │ │ │ │ ├── SessionTimeoutConfigSessionCreatedEventListener.java │ │ │ │ │ ├── SecurityEventListener.java │ │ │ │ │ ├── EventListener.java │ │ │ │ │ └── EventService.java │ │ │ │ ├── PlsService.java │ │ │ │ ├── exception │ │ │ │ │ ├── SqlScriptFileException.java │ │ │ │ │ ├── PdfGenerationException.java │ │ │ │ │ ├── InvalidContentException.java │ │ │ │ │ └── InvalidTableAttributeException.java │ │ │ │ ├── DssService.java │ │ │ │ ├── ImprovedNamingStrategy.java │ │ │ │ └── ClasspathSqlScriptProvider.java │ │ │ │ ├── config │ │ │ │ ├── ModelMapperConfig.java │ │ │ │ ├── ApplicationContextConfig.java │ │ │ │ ├── ValidatorConfig.java │ │ │ │ ├── SpringContext.java │ │ │ │ ├── WebConfig.java │ │ │ │ ├── OAuth2FeignClientConfig.java │ │ │ │ ├── PdfProperties.java │ │ │ │ ├── FHIRProperties.java │ │ │ │ ├── CommonLibraryConfig.java │ │ │ │ └── FhirServiceConfig.java │ │ │ │ ├── web │ │ │ │ └── ObligationRestController.java │ │ │ │ └── PatientConsentManagementApplication.java │ │ └── docker │ │ │ └── Dockerfile │ └── test │ │ └── java │ │ └── gov │ │ └── samhsa │ │ └── c2s │ │ ├── pcm │ │ ├── domain │ │ │ ├── patient │ │ │ │ └── PatientTest.java │ │ │ ├── clinicaldata │ │ │ │ ├── AllergyTest.java │ │ │ │ ├── ProblemTest.java │ │ │ │ ├── MedicationTest.java │ │ │ │ ├── SocialHistoryTest.java │ │ │ │ ├── ClinicalDocumentTest.java │ │ │ │ ├── ResultObservationTest.java │ │ │ │ └── ProcedureObservationTest.java │ │ │ ├── provider │ │ │ │ ├── IndividualProviderTest.java │ │ │ │ └── OrganizationalProviderTest.java │ │ │ ├── educationmaterial │ │ │ │ └── EducationMaterialTest.java │ │ │ └── DomainEventServiceImplTest.java │ │ ├── PatientConsentManagementApplicationIntegrationTest.java │ │ └── infrastructure │ │ │ └── eventlistener │ │ │ ├── UserCreatedEventListenerTest.java │ │ │ ├── FileUploadedEventListenerTest.java │ │ │ ├── FileDownloadedEventListenerTest.java │ │ │ ├── UnauthorizedAccessAttemptedEventListenerTest.java │ │ │ ├── MaliciousFileDetectedEventListenerTest.java │ │ │ └── AuthenticationFailedEventListenerTest.java │ │ └── common │ │ └── consentgen │ │ ├── pg │ │ └── XacmlXslUrlProviderImplTest.java │ │ └── XacmlXslUrlProviderImplTest.java └── .mvn │ └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── NOTICE └── tool-scripts ├── decreaseMajorVersionAndCommit.bat ├── decreaseMinorVersionAndCommit.bat ├── increaseMinorVersionAndCommit.bat └── increaseMajorVersionAndCommit.bat /pcm/src/main/resources/i18n/messages/messages_cn.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pcm/src/main/resources/META-INF/services/javax.xml.ws.spi.Provider: -------------------------------------------------------------------------------- 1 | org.apache.cxf.jaxws22.spi.ProviderImpl -------------------------------------------------------------------------------- /pcm/src/main/resources/META-INF/services/javax.xml.xpath.XPathFactory: -------------------------------------------------------------------------------- 1 | net.sf.saxon.xpath.XPathFactoryImpl -------------------------------------------------------------------------------- /pcm/src/main/resources/i18n/messages/messages.properties: -------------------------------------------------------------------------------- 1 | welcome=default welcome 2 | sidebar_logout=hello -------------------------------------------------------------------------------- /pcm/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bhits/pcm-api/HEAD/pcm/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /pcm/src/main/resources/META-INF/services/javax.xml.transform.TransformerFactory: -------------------------------------------------------------------------------- 1 | net.sf.saxon.TransformerFactoryImpl -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V2.1.2__Remove emergency from purpose of use.sql: -------------------------------------------------------------------------------- 1 | DELETE from purpose_of_use_code where code="EMERGENCY"; -------------------------------------------------------------------------------- /pcm/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V4.0.0__Add created_date_time field to consent table.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE consent ADD COLUMN created_date_time DATETIME; -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V6.1.1__Alter Table patient to increase the length of username.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE patient MODIFY username VARCHAR(255); 2 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V6.2.0__Alter Table patient audit to increase the length of username.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE patient_audit MODIFY username VARCHAR(255); -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/VssBasePackageMarkerInterface.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss; 2 | 3 | public interface VssBasePackageMarkerInterface { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/domain/PcmDomainBasePackageMarkerInterface.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain; 2 | 3 | public interface PcmDomainBasePackageMarkerInterface { 4 | } 5 | -------------------------------------------------------------------------------- /pcm/src/main/resources/schema/cdar2c32/infrastructure/cda/NIST_Disclaimer.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bhits/pcm-api/HEAD/pcm/src/main/resources/schema/cdar2c32/infrastructure/cda/NIST_Disclaimer.doc -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/dto/HasId.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.dto; 2 | 3 | public interface HasId { 4 | public String getId(); 5 | public void setId(String id); 6 | } 7 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/pdfbox/TextAlignment.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.pdfbox; 2 | 3 | public enum TextAlignment { 4 | CENTER, 5 | LEFT, 6 | RIGHT 7 | } 8 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V4.0.1__Add created_date_time field to consent_aud table.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE consent_aud ADD COLUMN created_date_time DATETIME; 2 | ALTER TABLE consent_aud ADD COLUMN created_date_time_mod BIT(1); -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V3.0.0__Remove medication information categories.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE consent_do_not_share_clinical_document_section_type_code; 2 | DROP TABLE medical_section_aud; 3 | DROP TABLE medical_section; 4 | 5 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V6.3.5__Remove sensitive categories without valuesets.sql: -------------------------------------------------------------------------------- 1 | /* Remove the sensitive categories of Genetic and Addiction, which don't have any value sets */ 2 | DELETE FROM pcm.value_set_category 3 | where code = 'GDIS' or code = 'ADD'; -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V4.1.6__Add status column in attested consent and attested consent revocation tables.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE pcm.attested_consent ADD status VARCHAR(255) NOT NULL ; 2 | ALTER TABLE pcm.attested_consent_revocation ADD status VARCHAR(255) NOT NULL ; -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/DuplicateConceptCodeException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service; 2 | 3 | public class DuplicateConceptCodeException extends Exception { 4 | 5 | private static final long serialVersionUID = 6339005605941165283L; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V4.1.5__Drop spring security authorities and users tables.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `pcm`.authorities DROP FOREIGN KEY fk_authorities_users; 2 | ALTER TABLE `pcm`.authorities DROP KEY ix_auth_username; 3 | DROP TABLE `pcm`.authorities; 4 | DROP TABLE `pcm`.users; -------------------------------------------------------------------------------- /pcm/src/main/resources/i18n/messages/header_messages_cn.properties: -------------------------------------------------------------------------------- 1 | #header 2 | header_in_box=\u6536\u4EF6\u7BB1 3 | header_my_account=\u6211\u7684\u5E10\u6237 4 | header_my_profile=\u6211\u7684\u8D44\u6599 5 | header_change_password=\u4FEE\u6539\u5BC6\u7801 6 | header_logout=\u767B\u51FA -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V6.3.0__Remove_Not_Null_Constrain_On_attester_middle_name_Field.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE attested_consent MODIFY attester_middle_name varchar(255) NULL DEFAULT NULL; 2 | ALTER TABLE attested_consent_revocation MODIFY attester_middle_name varchar(255) NULL DEFAULT NULL; -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/pdfbox/PdfBoxPageSize.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.pdfbox; 2 | 3 | public enum PdfBoxPageSize { 4 | LETTER, 5 | LEGAL, 6 | A0, 7 | A1, 8 | A2, 9 | A3, 10 | A4, 11 | A5, 12 | A6 13 | } 14 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/AttestedConsentException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | public class AttestedConsentException extends RuntimeException { 4 | 5 | public AttestedConsentException(String message) { 6 | super(message); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/domain/SecurityEvent.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain; 2 | 3 | public abstract class SecurityEvent{ 4 | String ipAddress; 5 | 6 | public String getIpAddress() { 7 | return ipAddress; 8 | } 9 | 10 | public SecurityEvent(String ipAddress) { 11 | this.ipAddress = ipAddress; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pcm/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM bhits/java-jar-runner:8u102-jre 2 | VOLUME /java 3 | 4 | # Copy application jar to container, argument is defined in pom.xml 5 | ARG finalName 6 | ENV JAR_FILE $finalName 7 | COPY $finalName / 8 | 9 | # Default active docker profile 10 | ENV DEFAULT_PROGRAM_ARGS --spring.profiles.active=application-default,docker -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/AttestedConsentRevocationException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | public class AttestedConsentRevocationException extends RuntimeException { 4 | 5 | public AttestedConsentRevocationException(String message) { 6 | super(message); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/consentexport/ConsentExportMapper.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.consentexport; 2 | 3 | import gov.samhsa.c2s.pcm.domain.consent.Consent; 4 | import gov.samhsa.c2s.common.consentgen.ConsentDto; 5 | 6 | public interface ConsentExportMapper { 7 | 8 | ConsentDto map(Consent consent); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/ConsentTermsVersionNotFoundException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | public class ConsentTermsVersionNotFoundException extends RuntimeException { 4 | 5 | public ConsentTermsVersionNotFoundException(String message) { 6 | super(message); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V4.1.0__Add new consent_terms_versions table.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE consent_terms_versions ( 2 | id BIGINT(20) AUTO_INCREMENT NOT NULL, 3 | consent_terms_text TEXT NOT NULL, 4 | added_date_time DATETIME NOT NULL, 5 | version_disabled BIT(1) DEFAULT 0, 6 | CONSTRAINT PK_CONSENT_TERMS_VERSIONS PRIMARY KEY (id) 7 | ); -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/consent/ConsentStatus.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.consent; 2 | 3 | public interface ConsentStatus { 4 | 5 | public static final String CONSENT_SIGNED = "CONSENT_SIGNED"; 6 | public static final String CONSENT_SAVED = "CONSENT_SAVED"; 7 | public static final String REVOCATION_REVOKED = "REVOCATION_REVOKED"; 8 | } 9 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/userinfo/OpenIDConnectUserInfoService.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.userinfo; 2 | 3 | import gov.samhsa.c2s.pcm.service.dto.OpenIDConnectUserInfoDto; 4 | 5 | import java.security.Principal; 6 | 7 | public interface OpenIDConnectUserInfoService { 8 | OpenIDConnectUserInfoDto getUserInfo(Principal principal); 9 | } 10 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/ConsentRevocationTermsVersionNotFoundException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | public class ConsentRevocationTermsVersionNotFoundException extends RuntimeException { 4 | 5 | public ConsentRevocationTermsVersionNotFoundException(String message) { 6 | super(message); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V4.1.7__Insert disabled record into consent_terms_versions table.sql: -------------------------------------------------------------------------------- 1 | insert into pcm.consent_terms_versions (consent_terms_text, added_date_time, version_disabled) values ('ATTESTER_FULL_NAME - THIS CONSENT TERMS VERSION RECORD IS DISABLED. IF YOU ARE SEEING THIS, THEN THERE IS A BUG IN THE CODE AND/OR DATABASE SCRIPT SOMEWHERE.','2016-06-02 00:00:00',true); -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/consent/ConsentCheckService.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.consent; 2 | 3 | import gov.samhsa.c2s.pcm.service.dto.ConsentDto; 4 | import gov.samhsa.c2s.pcm.service.dto.ConsentValidationDto; 5 | 6 | public interface ConsentCheckService { 7 | 8 | public ConsentValidationDto getConflictConsent(ConsentDto consentDto); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V4.1.1__Add new consent_revocation_terms_versions table.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE consent_revocation_terms_versions ( 2 | id BIGINT(20) AUTO_INCREMENT NOT NULL, 3 | consent_revoke_terms_text TEXT NOT NULL, 4 | added_date_time DATETIME NOT NULL, 5 | version_disabled BIT(1) DEFAULT 0, 6 | CONSTRAINT PK_CONSENT_REVOCATION_TERMS_VERSIONS PRIMARY KEY (id) 7 | ); -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V4.1.8__Insert disabled record into consent_revocation_terms_versions table.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO consent_revocation_terms_versions (consent_revoke_terms_text, added_date_time, version_disabled) VALUES ('THIS CONSENT REVOCATION TERMS VERSION RECORD IS DISABLED. IF YOU ARE SEEING THIS, THEN THERE IS A BUG IN THE CODE AND/OR DATABASE SCRIPT SOMEWHERE.','2016-06-02 00:00:00',true); -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/pagination/SetQueryInfoMapping.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.pagination; 2 | 3 | import org.springframework.jdbc.core.RowMapper; 4 | 5 | public interface SetQueryInfoMapping { 6 | public abstract RowMapper getRowMapper(); 7 | 8 | public abstract String getTableName(); 9 | 10 | public abstract String getIdColumn(); 11 | } 12 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/securityevent/SecurityPredicateKey.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.securityevent; 2 | 3 | import gov.samhsa.c2s.common.audit.PredicateKey; 4 | 5 | public enum SecurityPredicateKey implements PredicateKey { 6 | IP_ADDRESS; 7 | 8 | @Override 9 | public String getPredicateKey() { 10 | return this.toString(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/fhir/FhirPatientService.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.fhir; 2 | 3 | 4 | import gov.samhsa.c2s.pcm.infrastructure.dto.PatientDto; 5 | import org.hl7.fhir.dstu3.model.Patient; 6 | 7 | public interface FhirPatientService { 8 | 9 | /* converts patientdto to fhir patient object */ 10 | public Patient createFhirPatient(PatientDto patientDto); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.2__Administrative gender code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into administrative_gender_code (id, code, display_name, code_system_name, code_system) values (1, 'F', 'Female', 'AdministrativeGender', '2.16.840.1.113883.5.1'); 2 | insert into administrative_gender_code (id, code, display_name, code_system_name, code_system) values (2, 'M', 'Male', 'AdministrativeGender', '2.16.840.1.113883.5.1'); -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V4.1.9__Move status column from attested consent and attested consent revoke tables to consent tables.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE pcm.attested_consent DROP COLUMN status ; 2 | ALTER TABLE pcm.attested_consent_revocation DROP COLUMN status; 3 | ALTER TABLE pcm.consent ADD status VARCHAR(255) NOT NULL ; 4 | ALTER TABLE pcm.consent_aud ADD status VARCHAR(255); 5 | ALTER TABLE pcm.consent_aud ADD status_mod BIT(1) NULL ; -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/dto/EntityType.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.dto; 2 | 3 | import lombok.Data; 4 | 5 | import javax.validation.constraints.NotNull; 6 | 7 | @Data 8 | public class EntityType { 9 | /* 10 | entityTypeCode =1 Individual 11 | entityTypeCode =2 Organization 12 | */ 13 | @NotNull 14 | private String code; 15 | private String displayName; 16 | } -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V2.1.0__Add display order and govern type columns in valueset category.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE value_set_category ADD COLUMN is_federal BOOLEAN NOT NULL; 2 | ALTER TABLE value_set_category ADD COLUMN display_order BIGINT UNSIGNED UNIQUE; 3 | 4 | ALTER TABLE value_set_category_aud ADD COLUMN is_federal BOOLEAN NOT NULL; 5 | ALTER TABLE value_set_category_aud ADD COLUMN display_order BIGINT UNSIGNED UNIQUE; 6 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/ConceptCodeNotFoundException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service; 2 | 3 | public class ConceptCodeNotFoundException extends Exception { 4 | 5 | private static final long serialVersionUID = 3234232442718766659L; 6 | 7 | public ConceptCodeNotFoundException() { 8 | super(); 9 | } 10 | 11 | public ConceptCodeNotFoundException(String message) { 12 | super(message); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.9__Ethnic group code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into ethnic_group_code (id, code, display_name, code_system_name, code_system) values (1, '2135-2', 'Hispanic or Latino', 'Race and Ethnicity - CDC', '2.16.840.1.113883.6.238'); 2 | insert into ethnic_group_code (id, code, display_name, code_system_name, code_system) values (2, '2186-5', 'Not Hispanic or Latino', 'Race and Ethnicity - CDC', '2.16.840.1.113883.6.238'); 3 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/domain/patient/PatientTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.patient; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.junit.runners.JUnit4; 6 | import org.springframework.mock.staticmock.MockStaticEntityMethods; 7 | 8 | @RunWith(JUnit4.class) 9 | @MockStaticEntityMethods 10 | public class PatientTest { 11 | 12 | @Test 13 | public void testMethod() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/SqlScriptProvider.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure; 2 | 3 | /** 4 | * An interface that returns a sql script string that can be used by the report 5 | * data providers. 6 | * 7 | * @see 8 | */ 9 | public interface SqlScriptProvider { 10 | 11 | /** 12 | * Gets the sql script. 13 | * 14 | * @return the sql script 15 | */ 16 | public abstract String getSqlScript(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/CodeSystemNotFoundException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service; 2 | 3 | public class CodeSystemNotFoundException extends Exception { 4 | 5 | 6 | /** 7 | * 8 | */ 9 | private static final long serialVersionUID = 2836654552303613383L; 10 | 11 | public CodeSystemNotFoundException() { 12 | super(); 13 | } 14 | 15 | public CodeSystemNotFoundException(String msg) { 16 | super(msg); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/CodeSystemVersionNotFoundException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service; 2 | 3 | public class CodeSystemVersionNotFoundException extends Exception { 4 | 5 | private static final long serialVersionUID = 8942118794723776513L; 6 | 7 | public CodeSystemVersionNotFoundException() { 8 | super(); 9 | } 10 | 11 | public CodeSystemVersionNotFoundException(String message) { 12 | super(message); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/pagination/JdbcPagingRepository.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.pagination; 2 | 3 | import org.springframework.data.domain.Page; 4 | import org.springframework.data.domain.Pageable; 5 | 6 | public interface JdbcPagingRepository { 7 | 8 | public abstract Page findAll(Pageable pageable); 9 | 10 | public abstract Page findAllByArgs(Pageable pageable, Object... args); 11 | } 12 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/domain/clinicaldata/AllergyTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.clinicaldata; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.junit.runners.JUnit4; 6 | import org.springframework.mock.staticmock.MockStaticEntityMethods; 7 | 8 | @RunWith(JUnit4.class) 9 | @MockStaticEntityMethods 10 | public class AllergyTest { 11 | 12 | @Test 13 | public void testMethod() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/domain/clinicaldata/ProblemTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.clinicaldata; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.junit.runners.JUnit4; 6 | import org.springframework.mock.staticmock.MockStaticEntityMethods; 7 | 8 | @RunWith(JUnit4.class) 9 | @MockStaticEntityMethods 10 | public class ProblemTest { 11 | 12 | @Test 13 | public void testMethod() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/ProviderNotFoundException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.NOT_FOUND) 7 | public class ProviderNotFoundException extends RuntimeException{ 8 | public ProviderNotFoundException(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/domain/clinicaldata/MedicationTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.clinicaldata; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.junit.runners.JUnit4; 6 | import org.springframework.mock.staticmock.MockStaticEntityMethods; 7 | 8 | @RunWith(JUnit4.class) 9 | @MockStaticEntityMethods 10 | public class MedicationTest { 11 | 12 | @Test 13 | public void testMethod() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/ConflictingConsentException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.CONFLICT) 7 | public class ConflictingConsentException extends RuntimeException { 8 | public ConflictingConsentException(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/OversizedFileException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class OversizedFileException extends RuntimeException { 8 | public OversizedFileException(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/domain/clinicaldata/SocialHistoryTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.clinicaldata; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.junit.runners.JUnit4; 6 | import org.springframework.mock.staticmock.MockStaticEntityMethods; 7 | 8 | @RunWith(JUnit4.class) 9 | @MockStaticEntityMethods 10 | public class SocialHistoryTest { 11 | 12 | @Test 13 | public void testMethod() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/security/InfectedFileException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.security; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class InfectedFileException extends RuntimeException{ 8 | public InfectedFileException(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/ProviderAlreadyInUseException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.CONFLICT) 7 | public class ProviderAlreadyInUseException extends RuntimeException { 8 | public ProviderAlreadyInUseException(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/domain/provider/IndividualProviderTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.provider; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.junit.runners.JUnit4; 6 | import org.springframework.mock.staticmock.MockStaticEntityMethods; 7 | 8 | @RunWith(JUnit4.class) 9 | @MockStaticEntityMethods 10 | public class IndividualProviderTest { 11 | 12 | @Test 13 | public void testMethod() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/domain/clinicaldata/ClinicalDocumentTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.clinicaldata; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.junit.runners.JUnit4; 6 | import org.springframework.mock.staticmock.MockStaticEntityMethods; 7 | 8 | @RunWith(JUnit4.class) 9 | @MockStaticEntityMethods 10 | public class ClinicalDocumentTest { 11 | 12 | @Test 13 | public void testMethod() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/domain/clinicaldata/ResultObservationTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.clinicaldata; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.junit.runners.JUnit4; 6 | import org.springframework.mock.staticmock.MockStaticEntityMethods; 7 | 8 | @RunWith(JUnit4.class) 9 | @MockStaticEntityMethods 10 | public class ResultObservationTest { 11 | 12 | @Test 13 | public void testMethod() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/domain/provider/OrganizationalProviderTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.provider; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.junit.runners.JUnit4; 6 | import org.springframework.mock.staticmock.MockStaticEntityMethods; 7 | 8 | @RunWith(JUnit4.class) 9 | @MockStaticEntityMethods 10 | public class OrganizationalProviderTest { 11 | 12 | @Test 13 | public void testMethod() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/domain/clinicaldata/ProcedureObservationTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.clinicaldata; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.junit.runners.JUnit4; 6 | import org.springframework.mock.staticmock.MockStaticEntityMethods; 7 | 8 | @RunWith(JUnit4.class) 9 | @MockStaticEntityMethods 10 | public class ProcedureObservationTest { 11 | 12 | @Test 13 | public void testMethod() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Consent2Share 2 | 3 | Copyright (c) 2017 SAMHSA. All Rights Reserved. 4 | 5 | This product is licensed to you under the Apache License, Version 2.0 (the "License"). 6 | You may not use this product except in compliance with the License. 7 | 8 | This product may include a number of subcomponents with separate copyright notices 9 | and license terms. Your use of these subcomponents is subject to the terms and 10 | conditions of the subcomponent's license, as noted in the LICENSE file. -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/config/ModelMapperConfig.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.config; 2 | 3 | import org.modelmapper.ModelMapper; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | @Configuration 8 | public class ModelMapperConfig { 9 | @Bean 10 | public ModelMapper modelMapper() { 11 | ModelMapper modelMapper = new ModelMapper(); 12 | return modelMapper; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/pdfbox/PdfBoxFont.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.pdfbox; 2 | 3 | public enum PdfBoxFont { 4 | TIMES_ROMAN, 5 | TIMES_BOLD, 6 | TIMES_ITALIC, 7 | TIMES_BOLD_ITALIC, 8 | HELVETICA, 9 | HELVETICA_BOLD, 10 | HELVETICA_OBLIQUE, 11 | HELVETICA_BOLD_OBLIQUE, 12 | COURIER, 13 | COURIER_BOLD, 14 | COURIER_OBLIQUE, 15 | COURIER_BOLD_OBLIQUE, 16 | SYMBOL, 17 | ZAPF_DINGBATS 18 | } 19 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/InvalidFileExtensionException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class InvalidFileExtensionException extends RuntimeException { 8 | public InvalidFileExtensionException(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/domain/educationmaterial/EducationMaterialTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.educationmaterial; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.junit.runners.JUnit4; 6 | import org.springframework.mock.staticmock.MockStaticEntityMethods; 7 | 8 | @RunWith(JUnit4.class) 9 | @MockStaticEntityMethods 10 | public class EducationMaterialTest { 11 | 12 | @Test 13 | public void testMethod() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/dto/ClinicalDocumentValidationRequest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.dto; 2 | 3 | import javax.validation.constraints.NotNull; 4 | 5 | public class ClinicalDocumentValidationRequest { 6 | @NotNull 7 | private byte[] document; 8 | 9 | public byte[] getDocument() { 10 | return document; 11 | } 12 | 13 | public void setDocument(byte[] document) { 14 | this.document = document; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/CannotDeleteProviderException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class CannotDeleteProviderException extends RuntimeException { 8 | 9 | public CannotDeleteProviderException(String message) { 10 | super(message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/InvalidClinicalDocumentException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class InvalidClinicalDocumentException extends RuntimeException { 8 | public InvalidClinicalDocumentException(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/InvalidDeleteDocumentRequestException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.BAD_REQUEST) 7 | public class InvalidDeleteDocumentRequestException extends RuntimeException { 8 | public InvalidDeleteDocumentRequestException(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/pdf/ConsentRevocationPdfGenerator.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.pdf; 2 | 3 | import gov.samhsa.c2s.pcm.domain.consent.Consent; 4 | import gov.samhsa.c2s.pcm.domain.patient.Patient; 5 | 6 | import java.io.IOException; 7 | import java.util.Date; 8 | 9 | public interface ConsentRevocationPdfGenerator { 10 | 11 | byte[] generateConsentRevocationPdf(Consent consent, Patient patient, Date revokedOnDateTime, String consentRevocationTerm) throws IOException; 12 | } 13 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/pdfbox/Column.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.pdfbox; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @Builder 10 | @AllArgsConstructor 11 | @NoArgsConstructor 12 | public class Column { 13 | private String header; 14 | private float cellWidth; 15 | 16 | public Column(float cellWidth) { 17 | this.cellWidth = cellWidth; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/consent/ConsentRevocationTermsVersionsService.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.consent; 2 | 3 | import gov.samhsa.c2s.pcm.domain.consent.ConsentRevocationTermsVersions; 4 | import gov.samhsa.c2s.pcm.service.dto.ConsentRevocationTermsVersionsDto; 5 | 6 | public interface ConsentRevocationTermsVersionsService { 7 | 8 | ConsentRevocationTermsVersions findByLatestEnabledVersion(); 9 | 10 | ConsentRevocationTermsVersionsDto findDtoByLatestEnabledVersion(); 11 | } 12 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V5.0.0__Create and insert revisionTypeCode.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `pcm`.`revision_type_code` (`id` bigint(20) NOT NULL AUTO_INCREMENT,`code` tinyint(4) DEFAULT NULL,`display_name` varchar(255) DEFAULT NULL,PRIMARY KEY (`id`) ); 2 | 3 | INSERT INTO `pcm`.`revision_type_code` (code, display_name) VALUES (0,'Create new entry'); 4 | INSERT INTO `pcm`.`revision_type_code` (code, display_name) VALUES (1,'Changed entry'); 5 | INSERT INTO `pcm`.`revision_type_code` (code, display_name) VALUES (2,'Delete entry'); -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V4.2.0__Remove signedpdfconsent and signedpdfconsent_revocation tables.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE consent drop foreign key FK38B6C01A5FD7634E; 2 | ALTER TABLE consent drop foreign key FK38B6C01AD5FBA41D; 3 | 4 | ALTER TABLE consent drop column unsigned_pdf_consent; 5 | ALTER TABLE consent drop column unsigned_pdf_consent_revoke; 6 | 7 | DROP TABLE signedpdfconsent; 8 | DROP TABLE signedpdfconsent_aud; 9 | 10 | DROP TABLE signedpdfconsent_revocation; 11 | DROP TABLE signedpdfconsent_revocation_aud; 12 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/securityevent/UserCreatedEvent.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.securityevent; 2 | 3 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 4 | 5 | public class UserCreatedEvent extends SecurityEvent { 6 | String userName; 7 | 8 | public UserCreatedEvent(String ipAddress, String userName) { 9 | super(ipAddress); 10 | this.userName = userName; 11 | } 12 | 13 | public String getUserName() { 14 | return userName; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /pcm/src/main/resources/schema/cdar2c32/infrastructure/cda/C32_CDA.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/securityevent/AuthenticationFailedEvent.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.securityevent; 2 | 3 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 4 | 5 | public class AuthenticationFailedEvent extends SecurityEvent { 6 | 7 | String userName; 8 | 9 | public AuthenticationFailedEvent(String ipAddress, String userName) { 10 | super(ipAddress); 11 | this.userName = userName; 12 | } 13 | 14 | public String getUserName() { 15 | return userName; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/consent/PolicyIdService.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.consent; 2 | 3 | import gov.samhsa.c2s.pcm.service.dto.ConsentDto; 4 | 5 | /** 6 | * The Interface PolicyIdService. 7 | */ 8 | public interface PolicyIdService { 9 | 10 | /** 11 | * Generate policy id. 12 | * 13 | * @param consentDto 14 | * the consent dto 15 | * @param mrn 16 | * the mrn 17 | * @return the string 18 | */ 19 | public abstract String generatePolicyId(ConsentDto consentDto, String mrn); 20 | } 21 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/securityevent/SecurityAuditVerb.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.securityevent; 2 | 3 | import gov.samhsa.c2s.common.audit.AuditVerb; 4 | 5 | public enum SecurityAuditVerb implements AuditVerb { 6 | FAILED_ATTEMPTS_TO_LOGIN_AS, 7 | DOWNLOADS_FILE, 8 | UPLOADS_FILE, 9 | UPLOADS_MALICIOUS_FILE, 10 | ATTEMPTS_TO_ACCESS_UNAUTHORIZED_RESOURCE, 11 | CREATES_USER; 12 | 13 | @Override 14 | public String getAuditVerb() { 15 | return this.toString(); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/config/VssProperties.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import javax.validation.constraints.Min; 8 | import javax.validation.constraints.NotNull; 9 | 10 | @Configuration 11 | @ConfigurationProperties(prefix = "c2s.vss") 12 | @Data 13 | public class VssProperties { 14 | 15 | @NotNull 16 | @Min(0) 17 | private int conceptCodeListPageSize; 18 | } -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/config/ApplicationContextConfig.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.config; 2 | 3 | import gov.samhsa.c2s.pcm.infrastructure.ClasspathSqlScriptProvider; 4 | import gov.samhsa.c2s.pcm.infrastructure.SqlScriptProvider; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class ApplicationContextConfig { 10 | 11 | @Bean 12 | public SqlScriptProvider sqlScriptProvider() { 13 | return new ClasspathSqlScriptProvider(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/config/ValidatorConfig.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; 6 | 7 | @Configuration 8 | public class ValidatorConfig { 9 | 10 | @Bean(name = "validator") 11 | public LocalValidatorFactoryBean validator() { 12 | LocalValidatorFactoryBean lvfb = new LocalValidatorFactoryBean(); 13 | return lvfb; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/fhir/FhirConsentService.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.fhir; 2 | 3 | import gov.samhsa.c2s.pcm.infrastructure.dto.PatientDto; 4 | import org.hl7.fhir.dstu3.model.Consent; 5 | 6 | public interface FhirConsentService { 7 | public Consent createFhirConsent(gov.samhsa.c2s.pcm.domain.consent.Consent consent, PatientDto patientDto); 8 | public void publishFhirConsentToHie(Consent fhirConsent); 9 | public void publishFhirConsentToHie(gov.samhsa.c2s.pcm.domain.consent.Consent consent, PatientDto patientDto); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/securityevent/UnauthorizedAccessAttemptedEvent.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.securityevent; 2 | 3 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 4 | 5 | public class UnauthorizedAccessAttemptedEvent extends SecurityEvent { 6 | 7 | String userName; 8 | 9 | public UnauthorizedAccessAttemptedEvent(String ipAddress, String userName) { 10 | super(ipAddress); 11 | this.userName = userName; 12 | } 13 | 14 | public String getUserName() { 15 | return userName; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /pcm/src/main/resources/i18n/messages/header_messages.properties: -------------------------------------------------------------------------------- 1 | header_staff_home=Staff Home 2 | header_staff_patient_view=Staff Patient View 3 | header_staff_add_consent=Staff Add Consent 4 | header_staff_edit_consent=Staff Edit Consent 5 | header_staff_edit_profile=Edit Staff Profile 6 | header_staff_admin_reports=Administrator Reports 7 | #header 8 | header_in_box=Message Center 9 | header_my_account=My Account 10 | header_my_profile=My Profile 11 | header_add_consent=Add Consent 12 | header_edit_consent=Edit Consent 13 | header_change_password=Change Password 14 | header_logout=Logout 15 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.14__Legal representative type code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into legal_representative_type_code (id, code, display_name, code_system_name, code_system) values (1, 'GUARD', 'Guardian', 'RoleCode', '2.16.840.1.113883.5.111'); 2 | insert into legal_representative_type_code (id, code, display_name, code_system_name, code_system) values (2, 'PRN', 'Parent', 'RoleCode', '2.16.840.1.113883.5.111'); 3 | insert into legal_representative_type_code (id, code, display_name, code_system_name, code_system) values (3, 'POWATY', 'Power of attorney', 'RoleCode', '2.16.840.1.113883.5.111'); 4 | 5 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/InvalidConsentDatesException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.BAD_REQUEST) 7 | public class InvalidConsentDatesException extends RuntimeException { 8 | public InvalidConsentDatesException(String message) { 9 | super(message); 10 | } 11 | 12 | public InvalidConsentDatesException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/dto/AttestedDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.dto; 2 | 3 | public class AttestedDto { 4 | private Long consentId; 5 | private boolean acceptTerms; 6 | 7 | public Long getConsentId() { 8 | return consentId; 9 | } 10 | 11 | public void setConsentId(Long consentId) { 12 | this.consentId = consentId; 13 | } 14 | 15 | public boolean isAcceptTerms() { 16 | return acceptTerms; 17 | } 18 | 19 | public void setAcceptTerms(boolean acceptTerms) { 20 | this.acceptTerms = acceptTerms; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/dto/RevocationDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.dto; 2 | 3 | public class RevocationDto { 4 | private Long consentId; 5 | private boolean acceptTerms; 6 | 7 | public Long getConsentId() { 8 | return consentId; 9 | } 10 | 11 | public void setConsentId(Long consentId) { 12 | this.consentId = consentId; 13 | } 14 | 15 | public boolean isAcceptTerms() { 16 | return acceptTerms; 17 | } 18 | 19 | public void setAcceptTerms(boolean acceptTerms) { 20 | this.acceptTerms = acceptTerms; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/CannotDeleteConsentException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class CannotDeleteConsentException extends RuntimeException{ 8 | public CannotDeleteConsentException(String message) { 9 | super(message); 10 | } 11 | 12 | public CannotDeleteConsentException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/MissingPurposeOfUseException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.UNPROCESSABLE_ENTITY) 7 | public class MissingPurposeOfUseException extends RuntimeException { 8 | public MissingPurposeOfUseException(String message) { 9 | super(message); 10 | } 11 | 12 | public MissingPurposeOfUseException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/dto/MedicalSectionDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service.dto; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | 5 | public class MedicalSectionDto extends AbstractNodeDto{ 6 | 7 | private String description; 8 | 9 | 10 | public String getDescription() { 11 | return description; 12 | } 13 | 14 | 15 | public void setDescription(String description) { 16 | this.description = description; 17 | } 18 | 19 | 20 | @Override 21 | public String toString() { 22 | return ToStringBuilder.reflectionToString(this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/TooManyProvidersSelectedException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.UNPROCESSABLE_ENTITY) 7 | public class TooManyProvidersSelectedException extends RuntimeException { 8 | public TooManyProvidersSelectedException(String message) { 9 | super(message); 10 | } 11 | 12 | public TooManyProvidersSelectedException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/ConsentNotBelongingToPatientException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.BAD_REQUEST) 7 | public class ConsentNotBelongingToPatientException extends RuntimeException{ 8 | public ConsentNotBelongingToPatientException(String message) { 9 | super(message); 10 | } 11 | 12 | public ConsentNotBelongingToPatientException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V2.1.3__Add descriptions in purpose of use code.sql: -------------------------------------------------------------------------------- 1 | UPDATE purpose_of_use_code SET original_text = 'To perform one or more operations on information for the provision of health care.' WHERE code = 'TREATMENT'; 2 | UPDATE purpose_of_use_code SET original_text = 'To perform one or more operations on information for conducting financial or contractual activities related to payment for the provision of health care.' WHERE code = 'PAYMENT'; 3 | UPDATE purpose_of_use_code SET original_text = 'To perform one or more operations on information for conducting scientific investigations to obtain health care knowledge.' WHERE code = 'RESEARCH'; -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/dto/AttestationDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.dto; 2 | 3 | public class AttestationDto { 4 | private Long consentId; 5 | private String attesterIpAddress; 6 | 7 | public Long getConsentId() { 8 | return consentId; 9 | } 10 | 11 | public void setConsentId(Long consentId) { 12 | this.consentId = consentId; 13 | } 14 | 15 | public String getAttesterIpAddress() { 16 | return attesterIpAddress; 17 | } 18 | 19 | public void setAttesterIpAddress(String attesterIpAddress) { 20 | this.attesterIpAddress = attesterIpAddress; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/UnprocessableConsentAddRequestException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.UNPROCESSABLE_ENTITY) 7 | public class UnprocessableConsentAddRequestException extends RuntimeException{ 8 | public UnprocessableConsentAddRequestException(String message) { 9 | super(message); 10 | } 11 | 12 | public UnprocessableConsentAddRequestException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/dto/ValueSetCategoryDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service.dto; 2 | 3 | 4 | import org.apache.commons.lang3.builder.ToStringBuilder; 5 | 6 | public class ValueSetCategoryDto extends AbstractNodeDto { 7 | 8 | private String description; 9 | 10 | 11 | public String getDescription() { 12 | return description; 13 | } 14 | 15 | 16 | public void setDescription(String description) { 17 | this.description = description; 18 | } 19 | 20 | 21 | @Override 22 | public String toString() { 23 | return ToStringBuilder.reflectionToString(this); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/CannotDeserializeProviderResultException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class CannotDeserializeProviderResultException extends RuntimeException { 8 | public CannotDeserializeProviderResultException(String message) { 9 | super(message); 10 | } 11 | 12 | public CannotDeserializeProviderResultException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.21__Product form code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into product_form_code (id, code, display_name, code_system_name, code_system) values (1, 'C42887', 'AEROSOL', 'National Cancer Institute (NCI) Thesaurus', '2.16.840.1.113883.3.26.1.1'); 2 | insert into product_form_code (id, code, display_name, code_system_name, code_system) values (2, 'C42909', 'GRANULE, EFFERVESCENT', 'National Cancer Institute (NCI) Thesaurus', '2.16.840.1.113883.3.26.1.1'); 3 | insert into product_form_code (id, code, display_name, code_system_name, code_system) values (3, 'C42998', 'TABLET', 'National Cancer Institute (NCI) Thesaurus', '2.16.840.1.113883.3.26.1.1'); 4 | 5 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/PhrService.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure; 2 | 3 | import gov.samhsa.c2s.pcm.config.OAuth2FeignClientConfig; 4 | import gov.samhsa.c2s.pcm.infrastructure.dto.PatientDto; 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RequestMethod; 8 | 9 | @FeignClient(name = "phr", configuration = OAuth2FeignClientConfig.class) 10 | public interface PhrService { 11 | 12 | @RequestMapping(value = "/patients", method = RequestMethod.GET) 13 | PatientDto getPatientProfile(); 14 | } 15 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V4.1.2__Insert record into consent_terms_versions table.sql: -------------------------------------------------------------------------------- 1 | insert into pcm.consent_terms_versions (consent_terms_text, added_date_time,version_disabled) values ('I, ATTESTER_FULL_NAME, understand that my records are protected under the federal regulations governing Confidentiality of Alcohol and Drug Abuse Patient Records, 42 CFR part 2, and cannot be disclosed without my written permission or as otherwise permitted by 42 CFR part 2. I also understand that I may revoke this consent at any time except to the extent that action has been taken in reliance on it, and that any event this consent expires automatically as follows:','2016-05-01 00:00:00',0); -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.8__Country code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into country_code (id, code, display_name, code_system_name, code_system) values (1, 'US', 'United States', 'ISO 3166-1 Country Codes', '1.0.3166.1'); 2 | insert into country_code (id, code, display_name, code_system_name, code_system) values (2, 'KZ', 'Kazakhstan', 'ISO 3166-1 Country Codes', '1.0.3166.1'); 3 | insert into country_code (id, code, display_name, code_system_name, code_system) values (3, 'IL', 'Israel', 'ISO 3166-1 Country Codes', '1.0.3166.1'); 4 | insert into country_code (id, code, display_name, code_system_name, code_system) values (4, 'AW', 'Aruba', 'ISO 3166-1 Country Codes', '1.0.3166.1'); 5 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/securityevent/MaliciousFileDetectedEvent.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.securityevent; 2 | 3 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 4 | 5 | public class MaliciousFileDetectedEvent extends SecurityEvent { 6 | String userName; 7 | 8 | String fileName; 9 | 10 | public MaliciousFileDetectedEvent(String ipAddress, String userName, 11 | String fileName) { 12 | super(ipAddress); 13 | this.userName = userName; 14 | this.fileName = fileName; 15 | } 16 | 17 | public String getUserName() { 18 | return userName; 19 | } 20 | 21 | public String getFileName() { 22 | return fileName; 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.1__Address use code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into address_use_code (id, code, display_name, code_system_name, code_system) values (1, 'HP', 'primary home', 'AddressUse', '2.16.840.1.113883.5.1119'); 2 | insert into address_use_code (id, code, display_name, code_system_name, code_system) values (2, 'WP', 'work place', 'AddressUse', '2.16.840.1.113883.5.1119'); 3 | insert into address_use_code (id, code, display_name, code_system_name, code_system) values (3, 'MC', 'mobile contact', 'AddressUse', '2.16.840.1.113883.5.1119'); 4 | insert into address_use_code (id, code, display_name, code_system_name, code_system) values (4, 'HV', 'vacation home', 'AddressUse', '2.16.840.1.113883.5.1119'); -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.35__Telecom use code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into telecom_use_code (id, code, display_name, code_system_name, code_system) values (1, 'HP', 'primary home', 'AddressUse', '2.16.840.1.113883.5.1119'); 2 | insert into telecom_use_code (id, code, display_name, code_system_name, code_system) values (2, 'WP', 'work place', 'AddressUse', '2.16.840.1.113883.5.1119'); 3 | insert into telecom_use_code (id, code, display_name, code_system_name, code_system) values (3, 'MC', 'mobile contact', 'AddressUse', '2.16.840.1.113883.5.1119'); 4 | insert into telecom_use_code (id, code, display_name, code_system_name, code_system) values (4, 'HV', 'vacation home', 'AddressUse', '2.16.840.1.113883.5.1119'); -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/dto/ClinicalDocumentValidationResult.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.dto; 2 | 3 | public class ClinicalDocumentValidationResult { 4 | private String documentType; 5 | private boolean isValidDocument; 6 | 7 | public String getDocumentType() { 8 | return documentType; 9 | } 10 | 11 | public void setDocumentType(String documentType) { 12 | this.documentType = documentType; 13 | } 14 | 15 | public boolean isValidDocument() { 16 | return isValidDocument; 17 | } 18 | 19 | public void setValidDocument(boolean validDocument) { 20 | isValidDocument = validDocument; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/eventlistener/LoggingSessionDestroyedEventListener.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.eventlistener; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.context.ApplicationListener; 6 | import org.springframework.security.web.session.HttpSessionDestroyedEvent; 7 | 8 | public class LoggingSessionDestroyedEventListener implements 9 | ApplicationListener { 10 | private final Logger logger = LoggerFactory.getLogger(this.getClass()); 11 | 12 | @Override 13 | public void onApplicationEvent(HttpSessionDestroyedEvent event) { 14 | logger.debug("Session is ended"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/dto/CCDDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.dto; 2 | 3 | import java.nio.charset.StandardCharsets; 4 | 5 | public class CCDDto { 6 | 7 | private byte[] ccdFile; 8 | 9 | public CCDDto() { 10 | } 11 | 12 | public CCDDto(byte[] ccdFile) { 13 | this.ccdFile = ccdFile; 14 | } 15 | 16 | public byte[] getCCDFile() { 17 | return ccdFile; 18 | } 19 | 20 | public void setCCDFile(byte[] ccdFile) { 21 | this.ccdFile = ccdFile; 22 | } 23 | 24 | @Override 25 | public String toString() { 26 | return this.ccdFile == null ? "" : new String(this.getCCDFile(), StandardCharsets.UTF_8); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.3__Body site code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into body_site_code (id, code, display_name, code_system_name, code_system) values (1, '361316009', 'entire embryonic artery', 'SNOMED CT', '2.16.840.1.113883.6.96'); 2 | insert into body_site_code (id, code, display_name, code_system_name, code_system) values (2, '38033009', 'amputation stump', 'SNOMED CT', '2.16.840.1.113883.6.96'); 3 | insert into body_site_code (id, code, display_name, code_system_name, code_system) values (3, '9550003', 'bronchogenic cyst', 'SNOMED CT', '2.16.840.1.113883.6.96'); 4 | insert into body_site_code (id, code, display_name, code_system_name, code_system) values (4, '302509004', 'heart', 'SNOMED CT', '2.16.840.1.113883.6.96'); -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/ValueSetNotFoundException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service; 2 | 3 | /** 4 | * The Class ValueSetNotFoundException. 5 | */ 6 | public class ValueSetNotFoundException extends Exception { 7 | 8 | /** The Constant serialVersionUID. */ 9 | private static final long serialVersionUID = 665469313254307065L; 10 | 11 | /** 12 | * Instantiates a new value set not found exception. 13 | * 14 | * @param msg the msg 15 | */ 16 | public ValueSetNotFoundException(String msg) { 17 | super(msg); 18 | } 19 | 20 | /** 21 | * Instantiates a new value set not found exception. 22 | */ 23 | public ValueSetNotFoundException() { 24 | super(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.19__Problem status code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into problem_status_code (id, code, display_name, code_system_name, code_system) values (1, 'active', 'active', 'ActStatus', '2.16.840.1.113883.5.14'); 2 | insert into problem_status_code (id, code, display_name, code_system_name, code_system) values (2, 'cancelled', 'cancelled', 'ActStatus', '2.16.840.1.113883.5.14'); 3 | insert into problem_status_code (id, code, display_name, code_system_name, code_system) values (3, 'aborted', 'aborted', 'ActStatus', '2.16.840.1.113883.5.14'); 4 | insert into problem_status_code (id, code, display_name, code_system_name, code_system) values (4, 'completed', 'completed', 'ActStatus', '2.16.840.1.113883.5.14'); 5 | 6 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.34__Target site code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into target_site_code (id, code, display_name, code_system_name, code_system) values (1, '361316009', 'entire embryonic artery', 'SNOMED CT', '2.16.840.1.113883.6.96'); 2 | insert into target_site_code (id, code, display_name, code_system_name, code_system) values (2, '38033009', 'amputation stump', 'SNOMED CT', '2.16.840.1.113883.6.96'); 3 | insert into target_site_code (id, code, display_name, code_system_name, code_system) values (3, '9550003', 'bronchogenic cyst', 'SNOMED CT', '2.16.840.1.113883.6.96'); 4 | insert into target_site_code (id, code, display_name, code_system_name, code_system) values (4, '302509004', 'heart', 'SNOMED CT', '2.16.840.1.113883.6.96'); -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.20__Procedure status code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into procedure_status_code (id, code, display_name, code_system_name, code_system) values (1, 'active', 'active', 'ActStatus', '2.16.840.1.113883.5.14'); 2 | insert into procedure_status_code (id, code, display_name, code_system_name, code_system) values (2, 'cancelled', 'cancelled', 'ActStatus', '2.16.840.1.113883.5.14'); 3 | insert into procedure_status_code (id, code, display_name, code_system_name, code_system) values (3, 'aborted', 'aborted', 'ActStatus', '2.16.840.1.113883.5.14'); 4 | insert into procedure_status_code (id, code, display_name, code_system_name, code_system) values (4, 'completed', 'completed', 'ActStatus', '2.16.840.1.113883.5.14'); 5 | 6 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/dto/XacmlDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.dto; 2 | 3 | import java.nio.charset.StandardCharsets; 4 | 5 | public class XacmlDto { 6 | private byte[] xacmlFile; 7 | 8 | public XacmlDto() { 9 | } 10 | 11 | public XacmlDto(byte[] xacmlFile) { 12 | this.xacmlFile = xacmlFile; 13 | } 14 | 15 | public byte[] getXacmlFile() { 16 | return xacmlFile; 17 | } 18 | 19 | public void setXacmlFile(byte[] xacmlFile) { 20 | this.xacmlFile = xacmlFile; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return this.xacmlFile == null ? "" : new String(this.getXacmlFile(), StandardCharsets.UTF_8); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.16__Medication status code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into medication_status_code (id, code, display_name, code_system_name, code_system) values (1, 'active', 'active', 'ActStatus', '2.16.840.1.113883.5.14'); 2 | insert into medication_status_code (id, code, display_name, code_system_name, code_system) values (2, 'cancelled', 'cancelled', 'ActStatus', '2.16.840.1.113883.5.14'); 3 | insert into medication_status_code (id, code, display_name, code_system_name, code_system) values (3, 'aborted', 'aborted', 'ActStatus', '2.16.840.1.113883.5.14'); 4 | insert into medication_status_code (id, code, display_name, code_system_name, code_system) values (4, 'completed', 'completed', 'ActStatus', '2.16.840.1.113883.5.14'); 5 | 6 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/config/SpringContext.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.config; 2 | 3 | 4 | import org.springframework.beans.BeansException; 5 | import org.springframework.context.ApplicationContext; 6 | import org.springframework.context.ApplicationContextAware; 7 | 8 | public class SpringContext implements ApplicationContextAware { 9 | private static ApplicationContext applicationContext; 10 | 11 | @Override 12 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 13 | SpringContext.applicationContext = applicationContext; 14 | } 15 | 16 | public static ApplicationContext getApplicationContext() { 17 | return applicationContext; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/audit/ActivityHistoryQueryInfo.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.audit; 2 | 3 | import gov.samhsa.c2s.pcm.infrastructure.pagination.SetQueryInfoMapping; 4 | import org.springframework.jdbc.core.RowMapper; 5 | import org.springframework.stereotype.Component; 6 | 7 | @Component("SetQueryInfoMapping") 8 | public class ActivityHistoryQueryInfo implements SetQueryInfoMapping { 9 | @Override 10 | public RowMapper getRowMapper() { 11 | return new ActivityHistoryRowMapper(); 12 | } 13 | 14 | @Override 15 | public String getTableName() { 16 | return "revinfo"; 17 | } 18 | 19 | @Override 20 | public String getIdColumn() { 21 | return "r.username"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.31__Social history status code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into social_history_status_code (id, code, display_name, code_system_name, code_system) values (1, 'active', 'active', 'ActStatus', '2.16.840.1.113883.5.14'); 2 | insert into social_history_status_code (id, code, display_name, code_system_name, code_system) values (2, 'suspended', 'suspended', 'ActStatus', '2.16.840.1.113883.5.14'); 3 | insert into social_history_status_code (id, code, display_name, code_system_name, code_system) values (3, 'aborted', 'aborted', 'ActStatus', '2.16.840.1.113883.5.14'); 4 | insert into social_history_status_code (id, code, display_name, code_system_name, code_system) values (4, 'completed', 'completed', 'ActStatus', '2.16.840.1.113883.5.14'); 5 | 6 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/securityevent/FileUploadedEvent.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.securityevent; 2 | 3 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 4 | 5 | public class FileUploadedEvent extends SecurityEvent { 6 | String userName; 7 | 8 | String fileUploaded; 9 | 10 | public FileUploadedEvent(String ipAddress, String userName, 11 | String fileUploaded) { 12 | super(ipAddress); 13 | this.userName = userName; 14 | this.fileUploaded = fileUploaded; 15 | } 16 | 17 | public String getUserName() { 18 | return userName; 19 | } 20 | 21 | public String getFileUploaded() { 22 | return fileUploaded; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/PlsService.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure; 2 | 3 | import gov.samhsa.c2s.pcm.config.OAuth2FeignClientConfig; 4 | import gov.samhsa.c2s.pcm.infrastructure.dto.ProviderDto; 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | 10 | @FeignClient(name = "pls", configuration = OAuth2FeignClientConfig.class) 11 | public interface PlsService { 12 | 13 | @RequestMapping(value = "/providers/{npi}", method = RequestMethod.GET) 14 | ProviderDto getProvider(@PathVariable("npi") String npi); 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/pdfbox/PdfBoxStyle.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.pdfbox; 2 | 3 | public class PdfBoxStyle { 4 | public static final float LEFT_RIGHT_MARGINS_OF_LETTER = 40f; 5 | public static final float TOP_BOTTOM_MARGINS_OF_LETTER = 60f; 6 | public static final float DEFAULT_TABLE_ROW_HEIGHT = 20f; 7 | public static final float TEXT_SMALL_SIZE = 12f; 8 | public static final float TEXT_MEDIUM_SIZE = 14f; 9 | public static final float TEXT_LARGE_SIZE = 16f; 10 | public static final float SMALL_LINE_SPACE = 5f; 11 | public static final float MEDIUM_LINE_SPACE = 10f; 12 | public static final float LARGE_LINE_SPACE = 15f; 13 | public static final float XLARGE_LINE_SPACE = 20f; 14 | } 15 | -------------------------------------------------------------------------------- /pcm/src/main/resources/i18n/messages/sidebar_messages.properties: -------------------------------------------------------------------------------- 1 | #side bar text messages 2 | sidebar_my_home=\ My Home 3 | sidebar_my_consents=\ My Consents 4 | sidebar_my_contacts=\ My Providers 5 | sidebar_my_profile=\ My Profile 6 | sidebar_in_box= Direct E-Mail 7 | sidebar_activity_history=\ Activity History 8 | sidebar_medical_documents=\ Medical Documents 9 | sidebar_change_password=\ Change Password 10 | sidebar_logout=\ Logout 11 | language=\ Language 12 | sidebar_codeSystems=\ Code Systems 13 | sidebar_codeSystemVersions=\ Code System Versions 14 | sidebar_valueSets=\ Value Sets 15 | sidebar_conceptCodes=\ Concept Codes 16 | sidebar_MedSections=\ Medical Information Categories 17 | sidebar_valueSetCats=\ Value Set Categories 18 | sidebar_lookup=\ Lookup Service 19 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.23__Purpose of use code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into purpose_of_use_code (id, code, display_name, code_system_name, code_system) values (1, 'TREATMENT', 'Healthcare Treatment', 'PurposeOfUse', '2.16.840.1.113883.1.11.20448'); 2 | insert into purpose_of_use_code (id, code, display_name, code_system_name, code_system) values (2, 'PAYMENT', 'Payment', 'PurposeOfUse', '2.16.840.1.113883.1.11.20448'); 3 | insert into purpose_of_use_code (id, code, display_name, code_system_name, code_system) values (3, 'EMERGENCY', 'Emergency Treatment', 'PurposeOfUse', '2.16.840.1.113883.1.11.20448'); 4 | insert into purpose_of_use_code (id, code, display_name, code_system_name, code_system) values (4, 'RESEARCH', 'Research', 'PurposeOfUse', '2.16.840.1.113883.1.11.20448'); -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/dto/ConceptCodeAndCodeSystemOidDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service.dto; 2 | 3 | 4 | import org.hibernate.validator.constraints.NotEmpty; 5 | 6 | public class ConceptCodeAndCodeSystemOidDto { 7 | @NotEmpty 8 | private String conceptCode; 9 | @NotEmpty 10 | private String codeSystemOid; 11 | 12 | public String getConceptCode() { 13 | return conceptCode; 14 | } 15 | 16 | public void setConceptCode(String conceptCode) { 17 | this.conceptCode = conceptCode; 18 | } 19 | 20 | public String getCodeSystemOid() { 21 | return codeSystemOid; 22 | } 23 | 24 | public void setCodeSystemOid(String codeSystemOid) { 25 | this.codeSystemOid = codeSystemOid; 26 | } 27 | } -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/PatientConsentManagementApplicationIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm; 2 | 3 | import org.junit.Ignore; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | import org.springframework.test.context.web.WebAppConfiguration; 9 | 10 | @RunWith(SpringRunner.class) 11 | @SpringBootTest 12 | @WebAppConfiguration 13 | @Ignore("Depends on config-server on bootstrap") 14 | public class PatientConsentManagementApplicationIntegrationTest { 15 | 16 | @Ignore("Integration Test: requires mysql connection with default configuration") 17 | @Test 18 | public void contextLoads() { 19 | } 20 | } -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/ValueSetCategoryNotFoundException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service; 2 | 3 | /** 4 | * The Class ValueSetCategoryNotFoundException. 5 | */ 6 | public class ValueSetCategoryNotFoundException extends Exception { 7 | 8 | /** The Constant serialVersionUID. */ 9 | private static final long serialVersionUID = 5122534788895239791L; 10 | 11 | /** 12 | * Instantiates a new value set category not found exception. 13 | */ 14 | public ValueSetCategoryNotFoundException() { 15 | super(); 16 | } 17 | 18 | /** 19 | * Instantiates a new value set category not found exception. 20 | * 21 | * @param message the message 22 | */ 23 | public ValueSetCategoryNotFoundException(String message) { 24 | super(message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.13__Language proficiency code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into language_proficiency_code (id, code, display_name, code_system_name, code_system) values (1, 'E', 'Excellent', 'LanguageAbilityProficiency', '2.16.840.1.113883.5.61'); 2 | insert into language_proficiency_code (id, code, display_name, code_system_name, code_system) values (2, 'F', 'Fair', 'LanguageAbilityProficiency', '2.16.840.1.113883.5.61'); 3 | insert into language_proficiency_code (id, code, display_name, code_system_name, code_system) values (3, 'G', 'Good', 'LanguageAbilityProficiency', '2.16.840.1.113883.5.61'); 4 | insert into language_proficiency_code (id, code, display_name, code_system_name, code_system) values (4, 'P', 'Poor', 'LanguageAbilityProficiency', '2.16.840.1.113883.5.61'); 5 | 6 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/securityevent/FileDownloadedEvent.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.securityevent; 2 | 3 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 4 | 5 | public class FileDownloadedEvent extends SecurityEvent { 6 | String userName; 7 | 8 | String fileDownloaded; 9 | 10 | public FileDownloadedEvent(String ipAddress, String userName, 11 | String fileDownloaded) { 12 | super(ipAddress); 13 | this.userName = userName; 14 | this.fileDownloaded = fileDownloaded; 15 | } 16 | 17 | public String getUserName() { 18 | return userName; 19 | } 20 | 21 | public String getFileDownloaded() { 22 | return fileDownloaded; 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/InvalidCSVException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service; 2 | 3 | /** 4 | * The Class InvalidCSVException. 5 | */ 6 | public class InvalidCSVException extends RuntimeException { 7 | 8 | /** The Constant serialVersionUID. */ 9 | private static final long serialVersionUID = 1L; 10 | 11 | /** 12 | * Instantiates a new invalid csv exception. 13 | * 14 | * @param message the message 15 | */ 16 | public InvalidCSVException(String message) { 17 | super(message); 18 | } 19 | 20 | /** 21 | * Instantiates a new invalid csv exception. 22 | * 23 | * @param message the message 24 | * @param cause the cause 25 | */ 26 | public InvalidCSVException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.7__Consent directive type code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into consent_directive_type_code (id, code, display_name, code_system_name, code_system) values (1, 'EMRGONLY', 'emergency only', 'ActPolicyType', '2.16.840.1.113883.1.11.19886'); 2 | insert into consent_directive_type_code (id, code, display_name, code_system_name, code_system) values (2, 'NOPP', 'notice of privacy practices', 'ActPolicyType', '2.16.840.1.113883.1.11.19886'); 3 | insert into consent_directive_type_code (id, code, display_name, code_system_name, code_system) values (3, 'OPTIN', 'opt-in', 'ActPolicyType', '2.16.840.1.113883.1.11.19886'); 4 | insert into consent_directive_type_code (id, code, display_name, code_system_name, code_system) values (4, 'OPTOUT', 'opt-out', 'ActPolicyType', '2.16.840.1.113883.1.11.19886'); -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/pagination/JdbcPagingException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.pagination; 2 | 3 | public class JdbcPagingException extends RuntimeException { 4 | public JdbcPagingException(String message) { 5 | super(message); 6 | } 7 | 8 | public JdbcPagingException() { 9 | super(); 10 | } 11 | 12 | public JdbcPagingException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public JdbcPagingException(Throwable cause) { 17 | super(cause); 18 | } 19 | 20 | protected JdbcPagingException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 21 | super(message, cause, enableSuppression, writableStackTrace); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.29__Route code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into route_code (id, code, display_name, code_system_name, code_system) values (1, 'C38229', 'INTRACAUDAL', 'National Cancer Institute (NCI) Thesaurus', '2.16.840.1.113883.3.26.1.1'); 2 | insert into route_code (id, code, display_name, code_system_name, code_system) values (2, 'C38276', 'INTRAVENOUS', 'National Cancer Institute (NCI) Thesaurus', '2.16.840.1.113883.3.26.1.1'); 3 | insert into route_code (id, code, display_name, code_system_name, code_system) values (3, 'C38288', 'ORAL', 'National Cancer Institute (NCI) Thesaurus', '2.16.840.1.113883.3.26.1.1'); 4 | insert into route_code (id, code, display_name, code_system_name, code_system) values (4, 'C38295', 'RECTAL', 'National Cancer Institute (NCI) Thesaurus', '2.16.840.1.113883.3.26.1.1'); 5 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 5 | import org.springframework.web.servlet.config.annotation.EnableWebMvc; 6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 7 | 8 | @Configuration 9 | @EnableWebMvc 10 | public class WebConfig extends WebMvcConfigurerAdapter { 11 | @Override 12 | public void addCorsMappings(CorsRegistry registry) { 13 | registry.addMapping("/patients/**") 14 | .allowedOrigins("*") 15 | .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") 16 | .allowCredentials(false).maxAge(3600); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/dto/ValueSetVSCDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service.dto; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class ValueSetVSCDto extends AbstractNodeDto { 7 | 8 | private ValueSetDto valueSetDto = new ValueSetDto(); 9 | private Map valueSetCategoryMap = new HashMap(); 10 | 11 | public ValueSetDto getValueSetDto() { 12 | return valueSetDto; 13 | } 14 | public void setValueSetDto(ValueSetDto valueSetDto) { 15 | this.valueSetDto = valueSetDto; 16 | } 17 | public Map getValueSetCategoryMap() { 18 | return valueSetCategoryMap; 19 | } 20 | public void setValueSetCategoryMap(Map valueSetCategoryMap) { 21 | this.valueSetCategoryMap = valueSetCategoryMap; 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /pcm/src/main/resources/activity/PatientActivityHistory.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | m.id AS activity_id, 3 | r.rev AS revision_id, 4 | r.revtstmp AS timestamp, 5 | r.username AS username, 6 | rtc.display_name AS rec_type, 7 | m.entity_class_name AS type 8 | FROM 9 | ( 10 | select * 11 | from modified_entity_type_entity m 12 | where 13 | case 14 | when m.entity_class_name = "gov.samhsa.c2s.pcm.domain.patient.Patient" 15 | then m.revision_type <> 1 16 | when m.entity_class_name = "gov.samhsa.c2s.pcm.domain.consent.Consent" 17 | then m.revision_type >= 0 18 | else true 19 | end 20 | ) as m 21 | LEFT JOIN 22 | revinfo AS r ON r.rev = m.revision_rev 23 | LEFT JOIN 24 | revision_type_code rtc ON m.revision_type = rtc.code 25 | LEFT JOIN 26 | patient_audit pa ON r.rev = pa.rev -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V2.0.0__Create staff individual and organizational provider.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE staff_individual_provider (id BIGINT AUTO_INCREMENT NOT NULL, individual_provider BIGINT NULL, CONSTRAINT PK_STAFF_INDIVIDUAL_PROVIDER PRIMARY KEY (id)); 2 | ALTER TABLE staff_individual_provider ADD CONSTRAINT FK_ioned9nvm4j3uds9rwmck698v FOREIGN KEY (individual_provider) REFERENCES individual_provider (id) ON UPDATE NO ACTION ON DELETE NO ACTION; 3 | 4 | CREATE TABLE staff_organizational_provider (id BIGINT AUTO_INCREMENT NOT NULL, individual_provider BIGINT NULL, CONSTRAINT PK_STAFF_ORGANIZATIONAL_PROVIDER PRIMARY KEY (id)); 5 | ALTER TABLE staff_organizational_provider ADD CONSTRAINT FK_g1j2ny84tiakvt9vj9oxpf12r FOREIGN KEY (individual_provider) REFERENCES organizational_provider (id) ON UPDATE NO ACTION ON DELETE NO ACTION; 6 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.1.0__Add unique constraints to valueset schema.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE code_system DROP KEY code_system_id; 2 | DROP INDEX code_system_oid ON code_system; 3 | ALTER TABLE code_system ADD CONSTRAINT UK_7j0saojr9joix0quj9a65492x UNIQUE (code_system_oid); 4 | 5 | 6 | ALTER TABLE code_system_version DROP KEY code_system_version_id; 7 | 8 | ALTER TABLE value_set_category ADD CONSTRAINT UK_ei6kilxu5rvqu6h6tvsqgqtyh UNIQUE (code); 9 | DROP INDEX code ON value_set_category; 10 | 11 | ALTER TABLE value_set ADD CONSTRAINT UK_qqdh21ud433ry6ybr0mwnu6c2 UNIQUE (code); 12 | DROP INDEX code ON value_set; 13 | 14 | ALTER TABLE concept_code ADD CONSTRAINT UK_3qk6t75290ixvreggu1u1k9jw UNIQUE (code, fk_code_system_version_id); 15 | ALTER TABLE concept_code DROP KEY concept_code_id; 16 | DROP INDEX code ON concept_code; 17 | 18 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.10__Facility type code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into facility_type_code (id, code, display_name, code_system_name, code_system) values (1, 'ENDOS', 'Ambulatory Health Care Facilities; Clinic/Center; Endoscopy', 'RoleCode', '2.16.840.1.113883.5.111'); 2 | insert into facility_type_code (id, code, display_name, code_system_name, code_system) values (2, 'CANC', 'Child and adolescent neurology clinic', 'RoleCode', '2.16.840.1.113883.5.111'); 3 | insert into facility_type_code (id, code, display_name, code_system_name, code_system) values (3, 'CAPC', 'Child and adolescent psychiatry clinic', 'RoleCode', '2.16.840.1.113883.5.111'); 4 | insert into facility_type_code (id, code, display_name, code_system_name, code_system) values (4, '282N00000N', 'Hospitals; General Acute Care Hospital', 'RoleCode', '2.16.840.1.113883.5.111'); 5 | -------------------------------------------------------------------------------- /pcm/src/main/resources/i18n/messages/sidebar_messages_cn.properties: -------------------------------------------------------------------------------- 1 | #side bar text messages 2 | #translate.google.com(chinese traditional) 3 | sidebar_my_home=\u4E3B\u9875 4 | sidebar_my_consents=\u540C\u610F\u4E66 5 | sidebar_my_contacts=\u8054\u7CFB\u4EBA 6 | sidebar_my_profile=\u4E2A\u4EBA\u8D44\u6599 7 | sidebar_in_box=\u6536\u4EF6\u7BB1 8 | sidebar_activity_history=\u6D3B\u52A8\u5386\u53F2 9 | sidebar_medical_documents=\u533B\u7597\u6587\u6863 10 | language=\u8A9E\u8A00 11 | sidebar_codeSystems=\u78BC\u7CFB\u7D71 12 | sidebar_codeSystemVersions=\u4EE3\u78BC\u7CFB\u7D71\u7248\u672C 13 | sidebar_valueSets=\u8D85\u503C\u5957\u88DD 14 | sidebar_conceptCodes=\u6982\u5FF5\u4EE3\u78BC 15 | sidebar_MedSections=\u91AB\u7642\u4FE1\u606F\u5206\u985E 16 | sidebar_valueSetCats=\u8D85\u503C\u5957\u88DD\u5206\u985E 17 | sidebar_lookup=\u67E5\u8A62\u670D\u52D9 18 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/pdfbox/TableAttribute.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.pdfbox; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import org.apache.pdfbox.pdmodel.font.PDFont; 8 | 9 | import java.awt.*; 10 | import java.util.List; 11 | 12 | @Data 13 | @Builder 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | public class TableAttribute { 17 | private float xCoordinate; 18 | private float yCoordinate; 19 | private float rowHeight; 20 | private float cellMargin; 21 | private PDFont contentFont; 22 | private float contentFontSize; 23 | private Color borderColor; 24 | /** 25 | * Define each column with in order to calculate table width 26 | */ 27 | private List columns; 28 | } 29 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/exception/SqlScriptFileException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.exception; 2 | 3 | public class SqlScriptFileException extends RuntimeException { 4 | 5 | private static final long serialVersionUID = -7643751788564017608L; 6 | 7 | public SqlScriptFileException() { 8 | super(); 9 | } 10 | 11 | public SqlScriptFileException(String message) { 12 | super(message); 13 | } 14 | 15 | public SqlScriptFileException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public SqlScriptFileException(String message, Throwable cause, 20 | boolean enableSuppression, boolean writableStackTrace) { 21 | super(message, cause, enableSuppression, writableStackTrace); 22 | } 23 | 24 | public SqlScriptFileException(Throwable cause) { 25 | super(cause); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/config/OAuth2FeignClientConfig.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.config; 2 | 3 | import org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.security.oauth2.client.OAuth2ClientContext; 6 | import org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails; 7 | 8 | // TODO (#22): remove this configuration when PHR API is refactored to a service that can be called by this API without OAuth2 token 9 | public class OAuth2FeignClientConfig { 10 | 11 | @Bean 12 | public OAuth2FeignRequestInterceptor oAuth2FeignRequestInterceptor(OAuth2ClientContext oAuth2ClientContext, OAuth2ProtectedResourceDetails resource) { 13 | return new OAuth2FeignRequestInterceptor(oAuth2ClientContext, resource); 14 | } 15 | } -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/DssService.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure; 2 | 3 | import gov.samhsa.c2s.pcm.infrastructure.dto.ClinicalDocumentValidationRequest; 4 | import gov.samhsa.c2s.pcm.infrastructure.dto.ClinicalDocumentValidationResult; 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.http.MediaType; 7 | import org.springframework.web.bind.annotation.RequestBody; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RequestMethod; 10 | 11 | @FeignClient("dss") 12 | public interface DssService { 13 | @RequestMapping(value = "/validateDocument", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) 14 | ClinicalDocumentValidationResult validateClinicalDocument(@RequestBody ClinicalDocumentValidationRequest validationRequest); 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/dto/ValueSetQueryDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service.dto; 2 | 3 | import java.util.Set; 4 | 5 | public class ValueSetQueryDto { 6 | 7 | private String conceptCode; 8 | 9 | private String codeSystemOid; 10 | 11 | private Set vsCategoryCodes; 12 | 13 | public String getConceptCode() { 14 | return conceptCode; 15 | } 16 | 17 | public void setConceptCode(String conceptCode) { 18 | this.conceptCode = conceptCode; 19 | } 20 | 21 | public String getCodeSystemOid() { 22 | return codeSystemOid; 23 | } 24 | 25 | public void setCodeSystemOid(String codeSystemOid) { 26 | this.codeSystemOid = codeSystemOid; 27 | } 28 | 29 | public Set getVsCategoryCodes() { 30 | return vsCategoryCodes; 31 | } 32 | 33 | public void setVsCategoryCodes(Set vsCategoryCodes) { 34 | this.vsCategoryCodes = vsCategoryCodes; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/dto/CSVersionsDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service.dto; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class CSVersionsDto { 7 | 8 | private Long codeSystemId; 9 | private String codeSystemName; 10 | Map versionsMap = new HashMap(); 11 | public Long getCodeSystemId() { 12 | return codeSystemId; 13 | } 14 | public void setCodeSystemId(Long codeSystemId) { 15 | this.codeSystemId = codeSystemId; 16 | } 17 | public String getCodeSystemName() { 18 | return codeSystemName; 19 | } 20 | public void setCodeSystemName(String codeSystemName) { 21 | this.codeSystemName = codeSystemName; 22 | } 23 | public Map getVersionsMap() { 24 | return versionsMap; 25 | } 26 | public void setVersionsMap(Map versionsMap) { 27 | this.versionsMap = versionsMap; 28 | } 29 | 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/exception/PdfGenerationException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class PdfGenerationException extends RuntimeException { 8 | 9 | public PdfGenerationException() { 10 | } 11 | 12 | public PdfGenerationException(String message) { 13 | super(message); 14 | } 15 | 16 | public PdfGenerationException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | 20 | public PdfGenerationException(Throwable cause) { 21 | super(cause); 22 | } 23 | 24 | public PdfGenerationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 25 | super(message, cause, enableSuppression, writableStackTrace); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/web/ObligationRestController.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.web; 2 | 3 | import gov.samhsa.c2s.pcm.service.consent.ConsentService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.web.bind.annotation.PathVariable; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | import java.security.Principal; 10 | import java.util.List; 11 | 12 | @RestController 13 | public class ObligationRestController { 14 | 15 | @Autowired 16 | private ConsentService consentService; 17 | 18 | @RequestMapping("/patients/consents/{consentId}/obligations") 19 | public List getConsentObligations(Principal principal, @PathVariable("consentId") Long consentId) { 20 | return consentService.findObligationsConsentById(principal.getName(), consentId); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.12__Language code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into language_code (id, code, display_name, code_system_name, code_system) values (1, 'en', 'English', 'Internet Society Language', '2.16.840.1.113883.1.11.11526'); 2 | insert into language_code (id, code, display_name, code_system_name, code_system) values (2, 'fr', 'French', 'Internet Society Language', '2.16.840.1.113883.1.11.11526'); 3 | insert into language_code (id, code, display_name, code_system_name, code_system) values (3, 'ar', 'Arabic', 'Internet Society Language', '2.16.840.1.113883.1.11.11526'); 4 | insert into language_code (id, code, display_name, code_system_name, code_system) values (4, 'en-US', 'English, US', 'Internet Society Language', '2.16.840.1.113883.1.11.11526'); 5 | insert into language_code (id, code, display_name, code_system_name, code_system) values (5, 'es-US', 'Spanish, US', 'Internet Society Language', '2.16.840.1.113883.1.11.11526'); 6 | 7 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/ValueSetLookupService.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service; 2 | 3 | import gov.samhsa.c2s.vss.service.dto.ValueSetQueryDto; 4 | import gov.samhsa.c2s.vss.service.dto.ValueSetQueryListDto; 5 | import gov.samhsa.c2s.vss.service.dto.ValueSetLookUpDto; 6 | 7 | public interface ValueSetLookupService { 8 | 9 | public ValueSetLookUpDto lookupValueSetCategories(String code, String codeSystemOid) throws CodeSystemVersionNotFoundException, ConceptCodeNotFoundException, ValueSetNotFoundException; 10 | 11 | public ValueSetQueryDto restfulValueSetCategories(String code, String codeSystemOid) throws CodeSystemVersionNotFoundException, ConceptCodeNotFoundException, ValueSetNotFoundException; 12 | 13 | public ValueSetQueryListDto restfulValueSetCategories(ValueSetQueryListDto valueSetQueryListDtos) throws CodeSystemVersionNotFoundException, ConceptCodeNotFoundException, ValueSetNotFoundException; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/fhir/FHIRFormatErrorException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.fhir; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class FHIRFormatErrorException extends RuntimeException { 8 | public FHIRFormatErrorException() { 9 | } 10 | 11 | public FHIRFormatErrorException(String message) { 12 | super(message); 13 | } 14 | 15 | public FHIRFormatErrorException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public FHIRFormatErrorException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | public FHIRFormatErrorException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 24 | super(message, cause, enableSuppression, writableStackTrace); 25 | } 26 | } -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/domain/reference/RevisionTypeCode.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.reference; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | @Table(name = "revision_type_code") 7 | public class RevisionTypeCode { 8 | @Id 9 | @GeneratedValue(strategy = GenerationType.AUTO) 10 | @Column(name = "id") 11 | private Long id; 12 | 13 | private Byte code; 14 | 15 | private String displayName; 16 | 17 | public Byte getCode() { 18 | return code; 19 | } 20 | 21 | public void setCode(Byte code) { 22 | this.code = code; 23 | } 24 | 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | public String getDisplayName() { 34 | return displayName; 35 | } 36 | 37 | public void setDisplayName(String displayName) { 38 | this.displayName = displayName; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/XacmlNotFoundException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.NOT_FOUND) 7 | public class XacmlNotFoundException extends RuntimeException { 8 | public XacmlNotFoundException() { 9 | super(); 10 | } 11 | 12 | public XacmlNotFoundException(String message) { 13 | super(message); 14 | } 15 | 16 | public XacmlNotFoundException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | 20 | public XacmlNotFoundException(Throwable cause) { 21 | super(cause); 22 | } 23 | 24 | protected XacmlNotFoundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 25 | super(message, cause, enableSuppression, writableStackTrace); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/exception/InvalidContentException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class InvalidContentException extends RuntimeException { 8 | public InvalidContentException() { 9 | } 10 | 11 | public InvalidContentException(String message) { 12 | super(message); 13 | } 14 | 15 | public InvalidContentException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public InvalidContentException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | public InvalidContentException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 24 | super(message, cause, enableSuppression, writableStackTrace); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/ViewActivitiesException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.BAD_REQUEST) 7 | public class ViewActivitiesException extends RuntimeException { 8 | public ViewActivitiesException() { 9 | super(); 10 | } 11 | 12 | public ViewActivitiesException(String message) { 13 | super(message); 14 | } 15 | 16 | public ViewActivitiesException(Throwable cause) { 17 | super(cause); 18 | } 19 | 20 | public ViewActivitiesException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | 24 | protected ViewActivitiesException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 25 | super(message, cause, enableSuppression, writableStackTrace); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/PatientNotFoundException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.NOT_FOUND) 7 | public class PatientNotFoundException extends RuntimeException { 8 | public PatientNotFoundException() { 9 | super(); 10 | } 11 | 12 | public PatientNotFoundException(String message) { 13 | super(message); 14 | } 15 | 16 | public PatientNotFoundException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | 20 | public PatientNotFoundException(Throwable cause) { 21 | super(cause); 22 | } 23 | 24 | protected PatientNotFoundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 25 | super(message, cause, enableSuppression, writableStackTrace); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/InternalServerErrorException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class InternalServerErrorException extends RuntimeException { 8 | public InternalServerErrorException() { 9 | } 10 | 11 | public InternalServerErrorException(String message) { 12 | super(message); 13 | } 14 | 15 | public InternalServerErrorException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public InternalServerErrorException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | public InternalServerErrorException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 24 | super(message, cause, enableSuppression, writableStackTrace); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/domain/consent/ConsentTermsVersionsRepository.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.consent; 2 | 3 | 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | @Repository 11 | public interface ConsentTermsVersionsRepository extends JpaSpecificationExecutor, 12 | JpaRepository{ 13 | 14 | /** 15 | * This query finds all versions that have the disabled 16 | * property set to whatever value is passed in as a parameter 17 | * sorted by added_date_time in descending order. 18 | * 19 | * @param disabled This is boolean true/false value to search for. 20 | * @return List 21 | */ 22 | List findAllByVersionDisabledOrderByAddedDateTimeDesc(Boolean disabled); 23 | } 24 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/common/consentgen/pg/XacmlXslUrlProviderImplTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.common.consentgen.pg; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import gov.samhsa.c2s.common.consentgen.XslResource; 6 | import gov.samhsa.c2s.common.consentgen.pg.XacmlXslUrlProviderImpl; 7 | import org.junit.Test; 8 | 9 | public class XacmlXslUrlProviderImplTest { 10 | 11 | @Test 12 | public void testGetUrl() { 13 | // Arrange 14 | XacmlXslUrlProviderImpl sut = new XacmlXslUrlProviderImpl(); 15 | 16 | final String xacmlXslFile = XacmlXslUrlProviderImpl.class.getPackage().getName().replace(".", "/")+"/c2xacml.xsl"; 17 | String expectedXacmlXslUrl = this.getClass().getClassLoader() 18 | .getResource(xacmlXslFile).toString(); 19 | 20 | // Act 21 | String returnedXacmlXslUrl = sut.getUrl(XslResource.XACMLXSLNAME); 22 | 23 | // Assert 24 | assertEquals(expectedXacmlXslUrl, returnedXacmlXslUrl); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/dto/ValueSetLookUpDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service.dto; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | 7 | public class ValueSetLookUpDto extends AbstractNodeDto { 8 | 9 | private String conceptCode=""; 10 | 11 | private String codeSystemOid=""; 12 | 13 | private Set vsCategoryCodes = new HashSet(); 14 | 15 | public String getConceptCode() { 16 | return conceptCode; 17 | } 18 | 19 | public void setConceptCode(String conceptCode) { 20 | this.conceptCode = conceptCode; 21 | } 22 | 23 | public String getCodeSystemOid() { 24 | return codeSystemOid; 25 | } 26 | 27 | public void setCodeSystemOid(String codeSystemOid) { 28 | this.codeSystemOid = codeSystemOid; 29 | } 30 | 31 | public Set getVsCategoryCodes() { 32 | return vsCategoryCodes; 33 | } 34 | 35 | public void setVsCategoryCodes(Set vsCategoryCodes) { 36 | this.vsCategoryCodes = vsCategoryCodes; 37 | } 38 | 39 | 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/exception/InvalidTableAttributeException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class InvalidTableAttributeException extends RuntimeException { 8 | public InvalidTableAttributeException() { 9 | } 10 | 11 | public InvalidTableAttributeException(String message) { 12 | super(message); 13 | } 14 | 15 | public InvalidTableAttributeException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public InvalidTableAttributeException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | public InvalidTableAttributeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 24 | super(message, cause, enableSuppression, writableStackTrace); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.28__Result status code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into result_status_code (id, code, display_name, code_system_name, code_system) values (1, 'active', 'active', 'ActStatus', '2.16.840.1.113883.5.14'); 2 | insert into result_status_code (id, code, display_name, code_system_name, code_system) values (2, 'suspended', 'suspended', 'ActStatus', '2.16.840.1.113883.5.14'); 3 | insert into result_status_code (id, code, display_name, code_system_name, code_system) values (3, 'aborted', 'aborted', 'ActStatus', '2.16.840.1.113883.5.14'); 4 | insert into result_status_code (id, code, display_name, code_system_name, code_system) values (4, 'completed', 'completed', 'ActStatus', '2.16.840.1.113883.5.14'); 5 | insert into result_status_code (id, code, display_name, code_system_name, code_system) values (5, 'held', 'held', 'ActStatus', '2.16.840.1.113883.5.14'); 6 | insert into result_status_code (id, code, display_name, code_system_name, code_system) values (6, 'cancelled', 'cancelled', 'ActStatus', '2.16.840.1.113883.5.14'); 7 | 8 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/ConsentPdfGenerationException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class ConsentPdfGenerationException extends RuntimeException { 8 | public ConsentPdfGenerationException() { 9 | super(); 10 | } 11 | 12 | public ConsentPdfGenerationException(String message) { 13 | super(message); 14 | } 15 | 16 | public ConsentPdfGenerationException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | 20 | public ConsentPdfGenerationException(Throwable cause) { 21 | super(cause); 22 | } 23 | 24 | protected ConsentPdfGenerationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 25 | super(message, cause, enableSuppression, writableStackTrace); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/domain/consent/ConsentRevocationTermsVersionsRepository.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.consent; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 5 | import org.springframework.stereotype.Repository; 6 | import java.util.List; 7 | 8 | @Repository 9 | public interface ConsentRevocationTermsVersionsRepository extends JpaSpecificationExecutor, 10 | JpaRepository{ 11 | 12 | /** 13 | * This query finds all versions that have the disabled 14 | * property set to whatever value is passed in as a parameter 15 | * sorted by added_date_time in descending order. 16 | * 17 | * @param disabled This is boolean true/false value to search for. 18 | * @return List 19 | */ 20 | List findAllByVersionDisabledOrderByAddedDateTimeDesc(Boolean disabled); 21 | } 22 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.6__Confidentiality code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into confidentiality_code (id, code, display_name, code_system_name, code_system) values (1, 'L', 'low', 'Confidentiality', '2.16.840.1.113883.5.25'); 2 | insert into confidentiality_code (id, code, display_name, code_system_name, code_system) values (2, 'M', 'moderate', 'Confidentiality', '2.16.840.1.113883.5.25'); 3 | insert into confidentiality_code (id, code, display_name, code_system_name, code_system) values (3, 'U', 'unrestricted', 'Confidentiality', '2.16.840.1.113883.5.25'); 4 | insert into confidentiality_code (id, code, display_name, code_system_name, code_system) values (4, 'N', 'normal', 'Confidentiality', '2.16.840.1.113883.5.25'); 5 | insert into confidentiality_code (id, code, display_name, code_system_name, code_system) values (5, 'R', 'restricted', 'Confidentiality', '2.16.840.1.113883.5.25'); 6 | insert into confidentiality_code (id, code, display_name, code_system_name, code_system) values (6, 'VR', 'very restricted', 'Confidentiality', '2.16.840.1.113883.5.25'); 7 | -------------------------------------------------------------------------------- /pcm/src/main/resources/i18n/messages/list_consent_messages.properties: -------------------------------------------------------------------------------- 1 | list_consent_page_title=My Consents 2 | list_consent_block_title=Consents 3 | list_consent_block_information=Federal Government Assisted Alcohol and Drug Abuse Treatment Program 4 | list_consent_email_sent_message=We just sent you an email to the address you registered. Please go to your mailbox and complete the e-sign. 5 | list_consent_medical_information=Medical Information NOT disclosed: 6 | list_consent_medical_information_share=Sharing all medical information: 7 | list_consent_share_following_purposes=Share for following purposes: 8 | list_consent_edit_consent=Edit 9 | list_consent_preview_consent=Preview this consent 10 | list_consent_view_consent=View this consent 11 | list_consent_view_signed_consent=View signed consent 12 | list_consent_sign=Sign 13 | list_consent_export_cdar2=Export CDAR2 14 | list_consent_export_xacml=Export XACML 15 | list_consent_withdrawal=Revocation 16 | list_consent_withdrawal_in_progress=Withdrawal In Progress 17 | list_consent_view_signed_revocation=View Signed Revocation 18 | list_consent_delete=Delete -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/eventlistener/SessionTimeoutConfigSessionCreatedEventListener.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.eventlistener; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.context.ApplicationListener; 6 | import org.springframework.security.web.session.HttpSessionCreatedEvent; 7 | 8 | public class SessionTimeoutConfigSessionCreatedEventListener implements 9 | ApplicationListener { 10 | private final Logger logger = LoggerFactory.getLogger(this.getClass()); 11 | 12 | private int sessionTimeoutInMins; 13 | 14 | public SessionTimeoutConfigSessionCreatedEventListener(int SessionTimeoutInMins) { 15 | this.sessionTimeoutInMins = SessionTimeoutInMins; 16 | } 17 | 18 | @Override 19 | public void onApplicationEvent(HttpSessionCreatedEvent event) { 20 | int sessionTimeoutInSecs = sessionTimeoutInMins * 60; 21 | event.getSession().setMaxInactiveInterval(sessionTimeoutInSecs); 22 | 23 | logger.debug("Session Timeout is set as " + sessionTimeoutInSecs + " Seconds"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/ConsentRevocationPdfGenerationException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class ConsentRevocationPdfGenerationException extends RuntimeException { 8 | public ConsentRevocationPdfGenerationException() { 9 | super(); 10 | } 11 | 12 | public ConsentRevocationPdfGenerationException(String message) { 13 | super(message); 14 | } 15 | 16 | public ConsentRevocationPdfGenerationException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | 20 | public ConsentRevocationPdfGenerationException(Throwable cause) { 21 | super(cause); 22 | } 23 | 24 | protected ConsentRevocationPdfGenerationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 25 | super(message, cause, enableSuppression, writableStackTrace); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/config/PdfProperties.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.config; 2 | 3 | import gov.samhsa.c2s.pcm.infrastructure.pdfbox.PdfBoxFont; 4 | import gov.samhsa.c2s.pcm.infrastructure.pdfbox.PdfBoxPageSize; 5 | import lombok.Data; 6 | import org.hibernate.validator.constraints.NotBlank; 7 | import org.springframework.boot.context.properties.ConfigurationProperties; 8 | import org.springframework.stereotype.Component; 9 | import org.springframework.validation.annotation.Validated; 10 | 11 | import javax.validation.Valid; 12 | import javax.validation.constraints.NotNull; 13 | import java.util.List; 14 | 15 | @Component 16 | @ConfigurationProperties(prefix = "c2s.pcm") 17 | @Data 18 | @Validated 19 | public class PdfProperties { 20 | 21 | @NotNull 22 | @Valid 23 | public List pdfConfigs; 24 | 25 | @Data 26 | public static class PdfConfig { 27 | @NotBlank 28 | public String type; 29 | 30 | //Not required 31 | public PdfBoxFont pdFont; 32 | 33 | //Not required 34 | public PdfBoxPageSize pdfPageSize; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.24__Race code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into race_code (id, code, display_name, code_system_name, code_system) values (1, '1002-5', 'American Indian or Alaska Native', 'Race and Ethnicity - CDC', '2.16.840.1.113883.6.238'); 2 | insert into race_code (id, code, display_name, code_system_name, code_system) values (2, '2028-9', 'Asian', 'Race and Ethnicity - CDC', '2.16.840.1.113883.6.238'); 3 | insert into race_code (id, code, display_name, code_system_name, code_system) values (3, '2054-5', 'Black or African American', 'Race and Ethnicity - CDC', '2.16.840.1.113883.6.238'); 4 | insert into race_code (id, code, display_name, code_system_name, code_system) values (4, '2076-8', 'Native Hawaiian or Other Pacific Islander', 'Race and Ethnicity - CDC', '2.16.840.1.113883.6.238'); 5 | insert into race_code (id, code, display_name, code_system_name, code_system) values (5, '2106-3', 'White', 'Race and Ethnicity - CDC', '2.16.840.1.113883.6.238'); 6 | insert into race_code (id, code, display_name, code_system_name, code_system) values (6, '2131-1', 'Other Race', 'Race and Ethnicity - CDC', '2.16.840.1.113883.6.238'); 7 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.11__Language ability code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into language_ability_code (id, code, display_name, code_system_name, code_system) values (1, 'ESGN', 'Expressed signed', 'LanguageAbilityMode', '2.16.840.1.113883.5.60'); 2 | insert into language_ability_code (id, code, display_name, code_system_name, code_system) values (2, 'ESP', 'Expressed spoken', 'LanguageAbilityMode', '2.16.840.1.113883.5.60'); 3 | insert into language_ability_code (id, code, display_name, code_system_name, code_system) values (3, 'EWR', 'Expressed written', 'LanguageAbilityMode', '2.16.840.1.113883.5.60'); 4 | insert into language_ability_code (id, code, display_name, code_system_name, code_system) values (4, 'RSGN', 'Received signed', 'LanguageAbilityMode', '2.16.840.1.113883.5.60'); 5 | insert into language_ability_code (id, code, display_name, code_system_name, code_system) values (5, 'RSP', 'Received spoken', 'LanguageAbilityMode', '2.16.840.1.113883.5.60'); 6 | insert into language_ability_code (id, code, display_name, code_system_name, code_system) values (6, 'RWR', 'Received written', 'LanguageAbilityMode', '2.16.840.1.113883.5.60'); 7 | 8 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/security/ClamAVClientNotAvailableException.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.security; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 7 | public class ClamAVClientNotAvailableException extends RuntimeException { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | public ClamAVClientNotAvailableException() { 12 | super(); 13 | } 14 | 15 | public ClamAVClientNotAvailableException(String message, Throwable cause, 16 | boolean enableSuppression, boolean writableStackTrace) { 17 | super(message, cause, enableSuppression, writableStackTrace); 18 | } 19 | 20 | public ClamAVClientNotAvailableException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | 24 | public ClamAVClientNotAvailableException(String message) { 25 | super(message); 26 | } 27 | 28 | public ClamAVClientNotAvailableException(Throwable cause) { 29 | super(cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/common/consentgen/XacmlXslUrlProviderImplTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.common.consentgen; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import gov.samhsa.c2s.common.consentgen.XacmlXslUrlProviderImpl; 6 | import gov.samhsa.c2s.common.consentgen.XslResource; 7 | import org.junit.Ignore; 8 | import org.junit.Test; 9 | 10 | public class XacmlXslUrlProviderImplTest { 11 | @Ignore 12 | @Test 13 | public void testGetUrl() { 14 | // Arrange 15 | XacmlXslUrlProviderImpl sut = new XacmlXslUrlProviderImpl(); 16 | 17 | final String xacmlXslFile = "c2xacml.xsl"; 18 | String expectedXacmlXslUrl = this 19 | .getClass() 20 | .getClassLoader() 21 | .getResource( 22 | this.getClass().getPackage().getName() 23 | .replace(".", "/") 24 | + "/" + xacmlXslFile).toString(); 25 | 26 | // Act 27 | String returnedXacmlXslUrl = sut.getUrl(XslResource.XACMLXSLNAME); 28 | 29 | // Assert 30 | assertEquals(expectedXacmlXslUrl, returnedXacmlXslUrl); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/dto/ValueSetQueryListDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service.dto; 2 | 3 | import javax.xml.bind.annotation.XmlAccessType; 4 | import javax.xml.bind.annotation.XmlAccessorType; 5 | import javax.xml.bind.annotation.XmlRootElement; 6 | import javax.xml.bind.annotation.XmlElement; 7 | import javax.xml.bind.annotation.XmlType; 8 | 9 | import java.io.Serializable; 10 | import java.util.HashSet; 11 | import java.util.Set; 12 | 13 | @XmlAccessorType(XmlAccessType.FIELD) 14 | @XmlType(name = "valueSetQueryListDto") 15 | @XmlRootElement(name = "valueSetQueryListDto") 16 | public class ValueSetQueryListDto implements Serializable { 17 | 18 | private static final long serialVersionUID = 6297751247585346546L; 19 | 20 | public ValueSetQueryListDto(){ 21 | 22 | } 23 | 24 | @XmlElement(name = "valueSetQueryDtos") 25 | private Set valueSetQueryDtos = new HashSet(); 26 | 27 | public Set getValueSetQueryDtos() { 28 | return valueSetQueryDtos; 29 | } 30 | 31 | public void setValueSetQueryDtos(Set valueSetQueryDtos) { 32 | this.valueSetQueryDtos = valueSetQueryDtos; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.3.0__Tinyint to BIT 1 changes.sql: -------------------------------------------------------------------------------- 1 | -- Changing tinyint type to BIT(1) 2 | ALTER TABLE consent_aud MODIFY consent_reference_id_mod BIT(1); 3 | ALTER TABLE consent_aud MODIFY consent_revokation_type_mod BIT(1); 4 | ALTER TABLE consent_aud MODIFY consent_revoked BIT(1); 5 | ALTER TABLE consent_aud MODIFY description_mod BIT(1); 6 | ALTER TABLE consent_aud MODIFY end_date_mod BIT(1); 7 | ALTER TABLE consent_aud MODIFY legal_representative_mod BIT(1); 8 | ALTER TABLE consent_aud MODIFY name_mod BIT(1); 9 | ALTER TABLE consent_aud MODIFY patient_mod BIT(1); 10 | ALTER TABLE consent_aud MODIFY revocation_date_mod BIT(1); 11 | ALTER TABLE consent_aud MODIFY signed_date_mod BIT(1); 12 | ALTER TABLE consent_aud MODIFY signed_pdf_consent_mod BIT(1); 13 | ALTER TABLE consent_aud MODIFY signed_pdf_consent_revoke_mod BIT(1); 14 | ALTER TABLE consent_aud MODIFY start_date_mod BIT(1); 15 | ALTER TABLE consent_aud MODIFY consent_revoked_mod BIT(1); 16 | ALTER TABLE consent_aud MODIFY description_mod BIT(1); 17 | ALTER TABLE email_token MODIFY is_token_used BIT(1); 18 | 19 | ALTER TABLE system_notification MODIFY dismissed BIT(1); 20 | ALTER TABLE system_notification MODIFY dismissed BIT(1) NOT NULL; 21 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.18__Privacy law policy code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into privacy_law_policy_code (id, code, display_name, code_system_name, code_system) values (1, '42CFRPart2', '42 CFR Part2', 'ActPolicyType', '2.16.840.1.113883.1.11.19886'); 2 | insert into privacy_law_policy_code (id, code, display_name, code_system_name, code_system) values (2, 'CommonRule', 'Common Rule', 'ActPolicyType', '2.16.840.1.113883.1.11.19886'); 3 | insert into privacy_law_policy_code (id, code, display_name, code_system_name, code_system) values (3, 'HIPAANOPP', 'HIPAA notice of privacy practices', 'ActPolicyType', '2.16.840.1.113883.1.11.19886'); 4 | insert into privacy_law_policy_code (id, code, display_name, code_system_name, code_system) values (4, 'HIPAAPsyNotes', 'HIPAA psychotherapy notes', 'ActPolicyType', '2.16.840.1.113883.1.11.19886'); 5 | insert into privacy_law_policy_code (id, code, display_name, code_system_name, code_system) values (5, 'HIPAASelfPay', 'HIPAA self-pay', 'ActPolicyType', '2.16.840.1.113883.1.11.19886'); 6 | insert into privacy_law_policy_code (id, code, display_name, code_system_name, code_system) values (6, 'Title38Section7332', 'Title 38 Section 7332', 'ActPolicyType', '2.16.840.1.113883.1.11.19886'); 7 | 8 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/config/FHIRProperties.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | @Configuration 8 | @ConfigurationProperties(prefix = "c2s.pcm") 9 | @Data 10 | public class FHIRProperties { 11 | 12 | private Pid pid; 13 | private Pou pou; 14 | private ConsentType consentType; 15 | private Npi npi; 16 | private Ssn ssn; 17 | private boolean keepExcludeList; 18 | 19 | @Data 20 | public static class Coding{ 21 | private String system; 22 | private String oid; 23 | private String label; 24 | } 25 | 26 | @Data 27 | public static class ConsentType extends Coding{ 28 | private String code; 29 | } 30 | 31 | @Data 32 | public static class Ssn extends Coding{ } 33 | 34 | @Data 35 | public static class Npi extends Coding{ } 36 | 37 | @Data 38 | public static class Pou extends Coding{ } 39 | 40 | @Data 41 | public static class Domain extends Coding{ } 42 | @Data 43 | public static class Pid { 44 | private Domain domain; 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V6.3.6__Drop unecessary columns in individual and organizational providers.sql: -------------------------------------------------------------------------------- 1 | 2 | -- Delete unnecessary columns from pcm.individual_provider 3 | ALTER TABLE pcm.individual_provider drop column name_prefix; 4 | ALTER TABLE pcm.individual_provider drop column name_suffix; 5 | ALTER TABLE pcm.individual_provider drop column credential; 6 | ALTER TABLE pcm.individual_provider drop column provider_taxonomy_code; 7 | ALTER TABLE pcm.individual_provider drop column provider_taxonomy_description; 8 | 9 | 10 | -- Delete unnecessary columns from pcm.organizational_provider 11 | ALTER TABLE pcm.organizational_provider drop column provider_taxonomy_code; 12 | ALTER TABLE pcm.organizational_provider drop column provider_taxonomy_description; 13 | ALTER TABLE pcm.organizational_provider drop column other_org_name; 14 | ALTER TABLE pcm.organizational_provider drop column authorized_official_last_name; 15 | ALTER TABLE pcm.organizational_provider drop column authorized_official_first_name; 16 | ALTER TABLE pcm.organizational_provider drop column authorized_official_title; 17 | ALTER TABLE pcm.organizational_provider drop column authorized_official_name_prefix; 18 | ALTER TABLE pcm.organizational_provider drop column authorized_official_telephone_number; -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V6.3.2__Add not null constraint to attested_consent and attested_consent_revocationt.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `pcm`.`attested_consent` MODIFY `attested_date_time` datetime(6) NOT NULL; 2 | ALTER TABLE `pcm`.`attested_consent` MODIFY `attested_pdf_consent` LONGBLOB NOT NULL; 3 | ALTER TABLE `pcm`.`attested_consent` MODIFY `consent_terms_accepted` BIT(1) NOT NULL; 4 | ALTER TABLE `pcm`.`attested_consent` MODIFY `consent_terms_versions` BIGINT NOT NULL; 5 | ALTER TABLE `pcm`.`attested_consent` MODIFY `attester_ip_address` VARCHAR(255) NOT NULL; 6 | ALTER TABLE `pcm`.`attested_consent` MODIFY `patient_guid` VARCHAR(255) NOT NULL; 7 | ALTER TABLE `pcm`.`attested_consent_revocation` MODIFY `attested_date_time` datetime(6) NOT NULL; 8 | ALTER TABLE `pcm`.`attested_consent_revocation` MODIFY `attested_pdf_consent_revoke` LONGBLOB NOT NULL; 9 | ALTER TABLE `pcm`.`attested_consent_revocation` MODIFY `consent_revoke_terms_accepted` BIT(1) NOT NULL; 10 | ALTER TABLE `pcm`.`attested_consent_revocation` MODIFY `consent_revocation_terms_versions` BIGINT NOT NULL; 11 | ALTER TABLE `pcm`.`attested_consent_revocation` MODIFY `attester_ip_address` VARCHAR(255) NOT NULL; 12 | ALTER TABLE `pcm`.`attested_consent_revocation` MODIFY `patient_guid` VARCHAR(255) NOT NULL; -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.36__Unit of measure code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into unit_of_measure_code (id, code, display_name, code_system_name, code_system) values (1, 'mmol/kg', 'MilliMolesPerKiloGram', 'Unified Code for Units of Measure (UCUM)', '2.16.840.1.113883.6.8'); 2 | insert into unit_of_measure_code (id, code, display_name, code_system_name, code_system) values (2, 'fL', 'FemtoLiter', 'Unified Code for Units of Measure (UCUM)', '2.16.840.1.113883.6.8'); 3 | insert into unit_of_measure_code (id, code, display_name, code_system_name, code_system) values (3, 'ug/mL', 'MicroGramsPerMilliLiter', 'Unified Code for Units of Measure (UCUM)', '2.16.840.1.113883.6.8'); 4 | insert into unit_of_measure_code (id, code, display_name, code_system_name, code_system) values (4, 'mg/mmol', 'milligram per millimole', 'Unified Code for Units of Measure (UCUM)', '2.16.840.1.113883.6.8'); 5 | insert into unit_of_measure_code (id, code, display_name, code_system_name, code_system) values (5, 'mL', 'milliliter', 'Unified Code for Units of Measure (UCUM)', '2.16.840.1.113883.6.8'); 6 | insert into unit_of_measure_code (id, code, display_name, code_system_name, code_system) values (6, 'mL/dL', 'milliliter per deciliter', 'Unified Code for Units of Measure (UCUM)', '2.16.840.1.113883.6.8'); 7 | 8 | 9 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/dto/CodeSystemVersionCSDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service.dto; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | public class CodeSystemVersionCSDto { 9 | 10 | private CodeSystemVersionDto codeSystemVersionDto = new CodeSystemVersionDto(); 11 | private Map codeSystemDtoMap = new HashMap(); 12 | private List> codeSystemVersions = new ArrayList>(); 13 | 14 | public CodeSystemVersionDto getCodeSystemVersionDto() { 15 | return codeSystemVersionDto; 16 | } 17 | public void setCodeSystemVersionDto(CodeSystemVersionDto codeSystemVersionDto) { 18 | this.codeSystemVersionDto = codeSystemVersionDto; 19 | } 20 | public Map getCodeSystemDtoMap() { 21 | return codeSystemDtoMap; 22 | } 23 | public void setCodeSystemDtoMap(Map codeSystemDtoMap) { 24 | this.codeSystemDtoMap = codeSystemDtoMap; 25 | } 26 | public List> getCodeSystemVersions() { 27 | return codeSystemVersions; 28 | } 29 | public void setCodeSystemVersions(List> codeSystemVersions) { 30 | this.codeSystemVersions = codeSystemVersions; 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V6.0.1__Add missing audit related fields to attested_consent, attested_consent_aud, attested_consent_revocation, and attested_consent_revocation_aud.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE attested_consent ADD attester_ip_address VARCHAR(255) DEFAULT NULL; 2 | 3 | ALTER TABLE attested_consent_aud ADD attester_ip_address VARCHAR(255) DEFAULT NULL; 4 | ALTER TABLE attested_consent_aud ADD attester_ip_address_mod BIT(1) DEFAULT NULL; 5 | 6 | 7 | ALTER TABLE attested_consent ADD patient_guid VARCHAR(255) DEFAULT NULL; 8 | 9 | ALTER TABLE attested_consent_aud ADD patient_guid VARCHAR(255) DEFAULT NULL; 10 | ALTER TABLE attested_consent_aud ADD patient_guid_mod BIT(1) DEFAULT NULL; 11 | 12 | 13 | 14 | 15 | ALTER TABLE attested_consent_revocation ADD attester_ip_address VARCHAR(255) DEFAULT NULL; 16 | 17 | ALTER TABLE attested_consent_revocation_aud ADD attester_ip_address VARCHAR(255) DEFAULT NULL; 18 | ALTER TABLE attested_consent_revocation_aud ADD attester_ip_address_mod BIT(1) DEFAULT NULL; 19 | 20 | 21 | ALTER TABLE attested_consent_revocation ADD patient_guid VARCHAR(255) DEFAULT NULL; 22 | 23 | ALTER TABLE attested_consent_revocation_aud ADD patient_guid VARCHAR(255) DEFAULT NULL; 24 | ALTER TABLE attested_consent_revocation_aud ADD patient_guid_mod BIT(1) DEFAULT NULL; 25 | -------------------------------------------------------------------------------- /pcm/src/main/resources/i18n/messages/list_consent_messages_cn.properties: -------------------------------------------------------------------------------- 1 | list_consent_page_title=\u6211\u7684\u540C\u610F\u4E66 2 | list_consent_block_title=\u540C\u610F\u4E66 3 | list_consent_block_information=\u8054\u90A6\u653F\u5E9C\u534F\u52A9\u7684\u9152\u7CBE\u548C\u836F\u7269\u6EE5\u7528\u6CBB\u7597\u9879\u76EE 4 | list_consent_email_sent_message=\u6211\u4EEC\u521A\u53D1\u9001\u4E86\u4E00\u5C01\u90AE\u4EF6\u5230\u60A8\u6CE8\u518C\u7684\u90AE\u7BB1\uFF0C\u8BF7\u5230\u60A8\u90AE\u7BB1\u67E5\u770B\u5E76\u5B8C\u6210\u7535\u5B50\u7B7E\u540D 5 | list_consent_medical_information=\u4E0D\u5171\u4EAB\u7684\u533B\u7597\u4FE1\u606F 6 | list_consent_share_following_purposes=\u5206\u4EAB\u7528\u65BC\u4EE5\u4E0B\u76EE\u7684\uFF1A 7 | list_consent_preview_consent=\u9884\u89C8\u540C\u610F\u4E66 8 | list_consent_view_consent=\u67E5\u770B\u540C\u610F\u4E66 9 | list_consent_view_signed_consent=\u67E5\u770B\u5DF2\u7F72\u540D\u7684\u540C\u610F\u4E66 10 | list_consent_go_mailbox=\u53BB\u90AE\u7BB1 11 | list_consent_submit=\u63D0\u4EA4 12 | list_consent_export_cdar2=\u5BFC\u51FA CDAR2 13 | list_consent_export_xacml=\u5BFC\u51FA XACML 14 | list_consent_withdrawal=\u64A4\u9500 15 | list_consent_withdrawal_in_progress=\u6B63\u5728\u64A4\u9500 16 | list_consent_view_signed_revocation=\u67E5\u770B\u64A4\u9500\u4E66 17 | list_consent_delete=\u5220\u9664 -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.27__Result interpretation code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into result_interpretation_code (id, code, display_name, code_system_name, code_system) values (1, 'A', 'Abnormal', 'ObservationInterpretation', '2.16.840.1.113883.5.83'); 2 | insert into result_interpretation_code (id, code, display_name, code_system_name, code_system) values (2, 'L', 'Low', 'ObservationInterpretation', '2.16.840.1.113883.5.83'); 3 | insert into result_interpretation_code (id, code, display_name, code_system_name, code_system) values (3, 'IND', 'Indeterminate', 'ObservationInterpretation', '2.16.840.1.113883.5.83'); 4 | insert into result_interpretation_code (id, code, display_name, code_system_name, code_system) values (4, 'LX', 'below low threshold', 'ObservationInterpretation', '2.16.840.1.113883.5.83'); 5 | insert into result_interpretation_code (id, code, display_name, code_system_name, code_system) values (5, 'HH', 'High alert', 'ObservationInterpretation', '2.16.840.1.113883.5.83'); 6 | insert into result_interpretation_code (id, code, display_name, code_system_name, code_system) values (6, 'H', 'High', 'ObservationInterpretation', '2.16.840.1.113883.5.83'); 7 | insert into result_interpretation_code (id, code, display_name, code_system_name, code_system) values (7, 'AA', 'Abnormal alert', 'ObservationInterpretation', '2.16.840.1.113883.5.83'); 8 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.2.0__Add unique constraints to consent and patient.sql: -------------------------------------------------------------------------------- 1 | -- Add unique constraint to consent 2 | ALTER TABLE consent ADD CONSTRAINT consent_consent_reference_id_idx UNIQUE (consent_reference_id); 3 | ALTER TABLE consent MODIFY consent_reference_id VARCHAR(255) NOT NULL; 4 | ALTER TABLE consent MODIFY consent_revoked BIT(1); 5 | 6 | -- Add unique constraint to patient 7 | ALTER TABLE patient ADD CONSTRAINT patient_medical_record_number_idx UNIQUE (medical_record_number); 8 | ALTER TABLE patient ADD CONSTRAINT patient_username_idx UNIQUE (username); 9 | CREATE INDEX patient_enterprise_identifier_idx ON patient(enterprise_identifier); 10 | ALTER TABLE patient MODIFY medical_record_number VARCHAR(30) NOT NULL; 11 | 12 | DROP INDEX individual_providers ON patient_individual_providers; 13 | ALTER TABLE patient_individual_providers ADD CONSTRAINT UK_cnxbjkdwq5amd0m5x7kpq2opq UNIQUE (individual_providers); 14 | 15 | DROP INDEX code ON medical_section; 16 | ALTER TABLE medical_section ADD CONSTRAINT UK_e6gfje2mokdtfn8f7930gf4gw UNIQUE (code); 17 | 18 | DROP INDEX patient_legal_representative_associations ON patient_patient_legal_representative_associations; 19 | ALTER TABLE patient_patient_legal_representative_associations ADD CONSTRAINT UK_c9krgj0yrbcq2b17hghkqv8iv UNIQUE (patient_legal_representative_associations); 20 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/dto/CodeSystemDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service.dto; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.hibernate.validator.constraints.NotEmpty; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | public class CodeSystemDto extends AbstractNodeDto { 10 | 11 | 12 | private String displayName; 13 | 14 | private List valueSets = new ArrayList(); 15 | 16 | @NotEmpty 17 | private String codeSystemOId; 18 | 19 | 20 | public String getDisplayName() { 21 | return displayName; 22 | } 23 | 24 | 25 | public void setDisplayName(String displayName) { 26 | this.displayName = displayName; 27 | } 28 | 29 | 30 | public String getCodeSystemOId() { 31 | return codeSystemOId; 32 | } 33 | 34 | 35 | public void setCodeSystemOId(String codeSystemOId) { 36 | this.codeSystemOId = codeSystemOId; 37 | } 38 | 39 | public List getValueSets() { 40 | return valueSets; 41 | } 42 | 43 | 44 | public void setValueSets(List valueSets) { 45 | this.valueSets = valueSets; 46 | } 47 | 48 | 49 | @Override 50 | public String toString() { 51 | return ToStringBuilder.reflectionToString(this); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/config/CommonLibraryConfig.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.config; 2 | 3 | import gov.samhsa.c2s.common.document.accessor.DocumentAccessor; 4 | import gov.samhsa.c2s.common.document.accessor.DocumentAccessorImpl; 5 | import gov.samhsa.c2s.common.document.converter.DocumentXmlConverter; 6 | import gov.samhsa.c2s.common.document.converter.DocumentXmlConverterImpl; 7 | import gov.samhsa.c2s.common.document.transformer.XmlTransformer; 8 | import gov.samhsa.c2s.common.document.transformer.XmlTransformerImpl; 9 | import gov.samhsa.c2s.common.marshaller.SimpleMarshaller; 10 | import gov.samhsa.c2s.common.marshaller.SimpleMarshallerImpl; 11 | import org.springframework.context.annotation.Bean; 12 | import org.springframework.context.annotation.Configuration; 13 | 14 | @Configuration 15 | public class CommonLibraryConfig { 16 | 17 | @Bean 18 | public DocumentAccessor docmentAccessor(){ 19 | return new DocumentAccessorImpl(); 20 | } 21 | 22 | @Bean 23 | public DocumentXmlConverter documentXmlConverter(){ 24 | return new DocumentXmlConverterImpl(); 25 | } 26 | 27 | @Bean 28 | public SimpleMarshaller simpleMarshaller(){ 29 | return new SimpleMarshallerImpl(); 30 | } 31 | 32 | @Bean 33 | public XmlTransformer xmlTransformer(){ 34 | return new XmlTransformerImpl(simpleMarshaller()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/pdf/ConsentPdfGenerator.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.pdf; 2 | 3 | import gov.samhsa.c2s.pcm.domain.consent.Consent; 4 | import gov.samhsa.c2s.pcm.domain.patient.Patient; 5 | import org.apache.pdfbox.pdmodel.PDPage; 6 | import org.apache.pdfbox.pdmodel.PDPageContentStream; 7 | import org.apache.pdfbox.pdmodel.font.PDFont; 8 | 9 | import java.io.IOException; 10 | import java.util.Date; 11 | 12 | /** 13 | * The Interface ConsentPdfGenerator. 14 | */ 15 | public interface ConsentPdfGenerator { 16 | 17 | void addConsentTitle(String titleMessageKey, float startYCoordinate, PDPage page, PDPageContentStream contentStream) throws IOException; 18 | 19 | void addConsentReferenceNumberAndPatientInfo(Consent consent, Patient patient, float startYCoordinate, PDFont defaultFont, PDPageContentStream contentStream) throws IOException; 20 | 21 | void addConsentSigningDetails(Patient patient, Date signedOnDateTime, float startYCoordinate, PDFont defaultFont, PDPageContentStream contentStream) throws IOException; 22 | 23 | /** 24 | * Generate consent pdf. 25 | * 26 | * @param consent the consent 27 | * @param patient the patient information 28 | * @return the byte[] 29 | */ 30 | byte[] generateConsentPdf(Consent consent, Patient patient, boolean isSigned, Date attestedOn, String terms) throws IOException; 31 | } 32 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/pagination/sql/SqlFromClause.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.pagination.sql; 2 | 3 | import org.springframework.util.Assert; 4 | import org.springframework.util.StringUtils; 5 | 6 | import java.util.Arrays; 7 | import java.util.Collections; 8 | import java.util.List; 9 | 10 | public class SqlFromClause { 11 | 12 | private final String tableName; 13 | private final String fromClause; 14 | private final List idColumns; 15 | 16 | public SqlFromClause(String tableName, String fromClause, String... idColumns) { 17 | Assert.notNull(tableName); 18 | Assert.notNull(idColumns); 19 | Assert.isTrue(idColumns.length > 0, "At least one primary key column must be provided"); 20 | 21 | this.tableName = tableName; 22 | this.fromClause = StringUtils.hasText(fromClause) ? fromClause : tableName; 23 | this.idColumns = Collections.unmodifiableList(Arrays.asList(idColumns)); 24 | } 25 | 26 | public SqlFromClause(String tableName, String idColumn) { 27 | this(tableName, null, idColumn); 28 | } 29 | 30 | public String getTableName() { 31 | return tableName; 32 | } 33 | 34 | public String getFromClause() { 35 | return fromClause; 36 | } 37 | 38 | public List getIdColumns() { 39 | return idColumns; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/dto/ConceptCodeVSCSDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service.dto; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | 5 | import java.util.ArrayList; 6 | import java.util.HashMap; 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | 11 | public class ConceptCodeVSCSDto extends AbstractNodeDto { 12 | 13 | private ConceptCodeDto conceptCodeDto = new ConceptCodeDto(); 14 | 15 | private Map valueSetsMap = new HashMap(); 16 | 17 | private List csVersions = new ArrayList(); 18 | 19 | public ConceptCodeDto getConceptCodeDto() { 20 | return conceptCodeDto; 21 | } 22 | 23 | public void setConceptCodeDto(ConceptCodeDto conceptCodeDto) { 24 | this.conceptCodeDto = conceptCodeDto; 25 | } 26 | 27 | public Map getValueSetsMap() { 28 | return valueSetsMap; 29 | } 30 | 31 | public void setValueSetsMap(Map valueSetsMap) { 32 | this.valueSetsMap = valueSetsMap; 33 | } 34 | 35 | public List getCsVersions() { 36 | return csVersions; 37 | } 38 | 39 | public void setCsVersions(List csVersions) { 40 | this.csVersions = csVersions; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return ToStringBuilder.reflectionToString(this); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V6.3.3__Rename foreign key column names.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | ALTER TABLE `consent_do_not_share_sensitivity_policy_code` 4 | DROP FOREIGN KEY `FKC819CBFA1765E89`; 5 | 6 | ALTER TABLE `value_set` 7 | DROP FOREIGN KEY `FKD2615C94ED451F98`; 8 | 9 | ALTER TABLE `value_set_category` CHANGE COLUMN `valueset_cat_id` `id` bigint(20); 10 | 11 | ALTER TABLE `consent_do_not_share_sensitivity_policy_code` 12 | CHANGE COLUMN `value_set_category` `value_set_category_id` bigint(20); 13 | 14 | ALTER TABLE `consent_do_not_share_sensitivity_policy_code` 15 | ADD CONSTRAINT `FKC819CBFA1765E89` FOREIGN KEY (`value_set_category_id`) REFERENCES `value_set_category` (`id`); 16 | 17 | -- value_set - value_set_category 18 | 19 | ALTER TABLE `value_set` 20 | CHANGE COLUMN `fk_valueset_cat_id` `value_set_category_id` bigint(20); 21 | 22 | 23 | ALTER TABLE `value_set` 24 | ADD CONSTRAINT `FKD2615C94ED451F98` FOREIGN KEY (`value_set_category_id`) REFERENCES `value_set_category` (`id`); 25 | 26 | -- Renaming foreign key name in modified_entity_type_entity 27 | 28 | ALTER TABLE `modified_entity_type_entity` 29 | DROP FOREIGN KEY `FK9D17762BE1C7106`; 30 | 31 | ALTER TABLE `modified_entity_type_entity` CHANGE COLUMN `revision` `revision_rev` bigint(20); 32 | 33 | ALTER TABLE `modified_entity_type_entity` 34 | ADD CONSTRAINT `FK9D17762BE1C7106` FOREIGN KEY (`revision_rev`) REFERENCES `revinfo` (`rev`); 35 | 36 | 37 | SET FOREIGN_KEY_CHECKS=1; -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/PatientConsentManagementApplication.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm; 2 | 3 | import gov.samhsa.c2s.pcm.domain.PcmDomainBasePackageMarkerInterface; 4 | import gov.samhsa.c2s.vss.VssBasePackageMarkerInterface; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.boot.orm.jpa.EntityScan; 8 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 9 | import org.springframework.cloud.netflix.feign.EnableFeignClients; 10 | import org.springframework.context.annotation.ComponentScan; 11 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 12 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; 13 | 14 | @SpringBootApplication 15 | @EntityScan(basePackageClasses = PcmDomainBasePackageMarkerInterface.class) 16 | @EnableJpaRepositories(basePackageClasses = PcmDomainBasePackageMarkerInterface.class) 17 | @EnableResourceServer 18 | // TODO (#23)(BU): remove component scan when VSS is separated from PCM 19 | @ComponentScan(basePackageClasses = {PatientConsentManagementApplication.class, VssBasePackageMarkerInterface.class}) 20 | @EnableDiscoveryClient 21 | @EnableFeignClients 22 | public class PatientConsentManagementApplication { 23 | 24 | public static void main(String[] args) { 25 | SpringApplication.run(PatientConsentManagementApplication.class, args); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.5__Clinical document type code lookup data.sql: -------------------------------------------------------------------------------- 1 | -- insert into clinical_document_type_code (id, code, display_name, code_system_name, code_system) values (1, '34133-9', 'Summarization of Episode Note', 'LOINC', '2.16.840.1.113883.6.1'); 2 | -- insert into clinical_document_type_code (id, code, display_name, code_system_name, code_system) values (2, '11488-4', 'Consultation Note', 'LOINC', '2.16.840.1.113883.6.1'); 3 | -- insert into clinical_document_type_code (id, code, display_name, code_system_name, code_system) values (3, '18748-4', 'Diagnostic Imaging Report', 'LOINC', '2.16.840.1.113883.6.1'); 4 | -- insert into clinical_document_type_code (id, code, display_name, code_system_name, code_system) values (4, '18842-5', 'Discharge Summary', 'LOINC', '2.16.840.1.113883.6.1'); 5 | -- insert into clinical_document_type_code (id, code, display_name, code_system_name, code_system) values (5, '34117-2', 'History and Physical Note', 'LOINC', '2.16.840.1.113883.6.1'); 6 | -- insert into clinical_document_type_code (id, code, display_name, code_system_name, code_system) values (6, '11504-8', 'Surgical Operation Note', 'LOINC', '2.16.840.1.113883.6.1'); 7 | -- insert into clinical_document_type_code (id, code, display_name, code_system_name, code_system) values (7, '28570-0', 'Procedure Note', 'LOINC', '2.16.840.1.113883.6.1'); 8 | -- insert into clinical_document_type_code (id, code, display_name, code_system_name, code_system) values (8, '11506-3', 'Progress Note', 'LOINC', '2.16.840.1.113883.6.1'); -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V4.1.3__Insert record into consent_revocation_terms_versions table.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO consent_revocation_terms_versions VALUES (1,'I have previously signed a patient consent form allowing my providers to access my electronic health records through the Consent2Share system and now want to withdraw that consent. If I sign this form as the Patient\'s Legal Representative, I understand that all references in this form to \"me\" or \"my\" refer to the Patient.\n\nBy withdrawing my Consent, I understand that:\n\n 1. I Deny Consent for all Participants to access my electronic health information through Consent2Share for any purpose, EXCEPT in a medical emergency.\n 2. Health care provider and health insurers that I am enrolled with will no longer be able to access health information about me through Consent2Share, except in an emergency.\n 3. The Withdrawal of Consent will not affect the exchange of my health information while my Consent was in effect.\n 4. No Consent2Share participating provider will deny me medical care and my insurance eligibility will not be affected based on my Withdrawal of Consent.\n 5. If I wish to reinstate Consent, I may do so by signing and completing a new Patient Consent form and returning it to a participating provider or payer.\n 6. Withdrawing my consent does not prevent my health care provider from submitting claims to my health insurer for reimbursement for services rendered to me.\n 7. I understand that I will get a copy of this form after I sign it.','2016-05-31 00:00:00','\0'); -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.15__Marital status code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into marital_status_code (id, code, display_name, code_system_name, code_system) values (1, 'A', 'Annulled', 'MaritalStatus', '2.16.840.1.113883.5.2'); 2 | insert into marital_status_code (id, code, display_name, code_system_name, code_system) values (2, 'D', 'Divorced', 'MaritalStatus', '2.16.840.1.113883.5.2'); 3 | insert into marital_status_code (id, code, display_name, code_system_name, code_system) values (3, 'I', 'Interlocutory', 'MaritalStatus', '2.16.840.1.113883.5.2'); 4 | insert into marital_status_code (id, code, display_name, code_system_name, code_system) values (4, 'L', 'Legally Separated', 'MaritalStatus', '2.16.840.1.113883.5.2'); 5 | insert into marital_status_code (id, code, display_name, code_system_name, code_system) values (5, 'M', 'Married', 'MaritalStatus', '2.16.840.1.113883.5.2'); 6 | insert into marital_status_code (id, code, display_name, code_system_name, code_system) values (6, 'P', 'Polygamous', 'MaritalStatus', '2.16.840.1.113883.5.2'); 7 | insert into marital_status_code (id, code, display_name, code_system_name, code_system) values (7, 'S', 'Never Married', 'MaritalStatus', '2.16.840.1.113883.5.2'); 8 | insert into marital_status_code (id, code, display_name, code_system_name, code_system) values (8, 'T', 'Domestic partner', 'MaritalStatus', '2.16.840.1.113883.5.2'); 9 | insert into marital_status_code (id, code, display_name, code_system_name, code_system) values (9, 'W', 'Widowed', 'MaritalStatus', '2.16.840.1.113883.5.2'); -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/config/FhirServiceConfig.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.config; 2 | 3 | import ca.uhn.fhir.context.FhirContext; 4 | import ca.uhn.fhir.parser.IParser; 5 | import ca.uhn.fhir.rest.client.IGenericClient; 6 | import ca.uhn.fhir.validation.FhirValidator; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.beans.factory.annotation.Value; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.context.annotation.Configuration; 11 | 12 | @Configuration 13 | public class FhirServiceConfig { 14 | 15 | @Autowired 16 | private PcmProperties pcmProperties; 17 | 18 | @Bean 19 | public FhirContext fhirContext() { 20 | FhirContext fhirContext = FhirContext.forDstu3(); 21 | fhirContext.getRestfulClientFactory().setSocketTimeout(Integer.parseInt(pcmProperties.getHieConnection().getFhir().getClientSocketTimeoutInMs())); 22 | return fhirContext; 23 | } 24 | 25 | @Bean 26 | public IGenericClient fhirClient() { 27 | // Create a client 28 | return fhirContext().newRestfulGenericClient(pcmProperties.getHieConnection().getFhir().getServerUrl()); 29 | } 30 | 31 | @Bean 32 | public IParser fhirXmlParser() { 33 | return fhirContext().newXmlParser(); 34 | } 35 | 36 | @Bean 37 | public IParser fhirJsonParser() { 38 | return fhirContext().newJsonParser(); 39 | } 40 | 41 | @Bean 42 | public FhirValidator fhirValidator() { 43 | return fhirContext().newValidator(); 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/dto/RecentPatientDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.dto; 2 | 3 | import java.util.Date; 4 | 5 | public class RecentPatientDto { 6 | 7 | /** The first name. */ 8 | private String firstName; 9 | 10 | /** The last name. */ 11 | private String lastName; 12 | 13 | 14 | /** The id. */ 15 | private Long id; 16 | 17 | /** The birth date. */ 18 | private Date birthDate; 19 | 20 | /** The administrative gender code. */ 21 | private String administrativeGenderCode; 22 | 23 | private Date dateCreated; 24 | 25 | public String getFirstName() { 26 | return firstName; 27 | } 28 | 29 | public void setFirstName(String firstName) { 30 | this.firstName = firstName; 31 | } 32 | 33 | public String getLastName() { 34 | return lastName; 35 | } 36 | 37 | public void setLastName(String lastName) { 38 | this.lastName = lastName; 39 | } 40 | 41 | public Long getId() { 42 | return id; 43 | } 44 | 45 | public void setId(Long id) { 46 | this.id = id; 47 | } 48 | 49 | public String getAdministrativeGenderCode() { 50 | return administrativeGenderCode; 51 | } 52 | 53 | public void setAdministrativeGenderCode(String administrativeGenderCode) { 54 | this.administrativeGenderCode = administrativeGenderCode; 55 | } 56 | 57 | public Date getBirthDate() { 58 | return birthDate; 59 | } 60 | 61 | public void setBirthDate(Date birthDate) { 62 | this.birthDate = birthDate; 63 | } 64 | 65 | public Date getDateCreated() { 66 | return dateCreated; 67 | } 68 | 69 | public void setDateCreated(Date dateCreated) { 70 | this.dateCreated = dateCreated; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /pcm/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: pcm 4 | profiles: 5 | active: application-default 6 | # Configure a symmetric key to use for Encryption and Decryption 7 | # Please change THE FOLLOWING DEFAULT KEY OUTSIDE OF DEVELOPMENT ENVIRONMENTS! 8 | encrypt: 9 | key: changeit 10 | --- 11 | spring.profiles: application-default 12 | spring: 13 | profiles: 14 | include: config-client,eureka-instance,eureka-client,oauth2-resource-default,mysql 15 | --- 16 | spring.profiles: config-client 17 | spring: 18 | cloud: 19 | config: 20 | discovery: 21 | enabled: true 22 | service-id: config-server 23 | fail-fast: true 24 | retry: 25 | initial-interval: 2000 26 | max-attempts: 20 27 | multiplier: 2 28 | max-interval: 20000 29 | --- 30 | spring.profiles: eureka-instance 31 | eureka: 32 | instance: 33 | instance-id: ${spring.cloud.client.hostname}:${spring.application.name}:${spring.application.instance_id:${random.value}} 34 | secure-port-enabled: false 35 | non-secure-port-enabled: true 36 | --- 37 | spring.profiles: eureka-client 38 | eureka: 39 | client: 40 | service-url: 41 | # endpoint for discovery-server, pass '--eureka.client.protocol=https' if discovery-server is running on https 42 | defaultZone: ${eureka.client.protocol:http}://localhost:8761/eureka/ 43 | --- 44 | # updates configuration for docker environment 45 | spring.profiles: docker 46 | eureka: 47 | client: 48 | service-url: 49 | defaultZone: ${eureka.client.protocol:http}://discovery-server.c2s.com:8761/eureka/ 50 | instance: 51 | prefer-ip-address: true -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V6.3.1__Insert new record into consent_revocation_terms_versions table.sql: -------------------------------------------------------------------------------- 1 | UPDATE consent_revocation_terms_versions SET version_disabled = TRUE WHERE id = 1; 2 | INSERT INTO consent_revocation_terms_versions (consent_revoke_terms_text, added_date_time, version_disabled) VALUES ('I have previously signed a patient consent form allowing my providers to access my electronic health records through the Consent2Share system and now want to revoke that consent. If I sign this form as the Patient\'s Legal Representative, I understand that all references in this form to \"me\" or \"my\" refer to the Patient.\n\nBy revoking my Consent, I understand that:\n\n 1. I Deny Consent for all Participants to access my electronic health information through Consent2Share for any purpose, EXCEPT in a medical emergency.\n 2. Health care provider and health insurers that I am enrolled with will no longer be able to access health information about me through Consent2Share, except in an emergency.\n 3. The Revocation of Consent will not affect the exchange of my health information while my Consent was in effect.\n 4. No Consent2Share participating provider will deny me medical care and my insurance eligibility will not be affected based on my Revocation of Consent.\n 5. If I wish to reinstate Consent, I may do so by signing and completing a new Patient Consent form and returning it to a participating provider or payer.\n 6. Revoking my consent does not prevent my health care provider from submitting claims to my health insurer for reimbursement for services rendered to me.\n 7. I understand that I will get a copy of this form after I sign it.','2016-09-01 12:24:00','\0'); -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/dto/OpenIDConnectUserInfoDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.dto; 2 | 3 | import com.fasterxml.jackson.databind.PropertyNamingStrategy; 4 | import com.fasterxml.jackson.databind.annotation.JsonNaming; 5 | 6 | @JsonNaming(PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy.class) 7 | public class OpenIDConnectUserInfoDto { 8 | private String userId; 9 | private String userName; 10 | private String givenName; 11 | private String familyName; 12 | private String name; 13 | private String email; 14 | 15 | public String getUserId() { 16 | return userId; 17 | } 18 | 19 | public void setUserId(String userId) { 20 | this.userId = userId; 21 | } 22 | 23 | public String getUserName() { 24 | return userName; 25 | } 26 | 27 | public void setUserName(String userName) { 28 | this.userName = userName; 29 | } 30 | 31 | public String getGivenName() { 32 | return givenName; 33 | } 34 | 35 | public void setGivenName(String givenName) { 36 | this.givenName = givenName; 37 | } 38 | 39 | public String getFamilyName() { 40 | return familyName; 41 | } 42 | 43 | public void setFamilyName(String familyName) { 44 | this.familyName = familyName; 45 | } 46 | 47 | public String getName() { 48 | return name; 49 | } 50 | 51 | public void setName(String name) { 52 | this.name = name; 53 | } 54 | 55 | public String getEmail() { 56 | return email; 57 | } 58 | 59 | public void setEmail(String email) { 60 | this.email = email; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.30__Sensitivity policy code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into sensitivity_policy_code (id, code, display_name, code_system_name, code_system) values (1, 'ETH', 'Substance abuse information sensitivity', 'ActInformationSensitivityPolicy', '2.16.840.1.113883.1.11.20428'); 2 | insert into sensitivity_policy_code (id, code, display_name, code_system_name, code_system) values (2, 'GDIS', 'Genetic disease information sensitivity', 'ActInformationSensitivityPolicy', '2.16.840.1.113883.1.11.20428'); 3 | insert into sensitivity_policy_code (id, code, display_name, code_system_name, code_system) values (3, 'HIV', 'HIV/AIDS information sensitivity', 'ActInformationSensitivityPolicy', '2.16.840.1.113883.1.11.20428'); 4 | insert into sensitivity_policy_code (id, code, display_name, code_system_name, code_system) values (4, 'PSY', 'Psychiatry information sensitivity', 'ActInformationSensitivityPolicy', '2.16.840.1.113883.1.11.20428'); 5 | insert into sensitivity_policy_code (id, code, display_name, code_system_name, code_system) values (5, 'SDV', 'Sexual assault, abuse, or domestic violence information sensitivity', 'ActInformationSensitivityPolicy', '2.16.840.1.113883.1.11.20428'); 6 | insert into sensitivity_policy_code (id, code, display_name, code_system_name, code_system) values (6, 'SEX', 'Sexuality and reproductive health information sensitivity', 'ActInformationSensitivityPolicy', '2.16.840.1.113883.1.11.20428'); 7 | insert into sensitivity_policy_code (id, code, display_name, code_system_name, code_system) values (7, 'STD', 'Sexually transmitted disease information sensitivity', 'ActInformationSensitivityPolicy', '2.16.840.1.113883.1.11.20428'); 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/pdfbox/Paragraph.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.pdfbox; 2 | 3 | import gov.samhsa.c2s.pcm.infrastructure.pdfbox.util.PdfBoxHandler; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import org.apache.pdfbox.pdmodel.font.PDFont; 9 | 10 | import java.io.IOException; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | @Data 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | @Builder 18 | public class Paragraph { 19 | 20 | private String text; 21 | 22 | private float width; 23 | 24 | private PDFont font; 25 | 26 | private float fontSize; 27 | 28 | public List getLines() throws IOException { 29 | List result = new ArrayList<>(); 30 | 31 | String[] split = text.split("(?<=\\W)"); 32 | int[] possibleWrapPoints = new int[split.length]; 33 | possibleWrapPoints[0] = split[0].length(); 34 | for (int i = 1; i < split.length; i++) { 35 | possibleWrapPoints[i] = possibleWrapPoints[i - 1] + split[i].length(); 36 | } 37 | 38 | int start = 0; 39 | int end = 0; 40 | for (int i : possibleWrapPoints) { 41 | float width = PdfBoxHandler.targetedStringWidth(text.substring(start, i), font, fontSize); 42 | if (start < end && width > this.width) { 43 | result.add(text.substring(start, end)); 44 | start = end; 45 | } 46 | end = i; 47 | } 48 | // Last piece of text 49 | result.add(text.substring(start)); 50 | return result; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /pcm/src/main/resources/db/migration/V1.0.32__Social history type code lookup data.sql: -------------------------------------------------------------------------------- 1 | insert into social_history_type_code (id, code, display_name, code_system_name, code_system) values (1, '229819007', 'Tobacco use and exposure', 'SNOMED CT', '2.16.840.1.113883.6.96'); 2 | insert into social_history_type_code (id, code, display_name, code_system_name, code_system) values (2, '256235009', 'Exercise', 'SNOMED CT', '2.16.840.1.113883.6.96'); 3 | insert into social_history_type_code (id, code, display_name, code_system_name, code_system) values (3, '160573003', 'Alcohol intake', 'SNOMED CT', '2.16.840.1.113883.6.96'); 4 | insert into social_history_type_code (id, code, display_name, code_system_name, code_system) values (4, '364393001', 'Nutritional observable', 'SNOMED CT', '2.16.840.1.113883.6.96'); 5 | insert into social_history_type_code (id, code, display_name, code_system_name, code_system) values (5, '364703007', 'Employment detail', 'SNOMED CT', '2.16.840.1.113883.6.96'); 6 | insert into social_history_type_code (id, code, display_name, code_system_name, code_system) values (6, '425400000', 'Toxic exposure status', 'SNOMED CT', '2.16.840.1.113883.6.96'); 7 | insert into social_history_type_code (id, code, display_name, code_system_name, code_system) values (7, '363908000', 'Details of drug misuse behavior', 'SNOMED CT', '2.16.840.1.113883.6.96'); 8 | insert into social_history_type_code (id, code, display_name, code_system_name, code_system) values (8, '228272008', 'Health-related behavior', 'SNOMED CT', '2.16.840.1.113883.6.96'); 9 | insert into social_history_type_code (id, code, display_name, code_system_name, code_system) values (9, '105421008', 'Educational Achievement', 'SNOMED CT', '2.16.840.1.113883.6.96'); 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/ImprovedNamingStrategy.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure; 2 | 3 | import org.apache.commons.lang.StringUtils; 4 | import org.hibernate.boot.model.naming.Identifier; 5 | import org.hibernate.boot.model.naming.PhysicalNamingStrategy; 6 | import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; 7 | 8 | public class ImprovedNamingStrategy implements PhysicalNamingStrategy { 9 | @Override 10 | public Identifier toPhysicalCatalogName(Identifier identifier, JdbcEnvironment jdbcEnv) { 11 | return convert(identifier); 12 | } 13 | 14 | @Override 15 | public Identifier toPhysicalColumnName(Identifier identifier, JdbcEnvironment jdbcEnv) { 16 | return convert(identifier); 17 | } 18 | 19 | @Override 20 | public Identifier toPhysicalSchemaName(Identifier identifier, JdbcEnvironment jdbcEnv) { 21 | return convert(identifier); 22 | } 23 | 24 | @Override 25 | public Identifier toPhysicalSequenceName(Identifier identifier, JdbcEnvironment jdbcEnv) { 26 | return convert(identifier); 27 | } 28 | 29 | @Override 30 | public Identifier toPhysicalTableName(Identifier identifier, JdbcEnvironment jdbcEnv) { 31 | return convert(identifier); 32 | } 33 | 34 | private Identifier convert(Identifier identifier) { 35 | if (identifier == null || StringUtils.isBlank(identifier.getText())) { 36 | return identifier; 37 | } 38 | 39 | String regex = "([a-z])([A-Z])"; 40 | String replacement = "$1_$2"; 41 | String newName = identifier.getText().replaceAll(regex, replacement).toLowerCase(); 42 | return Identifier.toIdentifier(newName); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/eventlistener/SecurityEventListener.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.eventlistener; 2 | 3 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 4 | import gov.samhsa.c2s.common.audit.AuditClient; 5 | 6 | /** 7 | * The listener interface for receiving securityEvent events. The class that is 8 | * interested in processing a securityEvent event implements this interface, and 9 | * the object created with that class is registered with a component using the 10 | * component's addSecurityEventListener method. When 11 | * the securityEvent event occurs, that object's appropriate 12 | * method is invoked. 13 | * 14 | * @see SecurityEvent 15 | */ 16 | public abstract class SecurityEventListener extends EventListener { 17 | 18 | /** 19 | * The audit service. 20 | */ 21 | protected AuditClient auditClient; 22 | 23 | /** 24 | * Instantiates a new security event listener. 25 | * 26 | * @param eventService the event service 27 | * @param auditClient the audit service 28 | */ 29 | public SecurityEventListener(EventService eventService, 30 | AuditClient auditClient) { 31 | super(eventService); 32 | this.auditClient = auditClient; 33 | } 34 | 35 | /* 36 | * (non-Javadoc) 37 | * 38 | * @see 39 | * gov.samhsa.consent2share.infrastructure.eventlistener.EventListener#handle 40 | * (java.lang.Object) 41 | */ 42 | @Override 43 | public void handle(Object event) { 44 | audit((SecurityEvent) event); 45 | } 46 | 47 | /** 48 | * Audit. 49 | * 50 | * @param event the event 51 | */ 52 | public abstract void audit(SecurityEvent event); 53 | } 54 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/audit/ActivityHistoryRowMapper.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.audit; 2 | 3 | import gov.samhsa.c2s.pcm.service.audit.domain.ActivityHistory; 4 | import org.springframework.jdbc.core.RowMapper; 5 | import org.springframework.util.Assert; 6 | 7 | import java.sql.ResultSet; 8 | import java.sql.SQLException; 9 | import java.text.SimpleDateFormat; 10 | import java.util.Date; 11 | 12 | public class ActivityHistoryRowMapper implements RowMapper { 13 | 14 | private static final String ACTIVITY_ID = "activity_id"; 15 | private static final String REVISION_ID = "revision_id"; 16 | private static final String TIMESTAMP = "timestamp"; 17 | private static final String USERNAME = "username"; 18 | private static final String REC_TYPE = "rec_type"; 19 | private static final String TYPE = "type"; 20 | 21 | @Override 22 | public ActivityHistory mapRow(ResultSet rs, int rowNum) throws SQLException { 23 | ActivityHistory activityHistory = new ActivityHistory(); 24 | 25 | activityHistory.setId(rs.getLong(ACTIVITY_ID)); 26 | activityHistory.setRevisionid(rs.getLong(REVISION_ID)); 27 | activityHistory.setChangedDateTime(convertTimestampToDateTime(rs.getLong(TIMESTAMP))); 28 | activityHistory.setChangedBy(rs.getString(USERNAME)); 29 | activityHistory.setRecType(rs.getString(REC_TYPE)); 30 | activityHistory.setType(rs.getString(TYPE)); 31 | 32 | return activityHistory; 33 | } 34 | 35 | private String convertTimestampToDateTime(Long revtstmp) { 36 | Assert.isTrue(revtstmp > 0, "The value must be greater than zero"); 37 | return new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new Date(revtstmp)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/ClasspathSqlScriptProvider.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure; 2 | 3 | import gov.samhsa.c2s.pcm.config.PcmProperties; 4 | import gov.samhsa.c2s.pcm.infrastructure.exception.SqlScriptFileException; 5 | import org.apache.commons.io.IOUtils; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.core.io.ClassPathResource; 10 | import org.springframework.core.io.Resource; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.io.IOException; 14 | 15 | @Service 16 | public class ClasspathSqlScriptProvider implements SqlScriptProvider { 17 | 18 | /** 19 | * The Constant UTF_8. 20 | */ 21 | private static final String UTF_8 = "UTF-8"; 22 | 23 | /** 24 | * The logger. 25 | */ 26 | private final Logger logger = LoggerFactory.getLogger(this.getClass()); 27 | 28 | @Autowired 29 | private PcmProperties pcmProperties; 30 | 31 | public ClasspathSqlScriptProvider() throws SqlScriptFileException { 32 | } 33 | 34 | @Override 35 | public String getSqlScript() throws SqlScriptFileException { 36 | try { 37 | final Resource sqlResource = new ClassPathResource(pcmProperties.getActivity().getSql().getPath()); 38 | final String sql = IOUtils.toString(sqlResource.getInputStream(), UTF_8); 39 | logger.debug(sqlResource.getFilename() + " SQL Script:"); 40 | logger.debug(sql); 41 | return sql; 42 | } catch (final IOException e) { 43 | logger.error(e.getMessage(), e); 44 | throw new SqlScriptFileException("SQL script file cannot be found:" + e); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/eventlistener/EventListener.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.eventlistener; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.InitializingBean; 6 | 7 | /** 8 | * The listener interface for receiving event events. The class that is 9 | * interested in processing a event event implements this interface, and the 10 | * object created with that class is registered with a component using the 11 | * component's addEventListener method. When 12 | * the event event occurs, that object's appropriate 13 | * method is invoked. 14 | * 15 | * @see EventService 16 | */ 17 | public abstract class EventListener implements InitializingBean { 18 | 19 | /** The log. */ 20 | Logger log = LoggerFactory.getLogger(this.getClass()); 21 | 22 | /** The event service. */ 23 | EventService eventService; 24 | 25 | /** 26 | * Instantiates a new event listener. 27 | * 28 | * @param eventService 29 | * the event service 30 | */ 31 | public EventListener(EventService eventService) { 32 | super(); 33 | this.eventService = eventService; 34 | } 35 | 36 | /* 37 | * (non-Javadoc) 38 | * 39 | * @see 40 | * org.springframework.beans.factory.InitializingBean#afterPropertiesSet() 41 | */ 42 | public void afterPropertiesSet() throws Exception { 43 | eventService.registerListener(this); 44 | } 45 | 46 | /** 47 | * Can handle. 48 | * 49 | * @param event 50 | * the event 51 | * @return true, if successful 52 | */ 53 | public abstract boolean canHandle(Object event); 54 | 55 | /** 56 | * Handle. 57 | * 58 | * @param event 59 | * the event 60 | */ 61 | public abstract void handle(Object event); 62 | } 63 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/infrastructure/eventlistener/UserCreatedEventListenerTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.eventlistener; 2 | 3 | import java.util.Map; 4 | 5 | import gov.samhsa.c2s.pcm.infrastructure.eventlistener.UserCreatedEventListener; 6 | import gov.samhsa.c2s.common.audit.AuditClient; 7 | import gov.samhsa.c2s.common.audit.PredicateKey; 8 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 9 | import gov.samhsa.c2s.pcm.infrastructure.securityevent.SecurityAuditVerb; 10 | import gov.samhsa.c2s.pcm.infrastructure.securityevent.UserCreatedEvent; 11 | import org.junit.Test; 12 | import org.junit.runner.RunWith; 13 | import org.mockito.InjectMocks; 14 | import org.mockito.Mock; 15 | import org.mockito.runners.MockitoJUnitRunner; 16 | 17 | import ch.qos.logback.audit.AuditException; 18 | import static org.mockito.Mockito.*; 19 | 20 | @RunWith(MockitoJUnitRunner.class) 21 | public class UserCreatedEventListenerTest { 22 | 23 | final static String IP_ADDRESS = "192.168.0.1"; 24 | final static String USER_NAME = "user1"; 25 | 26 | @Mock 27 | AuditClient auditClient; 28 | 29 | @InjectMocks 30 | UserCreatedEventListener listener; 31 | 32 | @Test 33 | public void testHandle() throws AuditException { 34 | @SuppressWarnings("unchecked") 35 | Map predicateMap = (Map) mock(Map.class); 36 | doReturn(predicateMap).when(auditClient).createPredicateMap(); 37 | 38 | SecurityEvent event = new UserCreatedEvent(IP_ADDRESS, 39 | USER_NAME); 40 | listener.audit(event); 41 | verify(auditClient).audit("UserCreatedEventListener", 42 | IP_ADDRESS, SecurityAuditVerb.CREATES_USER, 43 | USER_NAME, predicateMap); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /pcm/src/main/resources/templates/account-updated-template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Account Updated Email 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 20 | 21 |
15 | Account Updated! 16 | 18 | Consent2Share 19 |
22 | 23 | 24 | 25 | 38 | 39 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
Your Consent2Share account information has been updated.
Thank you,
Consent2Share Team
40 | 41 | 42 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/CodeSystemService.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service; 2 | 3 | import gov.samhsa.c2s.vss.service.dto.CodeSystemDto; 4 | import org.springframework.transaction.annotation.Transactional; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Declares methods used to obtain and modify CodeSystem information. 10 | */ 11 | @Transactional(readOnly = true) 12 | public interface CodeSystemService { 13 | 14 | /** 15 | * Creates a new CodeSystem. 16 | * 17 | * @param created The information of the created person. 18 | * @return The created person. 19 | */ 20 | public CodeSystemDto create(CodeSystemDto created); 21 | 22 | /** 23 | * Deletes a CodeSystem. 24 | * 25 | * @param codeSystemId The id of the deleted CodeSystem. 26 | * @return The deleted CodeSystem. 27 | * @throws CodeSystemNotFoundException if no CodeSystem is found with the given id. 28 | */ 29 | public CodeSystemDto delete(Long codeSystemId) throws CodeSystemNotFoundException; 30 | 31 | /** 32 | * Finds all CodeSystems. 33 | * 34 | * @return A list of CodeSystems. 35 | */ 36 | public List findAll(); 37 | 38 | /** 39 | * Finds CodeSystem by id. 40 | * 41 | * @param id The id of the wanted CodeSystem. 42 | * @return The found CodeSystem. If no CodeSystem is found, this method returns null. 43 | */ 44 | public CodeSystemDto findById(Long id); 45 | 46 | /** 47 | * Updates the information of a CodeSystem. 48 | * 49 | * @param updated The information of the updated CodeSystem. 50 | * @return The updated CodeSystem. 51 | * @throws CodeSystemNotFoundException if no CodeSystem is found with given id. 52 | */ 53 | public CodeSystemDto update(CodeSystemDto updated) throws CodeSystemNotFoundException; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/infrastructure/eventlistener/FileUploadedEventListenerTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.eventlistener; 2 | 3 | import java.util.Map; 4 | 5 | import gov.samhsa.c2s.pcm.infrastructure.eventlistener.FileUploadedEventListener; 6 | import gov.samhsa.c2s.common.audit.AuditClient; 7 | import gov.samhsa.c2s.common.audit.PredicateKey; 8 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 9 | import gov.samhsa.c2s.pcm.infrastructure.securityevent.FileUploadedEvent; 10 | import gov.samhsa.c2s.pcm.infrastructure.securityevent.SecurityAuditVerb; 11 | import org.junit.Test; 12 | import org.junit.runner.RunWith; 13 | import org.mockito.InjectMocks; 14 | import org.mockito.Mock; 15 | import org.mockito.runners.MockitoJUnitRunner; 16 | 17 | import ch.qos.logback.audit.AuditException; 18 | import static org.mockito.Mockito.*; 19 | 20 | @RunWith(MockitoJUnitRunner.class) 21 | public class FileUploadedEventListenerTest { 22 | 23 | final static String IP_ADDRESS = "192.168.0.1"; 24 | final static String USER_NAME = "user1"; 25 | final static String FILE_UPLOADED = "file1"; 26 | 27 | @Mock 28 | AuditClient auditClient; 29 | 30 | @InjectMocks 31 | FileUploadedEventListener listener; 32 | 33 | @Test 34 | public void test() throws AuditException { 35 | @SuppressWarnings("unchecked") 36 | Map predicateMap = (Map) mock(Map.class); 37 | doReturn(predicateMap).when(auditClient).createPredicateMap(); 38 | 39 | SecurityEvent event = new FileUploadedEvent(IP_ADDRESS, 40 | USER_NAME, FILE_UPLOADED); 41 | listener.audit(event); 42 | verify(auditClient).audit("FileUploadedEventListener", 43 | USER_NAME, SecurityAuditVerb.UPLOADS_FILE, 44 | FILE_UPLOADED, predicateMap); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/infrastructure/eventlistener/FileDownloadedEventListenerTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.eventlistener; 2 | 3 | import java.util.Map; 4 | 5 | import gov.samhsa.c2s.pcm.infrastructure.eventlistener.FileDownloadedEventListener; 6 | import gov.samhsa.c2s.common.audit.AuditClient; 7 | import gov.samhsa.c2s.common.audit.PredicateKey; 8 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 9 | import gov.samhsa.c2s.pcm.infrastructure.securityevent.FileDownloadedEvent; 10 | import gov.samhsa.c2s.pcm.infrastructure.securityevent.SecurityAuditVerb; 11 | import org.junit.Test; 12 | import org.junit.runner.RunWith; 13 | import org.mockito.InjectMocks; 14 | import org.mockito.Mock; 15 | import org.mockito.runners.MockitoJUnitRunner; 16 | import ch.qos.logback.audit.AuditException; 17 | import static org.mockito.Mockito.*; 18 | 19 | @RunWith(MockitoJUnitRunner.class) 20 | public class FileDownloadedEventListenerTest { 21 | 22 | final static String IP_ADDRESS = "192.168.0.1"; 23 | final static String USER_NAME = "user1"; 24 | final static String FILE_DOWNLOADED = "file1"; 25 | 26 | @Mock 27 | AuditClient auditClient; 28 | 29 | @InjectMocks 30 | FileDownloadedEventListener listener; 31 | 32 | @Test 33 | public void test() throws AuditException { 34 | @SuppressWarnings("unchecked") 35 | Map predicateMap = (Map) mock(Map.class); 36 | doReturn(predicateMap).when(auditClient).createPredicateMap(); 37 | 38 | SecurityEvent event = new FileDownloadedEvent(IP_ADDRESS, 39 | USER_NAME, FILE_DOWNLOADED); 40 | listener.audit(event); 41 | verify(auditClient).audit("FileDownloadedEventListener", 42 | USER_NAME, SecurityAuditVerb.DOWNLOADS_FILE, 43 | FILE_DOWNLOADED, predicateMap); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/dto/ConsentRevocationTermsVersionsDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.dto; 2 | 3 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 4 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 5 | import gov.samhsa.c2s.pcm.service.util.CustomJsonDateDeserializer; 6 | import gov.samhsa.c2s.pcm.service.util.CustomJsonDateSerializer; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import java.util.Date; 10 | 11 | public class ConsentRevocationTermsVersionsDto { 12 | 13 | private Long id; 14 | 15 | private String consentRevokeTermsText; 16 | 17 | @DateTimeFormat(pattern = "MM/dd/yyyy") 18 | @JsonDeserialize(using = CustomJsonDateDeserializer.class) 19 | @JsonSerialize(using = CustomJsonDateSerializer.class) 20 | private Date addedDateTime; 21 | 22 | //When set to true, this version will not be shown to users regardless of whether it is the most recent or not 23 | private Boolean versionDisabled; 24 | 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | public String getConsentRevokeTermsText() { 34 | return consentRevokeTermsText; 35 | } 36 | 37 | public void setConsentRevokeTermsText(String consentRevokeTermsText) { 38 | this.consentRevokeTermsText = consentRevokeTermsText; 39 | } 40 | 41 | public Date getAddedDateTime() { 42 | return addedDateTime; 43 | } 44 | 45 | public void setAddedDateTime(Date addedDateTime) { 46 | this.addedDateTime = addedDateTime; 47 | } 48 | 49 | public Boolean getVersionDisabled() { 50 | return versionDisabled; 51 | } 52 | 53 | public void setVersionDisabled(Boolean versionDisabled) { 54 | this.versionDisabled = versionDisabled; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/vss/service/dto/CodeSystemVersionDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.vss.service.dto; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | 5 | import java.util.ArrayList; 6 | import java.util.HashMap; 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | 11 | public class CodeSystemVersionDto extends AbstractNodeDto { 12 | 13 | private String description; 14 | private List codeSystems = new ArrayList(); 15 | private Map codeSystemMap = new HashMap(); 16 | private Long codeSystemId; 17 | 18 | private String codeSystemName; 19 | 20 | public String getDescription() { 21 | return description; 22 | } 23 | 24 | public void setDescription(String description) { 25 | this.description = description; 26 | } 27 | 28 | public List getCodeSystems() { 29 | return codeSystems; 30 | } 31 | 32 | public void setCodeSystems(List codeSystems) { 33 | this.codeSystems = codeSystems; 34 | } 35 | 36 | public Long getCodeSystemId() { 37 | return codeSystemId; 38 | } 39 | 40 | public void setCodeSystemId(Long codeSystemId) { 41 | this.codeSystemId = codeSystemId; 42 | } 43 | 44 | public String getCodeSystemName() { 45 | return codeSystemName; 46 | } 47 | 48 | public void setCodeSystemName(String codeSystemName) { 49 | this.codeSystemName = codeSystemName; 50 | } 51 | 52 | public Map getCodeSystemMap() { 53 | return codeSystemMap; 54 | } 55 | 56 | public void setCodeSystemMap(Map codeSystemMap) { 57 | this.codeSystemMap = codeSystemMap; 58 | } 59 | 60 | @Override 61 | public String toString() { 62 | return ToStringBuilder.reflectionToString(this); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/domain/consent/ConsentTermsVersions.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.consent; 2 | 3 | import org.hibernate.envers.Audited; 4 | import org.springframework.format.annotation.DateTimeFormat; 5 | 6 | import javax.persistence.*; 7 | import javax.validation.constraints.NotNull; 8 | import javax.validation.constraints.Size; 9 | import java.util.Date; 10 | 11 | @Entity 12 | @Table(name = "consent_terms_versions") 13 | @Audited 14 | public class ConsentTermsVersions { 15 | 16 | @Id 17 | @GeneratedValue 18 | @Column(name = "id") 19 | private Long id; 20 | 21 | @NotNull 22 | @Size(max = 20000) //Maximum of 20,000 characters (using utf-8 encoding) 23 | @Column(columnDefinition = "TEXT") 24 | private String consentTermsText; 25 | 26 | @Temporal(TemporalType.TIMESTAMP) 27 | @DateTimeFormat(pattern = "MM/dd/yyyy") 28 | private Date addedDateTime; 29 | 30 | //When set to true, this version will not be shown to users regardless of whether it is the most recent or not 31 | private Boolean versionDisabled; 32 | 33 | public Long getId() { 34 | return id; 35 | } 36 | 37 | public void setId(Long id) { 38 | this.id = id; 39 | } 40 | 41 | public String getConsentTermsText() { 42 | return consentTermsText; 43 | } 44 | 45 | public void setConsentTermsText(String consentTermsText) { 46 | this.consentTermsText = consentTermsText; 47 | } 48 | 49 | public Date getAddedDateTime() { 50 | return addedDateTime; 51 | } 52 | 53 | public void setAddedDateTime(Date addedDateTime) { 54 | this.addedDateTime = addedDateTime; 55 | } 56 | 57 | public Boolean getVersionDisabled() { 58 | return versionDisabled; 59 | } 60 | 61 | public void setVersionDisabled(Boolean versionDisabled) { 62 | this.versionDisabled = versionDisabled; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/domain/DomainEventServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain; 2 | 3 | import static org.junit.Assert.*; 4 | import java.lang.reflect.Field; 5 | 6 | import org.junit.Test; 7 | 8 | public class DomainEventServiceImplTest { 9 | 10 | @Test 11 | public void testRegisterAndRaise() throws Throwable { 12 | // Arrange 13 | DomainEventServiceImpl sut = new DomainEventServiceImpl(); 14 | 15 | final String whatHappened = "Our team won!"; 16 | 17 | AbstractDomainEventHandler domainEventHandler = new AbstractDomainEventHandler() { 18 | private String receivedWhatHappened; 19 | 20 | @Override 21 | public void handle(OccuredEvent event) { 22 | receivedWhatHappened = event.getWhatHappened(); 23 | } 24 | 25 | @Override 26 | protected Class getEventClass() { 27 | return OccuredEvent.class; 28 | } 29 | }; 30 | 31 | OccuredEvent occuredEvent = new OccuredEvent(whatHappened); 32 | 33 | // Act 34 | sut.register(domainEventHandler); 35 | sut.raise(occuredEvent); 36 | 37 | // Assert 38 | Field f = domainEventHandler.getClass().getDeclaredField( 39 | "receivedWhatHappened"); 40 | f.setAccessible(true); 41 | String receivedWhatHappened = (String) (f.get(domainEventHandler)); 42 | 43 | assertEquals(whatHappened, receivedWhatHappened); 44 | } 45 | 46 | private class OccuredEvent implements DomainEvent { 47 | private String whatHappened; 48 | 49 | public OccuredEvent(String whatHappened) { 50 | this.whatHappened = whatHappened; 51 | } 52 | 53 | public String getWhatHappened() { 54 | return whatHappened; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /tool-scripts/decreaseMajorVersionAndCommit.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo 'Will decrease Major parts of version numbers in pom.xml files by 1' 3 | 4 | :: 5 | :: get current_version in parent pom 6 | :: 7 | 8 | :: set the working directory of a command in windows batch file 9 | pushd ..\pcm 10 | 11 | :: get current version of the top level pom 12 | :: call mvn help:evaluate -Dexpression=project.version 13 | :: for /f %%i in ('"mvn help:evaluate -Dexpression=project.version | grep -v '\[.*'"') do set current_version=%%i 14 | :: run the following line first to have downloading done before next line 15 | call mvn help:evaluate -Dexpression=project.version 16 | :: The following link couldn't excluding Downloading: line 17 | for /f %%i in ('"mvn help:evaluate -Dexpression=project.version | grep -v '\[.*'"') do set current_version=%%i 18 | 19 | echo current_version is %current_version% 20 | 21 | 22 | :: 23 | :: split the maven version into major, minor and build number with qualifier 24 | :: 25 | 26 | echo.-- split the maven version into major, minor and build number with qualifier, using dot as delimiter 27 | for /f "tokens=1,2,3 delims=." %%a in ("%current_version%") do set major=%%a&set minor=%%b&set bq=%%c 28 | echo.Major: %major% 29 | echo.Minor: %minor% 30 | echo.BuildNumberAndQualifier: %bq% 31 | 32 | 33 | :: 34 | :: decrease the major version to get the new version 35 | :: 36 | echo.-- decrease the major version to get the new version 37 | set /a sum1=%major%-1 38 | set new_major=%sum1% 39 | echo new_major is %new_major% 40 | 41 | set new_version=%new_major%.%minor%.%bq% 42 | 43 | echo new_version is %new_version% 44 | 45 | :: Sets the current projects version, updating the details of any child modules as necessary. 46 | call mvn versions:set -DgenerateBackupPoms=false -DnewVersion=%new_version% 47 | 48 | git commit -a -m "Decrease major parts of version numbers in pom.xml files by 1" 49 | 50 | :: reset the working directory 51 | popd 52 | 53 | :end -------------------------------------------------------------------------------- /tool-scripts/decreaseMinorVersionAndCommit.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo 'Will decrease Minor parts of version numbers in pom.xml files by 1' 3 | 4 | :: 5 | :: get current_version in parent pom 6 | :: 7 | 8 | :: set the working directory of a command in windows batch file 9 | pushd ..\pcm 10 | 11 | :: get current version of the top level pom 12 | :: call mvn help:evaluate -Dexpression=project.version 13 | :: for /f %%i in ('"mvn help:evaluate -Dexpression=project.version | grep -v '\[.*'"') do set current_version=%%i 14 | :: run the following line first to have downloading done before next line 15 | call mvn help:evaluate -Dexpression=project.version 16 | :: The following link couldn't excluding Downloading: line 17 | for /f %%i in ('"mvn help:evaluate -Dexpression=project.version | grep -v '\[.*'"') do set current_version=%%i 18 | 19 | echo current_version is %current_version% 20 | 21 | 22 | :: 23 | :: split the maven version into major, minor and build number with qualifier 24 | :: 25 | 26 | echo.-- split the maven version into major, minor and build number with qualifier, using dot as delimiter 27 | for /f "tokens=1,2,3 delims=." %%a in ("%current_version%") do set major=%%a&set minor=%%b&set bq=%%c 28 | echo.Major: %major% 29 | echo.Minor: %minor% 30 | echo.BuildNumberAndQualifier: %bq% 31 | 32 | 33 | :: 34 | :: decrease the minor version to get the new version 35 | :: 36 | echo.-- decrease the minor version to get the new version 37 | set /a sum1=%minor%-1 38 | set new_minor=%sum1% 39 | echo new_minor is %new_minor% 40 | 41 | set new_version=%major%.%new_minor%.%bq% 42 | 43 | echo new_version is %new_version% 44 | 45 | :: Sets the current projects version, updating the details of any child modules as necessary. 46 | call mvn versions:set -DgenerateBackupPoms=false -DnewVersion=%new_version% 47 | 48 | git commit -a -m "Decrease minor parts of version numbers in pom.xml files by 1" 49 | 50 | :: reset the working directory 51 | popd 52 | 53 | :end -------------------------------------------------------------------------------- /tool-scripts/increaseMinorVersionAndCommit.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo 'Will increase Minor parts of version numbers in pom.xml files by 1' 3 | 4 | :: 5 | :: get current_version in parent pom 6 | :: 7 | 8 | :: set the working directory of a command in windows batch file 9 | pushd ..\pcm 10 | 11 | :: get current version of the top level pom 12 | :: call mvn help:evaluate -Dexpression=project.version 13 | :: for /f %%i in ('"mvn help:evaluate -Dexpression=project.version | grep -v '\[.*'"') do set current_version=%%i 14 | :: run the following line first to have downloading done before next line 15 | call mvn help:evaluate -Dexpression=project.version 16 | :: The following link couldn't excluding Downloading: line 17 | for /f %%i in ('"mvn help:evaluate -Dexpression=project.version | grep -v '\[.*'"') do set current_version=%%i 18 | 19 | echo current_version is %current_version% 20 | 21 | 22 | :: 23 | :: split the maven version into major, minor and build number with qualifier 24 | :: 25 | 26 | echo.-- split the maven version into major, minor and build number with qualifier, using dot as delimiter 27 | for /f "tokens=1,2,3 delims=." %%a in ("%current_version%") do set major=%%a&set minor=%%b&set bq=%%c 28 | echo.Major: %major% 29 | echo.Minor: %minor% 30 | echo.BuildNumberAndQualifier: %bq% 31 | 32 | 33 | :: 34 | :: increase the minor version to get the new version 35 | :: 36 | echo.-- increase the minor version to get the new version 37 | set /a sum1=%minor%+1 38 | set new_minor=%sum1% 39 | echo new_minor is %new_minor% 40 | 41 | set new_version=%major%.%new_minor%.%bq% 42 | 43 | echo new_version is %new_version% 44 | 45 | :: Sets the current projects version, updating the details of any child modules as necessary. 46 | call mvn versions:set -DgenerateBackupPoms=false -DnewVersion=%new_version% 47 | 48 | git commit -a -m "Increase minor parts of version numbers in pom.xml files by 1" 49 | 50 | :: reset the working directory 51 | popd 52 | 53 | :end -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/service/dto/ActivityHistoryListDto.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.service.dto; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | public class ActivityHistoryListDto { 7 | private List historyDtoList; 8 | private long totalItems; 9 | private int totalPages; 10 | private int itemsPerPage; 11 | private int currentPage; 12 | 13 | public ActivityHistoryListDto() { 14 | } 15 | 16 | public ActivityHistoryListDto(Map pageResults) { 17 | this.historyDtoList = (List) pageResults.get("results"); 18 | this.currentPage = (int) pageResults.get("currentPage"); 19 | this.itemsPerPage = (int) pageResults.get("itemsPerPage"); 20 | this.totalPages = (int) pageResults.get("totalPages"); 21 | this.totalItems = (long) pageResults.get("totalItems"); 22 | } 23 | 24 | public List getHistoryDtoList() { 25 | return historyDtoList; 26 | } 27 | 28 | public void setHistoryDtoList(List historyDtoList) { 29 | this.historyDtoList = historyDtoList; 30 | } 31 | 32 | public long getTotalItems() { 33 | return totalItems; 34 | } 35 | 36 | public void setTotalItems(long totalItems) { 37 | this.totalItems = totalItems; 38 | } 39 | 40 | public int getTotalPages() { 41 | return totalPages; 42 | } 43 | 44 | public void setTotalPages(int totalPages) { 45 | this.totalPages = totalPages; 46 | } 47 | 48 | public int getCurrentPage() { 49 | return currentPage; 50 | } 51 | 52 | public void setCurrentPage(int currentPage) { 53 | this.currentPage = currentPage; 54 | } 55 | 56 | public int getItemsPerPage() { 57 | return itemsPerPage; 58 | } 59 | 60 | public void setItemsPerPage(int itemsPerPage) { 61 | this.itemsPerPage = itemsPerPage; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/infrastructure/eventlistener/UnauthorizedAccessAttemptedEventListenerTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.eventlistener; 2 | 3 | import java.util.Map; 4 | 5 | import gov.samhsa.c2s.pcm.infrastructure.eventlistener.UnauthorizedAccessAttemptedEventListener; 6 | import gov.samhsa.c2s.common.audit.AuditClient; 7 | import gov.samhsa.c2s.common.audit.PredicateKey; 8 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 9 | import gov.samhsa.c2s.pcm.infrastructure.securityevent.SecurityAuditVerb; 10 | import gov.samhsa.c2s.pcm.infrastructure.securityevent.UnauthorizedAccessAttemptedEvent; 11 | import org.junit.Test; 12 | import org.junit.runner.RunWith; 13 | import org.mockito.InjectMocks; 14 | import org.mockito.Mock; 15 | import org.mockito.runners.MockitoJUnitRunner; 16 | 17 | import ch.qos.logback.audit.AuditException; 18 | import static org.mockito.Mockito.*; 19 | 20 | @RunWith(MockitoJUnitRunner.class) 21 | public class UnauthorizedAccessAttemptedEventListenerTest { 22 | 23 | final static String IP_ADDRESS = "192.168.0.1"; 24 | final static String USER_NAME = "user1"; 25 | 26 | @Mock 27 | AuditClient auditClient; 28 | 29 | @InjectMocks 30 | UnauthorizedAccessAttemptedEventListener listener; 31 | 32 | @Test 33 | public void testAudit() throws AuditException { 34 | @SuppressWarnings("unchecked") 35 | Map predicateMap = (Map) mock(Map.class); 36 | doReturn(predicateMap).when(auditClient).createPredicateMap(); 37 | 38 | SecurityEvent event = new UnauthorizedAccessAttemptedEvent(IP_ADDRESS, 39 | USER_NAME); 40 | listener.audit(event); 41 | verify(auditClient).audit("UnauthorizedAccessAttemptedEventListener", 42 | USER_NAME, SecurityAuditVerb.ATTEMPTS_TO_ACCESS_UNAUTHORIZED_RESOURCE, 43 | "Unauthorized Page", predicateMap); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/infrastructure/eventlistener/MaliciousFileDetectedEventListenerTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.eventlistener; 2 | 3 | import java.util.Map; 4 | 5 | import gov.samhsa.c2s.pcm.infrastructure.eventlistener.MaliciousFileDetectedEventListener; 6 | import gov.samhsa.c2s.common.audit.AuditClient; 7 | import gov.samhsa.c2s.common.audit.PredicateKey; 8 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 9 | import gov.samhsa.c2s.pcm.infrastructure.securityevent.MaliciousFileDetectedEvent; 10 | import gov.samhsa.c2s.pcm.infrastructure.securityevent.SecurityAuditVerb; 11 | import org.junit.Test; 12 | import org.junit.runner.RunWith; 13 | import org.mockito.InjectMocks; 14 | import org.mockito.Mock; 15 | import org.mockito.runners.MockitoJUnitRunner; 16 | 17 | import ch.qos.logback.audit.AuditException; 18 | import static org.mockito.Mockito.*; 19 | 20 | @RunWith(MockitoJUnitRunner.class) 21 | public class MaliciousFileDetectedEventListenerTest { 22 | 23 | final static String IP_ADDRESS = "192.168.0.1"; 24 | final static String USER_NAME = "user1"; 25 | final static String FILE_UPLOADED = "file1"; 26 | 27 | @Mock 28 | AuditClient auditClient; 29 | 30 | @InjectMocks 31 | MaliciousFileDetectedEventListener listener; 32 | 33 | @Test 34 | public void test() throws AuditException { 35 | @SuppressWarnings("unchecked") 36 | Map predicateMap = (Map) mock(Map.class); 37 | doReturn(predicateMap).when(auditClient).createPredicateMap(); 38 | 39 | SecurityEvent event = new MaliciousFileDetectedEvent(IP_ADDRESS, 40 | USER_NAME, FILE_UPLOADED); 41 | listener.audit(event); 42 | verify(auditClient).audit("MaliciousFileDetectedEventListener", 43 | USER_NAME, SecurityAuditVerb.UPLOADS_MALICIOUS_FILE, 44 | FILE_UPLOADED, predicateMap); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /tool-scripts/increaseMajorVersionAndCommit.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo 'Will increase Major parts of version numbers in pom.xml files by 1' 3 | 4 | :: 5 | :: get current_version in parent pom 6 | :: 7 | 8 | :: set the working directory of a command in windows batch file 9 | pushd ..\pcm 10 | 11 | :: get current version of the top level pom 12 | :: call mvn help:evaluate -Dexpression=project.version 13 | :: for /f %%i in ('"mvn help:evaluate -Dexpression=project.version | grep -v '\[.*'"') do set current_version=%%i 14 | :: run the following line first to have downloading done before next line 15 | call mvn help:evaluate -Dexpression=project.version 16 | :: The following link couldn't excluding Downloading: line 17 | for /f %%i in ('"mvn help:evaluate -Dexpression=project.version | grep -v '\[.*'"') do set current_version=%%i 18 | 19 | echo current_version is %current_version% 20 | 21 | 22 | :: 23 | :: split the maven version into major, minor and build number with qualifier 24 | :: 25 | 26 | echo.-- split the maven version into major, minor and build number with qualifier, using dot as delimiter 27 | for /f "tokens=1,2,3 delims=." %%a in ("%current_version%") do set major=%%a&set minor=%%b&set bq=%%c 28 | echo.Major: %major% 29 | echo.Minor: %minor% 30 | echo.BuildNumberAndQualifier: %bq% 31 | 32 | 33 | :: 34 | :: increase the major version to get the new version 35 | :: 36 | echo.-- increase the major version and reset minor version to get the new version 37 | set /a sum1=%major%+1 38 | set new_major=%sum1% 39 | echo new_major is %new_major% 40 | 41 | set new_version=%new_major%.0.%bq% 42 | 43 | echo new_version is %new_version% 44 | 45 | :: Sets the current projects version, updating the details of any child modules as necessary. 46 | call mvn versions:set -DgenerateBackupPoms=false -DnewVersion=%new_version% 47 | 48 | git commit -a -m "Increase major parts of version numbers in pom.xml files by 1" 49 | 50 | :: reset the working directory 51 | popd 52 | 53 | :end -------------------------------------------------------------------------------- /pcm/src/main/resources/templates/user-profile-updated-template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Account Updated Email 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 20 | 21 |
15 | User profile Updated! 16 | 18 | Consent2Share 19 |
22 | 23 | 24 | 25 | 40 | 41 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
Your Consent2Share user profile information has been changed.
If you didn't initiate this change please contact us immediately.
Thank you,
Consent2Share Team
42 | 43 | 44 | -------------------------------------------------------------------------------- /pcm/src/test/java/gov/samhsa/c2s/pcm/infrastructure/eventlistener/AuthenticationFailedEventListenerTest.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.eventlistener; 2 | 3 | import ch.qos.logback.audit.AuditException; 4 | import gov.samhsa.c2s.pcm.infrastructure.eventlistener.AuthenticationFailedEventListener; 5 | import gov.samhsa.c2s.pcm.infrastructure.eventlistener.EventService; 6 | import gov.samhsa.c2s.common.audit.AuditClient; 7 | import gov.samhsa.c2s.common.audit.PredicateKey; 8 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 9 | import gov.samhsa.c2s.pcm.infrastructure.securityevent.AuthenticationFailedEvent; 10 | import gov.samhsa.c2s.pcm.infrastructure.securityevent.SecurityAuditVerb; 11 | import org.junit.Test; 12 | import org.junit.runner.RunWith; 13 | import org.mockito.InjectMocks; 14 | import org.mockito.Mock; 15 | import org.mockito.runners.MockitoJUnitRunner; 16 | 17 | import java.util.Map; 18 | 19 | import static org.mockito.Mockito.*; 20 | 21 | 22 | @RunWith(MockitoJUnitRunner.class) 23 | public class AuthenticationFailedEventListenerTest { 24 | 25 | final static String IP_ADDRESS = "192.168.0.1"; 26 | final static String USER_NAME = "user1"; 27 | 28 | @Mock 29 | AuditClient auditClient; 30 | @Mock 31 | EventService eventService; 32 | 33 | @InjectMocks 34 | AuthenticationFailedEventListener listener; 35 | 36 | 37 | @Test 38 | public void testAudit() throws AuditException { 39 | @SuppressWarnings("unchecked") 40 | Map predicateMap = (Map) mock(Map.class); 41 | doReturn(predicateMap).when(auditClient).createPredicateMap(); 42 | 43 | SecurityEvent event = new AuthenticationFailedEvent(IP_ADDRESS, USER_NAME); 44 | listener.audit(event); 45 | verify(auditClient).audit("AuthenticationFailedEventListener", IP_ADDRESS, SecurityAuditVerb.FAILED_ATTEMPTS_TO_LOGIN_AS, USER_NAME, predicateMap); 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/infrastructure/eventlistener/EventService.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.infrastructure.eventlistener; 2 | 3 | import gov.samhsa.c2s.pcm.domain.SecurityEvent; 4 | import org.springframework.context.ApplicationEvent; 5 | import org.springframework.stereotype.Service; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * The Class EventService. 12 | */ 13 | @Service 14 | public class EventService implements 15 | org.springframework.context.ApplicationListener { 16 | 17 | /** 18 | * The listeners. 19 | */ 20 | private List listeners = new ArrayList(); 21 | 22 | /** 23 | * Method that allows registering of an Event Listener. 24 | * 25 | * @param listener the listener 26 | */ 27 | public void registerListener(EventListener listener) { 28 | listeners.add(listener); 29 | } 30 | 31 | /** 32 | * Spring executes this method with the event object. This method iterates 33 | * though the list of registered Listeners and checks whether any listener 34 | * can handle the event. Calls handle method of the Listener if it can 35 | * handle the event. 36 | * 37 | * @param event the event 38 | */ 39 | public void onApplicationEvent(ApplicationEvent event) { 40 | dispatchEvent(event); 41 | } 42 | 43 | /** 44 | * Raise security event. 45 | * 46 | * @param securityEvent the security event 47 | */ 48 | public void raiseSecurityEvent(SecurityEvent securityEvent) { 49 | dispatchEvent(securityEvent); 50 | } 51 | 52 | /** 53 | * Dispatch event. 54 | * 55 | * @param event the event 56 | */ 57 | private void dispatchEvent(Object event) { 58 | for (EventListener listener : listeners) { 59 | if (listener.canHandle(event)) { 60 | listener.handle(event); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/domain/consent/ConsentRevocationTermsVersions.java: -------------------------------------------------------------------------------- 1 | package gov.samhsa.c2s.pcm.domain.consent; 2 | 3 | import org.hibernate.envers.Audited; 4 | import org.springframework.format.annotation.DateTimeFormat; 5 | 6 | import javax.persistence.*; 7 | import javax.validation.constraints.NotNull; 8 | import javax.validation.constraints.Size; 9 | import java.util.Date; 10 | 11 | @Entity 12 | @Table(name = "consent_revocation_terms_versions") 13 | @Audited 14 | public class ConsentRevocationTermsVersions { 15 | 16 | @Id 17 | @GeneratedValue 18 | @Column(name = "id") 19 | private Long id; 20 | 21 | @NotNull 22 | @Size(max = 20000) //Maximum of 20,000 characters (using utf-8 encoding) 23 | @Column(columnDefinition = "TEXT") 24 | private String consentRevokeTermsText; 25 | 26 | @Temporal(TemporalType.TIMESTAMP) 27 | @DateTimeFormat(pattern = "MM/dd/yyyy") 28 | private Date addedDateTime; 29 | 30 | //When set to true, this version will not be shown to users regardless of whether it is the most recent or not 31 | private Boolean versionDisabled; 32 | 33 | public Long getId() { 34 | return id; 35 | } 36 | 37 | public void setId(Long id) { 38 | this.id = id; 39 | } 40 | 41 | public String getConsentRevokeTermsText() { 42 | return consentRevokeTermsText; 43 | } 44 | 45 | public void setConsentRevokeTermsText(String consentRevokeTermsText) { 46 | this.consentRevokeTermsText = consentRevokeTermsText; 47 | } 48 | 49 | public Date getAddedDateTime() { 50 | return addedDateTime; 51 | } 52 | 53 | public void setAddedDateTime(Date addedDateTime) { 54 | this.addedDateTime = addedDateTime; 55 | } 56 | 57 | public Boolean getVersionDisabled() { 58 | return versionDisabled; 59 | } 60 | 61 | public void setVersionDisabled(Boolean versionDisabled) { 62 | this.versionDisabled = versionDisabled; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /pcm/src/main/java/gov/samhsa/c2s/pcm/domain/DomainEvent.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Open Behavioral Health Information Technology Architecture (OBHITA.org) 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * * Neither the name of the nor the 12 | * names of its contributors may be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | ******************************************************************************/ 26 | package gov.samhsa.c2s.pcm.domain; 27 | 28 | /** 29 | * The Interface DomainEvent. 30 | */ 31 | public interface DomainEvent { 32 | 33 | } 34 | --------------------------------------------------------------------------------