Sie sind auf Seite 1von 4

Claim Level Rollup:

Note: In this document I reference the suggested table CMS_SERVICE_CLAIM_LINK. This would be a new table
created for the claim roll up. I’m also basing some of this on the code in
ServiceDeliverySearchViewModel.GenerateClaimBatchNew(). It appears that code is currently at the heart of how HFM
creates claims.

One thought to make the rollup work is that we store a SQL Query which rolls up multiple service deliveries. For example,
let’s say we need to roll up on Consumer, Care Plan, Diagnosis, HCPCS, Place of Service, and Provider. The following
query would roll up service deliveries:

Select Consumer_UUID, CarePlan_UUID, SD.DIAGNOSIS_CODE,


S.HCPCS_CODE, SD.place_of_service_code, SD.Provider_UUID
FROM Service_Delivery SD
INNER JOIN Service_Allocation SA ON SD.Service_Alloc_UUID
= SA.Service_Alloc_UUID
INNER JOIN SERVICE S ON SA.Service_UUID = S.Service_UUID
Group By Consumer_UUID, CarePlan_UUID, SD.DIAGNOSIS_CODE,
S.HCPCS_CODE, SD.place_of_service_code, SD.Provider_UUID

We would need to somehow provide a list of service deliveries. Perhaps we could add BATCH_UUID to the
CMS_SERVICE _CLAIM _LINK table. When the user clicks Generate Claim Batch the application should create a new
CMS_BATCH record. It should then write the BATCH_UUID, SERVICE_DELIVERY_UUID, and
SERVICE_DELIVERY_DAILY_DETAIL_UUID of all selected services to the CMS_SERVICE_LINK table. Now, lets take
the same query from above and add CMS_SERVICE_CLAIM_LINK:

Select Consumer_UUID, CarePlan_UUID, SD.DIAGNOSIS_CODE,


S.HCPCS_CODE, SD.place_of_service_code, SD.Provider_UUID,
Row_Number() OVER (ORDER BY Consumer_UUID) As Claim_Number
FROM Service_Delivery SD
INNER JOIN Service_Allocation SA ON SD.Service_Alloc_UUID
= SA.Service_Alloc_UUID
INNER JOIN SERVICE S ON SA.Service_UUID = S.Service_UUID
INNER JOIN CMS_SERVICE_CLAIM_LINK CL ON
SD.SERVICE_DELIVERY_UUID = CL.SERVICE_DELIVERY_UUID
WHERE CL.BATCH_UUID = <Batch_UUID>
Group By Consumer_UUID, CarePlan_UUID, SD.DIAGNOSIS_CODE,
S.HCPCS_CODE, SD.place_of_service_code, SD.Provider_UUID

With this query the roll up is based on the service deliveries selected by the user. I also added Row_Number so that each
rollup has a unique number.

We need to link each roll up pulled by the query above with a service delivery. To do this we need a query that link the
service delivery table with the query above:

Select Distinct SD.Service_Delivery_UUID, SD.Agency_UUID,


A.Short_Name As Agency,
SD.Service_UUID, Site.Description, SD.Fund_IDENTIFIER_UUID,
Q1.* FROM Service_Delivery SD
INNER JOIN Service_Allocation SA ON SD.Service_Alloc_UUID
= SA.Service_Alloc_UUID
INNER JOIN SERVICE S ON SA.Service_UUID = S.Service_UUID
INNER JOIN CMS_SERVICE_CLAIM_LINK CL ON
SD.SERVICE_DELIVERY_UUID = CL.SERVICE_DELIVERY_UUID
INNER JOIN Agency A ON SD.Agency_UUID = A.Agency_UUID
LEFT JOIN Site ON SD.Site_UUID = Site.Site_UUID
INNER JOIN
(Select Consumer_UUID, CarePlan_UUID, SD.DIAGNOSIS_CODE,
S.HCPCS_CODE, SD.place_of_service_code, SD.Provider_UUID,
Row_Number() OVER (ORDER BY Consumer_UUID) As Claim_Number
FROM Service_Delivery SD
INNER JOIN Service_Allocation SA ON SD.Service_Alloc_UUID
= SA.Service_Alloc_UUID
INNER JOIN SERVICE S ON SA.Service_UUID = S.Service_UUID
INNER JOIN CMS_SERVICE_CLAIM_LINK CL ON
SD.SERVICE_DELIVERY_UUID = CL.SERVICE_DELIVERY_UUID
WHERE CL.BATCH_UUID = <Batch_UUID>
Group By Consumer_UUID, CarePlan_UUID, SD.DIAGNOSIS_CODE,
S.HCPCS_CODE, SD.place_of_service_code, SD.Provider_UUID)
As Q1 ON SD.Consumer_UUID = Q1.Consumer_UUID
and SA.CarePlan_UUID = Q1.CarePlan_UUID
and S.HCPCS_CODE = Q1.HCPCS_CODE
and SD.Provider_UUID = Q1.Provider_UUID
Order BY Claim_Number

The query above would be at the heart of the roll up. This is the query we would use to pull the service deliveries we
need to roll into claims. This query would be saved in the config table. This query links the service delivery records with
the roll up records.

In HFM, the following code saves claim records:

cmsClaim.ProviderUuid = selectedServiceDelivery.ServiceDelivery.ProviderUuid;
cmsClaim.AgencyUuid = selectedServiceDelivery.ServiceDelivery.AgencyUuid;
cmsClaim.AgencyName = selectedServiceDelivery.ServiceDelivery.Agency;
cmsClaim.SiteDescription = selectedServiceDelivery.ServiceDelivery.Site.ToString();
cmsClaim.FundIdentifierCode = selectedServiceDelivery.FundIdentifierUuid.ToString();
cmsClaim.ServiceUuid = selectedServiceDelivery.ServiceUuid;
cmsClaim.SubProviderName = selectedServiceDelivery.SubProvider;
cmsClaim.TotalUnits = selectedServiceDelivery.TotalUnits;
cmsClaim.UnitPrice = selectedServiceDelivery.ServiceDelivery.UnitPrice;
cmsClaim.DiagnosisCode = selectedServiceDelivery.DiagnosisCode;
cmsClaim.ServiceDeliveryUuid = selectedServiceDelivery.ServiceDeliveryUuid

I’ve added fields to the query to account for this code. HFM could take the recordset returned by the query above and
loop through it. Each time the value of Claim_Number changes a new claim record should created. Each service
associated with a given Claim_Number should be updated with the same Claim_UUID in the
CMS_SERVICE_CLAIM_LINK table. For example:

Let’s say the query above returns the following:

Service_Delivery_UUID ….. Claim_Count


E824F980-9ECA-4845-8094-38910FF8EA3B 1
3129D68A-53E9-4533-AB0C-D60E621AD06B 1
15FA9ABC-E91C-4D65-B5B7-13A53E15683D 2
6A30DE6A-0C86-435C-808C-51B7EFEBBB82 2

HFM would loop through this record set.:


When HFM sees the first record it will create a new CMS_CLAIM record. It should also update
CMS_SERVICE_CLAIM_LINK.CLAIM_UUID where SERVICE_DELIVERY_UUID = ‘E824F980-9ECA-4845-8094-
38910FF8EA3B’

When HFM moves to the second record it should know that a CMS_CLAIM record was already created for
CLAIM_COUNT 1. It should not create a new CMS_CLAIM record. It should also update
CMS_SERVICE_CLAIM_LINK.CLAIM_UUID where SERVICE_DELIVERY_UUID = ‘3129D68A-53E9-4533-AB0C-
D60E621AD06B’

When HFM moves to the third record it will know a new claim has not been created for Claim_Count 2. Here it
will add a new CMS_CLAIM record for Claim_Count 2. It should also update
CMS_SERVICE_CLAIM_LINK.CLAIM_UUID where SERVICE_DELIVERY_UUID = ‘15FA9ABC-E91C-4D65-B5B7-
13A53E15683D’

When HFM moves to the fourth record it should know that a CMS_CLAIM record was already created for
CLAIM_COUNT 2. It should not create a new CMS_CLAIM record. It should also update
CMS_SERVICE_CLAIM_LINK.CLAIM_UUID where SERVICE_DELIVERY_UUID = ‘6A30DE6A-0C86-435C-808C-
51B7EFEBBB82’

At this point we will have created the CMS_CLAIM records.

Service Level Rollup:

Let’s assume the user has requested we roll up at the service level based on service dates. I think we should have a
check box on the config page which determines if we roll up on dates. I can’t think of any other values we could roll up on
at this level.

By time we reach the service level rollup we should have all of our CMS_Claim records created.

Let’s start by getting a list of claim_uuids associated with the current batch:

Select CLAIM_UUID FROM CMS_CLAIM WHERE BATCH_UUID = '<Batch_UUID>'


Loop through each UUID in the list. For each UUID we will need to get a list of Service Delivery Details associated with
the claim. Order the list by Service_Date:

Select SC.SERVICE_DELIVERY_DAILY_DETAIL_UUID, SC.SERVICE_DELIVERY_UUID,


SERVICE_DATE, case
when sdd.units is null then sd.units
Else sdd.Units
end As UNITS, SD.UNIT_PRICE FROM CMS_SERVICE_CLAIM_LINK SC
LEFT JOIN SERVICE_DELIVERY_DAILY_DETAIL SDD ON SC.SERVICE_DELIVERY_DAILY_DETAIL_UUID
= SDD.SERVICE_DELIVERY_DAILY_DETAIL_UUID
LEFT JOIN SERVICE_DELIVERY SD ON SC.SERVICE_DELIVERY_UUID =
SD.SERVICE_DELIVERY_UUID
WHERE SC.Claim_UUID = '<Claim_UUID>'
ORDER BY Service_Date

For each service delivery in the list we will need to keep track of Service_Date, Units, and Unit Price. We will want to roll
up claims when dates are continuous. Notice in the query above if SERVICE_DELIVERY_DAILY_DETAIL.UNITS is null
we are pulling units from SERVICE_DELIVERY.

Let’s assume the query above pulls the following records:

Service_Delivery_Daily_Detail_UUID Service_Delivery_UUID Service_Date Units Unit Cost


A9518A9F-22BE-432B-8690-83F5DE5C7AE3 1A8A0EDE-5B4A-413D-8CA4-5A2B9CD09407
10/27/102.50 21.00
9FBCEEA8-56A9-4DB6-B993-486E2D5E1ECF 1A8A0EDE-5B4A-413D-8CA4-5A2B9CD09407 10/28/10
2.50 21.00
6D563261-B97C-4A96-82A7-65838C5DD359 AADA1B1D-2B25-41AD-AB20-59677040F205 11/1/10
2.00 21.00
BCB01961-7AFD-45F5-9B7A-6B43E5290DA0 AADA1B1D-2B25-41AD-AB20-59677040F205 11/2/10
4.00 21.00
145224E0-A332-4C66-80C5-100A33C6735E AADA1B1D-2B25-41AD-AB20-59677040F205 11/3/10
2.50 21.00

HFM would loop through this record set:

It should hit the first record and realize that this is first record. It would note that the current detail record is

10/27/10, for 2.50 units, billed for 52.5 (2.5 * 21)

HFM will check the second record. It should compare the service information of this record to the information in
memory. It will check if the service date of this record is one day later than the record in memory. It is, so the current
service information is

10/27/10-10/28/10, for 5 units (2.50 + 2.50), billed for 105 (52.5 + 52.5)

HFM will check the third record. It should compare the service information of this record to the information in
memory. It will check if the service date of this record is one day later than the record in memory. It is NOT, so the
current service information should be written to the database. Here we would create a new claim detail record. We will
also update CMS_SERVICE_CLAIM_LINK:

Update CMS_SERVICE_CLAIM_LINK SET CLAIM_DETAIL_UUID = '<CLAIM_DETAIL_UUID>'


WHERE CLAIM_UUID = '<CLAIM_UUID>' and SERVICE_DELIVERY_DAILY_DETAIL_UUID IN
('9FBCEEA8-56A9-4DB6-B993-486E2D5E1ECF', 'A9518A9F-22BE-432B-8690-83F5DE5C7AE3')

HFM will clear the service information in memory and start a new detail record based on the information in the
third record:

11/1/10, for 2 units, billed for 42 (2 *21)

HFM will check the fourth record. It should compare the service information of this record to the information in
memory. It will check if the service date of this record is one day later than the record in memory. It is, so the current
service information is

11/1/10-11/2/10, for 6 units (2 + 4), billed for 126 (42 + 84).

HFM will check the fifth record. It should compare the service information of this record to the information in
memory. It will check if the service date of this record is one day later than the record in memory. It is, so the current
service information is
11/1/10 -11/3/10, for 8.5 units (2 + 4 + 2.5), billed for 178.5 (42 + 84 + 52.5)

This is the final record in the recordset, so we create the final claim detail record. We will also update
CMS_SERVICE_CLAIM_LINK:

Update CMS_SERVICE_CLAIM_LINK SET CLAIM_DETAIL_UUID = '<CLAIM_DETAIL_UUID>'


WHERE CLAIM_UUID = '<CLAIM_UUID>' and SERVICE_DELIVERY_DAILY_DETAIL_UUID IN
('6D563261-B97C-4A96-82A7-65838C5DD359', 'BCB01961-7AFD-45F5-9B7A-6B43E5290DA0',
'145224E0-A332-4C66-80C5-100A33C6735E')