Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(wip): ABDM Integration #94

Closed
wants to merge 73 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
a6ed2fe
feat: Medications, Allergy and Drug Interactions
ruchamahabal Apr 16, 2021
a4a882a
fix: medication or item_code in prescription, clean up medication
akurungadam Apr 8, 2021
6378d53
feat: (WIP) Healthcare Service Order and related doctypes, related li…
akurungadam Mar 14, 2021
1537683
feat(wip): create service order on encounter submit
Oct 21, 2020
b6f58d2
feat: get items to invoice via HSO
Oct 21, 2020
5f1d0ca
fix: filter Healthcare Service Order doctypes
ruchamahabal Apr 16, 2021
e20660c
refactor: make service order from encounter
ruchamahabal Apr 19, 2021
6ea5b4a
chore: Remove unnecessary masters and extra fields from Medication do…
ruchamahabal Apr 20, 2021
64b8c60
chore: Clean-up Medication Form
ruchamahabal Apr 21, 2021
e62768d
refactor: Healthcare Service Order DocType
ruchamahabal Apr 27, 2021
d060377
feat: setup defaults for all HSO masters
ruchamahabal Apr 27, 2021
1e09a91
feat: Handle HSO status
ruchamahabal Apr 28, 2021
cb752bb
feat: Utility buttons to create service transactions from HSO
ruchamahabal Apr 29, 2021
0e0a998
fix: HSO Invoicing
ruchamahabal Apr 29, 2021
f41cb53
refactor: HSO creation from encounter
ruchamahabal Apr 29, 2021
da3371f
feat: add Occurrence Date and Time
ruchamahabal Apr 29, 2021
373b27a
chore: Remove Healthcare Service Order Category and Reason (redundant…
ruchamahabal Apr 30, 2021
ddb894d
fix(invoicing): filter service transactions with linked HSO
ruchamahabal May 1, 2021
9a221da
fix: semgrep and sider fixes
ruchamahabal May 1, 2021
4f5ca31
feat: Healthcare Insurance - Doctypes
Nov 24, 2020
5567b17
fix(Insurance): Set Insurance fields in service doctypes Co-authored-…
Nov 24, 2020
258f304
fix(Insurance): Set Insurance claim field in service doctypes Co-auth…
Nov 24, 2020
23d67dc
fix(Insurance): Fetch claim status if empty in service doctypes Co-au…
ruchamahabal May 2, 2021
614e526
feat: create insurance claim on service submissions Co-authored-by: m…
ruchamahabal May 2, 2021
b1341aa
feat: add custom fields for Insurance to Sales Invoice Co-authored-by…
ruchamahabal May 2, 2021
1eed5ce
feat: Healthcare Service billing based on insurance Co-authored-by: m…
ruchamahabal May 2, 2021
c8cb773
fix:Healthcare Insurance - set sales invoice item lines
Nov 9, 2020
6c99fdd
Healthcare Insurance - create service coverage from claim
Nov 24, 2020
a9e2251
Healthcare Insurance - claim created based service, item, item_group …
Nov 26, 2020
e27b631
fix: Patient encounter - set insurance claim field allow on submit
Jan 19, 2021
6f0c75b
fix:Healthcare Insurance - cosmetics changes
Jan 19, 2021
be32c9a
fix: Remove links to missing doctypes
ruchamahabal May 2, 2021
880df8d
refactor: Insurance Company, Contract and Coverage Plan
ruchamahabal May 2, 2021
5807f14
chore: clean-up Service Coverage
ruchamahabal May 3, 2021
5550d86
chore: clean-up Insurance Subscription
ruchamahabal May 3, 2021
110da91
fix: Miscellaneous fixes
ruchamahabal May 5, 2021
f2e9a6d
refactor: Healthcare Insurance Claim
ruchamahabal May 9, 2021
f0fa09d
refactor: commonify insurance claim creation from services
ruchamahabal May 9, 2021
69aa3f1
refactor: Insurance Billing
ruchamahabal May 9, 2021
b5d6e01
refactor: Healthcare Insurance Payment Request
ruchamahabal May 13, 2021
f19cc50
fix: sider and linter issues
ruchamahabal May 13, 2021
749c4fd
fix: insurance masters - insurance company - remove naming series, re…
akurungadam May 23, 2021
0e20f65
Squashed commit of the following:
akurungadam Jul 9, 2021
f0f3e93
fix: invoice based on claim qty, cancel invoice hso bill based on qty…
akurungadam Jul 18, 2021
0cfe2a5
fix(wip): insurance payment request
akurungadam Jul 29, 2021
87acb15
fix: Inpatient Record - Insurance
akashkrishna619 Jul 23, 2021
de40f96
refactor: erpnext domain reference left in healthcare
akashkrishna619 Nov 1, 2021
6244327
fix: Clinical Procedure & Lab Test - shift get_from prescription to HSO
akashkrishna619 Nov 1, 2021
bdae9a3
fix: Insurance Payment Request - fetch account from mode_of_payment
akashkrishna619 Nov 12, 2021
01b851d
refactor: Clinical Procedure, Lab Test - convert queries to query bui…
akashkrishna619 Dec 9, 2021
2f8824a
test: Healthcare Insurance Contract
akashkrishna619 Dec 9, 2021
54ef600
test: Healthcare Insurance Subscription
akashkrishna619 Dec 9, 2021
ffac67c
rename insurance doctypes, fields, variable names
akurungadam Dec 9, 2021
c013c80
fix: service order list status indicator
akurungadam Dec 12, 2021
e4cce6d
fix: insurance claim payment entry
akurungadam Dec 12, 2021
d56717a
fix: Healthcare Settings - naming series for insurance coverage journ…
akashkrishna619 Dec 15, 2021
452727b
fix: inconsistent identifiers and field names after renaming docs cor…
akurungadam Dec 23, 2021
f17dbf5
rename doctypes
akurungadam Dec 23, 2021
86c8091
fix: set cost center while creating the balance adjustment journal entry
akurungadam Dec 24, 2021
1b8aec4
test: Patient Insurance Coverage, fix Insurance Payor Contract,
akashkrishna619 Dec 24, 2021
51724c1
fix: patient payable amount calculation
akurungadam Dec 27, 2021
f06cfba
fix: Service Request - set Insurance Policy and create Insurance Cove…
akashkrishna619 Dec 27, 2021
82a56e9
test: Insurance Claim
akashkrishna619 Dec 28, 2021
5737503
fix: validate insurance payor contract exists for transacting company
akurungadam Dec 28, 2021
1bfd99f
Merge remote-tracking branch 'upstream/develop' into hsr-insurance
akurungadam Dec 28, 2021
eef0112
fix: set insurance claim update_status button as primary action
akurungadam Jan 25, 2022
f6beae0
Merge remote-tracking branch 'upstream/develop' into hsr-insurance-wip
akashkrishna619 Mar 23, 2022
1cfaeca
feat: ABDM - Milestone 1
akashkrishna619 Mar 15, 2022
4c73660
fix: ABDM - Milestone 1 - ABHA creation using mobile
Sajinsr Mar 16, 2022
337fd06
fix: ABDM - Milestone 1 - code cleanup and sandbox_config update
Sajinsr Mar 18, 2022
6afc7bc
fix: ABDM - Milestone 1 - QR code scanning in ABHA address verification
akashkrishna619 Mar 18, 2022
68d3a19
feat: ABDM - Milestone 1 - Health ID verification with Authentication
akashkrishna619 Mar 21, 2022
c3da47f
feat: ABDM - Milestone 1 - code cleanup with verification response sh…
akashkrishna619 Mar 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(wip): insurance payment request
  • Loading branch information
akurungadam authored and akashkrishna619 committed Oct 21, 2021
commit 0cfe2a5eb93ecb9acbd0cc7c8e76ca015fc15e4c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
frappe.listview_settings['Healthcare Insurance Payment Request'] = {
add_fields: ['status'],
get_indicator: function(doc) {
return [__(doc.status), {
'Draft': 'red',
'Submitted': 'blue',
'Verified': 'lightblue',
'Completed': 'green',
'Cancelled': 'darkgrey'
}[doc.status], 'status,=,' + doc.status];
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
"qty",
"column_break_22",
"item_code",
"medical_code",
"medical_code_standard",
"medical_code",
"medical_code_description",
"coverage_details_section",
"mode_of_approval",
"claim_validity_end_date",
Expand All @@ -46,10 +47,15 @@
"amount",
"claim_amount",
"patient_payable",
"insurance_claim_billing_summary_section",
"billing_summary_section",
"qty_invoiced",
"column_break_31",
"claim_amount_invoiced"
"claim_amount_invoiced",
"insurance_payment_section",
"payment_approved_amount",
"payment_request_comments",
"column_break_48",
"paid_amount"
],
"fields": [
{
Expand Down Expand Up @@ -140,15 +146,15 @@
"bold": 1,
"fieldname": "discount",
"fieldtype": "Percent",
"label": "Discount",
"label": "Discount %",
"no_copy": 1,
"read_only_depends_on": "eval:doc.service_coverage || doc.status != 'Draft'"
},
{
"bold": 1,
"fieldname": "coverage",
"fieldtype": "Percent",
"label": "Coverage",
"label": "Coverage %",
"no_copy": 1,
"read_only_depends_on": "eval:doc.service_coverage || doc.status != 'Draft'"
},
Expand All @@ -173,7 +179,7 @@
"in_standard_filter": 1,
"label": "Status",
"no_copy": 1,
"options": "Draft\nApproved\nCancelled\nRejected\nInvoiced\nPartially Invoiced\nSubmitted\nCompleted\nPayment Error\nPayment Rejected",
"options": "Draft\nApproved\nCancelled\nRejected\nInvoiced\nPartially Invoiced\nPayment Requested\nCompleted\nPayment Error\nPayment Rejected",
"read_only": 1,
"reqd": 1
},
Expand Down Expand Up @@ -340,7 +346,7 @@
"fieldname": "claim_amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Coverage Amount",
"label": "Claim Amount",
"no_copy": 1,
"read_only": 1
},
Expand Down Expand Up @@ -369,17 +375,53 @@
"options": "Medical Code Standard",
"read_only": 1
},
{
"fetch_from": "medical_code.description",
"fieldname": "medical_code_description",
"fieldtype": "Small Text",
"label": "Medical Code Description"
},
{
"default": "0",
"fieldname": "payment_approved_amount",
"fieldtype": "Currency",
"label": "Payment Approved Amount",
"read_only": 1
},
{
"default": "0",
"fieldname": "paid_amount",
"fieldtype": "Currency",
"label": "Paid Amount",
"read_only": 1
},
{
"depends_on": "eval:doc.status != 'Rejected'",
"fieldname": "billing_summary_section",
"fieldtype": "Section Break",
"label": "Billing Summary"
},
{
"fieldname": "column_break_48",
"fieldtype": "Column Break"
},
{
"depends_on": "eval:doc.status != 'Rejected'",
"fieldname": "insurance_claim_billing_summary_section",
"fieldname": "insurance_payment_section",
"fieldtype": "Section Break",
"label": "Insurance Billing Summary"
"label": "Insurance Payment"
},
{
"fieldname": "payment_request_comments",
"fieldtype": "Small Text",
"label": "Payment Request Comments",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2021-07-18 17:02:32.151849",
"modified": "2021-08-03 18:26:07.207203",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Healthcare Insurance Claim",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,30 +68,11 @@ def on_submit(self):

self.flags.silent = False

# def on_update_after_submit(self):
# qty_invoiced = sum(detail.get('invoice_qty', 0) for detail in self.insurance_claim_details)
# claim_amount_invoiced = sum(detail.get('invoice_amount', 0) for detail in self.insurance_claim_details)

# if qty_invoiced == 0:
# status = 'Approved'
# if qty_invoiced < self.qty:
# status = 'Partially Invoiced'
# else:
# status = 'Invoiced'

# self.db_set({
# 'qty_invoiced': qty_invoiced,
# 'claim_amount_invoiced': claim_amount_invoiced,
# 'status': status
# })

def update_invoice_details(self, qty, amount):
def update_invoice_details(self, qty=0, amount=0):
'''
updates qty_invoiced, claim_amount_invoiced and sets status
NOTE: on invoice cancel, qty and amount ca be negative
'''

print(self.template_dt, qty)
qty_invoiced = self.qty_invoiced + qty
claim_amount_invoiced = self.claim_amount_invoiced + amount

Expand Down Expand Up @@ -230,7 +211,7 @@ def make_insurance_claim(patient, policy, company, template_dt=None, template_dn
'''
Inserts a new Insurance Claim for the service
If claim status is Approved, Submits the claim
Returns claim name and status if Insurance Claim inserted
Returns dict with claim name and status if Insurance Claim inserted
'''
if not (template_dt and template_dn) and not item_code:
return None
Expand Down Expand Up @@ -300,6 +281,6 @@ def create_insurance_coverage(doc):
coverage.coverage = doc.coverage
coverage.discount = doc.discount
coverage.start_date = doc.posting_date or getdate()
# coverage.end_date = doc.approval_validity_end_date # leave blank as this is dependent on policy end date
# coverage.end_date = doc.approval_validity_end_date # leave blank as claim.approval_validity_end_date is dependent on policy end date

return coverage
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ frappe.listview_settings['Healthcare Insurance Claim'] = {
return [__(doc.status), {
'Draft': 'red',
'Approved': 'blue',
'Invoiced': 'orange',
'Partially Invoiced': 'orange',
'Paid': 'green',
'Partially Paid': 'orange',
'Resubmitted': 'blue',
'Rejected': 'grey',
'Payment Rejected': 'grey'
'Cancelled': 'grey',
'Rejected': 'darkgrey',
'Invoiced': 'lightblue',
'Partially Invoiced': 'lightblue',
'Payment Requested': 'blue',
'Payment Approved': 'green',
'Completed': 'green',
'Payment Error': 'red',
'Payment Rejected': 'darkgrey'
}[doc.status], 'status,=,' + doc.status];
}
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"customer",
"column_break_3",
"disabled",
"medical_code_standard",
"image",
"address_and_contacts_section",
"address_html",
Expand Down Expand Up @@ -110,6 +111,13 @@
{
"fieldname": "column_break_3",
"fieldtype": "Column Break"
},
{
"description": "Default Medical Code Standard for use while Insurance Claim Submission",
"fieldname": "medical_code_standard",
"fieldtype": "Link",
"label": "Medical Code Standard",
"options": "Medical Code Standard"
}
],
"image_field": "image",
Expand All @@ -127,7 +135,7 @@
"link_fieldname": "insurance_company"
}
],
"modified": "2021-07-11 10:22:14.710654",
"modified": "2021-08-03 19:46:21.382244",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Healthcare Insurance Company",
Expand Down Expand Up @@ -171,7 +179,7 @@
}
],
"restrict_to_domain": "Healthcare",
"search_fields": "insurance_company_name,customer",
"search_fields": "insurance_company_name",
"sort_field": "modified",
"sort_order": "ASC",
"title_field": "insurance_company_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

class HealthcareInsuranceContract(Document):
def validate(self):
if self.start_date >= self.end_date:
frappe.throw(_('Start Date should be before End Date'))

if self.is_active:
contract = frappe.db.exists('Healthcare Insurance Contract', {
'insurance_company': self.insurance_company,
Expand All @@ -20,19 +23,5 @@ def validate(self):
})

if contract:
frappe.throw(_('An active contract with this insurance company already exists: {0}').format(
frappe.throw(_('An active contract for this insurance company already exists: {0}').format(
get_link_to_form('Healthcare Insurance Contract', contract)), title=_('Duplicate Contract'))

#TODO: remove ?
def validate_insurance_contract(insurance_company, company=None, on_date=None):
contract = frappe.db.exists('Healthcare Insurance Contract', {
'insurance_company': insurance_company,
'company': company,
'is_active': 1,
'docstatus': 1,
'start_date': ('<=', on_date or getdate()),
'end_date':('>=', on_date or getdate())
})

if not contract:
frappe.throw(_('No active contracts found for Insurance Company {0} as on {1}').format(insurance_company, on_date))
Loading