Payment plan calculation rule: Fee-for-service

github

version = 1
status = active
UUID = 0a1b6d54-eef4-4ee6-ac47-2a99cfa5e9a8
calculation_rule_name = “payment: fee for service “

type = account_payable

sub_type = third_party_payment

dateValidTo = None

dateValidFrom = 2000-01-01

list of impacted parameters: NULL (will take data from product, claims … )

 

FROM_TO = [ {"from": "QuerySet(Claim)", "to": "Bill"}, {"from": "Claim", "to": "BillItem"} ]

the claims part of the Queryset must have the same RUNID and HF

description = “ This calculation will, for the selected level and product, calculate how much the insurance need to pay the HF for the fee for service health financing “

Service

activeForObject(self, instance, context, type, sub_type)
instance.__class__ == PaymentPan and context IN (submit) and self.checkCalculation(instance)

 

check_calculation

return true (to be updated once real payment plan will be in place)

BatchRUn → Location

if HF → locations

if location → ProductS (Product also related to Region if the location is a district)

if claim → claim product (MAX Product id from item and services)

if product → paymentPlans

if paymentPlan → check if UUID = this.UUID

calculate(cls, instance, *args[date_from, date_to, productid, location])
instance.__class__ == PaymentPlan

get all “processed“ claims that should be evaluated with fee for service that matches args (should replace the batch run)

if instance.__class__ == Claim

fee-for-service evaluation

 

billCreationFromCalculation(date_from, date_to, type, sub_type, product_id, location)

Registration on signals from other module(existing or not):

  • billCreationFromCalculation

Batchrun will trigger billCreationFromCalculation and will send: when the payment plan would be deliver the batch run page could be replaced by payment plan (this page could call billCreationFromCalculation service on selected payment plans) page and bill page.

if active_for_object(<fakepaymentplan>, 'submit', type, sub_type):

calculate(cls, <fakepaymentplan>, *args[date_from, date_to, productid, location])

convert(from, to, obj_from, **argv)

to convert a “from” object (obj_from) to a to object

from = ‘HF' + claim queryset

to = 'bill'

obj_from HF

argv, claimlist queryset(claim) / claim

 

Batch run tacken from the first claim

convert_batch(from, to, **agrv)

argv : product/Paymentplan and dateStart, dateEnd, location or HF (optionnal, will take location from Product)

Create queryset to retrieve the claims per HF/Product

convert the queryset

 

Save the bill in database

get_linked_class

See classes defiened in check calculation

 

Converter

[to be updated]

  1. two way of creating the bills are possible for the valuation, in both case there will be one “bill” per HF/Product

    1. (Chosen)One asset (line) per claim, claim details as asset description: claimed amount as unit price, net amount as net price, discount calculated based on net and unit price

    2. one asset (line) per item or service with claim detail as asset description: item/service claimed unit price as unit price, net as valuated price, quantity as quantity, discount calculated based on net and unit price

bill:

field

type

comment

subject_type

json

batch_run

subject_id

json

run_id

 thirdparty_type

str

HF

 thirdparty_id

id/uuid

HFID

 code

 str 

IV-[PRODUCT code]-HFID-YYMM

 date_due

 date 

batch run date +30 days

 date_invoice

 date 

batch run date

 *dateValidFrom

 date 

validFrom: first day of batch run

 *dateValidTo

 date 

validTo: last first day of batch run

 amount_discount

 float 

N/A

 amount_net

 float 

Total without tax

 tax_analysis

 json 

N/A

 amount_total

 float 

total net

 status

 int 

validated

 currency_rcp_code

 str 

default-curency

 currency_code

 str 

default-curency-code

 note

 bigttext 

 

 terms

 bigttext 

  Product: Product Name

billItem

field

type

comment

HistoryBusinessModel fields

 

validFrom: claim date from

validTo:claim date to

line_id

 

claim_id

line_type

 

claim

code

 str 

Claim-code

description

 str 

Main Diag

details

 json 

claim details (Item and service): name, qty, qty approved, price, price_approved,

ledger_account

 int 

N/A

quantity

 float 

1

unit_price

 type 

claim_amount

discount

 float 

claim_amount - claim_amount_payable

 tax_rate

 Calculation uuid 

N/A

tax_analysis

json

1

amount_total

float

net +tax

amount_net

 

qty * unitprice - discount