diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/AttestationCheckinReportDAO.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/AttestationCheckinReportDAO.java index d764dd7cdc..81ad423118 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/AttestationCheckinReportDAO.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/AttestationCheckinReportDAO.java @@ -67,6 +67,9 @@ public void save(List checkinReports) { .realWorldTestingValidation(report.getRealWorldTestingValidation()) .apiValidation(report.getApiValidation()) .warnings(report.getWarnings()) + .attestsG7(report.getAttestsG7()) + .attestsG9(report.getAttestsG9()) + .attestsG10(report.getAttestsG10()) .build(); create(entity); }); diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/AttestationCheckinReportEntity.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/AttestationCheckinReportEntity.java index f6b6045c5d..e05251ac25 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/AttestationCheckinReportEntity.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/AttestationCheckinReportEntity.java @@ -129,6 +129,14 @@ public class AttestationCheckinReportEntity extends EntityAudit { @Column(name = "warnings") private String warnings; + @Column(name = "attests_g7") + private Boolean attestsG7; + + @Column(name = "attests_g9") + private Boolean attestsG9; + + @Column(name = "attests_g10") + private Boolean attestsG10; public CheckInReport toDomain() { return CheckInReport.builder() @@ -162,7 +170,9 @@ public CheckInReport toDomain() { .realWorldTestingValidation(this.getRealWorldTestingValidation()) .apiValidation(this.getApiValidation()) .warnings(this.getWarnings()) + .attestsG7(this.getAttestsG7()) + .attestsG9(this.getAttestsG9()) + .attestsG10(this.getAttestsG10()) .build(); - } } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/CheckInReport.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/CheckInReport.java index 35b94ccd0f..9d417a4c3a 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/CheckInReport.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/CheckInReport.java @@ -3,6 +3,8 @@ import java.time.LocalDateTime; import java.util.List; +import org.apache.commons.lang3.BooleanUtils; + import gov.healthit.chpl.changerequest.domain.ChangeRequest; import gov.healthit.chpl.domain.CertificationBody; import gov.healthit.chpl.domain.Developer; @@ -46,6 +48,9 @@ public class CheckInReport { private String realWorldTestingValidation; private String apiValidation; private String warnings; + private Boolean attestsG7; + private Boolean attestsG9; + private Boolean attestsG10; private ChangeRequest mostRecentAttestationChangeRequest; private Developer developer; @@ -80,7 +85,10 @@ public List toListOfStrings() { openDirectReviewNonconformities != null ? openDirectReviewNonconformities.toString() : "0", assurancesValidation != null ? assurancesValidation : "", apiValidation != null ? apiValidation : "", - realWorldTestingValidation != null ? realWorldTestingValidation : ""); + realWorldTestingValidation != null ? realWorldTestingValidation : "", + BooleanUtils.isTrue(attestsG7) ? "TRUE" : "FALSE", + BooleanUtils.isTrue(attestsG9) ? "TRUE" : "FALSE", + BooleanUtils.isTrue(attestsG10) ? "TRUE" : "FALSE"); } public static List getHeaders() { @@ -112,6 +120,9 @@ public static List getHeaders() { "Open Direct Review Non-conformities", "Has listing(s) with Assurances criteria (b)(10)", "Has listing(s) with API criteria", - "Has listing(s) with RWT criteria"); + "Has listing(s) with RWT criteria", + "170.315 (g)(7)", + "170.315 (g)(9)", + "170.315 (g)(10)"); } } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/CheckInReportDataCollector.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/CheckInReportDataCollector.java index b971f0dd5f..7099e920d6 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/CheckInReportDataCollector.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/developer/attestation/CheckInReportDataCollector.java @@ -11,6 +11,7 @@ import gov.healthit.chpl.attestation.domain.AttestationSubmission; import gov.healthit.chpl.attestation.manager.AttestationManager; import gov.healthit.chpl.attestation.service.AttestationCertificationBodyService; +import gov.healthit.chpl.certificationCriteria.CertificationCriterion; import gov.healthit.chpl.changerequest.dao.DeveloperCertificationBodyMapDAO; import gov.healthit.chpl.changerequest.domain.ChangeRequest; import gov.healthit.chpl.changerequest.domain.ChangeRequestAttestationSubmission; @@ -24,6 +25,7 @@ import gov.healthit.chpl.search.domain.ListingSearchResult; import gov.healthit.chpl.search.domain.SearchRequest; import gov.healthit.chpl.service.CertificationCriterionService; +import gov.healthit.chpl.service.CertificationCriterionService.Criteria2015; import gov.healthit.chpl.service.realworldtesting.RealWorldTestingCriteriaService; import gov.healthit.chpl.util.CertificationStatusUtil; import lombok.extern.log4j.Log4j2; @@ -41,6 +43,7 @@ public class CheckInReportDataCollector { private CheckInReportSourceService checkInReportSourceService; private CheckInReportValidation checkInReportValidation; private AttestationCertificationBodyService attestationCertificationBodyService; + private CertificationCriterion g7, g9, g10; private List activeStatuses = CertificationStatusUtil.getActiveStatusNames(); @@ -63,6 +66,9 @@ public CheckInReportDataCollector(AttestationManager attestationManager, this.checkInReportSourceService = checkInReportSourceService; this.checkInReportValidation = checkInReportValidation; this.attestationCertificationBodyService = attestationCertificationBodyService; + this.g7 = certificationCriterionService.get(Criteria2015.G_7); + this.g9 = certificationCriterionService.get(Criteria2015.G_9_CURES); + this.g10 = certificationCriterionService.get(Criteria2015.G_10); } public List collect(List acbIds) throws EntityRetrievalException { @@ -163,11 +169,14 @@ private CheckInReport addResponses(CheckInReport checkInReport, Form form) { } private CheckInReport addComplianceInformation(CheckInReport checkInReport, Developer developer, List allActiveListingsForDeveloper) { - checkInReport.setTotalSurveillances(getTotalSurveillances(developer, allActiveListingsForDeveloper, LOGGER)); - checkInReport.setTotalSurveillanceNonconformities(getTotalSurveillanceNonconformities(developer, allActiveListingsForDeveloper, LOGGER)); - checkInReport.setOpenSurveillanceNonconformities(getOpenSurveillanceNonconformities(developer, allActiveListingsForDeveloper, LOGGER)); + checkInReport.setTotalSurveillances(getTotalSurveillances(allActiveListingsForDeveloper)); + checkInReport.setTotalSurveillanceNonconformities(getTotalSurveillanceNonconformities(allActiveListingsForDeveloper)); + checkInReport.setOpenSurveillanceNonconformities(getOpenSurveillanceNonconformities(allActiveListingsForDeveloper)); checkInReport.setTotalDirectReviewNonconformities(getTotalDirectReviewNonconformities(developer, LOGGER)); checkInReport.setOpenDirectReviewNonconformities(getOpenDirectReviewNonconformities(developer, LOGGER)); + checkInReport.setAttestsG7(getAnyListingForDeveloperAttestsCriterion(allActiveListingsForDeveloper, g7)); + checkInReport.setAttestsG9(getAnyListingForDeveloperAttestsCriterion(allActiveListingsForDeveloper, g9)); + checkInReport.setAttestsG10(getAnyListingForDeveloperAttestsCriterion(allActiveListingsForDeveloper, g10)); return checkInReport; } @@ -197,24 +206,32 @@ private String getAttestationOptionalResponse(Form form, Long conditionId) { return form.formatOptionalResponsesForCondition(conditionId); } - private Long getTotalSurveillances(Developer developer, List allActiveListingsForDeveloper, Logger logger) { + private Long getTotalSurveillances(List allActiveListingsForDeveloper) { return allActiveListingsForDeveloper.stream() .map(listing -> addSurveillanceCount(listing)) .collect(Collectors.summingLong(Long::longValue)); } - private Long getTotalSurveillanceNonconformities(Developer developer, List allActiveListingsForDeveloper, Logger logger) { + private Long getTotalSurveillanceNonconformities(List allActiveListingsForDeveloper) { return allActiveListingsForDeveloper.stream() .map(listing -> addOpenAndClosedNonconformityCount(listing)) .collect(Collectors.summingLong(Long::longValue)); } - private Long getOpenSurveillanceNonconformities(Developer developer, List allActiveListingsForDeveloper, Logger logger) { + private Long getOpenSurveillanceNonconformities(List allActiveListingsForDeveloper) { return allActiveListingsForDeveloper.stream() .map(listing -> listing.getOpenSurveillanceNonConformityCount()) .collect(Collectors.summingLong(Long::longValue)); } + private Boolean getAnyListingForDeveloperAttestsCriterion(List allActiveListingsForDeveloper, CertificationCriterion criterionToCheck) { + return allActiveListingsForDeveloper.stream() + .flatMap(listing -> listing.getCriteriaMet().stream()) + .filter(criterion -> criterion.getId().equals(criterionToCheck.getId())) + .findAny() + .isPresent(); + } + private Long getTotalDirectReviewNonconformities(Developer developer, Logger logger) { return directReviewSearchService.getDeveloperDirectReviews(developer.getId(), logger).stream() .flatMap(dr -> dr.getNonConformities().stream())