feat(jubilee): add benefit creation, selection, and service verification#1183
Merged
av-dev2 merged 1 commit intoAakvatech-Limited:nurse-ot-modulefrom Apr 23, 2026
Merged
Conversation
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
Not up to standards ⛔
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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():
get_authorization_number():
verify_jubilee_services():
get_services():
Import additions: