Skip to content

feat(jubilee): add benefit creation, selection, and service verification#1183

Merged
av-dev2 merged 1 commit intoAakvatech-Limited:nurse-ot-modulefrom
av-dev2:feat_nurse_ot_module
Apr 23, 2026
Merged

feat(jubilee): add benefit creation, selection, and service verification#1183
av-dev2 merged 1 commit intoAakvatech-Limited:nurse-ot-modulefrom
av-dev2:feat_nurse_ot_module

Conversation

@av-dev2
Copy link
Copy Markdown
Collaborator

@av-dev2 av-dev2 commented Apr 23, 2026

Implement the end-to-end Jubilee VerifyItems workflow: auto-create Jubilee Benefit records on authorization, allow practitioners to select a benefit via dialog, and send the selected BenefitCode to the Jubilee VerifyItems API.

Changes in api.py:

create_jubilee_benefits():

  • New function called after successful AuthorizeCard response
  • Parses the Benefits array from the authorization response and bulk-inserts Jubilee Benefit records (benefit_code, benefit_name, benefit_balance, card_no, patient, appointment, authorization_no, company, posting_date, posting_time)
  • Does NOT delete existing records on re-authorization, preserving history across different authorization numbers and appointments

get_authorization_number():

  • Hook create_jubilee_benefits() after successful authorization, passing card_no, response data, appointment, company, and patient

verify_jubilee_services():

  • New @frappe.whitelist() function that collects eligible items from Patient Encounter child tables (lab tests, radiology, procedures, medications, therapies), resolves each item's Jubilee ref_code via get_item_refcode(), and POSTs to /jubileeapi/VerifyItems
  • Accepts benefit_code parameter from the practitioner's selection instead of hardcoding Outpatient/Inpatient
  • Validates benefit_code is provided before proceeding
  • Sends payload as form-data with VerifyItems as JSON-stringified nested array and Amount as string
  • On success, sets preapproval_status on each verified child row to the API response Status value (e.g. OK)
  • Adds a comment on the source document summarizing verification result (description + count of verified items)
  • Logs request/response via add_jubilee_log for audit trail

get_services():

  • New helper that iterates child tables using get_childs_map(), skips cancelled/prescribed/restricted/already-approved rows, and builds the VerifyItems JSON array plus a service_map of (child_doctype, child_name, item_name) -> ref_code for post-response updates

Import additions:

  • nowdate, nowtime from frappe.utils
  • get_childs_map, get_item_rate, get_item_refcode from healthcare_service_request

Implement the end-to-end Jubilee VerifyItems workflow: auto-create
Jubilee Benefit records on authorization, allow practitioners to select
a benefit via dialog, and send the selected BenefitCode to the Jubilee
VerifyItems API.

Changes in api.py:

create_jubilee_benefits():
- New function called after successful AuthorizeCard response
- Parses the Benefits array from the authorization response and
  bulk-inserts Jubilee Benefit records (benefit_code, benefit_name,
  benefit_balance, card_no, patient, appointment, authorization_no,
  company, posting_date, posting_time)
- Does NOT delete existing records on re-authorization, preserving
  history across different authorization numbers and appointments

get_authorization_number():
- Hook create_jubilee_benefits() after successful authorization,
  passing card_no, response data, appointment, company, and patient

verify_jubilee_services():
- New @frappe.whitelist() function that collects eligible items from
  Patient Encounter child tables (lab tests, radiology, procedures,
  medications, therapies), resolves each item's Jubilee ref_code via
  get_item_refcode(), and POSTs to /jubileeapi/VerifyItems
- Accepts benefit_code parameter from the practitioner's selection
  instead of hardcoding Outpatient/Inpatient
- Validates benefit_code is provided before proceeding
- Sends payload as form-data with VerifyItems as JSON-stringified
  nested array and Amount as string
- On success, sets preapproval_status on each verified child row
  to the API response Status value (e.g. OK)
- Adds a comment on the source document summarizing verification
  result (description + count of verified items)
- Logs request/response via add_jubilee_log for audit trail

get_services():
- New helper that iterates child tables using get_childs_map(),
  skips cancelled/prescribed/restricted/already-approved rows,
  and builds the VerifyItems JSON array plus a service_map of
  (child_doctype, child_name, item_name) -> ref_code for
  post-response updates

Import additions:
- nowdate, nowtime from frappe.utils
- get_childs_map, get_item_rate, get_item_refcode from
  healthcare_service_request
@av-dev2 av-dev2 merged commit 51abc0c into Aakvatech-Limited:nurse-ot-module Apr 23, 2026
1 check failed
@codacy-production
Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant