mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 20:59:11 +00:00
[domain] Healthcare (#10664)
* Medical module for erpnext * Changes in core for Medical module * patient registration updated * fix - appointment invioce - fields missing * pages- indicator instead of bg-color * Lab Test field renamed service type * Department added Lab Test * procedure name in prescription * fixes sample collection * filter disabled patient * fix patient admission * updated patient age * availability check msg updated * fixes, removed procedure from invoice * sample print renamed * fixes, validation * service desk physician in filter * refactor scheduler * Appointment -field property - set only once = 1 * Appointment - Mark closed and pending buttons removed * Appointment - readonly = 1 if value set * Appointment - availabilty * Appointment - Cancel - info - cancel invoice * Appointment - set pending appointments * Dosage form - new DT * Drug Prescription - Dosage form added * Facility - Floor - removed from Fecility * Floor - removed * Lab Test Template - item creation validation * Procedure - Create Procedure * Procedure Appointment - new DT * Service Unit - Floor reference removed * Zone Fcilities - Unused DT removed * Appointment Desk - fixed * Service Desk - method pointing from procedure changed to procedure_appointment * Consultation print - got featured * Consultation - removed patient refernce to procedure prescription * Procedure Prescription - removed patient refernce * Lab Test - Changed field properties and value * Lab Test - field property changed * Lab Test - methods rewrite - lab test doc creation * Lab Test - create lab test from invoice and consultaion - got changed * Button History changed to Medical Record * Service Desk - Updated * Notification - Procedure Appointment * fix-get procedure prescription * fix field added to test prescription * msgprint on invoice creation * fix data on install * Merge branch erpnext/develop * fixes- minor * Setup wizard - Create Sensitivity * Appointment - Validate and Save if there is no schedule for Physician * Consultation - Button create vital signs and medical record * Review Type - New DocType * Review Detail and Treatment Plan - Childs - Consultation * Patient Medical Record - field Attach doc * Consultation - New Fields * Consultation - Manage new Fields - Medical record add action * Patient Relation - Child DocType - Patient * Patient - Patient Relation added * Patient - collapsible = 1 * Laboratory Settings - fields - message for lab test * Laboratory Settings - get message for lab test * SMS text for lab test and invoice test report * Procedure Stock Detail - Stock detail for Procedure and Template * Template Stage Detail - Stage detail for Procedure Template * Procedure Stage Detail - Stage detail for Procedure * Service Unit - field - warehouse * Scheduler - msg - content changed * Laboratory Settings - defualt - msg content * Invoice Test Report - msg print * Print Format-Changed-Consultation-Invoice Test Report-Lab Test * OP Settings - Expnse Account for Stock Entry in Procedure * Procedure and Procedure Template - Manage Stock Stage and Sample Collection * Procedure Appointment - Manage Stock and Stage * Lab Test - fixed - resource not find * Invoice Test Report - fixed - resource not find * Procedure - doc reload after insert * Patient Medical Record - fixed - refernce missed * Create Vital Signs -on client side * Rename module Medical to Healthcare * Remove In Patient (IP) Feature. * Rename - Procedure to Clinical Procedure * Remove spaces in Naming Series * Rename Duration to Drug Prescription Duration * Duration to Drug Prescription Duration * Merge All Settings to Healthcare Settings * Healthcare settings - import fixed * Procedure related documents are removed * Appointment Desk and Sevrvice Desk are removed * Consultation - minimal * Consultation - minimal * Consultation - minimal - patient detials in collapsible section * Message Print to Alerts * Patient - some fields removed * Patient - create consultation - message print to alerts * Consultation - show patient details updated * Setup wizard - Duration to Drug Prescritpion Duration * Healthcare Settings - patient registration - fee collection * Lab Test - Create Sales Invoice bug fixed * Healthcare menu rearranged * Healthcare Settings - Optimised and Rearragnged * Healthcare Settings - Expense account removed * Receivable account removed from patient * Patient - Optimised and Rearragnged * Removed Referring Physician * Healthcare Settings - bold headings removed * Physician - Patient - Fields are Segregated * Remove Service Unit * Remove - Service Type * Consultation invoice * Lab Test - invoice * Patient - Invoice * Rename Appointment to Patient Appointment * wip * Patient Dashboard, Physician Form cleanup * Dosage renamed to Prescription Dosage * Renamed Drug Prescription Duration to Prescription Duration * Patient Appointment booking modal * Patient Age - calculate by dob * Remove - scheduler * Consultation - Appointment to Patient Appointment * Patient Dashboard - rearranged * Patient Appointment * Removed rer_physician from lab test and consultation * Patient Appontment Changes * Appointment and Consultation - optimized * Patient Appointment - fee validity code optimized * Consultation and Patient Appointment - Invoice validate two side * fix: #13 remove relation to admission * Healthcare - Patient Portal * fix import error * domain Healthcare added on install * Removed - Invoice Test Report * Physician Schedule - menu * Consultation - patient details - re write * New Doctype-Medical Code * Consultation - Daignosis codification * Medical Code - Codification - Settings * Medical Code Standard - Medical Code - Codification - Settings * fix appointment calendar * fix appointment analytics * Menu Medical Code Standard * New Doctype - Medical Code Standard * Set Physician Role insted of IP Physician and OP Physician Role * fixed some json files * Medical code - permission to physician * Unused Childs - Work Schedule and User List - Removed * Label Procedure to Lab Test * Lab Test and Patient - code optimised * Add Item Groups - setup wizard * Healthcare Settings - add Role - Medical Administrator * Healthcare - Demo setup - Make Demo * Fee Validity - Logic Test * Test Fee Validity - Optimised * Healthcare Doctypes - Restricted to Domain Healthcare * Domainify - remove Healthcare Roles - Other Domains * Healthcare doctypes - beta checked * Codacy fixes * Codacy - fixes * Codacy - fixes * Codacy - fixes * Codacy - fixes * Codacy - fixes * Lab Test - print hide =1 for some fields * Consultation - Codification field label to Medical Coding * Codacy fixes - import frappe and etc. * Codacy fixes - import frappe in test_vital_signs * Codacy fixes * Codacy fixes * Codacy fixes and remove delete perm for patient * send_sms - import form frappe * Healthcare Settings * Lab Prescription - Consultation - Test Code - read_only = 0 * Portal fixes * Patient Appointment - filter physician - if has schedule * Physician - IP Charge - Removed * test - files * Web Form - Patient Profile - removed * Role Medical Administrator to Healthcare Administrator * WIP healthcare documentation * Coday - fixes * Travis - fixes * Lab Test Report - menu * Reorder Healthcare settings - group lab config to bottom * Sample Collection - New - allow Sample and patient Selection * Rate - similar behaviour and Label as in Item Standard Selling Rate * Healthcare documentation * Lab Test Samples to Lab Test sample * Commplaints to Complaint * Commplaints to Complaint * Antibiotics to Antibiotic * Appointment Token Number - remove * View - Medical record * Codacy fixes * update healthcare docs * Cleanup Docs - Search, quick entry, trsck change, etc. * [minor] ux changes
This commit is contained in:
committed by
Makarand Bauskar
parent
ff667695ad
commit
f056974bc5
0
erpnext/healthcare/__init__.py
Normal file
0
erpnext/healthcare/__init__.py
Normal file
0
erpnext/healthcare/doctype/__init__.py
Normal file
0
erpnext/healthcare/doctype/__init__.py
Normal file
0
erpnext/healthcare/doctype/antibiotic/__init__.py
Normal file
0
erpnext/healthcare/doctype/antibiotic/__init__.py
Normal file
5
erpnext/healthcare/doctype/antibiotic/antibiotic.js
Normal file
5
erpnext/healthcare/doctype/antibiotic/antibiotic.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Antibiotic', {
|
||||
});
|
||||
115
erpnext/healthcare/doctype/antibiotic/antibiotic.json
Normal file
115
erpnext/healthcare/doctype/antibiotic/antibiotic.json
Normal file
@@ -0,0 +1,115 @@
|
||||
{
|
||||
"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,
|
||||
"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
|
||||
}
|
||||
],
|
||||
"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",
|
||||
"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,
|
||||
"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,
|
||||
"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
|
||||
}
|
||||
9
erpnext/healthcare/doctype/antibiotic/antibiotic.py
Normal file
9
erpnext/healthcare/doctype/antibiotic/antibiotic.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, 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 Antibiotic(Document):
|
||||
pass
|
||||
23
erpnext/healthcare/doctype/antibiotic/test_antibiotic.js
Normal file
23
erpnext/healthcare/doctype/antibiotic/test_antibiotic.js
Normal file
@@ -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: Antibiotic", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Antibiotic
|
||||
() => frappe.tests.make('Antibiotic', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
8
erpnext/healthcare/doctype/antibiotic/test_antibiotic.py
Normal file
8
erpnext/healthcare/doctype/antibiotic/test_antibiotic.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
|
||||
class TestAntibiotic(unittest.TestCase):
|
||||
pass
|
||||
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) 2016, ESS LLP and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Appointment Type', {
|
||||
});
|
||||
@@ -0,0 +1,145 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:appointment_type",
|
||||
"beta": 1,
|
||||
"creation": "2016-07-22 11:52:34.953019",
|
||||
"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": "appointment_type",
|
||||
"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": "Type",
|
||||
"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_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "ip",
|
||||
"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": "Is Inpatient",
|
||||
"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,
|
||||
"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": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-31 13:46:57.142289",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Appointment Type",
|
||||
"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,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"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": "Physician",
|
||||
"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": "appointment_type",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS LLP and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from frappe.model.document import Document
|
||||
|
||||
class AppointmentType(Document):
|
||||
pass
|
||||
@@ -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: Appointment Type", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Appointment Type
|
||||
() => frappe.tests.make('Appointment Type', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS LLP and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Appointment Type')
|
||||
|
||||
class TestAppointmentType(unittest.TestCase):
|
||||
pass
|
||||
@@ -0,0 +1,135 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 1,
|
||||
"creation": "2017-06-22 13:09:23.159579",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "medical_code",
|
||||
"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": "Medical Code",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Medical Code",
|
||||
"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_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "code",
|
||||
"fieldtype": "Read Only",
|
||||
"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": "Code",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "medical_code.code",
|
||||
"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": "description",
|
||||
"fieldtype": "Read Only",
|
||||
"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": "Description",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "medical_code.description",
|
||||
"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-08-31 14:06:50.281545",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Codification Table",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"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": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, 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 CodificationTable(Document):
|
||||
pass
|
||||
0
erpnext/healthcare/doctype/complaint/__init__.py
Normal file
0
erpnext/healthcare/doctype/complaint/__init__.py
Normal file
5
erpnext/healthcare/doctype/complaint/complaint.js
Normal file
5
erpnext/healthcare/doctype/complaint/complaint.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Complaint', {
|
||||
});
|
||||
116
erpnext/healthcare/doctype/complaint/complaint.json
Normal file
116
erpnext/healthcare/doctype/complaint/complaint.json
Normal file
@@ -0,0 +1,116 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:complaints",
|
||||
"beta": 1,
|
||||
"creation": "2017-02-15 12:25:28.045267",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "complaints",
|
||||
"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": "Complaints",
|
||||
"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
|
||||
}
|
||||
],
|
||||
"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:31.848346",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Complaint",
|
||||
"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,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"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": "Physician",
|
||||
"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": "complaints",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "complaints",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0
|
||||
}
|
||||
9
erpnext/healthcare/doctype/complaint/complaint.py
Normal file
9
erpnext/healthcare/doctype/complaint/complaint.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, 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 Complaint(Document):
|
||||
pass
|
||||
23
erpnext/healthcare/doctype/complaint/test_complaint.js
Normal file
23
erpnext/healthcare/doctype/complaint/test_complaint.js
Normal file
@@ -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: Complaint", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Complaint
|
||||
() => frappe.tests.make('Complaint', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
8
erpnext/healthcare/doctype/complaint/test_complaint.py
Normal file
8
erpnext/healthcare/doctype/complaint/test_complaint.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
|
||||
class TestComplaint(unittest.TestCase):
|
||||
pass
|
||||
0
erpnext/healthcare/doctype/consultation/__init__.py
Normal file
0
erpnext/healthcare/doctype/consultation/__init__.py
Normal file
317
erpnext/healthcare/doctype/consultation/consultation.js
Normal file
317
erpnext/healthcare/doctype/consultation/consultation.js
Normal file
@@ -0,0 +1,317 @@
|
||||
// Copyright (c) 2016, ESS LLP and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Consultation', {
|
||||
setup: function(frm) {
|
||||
frm.get_field('drug_prescription').grid.editable_fields = [
|
||||
{fieldname: 'drug_code', columns: 2},
|
||||
{fieldname: 'drug_name', columns: 2},
|
||||
{fieldname: 'dosage', columns: 2},
|
||||
{fieldname: 'period', columns: 2}
|
||||
];
|
||||
frm.get_field('test_prescription').grid.editable_fields = [
|
||||
{fieldname: 'test_code', columns: 2},
|
||||
{fieldname: 'test_name', columns: 4},
|
||||
{fieldname: 'test_comment', columns: 4}
|
||||
];
|
||||
},
|
||||
onload: function(frm){
|
||||
if(frm.doc.patient){
|
||||
frappe.call({
|
||||
"method": "erpnext.healthcare.doctype.patient.patient.get_patient_detail",
|
||||
args: {
|
||||
patient: frm.doc.patient
|
||||
},
|
||||
callback: function (data) {
|
||||
var age = null;
|
||||
if(data.message.dob){
|
||||
age = calculate_age(data.message.dob);
|
||||
}
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "patient_age", age);
|
||||
show_details(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
refresh: function(frm) {
|
||||
refresh_field('drug_prescription');
|
||||
refresh_field('test_prescription');
|
||||
|
||||
frm.add_custom_button(__('Medical Record'), function() {
|
||||
if (frm.doc.patient) {
|
||||
frappe.route_options = {"patient": frm.doc.patient};
|
||||
frappe.set_route("medical_record");
|
||||
} else {
|
||||
frappe.msgprint("Please select Patient");
|
||||
}
|
||||
},"View");
|
||||
frm.add_custom_button(__('Vital Signs'), function() {
|
||||
btn_create_vital_signs(frm);
|
||||
},"Create");
|
||||
frm.add_custom_button(__('Medical Record'), function() {
|
||||
create_medical_record(frm);
|
||||
},"Create");
|
||||
|
||||
frm.set_query("patient", function () {
|
||||
return {
|
||||
filters: {"disabled": 0}
|
||||
};
|
||||
});
|
||||
frm.set_query("drug_code", "drug_prescription", function() {
|
||||
return {
|
||||
filters: {
|
||||
is_stock_item:'1'
|
||||
}
|
||||
};
|
||||
});
|
||||
frm.set_query("test_code", "test_prescription", function() {
|
||||
return {
|
||||
filters: {
|
||||
is_billable:'1'
|
||||
}
|
||||
};
|
||||
});
|
||||
frm.set_query("medical_code", "codification_table", function() {
|
||||
return {
|
||||
filters: {
|
||||
medical_code_standard: frappe.defaults.get_default("default_medical_code_standard")
|
||||
}
|
||||
};
|
||||
});
|
||||
frm.set_query("appointment", function() {
|
||||
return {
|
||||
filters: {
|
||||
// Scheduled filter for demo ...
|
||||
status:['in',["Open","Scheduled"]]
|
||||
}
|
||||
};
|
||||
});
|
||||
if(!frm.doc.__islocal && !frm.doc.invoice && (frappe.user.has_role("Accounts User"))){
|
||||
frm.add_custom_button(__('Invoice'), function() {
|
||||
btn_invoice_consultation(frm);
|
||||
},__("Create"));
|
||||
}
|
||||
frm.set_df_property("appointment", "read_only", frm.doc.__islocal ? 0:1);
|
||||
frm.set_df_property("patient", "read_only", frm.doc.__islocal ? 0:1);
|
||||
frm.set_df_property("patient_age", "read_only", frm.doc.__islocal ? 0:1);
|
||||
frm.set_df_property("patient_sex", "read_only", frm.doc.__islocal ? 0:1);
|
||||
frm.set_df_property("type", "read_only", frm.doc.__islocal ? 0:1);
|
||||
frm.set_df_property("physician", "read_only", frm.doc.__islocal ? 0:1);
|
||||
frm.set_df_property("visit_department", "read_only", frm.doc.__islocal ? 0:1);
|
||||
frm.set_df_property("consultation_date", "read_only", frm.doc.__islocal ? 0:1);
|
||||
frm.set_df_property("consultation_time", "read_only", frm.doc.__islocal ? 0:1);
|
||||
}
|
||||
});
|
||||
|
||||
var btn_invoice_consultation = function(frm){
|
||||
var doc = frm.doc;
|
||||
frappe.call({
|
||||
method:
|
||||
"erpnext.healthcare.doctype.consultation.consultation.create_invoice",
|
||||
args: {company: doc.company, patient: doc.patient, physician: doc.physician, consultation_id: doc.name },
|
||||
callback: function(data){
|
||||
if(!data.exc){
|
||||
if(data.message){
|
||||
frappe.set_route("Form", "Sales Invoice", data.message);
|
||||
}
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var create_medical_record = function (frm) {
|
||||
if(!frm.doc.patient){
|
||||
frappe.throw("Please select patient");
|
||||
}
|
||||
frappe.route_options = {
|
||||
"patient": frm.doc.patient,
|
||||
"status": "Open",
|
||||
"reference_doctype": "Patient Medical Record",
|
||||
"reference_owner": frm.doc.owner
|
||||
};
|
||||
frappe.new_doc("Patient Medical Record");
|
||||
};
|
||||
|
||||
var btn_create_vital_signs = function (frm) {
|
||||
if(!frm.doc.patient){
|
||||
frappe.throw("Please select patient");
|
||||
}
|
||||
frappe.route_options = {
|
||||
"patient": frm.doc.patient,
|
||||
};
|
||||
frappe.new_doc("Vital Signs");
|
||||
};
|
||||
|
||||
var show_details = function(data){
|
||||
var personal_details = "";
|
||||
var age = null;
|
||||
if(data.dob){
|
||||
age = calculate_age(data.dob);
|
||||
personal_details += "<br><b>Age :</b> " + age;
|
||||
}
|
||||
if(data.sex) personal_details += "<br><b>Gender :</b> " + data.sex;
|
||||
if(data.blood_group) personal_details += "<br><b>Blood group : </b> " + data.blood_group;
|
||||
if(data.occupation) personal_details += "<br><b>Occupation :</b> " + data.occupation;
|
||||
if(data.email) personal_details += "<br><b>Email :</b> " + data.email;
|
||||
if(data.mobile) personal_details += "<br><b>Mobile :</b> " + data.mobile;
|
||||
|
||||
if(personal_details){
|
||||
personal_details = "<div style='padding-left:10px; font-size:13px;' align='left'></br><b class='text-muted'>Personal Details</b>" + personal_details + "</div>";
|
||||
}
|
||||
|
||||
var details = "";
|
||||
if(data.allergies) details += "<br><br><b>Allergies : </b> "+ data.allergies;
|
||||
if(data.medication) details += "<br><b>Medication : </b> "+ data.medication;
|
||||
if(data.alcohol_current_use) details += "<br><br><b>Alcohol use : </b> "+ data.alcohol_current_use;
|
||||
if(data.alcohol_past_use) details += "<br><b>Alcohol past use : </b> "+ data.alcohol_past_use;
|
||||
if(data.tobacco_current_use) details += "<br><b>Tobacco use : </b> "+ data.tobacco_current_use;
|
||||
if(data.tobacco_past_use) details += "<br><b>Tobacco past use : </b> "+ data.tobacco_past_use;
|
||||
if(data.medical_history) details += "<br><br><b>Medical history : </b> "+ data.medical_history;
|
||||
if(data.surgical_history) details += "<br><b>Surgical history : </b> "+ data.surgical_history;
|
||||
if(data.surrounding_factors) details += "<br><br><b>Occupational hazards : </b> "+ data.surrounding_factors;
|
||||
if(data.other_risk_factors) details += "<br><b>Other risk factors : </b> " + data.other_risk_factors;
|
||||
if(data.patient_details) details += "<br><br><b>More info : </b> " + data.patient_details;
|
||||
|
||||
if(details){
|
||||
details = "<div style='padding-left:10px; font-size:13px;' align='left'></br><b class='text-muted'>Patient Details</b>" + details + "</div>";
|
||||
}
|
||||
|
||||
var vitals = "";
|
||||
if(data.temperature) vitals += "<br><b>Temperature :</b> " + data.temperature;
|
||||
if(data.pulse) vitals += ", <b>Pulse :</b> " + data.pulse;
|
||||
if(data.respiratory_rate) vitals += ", <b>Respiratory Rate :</b> " + data.respiratory_rate;
|
||||
if(data.bp) vitals += ", <b>BP :</b> " + data.bp;
|
||||
if(data.bmi) vitals += "<br><b>BMI :</b> " + data.bmi;
|
||||
if(data.nutrition_note) vitals += " (" + data.nutrition_note + ")";
|
||||
if(data.height) vitals += ", <b>Height :</b> " + data.height;
|
||||
if(data.weight) vitals += ", <b>Weight :</b> " + data.weight;
|
||||
if(data.signs_date) vitals += "<br><b>Date :</b> " + data.signs_date;
|
||||
|
||||
if(vitals){
|
||||
vitals = "<div style='padding-left:10px; font-size:13px;' align='left'></br><b class='text-muted'>Vital Signs</b>" + vitals + "<br></div>";
|
||||
}
|
||||
details = personal_details + vitals + details;
|
||||
cur_frm.fields_dict.patient_details_html.$wrapper.html(details);
|
||||
};
|
||||
|
||||
frappe.ui.form.on("Consultation", "appointment", function(frm){
|
||||
if(frm.doc.appointment){
|
||||
frappe.call({
|
||||
"method": "frappe.client.get",
|
||||
args: {
|
||||
doctype: "Patient Appointment",
|
||||
name: frm.doc.appointment
|
||||
},
|
||||
callback: function (data) {
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "patient", data.message.patient);
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "type", data.message.appointment_type);
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "physician", data.message.physician);
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "invoice", data.message.sales_invoice);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Consultation", "physician", function(frm) {
|
||||
if(frm.doc.physician){
|
||||
frappe.call({
|
||||
"method": "frappe.client.get",
|
||||
args: {
|
||||
doctype: "Physician",
|
||||
name: frm.doc.physician
|
||||
},
|
||||
callback: function (data) {
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "visit_department",data.message.department);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Consultation", "symptoms_select", function(frm) {
|
||||
if(frm.doc.symptoms_select){
|
||||
var symptoms = null;
|
||||
if(frm.doc.symptoms)
|
||||
symptoms = frm.doc.symptoms + "\n" +frm.doc.symptoms_select;
|
||||
else
|
||||
symptoms = frm.doc.symptoms_select;
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "symptoms", symptoms);
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "symptoms_select", null);
|
||||
}
|
||||
});
|
||||
frappe.ui.form.on("Consultation", "diagnosis_select", function(frm) {
|
||||
if(frm.doc.diagnosis_select){
|
||||
var diagnosis = null;
|
||||
if(frm.doc.diagnosis)
|
||||
diagnosis = frm.doc.diagnosis + "\n" +frm.doc.diagnosis_select;
|
||||
else
|
||||
diagnosis = frm.doc.diagnosis_select;
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "diagnosis", diagnosis);
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "diagnosis_select", null);
|
||||
}
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Consultation", "patient", function(frm) {
|
||||
if(frm.doc.patient){
|
||||
frappe.call({
|
||||
"method": "erpnext.healthcare.doctype.patient.patient.get_patient_detail",
|
||||
args: {
|
||||
patient: frm.doc.patient
|
||||
},
|
||||
callback: function (data) {
|
||||
var age = "";
|
||||
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);
|
||||
if(frm.doc.__islocal) show_details(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Drug Prescription", {
|
||||
drug_code: function(frm, cdt, cdn) {
|
||||
var child = locals[cdt][cdn];
|
||||
if(child.drug_code){
|
||||
frappe.call({
|
||||
"method": "frappe.client.get",
|
||||
args: {
|
||||
doctype: "Item",
|
||||
name: child.drug_code,
|
||||
},
|
||||
callback: function (data) {
|
||||
frappe.model.set_value(cdt, cdn, 'drug_name',data.message.item_name);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
dosage: function(frm, cdt, cdn){
|
||||
frappe.model.set_value(cdt, cdn, 'update_schedule', 1);
|
||||
var child = locals[cdt][cdn];
|
||||
if(child.dosage){
|
||||
frappe.model.set_value(cdt, cdn, 'in_every', 'Day');
|
||||
frappe.model.set_value(cdt, cdn, 'interval', 1);
|
||||
}
|
||||
},
|
||||
period: function(frm, cdt, cdn){
|
||||
frappe.model.set_value(cdt, cdn, 'update_schedule', 1);
|
||||
},
|
||||
in_every: function(frm, cdt, cdn){
|
||||
frappe.model.set_value(cdt, cdn, 'update_schedule', 1);
|
||||
var child = locals[cdt][cdn];
|
||||
if(child.in_every == "Hour"){
|
||||
frappe.model.set_value(cdt, cdn, 'dosage', null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var calculate_age = function(birth) {
|
||||
var ageMS = Date.parse(Date()) - Date.parse(birth);
|
||||
var age = new Date();
|
||||
age.setTime(ageMS);
|
||||
var years = age.getFullYear() - 1970;
|
||||
return years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
|
||||
};
|
||||
1046
erpnext/healthcare/doctype/consultation/consultation.json
Normal file
1046
erpnext/healthcare/doctype/consultation/consultation.json
Normal file
File diff suppressed because it is too large
Load Diff
128
erpnext/healthcare/doctype/consultation/consultation.py
Executable file
128
erpnext/healthcare/doctype/consultation/consultation.py
Executable file
@@ -0,0 +1,128 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS LLP and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import getdate
|
||||
import json
|
||||
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account,get_income_account
|
||||
|
||||
class Consultation(Document):
|
||||
def on_update(self):
|
||||
if(self.appointment):
|
||||
frappe.db.set_value("Patient Appointment",self.appointment,"status","Closed")
|
||||
update_consultation_to_medical_record(self)
|
||||
|
||||
def after_insert(self):
|
||||
insert_consultation_to_medical_record(self)
|
||||
|
||||
def on_submit(self):
|
||||
if not self.diagnosis or not self.symptoms:
|
||||
frappe.throw("Diagnosis and Complaints cannot be left blank")
|
||||
|
||||
physician = frappe.get_doc("Physician",self.physician)
|
||||
if(frappe.session.user != physician.user_id):
|
||||
frappe.throw(_("You don't have permission to submit"))
|
||||
|
||||
def set_sales_invoice_fields(company, patient):
|
||||
sales_invoice = frappe.new_doc("Sales Invoice")
|
||||
sales_invoice.customer = frappe.get_value("Patient", patient, "customer")
|
||||
# patient is custom field in sales inv.
|
||||
sales_invoice.due_date = getdate()
|
||||
sales_invoice.is_pos = '0'
|
||||
sales_invoice.debit_to = get_receivable_account(company)
|
||||
|
||||
return sales_invoice
|
||||
|
||||
def create_sales_invoice_item_lines(item, sales_invoice):
|
||||
sales_invoice_line = sales_invoice.append("items")
|
||||
sales_invoice_line.item_code = item.item_code
|
||||
sales_invoice_line.item_name = item.item_name
|
||||
sales_invoice_line.qty = 1.0
|
||||
sales_invoice_line.description = item.description
|
||||
return sales_invoice_line
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_drug_invoice(company, patient, prescriptions):
|
||||
list_ids = json.loads(prescriptions)
|
||||
if not (company or patient or prescriptions):
|
||||
return False
|
||||
|
||||
sales_invoice = set_sales_invoice_fields(company, patient)
|
||||
sales_invoice.update_stock = 1
|
||||
|
||||
for line_id in list_ids:
|
||||
line_obj = frappe.get_doc("Drug Prescription", line_id)
|
||||
if line_obj:
|
||||
if(line_obj.drug_code):
|
||||
item = frappe.get_doc("Item", line_obj.drug_code)
|
||||
sales_invoice_line = create_sales_invoice_item_lines(item, sales_invoice)
|
||||
sales_invoice_line.qty = line_obj.get_quantity()
|
||||
#income_account and cost_center in itemlines - by set_missing_values()
|
||||
sales_invoice.set_missing_values()
|
||||
return sales_invoice.as_dict()
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_invoice(company, patient, physician, consultation_id):
|
||||
if not consultation_id:
|
||||
return False
|
||||
sales_invoice = frappe.new_doc("Sales Invoice")
|
||||
sales_invoice.customer = frappe.get_value("Patient", patient, "customer")
|
||||
sales_invoice.due_date = getdate()
|
||||
sales_invoice.is_pos = '0'
|
||||
sales_invoice.debit_to = get_receivable_account(company)
|
||||
|
||||
create_invoice_items(physician, sales_invoice, company)
|
||||
|
||||
sales_invoice.save(ignore_permissions=True)
|
||||
frappe.db.sql(_("""update tabConsultation set invoice='{0}' where name='{1}'""").format(sales_invoice.name, consultation_id))
|
||||
appointment = frappe.db.get_value("Consultation", consultation_id, "appointment")
|
||||
if appointment:
|
||||
frappe.db.set_value("Patient Appointment", appointment, "sales_invoice", sales_invoice.name)
|
||||
return sales_invoice.name
|
||||
|
||||
def create_invoice_items(physician, invoice, company):
|
||||
item_line = invoice.append("items")
|
||||
item_line.item_name = "Consulting Charges"
|
||||
item_line.description = "Consulting Charges: " + physician
|
||||
item_line.qty = 1
|
||||
item_line.uom = "Nos"
|
||||
item_line.conversion_factor = 1
|
||||
item_line.income_account = get_income_account(physician,company)
|
||||
op_consulting_charge = frappe.get_value("Physician",physician,"op_consulting_charge")
|
||||
if op_consulting_charge:
|
||||
item_line.rate = op_consulting_charge
|
||||
item_line.amount = op_consulting_charge
|
||||
return invoice
|
||||
|
||||
def insert_consultation_to_medical_record(doc):
|
||||
subject = set_subject_field(doc)
|
||||
medical_record = frappe.new_doc("Patient Medical Record")
|
||||
medical_record.patient = doc.patient
|
||||
medical_record.subject = subject
|
||||
medical_record.status = "Open"
|
||||
medical_record.communication_date = doc.consultation_date
|
||||
medical_record.reference_doctype = "Consultation"
|
||||
medical_record.reference_name = doc.name
|
||||
medical_record.reference_owner = doc.owner
|
||||
medical_record.save(ignore_permissions=True)
|
||||
|
||||
def update_consultation_to_medical_record(consultation):
|
||||
medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(consultation.name))
|
||||
if(medical_record_id[0][0]):
|
||||
subject = set_subject_field(consultation)
|
||||
frappe.db.set_value("Patient Medical Record",medical_record_id[0][0],"subject",subject)
|
||||
|
||||
def set_subject_field(consultation):
|
||||
subject = "No Diagnosis "
|
||||
if(consultation.diagnosis):
|
||||
subject = "Diagnosis: \n"+ str(consultation.diagnosis)+". "
|
||||
if(consultation.drug_prescription):
|
||||
subject +="\nDrug(s) Prescribed. "
|
||||
if(consultation.test_prescription):
|
||||
subject += " Test(s) Prescribed."
|
||||
|
||||
return subject
|
||||
@@ -0,0 +1,15 @@
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
'fieldname': 'consultation',
|
||||
'non_standard_fieldnames': {
|
||||
'Patient Medical Record': 'reference_name'
|
||||
},
|
||||
'transactions': [
|
||||
{
|
||||
'label': _('Records'),
|
||||
'items': ['Vital Signs', 'Patient Medical Record']
|
||||
},
|
||||
]
|
||||
}
|
||||
7
erpnext/healthcare/doctype/consultation/consultation_list.js
Executable file
7
erpnext/healthcare/doctype/consultation/consultation_list.js
Executable file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
(c) ESS 2015-16
|
||||
*/
|
||||
frappe.listview_settings['Consultation'] = {
|
||||
filters:[["docstatus","!=","1"]]
|
||||
};
|
||||
|
||||
23
erpnext/healthcare/doctype/consultation/test_consultation.js
Normal file
23
erpnext/healthcare/doctype/consultation/test_consultation.js
Normal file
@@ -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: Consultation", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Consultation
|
||||
() => frappe.tests.make('Consultation', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
10
erpnext/healthcare/doctype/consultation/test_consultation.py
Normal file
10
erpnext/healthcare/doctype/consultation/test_consultation.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS LLP and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Consultation')
|
||||
|
||||
class TestConsultation(unittest.TestCase):
|
||||
pass
|
||||
0
erpnext/healthcare/doctype/diagnosis/__init__.py
Normal file
0
erpnext/healthcare/doctype/diagnosis/__init__.py
Normal file
5
erpnext/healthcare/doctype/diagnosis/diagnosis.js
Normal file
5
erpnext/healthcare/doctype/diagnosis/diagnosis.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) 2016, ESS LLP and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Diagnosis', {
|
||||
});
|
||||
116
erpnext/healthcare/doctype/diagnosis/diagnosis.json
Normal file
116
erpnext/healthcare/doctype/diagnosis/diagnosis.json
Normal file
@@ -0,0 +1,116 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:diagnosis",
|
||||
"beta": 1,
|
||||
"creation": "2017-02-15 12:23:59.341108",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "diagnosis",
|
||||
"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": "Diagnosis",
|
||||
"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
|
||||
}
|
||||
],
|
||||
"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:40:09.731904",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Diagnosis",
|
||||
"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,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"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": "Physician",
|
||||
"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": "diagnosis",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "diagnosis",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
9
erpnext/healthcare/doctype/diagnosis/diagnosis.py
Normal file
9
erpnext/healthcare/doctype/diagnosis/diagnosis.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS LLP and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from frappe.model.document import Document
|
||||
|
||||
class Diagnosis(Document):
|
||||
pass
|
||||
23
erpnext/healthcare/doctype/diagnosis/test_diagnosis.js
Normal file
23
erpnext/healthcare/doctype/diagnosis/test_diagnosis.js
Normal file
@@ -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: Diagnosis", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Diagnosis
|
||||
() => frappe.tests.make('Diagnosis', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
11
erpnext/healthcare/doctype/diagnosis/test_diagnosis.py
Normal file
11
erpnext/healthcare/doctype/diagnosis/test_diagnosis.py
Normal file
@@ -0,0 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS LLP and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Diagnosis')
|
||||
|
||||
class TestDiagnosis(unittest.TestCase):
|
||||
pass
|
||||
0
erpnext/healthcare/doctype/dosage_form/__init__.py
Normal file
0
erpnext/healthcare/doctype/dosage_form/__init__.py
Normal file
5
erpnext/healthcare/doctype/dosage_form/dosage_form.js
Normal file
5
erpnext/healthcare/doctype/dosage_form/dosage_form.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) 2017, ESS LLP and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Dosage Form', {
|
||||
});
|
||||
114
erpnext/healthcare/doctype/dosage_form/dosage_form.json
Normal file
114
erpnext/healthcare/doctype/dosage_form/dosage_form.json
Normal file
@@ -0,0 +1,114 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:dosage_form",
|
||||
"beta": 1,
|
||||
"creation": "2017-04-08 12:04:33.987972",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "dosage_form",
|
||||
"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": "Dosage Form",
|
||||
"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
|
||||
}
|
||||
],
|
||||
"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:40:19.973532",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Dosage Form",
|
||||
"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": "Physician",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"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,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"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": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
9
erpnext/healthcare/doctype/dosage_form/dosage_form.py
Normal file
9
erpnext/healthcare/doctype/dosage_form/dosage_form.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, ESS LLP and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from frappe.model.document import Document
|
||||
|
||||
class DosageForm(Document):
|
||||
pass
|
||||
23
erpnext/healthcare/doctype/dosage_form/test_dosage_form.js
Normal file
23
erpnext/healthcare/doctype/dosage_form/test_dosage_form.js
Normal file
@@ -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: Dosage Form", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Dosage Form
|
||||
() => frappe.tests.make('Dosage Form', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, ESS LLP and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import unittest
|
||||
|
||||
class TestDosageForm(unittest.TestCase):
|
||||
pass
|
||||
102
erpnext/healthcare/doctype/dosage_strength/dosage_strength.json
Normal file
102
erpnext/healthcare/doctype/dosage_strength/dosage_strength.json
Normal file
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 1,
|
||||
"creation": "2017-02-14 15:40:14.385707",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "strength",
|
||||
"fieldtype": "Float",
|
||||
"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": "Strength",
|
||||
"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_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "strength_time",
|
||||
"fieldtype": "Time",
|
||||
"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": "Time",
|
||||
"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,
|
||||
"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-08-31 14:11:59.874645",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Dosage Strength",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"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
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS LLP and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from frappe.model.document import Document
|
||||
|
||||
class DosageStrength(Document):
|
||||
pass
|
||||
@@ -0,0 +1,381 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 1,
|
||||
"creation": "2016-09-16 16:41:45.533374",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Document",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "drug_code",
|
||||
"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": "Drug Code",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Item",
|
||||
"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": "drug_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": "Description/Strength",
|
||||
"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": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "dosage",
|
||||
"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": "Dosage",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Prescription Dosage",
|
||||
"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": "period",
|
||||
"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": "Period",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Prescription Duration",
|
||||
"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": "dosage_form",
|
||||
"fieldtype": "Link",
|
||||
"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": "Dosage Form",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Dosage Form",
|
||||
"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": "column_break_7",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "comment",
|
||||
"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": "Comment",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fieldname": "use_interval",
|
||||
"fieldtype": "Check",
|
||||
"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": "Dosage by time interval",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "use_interval",
|
||||
"fieldname": "interval",
|
||||
"fieldtype": "Int",
|
||||
"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": "Interval",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "use_interval",
|
||||
"fieldname": "in_every",
|
||||
"fieldtype": "Select",
|
||||
"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": "Interval UOM",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "\nHour\nDay",
|
||||
"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,
|
||||
"default": "1",
|
||||
"fieldname": "update_schedule",
|
||||
"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": "Update Schedule",
|
||||
"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,
|
||||
"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-08-31 13:59:48.222282",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Drug Prescription",
|
||||
"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
|
||||
}
|
||||
34
erpnext/healthcare/doctype/drug_prescription/drug_prescription.py
Executable file
34
erpnext/healthcare/doctype/drug_prescription/drug_prescription.py
Executable file
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS LLP and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class DrugPrescription(Document):
|
||||
def get_quantity(self):
|
||||
quantity = 0
|
||||
dosage = None
|
||||
period = None
|
||||
|
||||
if(self.dosage):
|
||||
dosage = frappe.get_doc("Prescription Dosage",self.dosage)
|
||||
for item in dosage.dosage_strength:
|
||||
quantity += item.strength
|
||||
if(self.period and self.interval):
|
||||
period = frappe.get_doc("Prescription Duration",self.period)
|
||||
if(self.interval < period.get_days()):
|
||||
quantity = quantity*(period.get_days()/self.interval)
|
||||
|
||||
elif(self.interval and self.in_every and self.period):
|
||||
period = frappe.get_doc("Prescription Duration",self.period)
|
||||
interval_in = self.in_every
|
||||
if(interval_in == 'Day' and (self.interval < period.get_days())):
|
||||
quantity = period.get_days()/self.interval
|
||||
elif(interval_in == 'Hour' and (self.interval < period.get_hours())):
|
||||
quantity = period.get_hours()/self.interval
|
||||
if quantity > 0:
|
||||
return quantity
|
||||
else:
|
||||
return 1
|
||||
0
erpnext/healthcare/doctype/fee_validity/__init__.py
Normal file
0
erpnext/healthcare/doctype/fee_validity/__init__.py
Normal file
5
erpnext/healthcare/doctype/fee_validity/fee_validity.js
Normal file
5
erpnext/healthcare/doctype/fee_validity/fee_validity.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) 2016, ESS LLP and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Fee Validity', {
|
||||
});
|
||||
248
erpnext/healthcare/doctype/fee_validity/fee_validity.json
Normal file
248
erpnext/healthcare/doctype/fee_validity/fee_validity.json
Normal file
@@ -0,0 +1,248 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 0,
|
||||
"beta": 1,
|
||||
"creation": "2017-01-05 10:56:29.564806",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "physician",
|
||||
"fieldtype": "Link",
|
||||
"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": "Physician",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Physician",
|
||||
"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": "patient",
|
||||
"fieldtype": "Link",
|
||||
"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": "Patient",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Patient",
|
||||
"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": "max_visit",
|
||||
"fieldtype": "Int",
|
||||
"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": "Max number of visit",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "visited",
|
||||
"fieldtype": "Int",
|
||||
"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": "Visited yet",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "valid_till",
|
||||
"fieldtype": "Date",
|
||||
"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": "Valid till",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "ref_invoice",
|
||||
"fieldtype": "Link",
|
||||
"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": "Reference Inv",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Sales Invoice",
|
||||
"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": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-31 13:36:52.108407",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Fee Validity",
|
||||
"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,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"search_fields": "physician,patient",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "physician",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0
|
||||
}
|
||||
9
erpnext/healthcare/doctype/fee_validity/fee_validity.py
Normal file
9
erpnext/healthcare/doctype/fee_validity/fee_validity.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS LLP and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from frappe.model.document import Document
|
||||
|
||||
class FeeValidity(Document):
|
||||
pass
|
||||
23
erpnext/healthcare/doctype/fee_validity/test_fee_validity.js
Normal file
23
erpnext/healthcare/doctype/fee_validity/test_fee_validity.js
Normal file
@@ -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: Fee Validity", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Fee Validity
|
||||
() => frappe.tests.make('Fee Validity', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
54
erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
Normal file
54
erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
Normal file
@@ -0,0 +1,54 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS LLP and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
from erpnext.healthcare.doctype.patient_appointment.patient_appointment import create_invoice
|
||||
from frappe.utils.make_random import get_random
|
||||
from frappe.utils import nowdate, add_days
|
||||
# test_records = frappe.get_test_records('Fee Validity')
|
||||
|
||||
class TestFeeValidity(unittest.TestCase):
|
||||
def test_fee_validity(self):
|
||||
patient = get_random("Patient")
|
||||
physician = get_random("Physician")
|
||||
|
||||
if not patient:
|
||||
patient = frappe.new_doc("Patient")
|
||||
patient.patient_name = "Test Patient"
|
||||
patient.sex = "Male"
|
||||
patient.save(ignore_permissions = True)
|
||||
patient = patient.name
|
||||
|
||||
if not physician:
|
||||
physician = frappe.new_doc("Physician")
|
||||
physician.first_name= "Amit Jain"
|
||||
physician.save(ignore_permissions = True)
|
||||
physician = physician.name
|
||||
|
||||
frappe.db.set_value("Healthcare Settings", None, "max_visit", 2)
|
||||
frappe.db.set_value("Healthcare Settings", None, "valid_days", 7)
|
||||
|
||||
appointment = create_appointment(patient, physician, nowdate())
|
||||
invoice = frappe.db.get_value("Patient Appointment", appointment.name, "sales_invoice")
|
||||
self.assertEqual(invoice, None)
|
||||
create_invoice(frappe.defaults.get_global_default("company"), physician, patient, appointment.name, appointment.appointment_date)
|
||||
appointment = create_appointment(patient, physician, add_days(nowdate(), 4))
|
||||
invoice = frappe.db.get_value("Patient Appointment", appointment.name, "sales_invoice")
|
||||
self.assertTrue(invoice)
|
||||
appointment = create_appointment(patient, physician, add_days(nowdate(), 5))
|
||||
invoice = frappe.db.get_value("Patient Appointment", appointment.name, "sales_invoice")
|
||||
self.assertEqual(invoice, None)
|
||||
appointment = create_appointment(patient, physician, add_days(nowdate(), 10))
|
||||
invoice = frappe.db.get_value("Patient Appointment", appointment.name, "sales_invoice")
|
||||
self.assertEqual(invoice, None)
|
||||
|
||||
def create_appointment(patient, physician, appointment_date):
|
||||
appointment = frappe.new_doc("Patient Appointment")
|
||||
appointment.patient = patient
|
||||
appointment.physician = physician
|
||||
appointment.appointment_date = appointment_date
|
||||
appointment.save(ignore_permissions = True)
|
||||
return appointment
|
||||
5
erpnext/healthcare/doctype/healthcare.py
Normal file
5
erpnext/healthcare/doctype/healthcare.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
def get_data():
|
||||
|
||||
return []
|
||||
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Healthcare Settings', {
|
||||
setup: function(frm) {
|
||||
frm.set_query('account', 'receivable_account', function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
return {
|
||||
filters: {
|
||||
'account_type': 'Receivable',
|
||||
'company': d.company,
|
||||
}
|
||||
};
|
||||
});
|
||||
frm.set_query('account', 'income_account', function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
return {
|
||||
filters: {
|
||||
'root_type': 'Income',
|
||||
'company': d.company,
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,68 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe.core.doctype.sms_settings.sms_settings import send_sms
|
||||
import json
|
||||
|
||||
class HealthcareSettings(Document):
|
||||
def validate(self):
|
||||
for key in ["collect_registration_fee","manage_customer","patient_master_name",
|
||||
"require_test_result_approval","require_sample_collection", "default_medical_code_standard"]:
|
||||
frappe.db.set_default(key, self.get(key, ""))
|
||||
if(self.collect_registration_fee):
|
||||
if self.registration_fee <= 0 :
|
||||
frappe.throw("Registration fee can not be Zero")
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_sms_text(doc):
|
||||
sms_text = {}
|
||||
doc = frappe.get_doc("Lab Test",doc)
|
||||
#doc = json.loads(doc)
|
||||
context = {"doc": doc, "alert": doc, "comments": None}
|
||||
emailed = frappe.db.get_value("Healthcare Settings", None, "sms_emailed")
|
||||
sms_text['emailed'] = frappe.render_template(emailed, context)
|
||||
printed = frappe.db.get_value("Healthcare Settings", None, "sms_printed")
|
||||
sms_text['printed'] = frappe.render_template(printed, context)
|
||||
return sms_text
|
||||
|
||||
def send_registration_sms(doc):
|
||||
if (frappe.db.get_value("Healthcare Settings", None, "reg_sms")=='1'):
|
||||
if doc.mobile:
|
||||
context = {"doc": doc, "alert": doc, "comments": None}
|
||||
if doc.get("_comments"):
|
||||
context["comments"] = json.loads(doc.get("_comments"))
|
||||
messages = frappe.db.get_value("Healthcare Settings", None, "reg_msg")
|
||||
messages = frappe.render_template(messages, context)
|
||||
number = [doc.mobile]
|
||||
send_sms(number,messages)
|
||||
else:
|
||||
frappe.msgprint(doc.name + " Has no mobile number to send registration SMS", alert=True)
|
||||
|
||||
|
||||
def get_receivable_account(company):
|
||||
receivable_account = get_account(None, "receivable_account", "Healthcare Settings", company)
|
||||
if receivable_account:
|
||||
return receivable_account
|
||||
return frappe.db.get_value("Company", company, "default_receivable_account")
|
||||
|
||||
def get_income_account(physician, company):
|
||||
if(physician):
|
||||
income_account = get_account("Physician", None, physician, company)
|
||||
if income_account:
|
||||
return income_account
|
||||
income_account = get_account(None, "income_account", "Healthcare Settings", company)
|
||||
if income_account:
|
||||
return income_account
|
||||
return frappe.db.get_value("Company", company, "default_income_account")
|
||||
|
||||
def get_account(parent_type, parent_field, parent, company):
|
||||
if(parent_type):
|
||||
return frappe.db.get_value("Party Account",
|
||||
{"parenttype": parent_type, "parent": parent, "company": company}, "account")
|
||||
if(parent_field):
|
||||
return frappe.db.get_value("Party Account",
|
||||
{"parentfield": parent_field, "parent": parent, "company": company}, "account")
|
||||
@@ -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: Healthcare Settings", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Healthcare Settings
|
||||
() => frappe.tests.make('Healthcare Settings', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,223 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 1,
|
||||
"creation": "2016-09-16 16:53:06.882970",
|
||||
"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": "test_code",
|
||||
"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": "Test Code",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "test_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": "Test",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "test_code.test_name",
|
||||
"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": "invoice",
|
||||
"fieldtype": "Link",
|
||||
"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": "Invoice",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Sales Invoice",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_4",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "test_comment",
|
||||
"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": "Comments",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "test_created",
|
||||
"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": "Test Created",
|
||||
"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,
|
||||
"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-08-31 13:47:22.789095",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Lab Prescription",
|
||||
"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
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS LLP and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from frappe.model.document import Document
|
||||
|
||||
class LabPrescription(Document):
|
||||
pass
|
||||
0
erpnext/healthcare/doctype/lab_test/__init__.py
Normal file
0
erpnext/healthcare/doctype/lab_test/__init__.py
Normal file
323
erpnext/healthcare/doctype/lab_test/lab_test.js
Normal file
323
erpnext/healthcare/doctype/lab_test/lab_test.js
Normal file
@@ -0,0 +1,323 @@
|
||||
// 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");
|
||||
};
|
||||
|
||||
frappe.ui.form.on('Lab Test', {
|
||||
setup: function(frm) {
|
||||
frm.get_field('normal_test_items').grid.editable_fields = [
|
||||
{fieldname: 'test_name', columns: 3},
|
||||
{fieldname: 'test_event', columns: 2},
|
||||
{fieldname: 'result_value', columns: 2},
|
||||
{fieldname: 'test_uom', columns: 1},
|
||||
{fieldname: 'normal_range', columns: 2}
|
||||
];
|
||||
frm.get_field('special_test_items').grid.editable_fields = [
|
||||
{fieldname: 'test_particulars', columns: 3},
|
||||
{fieldname: 'result_value', columns: 7}
|
||||
];
|
||||
},
|
||||
refresh : function(frm){
|
||||
refresh_field('normal_test_items');
|
||||
refresh_field('special_test_items');
|
||||
if(!frm.doc.__islocal && !frm.doc.invoice && frappe.user.has_role("Accounts User")){
|
||||
frm.add_custom_button(__('Make Invoice'), function() {
|
||||
make_invoice(frm);
|
||||
});
|
||||
}
|
||||
if(frm.doc.__islocal){
|
||||
frm.add_custom_button(__('Get from Consultation'), function () {
|
||||
get_lab_test_prescribed(frm);
|
||||
});
|
||||
}
|
||||
if(frm.doc.docstatus==1 && frm.doc.status!='Approved' && frm.doc.status!='Rejected' && frappe.defaults.get_default("require_test_result_approval") && 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(frm.doc.docstatus==1 && frm.doc.sms_sent==0){
|
||||
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) {
|
||||
var emailed = r.message.emailed;
|
||||
var printed = r.message.printed;
|
||||
make_dialog(frm, emailed, printed);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
onload: function (frm) {
|
||||
frm.add_fetch("physician", "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.call({
|
||||
"method": "erpnext.healthcare.doctype.patient.patient.get_patient_detail",
|
||||
args: {
|
||||
patient: frm.doc.patient
|
||||
},
|
||||
callback: function (data) {
|
||||
var age = null;
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
frappe.ui.form.on('Normal Test Items', {
|
||||
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");
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
});
|
||||
|
||||
var status_update = function(approve,frm){
|
||||
var doc = frm.doc;
|
||||
var status = null;
|
||||
if(approve == 1){
|
||||
status = "Approved";
|
||||
}
|
||||
else {
|
||||
status = "Rejected";
|
||||
}
|
||||
frappe.call({
|
||||
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){
|
||||
frappe.call({
|
||||
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 Patient to get Lab Tests");
|
||||
}
|
||||
};
|
||||
|
||||
var show_lab_tests = function(frm, result){
|
||||
var d = new frappe.ui.Dialog({
|
||||
title: __("Lab Test Prescriptions"),
|
||||
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('<div class="col-xs-12" style="padding-top:12px; text-align:center;" >\
|
||||
<div class="col-xs-2"> %(lab_test)s </div>\
|
||||
<div class="col-xs-2"> %(consultation)s </div>\
|
||||
<div class="col-xs-3"> %(physician)s </div>\
|
||||
<div class="col-xs-3"> %(date)s </div>\
|
||||
<div class="col-xs-1">\
|
||||
<a data-name="%(name)s" data-lab-test="%(lab_test)s"\
|
||||
data-consultation="%(consultation)s" data-physician="%(physician)s"\
|
||||
data-invoice="%(invoice)s" href="#"><button class="btn btn-default btn-xs">Get Lab Test\
|
||||
</button></a></div></div>', {name:y[0], lab_test: y[1], consultation:y[2], invoice:y[3], physician: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.physician = $(this).attr("data-physician");
|
||||
frm.set_df_property("template", "read_only", 1);
|
||||
frm.set_df_property("patient", "read_only", 1);
|
||||
frm.set_df_property("physician", "read_only", 1);
|
||||
if($(this).attr("data-invoice") != 'null'){
|
||||
frm.doc.invoice = $(this).attr("data-invoice");
|
||||
refresh_field("invoice");
|
||||
}else {
|
||||
frm.doc.invoice = "";
|
||||
refresh_field("invoice");
|
||||
}
|
||||
|
||||
refresh_field("template");
|
||||
d.hide();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
if(!result){
|
||||
var msg = "There are no Lab Test prescribed for "+frm.doc.patient;
|
||||
$(repl('<div class="col-xs-12" style="padding-top:20px;" >%(msg)s</div></div>', {msg: msg})).appendTo(html_field);
|
||||
}
|
||||
d.show();
|
||||
};
|
||||
|
||||
var make_invoice = function(frm){
|
||||
var doc = frm.doc;
|
||||
frappe.call({
|
||||
method: "erpnext.healthcare.doctype.lab_test.lab_test.create_invoice",
|
||||
args: {company:doc.company, patient:doc.patient, lab_tests: [doc.name], prescriptions:[]},
|
||||
callback: function(r){
|
||||
if(!r.exc){
|
||||
if(r.message){
|
||||
/* frappe.show_alert(__('Sales Invoice {0} created',
|
||||
['<a href="#Form/Sales Invoice/'+r.message+'">' + r.message+ '</a>'])); */
|
||||
frappe.set_route("Form", "Sales Invoice", r.message);
|
||||
}
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
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}
|
||||
],
|
||||
primary_action_label: __("Send"),
|
||||
primary_action : function(){
|
||||
var values = dialog.fields_dict;
|
||||
if(!values){
|
||||
return;
|
||||
}
|
||||
send_sms(values,frm);
|
||||
dialog.hide();
|
||||
}
|
||||
});
|
||||
if(frm.doc.report_preference == "Email"){
|
||||
dialog.set_values({
|
||||
'sms_type': "Emailed",
|
||||
'number': number
|
||||
});
|
||||
dialog.fields_dict.messages_label.html("Message".bold());
|
||||
dialog.fields_dict.messages.html(emailed);
|
||||
}else{
|
||||
dialog.set_values({
|
||||
'sms_type': "Printed",
|
||||
'number': number
|
||||
});
|
||||
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'){
|
||||
dialog.set_values({
|
||||
'number': number
|
||||
});
|
||||
fd.messages_label.html("Message".bold());
|
||||
fd.messages.html(emailed);
|
||||
}else{
|
||||
dialog.set_values({
|
||||
'number': number
|
||||
});
|
||||
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;
|
||||
frappe.call({
|
||||
method: "frappe.core.doctype.sms_settings.sms_settings.send_sms",
|
||||
args: {
|
||||
receiver_list: [number],
|
||||
msg: messages
|
||||
},
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var calculate_age = function(birth) {
|
||||
var ageMS = Date.parse(Date()) - Date.parse(birth);
|
||||
var age = new Date();
|
||||
age.setTime(ageMS);
|
||||
var years = age.getFullYear() - 1970;
|
||||
return years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
|
||||
};
|
||||
1470
erpnext/healthcare/doctype/lab_test/lab_test.json
Normal file
1470
erpnext/healthcare/doctype/lab_test/lab_test.json
Normal file
File diff suppressed because it is too large
Load Diff
295
erpnext/healthcare/doctype/lab_test/lab_test.py
Normal file
295
erpnext/healthcare/doctype/lab_test/lab_test.py
Normal file
@@ -0,0 +1,295 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
import json
|
||||
from frappe.utils import getdate
|
||||
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account
|
||||
from frappe import _
|
||||
|
||||
class LabTest(Document):
|
||||
def on_submit(self):
|
||||
frappe.db.set_value(self.doctype,self.name,"submitted_date", getdate())
|
||||
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.reload()
|
||||
|
||||
def on_update(self):
|
||||
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
|
||||
self.sensitivity_test_items = sensitivity
|
||||
|
||||
def after_insert(self):
|
||||
if(self.prescription):
|
||||
frappe.db.set_value("Lab Prescription", self.prescription, "test_created", 1)
|
||||
if not self.test_name and self.template:
|
||||
self.load_test_from_template()
|
||||
self.reload()
|
||||
|
||||
def load_test_from_template(self):
|
||||
lab_test = self
|
||||
create_test_from_template(lab_test)
|
||||
self.reload()
|
||||
|
||||
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)
|
||||
|
||||
lab_test.test_name = template.test_name
|
||||
lab_test.result_date = getdate()
|
||||
lab_test.department = template.department
|
||||
lab_test.test_group = template.test_group
|
||||
|
||||
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)
|
||||
|
||||
def create_lab_test_doc(invoice, consultation, patient, template):
|
||||
#create Test Result for template, copy vals from Invoice
|
||||
lab_test = frappe.new_doc("Lab Test")
|
||||
if(invoice):
|
||||
lab_test.invoice = invoice
|
||||
if(consultation):
|
||||
lab_test.physician = consultation.physician
|
||||
lab_test.patient = patient.name
|
||||
lab_test.patient_age = patient.get_age()
|
||||
lab_test.patient_sex = patient.sex
|
||||
lab_test.email = patient.email
|
||||
lab_test.mobile = patient.mobile
|
||||
lab_test.department = template.department
|
||||
lab_test.test_name = template.test_name
|
||||
lab_test.template = template.name
|
||||
lab_test.test_group = template.test_group
|
||||
lab_test.result_date = getdate()
|
||||
lab_test.report_preference = patient.report_preference
|
||||
return lab_test
|
||||
|
||||
def create_normals(template, lab_test):
|
||||
lab_test.normal_toggle = "1"
|
||||
normal = lab_test.append("normal_test_items")
|
||||
normal.test_name = template.test_name
|
||||
normal.test_uom = template.test_uom
|
||||
normal.normal_range = template.test_normal_range
|
||||
normal.require_result_value = 1
|
||||
normal.template = template.name
|
||||
|
||||
def create_compounds(template, lab_test, is_group):
|
||||
lab_test.normal_toggle = "1"
|
||||
for normal_test_template in template.normal_test_templates:
|
||||
normal = lab_test.append("normal_test_items")
|
||||
if is_group:
|
||||
normal.test_event = normal_test_template.test_event
|
||||
else:
|
||||
normal.test_name = normal_test_template.test_event
|
||||
|
||||
normal.test_uom = normal_test_template.test_uom
|
||||
normal.normal_range = normal_test_template.normal_range
|
||||
normal.require_result_value = 1
|
||||
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.test_particulars = special_test_template.particulars
|
||||
special.require_result_value = 1
|
||||
special.template = template.name
|
||||
|
||||
def create_sample_doc(template, patient, invoice):
|
||||
if(template.sample):
|
||||
sample_exist = frappe.db.exists({
|
||||
"doctype": "Sample Collection",
|
||||
"patient": patient.name,
|
||||
"docstatus": 0,
|
||||
"sample": template.sample})
|
||||
if sample_exist :
|
||||
#Update Sample Collection by adding quantity
|
||||
sample_collection = frappe.get_doc("Sample Collection",sample_exist[0][0])
|
||||
quantity = int(sample_collection.sample_quantity)+int(template.sample_quantity)
|
||||
if(template.sample_collection_details):
|
||||
sample_collection_details = sample_collection.sample_collection_details+"\n==============\n"+"Test :"+template.test_name+"\n"+"Collection Detials:\n\t"+template.sample_collection_details
|
||||
frappe.db.set_value("Sample Collection", sample_collection.name, "sample_collection_details",sample_collection_details)
|
||||
frappe.db.set_value("Sample Collection", sample_collection.name, "sample_quantity",quantity)
|
||||
|
||||
else:
|
||||
#create Sample Collection for template, copy vals from Invoice
|
||||
sample_collection = frappe.new_doc("Sample Collection")
|
||||
if(invoice):
|
||||
sample_collection.invoice = invoice
|
||||
sample_collection.patient = patient.name
|
||||
sample_collection.patient_age = patient.get_age()
|
||||
sample_collection.patient_sex = patient.sex
|
||||
sample_collection.sample = template.sample
|
||||
sample_collection.sample_uom = template.sample_uom
|
||||
sample_collection.sample_quantity = template.sample_quantity
|
||||
if(template.sample_collection_details):
|
||||
sample_collection.sample_collection_details = "Test :"+template.test_name+"\n"+"Collection Detials:\n\t"+template.sample_collection_details
|
||||
sample_collection.save(ignore_permissions=True)
|
||||
|
||||
return sample_collection
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_lab_test_from_desk(patient, template, prescription, invoice=None):
|
||||
lab_test_exist = frappe.db.exists({
|
||||
"doctype": "Lab Test",
|
||||
"prescription": prescription
|
||||
})
|
||||
if lab_test_exist:
|
||||
return
|
||||
template = frappe.get_doc("Lab Test Template", template)
|
||||
#skip the loop if there is no test_template for Item
|
||||
if not (template):
|
||||
return
|
||||
patient = frappe.get_doc("Patient", patient)
|
||||
consultation_id = frappe.get_value("Lab Prescription", prescription, "parent")
|
||||
consultation = frappe.get_doc("Consultation", consultation_id)
|
||||
lab_test = create_lab_test(patient, template, prescription, consultation, invoice)
|
||||
return lab_test.name
|
||||
|
||||
def create_sample_collection(lab_test, template, patient, invoice):
|
||||
if(frappe.db.get_value("Healthcare Settings", None, "require_sample_collection") == "1"):
|
||||
sample_collection = create_sample_doc(template, patient, invoice)
|
||||
if(sample_collection):
|
||||
lab_test.sample = sample_collection.name
|
||||
return lab_test
|
||||
|
||||
def load_result_format(lab_test, template, prescription, invoice):
|
||||
if(template.test_template_type == 'Single'):
|
||||
create_normals(template, lab_test)
|
||||
elif(template.test_template_type == 'Compound'):
|
||||
create_compounds(template, lab_test, False)
|
||||
elif(template.test_template_type == 'Descriptive'):
|
||||
create_specials(template, lab_test)
|
||||
elif(template.test_template_type == 'Grouped'):
|
||||
#iterate for each template in the group and create one result for all.
|
||||
for test_group in template.test_groups:
|
||||
#template_in_group = None
|
||||
if(test_group.test_template):
|
||||
template_in_group = frappe.get_doc("Lab Test Template",
|
||||
test_group.test_template)
|
||||
if(template_in_group):
|
||||
if(template_in_group.test_template_type == 'Single'):
|
||||
create_normals(template_in_group, lab_test)
|
||||
elif(template_in_group.test_template_type == 'Compound'):
|
||||
normal_heading = lab_test.append("normal_test_items")
|
||||
normal_heading.test_name = template_in_group.test_name
|
||||
normal_heading.require_result_value = 0
|
||||
normal_heading.template = template_in_group.name
|
||||
create_compounds(template_in_group, lab_test, True)
|
||||
elif(template_in_group.test_template_type == 'Descriptive'):
|
||||
special_heading = lab_test.append("special_test_items")
|
||||
special_heading.test_name = template_in_group.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")
|
||||
normal.test_name = test_group.group_event
|
||||
normal.test_uom = test_group.group_test_uom
|
||||
normal.normal_range = test_group.group_test_normal_range
|
||||
normal.require_result_value = 1
|
||||
normal.template = template.name
|
||||
if(template.test_template_type != 'No Result'):
|
||||
if(prescription):
|
||||
lab_test.prescription = prescription
|
||||
if(invoice):
|
||||
frappe.db.set_value("Lab Prescription", prescription, "invoice", invoice)
|
||||
lab_test.save(ignore_permissions=True) # insert the result
|
||||
return lab_test
|
||||
|
||||
def create_lab_test(patient, template, prescription, consultation, invoice):
|
||||
lab_test = create_lab_test_doc(invoice, consultation, patient, template)
|
||||
lab_test = create_sample_collection(lab_test, template, patient, invoice)
|
||||
lab_test = load_result_format(lab_test, template, prescription, invoice)
|
||||
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)
|
||||
return employee
|
||||
|
||||
def insert_lab_test_to_medical_record(doc):
|
||||
subject = str(doc.test_name)
|
||||
if(doc.test_comment):
|
||||
subject += ", \n"+str(doc.test_comment)
|
||||
medical_record = frappe.new_doc("Patient Medical Record")
|
||||
medical_record.patient = doc.patient
|
||||
medical_record.subject = subject
|
||||
medical_record.status = "Open"
|
||||
medical_record.communication_date = doc.result_date
|
||||
medical_record.reference_doctype = "Lab Test"
|
||||
medical_record.reference_name = doc.name
|
||||
medical_record.reference_owner = doc.owner
|
||||
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))
|
||||
|
||||
if(medical_record_id[0][0]):
|
||||
frappe.delete_doc("Patient Medical Record", medical_record_id[0][0])
|
||||
|
||||
def create_item_line(test_code, sales_invoice):
|
||||
if test_code:
|
||||
item = frappe.get_doc("Item", test_code)
|
||||
if item:
|
||||
if not item.disabled:
|
||||
sales_invoice_line = sales_invoice.append("items")
|
||||
sales_invoice_line.item_code = item.item_code
|
||||
sales_invoice_line.item_name = item.item_name
|
||||
sales_invoice_line.qty = 1.0
|
||||
sales_invoice_line.description = item.description
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_invoice(company, patient, lab_tests, prescriptions):
|
||||
test_ids = json.loads(lab_tests)
|
||||
line_ids = json.loads(prescriptions)
|
||||
if not test_ids and not line_ids:
|
||||
return
|
||||
sales_invoice = frappe.new_doc("Sales Invoice")
|
||||
sales_invoice.customer = frappe.get_value("Patient", patient, "customer")
|
||||
sales_invoice.due_date = getdate()
|
||||
sales_invoice.is_pos = '0'
|
||||
sales_invoice.debit_to = get_receivable_account(company)
|
||||
for line in line_ids:
|
||||
test_code = frappe.get_value("Lab Prescription", line, "test_code")
|
||||
create_item_line(test_code, sales_invoice)
|
||||
for test in test_ids:
|
||||
template = frappe.get_value("Lab Test", test, "template")
|
||||
test_code = frappe.get_value("Lab Test Template", template, "item")
|
||||
create_item_line(test_code, sales_invoice)
|
||||
sales_invoice.set_missing_values()
|
||||
sales_invoice.save()
|
||||
#set invoice in lab test
|
||||
for test in test_ids:
|
||||
frappe.db.set_value("Lab Test", test, "invoice", sales_invoice.name)
|
||||
prescription = frappe.db.get_value("Lab Test", test, "prescription")
|
||||
if prescription:
|
||||
frappe.db.set_value("Lab Prescription", prescription, "invoice", sales_invoice.name)
|
||||
#set invoice in prescription
|
||||
for line in line_ids:
|
||||
frappe.db.set_value("Lab Prescription", line, "invoice", sales_invoice.name)
|
||||
return sales_invoice.name
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_lab_test_prescribed(patient):
|
||||
return frappe.db.sql(_("""select cp.name, cp.test_code, cp.parent, cp.invoice, ct.physician, ct.consultation_date from tabConsultation ct,
|
||||
`tabLab Prescription` cp where ct.patient='{0}' and cp.parent=ct.name and cp.test_created=0""").format(patient))
|
||||
15
erpnext/healthcare/doctype/lab_test/lab_test_list.js
Normal file
15
erpnext/healthcare/doctype/lab_test/lab_test_list.js
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
(c) ESS 2015-16
|
||||
*/
|
||||
frappe.listview_settings['Lab Test'] = {
|
||||
add_fields: ["name", "status", "invoice"],
|
||||
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"];
|
||||
}
|
||||
}
|
||||
};
|
||||
23
erpnext/healthcare/doctype/lab_test/test_lab_test.js
Normal file
23
erpnext/healthcare/doctype/lab_test/test_lab_test.js
Normal file
@@ -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: Lab Test", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Lab Test
|
||||
() => frappe.tests.make('Lab Test', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
10
erpnext/healthcare/doctype/lab_test/test_lab_test.py
Normal file
10
erpnext/healthcare/doctype/lab_test/test_lab_test.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS LLP and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Lab Test')
|
||||
|
||||
class TestLabTest(unittest.TestCase):
|
||||
pass
|
||||
291
erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.json
Normal file
291
erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.json
Normal file
@@ -0,0 +1,291 @@
|
||||
{
|
||||
"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_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": 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,
|
||||
"depends_on": "eval:doc.template_or_new_line == 'Add Test'",
|
||||
"fieldname": "test_template",
|
||||
"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": "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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "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": "test_template.test_rate",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "test_description",
|
||||
"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": "Description",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "test_template.test_description",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 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": 0,
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 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": 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,
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 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": 0,
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 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,
|
||||
"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-08-31 14:07:35.188661",
|
||||
"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
|
||||
}
|
||||
@@ -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 LabTestGroups(Document):
|
||||
pass
|
||||
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Lab Test Sample', {
|
||||
});
|
||||
145
erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.json
Normal file
145
erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.json
Normal file
@@ -0,0 +1,145 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:sample",
|
||||
"beta": 1,
|
||||
"creation": "2016-04-04 17:35:44.823951",
|
||||
"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": "sample",
|
||||
"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": "Sample",
|
||||
"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_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sample_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,
|
||||
"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": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-31 13:46:22.508908",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Lab Test Sample",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"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,
|
||||
"write": 0
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "sample",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, 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 LabTestSample(Document):
|
||||
pass
|
||||
@@ -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: Lab Test Sample", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Lab Test Sample
|
||||
() => frappe.tests.make('Lab Test Sample', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
|
||||
class TestLabTestSample(unittest.TestCase):
|
||||
pass
|
||||
@@ -0,0 +1,132 @@
|
||||
// Copyright (c) 2016, ESS
|
||||
// License: ESS license.txt
|
||||
|
||||
frappe.ui.form.on("Lab Test Template",{
|
||||
test_name: function(frm) {
|
||||
if(!frm.doc.test_code)
|
||||
frm.set_value("test_code", frm.doc.test_name);
|
||||
if(!frm.doc.test_description)
|
||||
frm.set_value("test_description", frm.doc.test_name);
|
||||
},
|
||||
refresh : function(frm){
|
||||
// Restrict Special, Grouped type templates in Child TestGroups
|
||||
frm.set_query("test_template", "test_groups", function() {
|
||||
return {
|
||||
filters: {
|
||||
test_template_type:['in',['Single','Compound']]
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
cur_frm.cscript.custom_refresh = function(doc) {
|
||||
cur_frm.set_df_property("test_code", "read_only", doc.__islocal ? 0 : 1);
|
||||
|
||||
if(!doc.__islocal) {
|
||||
cur_frm.add_custom_button(__('Change Template Code'), function() {
|
||||
change_template_code(cur_frm,doc);
|
||||
} );
|
||||
if(doc.disabled == 1){
|
||||
cur_frm.add_custom_button(__('Enable Template'), function() {
|
||||
enable_template(cur_frm);
|
||||
} );
|
||||
}
|
||||
else{
|
||||
cur_frm.add_custom_button(__('Disable Template'), function() {
|
||||
disable_template(cur_frm);
|
||||
} );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var disable_template = function(frm){
|
||||
var doc = frm.doc;
|
||||
frappe.call({
|
||||
method: "erpnext.healthcare.doctype.lab_test_template.lab_test_template.disable_enable_test_template",
|
||||
args: {status: 1, name: doc.name, is_billable: doc.is_billable},
|
||||
callback: function(){
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var enable_template = function(frm){
|
||||
var doc = frm.doc;
|
||||
frappe.call({
|
||||
method: "erpnext.healthcare.doctype.lab_test_template.lab_test_template.disable_enable_test_template",
|
||||
args: {status: 0, name: doc.name, is_billable: doc.is_billable},
|
||||
callback: function(){
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
var change_template_code = function(frm,doc){
|
||||
var d = new frappe.ui.Dialog({
|
||||
title:__("Change Template Code"),
|
||||
fields:[
|
||||
{
|
||||
"fieldtype": "Data",
|
||||
"label": "Test Template Code",
|
||||
"fieldname": "Test Code",
|
||||
reqd:1
|
||||
},
|
||||
{
|
||||
"fieldtype": "Button",
|
||||
"label": __("Change Code"),
|
||||
click: function() {
|
||||
var values = d.get_values();
|
||||
if(!values)
|
||||
return;
|
||||
change_test_code_from_template(values["Test Code"],doc);
|
||||
d.hide();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
d.show();
|
||||
d.set_values({
|
||||
'Test Code': doc.test_code
|
||||
});
|
||||
|
||||
var change_test_code_from_template = function(test_code,doc){
|
||||
frappe.call({
|
||||
"method": "erpnext.healthcare.doctype.lab_test_template.lab_test_template.change_test_code_from_template",
|
||||
"args": {test_code: test_code, doc: doc},
|
||||
callback: function (data) {
|
||||
frappe.set_route("Form", "Lab Test Template", data.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
frappe.ui.form.on("Lab Test Template", "test_name", function(frm){
|
||||
|
||||
frm.doc.change_in_item = 1;
|
||||
|
||||
});
|
||||
frappe.ui.form.on("Lab Test Template", "test_rate", function(frm){
|
||||
|
||||
frm.doc.change_in_item = 1;
|
||||
|
||||
});
|
||||
frappe.ui.form.on("Lab Test Template", "test_group", function(frm){
|
||||
|
||||
frm.doc.change_in_item = 1;
|
||||
|
||||
});
|
||||
frappe.ui.form.on("Lab Test Template", "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) {
|
||||
var child = locals[cdt][cdn];
|
||||
if(child.template_or_new_line =="Add new line"){
|
||||
frappe.model.set_value(cdt, cdn, 'test_template', "");
|
||||
frappe.model.set_value(cdt, cdn, 'test_description', "");
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,978 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:test_code",
|
||||
"beta": 1,
|
||||
"creation": "2016-03-29 17:35:36.761223",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 0,
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "test_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": "Test Name",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"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": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "item",
|
||||
"fieldtype": "Link",
|
||||
"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": "Item",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "Item",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "test_code",
|
||||
"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": "Item Code",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"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": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "",
|
||||
"fieldname": "test_group",
|
||||
"fieldtype": "Link",
|
||||
"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": "Item Group",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Item Group",
|
||||
"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_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "department",
|
||||
"fieldtype": "Link",
|
||||
"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": "Department",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Medical Department",
|
||||
"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_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_3",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "",
|
||||
"description": "Single for results which require only a single input, result UOM and normal value \n<br>\nCompound for results which require multiple input fields with corresponding event names, result UOMs and normal values\n<br>\nDescriptive for tests which have multiple result components and corresponding result entry fields. \n<br>\nGrouped for test templates which are a group of other test templates.\n<br>\nNo Result for tests with no results. Also, no Lab Test is created. e.g.. Sub Tests for Grouped results.",
|
||||
"fieldname": "test_template_type",
|
||||
"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": "Result Format",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "\nSingle\nCompound\nDescriptive\nGrouped\nNo Result",
|
||||
"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,
|
||||
"default": "1",
|
||||
"depends_on": "eval:doc.test_template_type != 'Grouped'",
|
||||
"description": "If unchecked, the item wont be appear in Sales Invoice, but can be used in group test creation. ",
|
||||
"fieldname": "is_billable",
|
||||
"fieldtype": "Check",
|
||||
"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": "Is billable",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.is_billable == 1",
|
||||
"description": "This value is updated in the Default Sales Price List.",
|
||||
"fieldname": "test_rate",
|
||||
"fieldtype": "Currency",
|
||||
"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": "Standard Selling Rate",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"collapsible_depends_on": "",
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.test_template_type == 'Single'",
|
||||
"fieldname": "section_break_normal",
|
||||
"fieldtype": "Section 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,
|
||||
"label": "Lab Routine",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "test_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": "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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "test_normal_range",
|
||||
"fieldtype": "Long Text",
|
||||
"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": "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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_10",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"collapsible_depends_on": "",
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.test_template_type == 'Compound'",
|
||||
"fieldname": "section_break_compound",
|
||||
"fieldtype": "Section 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,
|
||||
"label": "Compound",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "normal_test_templates",
|
||||
"fieldtype": "Table",
|
||||
"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,
|
||||
"options": "Normal 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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.test_template_type == 'Descriptive'",
|
||||
"fieldname": "section_break_special",
|
||||
"fieldtype": "Section 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,
|
||||
"label": "Special",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fieldname": "sensitivity",
|
||||
"fieldtype": "Check",
|
||||
"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": "Sensitivity",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "special_test_template",
|
||||
"fieldtype": "Table",
|
||||
"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,
|
||||
"options": "Special 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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.test_template_type == 'Grouped'",
|
||||
"fieldname": "section_break_group",
|
||||
"fieldtype": "Section 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,
|
||||
"label": "Group",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "test_groups",
|
||||
"fieldtype": "Table",
|
||||
"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": "Lab Test Groups",
|
||||
"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": "section_break_description",
|
||||
"fieldtype": "Section 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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "test_description",
|
||||
"fieldtype": "Text",
|
||||
"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": "Description",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"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": "sb_sample_collection",
|
||||
"fieldtype": "Section 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,
|
||||
"label": "Sample Collection",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sample",
|
||||
"fieldtype": "Link",
|
||||
"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": "Sample",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Lab Test Sample",
|
||||
"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": "sample_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,
|
||||
"options": "sample.sample_uom",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fieldname": "sample_quantity",
|
||||
"fieldtype": "Float",
|
||||
"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": "Quantity",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sample_collection_details",
|
||||
"fieldtype": "Text",
|
||||
"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": "Collection Details",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fieldname": "change_in_item",
|
||||
"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": "Change In Item",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fieldname": "disabled",
|
||||
"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": "disabled",
|
||||
"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,
|
||||
"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": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-31 13:45:27.655822",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Lab Test Template",
|
||||
"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,
|
||||
"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,
|
||||
"write": 0
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"search_fields": "test_code,test_name,test_template_type",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "test_name",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe, json
|
||||
from frappe.model.document import Document
|
||||
from frappe import _
|
||||
|
||||
class LabTestTemplate(Document):
|
||||
def on_update(self):
|
||||
#Item and Price List update --> if (change_in_item)
|
||||
if(self.change_in_item and self.is_billable == 1 and self.item):
|
||||
updating_item(self)
|
||||
if not item_price_exist(self):
|
||||
if(self.test_rate != 0.0):
|
||||
price_list_name = frappe.db.get_value("Price List", {"selling": 1})
|
||||
if(self.test_rate):
|
||||
make_item_price(self.test_code, price_list_name, self.test_rate)
|
||||
else:
|
||||
make_item_price(self.test_code, price_list_name, 0.0)
|
||||
|
||||
frappe.db.set_value(self.doctype,self.name,"change_in_item",0)
|
||||
elif(self.is_billable == 0 and self.item):
|
||||
frappe.db.set_value("Item",self.item,"disabled",1)
|
||||
self.reload()
|
||||
|
||||
def after_insert(self):
|
||||
if not self.item:
|
||||
create_item_from_template(self)
|
||||
|
||||
#Call before delete the template
|
||||
def on_trash(self):
|
||||
# remove template refernce from item and disable item
|
||||
if(self.item):
|
||||
try:
|
||||
frappe.delete_doc("Item",self.item)
|
||||
except Exception:
|
||||
frappe.throw("""Not permitted. Please disable the Test Template""")
|
||||
|
||||
def item_price_exist(doc):
|
||||
item_price = frappe.db.exists({
|
||||
"doctype": "Item Price",
|
||||
"item_code": doc.test_code})
|
||||
if(item_price):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def updating_item(self):
|
||||
frappe.db.sql("""update `tabItem` set item_name=%s, item_group=%s, disabled=0, standard_rate=%s,
|
||||
description=%s, modified=NOW() where item_code=%s""",
|
||||
(self.test_name, self.test_group , self.test_rate, self.test_description, self.item))
|
||||
|
||||
def create_item_from_template(doc):
|
||||
if(doc.is_billable == 1):
|
||||
disabled = 0
|
||||
else:
|
||||
disabled = 1
|
||||
#insert item
|
||||
item = frappe.get_doc({
|
||||
"doctype": "Item",
|
||||
"item_code": doc.test_code,
|
||||
"item_name":doc.test_name,
|
||||
"item_group": doc.test_group,
|
||||
"description":doc.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": "Unit"
|
||||
}).insert(ignore_permissions=True)
|
||||
|
||||
#insert item price
|
||||
#get item price list to insert item price
|
||||
if(doc.test_rate != 0.0):
|
||||
price_list_name = frappe.db.get_value("Price List", {"selling": 1})
|
||||
if(doc.test_rate):
|
||||
make_item_price(item.name, price_list_name, doc.test_rate)
|
||||
item.standard_rate = doc.test_rate
|
||||
else:
|
||||
make_item_price(item.name, price_list_name, 0.0)
|
||||
item.standard_rate = 0.0
|
||||
item.save(ignore_permissions = True)
|
||||
#Set item to the template
|
||||
frappe.db.set_value("Lab Test Template", doc.name, "item", item.name)
|
||||
|
||||
doc.reload() #refresh the doc after insert.
|
||||
|
||||
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)
|
||||
|
||||
@frappe.whitelist()
|
||||
def change_test_code_from_template(test_code, doc):
|
||||
args = json.loads(doc)
|
||||
doc = frappe._dict(args)
|
||||
|
||||
item_exist = frappe.db.exists({
|
||||
"doctype": "Item",
|
||||
"item_code": test_code})
|
||||
if(item_exist):
|
||||
frappe.throw(_("Code {0} already exist").format(test_code))
|
||||
else:
|
||||
frappe.rename_doc("Item", doc.name, test_code, ignore_permissions = True)
|
||||
frappe.db.set_value("Lab Test Template",doc.name,"test_code",test_code)
|
||||
frappe.rename_doc("Lab Test Template", doc.name, test_code, ignore_permissions = True)
|
||||
return test_code
|
||||
|
||||
@frappe.whitelist()
|
||||
def disable_enable_test_template(status, name, is_billable):
|
||||
frappe.db.set_value("Lab Test Template",name,"disabled",status)
|
||||
if(is_billable == 1):
|
||||
frappe.db.set_value("Item",name,"disabled",status)
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
(c) ESS 2015-16
|
||||
*/
|
||||
frappe.listview_settings['Lab Test Template'] = {
|
||||
add_fields: ["test_name", "test_code", "test_rate"],
|
||||
filters:[["disabled","=",0]],
|
||||
/* get_indicator: function(doc) {
|
||||
if(doc.disabled==1){
|
||||
return [__("Disabled"), "red", "disabled,=,Disabled"];
|
||||
}
|
||||
if(doc.disabled==0){
|
||||
return [__("Enabled"), "green", "disabled,=,0"];
|
||||
}
|
||||
} */
|
||||
};
|
||||
@@ -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: Lab Test Template", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Lab Test Template
|
||||
() => frappe.tests.make('Lab Test Template', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Lab Test Template')
|
||||
|
||||
class TestLabTestTemplate(unittest.TestCase):
|
||||
pass
|
||||
0
erpnext/healthcare/doctype/lab_test_uom/__init__.py
Normal file
0
erpnext/healthcare/doctype/lab_test_uom/__init__.py
Normal file
5
erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.js
Normal file
5
erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) 2016, ESS and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Lab Test UOM', {
|
||||
});
|
||||
145
erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.json
Normal file
145
erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.json
Normal file
@@ -0,0 +1,145 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:test_uom",
|
||||
"beta": 1,
|
||||
"creation": "2016-03-29 17:28:08.630148",
|
||||
"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": "test_uom",
|
||||
"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": "Test UOM",
|
||||
"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_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "uom_description",
|
||||
"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": "Description",
|
||||
"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,
|
||||
"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": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-31 13:41:40.186676",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Lab Test UOM",
|
||||
"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,
|
||||
"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,
|
||||
"write": 0
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"search_fields": "test_uom",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "test_uom",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
9
erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.py
Normal file
9
erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.py
Normal file
@@ -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 LabTestUOM(Document):
|
||||
pass
|
||||
23
erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.js
Normal file
23
erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.js
Normal file
@@ -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: Lab Test UOM", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Lab Test UOM
|
||||
() => frappe.tests.make('Lab Test UOM', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
10
erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.py
Normal file
10
erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, ESS and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Lab Test UOM')
|
||||
|
||||
class TestLabTestUOM(unittest.TestCase):
|
||||
pass
|
||||
0
erpnext/healthcare/doctype/medical_code/__init__.py
Normal file
0
erpnext/healthcare/doctype/medical_code/__init__.py
Normal file
5
erpnext/healthcare/doctype/medical_code/medical_code.js
Normal file
5
erpnext/healthcare/doctype/medical_code/medical_code.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Medical Code', {
|
||||
});
|
||||
156
erpnext/healthcare/doctype/medical_code/medical_code.json
Normal file
156
erpnext/healthcare/doctype/medical_code/medical_code.json
Normal file
@@ -0,0 +1,156 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"beta": 1,
|
||||
"creation": "2017-06-21 13:02:56.122897",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "medical_code_standard",
|
||||
"fieldtype": "Link",
|
||||
"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": "Medical Code Standard",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Medical Code Standard",
|
||||
"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_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "code",
|
||||
"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": "Code",
|
||||
"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_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "description",
|
||||
"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": "Description",
|
||||
"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,
|
||||
"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": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-31 14:01:18.817484",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Medical Code",
|
||||
"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": "Physician",
|
||||
"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": "code, description",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
10
erpnext/healthcare/doctype/medical_code/medical_code.py
Normal file
10
erpnext/healthcare/doctype/medical_code/medical_code.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, 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 MedicalCode(Document):
|
||||
def autoname(self):
|
||||
self.name = self.medical_code_standard+" "+self.code
|
||||
23
erpnext/healthcare/doctype/medical_code/test_medical_code.js
Normal file
23
erpnext/healthcare/doctype/medical_code/test_medical_code.js
Normal file
@@ -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: Medical Code", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Medical Code
|
||||
() => frappe.tests.make('Medical Code', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
|
||||
class TestMedicalCode(unittest.TestCase):
|
||||
pass
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user