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: Add imaging reports to lab tests #103

Merged
merged 2 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions healthcare/healthcare/doctype/lab_test/lab_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cur_frm.cscript.custom_refresh = function (doc) {
cur_frm.toggle_display('organisms_section', doc.descriptive_toggle);
cur_frm.toggle_display('sb_descriptive', doc.descriptive_toggle);
cur_frm.toggle_display('sb_normal', doc.normal_toggle);
cur_frm.toggle_display('sb_descriptive_result', doc.imaging_toggle);
};

frappe.ui.form.on('Lab Test', {
Expand Down
22 changes: 21 additions & 1 deletion healthcare/healthcare/doctype/lab_test/lab_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
"sb_normal",
"lab_test_html",
"normal_test_items",
"sb_descriptive_result",
"descriptive_result",
"sb_descriptive",
"descriptive_test_items",
"organisms_section",
Expand All @@ -66,6 +68,7 @@
"sms_sent",
"printed",
"normal_toggle",
"imaging_toggle",
"descriptive_toggle",
"sensitivity_toggle",
"amended_from",
Expand Down Expand Up @@ -555,14 +558,30 @@
"label": "Organism Test Result",
"options": "Organism Test Result",
"print_hide": 1
},
{
"fieldname": "descriptive_result",
"fieldtype": "Text Editor",
"label": "Descriptive Result"
},
{
"fieldname": "sb_descriptive_result",
"fieldtype": "Section Break",
"label": "Descriptive Result"
},
{
"default": "0",
"fieldname": "imaging_toggle",
"fieldtype": "Check"
}
],
"is_submittable": 1,
"links": [],
"modified": "2020-11-30 11:04:17.195848",
"modified": "2022-04-12 07:23:13.890135",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Lab Test",
"naming_rule": "By \"Naming Series\" field",
"owner": "Administrator",
"permissions": [
{
Expand Down Expand Up @@ -604,6 +623,7 @@
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"title_field": "patient",
"track_changes": 1,
"track_seen": 1
Expand Down
15 changes: 14 additions & 1 deletion healthcare/healthcare/doctype/lab_test/lab_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def create_test_from_template(lab_test):
lab_test.worksheet_instructions = template.worksheet_instructions

lab_test = create_sample_collection(lab_test, template, patient, None)
lab_test = load_result_format(lab_test, template, None, None)
load_result_format(lab_test, template, None, None)


@frappe.whitelist()
def update_status(status, name):
Expand Down Expand Up @@ -189,6 +190,14 @@ def create_normals(template, lab_test):
normal.allow_blank = 0
normal.template = template.name


def create_imaging(template, lab_test):
lab_test.imaging_toggle = 1
lab_test.template = template.name
lab_test.lab_test_name = template.lab_test_name
lab_test.descriptive_result = template.descriptive_result


def create_compounds(template, lab_test, is_group):
lab_test.normal_toggle = 1
for normal_test_template in template.normal_test_templates:
Expand Down Expand Up @@ -268,6 +277,7 @@ def create_sample_collection(lab_test, template, patient, invoice):
title=_('Sample Collection'), indicator='green')
return lab_test


def load_result_format(lab_test, template, prescription, invoice):
if template.lab_test_template_type == 'Single':
create_normals(template, lab_test)
Expand All @@ -278,6 +288,9 @@ def load_result_format(lab_test, template, prescription, invoice):
elif template.lab_test_template_type == 'Descriptive':
create_descriptives(template, lab_test)

elif template.lab_test_template_type == 'Imaging':
create_imaging(template, lab_test)

elif template.lab_test_template_type == 'Grouped':
# Iterate for each template in the group and create one result for all.
for lab_test_group in template.lab_test_groups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"lab_test_rate",
"section_break_description",
"lab_test_description",
"section_break_descriptive_result",
"descriptive_result",
"section_break_normal",
"lab_test_uom",
"secondary_uom",
Expand Down Expand Up @@ -108,7 +110,7 @@
"fieldtype": "Select",
"in_standard_filter": 1,
"label": "Result Format",
"options": "\nSingle\nCompound\nDescriptive\nGrouped\nNo Result"
"options": "\nSingle\nCompound\nDescriptive\nGrouped\nImaging\nNo Result"
},
{
"default": "1",
Expand Down Expand Up @@ -212,6 +214,7 @@
"label": "Description "
},
{
"depends_on": "eval:doc.lab_test_template_type == 'Imaging'",
"fieldname": "lab_test_description",
"fieldtype": "Text Editor",
"ignore_xss_filter": 1,
Expand Down Expand Up @@ -316,13 +319,25 @@
{
"fieldname": "column_break_33",
"fieldtype": "Column Break"
},
{
"fieldname": "descriptive_result",
"fieldtype": "Text Editor",
"label": "Descriptive Result"
},
{
"depends_on": "eval:doc.lab_test_template_type == 'Imaging'",
"fieldname": "section_break_descriptive_result",
"fieldtype": "Section Break",
"label": "Descriptive Result"
}
],
"links": [],
"modified": "2020-07-30 14:32:40.449818",
"modified": "2022-04-12 02:58:57.369498",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Lab Test Template",
"naming_rule": "By fieldname",
"owner": "Administrator",
"permissions": [
{
Expand Down Expand Up @@ -351,6 +366,7 @@
"search_fields": "lab_test_code,lab_test_name,lab_test_template_type",
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"title_field": "lab_test_name",
"track_changes": 1
}