serenity-health / roadmap

Public roadmap for development of Serenity's apps reported by our community of users
0 stars 1 forks source link

feature/update bill cancelations #121

Closed chris-dare closed 2 years ago

chris-dare commented 2 years ago

Tell us about your request! Update the bill cancelation feature on Serenity such that authorized practitioners (AP's) can request cancelations which can be approved and finally marked as cancelled upon reversal of payments.

See the Serenity EMR - Bill cancelations flowchart to learn more about the bill cancelation procedure. A screenshot of that flow is listed below. The original copy is available here

Serenity EMR - Bill cancelations

Here's what we should be able to accomplish following this improvement:

In scope

  1. APs can request a bill cancelation
  2. APs can approve a bill cancelation
  3. APs can cancel a cancelation for a debit bill after they have manually determined a successful refund
  4. Cash/debit payments will be cleared for cancelation post approval iff payment has been refunded to the payer(s) and credit payments will be automatically reversed
  5. If stock items like drugs were given to patients as part of the benefits of bill payment, the application should automatically update the inventory to reflect the expected return of those drugs
  6. If a service was to be delivered as a benefit of the bill payment and has not yet been done, then that encounter/service delivery should automatically be canceled as well

Out of scope

  1. APs will be automaticall notified in app when a cancelation event occurs. Cancelation events may include request, approval or cancelation of a bill
  2. APs can reject a cancelation
  3. Automated/digitized processing of chargebacks

Which app does this concern? Provider portal? Corporate portal? Patient app?

What will be benefit of this feature? What's the value of this feature? If you can quantity it, that would be awesome!

Describe the solution you'd like We're going to implement the flow in the description above with the exception its notification feature

Here's what should be updated in the app:

  1. Add a field for mode of payment on the following models: PatientAccount, ClientAccount, ChargeItem
  2. The options for the mode of payment will be CREDIT, or DEBIT
  3. When creating a patient account, the default will be DEBIT and the for ClientAccount, this will be CREDIT
  4. When paying for a charge item, if a client account is used to make the payment, then we will set the charge_item's mode of payment to client_account.payment_mode
  5. Otherwise, we will set the mode of payment to patient_account.payment_mode
  6. Now, if the mode of payment is debit, the we will debit the account balance for both patient and client account
  7. However, if the mode of payment is credit, we will debit the account limit instead and proceed to raise a claim
  8. Now, in ChargeItemCancelation.cancel, if the chargeitem has stock items (i.e. stock items were dispensed for the bill) then we will update the stock and record its adjustment
  9. Finally, in the ChargeItemCancelation.approve, if the chargeitem was paid in credit mode, then we will automatically call ChargeItemCancelation.cancel within the model as well Note: Be sure to check and confirm that ChargeItemCancelation.cancel does not raise bugs. Some of that activity has been spotted in the app

Describe alternatives you've considered N/A

Additional context N/A

chris-dare commented 2 years ago

Hey @TuyizereBapt, you'll need to implement a method on Stock like Stock.pop()

It will help us encapsulate the behaviour of topping up the inventory through ops like cancelations/refunds

So I'm thinking something

def push(self, quantity_to_add: int, actor: User) -> (Stock, InventoryActionHistory)

Then you can call this in ChargeItemCancelation to update inventory on bill cancelation

TuyizereBapt commented 2 years ago
  1. When paying for a charge item, if a client account is used to make the payment, then we will set the charge_item's mode of payment to client_account.payment_mode
  2. Otherwise, we will set the mode of payment to patient_account.payment_mode

Which method on ChargeItem as shown in the snapshot below is used to pay for a ChargeItem? both? ChargeItem.settle_payment() is somehow confusing

image

chris-dare commented 2 years ago

Use settle_payment

Please run a safe delete on settle_payment_with_corporate and take it out if it's not used anywhere. We don't use it anymore

TuyizereBapt commented 2 years ago

Use settle_payment

Please run a safe delete on settle_payment_with_corporate and take it out if it's not used anywhere. We don't use it anymore

So how do I know which type of account is used to pay for the ChargeItem? From the info in screshots below

Is it PaymentInfoPydanticModel.account_id or PaymentInfoPydanticModel.account? Os something else?

Why multiple charge_items by charge_items = process_payment_via_account(...)?

image

image

chris-dare commented 2 years ago

Under settle_payment, The charge item in

charge_item = charge_items[0]

Will have either a patient_account, a payer_account or both.

It there is a charge_item.patient_account, set the mode to patient_account.payment_mode Otherwise, set it to charge_item.payer_account.payment_mode

TuyizereBapt commented 2 years ago

Under settle_payment, The charge item in

charge_item = charge_items[0]

Will have either a patient_account, a payer_account or both.

It there is a charge_item.patient_account, set the mode to patient_account.payment_mode Otherwise, set it to charge_item.payer_account.payment_mode

Okay. Thanks

chris-dare commented 2 years ago

You're welcome. I just updated the comment FYI

TuyizereBapt commented 2 years ago

Use settle_payment

Please run a safe delete on settle_payment_with_corporate and take it out if it's not used anywhere. We don't use it anymore

It looks like settle_payment_with_corporate is used somewhere

image

chris-dare commented 2 years ago

ok. just raise a NotImplementedError in settle_payment_with_corporate with todo to delete Alternatively, you can delete that ..WithdrawalListView. It's useless

TuyizereBapt commented 2 years ago

Let me delete both the View where it's used and the method itself

chris-dare commented 2 years ago

Sure

TuyizereBapt commented 2 years ago

That ChargeItem.stock_item Isn't the reference of the foreignkey wrong? I think it should have been Stock rather ChargeItem

How can I know the stock associated with the ChargeItem?

image

chris-dare commented 2 years ago

That's correct. Change it

chris-dare commented 2 years ago

See medication.models.MedicationDispense.create,

Particularly in 355 that says # create charge item for that dispense and add to the invoice

TuyizereBapt commented 2 years ago

See medication.models.MedicationDispense.create,

Particularly in 355 that says # create charge item for that dispense and add to the invoice

What does this mean?

chris-dare commented 2 years ago

This is where you can can set the stock on the charge item being created

TuyizereBapt commented 2 years ago

That's correct. Change it

Is this not going to break things?

chris-dare commented 2 years ago

Depends. What would you like to do?

TuyizereBapt commented 2 years ago

This is where you can can set the stock on the charge item being created

inventory_item is Stock right?

chris-dare commented 2 years ago

That's correct. Let's have a chat on this. Please come to Gather

chris-dare commented 2 years ago

Concerning revoking a service request, there are 3 things that are necessary:

  1. Setting the status of the service request to revoked. Where this means "the request (and any implicit authorization to act) has been terminated prior to the known full completion of the intended actions. No further activity should occur"
  2. Setting actor of the revoke action: i.e a foreign key to the practioner role and then also the name of the actor who revoked the request
    Please create these fields on the ServiceRequest called: a. canceled_by_practitioner -> FK to the Practitionerrole where the practitionerrole must have the same managing organization as ServiceRequest.healthcareservice.provider.
    i.e If I should only be able to cancel a service request at Hospital A iff I work there. b. canceled_by_user -> FK to authenticationmanager.User c. canceled_by_name -> Text of the fullname of the canceled_by_practitioner if not null else canceled_by_user

We need canceled_by_user because when the patient portal comes online, users may have the ability to cancel diagnostic service request which they are yet to pay for.

  1. Setting the time the cancelation occured
chris-dare commented 2 years ago

Hi @pkdadson, I noticed that samples can be taken for a test when it's revoked. Please update this so the samples are only taken if the status is active. Because that's the only stage where a sample is expected to be collected to continue the process.

image

pkdadson commented 2 years ago
Screenshot 2022-03-28 at 00 52 32

@dexios1 this is fixed

chris-dare commented 2 years ago

Thank you very much