diff --git a/erpnext/healthcare/doctype/antibiotic/antibiotic.json b/erpnext/healthcare/doctype/antibiotic/antibiotic.json index d481036ee6..41a3e318f3 100644 --- a/erpnext/healthcare/doctype/antibiotic/antibiotic.json +++ b/erpnext/healthcare/doctype/antibiotic/antibiotic.json @@ -1,115 +1,151 @@ { - "allow_copy": 1, - "allow_guest_to_view": 0, - "allow_import": 1, - "allow_rename": 1, - "autoname": "field:antibiotic_name", - "beta": 1, - "creation": "2016-02-23 11:11:30.749731", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "Setup", - "editable_grid": 0, + "allow_copy": 1, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:antibiotic_name", + "beta": 1, + "creation": "2016-02-23 11:11:30.749731", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 0, "fields": [ { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "antibiotic_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Antibiotic Name", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "antibiotic_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Antibiotic Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 1 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "abbr", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Abbr", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 1 } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2017-08-31 13:44:43.199657", - "modified_by": "Administrator", - "module": "Healthcare", - "name": "Antibiotic", - "name_case": "", - "owner": "Administrator", + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-10-01 17:58:23.136498", + "modified_by": "Administrator", + "module": "Healthcare", + "name": "Antibiotic", + "name_case": "", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Healthcare Administrator", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Healthcare Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 0, "write": 1 - }, + }, { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Laboratory User", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "amend": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Laboratory User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, "write": 0 } - ], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "restrict_to_domain": "Healthcare", - "search_fields": "antibiotic_name", - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "title_field": "antibiotic_name", - "track_changes": 0, - "track_seen": 0 + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "restrict_to_domain": "Healthcare", + "search_fields": "antibiotic_name", + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "antibiotic_name", + "track_changes": 0, + "track_seen": 0, + "track_views": 0 } \ No newline at end of file diff --git a/erpnext/healthcare/doctype/lab_test_groups/__init__.py b/erpnext/healthcare/doctype/descriptive_test_result/__init__.py similarity index 100% rename from erpnext/healthcare/doctype/lab_test_groups/__init__.py rename to erpnext/healthcare/doctype/descriptive_test_result/__init__.py diff --git a/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.json b/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.json new file mode 100644 index 0000000000..fcd3828aa5 --- /dev/null +++ b/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.json @@ -0,0 +1,74 @@ +{ + "actions": [], + "allow_copy": 1, + "beta": 1, + "creation": "2016-02-22 15:12:36.202380", + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "lab_test_particulars", + "result_value", + "allow_blank", + "template", + "require_result_value" + ], + "fields": [ + { + "fieldname": "lab_test_particulars", + "fieldtype": "Data", + "ignore_xss_filter": 1, + "in_list_view": 1, + "label": "Particulars", + "read_only": 1 + }, + { + "depends_on": "eval:doc.require_result_value == 1", + "fieldname": "result_value", + "fieldtype": "Small Text", + "ignore_xss_filter": 1, + "in_list_view": 1, + "label": "Value" + }, + { + "fieldname": "template", + "fieldtype": "Link", + "hidden": 1, + "label": "Template", + "options": "Lab Test Template", + "print_hide": 1, + "report_hide": 1 + }, + { + "default": "0", + "fieldname": "require_result_value", + "fieldtype": "Check", + "hidden": 1, + "label": "Require Result Value", + "print_hide": 1, + "read_only": 1, + "report_hide": 1 + }, + { + "default": "1", + "fieldname": "allow_blank", + "fieldtype": "Check", + "label": "Allow Blank", + "print_hide": 1, + "read_only": 1, + "report_hide": 1 + } + ], + "istable": 1, + "links": [], + "modified": "2020-07-23 12:33:47.693065", + "modified_by": "Administrator", + "module": "Healthcare", + "name": "Descriptive Test Result", + "owner": "Administrator", + "permissions": [], + "restrict_to_domain": "Healthcare", + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/healthcare/doctype/sensitivity_test_items/sensitivity_test_items.py b/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.py similarity index 84% rename from erpnext/healthcare/doctype/sensitivity_test_items/sensitivity_test_items.py rename to erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.py index 35c8efde79..7ccf6b57aa 100644 --- a/erpnext/healthcare/doctype/sensitivity_test_items/sensitivity_test_items.py +++ b/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.py @@ -5,5 +5,5 @@ from __future__ import unicode_literals from frappe.model.document import Document -class SensitivityTestItems(Document): +class DescriptiveTestResult(Document): pass diff --git a/erpnext/healthcare/doctype/normal_test_items/__init__.py b/erpnext/healthcare/doctype/descriptive_test_template/__init__.py similarity index 100% rename from erpnext/healthcare/doctype/normal_test_items/__init__.py rename to erpnext/healthcare/doctype/descriptive_test_template/__init__.py diff --git a/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.json b/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.json new file mode 100644 index 0000000000..9ee8f4fc68 --- /dev/null +++ b/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.json @@ -0,0 +1,41 @@ +{ + "actions": [], + "allow_copy": 1, + "beta": 1, + "creation": "2016-02-22 16:12:12.394200", + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "particulars", + "allow_blank" + ], + "fields": [ + { + "fieldname": "particulars", + "fieldtype": "Data", + "ignore_xss_filter": 1, + "in_list_view": 1, + "label": "Result Component" + }, + { + "default": "0", + "fieldname": "allow_blank", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Allow Blank" + } + ], + "istable": 1, + "links": [], + "modified": "2020-06-24 14:03:51.728863", + "modified_by": "Administrator", + "module": "Healthcare", + "name": "Descriptive Test Template", + "owner": "Administrator", + "permissions": [], + "restrict_to_domain": "Healthcare", + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.py b/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.py new file mode 100644 index 0000000000..281f32db7f --- /dev/null +++ b/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, ESS and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +from frappe.model.document import Document + +class DescriptiveTestTemplate(Document): + pass diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json index 2f0115c36a..0104386714 100644 --- a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json +++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json @@ -39,8 +39,8 @@ "create_lab_test_on_si_submit", "create_sample_collection_for_lab_test", "column_break_34", - "employee_name_and_designation_in_print", "lab_test_approval_required", + "employee_name_and_designation_in_print", "custom_signature_in_print", "laboratory_sms_alerts", "sms_printed", @@ -306,7 +306,7 @@ ], "issingle": 1, "links": [], - "modified": "2020-03-26 11:25:21.842092", + "modified": "2020-07-08 15:17:21.543218", "modified_by": "Administrator", "module": "Healthcare", "name": "Healthcare Settings", diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.js b/erpnext/healthcare/doctype/lab_test/lab_test.js index bf1ecc87e4..8036c7dc13 100644 --- a/erpnext/healthcare/doctype/lab_test/lab_test.js +++ b/erpnext/healthcare/doctype/lab_test/lab_test.js @@ -1,49 +1,53 @@ // Copyright (c) 2016, ESS and contributors // For license information, please see license.txt -cur_frm.cscript.custom_refresh = function(doc) { - cur_frm.toggle_display("sb_sensitivity", doc.sensitivity_toggle=="1"); - cur_frm.toggle_display("sb_special", doc.special_toggle=="1"); - cur_frm.toggle_display("sb_normal", doc.normal_toggle=="1"); +cur_frm.cscript.custom_refresh = function (doc) { + cur_frm.toggle_display('sb_sensitivity', doc.sensitivity_toggle); + 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); }; frappe.ui.form.on('Lab Test', { - setup: function(frm) { + setup: function (frm) { frm.get_field('normal_test_items').grid.editable_fields = [ - {fieldname: 'lab_test_name', columns: 3}, - {fieldname: 'lab_test_event', columns: 2}, - {fieldname: 'result_value', columns: 2}, - {fieldname: 'lab_test_uom', columns: 1}, - {fieldname: 'normal_range', columns: 2} + { fieldname: 'lab_test_name', columns: 3 }, + { fieldname: 'lab_test_event', columns: 2 }, + { fieldname: 'result_value', columns: 2 }, + { fieldname: 'lab_test_uom', columns: 1 }, + { fieldname: 'normal_range', columns: 2 } ]; - frm.get_field('special_test_items').grid.editable_fields = [ - {fieldname: 'lab_test_particulars', columns: 3}, - {fieldname: 'result_value', columns: 7} + frm.get_field('descriptive_test_items').grid.editable_fields = [ + { fieldname: 'lab_test_particulars', columns: 3 }, + { fieldname: 'result_value', columns: 7 } ]; }, - refresh : function(frm){ + refresh: function (frm) { refresh_field('normal_test_items'); - refresh_field('special_test_items'); - if(frm.doc.__islocal){ + refresh_field('descriptive_test_items'); + if (frm.doc.__islocal) { frm.add_custom_button(__('Get from Patient Encounter'), function () { get_lab_test_prescribed(frm); }); } - if(frm.doc.docstatus==1 && frm.doc.status!='Approved' && frm.doc.status!='Rejected' && frappe.defaults.get_default("lab_test_approval_required") && frappe.user.has_role("LabTest Approver")){ - frm.add_custom_button(__('Approve'), function() { - status_update(1,frm); - }); - frm.add_custom_button(__('Reject'), function() { - status_update(0,frm); - }); + if (frappe.defaults.get_default('lab_test_approval_required') && frappe.user.has_role('LabTest Approver')) { + if (frm.doc.docstatus === 1 && frm.doc.status !== 'Approved' && frm.doc.status !== 'Rejected') { + frm.add_custom_button(__('Approve'), function () { + status_update(1, frm); + }); + frm.add_custom_button(__('Reject'), function () { + status_update(0, frm); + }); + } } - if(frm.doc.docstatus==1 && frm.doc.sms_sent==0){ - frm.add_custom_button(__('Send SMS'), function() { + + if (frm.doc.docstatus === 1 && frm.doc.sms_sent === 0 && frm.doc.status !== 'Rejected' ) { + frm.add_custom_button(__('Send SMS'), function () { frappe.call({ - method: "erpnext.healthcare.doctype.healthcare_settings.healthcare_settings.get_sms_text", - args:{doc: frm.doc.name}, - callback: function(r) { - if(!r.exc) { + method: 'erpnext.healthcare.doctype.healthcare_settings.healthcare_settings.get_sms_text', + args: { doc: frm.doc.name }, + callback: function (r) { + if (!r.exc) { var emailed = r.message.emailed; var printed = r.message.printed; make_dialog(frm, emailed, printed); @@ -53,246 +57,223 @@ frappe.ui.form.on('Lab Test', { }); } - }, - onload: function (frm) { - frm.add_fetch("practitioner", "department", "department"); - if(frm.doc.employee){ - frappe.call({ - method: "frappe.client.get", - args:{ - doctype: "Employee", - name: frm.doc.employee - }, - callback: function(arg){ - frappe.model.set_value(frm.doctype,frm.docname,"employee_name", arg.message.employee_name); - frappe.model.set_value(frm.doctype,frm.docname,"employee_designation", arg.message.designation); - } - }); - } } }); -frappe.ui.form.on("Lab Test", "patient", function(frm) { - if(frm.doc.patient){ +frappe.ui.form.on('Lab Test', 'patient', function (frm) { + if (frm.doc.patient) { frappe.call({ - "method": "erpnext.healthcare.doctype.patient.patient.get_patient_detail", - args: { - patient: frm.doc.patient - }, + 'method': 'erpnext.healthcare.doctype.patient.patient.get_patient_detail', + args: { patient: frm.doc.patient }, callback: function (data) { var age = null; - if(data.message.dob){ + if (data.message.dob) { age = calculate_age(data.message.dob); } - frappe.model.set_value(frm.doctype,frm.docname, "patient_age", age); - frappe.model.set_value(frm.doctype,frm.docname, "patient_sex", data.message.sex); - frappe.model.set_value(frm.doctype,frm.docname, "email", data.message.email); - frappe.model.set_value(frm.doctype,frm.docname, "mobile", data.message.mobile); - frappe.model.set_value(frm.doctype,frm.docname, "report_preference", data.message.report_preference); + let values = { + 'patient_age': age, + 'patient_sex': data.message.sex, + 'email': data.message.email, + 'mobile': data.message.mobile, + 'report_preference': data.message.report_preference + }; + frm.set_value(values); } }); } }); -frappe.ui.form.on('Normal Test Items', { - normal_test_items_remove: function() { - frappe.msgprint(__("Not permitted, configure Lab Test Template as required")); +frappe.ui.form.on('Normal Test Result', { + normal_test_items_remove: function () { + frappe.msgprint(__('Not permitted, configure Lab Test Template as required')); cur_frm.reload_doc(); } }); -frappe.ui.form.on('Special Test Items', { - special_test_items_remove: function() { - frappe.msgprint(__("Not permitted, configure Lab Test Template as required")); +frappe.ui.form.on('Descriptive Test Result', { + descriptive_test_items_remove: function () { + frappe.msgprint(__('Not permitted, configure Lab Test Template as required')); cur_frm.reload_doc(); } }); -var status_update = function(approve,frm){ +var status_update = function (approve, frm) { var doc = frm.doc; var status = null; - if(approve == 1){ - status = "Approved"; + if (approve == 1) { + status = 'Approved'; } else { - status = "Rejected"; + status = 'Rejected'; } frappe.call({ - method: "erpnext.healthcare.doctype.lab_test.lab_test.update_status", - args: {status: status, name: doc.name}, - callback: function(){ + method: 'erpnext.healthcare.doctype.lab_test.lab_test.update_status', + args: { status: status, name: doc.name }, + callback: function () { cur_frm.reload_doc(); } }); }; -var get_lab_test_prescribed = function(frm){ - if(frm.doc.patient){ +var get_lab_test_prescribed = function (frm) { + if (frm.doc.patient) { frappe.call({ - method: "erpnext.healthcare.doctype.lab_test.lab_test.get_lab_test_prescribed", - args: {patient: frm.doc.patient}, - callback: function(r){ + method: 'erpnext.healthcare.doctype.lab_test.lab_test.get_lab_test_prescribed', + args: { patient: frm.doc.patient }, + callback: function (r) { show_lab_tests(frm, r.message); } }); } - else{ - frappe.msgprint(__("Please select a Patient to get Lab Tests")); + else { + frappe.msgprint(__('Please select Patient to get Lab Tests')); } }; -var show_lab_tests = function(frm, result){ +var show_lab_tests = function (frm, lab_test_list) { var d = new frappe.ui.Dialog({ - title: __("Lab Tests"), - fields: [ - { - fieldtype: "HTML", fieldname: "lab_test" - } - ] + title: __('Lab Tests'), + fields: [{ + fieldtype: 'HTML', fieldname: 'lab_test' + }] }); var html_field = d.fields_dict.lab_test.$wrapper; html_field.empty(); - $.each(result, function(x, y){ - var row = $(repl('
\ -
%(lab_test)s
\ -
%(encounter)s
\ -
%(practitioner)s
\ -
%(date)s
\ -
\ -
', {name:y[0], lab_test: y[1], encounter:y[2], invoiced:y[3], practitioner:y[4], date:y[5]})).appendTo(html_field); - row.find("a").click(function() { - frm.doc.template = $(this).attr("data-lab-test"); - frm.doc.prescription = $(this).attr("data-name"); - frm.doc.practitioner = $(this).attr("data-practitioner"); - frm.set_df_property("template", "read_only", 1); - frm.set_df_property("patient", "read_only", 1); - frm.set_df_property("practitioner", "read_only", 1); + $.each(lab_test_list, function (x, y) { + var row = $(repl( + '
\ +
%(lab_test)s
\ +
%(practitioner_name)s
%(encounter)s
\ +
%(date)s
\ +
\ + \ +
\ +

', + { name: y[0], lab_test: y[1], encounter: y[2], invoiced: y[3], practitioner: y[4], practitioner_name: y[5], date: y[6] }) + ).appendTo(html_field); + + row.find("a").click(function () { + frm.doc.template = $(this).attr('data-lab-test'); + frm.doc.prescription = $(this).attr('data-name'); + frm.doc.practitioner = $(this).attr('data-practitioner'); + frm.set_df_property('template', 'read_only', 1); + frm.set_df_property('patient', 'read_only', 1); + frm.set_df_property('practitioner', 'read_only', 1); frm.doc.invoiced = 0; - if($(this).attr("data-invoiced") == 1){ + if ($(this).attr('data-invoiced') === 1) { frm.doc.invoiced = 1; } - refresh_field("invoiced"); - refresh_field("template"); + refresh_field('invoiced'); + refresh_field('template'); d.hide(); return false; }); }); - if(!result.length){ - var msg = __("No Lab Tests found for the Patient {0}", [frm.doc.patient_name.bold()]); + if (!lab_test_list.length) { + var msg = __('No Lab Tests found for the Patient {0}', [frm.doc.patient_name.bold()]); html_field.empty(); - $(repl('
%(msg)s
', {msg: msg})).appendTo(html_field); + $(repl('
%(msg)s
', { msg: msg })).appendTo(html_field); } d.show(); }; -cur_frm.cscript.custom_before_submit = function(doc) { - if(doc.normal_test_items){ - for(let result in doc.normal_test_items){ - if(!doc.normal_test_items[result].result_value && doc.normal_test_items[result].require_result_value == 1){ - frappe.msgprint(__("Please input all required Result Value(s)")); - throw("Error"); +cur_frm.cscript.custom_before_submit = function (doc) { + if (doc.normal_test_items) { + for (let result in doc.normal_test_items) { + if (!doc.normal_test_items[result].result_value && !doc.normal_test_items[result].allow_blank && doc.normal_test_items[result].require_result_value) { + frappe.throw(__('Please input all required result values')); } } } - if(doc.special_test_items){ - for(let result in doc.special_test_items){ - if(!doc.special_test_items[result].result_value && doc.special_test_items[result].require_result_value == 1){ - frappe.msgprint(__("Please input all required Result Value(s)")); - throw("Error"); + if (doc.descriptive_test_items) { + for (let result in doc.descriptive_test_items) { + if (!doc.descriptive_test_items[result].result_value && !doc.descriptive_test_items[result].allow_blank && doc.descriptive_test_items[result].require_result_value) { + frappe.throw(__('Please input all required result values')); } } } }; -var make_dialog = function(frm, emailed, printed) { +var make_dialog = function (frm, emailed, printed) { var number = frm.doc.mobile; var dialog = new frappe.ui.Dialog({ title: 'Send SMS', width: 400, fields: [ - {fieldname:'sms_type', fieldtype:'Select', label:'Type', options: - ['Emailed','Printed']}, - {fieldname:'number', fieldtype:'Data', label:'Mobile Number', reqd:1}, - {fieldname:'messages_label', fieldtype:'HTML'}, - {fieldname:'messages', fieldtype:'HTML', reqd:1} + { fieldname: 'sms_type', fieldtype: 'Select', label: 'Type', options: ['Emailed', 'Printed'] }, + { fieldname: 'number', fieldtype: 'Data', label: 'Mobile Number', reqd: 1 }, + { fieldname: 'message', fieldtype: 'Small Text', label: 'Message', reqd: 1 } ], - primary_action_label: __("Send"), - primary_action : function(){ + primary_action_label: __('Send'), + primary_action: function () { var values = dialog.fields_dict; - if(!values){ + if (!values) { return; } - send_sms(values,frm); + send_sms(values, frm); dialog.hide(); } }); - if(frm.doc.report_preference == "Email"){ + if (frm.doc.report_preference == 'Print') { dialog.set_values({ - 'sms_type': "Emailed", - 'number': number + 'sms_type': 'Printed', + 'number': number, + 'message': printed }); - dialog.fields_dict.messages_label.html("Message".bold()); - dialog.fields_dict.messages.html(emailed); - }else{ + } else { dialog.set_values({ - 'sms_type': "Printed", - 'number': number + 'sms_type': 'Emailed', + 'number': number, + 'message': emailed }); - dialog.fields_dict.messages_label.html("Message".bold()); - dialog.fields_dict.messages.html(printed); } var fd = dialog.fields_dict; - $(fd.sms_type.input).change(function(){ - if(dialog.get_value('sms_type') == 'Emailed'){ + $(fd.sms_type.input).change(function () { + if (dialog.get_value('sms_type') == 'Emailed') { dialog.set_values({ - 'number': number + 'number': number, + 'message': emailed }); - fd.messages_label.html("Message".bold()); - fd.messages.html(emailed); - }else{ + } else { dialog.set_values({ - 'number': number + 'number': number, + 'message': printed }); - fd.messages_label.html("Message".bold()); - fd.messages.html(printed); } }); dialog.show(); }; -var send_sms = function(v,frm){ - var doc = frm.doc; - var number = v.number.last_value; - var messages = v.messages.wrapper.innerText; +var send_sms = function (vals, frm) { + var number = vals.number.value; + var message = vals.message.last_value; + + if (!number || !message) { + frappe.throw(__('Did not send SMS, missing patient mobile number or message content.')); + } frappe.call({ - method: "frappe.core.doctype.sms_settings.sms_settings.send_sms", + method: 'frappe.core.doctype.sms_settings.sms_settings.send_sms', args: { receiver_list: [number], - msg: messages + msg: message }, - callback: function(r) { - if(r.exc) {frappe.msgprint(r.exc); return; } - else{ - frappe.call({ - method: "erpnext.healthcare.doctype.lab_test.lab_test.update_lab_test_print_sms_email_status", - args: {print_sms_email: "sms_sent", name: doc.name}, - callback: function(){ - cur_frm.reload_doc(); - } - }); + callback: function (r) { + if (r.exc) { + frappe.msgprint(r.exc); + } else { + frm.reload_doc(); } } }); }; -var calculate_age = function(birth) { - var ageMS = Date.parse(Date()) - Date.parse(birth); - var age = new Date(); +var calculate_age = function (dob) { + var ageMS = Date.parse(Date()) - Date.parse(dob); + var age = new Date(); age.setTime(ageMS); - var years = age.getFullYear() - 1970; - return years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)"; + var years = age.getFullYear() - 1970; + return years + ' Year(s) ' + age.getMonth() + ' Month(s) ' + age.getDate() + ' Day(s)'; }; diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.json b/erpnext/healthcare/doctype/lab_test/lab_test.json index 88eeb46a24..2eb8014b7e 100644 --- a/erpnext/healthcare/doctype/lab_test/lab_test.json +++ b/erpnext/healthcare/doctype/lab_test/lab_test.json @@ -10,49 +10,63 @@ "engine": "InnoDB", "field_order": [ "naming_series", + "template", + "lab_test_name", + "lab_test_group", + "medical_code", + "department", + "column_break_26", + "company", + "status", + "submitted_date", + "result_date", + "approved_date", + "expected_result_date", + "expected_result_time", + "printed_on", + "invoiced", + "sb_first", "patient", "patient_name", "patient_age", "patient_sex", + "inpatient_record", "report_preference", "email", "mobile", - "practitioner", "c_b", - "inpatient_record", - "company", - "department", - "status", - "submitted_date", - "approved_date", - "sample", - "result_date", + "practitioner", + "practitioner_name", + "requesting_department", "employee", "employee_name", "employee_designation", "user", - "invoiced", - "sb_first", - "template", - "lab_test_name", - "column_break_26", - "medical_code", - "lab_test_group", + "sample", "sb_normal", + "lab_test_html", "normal_test_items", - "sb_special", - "special_test_items", + "sb_descriptive", + "descriptive_test_items", + "organisms_section", + "organism_test_items", "sb_sensitivity", "sensitivity_test_items", "sb_comments", "lab_test_comment", "sb_customresult", "custom_result", + "worksheet_section", + "worksheet_instructions", + "result_legend_section", + "legend_print_position", + "result_legend", + "section_break_50", "email_sent", "sms_sent", "printed", "normal_toggle", - "special_toggle", + "descriptive_toggle", "sensitivity_toggle", "amended_from", "prescription" @@ -89,7 +103,6 @@ "fieldname": "patient", "fieldtype": "Link", "ignore_user_permissions": 1, - "in_list_view": 1, "in_standard_filter": 1, "label": "Patient", "options": "Patient", @@ -120,6 +133,7 @@ "label": "Gender", "options": "Gender", "print_hide": 1, + "read_only": 1, "report_hide": 1, "reqd": 1, "set_only_once": 1 @@ -128,11 +142,14 @@ "fieldname": "practitioner", "fieldtype": "Link", "ignore_user_permissions": 1, - "label": "Healthcare Practitioner", + "in_list_view": 1, + "label": "Requesting Practitioner", + "no_copy": 1, "options": "Healthcare Practitioner", "search_index": 1 }, { + "fetch_from": "patient.email", "fieldname": "email", "fieldtype": "Data", "hidden": 1, @@ -142,6 +159,7 @@ "report_hide": 1 }, { + "fetch_from": "patient.mobile", "fieldname": "mobile", "fieldtype": "Data", "hidden": 1, @@ -166,21 +184,23 @@ "print_hide": 1 }, { + "fetch_from": "template.department", "fieldname": "department", "fieldtype": "Link", "ignore_user_permissions": 1, "in_standard_filter": 1, "label": "Department", "options": "Medical Department", + "read_only": 1, "search_index": 1 }, { "fieldname": "status", "fieldtype": "Select", - "hidden": 1, "label": "Status", "options": "Draft\nCompleted\nApproved\nRejected\nCancelled", "print_hide": 1, + "read_only": 1, "report_hide": 1, "search_index": 1 }, @@ -211,16 +231,39 @@ "read_only": 1, "report_hide": 1 }, + { + "default": "Today", + "fieldname": "expected_result_date", + "fieldtype": "Date", + "hidden": 1, + "label": "Expected Result Date", + "read_only": 1 + }, + { + "fieldname": "expected_result_time", + "fieldtype": "Time", + "hidden": 1, + "label": "Expected Result Time", + "read_only": 1 + }, { "fieldname": "result_date", "fieldtype": "Date", + "hidden": 1, "label": "Result Date", "search_index": 1 }, + { + "allow_on_submit": 1, + "fieldname": "printed_on", + "fieldtype": "Datetime", + "label": "Printed on", + "read_only": 1 + }, { "fieldname": "employee", "fieldtype": "Link", - "label": "Lab Technician", + "label": "Employee (Lab Technician)", "no_copy": 1, "options": "Employee", "print_hide": 1, @@ -230,7 +273,7 @@ "fetch_from": "employee.employee_name", "fieldname": "employee_name", "fieldtype": "Data", - "label": "Technician Name", + "label": "Lab Technician Name", "no_copy": 1, "print_hide": 1, "read_only": 1, @@ -240,7 +283,7 @@ "fetch_from": "employee.designation", "fieldname": "employee_designation", "fieldtype": "Data", - "label": "Designation", + "label": "Lab Technician Designation", "no_copy": 1, "print_hide": 1, "read_only": 1, @@ -257,6 +300,7 @@ "report_hide": 1 }, { + "fetch_from": "patient.report_preference", "fieldname": "report_preference", "fieldtype": "Data", "label": "Report Preference", @@ -272,7 +316,6 @@ "fieldname": "lab_test_name", "fieldtype": "Data", "in_list_view": 1, - "in_standard_filter": 1, "label": "Test Name", "no_copy": 1, "print_hide": 1, @@ -280,14 +323,11 @@ "report_hide": 1, "search_index": 1 }, - { - "fieldname": "column_break_26", - "fieldtype": "Column Break" - }, { "fieldname": "template", "fieldtype": "Link", "ignore_user_permissions": 1, + "in_standard_filter": 1, "label": "Test Template", "options": "Lab Test Template", "print_hide": 1, @@ -304,6 +344,14 @@ "print_hide": 1, "report_hide": 1 }, + { + "fetch_from": "template.medical_code", + "fieldname": "medical_code", + "fieldtype": "Link", + "label": "Medical Code", + "options": "Medical Code", + "read_only": 1 + }, { "fieldname": "sb_normal", "fieldtype": "Section Break" @@ -311,19 +359,18 @@ { "fieldname": "normal_test_items", "fieldtype": "Table", - "options": "Normal Test Items" + "options": "Normal Test Result", + "print_hide": 1 }, { - "fieldname": "sb_special", + "fieldname": "lab_test_html", + "fieldtype": "HTML" + }, + { + "depends_on": "descriptive_toggle", + "fieldname": "organisms_section", "fieldtype": "Section Break" }, - { - "fieldname": "special_test_items", - "fieldtype": "Table", - "options": "Special Test Items", - "print_hide": 1, - "report_hide": 1 - }, { "fieldname": "sb_sensitivity", "fieldtype": "Section Break" @@ -331,7 +378,7 @@ { "fieldname": "sensitivity_test_items", "fieldtype": "Table", - "options": "Sensitivity Test Items", + "options": "Sensitivity Test Result", "print_hide": 1, "report_hide": 1 }, @@ -343,7 +390,8 @@ "fieldname": "lab_test_comment", "fieldtype": "Text", "ignore_xss_filter": 1, - "label": "Comments" + "label": "Comments", + "print_hide": 1 }, { "collapsible": 1, @@ -355,7 +403,8 @@ "fieldname": "custom_result", "fieldtype": "Text Editor", "ignore_xss_filter": 1, - "label": "Custom Result" + "label": "Custom Result", + "print_hide": 1 }, { "default": "0", @@ -389,14 +438,6 @@ "print_hide": 1, "report_hide": 1 }, - { - "default": "0", - "fieldname": "special_toggle", - "fieldtype": "Check", - "hidden": 1, - "print_hide": 1, - "report_hide": 1 - }, { "default": "0", "fieldname": "sensitivity_toggle", @@ -427,17 +468,89 @@ "report_hide": 1 }, { - "fetch_from": "template.medical_code", - "fieldname": "medical_code", + "fieldname": "column_break_26", + "fieldtype": "Column Break" + }, + { + "fetch_from": "practitioner.department", + "fieldname": "requesting_department", "fieldtype": "Link", - "label": "Medical Code", - "options": "Medical Code", + "in_list_view": 1, + "label": "Requesting Department", + "options": "Medical Department", "read_only": 1 + }, + { + "fetch_from": "practitioner.practitioner_name", + "fieldname": "practitioner_name", + "fieldtype": "Data", + "label": "Requesting Practitioner", + "read_only": 1 + }, + { + "collapsible": 1, + "fieldname": "result_legend_section", + "fieldtype": "Section Break", + "label": "Result Legend Print" + }, + { + "fieldname": "legend_print_position", + "fieldtype": "Select", + "label": "Print Position", + "options": "\nBottom\nTop\nBoth", + "print_hide": 1 + }, + { + "fieldname": "result_legend", + "fieldtype": "Text Editor", + "label": "Result Legend", + "print_hide": 1 + }, + { + "fieldname": "section_break_50", + "fieldtype": "Section Break" + }, + { + "fieldname": "worksheet_instructions", + "fieldtype": "Text Editor", + "label": "Worksheet Instructions", + "print_hide": 1 + }, + { + "collapsible": 1, + "fieldname": "worksheet_section", + "fieldtype": "Section Break", + "label": "Worksheet Print" + }, + { + "fieldname": "descriptive_test_items", + "fieldtype": "Table", + "options": "Descriptive Test Result", + "print_hide": 1, + "report_hide": 1 + }, + { + "fieldname": "sb_descriptive", + "fieldtype": "Section Break" + }, + { + "default": "0", + "fieldname": "descriptive_toggle", + "fieldtype": "Check", + "hidden": 1, + "print_hide": 1, + "report_hide": 1 + }, + { + "fieldname": "organism_test_items", + "fieldtype": "Table", + "options": "Organism Test Result", + "print_hide": 1 } ], "is_submittable": 1, "links": [], - "modified": "2020-06-29 14:24:26.509721", + "modified": "2020-07-16 13:35:24.811062", "modified_by": "Administrator", "module": "Healthcare", "name": "Lab Test", diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.py b/erpnext/healthcare/doctype/lab_test/lab_test.py index b2c5e6bf43..865f4a14e3 100644 --- a/erpnext/healthcare/doctype/lab_test/lab_test.py +++ b/erpnext/healthcare/doctype/lab_test/lab_test.py @@ -10,26 +10,30 @@ from frappe.utils import getdate, cstr class LabTest(Document): def on_submit(self): - frappe.db.set_value(self.doctype,self.name,"submitted_date", getdate()) + self.db_set('submitted_date', getdate()) + self.db_set('status', 'Completed') insert_lab_test_to_medical_record(self) - frappe.db.set_value("Lab Test", self.name, "status", "Completed") def on_cancel(self): delete_lab_test_from_medical_record(self) - frappe.db.set_value("Lab Test", self.name, "status", "Cancelled") + self.db_set('status', 'Cancelled') self.reload() + def validate(self): + if not self.is_new(): + self.set_secondary_uom_result() + def on_update(self): - if(self.sensitivity_test_items): + if self.sensitivity_test_items: sensitivity = sorted(self.sensitivity_test_items, key=lambda x: x.antibiotic_sensitivity) for i, item in enumerate(sensitivity): - item.idx = i+1 + item.idx = i + 1 self.sensitivity_test_items = sensitivity def after_insert(self): - if(self.prescription): - frappe.db.set_value("Lab Prescription", self.prescription, "lab_test_created", 1) - if frappe.db.get_value("Lab Prescription", self.prescription, 'invoiced') == 1: + if self.prescription: + frappe.db.set_value('Lab Prescription', self.prescription, 'lab_test_created', 1) + if frappe.db.get_value('Lab Prescription', self.prescription, 'invoiced'): self.invoiced = True if not self.lab_test_name and self.template: self.load_test_from_template() @@ -40,109 +44,110 @@ class LabTest(Document): create_test_from_template(lab_test) self.reload() + def set_secondary_uom_result(self): + for item in self.normal_test_items: + if item.result_value and item.secondary_uom and item.conversion_factor: + try: + item.secondary_uom_result = float(item.result_value) * float(item.conversion_factor) + except: + item.secondary_uom_result = '' + frappe.msgprint(_('Result for Secondary UOM not calculated for row #{0}'.format(item.idx)), title = _('Warning')) + + def create_test_from_template(lab_test): - template = frappe.get_doc("Lab Test Template", lab_test.template) - patient = frappe.get_doc("Patient", lab_test.patient) + template = frappe.get_doc('Lab Test Template', lab_test.template) + patient = frappe.get_doc('Patient', lab_test.patient) lab_test.lab_test_name = template.lab_test_name lab_test.result_date = getdate() lab_test.department = template.department lab_test.lab_test_group = template.lab_test_group + lab_test.legend_print_position = template.legend_print_position + lab_test.result_legend = template.result_legend + 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) @frappe.whitelist() def update_status(status, name): - frappe.db.sql("""update `tabLab Test` set status=%s, approved_date=%s where name = %s""", (status, getdate(), name)) - -@frappe.whitelist() -def update_lab_test_print_sms_email_status(print_sms_email, name): - frappe.db.set_value("Lab Test",name,print_sms_email,1) + if name and status: + frappe.db.set_value('Lab Test', name, { + 'status': status, + 'approved_date': getdate() + }) @frappe.whitelist() def create_multiple(doctype, docname): + if not doctype or not docname: + frappe.throw(_('Sales Invoice or Patient Encounter is required to create Lab Tests'), title=_('Insufficient Data')) + lab_test_created = False - if doctype == "Sales Invoice": + if doctype == 'Sales Invoice': lab_test_created = create_lab_test_from_invoice(docname) - elif doctype == "Patient Encounter": + elif doctype == 'Patient Encounter': lab_test_created = create_lab_test_from_encounter(docname) if lab_test_created: - frappe.msgprint(_("Lab Test(s) {0} created".format(lab_test_created))) + frappe.msgprint(_('Lab Test(s) {0} created'.format(lab_test_created))) else: - frappe.msgprint(_("No Lab Tests created")) + frappe.msgprint(_('No Lab Tests created')) -def create_lab_test_from_encounter(encounter_id): +def create_lab_test_from_encounter(encounter): lab_test_created = False - encounter = frappe.get_doc("Patient Encounter", encounter_id) + encounter = frappe.get_doc('Patient Encounter', encounter) - lab_test_ids = frappe.db.sql("""select lp.name, lp.lab_test_code, lp.invoiced - from `tabPatient Encounter` et, `tabLab Prescription` lp - where et.patient=%s and lp.parent=%s and - lp.parent=et.name and lp.lab_test_created=0 and et.docstatus=1""", (encounter.patient, encounter_id)) - - if lab_test_ids: - patient = frappe.get_doc("Patient", encounter.patient) - for lab_test_id in lab_test_ids: - template = get_lab_test_template(lab_test_id[1]) - if template: - lab_test = create_lab_test_doc(lab_test_id[2], encounter.practitioner, patient, template, encounter.company) - lab_test.save(ignore_permissions = True) - frappe.db.set_value("Lab Prescription", lab_test_id[0], "lab_test_created", 1) - if not lab_test_created: - lab_test_created = lab_test.name - else: - lab_test_created += ", "+lab_test.name + if encounter and encounter.lab_test_prescription: + patient = frappe.get_doc('Patient', encounter.patient) + for item in encounter.lab_test_prescription: + if not item.lab_test_created: + template = get_lab_test_template(item.lab_test_code) + if template: + lab_test = create_lab_test_doc(item.invoiced, encounter.practitioner, patient, template, encounter.company) + lab_test.save(ignore_permissions = True) + frappe.db.set_value('Lab Prescription', item.name, 'lab_test_created', 1) + if not lab_test_created: + lab_test_created = lab_test.name + else: + lab_test_created += ', ' + lab_test.name return lab_test_created -def create_lab_test_from_invoice(invoice_name): +def create_lab_test_from_invoice(sales_invoice): lab_tests_created = False - invoice = frappe.get_doc("Sales Invoice", invoice_name) - if invoice.patient: - patient = frappe.get_doc("Patient", invoice.patient) + invoice = frappe.get_doc('Sales Invoice', sales_invoice) + if invoice and invoice.patient: + patient = frappe.get_doc('Patient', invoice.patient) for item in invoice.items: lab_test_created = 0 - if item.reference_dt == "Lab Prescription": - lab_test_created = frappe.db.get_value("Lab Prescription", item.reference_dn, "lab_test_created") - elif item.reference_dt == "Lab Test": + if item.reference_dt == 'Lab Prescription': + lab_test_created = frappe.db.get_value('Lab Prescription', item.reference_dn, 'lab_test_created') + elif item.reference_dt == 'Lab Test': lab_test_created = 1 if lab_test_created != 1: template = get_lab_test_template(item.item_code) if template: lab_test = create_lab_test_doc(True, invoice.ref_practitioner, patient, template, invoice.company) - if item.reference_dt == "Lab Prescription": + if item.reference_dt == 'Lab Prescription': lab_test.prescription = item.reference_dn lab_test.save(ignore_permissions = True) - if item.reference_dt != "Lab Prescription": - frappe.db.set_value("Sales Invoice Item", item.name, "reference_dt", "Lab Test") - frappe.db.set_value("Sales Invoice Item", item.name, "reference_dn", lab_test.name) + if item.reference_dt != 'Lab Prescription': + frappe.db.set_value('Sales Invoice Item', item.name, 'reference_dt', 'Lab Test') + frappe.db.set_value('Sales Invoice Item', item.name, 'reference_dn', lab_test.name) if not lab_tests_created: lab_tests_created = lab_test.name else: - lab_tests_created += ", " + lab_test.name + lab_tests_created += ', ' + lab_test.name return lab_tests_created def get_lab_test_template(item): - template_id = check_template_exists(item) + template_id = frappe.db.exists('Lab Test Template', {'item': item}) if template_id: - return frappe.get_doc("Lab Test Template", template_id) - return False - -def check_template_exists(item): - template_exists = frappe.db.exists( - "Lab Test Template", - { - 'item': item - } - ) - if template_exists: - return template_exists + return frappe.get_doc('Lab Test Template', template_id) return False def create_lab_test_doc(invoiced, practitioner, patient, template, company): - lab_test = frappe.new_doc("Lab Test") + lab_test = frappe.new_doc('Lab Test') lab_test.invoiced = invoiced lab_test.practitioner = practitioner lab_test.patient = patient.name @@ -159,63 +164,71 @@ def create_lab_test_doc(invoiced, practitioner, patient, template, company): return lab_test def create_normals(template, lab_test): - lab_test.normal_toggle = "1" - normal = lab_test.append("normal_test_items") + lab_test.normal_toggle = 1 + normal = lab_test.append('normal_test_items') normal.lab_test_name = template.lab_test_name normal.lab_test_uom = template.lab_test_uom + normal.secondary_uom = template.secondary_uom + normal.conversion_factor = template.conversion_factor normal.normal_range = template.lab_test_normal_range normal.require_result_value = 1 + normal.allow_blank = 0 normal.template = template.name def create_compounds(template, lab_test, is_group): - lab_test.normal_toggle = "1" + lab_test.normal_toggle = 1 for normal_test_template in template.normal_test_templates: - normal = lab_test.append("normal_test_items") + normal = lab_test.append('normal_test_items') if is_group: normal.lab_test_event = normal_test_template.lab_test_event else: normal.lab_test_name = normal_test_template.lab_test_event normal.lab_test_uom = normal_test_template.lab_test_uom + normal.secondary_uom = normal_test_template.secondary_uom + normal.conversion_factor = normal_test_template.conversion_factor normal.normal_range = normal_test_template.normal_range normal.require_result_value = 1 + normal.allow_blank = normal_test_template.allow_blank normal.template = template.name -def create_specials(template, lab_test): - lab_test.special_toggle = "1" - if(template.sensitivity): - lab_test.sensitivity_toggle = "1" - for special_test_template in template.special_test_template: - special = lab_test.append("special_test_items") - special.lab_test_particulars = special_test_template.particulars - special.require_result_value = 1 - special.template = template.name +def create_descriptives(template, lab_test): + lab_test.descriptive_toggle = 1 + if template.sensitivity: + lab_test.sensitivity_toggle = 1 + for descriptive_test_template in template.descriptive_test_templates: + descriptive = lab_test.append('descriptive_test_items') + descriptive.lab_test_particulars = descriptive_test_template.particulars + descriptive.require_result_value = 1 + descriptive.allow_blank = descriptive_test_template.allow_blank + descriptive.template = template.name def create_sample_doc(template, patient, invoice, company = None): if template.sample: sample_exists = frappe.db.exists({ - "doctype": "Sample Collection", - "patient": patient.name, - "docstatus": 0, - "sample": template.sample + 'doctype': 'Sample Collection', + 'patient': patient.name, + 'docstatus': 0, + 'sample': template.sample }) if sample_exists: - # update Sample Collection by adding quantity - sample_collection = frappe.get_doc("Sample Collection", sample_exists[0][0]) + # Update Sample Collection by adding quantity + sample_collection = frappe.get_doc('Sample Collection', sample_exists[0][0]) quantity = int(sample_collection.sample_qty) + int(template.sample_qty) if template.sample_details: - sample_details = sample_collection.sample_details + "\n==============\n" + _("Test: ") - sample_details += (template.get("lab_test_name") or template.get("template")) + "\n" - sample_details += _("Collection Details: ") + "\n\t" + template.sample_details + sample_details = sample_collection.sample_details + '\n-\n' + _('Test: ') + sample_details += (template.get('lab_test_name') or template.get('template')) + '\n' + sample_details += _('Collection Details: ') + '\n\t' + template.sample_details + frappe.db.set_value('Sample Collection', sample_collection.name, 'sample_details', sample_details) - frappe.db.set_value("Sample Collection", sample_collection.name, "sample_details", sample_details) - frappe.db.set_value("Sample Collection", sample_collection.name, "sample_qty", quantity) + frappe.db.set_value('Sample Collection', sample_collection.name, 'sample_qty', quantity) else: - #create Sample Collection for template, copy vals from Invoice - sample_collection = frappe.new_doc("Sample Collection") - if(invoice): + # Create Sample Collection for template, copy vals from Invoice + sample_collection = frappe.new_doc('Sample Collection') + if invoice: sample_collection.invoiced = True + sample_collection.patient = patient.name sample_collection.patient_age = patient.get_age() sample_collection.patient_sex = patient.sex @@ -224,125 +237,146 @@ def create_sample_doc(template, patient, invoice, company = None): sample_collection.sample_qty = template.sample_qty sample_collection.company = company - if(template.sample_details): - sample_collection.sample_details = "Test :" + (template.get("lab_test_name") or template.get("template")) +"\n"+"Collection Detials:\n\t"+template.sample_details + if template.sample_details: + sample_collection.sample_details = 'Test :' + (template.get('lab_test_name') or template.get('template')) + '\n' + 'Collection Detials:\n\t' + template.sample_details sample_collection.save(ignore_permissions=True) return sample_collection def create_sample_collection(lab_test, template, patient, invoice): - if(frappe.db.get_value("Healthcare Settings", None, "create_sample_collection_for_lab_test") == "1"): + if frappe.get_cached_value('Healthcare Settings', None, 'create_sample_collection_for_lab_test'): sample_collection = create_sample_doc(template, patient, invoice, lab_test.company) - if(sample_collection): + if sample_collection: lab_test.sample = sample_collection.name + return lab_test def load_result_format(lab_test, template, prescription, invoice): - if(template.lab_test_template_type == 'Single'): + if template.lab_test_template_type == 'Single': create_normals(template, lab_test) - elif(template.lab_test_template_type == 'Compound'): + elif template.lab_test_template_type == 'Compound': create_compounds(template, lab_test, False) - elif(template.lab_test_template_type == 'Descriptive'): - create_specials(template, lab_test) - elif(template.lab_test_template_type == 'Grouped'): - #iterate for each template in the group and create one result for all. + elif template.lab_test_template_type == 'Descriptive': + create_descriptives(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: - #template_in_group = None - if(lab_test_group.lab_test_template): - template_in_group = frappe.get_doc("Lab Test Template", + # Template_in_group = None + if lab_test_group.lab_test_template: + template_in_group = frappe.get_doc('Lab Test Template', lab_test_group.lab_test_template) - if(template_in_group): - if(template_in_group.lab_test_template_type == 'Single'): + if template_in_group: + if template_in_group.lab_test_template_type == 'Single': create_normals(template_in_group, lab_test) - elif(template_in_group.lab_test_template_type == 'Compound'): - normal_heading = lab_test.append("normal_test_items") + elif template_in_group.lab_test_template_type == 'Compound': + normal_heading = lab_test.append('normal_test_items') normal_heading.lab_test_name = template_in_group.lab_test_name normal_heading.require_result_value = 0 + normal_heading.allow_blank = 1 normal_heading.template = template_in_group.name create_compounds(template_in_group, lab_test, True) - elif(template_in_group.lab_test_template_type == 'Descriptive'): - special_heading = lab_test.append("special_test_items") - special_heading.lab_test_name = template_in_group.lab_test_name - special_heading.require_result_value = 0 - special_heading.template = template_in_group.name - create_specials(template_in_group, lab_test) - else: - normal = lab_test.append("normal_test_items") + elif template_in_group.lab_test_template_type == 'Descriptive': + descriptive_heading = lab_test.append('descriptive_test_items') + descriptive_heading.lab_test_name = template_in_group.lab_test_name + descriptive_heading.require_result_value = 0 + descriptive_heading.allow_blank = 1 + descriptive_heading.template = template_in_group.name + create_descriptives(template_in_group, lab_test) + else: # Lab Test Group - Add New Line + normal = lab_test.append('normal_test_items') normal.lab_test_name = lab_test_group.group_event normal.lab_test_uom = lab_test_group.group_test_uom + normal.secondary_uom = lab_test_group.secondary_uom + normal.conversion_factor = lab_test_group.conversion_factor normal.normal_range = lab_test_group.group_test_normal_range + normal.allow_blank = lab_test_group.allow_blank normal.require_result_value = 1 normal.template = template.name - if(template.lab_test_template_type != 'No Result'): - if(prescription): + if template.lab_test_template_type != 'No Result': + if prescription: lab_test.prescription = prescription - if(invoice): - frappe.db.set_value("Lab Prescription", prescription, "invoiced", True) - lab_test.save(ignore_permissions=True) # insert the result + if invoice: + frappe.db.set_value('Lab Prescription', prescription, 'invoiced', True) + lab_test.save(ignore_permissions=True) # Insert the result return lab_test @frappe.whitelist() def get_employee_by_user_id(user_id): - emp_id = frappe.db.get_value("Employee",{"user_id":user_id}) - employee = frappe.get_doc("Employee",emp_id) + emp_id = frappe.db.get_value('Employee', { 'user_id': user_id }) + employee = frappe.get_doc('Employee', emp_id) return employee def insert_lab_test_to_medical_record(doc): table_row = False subject = cstr(doc.lab_test_name) if doc.practitioner: - subject += frappe.bold(_("Healthcare Practitioner: "))+ doc.practitioner + "
" + subject += frappe.bold(_('Healthcare Practitioner: '))+ doc.practitioner + '
' if doc.normal_test_items: item = doc.normal_test_items[0] - comment = "" + comment = '' if item.lab_test_comment: comment = str(item.lab_test_comment) - table_row = frappe.bold(_("Lab Test Conducted: ")) + item.lab_test_name + table_row = frappe.bold(_('Lab Test Conducted: ')) + item.lab_test_name if item.lab_test_event: - table_row += frappe.bold(_("Lab Test Event: ")) + item.lab_test_event + table_row += frappe.bold(_('Lab Test Event: ')) + item.lab_test_event if item.result_value: - table_row += " " + frappe.bold(_("Lab Test Result: ")) + item.result_value + table_row += ' ' + frappe.bold(_('Lab Test Result: ')) + item.result_value if item.normal_range: - table_row += " " + _("Normal Range:") + item.normal_range - table_row += " " + comment + table_row += ' ' + _('Normal Range:') + item.normal_range + table_row += ' ' + comment - elif doc.special_test_items: - item = doc.special_test_items[0] + elif doc.descriptive_test_items: + item = doc.descriptive_test_items[0] if item.lab_test_particulars and item.result_value: - table_row = item.lab_test_particulars +" "+ item.result_value + table_row = item.lab_test_particulars + ' ' + item.result_value elif doc.sensitivity_test_items: item = doc.sensitivity_test_items[0] if item.antibiotic and item.antibiotic_sensitivity: - table_row = item.antibiotic + " " + item.antibiotic_sensitivity + table_row = item.antibiotic + ' ' + item.antibiotic_sensitivity if table_row: - subject += "
" + table_row + subject += '
' + table_row if doc.lab_test_comment: - subject += "
" + cstr(doc.lab_test_comment) + subject += '
' + cstr(doc.lab_test_comment) - medical_record = frappe.new_doc("Patient Medical Record") + medical_record = frappe.new_doc('Patient Medical Record') medical_record.patient = doc.patient medical_record.subject = subject - medical_record.status = "Open" + medical_record.status = 'Open' medical_record.communication_date = doc.result_date - medical_record.reference_doctype = "Lab Test" + medical_record.reference_doctype = 'Lab Test' medical_record.reference_name = doc.name medical_record.reference_owner = doc.owner - medical_record.save(ignore_permissions=True) + medical_record.save(ignore_permissions = True) def delete_lab_test_from_medical_record(self): - medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(self.name)) + medical_record_id = frappe.db.sql('select name from `tabPatient Medical Record` where reference_name= %s', (self.name)) if medical_record_id and medical_record_id[0][0]: - frappe.delete_doc("Patient Medical Record", medical_record_id[0][0]) + frappe.delete_doc('Patient Medical Record', medical_record_id[0][0]) @frappe.whitelist() def get_lab_test_prescribed(patient): - return frappe.db.sql("""select cp.name, cp.lab_test_code, cp.parent, cp.invoiced, ct.practitioner, ct.encounter_date from `tabPatient Encounter` ct, - `tabLab Prescription` cp where ct.patient=%s and cp.parent=ct.name and cp.lab_test_created=0""", (patient)) + return frappe.db.sql( + ''' + select + lp.name, + lp.lab_test_code, + lp.parent, + lp.invoiced, + pe.practitioner, + pe.practitioner_name, + pe.encounter_date + from + `tabPatient Encounter` pe, `tabLab Prescription` lp + where + pe.patient=%s + and lp.parent=pe.name + and lp.lab_test_created=0 + ''', (patient)) diff --git a/erpnext/healthcare/doctype/lab_test/lab_test_list.js b/erpnext/healthcare/doctype/lab_test/lab_test_list.js index 1f6a12f935..6783bb3a59 100644 --- a/erpnext/healthcare/doctype/lab_test/lab_test_list.js +++ b/erpnext/healthcare/doctype/lab_test/lab_test_list.js @@ -2,57 +2,63 @@ (c) ESS 2015-16 */ frappe.listview_settings['Lab Test'] = { - add_fields: ["name", "status", "invoiced"], - filters:[["docstatus","=","0"]], - get_indicator: function(doc) { - if(doc.status=="Approved"){ - return [__("Approved"), "green", "status,=,Approved"]; + add_fields: ['name', 'status', 'invoiced'], + filters: [['docstatus', '=', '0']], + get_indicator: function (doc) { + if (doc.status == 'Approved') { + return [__('Approved'), 'green', 'status, = ,Approved']; } - if(doc.status=="Rejected"){ - return [__("Rejected"), "yellow", "status,=,Rejected"]; + if (doc.status == 'Rejected') { + return [__('Rejected'), 'orange', 'status, =, Rejected']; } }, - onload: function(listview) { - listview.page.add_menu_item(__("Create Multiple"), function() { + onload: function (listview) { + listview.page.add_menu_item(__('Create Multiple'), function () { create_multiple_dialog(listview); }); } }; -var create_multiple_dialog = function(listview){ +var create_multiple_dialog = function (listview) { var dialog = new frappe.ui.Dialog({ title: 'Create Multiple Lab Test', width: 100, fields: [ - {fieldtype: "Link", label: "Patient", fieldname: "patient", options: "Patient", reqd: 1}, - {fieldtype: "Select", label: "Invoice / Patient Encounter", fieldname: "doctype", - options: "\nSales Invoice\nPatient Encounter", reqd: 1}, - {fieldtype: "Dynamic Link", fieldname: "docname", options: "doctype", reqd: 1, - get_query: function(){ + { fieldtype: 'Link', label: 'Patient', fieldname: 'patient', options: 'Patient', reqd: 1 }, + { + fieldtype: 'Select', label: 'Invoice / Patient Encounter', fieldname: 'doctype', + options: '\nSales Invoice\nPatient Encounter', reqd: 1 + }, + { + fieldtype: 'Dynamic Link', fieldname: 'docname', options: 'doctype', reqd: 1, + get_query: function () { return { filters: { - "patient": dialog.get_value("patient"), - "docstatus": 1 + 'patient': dialog.get_value('patient'), + 'docstatus': 1 } }; } } ], - primary_action_label: __("Create Lab Test"), - primary_action : function(){ + primary_action_label: __('Create Lab Test'), + primary_action: function () { frappe.call({ method: 'erpnext.healthcare.doctype.lab_test.lab_test.create_multiple', - args:{ - 'doctype': dialog.get_value("doctype"), - 'docname': dialog.get_value("docname") + args: { + 'doctype': dialog.get_value('doctype'), + 'docname': dialog.get_value('docname') }, - callback: function(data) { - if(!data.exc){ + callback: function (data) { + if (!data.exc) { + if (!data.message) { + frappe.msgprint(__('No Lab Tests created')); + } listview.refresh(); } }, freeze: true, - freeze_message: "Creating Lab Test..." + freeze_message: 'Creating Lab Tests...' }); dialog.hide(); } diff --git a/erpnext/healthcare/doctype/sensitivity_test_items/__init__.py b/erpnext/healthcare/doctype/lab_test_group_template/__init__.py similarity index 100% rename from erpnext/healthcare/doctype/sensitivity_test_items/__init__.py rename to erpnext/healthcare/doctype/lab_test_group_template/__init__.py diff --git a/erpnext/healthcare/doctype/lab_test_group_template/lab_test_group_template.json b/erpnext/healthcare/doctype/lab_test_group_template/lab_test_group_template.json new file mode 100644 index 0000000000..beea7a357e --- /dev/null +++ b/erpnext/healthcare/doctype/lab_test_group_template/lab_test_group_template.json @@ -0,0 +1,118 @@ +{ + "actions": [], + "allow_copy": 1, + "beta": 1, + "creation": "2016-03-29 17:37:29.913583", + "doctype": "DocType", + "document_type": "Setup", + "engine": "InnoDB", + "field_order": [ + "template_or_new_line", + "lab_test_template", + "lab_test_rate", + "lab_test_description", + "group_event", + "group_test_uom", + "secondary_uom", + "conversion_factor", + "allow_blank", + "column_break_8", + "group_test_normal_range" + ], + "fields": [ + { + "default": "Add Test", + "fieldname": "template_or_new_line", + "fieldtype": "Select", + "options": "Add Test\nAdd New Line", + "print_hide": 1, + "report_hide": 1 + }, + { + "depends_on": "eval:doc.template_or_new_line == 'Add Test'", + "fieldname": "lab_test_template", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "in_list_view": 1, + "label": "Test Name", + "options": "Lab Test Template" + }, + { + "fetch_from": "lab_test_template.lab_test_rate", + "fieldname": "lab_test_rate", + "fieldtype": "Currency", + "label": "Rate", + "print_hide": 1, + "read_only": 1, + "report_hide": 1 + }, + { + "fetch_from": "lab_test_template.lab_test_description", + "fieldname": "lab_test_description", + "fieldtype": "Data", + "ignore_xss_filter": 1, + "in_list_view": 1, + "label": "Description", + "read_only": 1 + }, + { + "depends_on": "eval:doc.template_or_new_line == 'Add New Line'", + "fieldname": "group_event", + "fieldtype": "Data", + "ignore_xss_filter": 1, + "in_list_view": 1, + "label": "Event" + }, + { + "depends_on": "eval:doc.template_or_new_line =='Add New Line'", + "fieldname": "group_test_uom", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "UOM", + "options": "Lab Test UOM" + }, + { + "depends_on": "eval:doc.template_or_new_line == 'Add New Line'", + "fieldname": "group_test_normal_range", + "fieldtype": "Long Text", + "ignore_xss_filter": 1, + "label": "Normal Range" + }, + { + "fieldname": "column_break_8", + "fieldtype": "Column Break" + }, + { + "depends_on": "eval:doc.template_or_new_line =='Add New Line'", + "fieldname": "secondary_uom", + "fieldtype": "Link", + "label": "Secondary UOM", + "options": "Lab Test UOM" + }, + { + "depends_on": "secondary_uom", + "fieldname": "conversion_factor", + "fieldtype": "Float", + "label": "Conversion Factor" + }, + { + "default": "0", + "depends_on": "eval:doc.template_or_new_line == 'Add New Line'", + "fieldname": "allow_blank", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Allow Blank" + } + ], + "istable": 1, + "links": [], + "modified": "2020-06-24 10:59:01.921924", + "modified_by": "Administrator", + "module": "Healthcare", + "name": "Lab Test Group Template", + "owner": "Administrator", + "permissions": [], + "restrict_to_domain": "Healthcare", + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.py b/erpnext/healthcare/doctype/lab_test_group_template/lab_test_group_template.py similarity index 84% rename from erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.py rename to erpnext/healthcare/doctype/lab_test_group_template/lab_test_group_template.py index c67531c179..1e2cef4e18 100644 --- a/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.py +++ b/erpnext/healthcare/doctype/lab_test_group_template/lab_test_group_template.py @@ -5,5 +5,5 @@ from __future__ import unicode_literals from frappe.model.document import Document -class LabTestGroups(Document): +class LabTestGroupTemplate(Document): pass diff --git a/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.json b/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.json deleted file mode 100644 index e51d8b7557..0000000000 --- a/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.json +++ /dev/null @@ -1,310 +0,0 @@ -{ - "allow_copy": 1, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 1, - "creation": "2016-03-29 17:37:29.913583", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "Setup", - "editable_grid": 0, - "fields": [ - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "Add Test", - "depends_on": "", - "fieldname": "template_or_new_line", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "", - "length": 0, - "no_copy": 0, - "options": "Add Test\nAdd new line", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 1, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.template_or_new_line == 'Add Test'", - "fieldname": "lab_test_template", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Test Name", - "length": 0, - "no_copy": 0, - "options": "Lab Test Template", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_from": "lab_test_template.lab_test_rate", - "fieldname": "lab_test_rate", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Rate", - "length": 0, - "no_copy": 0, - "options": "", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 1, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_from": "lab_test_template.lab_test_description", - "fieldname": "lab_test_description", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 1, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Description", - "length": 0, - "no_copy": 0, - "options": "", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.template_or_new_line == 'Add new line'", - "fieldname": "group_event", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 1, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Event", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.template_or_new_line =='Add new line'", - "fieldname": "group_test_uom", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "UOM", - "length": 0, - "no_copy": 0, - "options": "Lab Test UOM", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.template_or_new_line == 'Add new line'", - "fieldname": "group_test_normal_range", - "fieldtype": "Long Text", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 1, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Normal Range", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_8", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2018-09-04 09:49:24.817787", - "modified_by": "Administrator", - "module": "Healthcare", - "name": "Lab Test Groups", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "restrict_to_domain": "Healthcare", - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 0, - "track_seen": 0, - "track_views": 0 -} \ No newline at end of file diff --git a/erpnext/healthcare/doctype/lab_test_template/lab_test_template.js b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.js index c3eedbbdf1..2e41f518f0 100644 --- a/erpnext/healthcare/doctype/lab_test_template/lab_test_template.js +++ b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.js @@ -1,25 +1,25 @@ // Copyright (c) 2016, ESS // License: ESS license.txt -frappe.ui.form.on("Lab Test Template",{ +frappe.ui.form.on('Lab Test Template', { lab_test_name: function(frm) { if (!frm.doc.lab_test_code) - frm.set_value("lab_test_code", frm.doc.lab_test_name); + frm.set_value('lab_test_code', frm.doc.lab_test_name); if (!frm.doc.lab_test_description) - frm.set_value("lab_test_description", frm.doc.lab_test_name); + frm.set_value('lab_test_description', frm.doc.lab_test_name); }, - refresh: function(frm) { - // Restrict Special, Grouped type templates in Child TestGroups - frm.set_query("lab_test_template", "lab_test_groups", function() { + refresh : function(frm) { + // Restrict Special, Grouped type templates in Child Test Groups + frm.set_query('lab_test_template', 'lab_test_groups', function() { return { filters: { - lab_test_template_type: ['in',['Single','Compound']] + lab_test_template_type: ['in', ['Single','Compound']] } }; }); }, medical_code: function(frm) { - frm.set_query("medical_code", function() { + frm.set_query('medical_code', function() { return { filters: { medical_code_standard: frm.doc.medical_code_standard @@ -30,10 +30,10 @@ frappe.ui.form.on("Lab Test Template",{ }); cur_frm.cscript.custom_refresh = function(doc) { - cur_frm.set_df_property("lab_test_code", "read_only", doc.__islocal ? 0 : 1); + cur_frm.set_df_property('lab_test_code', 'read_only', doc.__islocal ? 0 : 1); if (!doc.__islocal) { - cur_frm.add_custom_button(__("Change Template Code"), function() { + cur_frm.add_custom_button(__('Change Template Code'), function() { change_template_code(doc); }); } @@ -41,12 +41,12 @@ cur_frm.cscript.custom_refresh = function(doc) { let change_template_code = function(doc) { let d = new frappe.ui.Dialog({ - title:__("Change Template Code"), + title:__('Change Template Code'), fields:[ { - "fieldtype": "Data", - "label": "Lab Test Template Code", - "fieldname": "lab_test_code", + 'fieldtype': 'Data', + 'label': 'Lab Test Template Code', + 'fieldname': 'lab_test_code', reqd: 1 } ], @@ -54,49 +54,44 @@ let change_template_code = function(doc) { let values = d.get_values(); if (values) { frappe.call({ - "method": "erpnext.healthcare.doctype.lab_test_template.lab_test_template.change_test_code_from_template", - "args": {lab_test_code: values.lab_test_code, doc: doc}, + 'method': 'erpnext.healthcare.doctype.lab_test_template.lab_test_template.change_test_code_from_template', + 'args': {lab_test_code: values.lab_test_code, doc: doc}, callback: function (data) { - frappe.set_route("Form", "Lab Test Template", data.message); + frappe.set_route('Form', 'Lab Test Template', data.message); } }); } d.hide(); }, - primary_action_label: __("Change Template Code") + primary_action_label: __('Change Template Code') }); d.show(); d.set_values({ - "lab_test_code": doc.lab_test_code + 'lab_test_code': doc.lab_test_code }); }; -frappe.ui.form.on("Lab Test Template", "lab_test_name", function(frm){ - +frappe.ui.form.on('Lab Test Template', 'lab_test_name', function(frm) { frm.doc.change_in_item = 1; - -}); -frappe.ui.form.on("Lab Test Template", "lab_test_rate", function(frm){ - - frm.doc.change_in_item = 1; - -}); -frappe.ui.form.on("Lab Test Template", "lab_test_group", function(frm){ - - frm.doc.change_in_item = 1; - -}); -frappe.ui.form.on("Lab Test Template", "lab_test_description", function(frm){ - - frm.doc.change_in_item = 1; - }); -frappe.ui.form.on("Lab Test Groups", "template_or_new_line", function (frm, cdt, cdn) { +frappe.ui.form.on('Lab Test Template', 'lab_test_rate', function(frm) { + frm.doc.change_in_item = 1; +}); + +frappe.ui.form.on('Lab Test Template', 'lab_test_group', function(frm) { + frm.doc.change_in_item = 1; +}); + +frappe.ui.form.on('Lab Test Template', 'lab_test_description', function(frm) { + frm.doc.change_in_item = 1; +}); + +frappe.ui.form.on('Lab Test Groups', 'template_or_new_line', function (frm, cdt, cdn) { let child = locals[cdt][cdn]; - if (child.template_or_new_line == "Add new line") { - frappe.model.set_value(cdt, cdn, 'lab_test_template', ""); - frappe.model.set_value(cdt, cdn, 'lab_test_description', ""); + if (child.template_or_new_line == 'Add New Line') { + frappe.model.set_value(cdt, cdn, 'lab_test_template', ''); + frappe.model.set_value(cdt, cdn, 'lab_test_description', ''); } }); diff --git a/erpnext/healthcare/doctype/lab_test_template/lab_test_template.json b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.json index ebd2ec0246..db64297269 100644 --- a/erpnext/healthcare/doctype/lab_test_template/lab_test_template.json +++ b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.json @@ -15,31 +15,38 @@ "lab_test_group", "department", "column_break_3", - "lab_test_template_type", "disabled", + "lab_test_template_type", "is_billable", "lab_test_rate", - "medical_coding_section", - "medical_code_standard", - "medical_code", + "section_break_description", + "lab_test_description", "section_break_normal", "lab_test_uom", - "lab_test_normal_range", + "secondary_uom", + "conversion_factor", "column_break_10", + "lab_test_normal_range", "section_break_compound", "normal_test_templates", "section_break_special", "sensitivity", - "special_test_template", + "descriptive_test_templates", "section_break_group", "lab_test_groups", - "section_break_description", - "lab_test_description", + "medical_coding_section", + "medical_code_standard", + "medical_code", "sb_sample_collection", "sample", "sample_uom", "sample_qty", "sample_details", + "worksheet_section", + "worksheet_instructions", + "result_legend_section", + "legend_print_position", + "result_legend", "change_in_item" ], "fields": [ @@ -95,7 +102,7 @@ "fieldtype": "Column Break" }, { - "description": "Single for results which require only a single input, result UOM and normal value \n
\nCompound for results which require multiple input fields with corresponding event names, result UOMs and normal values\n
\nDescriptive for tests which have multiple result components and corresponding result entry fields. \n
\nGrouped for test templates which are a group of other test templates.\n
\nNo Result for tests with no results. Also, no Lab Test is created. e.g.. Sub Tests for Grouped results.", + "description": "Single: Results which require only a single input.\n
\nCompound: Results which require multiple event inputs.\n
\nDescriptive: Tests which have multiple result components with manual result entry.\n
\nGrouped: Test templates which are a group of other test templates.\n
\nNo Result: Tests with no results, can be ordered and billed but no Lab Test will be created. e.g.. Sub Tests for Grouped results", "fieldname": "lab_test_template_type", "fieldtype": "Select", "in_standard_filter": 1, @@ -120,6 +127,24 @@ "label": "Rate", "mandatory_depends_on": "eval:doc.is_billable == 1" }, + { + "fieldname": "medical_coding_section", + "fieldtype": "Section Break", + "label": "Medical Coding" + }, + { + "depends_on": "medical_code_standard", + "fieldname": "medical_code", + "fieldtype": "Link", + "label": "Medical Code", + "options": "Medical Code" + }, + { + "fieldname": "medical_code_standard", + "fieldtype": "Link", + "label": "Medical Code Standard", + "options": "Medical Code Standard" + }, { "depends_on": "eval:doc.lab_test_template_type == 'Single'", "fieldname": "section_break_normal", @@ -159,7 +184,7 @@ "depends_on": "eval:doc.lab_test_template_type == 'Descriptive'", "fieldname": "section_break_special", "fieldtype": "Section Break", - "label": "Special" + "label": "Descriptive" }, { "default": "0", @@ -167,11 +192,6 @@ "fieldtype": "Check", "label": "Sensitivity" }, - { - "fieldname": "special_test_template", - "fieldtype": "Table", - "options": "Special Test Template" - }, { "depends_on": "eval:doc.lab_test_template_type == 'Grouped'", "fieldname": "section_break_group", @@ -181,20 +201,23 @@ { "fieldname": "lab_test_groups", "fieldtype": "Table", - "options": "Lab Test Groups" + "options": "Lab Test Group Template" }, { + "collapsible": 1, "fieldname": "section_break_description", - "fieldtype": "Section Break" + "fieldtype": "Section Break", + "label": "Description " }, { "fieldname": "lab_test_description", - "fieldtype": "Text", + "fieldtype": "Text Editor", "ignore_xss_filter": 1, "label": "Description", "no_copy": 1 }, { + "collapsible": 1, "fieldname": "sb_sample_collection", "fieldtype": "Section Break", "label": "Sample Collection" @@ -237,32 +260,61 @@ }, { "fieldname": "sample_details", - "fieldtype": "Text", + "fieldtype": "Small Text", "ignore_xss_filter": 1, "label": "Collection Details" }, { "collapsible": 1, - "fieldname": "medical_coding_section", + "description": "Information to help easily interpret the test report, will be printed as part of the Lab Test result.", + "fieldname": "result_legend_section", "fieldtype": "Section Break", - "label": "Medical Coding" + "label": "Result Legend Print" }, { - "depends_on": "medical_code_standard", - "fieldname": "medical_code", - "fieldtype": "Link", - "label": "Medical Code", - "options": "Medical Code" + "fieldname": "result_legend", + "fieldtype": "Text Editor", + "label": "Result Legend" }, { - "fieldname": "medical_code_standard", + "fieldname": "legend_print_position", + "fieldtype": "Select", + "label": "Print Position", + "options": "Bottom\nTop\nBoth" + }, + { + "fieldname": "secondary_uom", "fieldtype": "Link", - "label": "Medical Code Standard", - "options": "Medical Code Standard" + "label": "Secondary UOM", + "options": "Lab Test UOM" + }, + { + "depends_on": "secondary_uom", + "fieldname": "conversion_factor", + "fieldtype": "Float", + "label": "Conversion Factor", + "mandatory_depends_on": "secondary_uom" + }, + { + "description": "Instructions to be printed on the worksheet", + "fieldname": "worksheet_instructions", + "fieldtype": "Text Editor", + "label": "Worksheet Instructions" + }, + { + "collapsible": 1, + "fieldname": "worksheet_section", + "fieldtype": "Section Break", + "label": "Worksheet Print" + }, + { + "fieldname": "descriptive_test_templates", + "fieldtype": "Table", + "options": "Descriptive Test Template" } ], "links": [], - "modified": "2020-06-29 14:07:20.772219", + "modified": "2020-07-13 12:57:09.925436", "modified_by": "Administrator", "module": "Healthcare", "name": "Lab Test Template", diff --git a/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py index 3521561f34..6f0d08cf85 100644 --- a/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py +++ b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py @@ -14,37 +14,37 @@ class LabTestTemplate(Document): create_item_from_template(self) def validate(self): + if self.is_billable and (not self.lab_test_rate or self.lab_test_rate <= 0.0): + frappe.throw(_("Standard Selling Rate should be greater than zero.")) + self.validate_conversion_factor() self.enable_disable_item() def on_update(self): - # if change_in_item update Item and Price List + # If change_in_item update Item and Price List if self.change_in_item and self.is_billable and self.item: self.update_item() item_price = self.item_price_exists() if not item_price: - if self.lab_test_rate != 0.0: - price_list_name = frappe.db.get_value("Price List", {"selling": 1}) - if self.lab_test_rate: - make_item_price(self.lab_test_code, price_list_name, self.lab_test_rate) - else: - make_item_price(self.lab_test_code, price_list_name, 0.0) + if self.lab_test_rate and self.lab_test_rate > 0.0: + price_list_name = frappe.db.get_value('Price List', {'selling': 1}) + make_item_price(self.lab_test_code, price_list_name, self.lab_test_rate) else: - frappe.db.set_value("Item Price", item_price, "price_list_rate", self.lab_test_rate) + frappe.db.set_value('Item Price', item_price, 'price_list_rate', self.lab_test_rate) - frappe.db.set_value(self.doctype, self.name, "change_in_item", 0) + self.db_set('change_in_item', 0) elif not self.is_billable and self.item: - frappe.db.set_value("Item", self.item, "disabled", 1) + frappe.db.set_value('Item', self.item, 'disabled', 1) self.reload() def on_trash(self): - # remove template reference from item and disable item + # Remove template reference from item and disable item if self.item: try: - frappe.delete_doc("Item", self.item) + frappe.delete_doc('Item', self.item) except Exception: - frappe.throw(_("Not permitted. Please disable the Lab Test Template")) + frappe.throw(_('Not permitted. Please disable the Lab Test Template')) def enable_disable_item(self): if self.is_billable: @@ -54,78 +54,86 @@ class LabTestTemplate(Document): frappe.db.set_value('Item', self.item, 'disabled', 0) def update_item(self): - item = frappe.get_doc("Item", self.item) + item = frappe.get_doc('Item', self.item) if item: item.update({ - "item_name": self.lab_test_name, - "item_group": self.lab_test_group, - "disabled": 0, - "standard_rate": self.lab_test_rate, - "description": self.lab_test_description + 'item_name': self.lab_test_name, + 'item_group': self.lab_test_group, + 'disabled': 0, + 'standard_rate': self.lab_test_rate, + 'description': self.lab_test_description }) item.save() def item_price_exists(self): - item_price = frappe.db.exists({"doctype": "Item Price", "item_code": self.lab_test_code}) + item_price = frappe.db.exists({'doctype': 'Item Price', 'item_code': self.lab_test_code}) if item_price: return item_price[0][0] else: return False + def validate_conversion_factor(self): + if self.lab_test_template_type == "Single" and self.secondary_uom and not self.conversion_factor: + frappe.throw(_("Conversion Factor is mandatory")) + if self.lab_test_template_type == "Compound": + for item in self.normal_test_templates: + if item.secondary_uom and not item.conversion_factor: + frappe.throw(_("Conversion Factor is mandatory")) + if self.lab_test_template_type == "Grouped": + for group in self.lab_test_groups: + if group.template_or_new_line == "Add New Line" and group.secondary_uom and not group.conversion_factor: + frappe.throw(_("Conversion Factor is mandatory")) + def create_item_from_template(doc): - disabled = doc.disabled - if doc.is_billable and not doc.disabled: - disabled = 0 - uom = frappe.db.exists('UOM', 'Unit') or frappe.db.get_single_value('Stock Settings', 'stock_uom') - # insert item + # Insert item item = frappe.get_doc({ - "doctype": "Item", - "item_code": doc.lab_test_code, - "item_name":doc.lab_test_name, - "item_group": doc.lab_test_group, - "description":doc.lab_test_description, - "is_sales_item": 1, - "is_service_item": 1, - "is_purchase_item": 0, - "is_stock_item": 0, - "show_in_website": 0, - "is_pro_applicable": 0, - "disabled": disabled, - "stock_uom": uom - }).insert(ignore_permissions=True, ignore_mandatory=True) + 'doctype': 'Item', + 'item_code': doc.lab_test_code, + 'item_name':doc.lab_test_name, + 'item_group': doc.lab_test_group, + 'description':doc.lab_test_description, + 'is_sales_item': 1, + 'is_service_item': 1, + 'is_purchase_item': 0, + 'is_stock_item': 0, + 'include_item_in_manufacturing': 0, + 'show_in_website': 0, + 'is_pro_applicable': 0, + 'disabled': 0 if doc.is_billable and not doc.disabled else doc.disabled, + 'stock_uom': uom + }).insert(ignore_permissions = True, ignore_mandatory = True) - # insert item price - # get item price list to insert item price - if doc.lab_test_rate != 0.0: - price_list_name = frappe.db.get_value("Price List", {"selling": 1}) + # Insert item price + if doc.is_billable and doc.lab_test_rate != 0.0: + price_list_name = frappe.db.get_value('Price List', {'selling': 1}) if doc.lab_test_rate: make_item_price(item.name, price_list_name, doc.lab_test_rate) else: make_item_price(item.name, price_list_name, 0.0) # Set item in the template - frappe.db.set_value("Lab Test Template", doc.name, "item", item.name) + frappe.db.set_value('Lab Test Template', doc.name, 'item', item.name) doc.reload() def make_item_price(item, price_list_name, item_price): frappe.get_doc({ - "doctype": "Item Price", - "price_list": price_list_name, - "item_code": item, - "price_list_rate": item_price - }).insert(ignore_permissions=True, ignore_mandatory=True) + 'doctype': 'Item Price', + 'price_list': price_list_name, + 'item_code': item, + 'price_list_rate': item_price + }).insert(ignore_permissions = True, ignore_mandatory = True) @frappe.whitelist() def change_test_code_from_template(lab_test_code, doc): doc = frappe._dict(json.loads(doc)) - if frappe.db.exists({ "doctype": "Item", "item_code": lab_test_code}): - frappe.throw(_("Lab Test Item {0} already exist").format(lab_test_code)) + if frappe.db.exists({'doctype': 'Item', 'item_code': lab_test_code}): + frappe.throw(_('Lab Test Item {0} already exist').format(lab_test_code)) else: - rename_doc("Item", doc.name, lab_test_code, ignore_permissions=True) - frappe.db.set_value("Lab Test Template", doc.name, "lab_test_code", lab_test_code) - frappe.db.set_value("Lab Test Template", doc.name, "lab_test_name", lab_test_code) - rename_doc("Lab Test Template", doc.name, lab_test_code, ignore_permissions=True) - return lab_test_code \ No newline at end of file + rename_doc('Item', doc.name, lab_test_code, ignore_permissions = True) + frappe.db.set_value('Lab Test Template', doc.name, 'lab_test_code', lab_test_code) + frappe.db.set_value('Lab Test Template', doc.name, 'lab_test_name', lab_test_code) + rename_doc('Lab Test Template', doc.name, lab_test_code, ignore_permissions = True) + return lab_test_code diff --git a/erpnext/healthcare/doctype/lab_test_template/lab_test_template_list.js b/erpnext/healthcare/doctype/lab_test_template/lab_test_template_list.js index a86075fc94..a3417ebdfc 100644 --- a/erpnext/healthcare/doctype/lab_test_template/lab_test_template_list.js +++ b/erpnext/healthcare/doctype/lab_test_template/lab_test_template_list.js @@ -2,6 +2,6 @@ (c) ESS 2015-16 */ frappe.listview_settings['Lab Test Template'] = { - add_fields: ["lab_test_name", "lab_test_code", "lab_test_rate"], - filters: [["disabled", "=", 0]] + add_fields: ['lab_test_name', 'lab_test_code', 'lab_test_rate'], + filters: [['disabled', '=', 0]] }; diff --git a/erpnext/healthcare/doctype/normal_test_items/normal_test_items.js b/erpnext/healthcare/doctype/normal_test_items/normal_test_items.js deleted file mode 100644 index 0371ddd5c9..0000000000 --- a/erpnext/healthcare/doctype/normal_test_items/normal_test_items.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2016, ESS -// License: ESS license.txt - - diff --git a/erpnext/healthcare/doctype/normal_test_items/normal_test_items.json b/erpnext/healthcare/doctype/normal_test_items/normal_test_items.json deleted file mode 100644 index a7a952b8cd..0000000000 --- a/erpnext/healthcare/doctype/normal_test_items/normal_test_items.json +++ /dev/null @@ -1,301 +0,0 @@ -{ - "allow_copy": 1, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 1, - "creation": "2016-02-22 15:06:08.295224", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "Document", - "editable_grid": 1, - "fields": [ - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "lab_test_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 1, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Test Name", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "lab_test_event", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 1, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Event", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.require_result_value == 1 ", - "fieldname": "result_value", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 1, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Result Value", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "lab_test_uom", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "UOM", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "normal_range", - "fieldtype": "Long Text", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 1, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Normal Range", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "lab_test_comment", - "fieldtype": "Data", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Comment", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 1, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "0", - "fieldname": "require_result_value", - "fieldtype": "Check", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Require Result Value", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 1, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "template", - "fieldtype": "Link", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Template", - "length": 0, - "no_copy": 0, - "options": "Lab Test Template", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 1, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2018-09-04 11:42:43.095726", - "modified_by": "Administrator", - "module": "Healthcare", - "name": "Normal Test Items", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "restrict_to_domain": "Healthcare", - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 0, - "track_seen": 0, - "track_views": 0 -} \ No newline at end of file diff --git a/erpnext/healthcare/doctype/special_test_items/__init__.py b/erpnext/healthcare/doctype/normal_test_result/__init__.py similarity index 100% rename from erpnext/healthcare/doctype/special_test_items/__init__.py rename to erpnext/healthcare/doctype/normal_test_result/__init__.py diff --git a/erpnext/healthcare/doctype/normal_test_result/normal_test_result.json b/erpnext/healthcare/doctype/normal_test_result/normal_test_result.json new file mode 100644 index 0000000000..c8f43d3a54 --- /dev/null +++ b/erpnext/healthcare/doctype/normal_test_result/normal_test_result.json @@ -0,0 +1,186 @@ +{ + "actions": [], + "allow_copy": 1, + "beta": 1, + "creation": "2016-02-22 15:06:08.295224", + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "lab_test_name", + "lab_test_event", + "result_value", + "lab_test_uom", + "secondary_uom_result", + "secondary_uom", + "conversion_factor", + "column_break_10", + "allow_blank", + "normal_range", + "lab_test_comment", + "bold", + "italic", + "underline", + "template", + "require_result_value" + ], + "fields": [ + { + "fieldname": "lab_test_name", + "fieldtype": "Data", + "ignore_xss_filter": 1, + "in_list_view": 1, + "label": "Test Name", + "read_only": 1 + }, + { + "fieldname": "lab_test_event", + "fieldtype": "Data", + "ignore_xss_filter": 1, + "in_list_view": 1, + "label": "Event", + "read_only": 1 + }, + { + "depends_on": "eval:doc.require_result_value", + "fieldname": "result_value", + "fieldtype": "Data", + "ignore_xss_filter": 1, + "in_list_view": 1, + "label": "Result Value" + }, + { + "depends_on": "eval:doc.require_result_value", + "fieldname": "lab_test_uom", + "fieldtype": "Link", + "label": "UOM", + "options": "Lab Test UOM", + "read_only": 1 + }, + { + "depends_on": "eval:doc.require_result_value", + "fieldname": "normal_range", + "fieldtype": "Long Text", + "ignore_xss_filter": 1, + "in_list_view": 1, + "label": "Normal Range", + "read_only": 1 + }, + { + "depends_on": "eval:doc.require_result_value", + "fieldname": "lab_test_comment", + "fieldtype": "Data", + "hidden": 1, + "in_list_view": 1, + "label": "Comment", + "no_copy": 1, + "print_hide": 1, + "report_hide": 1 + }, + { + "fieldname": "template", + "fieldtype": "Link", + "hidden": 1, + "label": "Template", + "options": "Lab Test Template", + "print_hide": 1, + "report_hide": 1 + }, + { + "depends_on": "eval:doc.require_result_value", + "fieldname": "secondary_uom", + "fieldtype": "Link", + "label": "Secondary UOM", + "options": "Lab Test UOM", + "print_hide": 1, + "read_only": 1 + }, + { + "depends_on": "secondary_uom", + "fieldname": "conversion_factor", + "fieldtype": "Float", + "label": "Conversion Factor", + "mandatory_depends_on": "secondary_uom", + "print_hide": 1, + "read_only": 1 + }, + { + "depends_on": "eval:doc.require_result_value && doc.result_value", + "fieldname": "secondary_uom_result", + "fieldtype": "Data", + "label": "Secondary UOM Result", + "no_copy": 1, + "print_hide": 1, + "read_only": 1 + }, + { + "allow_on_submit": 1, + "default": "0", + "depends_on": "eval:doc.require_result_value", + "fieldname": "bold", + "fieldtype": "Check", + "label": "Bold", + "no_copy": 1, + "print_hide": 1, + "report_hide": 1 + }, + { + "allow_on_submit": 1, + "default": "0", + "depends_on": "eval:doc.require_result_value", + "fieldname": "italic", + "fieldtype": "Check", + "label": "Italic", + "no_copy": 1, + "print_hide": 1, + "report_hide": 1 + }, + { + "allow_on_submit": 1, + "default": "0", + "depends_on": "eval:doc.require_result_value", + "fieldname": "underline", + "fieldtype": "Check", + "label": "Underline", + "no_copy": 1, + "print_hide": 1, + "report_hide": 1 + }, + { + "fieldname": "column_break_10", + "fieldtype": "Column Break" + }, + { + "default": "0", + "fieldname": "require_result_value", + "fieldtype": "Check", + "hidden": 1, + "label": "Require Result Value", + "print_hide": 1, + "read_only": 1, + "report_hide": 1 + }, + { + "default": "1", + "depends_on": "eval:doc.require_result_value", + "fieldname": "allow_blank", + "fieldtype": "Check", + "label": "Allow Blank", + "print_hide": 1, + "read_only": 1, + "report_hide": 1 + } + ], + "istable": 1, + "links": [], + "modified": "2020-07-08 16:03:17.522893", + "modified_by": "Administrator", + "module": "Healthcare", + "name": "Normal Test Result", + "owner": "Administrator", + "permissions": [], + "restrict_to_domain": "Healthcare", + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/healthcare/doctype/normal_test_items/normal_test_items.py b/erpnext/healthcare/doctype/normal_test_result/normal_test_result.py similarity index 85% rename from erpnext/healthcare/doctype/normal_test_items/normal_test_items.py rename to erpnext/healthcare/doctype/normal_test_result/normal_test_result.py index a0069d7252..63abf0297e 100644 --- a/erpnext/healthcare/doctype/normal_test_items/normal_test_items.py +++ b/erpnext/healthcare/doctype/normal_test_result/normal_test_result.py @@ -5,5 +5,5 @@ from __future__ import unicode_literals from frappe.model.document import Document -class NormalTestItems(Document): +class NormalTestResult(Document): pass diff --git a/erpnext/healthcare/doctype/normal_test_template/normal_test_template.json b/erpnext/healthcare/doctype/normal_test_template/normal_test_template.json index a36c28d070..8dd6476ea8 100644 --- a/erpnext/healthcare/doctype/normal_test_template/normal_test_template.json +++ b/erpnext/healthcare/doctype/normal_test_template/normal_test_template.json @@ -1,202 +1,84 @@ { - "allow_copy": 1, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 1, - "creation": "2016-02-22 16:09:54.310628", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "Setup", - "editable_grid": 1, + "actions": [], + "allow_copy": 1, + "beta": 1, + "creation": "2016-02-22 16:09:54.310628", + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "heading_text", + "lab_test_event", + "allow_blank", + "lab_test_uom", + "secondary_uom", + "conversion_factor", + "column_break_5", + "normal_range" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "heading_text", - "fieldtype": "Heading", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 1, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Test", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "heading_text", + "fieldtype": "Heading", + "ignore_xss_filter": 1, + "label": "Test" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "lab_test_event", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 1, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Event", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "lab_test_event", + "fieldtype": "Data", + "ignore_xss_filter": 1, + "in_list_view": 1, + "label": "Event" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "lab_test_uom", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "UOM", - "length": 0, - "no_copy": 0, - "options": "Lab Test UOM", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "lab_test_uom", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "in_list_view": 1, + "label": "UOM", + "options": "Lab Test UOM" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "normal_range", - "fieldtype": "Long Text", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 1, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Normal Range", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "normal_range", + "fieldtype": "Long Text", + "ignore_xss_filter": 1, + "in_list_view": 1, + "label": "Normal Range" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_5", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "fieldname": "column_break_5", + "fieldtype": "Column Break" + }, + { + "fieldname": "secondary_uom", + "fieldtype": "Link", + "label": "Secondary UOM", + "options": "Lab Test UOM" + }, + { + "depends_on": "secondary_uom", + "fieldname": "conversion_factor", + "fieldtype": "Float", + "label": "Conversion Factor", + "mandatory_depends_on": "secondary_uom" + }, + { + "default": "0", + "fieldname": "allow_blank", + "fieldtype": "Check", + "label": "Allow Blank" } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2018-09-04 11:42:30.766950", - "modified_by": "Administrator", - "module": "Healthcare", - "name": "Normal Test Template", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "restrict_to_domain": "Healthcare", - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 0, - "track_seen": 0, - "track_views": 0 + ], + "istable": 1, + "links": [], + "modified": "2020-06-23 13:28:40.156224", + "modified_by": "Administrator", + "module": "Healthcare", + "name": "Normal Test Template", + "owner": "Administrator", + "permissions": [], + "restrict_to_domain": "Healthcare", + "sort_field": "modified", + "sort_order": "DESC" } \ No newline at end of file diff --git a/erpnext/healthcare/doctype/special_test_template/__init__.py b/erpnext/healthcare/doctype/organism/__init__.py similarity index 100% rename from erpnext/healthcare/doctype/special_test_template/__init__.py rename to erpnext/healthcare/doctype/organism/__init__.py diff --git a/erpnext/healthcare/doctype/organism/organism.js b/erpnext/healthcare/doctype/organism/organism.js new file mode 100644 index 0000000000..fbcb0942e9 --- /dev/null +++ b/erpnext/healthcare/doctype/organism/organism.js @@ -0,0 +1,5 @@ +// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Organism', { +}); diff --git a/erpnext/healthcare/doctype/organism/organism.json b/erpnext/healthcare/doctype/organism/organism.json new file mode 100644 index 0000000000..88a7686777 --- /dev/null +++ b/erpnext/healthcare/doctype/organism/organism.json @@ -0,0 +1,152 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:organism", + "beta": 1, + "creation": "2019-09-06 16:29:07.797960", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "organism", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Organism", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 1 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "abbr", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Abbr", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 1 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-10-04 19:45:33.353753", + "modified_by": "Administrator", + "module": "Healthcare", + "name": "Organism", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Healthcare Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "restrict_to_domain": "Healthcare", + "search_fields": "organism, abbr", + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "organism", + "track_changes": 0, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/erpnext/healthcare/doctype/organism/organism.py b/erpnext/healthcare/doctype/organism/organism.py new file mode 100644 index 0000000000..1ead762c2f --- /dev/null +++ b/erpnext/healthcare/doctype/organism/organism.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +from frappe.model.document import Document + +class Organism(Document): + pass diff --git a/erpnext/healthcare/doctype/organism/test_organism.js b/erpnext/healthcare/doctype/organism/test_organism.js new file mode 100644 index 0000000000..d57e5536c6 --- /dev/null +++ b/erpnext/healthcare/doctype/organism/test_organism.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Organism", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Organism + () => frappe.tests.make('Organism', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/erpnext/healthcare/doctype/organism/test_organism.py b/erpnext/healthcare/doctype/organism/test_organism.py new file mode 100644 index 0000000000..ecb96650e1 --- /dev/null +++ b/erpnext/healthcare/doctype/organism/test_organism.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals +import unittest + +class TestOrganism(unittest.TestCase): + pass diff --git a/erpnext/healthcare/doctype/organism_test_item/__init__.py b/erpnext/healthcare/doctype/organism_test_item/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/healthcare/doctype/organism_test_item/organism_test_item.json b/erpnext/healthcare/doctype/organism_test_item/organism_test_item.json new file mode 100644 index 0000000000..56d0a4d905 --- /dev/null +++ b/erpnext/healthcare/doctype/organism_test_item/organism_test_item.json @@ -0,0 +1,144 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 1, + "creation": "2019-09-06 16:37:59.698996", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "organism", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Organism", + "length": 0, + "no_copy": 0, + "options": "Organism", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "colony_population", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Colony Population", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "colony_uom", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Colony UOM", + "length": 0, + "no_copy": 0, + "options": "Lab Test UOM", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-10-04 19:48:04.104234", + "modified_by": "Administrator", + "module": "Healthcare", + "name": "Organism Test Item", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 0, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/erpnext/healthcare/doctype/organism_test_item/organism_test_item.py b/erpnext/healthcare/doctype/organism_test_item/organism_test_item.py new file mode 100644 index 0000000000..019a55b396 --- /dev/null +++ b/erpnext/healthcare/doctype/organism_test_item/organism_test_item.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +from frappe.model.document import Document + +class OrganismTestItem(Document): + pass diff --git a/erpnext/healthcare/doctype/organism_test_result/__init__.py b/erpnext/healthcare/doctype/organism_test_result/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/healthcare/doctype/organism_test_result/organism_test_result.json b/erpnext/healthcare/doctype/organism_test_result/organism_test_result.json new file mode 100644 index 0000000000..8b238de4cd --- /dev/null +++ b/erpnext/healthcare/doctype/organism_test_result/organism_test_result.json @@ -0,0 +1,144 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 1, + "creation": "2019-09-06 16:37:59.698996", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "organism", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Organism", + "length": 0, + "no_copy": 0, + "options": "Organism", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "colony_population", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Colony Population", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "colony_uom", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Colony UOM", + "length": 0, + "no_copy": 0, + "options": "Lab Test UOM", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-10-04 19:48:04.104234", + "modified_by": "Administrator", + "module": "Healthcare", + "name": "Organism Test Result", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 0, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/erpnext/healthcare/doctype/organism_test_result/organism_test_result.py b/erpnext/healthcare/doctype/organism_test_result/organism_test_result.py new file mode 100644 index 0000000000..02393c2700 --- /dev/null +++ b/erpnext/healthcare/doctype/organism_test_result/organism_test_result.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +from frappe.model.document import Document + +class OrganismTestResult(Document): + pass diff --git a/erpnext/healthcare/doctype/sensitivity_test_items/sensitivity_test_items.json b/erpnext/healthcare/doctype/sensitivity_test_items/sensitivity_test_items.json deleted file mode 100644 index 86f5e26f0a..0000000000 --- a/erpnext/healthcare/doctype/sensitivity_test_items/sensitivity_test_items.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "allow_copy": 1, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 1, - "creation": "2016-02-22 15:18:01.769903", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "Document", - "editable_grid": 1, - "fields": [ - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "antibiotic", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Antibiotic", - "length": 0, - "no_copy": 0, - "options": "Antibiotic", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "antibiotic_sensitivity", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Sensitivity", - "length": 0, - "no_copy": 0, - "options": "Sensitivity", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2017-10-05 11:08:06.327972", - "modified_by": "Administrator", - "module": "Healthcare", - "name": "Sensitivity Test Items", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "restrict_to_domain": "Healthcare", - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 0, - "track_seen": 0 -} \ No newline at end of file diff --git a/erpnext/healthcare/doctype/sensitivity_test_result/__init__.py b/erpnext/healthcare/doctype/sensitivity_test_result/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.json b/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.json new file mode 100644 index 0000000000..768c17710f --- /dev/null +++ b/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.json @@ -0,0 +1,103 @@ +{ + "allow_copy": 1, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 1, + "creation": "2016-02-22 15:18:01.769903", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "antibiotic", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Antibiotic", + "length": 0, + "no_copy": 0, + "options": "Antibiotic", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "antibiotic_sensitivity", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Sensitivity", + "length": 0, + "no_copy": 0, + "options": "Sensitivity", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-10-05 11:08:06.327972", + "modified_by": "Administrator", + "module": "Healthcare", + "name": "Sensitivity Test Result", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "restrict_to_domain": "Healthcare", + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 0, + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/healthcare/doctype/special_test_items/special_test_items.py b/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.py similarity index 84% rename from erpnext/healthcare/doctype/special_test_items/special_test_items.py rename to erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.py index 17080b7e3b..64f1e6ca25 100644 --- a/erpnext/healthcare/doctype/special_test_items/special_test_items.py +++ b/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.py @@ -5,5 +5,5 @@ from __future__ import unicode_literals from frappe.model.document import Document -class SpecialTestItems(Document): +class SensitivityTestResult(Document): pass diff --git a/erpnext/healthcare/doctype/special_test_items/special_test_items.json b/erpnext/healthcare/doctype/special_test_items/special_test_items.json deleted file mode 100644 index a15806e8a5..0000000000 --- a/erpnext/healthcare/doctype/special_test_items/special_test_items.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "allow_copy": 1, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 1, - "creation": "2016-02-22 15:12:36.202380", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "Document", - "editable_grid": 1, - "engine": "InnoDB", - "fields": [ - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "lab_test_particulars", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 1, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Particulars", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.require_result_value == 1", - "fieldname": "result_value", - "fieldtype": "Small Text", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 1, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Value", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": "", - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0, - "width": "" - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "require_result_value", - "fieldtype": "Check", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Require Result Value", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 1, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "template", - "fieldtype": "Link", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Template", - "length": 0, - "no_copy": 0, - "options": "Lab Test Template", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 1, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2018-09-04 12:01:18.801216", - "modified_by": "Administrator", - "module": "Healthcare", - "name": "Special Test Items", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "restrict_to_domain": "Healthcare", - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 0, - "track_seen": 0, - "track_views": 0 -} \ No newline at end of file diff --git a/erpnext/healthcare/doctype/special_test_template/special_test_template.json b/erpnext/healthcare/doctype/special_test_template/special_test_template.json deleted file mode 100644 index 372af0a959..0000000000 --- a/erpnext/healthcare/doctype/special_test_template/special_test_template.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "allow_copy": 1, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 1, - "creation": "2016-02-22 16:12:12.394200", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "Setup", - "editable_grid": 1, - "fields": [ - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "particulars", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 1, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Result Component", - "length": 0, - "no_copy": 0, - "options": "", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2017-10-04 16:20:09.565316", - "modified_by": "Administrator", - "module": "Healthcare", - "name": "Special Test Template", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "restrict_to_domain": "Healthcare", - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 0, - "track_seen": 0 -} \ No newline at end of file diff --git a/erpnext/healthcare/doctype/special_test_template/special_test_template.py b/erpnext/healthcare/doctype/special_test_template/special_test_template.py deleted file mode 100644 index e4e0d5b7bd..0000000000 --- a/erpnext/healthcare/doctype/special_test_template/special_test_template.py +++ /dev/null @@ -1,9 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, ESS and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -from frappe.model.document import Document - -class SpecialTestTemplate(Document): - pass diff --git a/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json b/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json index e8e95d8439..f7d16769c6 100644 --- a/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json +++ b/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json @@ -7,16 +7,17 @@ "docstatus": 0, "doctype": "Print Format", "font": "Default", - "html": "
\n {% if letter_head and not no_letterhead -%}\n
{{ letter_head }}
\n
\n {%- endif %}\n\n {% if (doc.docstatus != 1) %}\n Lab Tests have to be Submitted for Print .. !\n {% elif (frappe.db.get_value(\"Healthcare Settings\", \"None\", \"lab_test_approval_required\") == '1' and doc.approval_status != \"Approved\") %}\n Lab Tests have to be Approved for Print .. !\n {%- else -%}\n
\n
\n\n
\n
\n \n
\n {% if doc.patient %}\n
\n : {{doc.patient}}\n
\n {% else %}\n
\n : Patient Name\n
\n {%- endif -%}\n
\n\n
\n
\n \n
\n
\n : {{doc.patient_age}}\n
\n
\n\n
\n
\n \n
\n
\n : {{doc.patient_sex}}\n
\n
\n\n
\n\n
\n\n
\n
\n \n
\n {% if doc.practitioner %}\n
\n : {{doc.practitioner}}\n
\n {%- endif -%}\n
\n\n {% if doc.sample_date %}\n
\n
\n \n
\n
\n : {{doc.sample_date}}\n
\n
\n {%- endif -%}\n\n {% if doc.result_date %}\n
\n
\n \n
\n
\n : {{doc.result_date}}\n
\n
\n {%- endif -%}\n\n
\n\n
\n\n
\n

Department of {{doc.department}}

\n
\n\n \n \n {%- if doc.normal_test_items -%}\n \n \n \n \n \n\n {%- if doc.normal_test_items|length > 1 %}\n \n {%- endif -%}\n\n {%- for row in doc.normal_test_items -%}\n \n \n\n \n\n \n \n\n {%- endfor -%}\n {%- endif -%}\n \n
Name of TestResultNormal Range
{{ doc.lab_test_name }}
\n {%- if doc.normal_test_items|length > 1 %}  {%- endif -%}\n {%- if row.lab_test_name -%}{{ row.lab_test_name }}\n {%- else -%}   {%- endif -%}\n {%- if row.lab_test_event -%}   {{ row.lab_test_event }}{%- endif -%}\n \n {%- if row.result_value -%}{{ row.result_value }}{%- endif -%} \n {%- if row.lab_test_uom -%}{{ row.lab_test_uom }}{%- endif -%}\n \n
\n {%- if row.normal_range -%}{{ row.normal_range }}{%- endif -%}\n
\n
\n\n \n \n {%- if doc.special_test_items -%}\n \n \n \n \n \n {%- for row in doc.special_test_items -%}\n \n \n \n \n\n {%- endfor -%}\n {%- endif -%}\n\n {%- if doc.sensitivity_test_items -%}\n \n \n \n \n {%- for row in doc.sensitivity_test_items -%}\n \n \n \n \n\n {%- endfor -%}\n {%- endif -%}\n\n \n
Name of TestResult
{{ doc.lab_test_name }}
  {{ row.lab_test_particulars }} \n {%- if row.result_value -%}{{ row.result_value }}{%- endif -%}\n
AntibioticSensitivity
{{ row.antibiotic }} {{ row.antibiotic_sensitivity }}
\n {%- endif -%}\n\n
\n {%- if (frappe.db.get_value(\"Healthcare Settings\", \"None\", \"employee_name_and_designation_in_print\") == '1') -%}\n
{{doc.employee_name}}
\n
{{doc.employee_designation}}
\n {%- else -%}\n
{{frappe.db.get_value(\"Healthcare Settings\", \"None\", \"custom_signature_in_print\") }}
\n {%- endif -%}\n
\n
\n", + "html": "
\n {% if letter_head and not no_letterhead -%}\n
{{ letter_head }}
\n
\n {%- endif %}\n\n {% if (doc.docstatus != 1) %}\n

WORKSHEET

\n\t
\n\t
\n
\n\n
\n
\n \n
\n {% if doc.patient_name %}\n
\n {{ doc.patient_name }}\n
\n {% else %}\n
\n {{ doc.patient }}\n
\n {%- endif -%}\n
\n\n
\n
\n \n
\n
\n {{ doc.patient_age or '' }}\n
\n
\n\n
\n
\n \n
\n
\n {{ doc.patient_sex or '' }}\n
\n
\n\n
\n\n
\n\n
\n
\n \n
\n {% if doc.practitioner_name %}\n
\n {{ doc.practitioner_name }}\n
\n {% else %}\n\t\t\t{% if doc.referring_practitioner_name %}\n
\n {{ doc.referring_practitioner_name }}\n
\n\t\t {% endif %}\n {%- endif -%}\n
\n\n {% if doc.sample_date %}\n
\n
\n \n
\n
\n {{ doc.sample_date }}\n
\n
\n {%- endif -%}\n
\n
\n\n\t
\n

Department of {{ doc.department }}

\n
\n\n\t\n \n {%- if doc.normal_test_items -%}\n \n \n \n \n \n\n {%- if doc.normal_test_items|length > 1 %}\n \n {%- endif -%}\n\n {%- for row in doc.normal_test_items -%}\n \n \n\n \n\n \n \n\n {%- endfor -%}\n {%- endif -%}\n \n
Name of TestResultNormal Range
{{ doc.lab_test_name }}
\n {%- if doc.normal_test_items|length > 1 %}  {%- endif -%}\n {%- if row.lab_test_name -%}{{ row.lab_test_name }}\n {%- else -%}   {%- endif -%}\n {%- if row.lab_test_event -%}   {{ row.lab_test_event }}{%- endif -%}\n \n {%- if row.lab_test_uom -%} {{ row.lab_test_uom }}{%- endif -%}\n \n
\n {%- if row.normal_range -%}{{ row.normal_range }}{%- endif -%}\n
\n
\n\n\t\n \n {%- if doc.descriptive_test_items -%}\n \n \n \n \n \n\t\t\t{% set gr_lab_test_name = {'ltname': ''} %}\n {%- for row in doc.descriptive_test_items -%}\n\t\t\t{%- if row.lab_test_name -%}\n\t\t\t{%- if row.lab_test_name != gr_lab_test_name.ltname -%}\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t{% if gr_lab_test_name.update({'ltname': row.lab_test_name}) %} {% endif %}\n\t\t\t{%- endif -%}\n\t\t\t{%- endif -%}\n \n \n \n \n {%- endfor -%}\n {%- endif -%}\n \n
Name of TestResult
{{ doc.lab_test_name }}
 {{ row.lab_test_name }}
  {{ row.lab_test_particulars }}
\n
\n {% if doc.worksheet_instructions %}\n
\n Instructions\n {{ doc.worksheet_instructions }}\n {%- endif -%}\n
\n {% elif (frappe.db.get_value(\"Healthcare Settings\", \"None\", \"require_test_result_approval\") == '1' and doc.status != \"Approved\") %}\n Lab Tests have to be Approved for Print .. !\n {%- else -%}\n
\n
\n\n
\n
\n \n
\n {% if doc.patient_name %}\n
\n {{ doc.patient_name }}\n
\n {% else %}\n
\n {{ doc.patient }}\n
\n {%- endif -%}\n
\n\n
\n
\n \n
\n
\n {{ doc.patient_age or '' }}\n
\n
\n\n
\n
\n \n
\n
\n {{ doc.patient_sex or '' }}\n
\n
\n\n
\n\n
\n\n
\n
\n \n
\n {% if doc.practitioner_name %}\n
\n {{ doc.practitioner_name }}\n
\n\t\t{% else %}\n\t\t {% if doc.referring_practitioner_name %}\n
\n {{ doc.referring_practitioner_name }}\n
\n\t\t\t{% endif %}\n {%- endif -%}\n
\n\n {% if doc.sample_date %}\n
\n
\n \n
\n
\n {{ doc.sample_date }}\n
\n
\n {%- endif -%}\n\n {% if doc.result_date %}\n
\n
\n \n
\n
\n {{ doc.result_date }}\n
\n
\n {%- endif -%}\n\n
\n\n
\n\n
\n

Department of {{ doc.department }}

\n
\n\n\t
\n\t\t{% if doc.result_legend and (doc.legend_print_position == \"Top\" or doc.legend_print_position == \"Both\")%}\n\t\tResult Legend:\n\t\t{{ doc.result_legend }}\n\t\t{%- endif -%}\n\t
\n\n \n \n {%- if doc.normal_test_items -%}\n \n \n \n \n \n\n {%- if doc.normal_test_items|length > 1 %}\n \n {%- endif -%}\n\n {%- for row in doc.normal_test_items -%}\n \n \n\n \n\n \n \n\n {%- endfor -%}\n {%- endif -%}\n \n
Name of TestResultNormal Range
{{ doc.lab_test_name }}
\n {%- if doc.normal_test_items|length > 1 %}  {%- endif -%}\n {%- if row.lab_test_name -%}{{ row.lab_test_name }}\n {%- else -%}   {%- endif -%}\n {%- if row.lab_test_event -%}   {{ row.lab_test_event }}{%- endif -%}\n \n\t\t\t\t\t{%- if row.result_value -%}\n\t\t\t\t\t\t{%- if row.bold -%}{% endif %}\n\t\t\t\t\t\t{%- if row.underline -%}{% endif %}\n\t\t\t\t\t\t{%- if row.italic -%}{% endif %}\n {{ row.result_value }}\n {%- if row.lab_test_uom -%} {{ row.lab_test_uom }}{%- endif -%}\n\t\t\t\t\t\t{%- if row.italic -%}{% endif %}\n\t\t\t\t\t\t{%- if row.underline -%}{% endif %}\n\t\t\t\t\t\t{%- if row.bold -%}{% endif %}\n\t\t\t\t\t{%- endif -%}\n \n\t\t\t\t\t{%- if row.secondary_uom and row.conversion_factor and row.secondary_uom_result -%}\n\t\t\t\t\t\t
\n\t\t\t\t\t\t{%- if row.bold -%}{% endif %}\n\t\t\t\t\t\t{%- if row.underline -%}{% endif %}\n\t\t\t\t\t\t{%- if row.italic -%}{% endif %}\n {{ row.secondary_uom_result }}\n  {{ row.secondary_uom }}\n\t\t\t\t\t\t{%- if row.italic -%}{% endif %}\n\t\t\t\t\t\t{%- if row.underline -%}{% endif %}\n\t\t\t\t\t\t{%- if row.bold -%}{% endif %}\n\t\t\t\t\t\t \n\t\t\t\t\t{%- endif -%}\n
\n
\n {%- if row.normal_range -%}{{ row.normal_range }}{%- endif -%}\n
\n
\n\n \n \n {%- if doc.descriptive_test_items -%}\n \n \n \n \n \n\t\t\t{% set gr_lab_test_name = {'ltname': ''} %}\n {%- for row in doc.descriptive_test_items -%}\n\t\t\t{%- if row.lab_test_name -%}\n\t\t\t{%- if row.lab_test_name != gr_lab_test_name.ltname -%}\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t{% if gr_lab_test_name.update({'ltname': row.lab_test_name}) %} {% endif %}\n\t\t\t{%- endif -%}\n\t\t\t{%- endif -%}\n \n \n \n \n {%- endfor -%}\n {%- endif -%}\n\n\t\t\t{%- if doc.organisms -%}\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t{%- for row in doc.organisms -%}\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t{%- endfor -%}\n\t\t\t{%- endif -%}\n\n\t\t\t{%- if doc.sensitivity_test_items -%}\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t{%- for row in doc.sensitivity_test_items -%}\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t{%- endfor -%}\n\t\t\t{%- endif -%}\n\n \n
Name of TestResult
{{ doc.lab_test_name }}
 {{ row.lab_test_name }}
  {{ row.lab_test_particulars }} \n {%- if row.result_value -%}{{ row.result_value }}{%- endif -%}\n
OrganismColony Population
{{ row.organism }} \n\t\t\t\t\t{{ row.colony_population }}\n\t\t\t\t\t{% if row.colony_uom %}\n\t\t\t\t\t\t{{ row.colony_uom }}\n\t\t\t\t\t{% endif %}\n\t\t\t\t
AntibioticSensitivity
{{ row.antibiotic }} {{ row.antibiotic_sensitivity }}
\n
\n {% if doc.custom_result %}\n
\n
{{ doc.custom_result }}
\n {%- endif -%}\n
\n\n
\n {% if doc.lab_test_comment %}\n
\n Comments\n {{ doc.lab_test_comment }}\n {%- endif -%}\n
\n\n
\n {%- if (frappe.db.get_value(\"Healthcare Settings\", \"None\", \"employee_name_and_designation_in_print\") == '1') -%}\n {%- if doc.employee_name -%}\n
{{ doc.employee_name }}
\n {%- endif -%}\n {%- if doc.employee_designation -%}\n
{{ doc.employee_designation }}
\n {%- endif -%}\n {%- else -%}\n {%- if frappe.db.get_value(\"Healthcare Settings\", \"None\", \"custom_signature_in_print\") -%}\n
{{ frappe.db.get_value(\"Healthcare Settings\", \"None\", \"custom_signature_in_print\") }}
\n {%- endif -%}\n {%- endif -%}\n
\n\n
\n {% if doc.result_legend and (doc.legend_print_position == \"Bottom\" or doc.legend_print_position == \"Both\" or doc.legend_print_position == \"\")%}\n
\n Result Legend\n {{ doc.result_legend }}\n {%- endif -%}\n
\n {%- endif -%}\n
", "idx": 0, "line_breaks": 0, - "modified": "2018-09-04 12:03:47.066918", + "modified": "2020-07-08 15:34:28.866798", "modified_by": "Administrator", "module": "Healthcare", "name": "Lab Test Print", "owner": "Administrator", "print_format_builder": 0, - "print_format_type": "Server", + "print_format_type": "Jinja", + "raw_printing": 0, "show_section_headings": 0, "standard": "Yes" } \ No newline at end of file diff --git a/erpnext/healthcare/web_form/lab_test/lab_test.json b/erpnext/healthcare/web_form/lab_test/lab_test.json index 88a9756e12..35099174e8 100644 --- a/erpnext/healthcare/web_form/lab_test/lab_test.json +++ b/erpnext/healthcare/web_form/lab_test/lab_test.json @@ -1,255 +1,459 @@ { - "accept_payment": 0, - "allow_comments": 0, - "allow_delete": 0, - "allow_edit": 1, - "allow_incomplete": 0, - "allow_multiple": 1, - "allow_print": 1, - "amount": 0.0, - "amount_based_on_field": 0, - "creation": "2017-06-06 16:12:33.052258", - "currency": "INR", - "doc_type": "Lab Test", - "docstatus": 0, - "doctype": "Web Form", - "idx": 0, - "introduction_text": "Lab Test", - "is_standard": 1, - "login_required": 1, - "max_attachment_size": 0, - "modified": "2018-09-04 08:50:41.314546", - "modified_by": "Administrator", - "module": "Healthcare", - "name": "lab-test", - "owner": "Administrator", - "payment_button_label": "Buy Now", - "print_format": "Lab Test Print", - "published": 1, - "route": "lab-test", - "show_in_grid": 0, - "show_sidebar": 1, - "sidebar_items": [], - "success_url": "/lab-test", - "title": "Lab Test", + "accept_payment": 0, + "allow_comments": 1, + "allow_delete": 0, + "allow_edit": 1, + "allow_incomplete": 0, + "allow_multiple": 1, + "allow_print": 1, + "amount": 0.0, + "amount_based_on_field": 0, + "creation": "2017-06-06 16:12:33.052258", + "currency": "INR", + "doc_type": "Lab Test", + "docstatus": 0, + "doctype": "Web Form", + "idx": 0, + "introduction_text": "Lab Test", + "is_standard": 1, + "login_required": 1, + "max_attachment_size": 0, + "modified": "2020-06-22 12:59:49.126398", + "modified_by": "Administrator", + "module": "Healthcare", + "name": "lab-test", + "owner": "Administrator", + "payment_button_label": "Buy Now", + "print_format": "Lab Test Print", + "published": 1, + "route": "lab-test", + "route_to_success_link": 0, + "show_attachments": 0, + "show_in_grid": 0, + "show_sidebar": 1, + "sidebar_items": [], + "success_url": "/lab-test", + "title": "Lab Test", "web_form_fields": [ { - "fieldname": "naming_series", - "fieldtype": "Select", - "hidden": 0, - "label": "Series", - "max_length": 0, - "max_value": 0, - "options": "LP-", - "read_only": 0, - "reqd": 1, + "allow_read_on_all_link_options": 0, + "fieldname": "lab_test_name", + "fieldtype": "Data", + "hidden": 0, + "label": "Test Name", + "max_length": 0, + "max_value": 0, + "read_only": 1, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "default": "0", - "fieldname": "invoiced", - "fieldtype": "Check", - "hidden": 0, - "label": "Invoiced", - "max_length": 0, - "max_value": 0, - "options": "", - "read_only": 0, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "department", + "fieldtype": "Link", + "hidden": 0, + "label": "Department", + "max_length": 0, + "max_value": 0, + "options": "Medical Department", + "read_only": 1, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "fieldname": "patient", - "fieldtype": "Link", - "hidden": 0, - "label": "Patient", - "max_length": 0, - "max_value": 0, - "options": "Patient", - "read_only": 0, - "reqd": 1, + "allow_read_on_all_link_options": 0, + "fieldname": "column_break_26", + "fieldtype": "Column Break", + "hidden": 0, + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "fieldname": "patient_name", - "fieldtype": "Data", - "hidden": 0, - "label": "Patient Name", - "max_length": 0, - "max_value": 0, - "options": "patient.patient_name", - "read_only": 0, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "label": "Company", + "max_length": 0, + "max_value": 0, + "options": "Company", + "read_only": 0, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "fieldname": "practitioner", - "fieldtype": "Link", - "hidden": 0, - "label": "Healthcare Practitioner", - "max_length": 0, - "max_value": 0, - "options": "Healthcare Practitioner", - "read_only": 0, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "status", + "fieldtype": "Select", + "hidden": 0, + "label": "Status", + "max_length": 0, + "max_value": 0, + "options": "Draft\nCompleted\nApproved\nRejected\nCancelled", + "read_only": 1, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "fieldname": "status", - "fieldtype": "Select", - "hidden": 0, - "label": "Status", - "max_length": 0, - "max_value": 0, - "options": "Draft\nCompleted\nApproved\nRejected\nCancelled", - "read_only": 0, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "submitted_date", + "fieldtype": "Datetime", + "hidden": 0, + "label": "Submitted Date", + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "fieldname": "department", - "fieldtype": "Link", - "hidden": 0, - "label": "Department", - "max_length": 0, - "max_value": 0, - "options": "Medical Department", - "read_only": 0, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "sb_first", + "fieldtype": "Section Break", + "hidden": 0, + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "fieldname": "sample", - "fieldtype": "Link", - "hidden": 0, - "label": "Sample ID", - "max_length": 0, - "max_value": 0, - "options": "Sample Collection", - "read_only": 0, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "patient", + "fieldtype": "Link", + "hidden": 0, + "label": "Patient", + "max_length": 0, + "max_value": 0, + "options": "Patient", + "read_only": 0, + "reqd": 1, "show_in_filter": 0 - }, + }, { - "default": "", - "fieldname": "result_date", - "fieldtype": "Date", - "hidden": 0, - "label": "Result Date", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "patient_name", + "fieldtype": "Data", + "hidden": 0, + "label": "Patient Name", + "max_length": 0, + "max_value": 0, + "read_only": 1, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "fieldname": "report_preference", - "fieldtype": "Data", - "hidden": 0, - "label": "Report Preference", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "patient_age", + "fieldtype": "Data", + "hidden": 0, + "label": "Age", + "max_length": 0, + "max_value": 0, + "read_only": 1, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "fieldname": "lab_test_name", - "fieldtype": "Data", - "hidden": 0, - "label": "Test Name", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "patient_sex", + "fieldtype": "Link", + "hidden": 0, + "label": "Gender", + "max_length": 0, + "max_value": 0, + "options": "Gender", + "read_only": 0, + "reqd": 1, "show_in_filter": 0 - }, + }, { - "fieldname": "normal_test_items", - "fieldtype": "Table", - "hidden": 0, - "max_length": 0, - "max_value": 0, - "options": "Normal Test Items", - "read_only": 1, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "inpatient_record", + "fieldtype": "Link", + "hidden": 0, + "label": "Inpatient Record", + "max_length": 0, + "max_value": 0, + "options": "Inpatient Record", + "read_only": 1, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "fieldname": "special_test_items", - "fieldtype": "Table", - "hidden": 0, - "max_length": 0, - "max_value": 0, - "options": "Special Test Items", - "read_only": 1, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "report_preference", + "fieldtype": "Data", + "hidden": 0, + "label": "Report Preference", + "max_length": 0, + "max_value": 0, + "read_only": 1, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "fieldname": "sensitivity_test_items", - "fieldtype": "Table", - "hidden": 0, - "max_length": 0, - "max_value": 0, - "options": "Sensitivity Test Items", - "read_only": 1, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "email", + "fieldtype": "Data", + "hidden": 1, + "label": "Email", + "max_length": 0, + "max_value": 0, + "read_only": 1, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "fieldname": "lab_test_comment", - "fieldtype": "Text", - "hidden": 0, - "label": "Comments", - "max_length": 0, - "max_value": 0, - "read_only": 1, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "mobile", + "fieldtype": "Data", + "hidden": 1, + "label": "Mobile", + "max_length": 0, + "max_value": 0, + "read_only": 1, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "fieldname": "custom_result", - "fieldtype": "Text Editor", - "hidden": 0, - "label": "Custom Result", - "max_length": 0, - "max_value": 0, - "read_only": 1, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "c_b", + "fieldtype": "Column Break", + "hidden": 0, + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "default": "0", - "fieldname": "sensitivity_toggle", - "fieldtype": "Check", - "hidden": 1, - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "practitioner", + "fieldtype": "Link", + "hidden": 0, + "label": "Requesting Practitioner", + "max_length": 0, + "max_value": 0, + "options": "Healthcare Practitioner", + "read_only": 0, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "default": "0", - "fieldname": "special_toggle", - "fieldtype": "Check", - "hidden": 1, - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "practitioner_name", + "fieldtype": "Data", + "hidden": 0, + "label": "Requesting Practitioner", + "max_length": 0, + "max_value": 0, + "read_only": 1, + "reqd": 0, "show_in_filter": 0 - }, + }, { - "default": "0", - "fieldname": "normal_toggle", - "fieldtype": "Check", - "hidden": 1, - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, + "allow_read_on_all_link_options": 0, + "fieldname": "requesting_department", + "fieldtype": "Link", + "hidden": 0, + "label": "Requesting Department", + "max_length": 0, + "max_value": 0, + "options": "Medical Department", + "read_only": 1, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "employee", + "fieldtype": "Link", + "hidden": 0, + "label": "Employee (Lab Technician)", + "max_length": 0, + "max_value": 0, + "options": "Employee", + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "employee_name", + "fieldtype": "Data", + "hidden": 0, + "label": "Lab Technician Name", + "max_length": 0, + "max_value": 0, + "read_only": 1, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "employee_designation", + "fieldtype": "Data", + "hidden": 0, + "label": "Lab Technician Designation", + "max_length": 0, + "max_value": 0, + "read_only": 1, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "sb_normal", + "fieldtype": "Section Break", + "hidden": 0, + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "lab_test_html", + "fieldtype": "HTML", + "hidden": 0, + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "normal_test_items", + "fieldtype": "Table", + "hidden": 0, + "max_length": 0, + "max_value": 0, + "options": "Normal Test Result", + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "sb_descriptive", + "fieldtype": "Section Break", + "hidden": 0, + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "descriptive_test_items", + "fieldtype": "Table", + "hidden": 0, + "max_length": 0, + "max_value": 0, + "options": "Descriptive Test Result", + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "depends_on": "special_toggle", + "fieldname": "organisms_section", + "fieldtype": "Section Break", + "hidden": 0, + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "organisms", + "fieldtype": "Table", + "hidden": 0, + "max_length": 0, + "max_value": 0, + "options": "Organism Test Result", + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "sb_sensitivity", + "fieldtype": "Section Break", + "hidden": 0, + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "sensitivity_test_items", + "fieldtype": "Table", + "hidden": 0, + "max_length": 0, + "max_value": 0, + "options": "Sensitivity Test Result", + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "sb_comments", + "fieldtype": "Section Break", + "hidden": 0, + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "lab_test_comment", + "fieldtype": "Text", + "hidden": 0, + "label": "Comments", + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "sb_customresult", + "fieldtype": "Section Break", + "hidden": 0, + "label": "Custom Result", + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "custom_result", + "fieldtype": "Text Editor", + "hidden": 0, + "label": "Custom Result", + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 0, "show_in_filter": 0 } ] diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 0c2b873f15..ea2611f698 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -712,3 +712,4 @@ erpnext.patches.v12_0.add_taxjar_integration_field erpnext.patches.v13_0.delete_report_requested_items_to_order erpnext.patches.v12_0.update_item_tax_template_company erpnext.patches.v13_0.move_branch_code_to_bank_account +erpnext.patches.v13_0.healthcare_lab_module_rename_doctypes diff --git a/erpnext/patches/v13_0/healthcare_lab_module_rename_doctypes.py b/erpnext/patches/v13_0/healthcare_lab_module_rename_doctypes.py new file mode 100644 index 0000000000..5920bf1f70 --- /dev/null +++ b/erpnext/patches/v13_0/healthcare_lab_module_rename_doctypes.py @@ -0,0 +1,51 @@ +from __future__ import unicode_literals +import frappe +from frappe.model.utils.rename_field import rename_field + +def execute(): + if frappe.db.exists('DocType', 'Lab Test') and frappe.db.exists('DocType', 'Lab Test Template'): + # rename child doctypes + doctypes = { + 'Lab Test Groups': 'Lab Test Group Template', + 'Normal Test Items': 'Normal Test Result', + 'Sensitivity Test Items': 'Sensitivity Test Result', + 'Special Test Items': 'Descriptive Test Result', + 'Special Test Template': 'Descriptive Test Template' + } + + frappe.reload_doc('healthcare', 'doctype', 'lab_test') + frappe.reload_doc('healthcare', 'doctype', 'lab_test_template') + + for old_dt, new_dt in doctypes.items(): + if not frappe.db.table_exists(new_dt) and frappe.db.table_exists(old_dt): + frappe.rename_doc('DocType', old_dt, new_dt, force=True) + frappe.reload_doc('healthcare', 'doctype', frappe.scrub(new_dt)) + frappe.delete_doc_if_exists('DocType', old_dt) + + parent_fields = { + 'Lab Test Group Template': 'lab_test_groups', + 'Descriptive Test Template': 'descriptive_test_templates', + 'Normal Test Result': 'normal_test_items', + 'Sensitivity Test Result': 'sensitivity_test_items', + 'Descriptive Test Result': 'descriptive_test_items' + } + + for doctype, parentfield in parent_fields.items(): + frappe.db.sql(""" + UPDATE `tab{0}` + SET parentfield = %(parentfield)s + """.format(doctype), {'parentfield': parentfield}) + + # rename field + frappe.reload_doc('healthcare', 'doctype', 'lab_test') + if frappe.db.has_column('Lab Test', 'special_toggle'): + rename_field('Lab Test', 'special_toggle', 'descriptive_toggle') + + if frappe.db.exists('DocType', 'Lab Test Group Template'): + # fix select field option + frappe.reload_doc('healthcare', 'doctype', 'lab_test_group_template') + frappe.db.sql(""" + UPDATE `tabLab Test Group Template` + SET template_or_new_line = 'Add New Line' + WHERE template_or_new_line = 'Add new line' + """)