Browse Source
* feat: Added doctypes for treatment plan template * feat: Added child doctype * feat: Added validations for patient age * chore: Clean up treatment plan template * fix: Limit plan items to templates * Added multiselectdialogbox for treatment plan template * Add template name as autoname * Clean up code * Cleanup lint issues * Clean up code * Added tests for tpt filters * Added test records * Fix order of fields * Added tests for care plan template * Added age property for patient * Clean up code * Clean up list view * Clean up code * Fix lint issues * Clean up test records * Code cleanup no-docs * chore: Code cleanup * chore: Use ORM instead of raw sql * fix: Make treatment plan item fields mandatory * fix: Added healthcare roles in permissions rules * fix: Added filters for symptoms, diagnosis * fix: Show applicable treatment plans button only if patient is present * fix: Fix key error issues * fix: Fix issues with filters in plan templates * chore: Fix age filters * refactor: appending treatment plan items * fix: treatment plan test Co-authored-by: Jannat Patel <31363128+pateljannat@users.noreply.github.com> Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>develop
Chillar Anand
3 years ago
committed by
GitHub
19 changed files with 567 additions and 10 deletions
@ -0,0 +1,7 @@ |
|||
[ |
|||
{ |
|||
"doctype": "Treatment Plan Template", |
|||
"template_name": "Chemo", |
|||
"patient_age_from": 21 |
|||
} |
|||
] |
@ -0,0 +1,8 @@ |
|||
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors |
|||
# See license.txt |
|||
|
|||
# import frappe |
|||
import unittest |
|||
|
|||
class TestTreatmentPlanTemplate(unittest.TestCase): |
|||
pass |
@ -0,0 +1,14 @@ |
|||
// Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
|
|||
// For license information, please see license.txt
|
|||
|
|||
frappe.ui.form.on('Treatment Plan Template', { |
|||
refresh: function (frm) { |
|||
frm.set_query('type', 'items', function () { |
|||
return { |
|||
filters: { |
|||
'name': ['in', ['Lab Test Template', 'Clinical Procedure Template', 'Therapy Type']], |
|||
} |
|||
}; |
|||
}); |
|||
}, |
|||
}); |
@ -0,0 +1,189 @@ |
|||
{ |
|||
"actions": [], |
|||
"autoname": "field:template_name", |
|||
"creation": "2021-06-10 10:14:17.901273", |
|||
"doctype": "DocType", |
|||
"editable_grid": 1, |
|||
"engine": "InnoDB", |
|||
"field_order": [ |
|||
"section_break_1", |
|||
"template_name", |
|||
"description", |
|||
"practitioners", |
|||
"disabled", |
|||
"column_break_1", |
|||
"medical_department", |
|||
"goal", |
|||
"order_group", |
|||
"section_break_8", |
|||
"patient_age_from", |
|||
"complaints", |
|||
"gender", |
|||
"column_break_12", |
|||
"patient_age_to", |
|||
"diagnosis", |
|||
"plan_items_section", |
|||
"items", |
|||
"drugs" |
|||
], |
|||
"fields": [ |
|||
{ |
|||
"fieldname": "section_break_1", |
|||
"fieldtype": "Section Break", |
|||
"label": "Plan Details" |
|||
}, |
|||
{ |
|||
"fieldname": "medical_department", |
|||
"fieldtype": "Link", |
|||
"in_list_view": 1, |
|||
"label": "Medical Department", |
|||
"options": "Medical Department" |
|||
}, |
|||
{ |
|||
"fieldname": "description", |
|||
"fieldtype": "Small Text", |
|||
"label": "Description" |
|||
}, |
|||
{ |
|||
"fieldname": "goal", |
|||
"fieldtype": "Small Text", |
|||
"label": "Goal" |
|||
}, |
|||
{ |
|||
"fieldname": "practitioners", |
|||
"fieldtype": "Table MultiSelect", |
|||
"label": "Practitioners", |
|||
"options": "Treatment Plan Template Practitioner" |
|||
}, |
|||
{ |
|||
"fieldname": "order_group", |
|||
"fieldtype": "Link", |
|||
"label": "Order Group", |
|||
"options": "Patient Encounter", |
|||
"read_only": 1 |
|||
}, |
|||
{ |
|||
"fieldname": "section_break_8", |
|||
"fieldtype": "Section Break", |
|||
"label": "Plan Conditions" |
|||
}, |
|||
{ |
|||
"fieldname": "template_name", |
|||
"fieldtype": "Data", |
|||
"in_list_view": 1, |
|||
"label": "Template Name", |
|||
"reqd": 1, |
|||
"unique": 1 |
|||
}, |
|||
{ |
|||
"fieldname": "patient_age_from", |
|||
"fieldtype": "Int", |
|||
"label": "Patient Age From", |
|||
"non_negative": 1 |
|||
}, |
|||
{ |
|||
"fieldname": "column_break_12", |
|||
"fieldtype": "Column Break" |
|||
}, |
|||
{ |
|||
"fieldname": "patient_age_to", |
|||
"fieldtype": "Int", |
|||
"label": "Patient Age To", |
|||
"non_negative": 1 |
|||
}, |
|||
{ |
|||
"fieldname": "gender", |
|||
"fieldtype": "Link", |
|||
"label": "Gender", |
|||
"options": "Gender" |
|||
}, |
|||
{ |
|||
"fieldname": "complaints", |
|||
"fieldtype": "Table MultiSelect", |
|||
"label": "Complaints", |
|||
"options": "Patient Encounter Symptom" |
|||
}, |
|||
{ |
|||
"fieldname": "diagnosis", |
|||
"fieldtype": "Table MultiSelect", |
|||
"label": "Diagnosis", |
|||
"options": "Patient Encounter Diagnosis" |
|||
}, |
|||
{ |
|||
"fieldname": "plan_items_section", |
|||
"fieldtype": "Section Break", |
|||
"label": "Plan Items" |
|||
}, |
|||
{ |
|||
"fieldname": "items", |
|||
"fieldtype": "Table", |
|||
"label": "Items", |
|||
"options": "Treatment Plan Template Item" |
|||
}, |
|||
{ |
|||
"fieldname": "drugs", |
|||
"fieldtype": "Table", |
|||
"label": "Drugs", |
|||
"options": "Drug Prescription" |
|||
}, |
|||
{ |
|||
"default": "0", |
|||
"fieldname": "disabled", |
|||
"fieldtype": "Check", |
|||
"label": "Disabled" |
|||
}, |
|||
{ |
|||
"fieldname": "column_break_1", |
|||
"fieldtype": "Column Break" |
|||
} |
|||
], |
|||
"index_web_pages_for_search": 1, |
|||
"links": [], |
|||
"modified": "2021-08-18 02:41:58.354296", |
|||
"modified_by": "Administrator", |
|||
"module": "Healthcare", |
|||
"name": "Treatment Plan Template", |
|||
"owner": "Administrator", |
|||
"permissions": [ |
|||
{ |
|||
"create": 1, |
|||
"delete": 1, |
|||
"email": 1, |
|||
"export": 1, |
|||
"print": 1, |
|||
"read": 1, |
|||
"report": 1, |
|||
"role": "System Manager", |
|||
"share": 1, |
|||
"write": 1 |
|||
}, |
|||
{ |
|||
"create": 1, |
|||
"delete": 1, |
|||
"email": 1, |
|||
"export": 1, |
|||
"print": 1, |
|||
"read": 1, |
|||
"report": 1, |
|||
"role": "Physician", |
|||
"share": 1, |
|||
"write": 1 |
|||
}, |
|||
{ |
|||
"create": 1, |
|||
"delete": 1, |
|||
"email": 1, |
|||
"export": 1, |
|||
"print": 1, |
|||
"read": 1, |
|||
"report": 1, |
|||
"role": "Healthcare Administrator", |
|||
"share": 1, |
|||
"write": 1 |
|||
} |
|||
], |
|||
"sort_field": "modified", |
|||
"sort_order": "DESC", |
|||
"title_field": "template_name", |
|||
"track_changes": 1 |
|||
} |
@ -0,0 +1,19 @@ |
|||
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors |
|||
# For license information, please see license.txt |
|||
|
|||
import frappe |
|||
from frappe import _ |
|||
from frappe.model.document import Document |
|||
|
|||
class TreatmentPlanTemplate(Document): |
|||
def validate(self): |
|||
self.validate_age() |
|||
|
|||
def validate_age(self): |
|||
if self.patient_age_from and self.patient_age_from < 0: |
|||
frappe.throw(_('Patient Age From cannot be less than 0')) |
|||
if self.patient_age_to and self.patient_age_to < 0: |
|||
frappe.throw(_('Patient Age To cannot be less than 0')) |
|||
if self.patient_age_to and self.patient_age_from and \ |
|||
self.patient_age_to < self.patient_age_from: |
|||
frappe.throw(_('Patient Age To cannot be less than Patient Age From')) |
@ -0,0 +1,10 @@ |
|||
frappe.listview_settings['Treatment Plan Template'] = { |
|||
get_indicator: function(doc) { |
|||
var colors = { |
|||
1: 'gray', |
|||
0: 'blue', |
|||
}; |
|||
let label = doc.disabled == 1 ? 'Disabled' : 'Enabled'; |
|||
return [__(label), colors[doc.disabled], 'disable,=,' + doc.disabled]; |
|||
} |
|||
}; |
@ -0,0 +1,55 @@ |
|||
{ |
|||
"actions": [], |
|||
"creation": "2021-06-10 11:47:29.194795", |
|||
"doctype": "DocType", |
|||
"editable_grid": 1, |
|||
"engine": "InnoDB", |
|||
"field_order": [ |
|||
"type", |
|||
"template", |
|||
"qty", |
|||
"instructions" |
|||
], |
|||
"fields": [ |
|||
{ |
|||
"fieldname": "type", |
|||
"fieldtype": "Link", |
|||
"in_list_view": 1, |
|||
"label": "Type", |
|||
"options": "DocType", |
|||
"reqd": 1 |
|||
}, |
|||
{ |
|||
"fieldname": "template", |
|||
"fieldtype": "Dynamic Link", |
|||
"in_list_view": 1, |
|||
"label": "Template", |
|||
"options": "type", |
|||
"reqd": 1 |
|||
}, |
|||
{ |
|||
"default": "1", |
|||
"fieldname": "qty", |
|||
"fieldtype": "Int", |
|||
"label": "Qty" |
|||
}, |
|||
{ |
|||
"fieldname": "instructions", |
|||
"fieldtype": "Small Text", |
|||
"in_list_view": 1, |
|||
"label": "Instructions" |
|||
} |
|||
], |
|||
"index_web_pages_for_search": 1, |
|||
"istable": 1, |
|||
"links": [], |
|||
"modified": "2021-08-17 11:19:03.515441", |
|||
"modified_by": "Administrator", |
|||
"module": "Healthcare", |
|||
"name": "Treatment Plan Template Item", |
|||
"owner": "Administrator", |
|||
"permissions": [], |
|||
"sort_field": "modified", |
|||
"sort_order": "DESC", |
|||
"track_changes": 1 |
|||
} |
@ -0,0 +1,8 @@ |
|||
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors |
|||
# For license information, please see license.txt |
|||
|
|||
# import frappe |
|||
from frappe.model.document import Document |
|||
|
|||
class TreatmentPlanTemplateItem(Document): |
|||
pass |
@ -0,0 +1,32 @@ |
|||
{ |
|||
"actions": [], |
|||
"creation": "2021-06-10 10:37:56.669416", |
|||
"doctype": "DocType", |
|||
"editable_grid": 1, |
|||
"engine": "InnoDB", |
|||
"field_order": [ |
|||
"practitioner" |
|||
], |
|||
"fields": [ |
|||
{ |
|||
"fieldname": "practitioner", |
|||
"fieldtype": "Link", |
|||
"in_list_view": 1, |
|||
"label": "Practitioner", |
|||
"options": "Healthcare Practitioner", |
|||
"reqd": 1 |
|||
} |
|||
], |
|||
"index_web_pages_for_search": 1, |
|||
"istable": 1, |
|||
"links": [], |
|||
"modified": "2021-06-11 16:05:06.733299", |
|||
"modified_by": "Administrator", |
|||
"module": "Healthcare", |
|||
"name": "Treatment Plan Template Practitioner", |
|||
"owner": "Administrator", |
|||
"permissions": [], |
|||
"sort_field": "modified", |
|||
"sort_order": "DESC", |
|||
"track_changes": 1 |
|||
} |
@ -0,0 +1,8 @@ |
|||
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors |
|||
# For license information, please see license.txt |
|||
|
|||
# import frappe |
|||
from frappe.model.document import Document |
|||
|
|||
class TreatmentPlanTemplatePractitioner(Document): |
|||
pass |
Loading…
Reference in new issue