use of org.hl7.fhir.dstu2016may.model.Resource in project beneficiary-fhir-data by CMSgov.
the class InpatientClaimTransformer method transformClaim.
/**
* @param claimGroup the CCW {@link InpatientClaim} to transform
* @return a FHIR {@link ExplanationOfBenefit} resource that represents the specified {@link
* InpatientClaim}
*/
private static ExplanationOfBenefit transformClaim(InpatientClaim claimGroup) {
ExplanationOfBenefit eob = new ExplanationOfBenefit();
// Common group level fields between all claim types
TransformerUtils.mapEobCommonClaimHeaderData(eob, claimGroup.getClaimId(), claimGroup.getBeneficiaryId(), ClaimType.INPATIENT, claimGroup.getClaimGroupId().toPlainString(), MedicareSegment.PART_A, Optional.of(claimGroup.getDateFrom()), Optional.of(claimGroup.getDateThrough()), Optional.of(claimGroup.getPaymentAmount()), claimGroup.getFinalAction());
TransformerUtils.mapEobWeeklyProcessDate(eob, claimGroup.getWeeklyProcessDate());
// map eob type codes into FHIR
TransformerUtils.mapEobType(eob, ClaimType.INPATIENT, Optional.of(claimGroup.getNearLineRecordIdCode()), Optional.of(claimGroup.getClaimTypeCode()));
// set the provider number which is common among several claim types
TransformerUtils.setProviderNumber(eob, claimGroup.getProviderNumber());
if (claimGroup.getPatientStatusCd().isPresent()) {
TransformerUtils.addInformationWithCode(eob, CcwCodebookVariable.NCH_PTNT_STUS_IND_CD, CcwCodebookVariable.NCH_PTNT_STUS_IND_CD, claimGroup.getPatientStatusCd());
}
// add EOB information to fields that are common between the Inpatient and SNF claim types
TransformerUtils.addCommonEobInformationInpatientSNF(eob, claimGroup.getAdmissionTypeCd(), claimGroup.getSourceAdmissionCd(), claimGroup.getNoncoveredStayFromDate(), claimGroup.getNoncoveredStayThroughDate(), claimGroup.getCoveredCareThoughDate(), claimGroup.getMedicareBenefitsExhaustedDate(), claimGroup.getDiagnosisRelatedGroupCd());
// Claim Operational Indirect Medical Education Amount
if (claimGroup.getIndirectMedicalEducationAmount().isPresent()) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.IME_OP_CLM_VAL_AMT, claimGroup.getIndirectMedicalEducationAmount());
}
// Claim Operational disproportionate Amount
if (claimGroup.getDisproportionateShareAmount().isPresent()) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.DSH_OP_CLM_VAL_AMT, claimGroup.getDisproportionateShareAmount());
}
// TODO If actually nullable, should be Optional.
if (claimGroup.getPassThruPerDiemAmount() != null) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.CLM_PASS_THRU_PER_DIEM_AMT, claimGroup.getPassThruPerDiemAmount());
}
// TODO If actually nullable, should be Optional.
if (claimGroup.getProfessionalComponentCharge() != null) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.NCH_PROFNL_CMPNT_CHRG_AMT, claimGroup.getProfessionalComponentCharge());
}
// TODO If actually nullable, should be Optional.
if (claimGroup.getClaimTotalPPSCapitalAmount() != null) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.CLM_TOT_PPS_CPTL_AMT, claimGroup.getClaimTotalPPSCapitalAmount());
}
if (claimGroup.getIndirectMedicalEducationAmount().isPresent()) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.IME_OP_CLM_VAL_AMT, claimGroup.getIndirectMedicalEducationAmount().get());
}
// Claim Uncompensated Care Payment Amount
if (claimGroup.getClaimUncompensatedCareAmount().isPresent()) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.CLM_UNCOMPD_CARE_PMT_AMT, claimGroup.getClaimUncompensatedCareAmount().get());
}
/*
* add field values to the benefit balances that are common between the
* Inpatient and SNF claim types
*/
TransformerUtils.addCommonGroupInpatientSNF(eob, claimGroup.getCoinsuranceDayCount(), claimGroup.getNonUtilizationDayCount(), claimGroup.getDeductibleAmount(), claimGroup.getPartACoinsuranceLiabilityAmount(), claimGroup.getBloodPintsFurnishedQty(), claimGroup.getNoncoveredCharge(), claimGroup.getTotalDeductionAmount(), claimGroup.getClaimPPSCapitalDisproportionateShareAmt(), claimGroup.getClaimPPSCapitalExceptionAmount(), claimGroup.getClaimPPSCapitalFSPAmount(), claimGroup.getClaimPPSCapitalIMEAmount(), claimGroup.getClaimPPSCapitalOutlierAmount(), claimGroup.getClaimPPSOldCapitalHoldHarmlessAmount());
// TODO If this is actually nullable, should be Optional.
if (claimGroup.getDrgOutlierApprovedPaymentAmount() != null) {
TransformerUtils.addAdjudicationTotal(eob, CcwCodebookVariable.NCH_DRG_OUTLIER_APRVD_PMT_AMT, claimGroup.getDrgOutlierApprovedPaymentAmount());
}
// Common group level fields between Inpatient, Outpatient and SNF
TransformerUtils.mapEobCommonGroupInpOutSNF(eob, claimGroup.getBloodDeductibleLiabilityAmount(), claimGroup.getOperatingPhysicianNpi(), claimGroup.getOtherPhysicianNpi(), claimGroup.getClaimQueryCode(), claimGroup.getMcoPaidSw());
// Common group level fields between Inpatient, Outpatient Hospice, HHA and SNF
TransformerUtils.mapEobCommonGroupInpOutHHAHospiceSNF(eob, claimGroup.getOrganizationNpi(), claimGroup.getClaimFacilityTypeCode(), claimGroup.getClaimFrequencyCode(), claimGroup.getClaimNonPaymentReasonCode(), claimGroup.getPatientDischargeStatusCode(), claimGroup.getClaimServiceClassificationTypeCode(), claimGroup.getClaimPrimaryPayerCode(), claimGroup.getAttendingPhysicianNpi(), claimGroup.getTotalChargeAmount(), claimGroup.getPrimaryPayerPaidAmount(), claimGroup.getFiscalIntermediaryNumber(), claimGroup.getFiDocumentClaimControlNumber(), claimGroup.getFiOriginalClaimControlNumber());
// Common group level fields between Inpatient, HHA, Hospice and SNF
TransformerUtils.mapEobCommonGroupInpHHAHospiceSNF(eob, claimGroup.getClaimAdmissionDate(), claimGroup.getBeneficiaryDischargeDate(), Optional.of(claimGroup.getUtilizationDayCount()));
for (Diagnosis diagnosis : extractDiagnoses(claimGroup)) TransformerUtils.addDiagnosisCode(eob, diagnosis);
for (CCWProcedure procedure : TransformerUtils.extractCCWProcedures(claimGroup.getProcedure1Code(), claimGroup.getProcedure1CodeVersion(), claimGroup.getProcedure1Date(), claimGroup.getProcedure2Code(), claimGroup.getProcedure2CodeVersion(), claimGroup.getProcedure2Date(), claimGroup.getProcedure3Code(), claimGroup.getProcedure3CodeVersion(), claimGroup.getProcedure3Date(), claimGroup.getProcedure4Code(), claimGroup.getProcedure4CodeVersion(), claimGroup.getProcedure4Date(), claimGroup.getProcedure5Code(), claimGroup.getProcedure5CodeVersion(), claimGroup.getProcedure5Date(), claimGroup.getProcedure6Code(), claimGroup.getProcedure6CodeVersion(), claimGroup.getProcedure6Date(), claimGroup.getProcedure7Code(), claimGroup.getProcedure7CodeVersion(), claimGroup.getProcedure7Date(), claimGroup.getProcedure8Code(), claimGroup.getProcedure8CodeVersion(), claimGroup.getProcedure8Date(), claimGroup.getProcedure9Code(), claimGroup.getProcedure9CodeVersion(), claimGroup.getProcedure9Date(), claimGroup.getProcedure10Code(), claimGroup.getProcedure10CodeVersion(), claimGroup.getProcedure10Date(), claimGroup.getProcedure11Code(), claimGroup.getProcedure11CodeVersion(), claimGroup.getProcedure11Date(), claimGroup.getProcedure12Code(), claimGroup.getProcedure12CodeVersion(), claimGroup.getProcedure12Date(), claimGroup.getProcedure13Code(), claimGroup.getProcedure13CodeVersion(), claimGroup.getProcedure13Date(), claimGroup.getProcedure14Code(), claimGroup.getProcedure14CodeVersion(), claimGroup.getProcedure14Date(), claimGroup.getProcedure15Code(), claimGroup.getProcedure15CodeVersion(), claimGroup.getProcedure15Date(), claimGroup.getProcedure16Code(), claimGroup.getProcedure16CodeVersion(), claimGroup.getProcedure16Date(), claimGroup.getProcedure17Code(), claimGroup.getProcedure17CodeVersion(), claimGroup.getProcedure17Date(), claimGroup.getProcedure18Code(), claimGroup.getProcedure18CodeVersion(), claimGroup.getProcedure18Date(), claimGroup.getProcedure19Code(), claimGroup.getProcedure19CodeVersion(), claimGroup.getProcedure19Date(), claimGroup.getProcedure20Code(), claimGroup.getProcedure20CodeVersion(), claimGroup.getProcedure20Date(), claimGroup.getProcedure21Code(), claimGroup.getProcedure21CodeVersion(), claimGroup.getProcedure21Date(), claimGroup.getProcedure22Code(), claimGroup.getProcedure22CodeVersion(), claimGroup.getProcedure22Date(), claimGroup.getProcedure23Code(), claimGroup.getProcedure23CodeVersion(), claimGroup.getProcedure23Date(), claimGroup.getProcedure24Code(), claimGroup.getProcedure24CodeVersion(), claimGroup.getProcedure24Date(), claimGroup.getProcedure25Code(), claimGroup.getProcedure25CodeVersion(), claimGroup.getProcedure25Date())) TransformerUtils.addProcedureCode(eob, procedure);
for (InpatientClaimLine claimLine : claimGroup.getLines()) {
ItemComponent item = eob.addItem();
item.setSequence(claimLine.getLineNumber().intValue());
TransformerUtils.mapHcpcs(eob, item, Optional.empty(), claimLine.getHcpcsCode(), Collections.emptyList());
item.setLocation(new Address().setState((claimGroup.getProviderStateCode())));
// Common item level fields between Inpatient, Outpatient, HHA, Hospice and SNF
TransformerUtils.mapEobCommonItemRevenue(item, eob, claimLine.getRevenueCenter(), claimLine.getRateAmount(), claimLine.getTotalChargeAmount(), claimLine.getNonCoveredChargeAmount(), claimLine.getUnitCount(), claimLine.getNationalDrugCodeQuantity(), claimLine.getNationalDrugCodeQualifierCode(), claimLine.getRevenueCenterRenderingPhysicianNPI());
// Common group level field coinsurance between Inpatient, HHA, Hospice and SNF
TransformerUtils.mapEobCommonGroupInpHHAHospiceSNFCoinsurance(eob, item, claimLine.getDeductibleCoinsuranceCd());
}
TransformerUtils.setLastUpdated(eob, claimGroup.getLastUpdated());
return eob;
}
use of org.hl7.fhir.dstu2016may.model.Resource in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsV2 method findOrCreateContainedOrg.
/**
* Looks for an {@link Organization} with the given resource ID in {@link
* ExplanationOfBenefit#getContained()} or adds one if it doesn't exist
*
* @param eob the {@link ExplanationOfBenefit} to modify
* @param id The resource ID
* @return The found or new {@link Organization} resource
*/
static Resource findOrCreateContainedOrg(ExplanationOfBenefit eob, String id) {
Optional<Resource> org = eob.getContained().stream().filter(r -> r.getId() == id).findFirst();
// If it isn't there, add one
if (!org.isPresent()) {
org = Optional.of(new Organization().setId(id));
org.get().getMeta().addProfile(ProfileConstants.C4BB_ORGANIZATION_URL);
eob.getContained().add(org.get());
}
return org.get();
}
use of org.hl7.fhir.dstu2016may.model.Resource in project beneficiary-fhir-data by CMSgov.
the class AbstractR4ResourceProvider method createBundleFor.
/**
* Creates a Bundle of resources for the given data using the given {@link ResourceTypeV2}.
*
* @param resourceTypes The {@link ResourceTypeV2} data to retrieve.
* @param mbi The mbi to look up associated data for.
* @param isHashed Denotes if the given mbi is hashed.
* @param lastUpdated Date range of desired lastUpdate values to retrieve data for.
* @param serviceDate Date range of the desired service date to retrieve data for.
* @return A Bundle with data found using the provided parameters.
*/
@VisibleForTesting
Bundle createBundleFor(Set<ResourceTypeV2<T>> resourceTypes, String mbi, boolean isHashed, boolean excludeSamhsa, DateRangeParam lastUpdated, DateRangeParam serviceDate) {
List<T> resources = new ArrayList<>();
for (ResourceTypeV2<T> type : resourceTypes) {
List<?> entities;
entities = claimDao.findAllByMbiAttribute(type.getEntityClass(), type.getEntityMbiRecordAttribute(), mbi, isHashed, lastUpdated, serviceDate, type.getEntityEndDateAttribute());
resources.addAll(entities.stream().filter(e -> !excludeSamhsa || hasNoSamhsaData(metricRegistry, e)).map(e -> type.getTransformer().transform(metricRegistry, e)).collect(Collectors.toList()));
}
Bundle bundle = new Bundle();
resources.forEach(c -> {
Bundle.BundleEntryComponent entry = bundle.addEntry();
entry.setResource((Resource) c);
});
return bundle;
}
use of org.hl7.fhir.dstu2016may.model.Resource in project beneficiary-fhir-data by CMSgov.
the class PatientResourceProvider method queryDatabaseByHash.
/**
* @param hash the {@link Beneficiary} hash value to match
* @param hashType a string to represent the hash type (used for logging purposes)
* @param requestHeader the {@link #RequestHeaders} where resource request headers are
* encapsulated
* @param beneficiaryHashField the JPA location of the beneficiary hash field
* @param beneficiaryHistoryHashField the JPA location of the beneficiary history hash field
* @return a FHIR {@link Patient} for the CCW {@link Beneficiary} that matches the specified
* {@link Beneficiary} hash value
* @throws NoResultException A {@link NoResultException} will be thrown if no matching {@link
* Beneficiary} can be found
*/
@Trace
private Patient queryDatabaseByHash(String hash, String hashType, SingularAttribute<Beneficiary, String> beneficiaryHashField, SingularAttribute<BeneficiaryHistory, String> beneficiaryHistoryHashField, RequestHeaders requestHeader) {
if (hash == null || hash.trim().isEmpty())
throw new IllegalArgumentException();
/*
* Beneficiaries' HICN/MBIs can change over time and those past HICN/MBIs may land in
* BeneficiaryHistory records. Accordingly, we need to search for matching HICN/MBIs in both the
* Beneficiary and the BeneficiaryHistory records.
*
* There's no sane way to do this in a single query with JPA 2.1, it appears: JPA doesn't
* support UNIONs and it doesn't support subqueries in FROM clauses. That said, the ideal query
* would look like this:
*
* SELECT * FROM ( SELECT DISTINCT "beneficiaryId" FROM "Beneficiaries" WHERE "hicn" =
* :'hicn_hash' UNION SELECT DISTINCT "beneficiaryId" FROM "BeneficiariesHistory" WHERE "hicn" =
* :'hicn_hash') AS matching_benes INNER JOIN "Beneficiaries" ON matching_benes."beneficiaryId"
* = "Beneficiaries"."beneficiaryId" LEFT JOIN "BeneficiariesHistory" ON
* "Beneficiaries"."beneficiaryId" = "BeneficiariesHistory"."beneficiaryId" LEFT JOIN
* "MedicareBeneficiaryIdHistory" ON "Beneficiaries"."beneficiaryId" =
* "MedicareBeneficiaryIdHistory"."beneficiaryId";
*
* ... with the returned columns and JOINs being dynamic, depending on IncludeIdentifiers.
*
* In lieu of that, we run two queries: one to find HICN/MBI matches in BeneficiariesHistory,
* and a second to find BENE_ID or HICN/MBI matches in Beneficiaries (with all of their data, so
* we're ready to return the result). This is bad and dumb but I can't find a better working
* alternative.
*
* (I'll just note that I did also try JPA/Hibernate native SQL queries but couldn't get the
* joins or fetch groups to work with them.)
*
* If we want to fix this, we need to move identifiers out entirely to separate tables:
* BeneficiaryHicns and BeneficiaryMbis. We could then safely query these tables and join them
* back to Beneficiaries (and hopefully the optimizer will play nice, too).
*/
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
// First, find all matching hashes from BeneficiariesHistory.
CriteriaQuery<String> beneHistoryMatches = builder.createQuery(String.class);
Root<BeneficiaryHistory> beneHistoryMatchesRoot = beneHistoryMatches.from(BeneficiaryHistory.class);
beneHistoryMatches.select(beneHistoryMatchesRoot.get(BeneficiaryHistory_.beneficiaryId));
beneHistoryMatches.where(builder.equal(beneHistoryMatchesRoot.get(beneficiaryHistoryHashField), hash));
List<String> matchingIdsFromBeneHistory = null;
Long hicnsFromHistoryQueryNanoSeconds = null;
Timer.Context beneHistoryMatchesTimer = metricRegistry.timer(MetricRegistry.name(getClass().getSimpleName(), "query", "bene_by_" + hashType, hashType + "s_from_beneficiarieshistory")).time();
try {
matchingIdsFromBeneHistory = entityManager.createQuery(beneHistoryMatches).getResultList();
} finally {
hicnsFromHistoryQueryNanoSeconds = beneHistoryMatchesTimer.stop();
TransformerUtils.recordQueryInMdc("bene_by_" + hashType + "." + hashType + "s_from_beneficiarieshistory", hicnsFromHistoryQueryNanoSeconds, matchingIdsFromBeneHistory == null ? 0 : matchingIdsFromBeneHistory.size());
}
// Then, find all Beneficiary records that match the hash or those BENE_IDs.
CriteriaQuery<Beneficiary> beneMatches = builder.createQuery(Beneficiary.class);
Root<Beneficiary> beneMatchesRoot = beneMatches.from(Beneficiary.class);
beneMatchesRoot.fetch(Beneficiary_.skippedRifRecords, JoinType.LEFT);
if (requestHeader.isHICNinIncludeIdentifiers())
beneMatchesRoot.fetch(Beneficiary_.beneficiaryHistories, JoinType.LEFT);
if (requestHeader.isMBIinIncludeIdentifiers())
beneMatchesRoot.fetch(Beneficiary_.medicareBeneficiaryIdHistories, JoinType.LEFT);
beneMatches.select(beneMatchesRoot);
Predicate beneHashMatches = builder.equal(beneMatchesRoot.get(beneficiaryHashField), hash);
if (matchingIdsFromBeneHistory != null && !matchingIdsFromBeneHistory.isEmpty()) {
Predicate beneHistoryHashMatches = beneMatchesRoot.get(Beneficiary_.beneficiaryId).in(matchingIdsFromBeneHistory);
beneMatches.where(builder.or(beneHashMatches, beneHistoryHashMatches));
} else {
beneMatches.where(beneHashMatches);
}
List<Beneficiary> matchingBenes = Collections.emptyList();
Long benesByHashOrIdQueryNanoSeconds = null;
Timer.Context timerHicnQuery = metricRegistry.timer(MetricRegistry.name(getClass().getSimpleName(), "query", "bene_by_" + hashType, "bene_by_" + hashType + "_or_id")).time();
try {
matchingBenes = entityManager.createQuery(beneMatches).getResultList();
} finally {
benesByHashOrIdQueryNanoSeconds = timerHicnQuery.stop();
TransformerUtils.recordQueryInMdc(String.format("bene_by_" + hashType + ".bene_by_" + hashType + "_or_id.include_%s", String.join("_", (List<String>) requestHeader.getValue(HEADER_NAME_INCLUDE_IDENTIFIERS))), benesByHashOrIdQueryNanoSeconds, matchingBenes.size());
}
// Then, if we found more than one distinct BENE_ID, or none, throw an error.
long distinctBeneIds = matchingBenes.stream().map(Beneficiary::getBeneficiaryId).filter(Objects::nonNull).distinct().count();
Beneficiary beneficiary = null;
if (distinctBeneIds <= 0) {
throw new NoResultException();
} else if (distinctBeneIds > 1) {
MDC.put("database_query.by_hash.collision.distinct_bene_ids", Long.toString(distinctBeneIds));
throw new ResourceNotFoundException("By hash query found more than one distinct BENE_ID: " + Long.toString(distinctBeneIds));
} else if (distinctBeneIds == 1) {
beneficiary = matchingBenes.get(0);
}
// Null out the unhashed HICNs if we're not supposed to be returning them
if (!requestHeader.isHICNinIncludeIdentifiers()) {
beneficiary.setHicnUnhashed(Optional.empty());
}
// Null out the unhashed MBIs if we're not supposed to be returning
if (!requestHeader.isMBIinIncludeIdentifiers()) {
beneficiary.setMedicareBeneficiaryId(Optional.empty());
}
Patient patient = BeneficiaryTransformer.transform(metricRegistry, beneficiary, requestHeader);
return patient;
}
use of org.hl7.fhir.dstu2016may.model.Resource in project beneficiary-fhir-data by CMSgov.
the class PatientResourceProvider method read.
/**
* Adds support for the FHIR "read" operation, for {@link Patient}s. The {@link Read} annotation
* indicates that this method supports the read operation.
*
* <p>Read operations take a single parameter annotated with {@link IdParam}, and should return a
* single resource instance.
*
* @param patientId The read operation takes one parameter, which must be of type {@link IdType}
* and must be annotated with the {@link IdParam} annotation.
* @param requestDetails a {@link RequestDetails} containing the details of the request URL, used
* to parse out pagination values
* @return Returns a resource matching the specified {@link IdDt}, or <code>null</code> if none
* exists.
*/
@Read(version = false)
@Trace
public Patient read(@IdParam IdType patientId, RequestDetails requestDetails) {
if (patientId == null)
throw new IllegalArgumentException();
if (patientId.getVersionIdPartAsLong() != null)
throw new IllegalArgumentException();
String beneIdText = patientId.getIdPart();
if (beneIdText == null || beneIdText.trim().isEmpty())
throw new IllegalArgumentException();
RequestHeaders requestHeader = RequestHeaders.getHeaderWrapper(requestDetails);
Operation operation = new Operation(Operation.Endpoint.V1_PATIENT);
operation.setOption("by", "id");
// there is another method with exclude list: requestHeader.getNVPairs(<excludeHeaders>)
requestHeader.getNVPairs().forEach((n, v) -> operation.setOption(n, v.toString()));
operation.publishOperationName();
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<Beneficiary> criteria = builder.createQuery(Beneficiary.class);
Root<Beneficiary> root = criteria.from(Beneficiary.class);
root.fetch(Beneficiary_.skippedRifRecords, JoinType.LEFT);
if (requestHeader.isHICNinIncludeIdentifiers())
root.fetch(Beneficiary_.beneficiaryHistories, JoinType.LEFT);
if (requestHeader.isMBIinIncludeIdentifiers())
root.fetch(Beneficiary_.medicareBeneficiaryIdHistories, JoinType.LEFT);
criteria.select(root);
criteria.where(builder.equal(root.get(Beneficiary_.beneficiaryId), beneIdText));
Beneficiary beneficiary = null;
Long beneByIdQueryNanoSeconds = null;
Timer.Context timerBeneQuery = metricRegistry.timer(MetricRegistry.name(getClass().getSimpleName(), "query", "bene_by_id")).time();
try {
beneficiary = entityManager.createQuery(criteria).getSingleResult();
} catch (NoResultException e) {
throw new ResourceNotFoundException(patientId);
} finally {
beneByIdQueryNanoSeconds = timerBeneQuery.stop();
TransformerUtils.recordQueryInMdc(String.format("bene_by_id.include_%s", String.join("_", (List<String>) requestHeader.getValue(HEADER_NAME_INCLUDE_IDENTIFIERS))), beneByIdQueryNanoSeconds, beneficiary == null ? 0 : 1);
}
// Null out the unhashed HICNs if we're not supposed to be returning them
if (!requestHeader.isHICNinIncludeIdentifiers()) {
beneficiary.setHicnUnhashed(Optional.empty());
}
// Null out the unhashed MBIs if we're not supposed to be returning
if (!requestHeader.isMBIinIncludeIdentifiers()) {
beneficiary.setMedicareBeneficiaryId(Optional.empty());
}
// Add bene_id to MDC logs
TransformerUtils.logBeneIdToMdc(Arrays.asList(beneIdText));
Patient patient = BeneficiaryTransformer.transform(metricRegistry, beneficiary, requestHeader);
return patient;
}
Aggregations