Browse Source

refactor!: Removed healthcare module from ERPNext (#27362)

* chore: Removed healthcare module

* chore: Removed healthcare demo, patch files

* chore: Rename imports from erpnext to healthcare

* chore: Added healthcare deprecation warning patch

* chore: Removed healthcare module code in other modules

* chore: Code clean up

* refactor: Remove sales invoice custom js related to healthcare

* fix: sider

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
develop
Rucha Mahabal 3 years ago
committed by GitHub
parent
commit
5905cf9002
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
  2. 273
      erpnext/accounts/doctype/sales_invoice/sales_invoice.js
  3. 53
      erpnext/accounts/doctype/sales_invoice/sales_invoice.py
  4. 30
      erpnext/controllers/queries.py
  5. 4
      erpnext/demo/demo.py
  6. 3
      erpnext/demo/domains.py
  7. 171
      erpnext/demo/setup/healthcare.py
  8. 4
      erpnext/demo/setup/setup_data.py
  9. 71
      erpnext/domains/healthcare.py
  10. 0
      erpnext/healthcare/__init__.py
  11. 26
      erpnext/healthcare/dashboard_chart/clinical_procedures/clinical_procedures.json
  12. 26
      erpnext/healthcare/dashboard_chart/clinical_procedures_status/clinical_procedures_status.json
  13. 25
      erpnext/healthcare/dashboard_chart/department_wise_patient_appointments/department_wise_patient_appointments.json
  14. 26
      erpnext/healthcare/dashboard_chart/diagnoses/diagnoses.json
  15. 26
      erpnext/healthcare/dashboard_chart/in_patient_status/in_patient_status.json
  16. 26
      erpnext/healthcare/dashboard_chart/lab_tests/lab_tests.json
  17. 27
      erpnext/healthcare/dashboard_chart/patient_appointments/patient_appointments.json
  18. 26
      erpnext/healthcare/dashboard_chart/symptoms/symptoms.json
  19. 0
      erpnext/healthcare/dashboard_chart_source/__init__.py
  20. 0
      erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/__init__.py
  21. 14
      erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.js
  22. 13
      erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.json
  23. 74
      erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.py
  24. 122
      erpnext/healthcare/desk_page/healthcare/healthcare.json
  25. 0
      erpnext/healthcare/doctype/__init__.py
  26. 0
      erpnext/healthcare/doctype/antibiotic/__init__.py
  27. 5
      erpnext/healthcare/doctype/antibiotic/antibiotic.js
  28. 151
      erpnext/healthcare/doctype/antibiotic/antibiotic.json
  29. 11
      erpnext/healthcare/doctype/antibiotic/antibiotic.py
  30. 10
      erpnext/healthcare/doctype/antibiotic/test_antibiotic.py
  31. 0
      erpnext/healthcare/doctype/appointment_type/__init__.py
  32. 83
      erpnext/healthcare/doctype/appointment_type/appointment_type.js
  33. 114
      erpnext/healthcare/doctype/appointment_type/appointment_type.json
  34. 58
      erpnext/healthcare/doctype/appointment_type/appointment_type.py
  35. 15
      erpnext/healthcare/doctype/appointment_type/appointment_type_dashboard.py
  36. 11
      erpnext/healthcare/doctype/appointment_type/test_appointment_type.py
  37. 0
      erpnext/healthcare/doctype/appointment_type_service_item/__init__.py
  38. 67
      erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.json
  39. 12
      erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.py
  40. 0
      erpnext/healthcare/doctype/body_part/__init__.py
  41. 8
      erpnext/healthcare/doctype/body_part/body_part.js
  42. 45
      erpnext/healthcare/doctype/body_part/body_part.json
  43. 12
      erpnext/healthcare/doctype/body_part/body_part.py
  44. 11
      erpnext/healthcare/doctype/body_part/test_body_part.py
  45. 0
      erpnext/healthcare/doctype/body_part_link/__init__.py
  46. 32
      erpnext/healthcare/doctype/body_part_link/body_part_link.json
  47. 12
      erpnext/healthcare/doctype/body_part_link/body_part_link.py
  48. 0
      erpnext/healthcare/doctype/clinical_procedure/__init__.py
  49. 377
      erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.js
  50. 345
      erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.json
  51. 255
      erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py
  52. 11
      erpnext/healthcare/doctype/clinical_procedure/clinical_procedure_list.js
  53. 71
      erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py
  54. 0
      erpnext/healthcare/doctype/clinical_procedure_item/__init__.py
  55. 123
      erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.json
  56. 11
      erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.py
  57. 0
      erpnext/healthcare/doctype/clinical_procedure_template/__init__.py
  58. 190
      erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.js
  59. 257
      erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.json
  60. 124
      erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py
  61. 15
      erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template_dashboard.py
  62. 10
      erpnext/healthcare/doctype/clinical_procedure_template/test_clinical_procedure_template.py
  63. 0
      erpnext/healthcare/doctype/codification_table/__init__.py
  64. 56
      erpnext/healthcare/doctype/codification_table/codification_table.json
  65. 11
      erpnext/healthcare/doctype/codification_table/codification_table.py
  66. 0
      erpnext/healthcare/doctype/complaint/__init__.py
  67. 5
      erpnext/healthcare/doctype/complaint/complaint.js
  68. 116
      erpnext/healthcare/doctype/complaint/complaint.json
  69. 11
      erpnext/healthcare/doctype/complaint/complaint.py
  70. 10
      erpnext/healthcare/doctype/complaint/test_complaint.py
  71. 0
      erpnext/healthcare/doctype/descriptive_test_result/__init__.py
  72. 74
      erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.json
  73. 11
      erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.py
  74. 0
      erpnext/healthcare/doctype/descriptive_test_template/__init__.py
  75. 41
      erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.json
  76. 11
      erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.py
  77. 0
      erpnext/healthcare/doctype/diagnosis/__init__.py
  78. 5
      erpnext/healthcare/doctype/diagnosis/diagnosis.js
  79. 116
      erpnext/healthcare/doctype/diagnosis/diagnosis.json
  80. 11
      erpnext/healthcare/doctype/diagnosis/diagnosis.py
  81. 11
      erpnext/healthcare/doctype/diagnosis/test_diagnosis.py
  82. 0
      erpnext/healthcare/doctype/dosage_form/__init__.py
  83. 5
      erpnext/healthcare/doctype/dosage_form/dosage_form.js
  84. 114
      erpnext/healthcare/doctype/dosage_form/dosage_form.json
  85. 11
      erpnext/healthcare/doctype/dosage_form/dosage_form.py
  86. 10
      erpnext/healthcare/doctype/dosage_form/test_dosage_form.py
  87. 0
      erpnext/healthcare/doctype/dosage_strength/__init__.py
  88. 102
      erpnext/healthcare/doctype/dosage_strength/dosage_strength.json
  89. 11
      erpnext/healthcare/doctype/dosage_strength/dosage_strength.py
  90. 0
      erpnext/healthcare/doctype/drug_prescription/__init__.py
  91. 122
      erpnext/healthcare/doctype/drug_prescription/drug_prescription.json
  92. 36
      erpnext/healthcare/doctype/drug_prescription/drug_prescription.py
  93. 0
      erpnext/healthcare/doctype/exercise/__init__.py
  94. 62
      erpnext/healthcare/doctype/exercise/exercise.json
  95. 12
      erpnext/healthcare/doctype/exercise/exercise.py
  96. 0
      erpnext/healthcare/doctype/exercise_difficulty_level/__init__.py
  97. 8
      erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.js
  98. 45
      erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.json
  99. 12
      erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.py
  100. 11
      erpnext/healthcare/doctype/exercise_difficulty_level/test_exercise_difficulty_level.py

11
erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py

@ -7,10 +7,8 @@ from __future__ import unicode_literals
import unittest
import frappe
from frappe import MandatoryError
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
from erpnext.healthcare.doctype.lab_test_template.lab_test_template import make_item_price
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
from erpnext.stock.doctype.item.test_item import make_item
from erpnext.stock.get_item_details import get_item_details
@ -623,3 +621,12 @@ def delete_existing_pricing_rules():
"Pricing Rule Item Group", "Pricing Rule Brand"]:
frappe.db.sql("delete from `tab{0}`".format(doctype))
def make_item_price(item, price_list_name, item_price):
frappe.get_doc({
'doctype': 'Item Price',
'price_list': price_list_name,
'item_code': item,
'price_list_rate': item_price
}).insert(ignore_permissions=True, ignore_mandatory=True)

273
erpnext/accounts/doctype/sales_invoice/sales_invoice.js

@ -1033,276 +1033,3 @@ var select_loyalty_program = function(frm, loyalty_programs) {
dialog.show();
}
// Healthcare
var get_healthcare_services_to_invoice = function(frm) {
var me = this;
let selected_patient = '';
var dialog = new frappe.ui.Dialog({
title: __("Get Items from Healthcare Services"),
fields:[
{
fieldtype: 'Link',
options: 'Patient',
label: 'Patient',
fieldname: "patient",
reqd: true
},
{ fieldtype: 'Section Break' },
{ fieldtype: 'HTML', fieldname: 'results_area' }
]
});
var $wrapper;
var $results;
var $placeholder;
dialog.set_values({
'patient': frm.doc.patient
});
dialog.fields_dict["patient"].df.onchange = () => {
var patient = dialog.fields_dict.patient.input.value;
if(patient && patient!=selected_patient){
selected_patient = patient;
var method = "erpnext.healthcare.utils.get_healthcare_services_to_invoice";
var args = {patient: patient, company: frm.doc.company};
var columns = (["service", "reference_name", "reference_type"]);
get_healthcare_items(frm, true, $results, $placeholder, method, args, columns);
}
else if(!patient){
selected_patient = '';
$results.empty();
$results.append($placeholder);
}
}
$wrapper = dialog.fields_dict.results_area.$wrapper.append(`<div class="results"
style="border: 1px solid #d1d8dd; border-radius: 3px; height: 300px; overflow: auto;"></div>`);
$results = $wrapper.find('.results');
$placeholder = $(`<div class="multiselect-empty-state">
<span class="text-center" style="margin-top: -40px;">
<i class="fa fa-2x fa-heartbeat text-extra-muted"></i>
<p class="text-extra-muted">No billable Healthcare Services found</p>
</span>
</div>`);
$results.on('click', '.list-item--head :checkbox', (e) => {
$results.find('.list-item-container .list-row-check')
.prop("checked", ($(e.target).is(':checked')));
});
set_primary_action(frm, dialog, $results, true);
dialog.show();
};
var get_healthcare_items = function(frm, invoice_healthcare_services, $results, $placeholder, method, args, columns) {
var me = this;
$results.empty();
frappe.call({
method: method,
args: args,
callback: function(data) {
if(data.message){
$results.append(make_list_row(columns, invoice_healthcare_services));
for(let i=0; i<data.message.length; i++){
$results.append(make_list_row(columns, invoice_healthcare_services, data.message[i]));
}
}else {
$results.append($placeholder);
}
}
});
}
var make_list_row= function(columns, invoice_healthcare_services, result={}) {
var me = this;
// Make a head row by default (if result not passed)
let head = Object.keys(result).length === 0;
let contents = ``;
columns.forEach(function(column) {
contents += `<div class="list-item__content ellipsis">
${
head ? `<span class="ellipsis">${__(frappe.model.unscrub(column))}</span>`
:(column !== "name" ? `<span class="ellipsis">${__(result[column])}</span>`
: `<a class="list-id ellipsis">
${__(result[column])}</a>`)
}
</div>`;
})
let $row = $(`<div class="list-item">
<div class="list-item__content" style="flex: 0 0 10px;">
<input type="checkbox" class="list-row-check" ${result.checked ? 'checked' : ''}>
</div>
${contents}
</div>`);
$row = list_row_data_items(head, $row, result, invoice_healthcare_services);
return $row;
};
var set_primary_action= function(frm, dialog, $results, invoice_healthcare_services) {
var me = this;
dialog.set_primary_action(__('Add'), function() {
let checked_values = get_checked_values($results);
if(checked_values.length > 0){
if(invoice_healthcare_services) {
frm.set_value("patient", dialog.fields_dict.patient.input.value);
}
frm.set_value("items", []);
add_to_item_line(frm, checked_values, invoice_healthcare_services);
dialog.hide();
}
else{
if(invoice_healthcare_services){
frappe.msgprint(__("Please select Healthcare Service"));
}
else{
frappe.msgprint(__("Please select Drug"));
}
}
});
};
var get_checked_values= function($results) {
return $results.find('.list-item-container').map(function() {
let checked_values = {};
if ($(this).find('.list-row-check:checkbox:checked').length > 0 ) {
checked_values['dn'] = $(this).attr('data-dn');
checked_values['dt'] = $(this).attr('data-dt');
checked_values['item'] = $(this).attr('data-item');
if($(this).attr('data-rate') != 'undefined'){
checked_values['rate'] = $(this).attr('data-rate');
}
else{
checked_values['rate'] = false;
}
if($(this).attr('data-income-account') != 'undefined'){
checked_values['income_account'] = $(this).attr('data-income-account');
}
else{
checked_values['income_account'] = false;
}
if($(this).attr('data-qty') != 'undefined'){
checked_values['qty'] = $(this).attr('data-qty');
}
else{
checked_values['qty'] = false;
}
if($(this).attr('data-description') != 'undefined'){
checked_values['description'] = $(this).attr('data-description');
}
else{
checked_values['description'] = false;
}
return checked_values;
}
}).get();
};
var get_drugs_to_invoice = function(frm) {
var me = this;
let selected_encounter = '';
var dialog = new frappe.ui.Dialog({
title: __("Get Items from Prescriptions"),
fields:[
{ fieldtype: 'Link', options: 'Patient', label: 'Patient', fieldname: "patient", reqd: true },
{ fieldtype: 'Link', options: 'Patient Encounter', label: 'Patient Encounter', fieldname: "encounter", reqd: true,
description:'Quantity will be calculated only for items which has "Nos" as UoM. You may change as required for each invoice item.',
get_query: function(doc) {
return {
filters: {
patient: dialog.get_value("patient"),
company: frm.doc.company,
docstatus: 1
}
};
}
},
{ fieldtype: 'Section Break' },
{ fieldtype: 'HTML', fieldname: 'results_area' }
]
});
var $wrapper;
var $results;
var $placeholder;
dialog.set_values({
'patient': frm.doc.patient,
'encounter': ""
});
dialog.fields_dict["encounter"].df.onchange = () => {
var encounter = dialog.fields_dict.encounter.input.value;
if(encounter && encounter!=selected_encounter){
selected_encounter = encounter;
var method = "erpnext.healthcare.utils.get_drugs_to_invoice";
var args = {encounter: encounter};
var columns = (["drug_code", "quantity", "description"]);
get_healthcare_items(frm, false, $results, $placeholder, method, args, columns);
}
else if(!encounter){
selected_encounter = '';
$results.empty();
$results.append($placeholder);
}
}
$wrapper = dialog.fields_dict.results_area.$wrapper.append(`<div class="results"
style="border: 1px solid #d1d8dd; border-radius: 3px; height: 300px; overflow: auto;"></div>`);
$results = $wrapper.find('.results');
$placeholder = $(`<div class="multiselect-empty-state">
<span class="text-center" style="margin-top: -40px;">
<i class="fa fa-2x fa-heartbeat text-extra-muted"></i>
<p class="text-extra-muted">No Drug Prescription found</p>
</span>
</div>`);
$results.on('click', '.list-item--head :checkbox', (e) => {
$results.find('.list-item-container .list-row-check')
.prop("checked", ($(e.target).is(':checked')));
});
set_primary_action(frm, dialog, $results, false);
dialog.show();
};
var list_row_data_items = function(head, $row, result, invoice_healthcare_services) {
if(invoice_healthcare_services){
head ? $row.addClass('list-item--head')
: $row = $(`<div class="list-item-container"
data-dn= "${result.reference_name}" data-dt= "${result.reference_type}" data-item= "${result.service}"
data-rate = ${result.rate}
data-income-account = "${result.income_account}"
data-qty = ${result.qty}
data-description = "${result.description}">
</div>`).append($row);
}
else{
head ? $row.addClass('list-item--head')
: $row = $(`<div class="list-item-container"
data-item= "${result.drug_code}"
data-qty = ${result.quantity}
data-description = "${result.description}">
</div>`).append($row);
}
return $row
};
var add_to_item_line = function(frm, checked_values, invoice_healthcare_services){
if(invoice_healthcare_services){
frappe.call({
doc: frm.doc,
method: "set_healthcare_services",
args:{
checked_values: checked_values
},
callback: function() {
frm.trigger("validate");
frm.refresh_fields();
}
});
}
else{
for(let i=0; i<checked_values.length; i++){
var si_item = frappe.model.add_child(frm.doc, 'Sales Invoice Item', 'items');
frappe.model.set_value(si_item.doctype, si_item.name, 'item_code', checked_values[i]['item']);
frappe.model.set_value(si_item.doctype, si_item.name, 'qty', 1);
if(checked_values[i]['qty'] > 1){
frappe.model.set_value(si_item.doctype, si_item.name, 'qty', parseFloat(checked_values[i]['qty']));
}
}
frm.refresh_fields();
}
};

53
erpnext/accounts/doctype/sales_invoice/sales_invoice.py

@ -40,7 +40,6 @@ from erpnext.assets.doctype.asset.depreciation import (
post_depreciation_entries,
)
from erpnext.controllers.selling_controller import SellingController
from erpnext.healthcare.utils import manage_invoice_submit_cancel
from erpnext.projects.doctype.timesheet.timesheet import get_projectwise_timesheet_data
from erpnext.setup.doctype.company.company import update_company_current_month_sales
from erpnext.stock.doctype.batch.batch import set_batch_nos
@ -263,13 +262,6 @@ class SalesInvoice(SellingController):
if self.redeem_loyalty_points and not self.is_consolidated and self.loyalty_points:
self.apply_loyalty_points()
# Healthcare Service Invoice.
domain_settings = frappe.get_doc('Domain Settings')
active_domains = [d.domain for d in domain_settings.active_domains]
if "Healthcare" in active_domains:
manage_invoice_submit_cancel(self, "on_submit")
self.process_common_party_accounting()
def validate_pos_return(self):
@ -352,12 +344,6 @@ class SalesInvoice(SellingController):
unlink_inter_company_doc(self.doctype, self.name, self.inter_company_invoice_reference)
# Healthcare Service Invoice.
domain_settings = frappe.get_doc('Domain Settings')
active_domains = [d.domain for d in domain_settings.active_domains]
if "Healthcare" in active_domains:
manage_invoice_submit_cancel(self, "on_cancel")
self.unlink_sales_invoice_from_timesheets()
self.ignore_linked_doctypes = ('GL Entry', 'Stock Ledger Entry', 'Repost Item Valuation')
@ -1430,45 +1416,6 @@ class SalesInvoice(SellingController):
if points_to_redeem < 1: # since points_to_redeem is integer
break
# Healthcare
@frappe.whitelist()
def set_healthcare_services(self, checked_values):
self.set("items", [])
from erpnext.stock.get_item_details import get_item_details
for checked_item in checked_values:
item_line = self.append("items", {})
price_list, price_list_currency = frappe.db.get_values("Price List", {"selling": 1}, ['name', 'currency'])[0]
args = {
'doctype': "Sales Invoice",
'item_code': checked_item['item'],
'company': self.company,
'customer': frappe.db.get_value("Patient", self.patient, "customer"),
'selling_price_list': price_list,
'price_list_currency': price_list_currency,
'plc_conversion_rate': 1.0,
'conversion_rate': 1.0
}
item_details = get_item_details(args)
item_line.item_code = checked_item['item']
item_line.qty = 1
if checked_item['qty']:
item_line.qty = checked_item['qty']
if checked_item['rate']:
item_line.rate = checked_item['rate']
else:
item_line.rate = item_details.price_list_rate
item_line.amount = float(item_line.rate) * float(item_line.qty)
if checked_item['income_account']:
item_line.income_account = checked_item['income_account']
if checked_item['dt']:
item_line.reference_dt = checked_item['dt']
if checked_item['dn']:
item_line.reference_dn = checked_item['dn']
if checked_item['description']:
item_line.description = checked_item['description']
self.set_missing_values(for_validate = True)
def set_status(self, update=False, status=None, update_modified=True):
if self.is_new():
if self.get('amended_from'):

30
erpnext/controllers/queries.py

@ -696,36 +696,6 @@ def get_purchase_invoices(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql(query, filters)
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_healthcare_service_units(doctype, txt, searchfield, start, page_len, filters):
query = """
select name
from `tabHealthcare Service Unit`
where
is_group = 0
and company = {company}
and name like {txt}""".format(
company = frappe.db.escape(filters.get('company')), txt = frappe.db.escape('%{0}%'.format(txt)))
if filters and filters.get('inpatient_record'):
from erpnext.healthcare.doctype.inpatient_medication_entry.inpatient_medication_entry import (
get_current_healthcare_service_unit,
)
service_unit = get_current_healthcare_service_unit(filters.get('inpatient_record'))
# if the patient is admitted, then appointments should be allowed against the admission service unit,
# inspite of it being an Inpatient Occupancy service unit
if service_unit:
query += " and (allow_appointments = 1 or name = {service_unit})".format(service_unit = frappe.db.escape(service_unit))
else:
query += " and allow_appointments = 1"
else:
query += " and allow_appointments = 1"
return frappe.db.sql(query, filters)
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_tax_template(doctype, txt, searchfield, start, page_len, filters):

4
erpnext/demo/demo.py

@ -6,7 +6,7 @@ import frappe
import frappe.utils
import erpnext
from erpnext.demo.setup import education, healthcare, manufacture, retail, setup_data
from erpnext.demo.setup import education, manufacture, retail, setup_data
from erpnext.demo.user import accounts
from erpnext.demo.user import education as edu
from erpnext.demo.user import fixed_asset, hr, manufacturing, projects, purchase, sales, stock
@ -38,8 +38,6 @@ def make(domain='Manufacturing', days=100):
retail.setup_data()
elif domain== 'Education':
education.setup_data()
elif domain== 'Healthcare':
healthcare.setup_data()
site = frappe.local.site
frappe.destroy()

3
erpnext/demo/domains.py

@ -16,9 +16,6 @@ data = {
'Education': {
'company_name': 'Whitmore College'
},
'Healthcare': {
'company_name': 'ABC Hospital Ltd.'
},
'Agriculture': {
'company_name': 'Schrute Farms'
},

171
erpnext/demo/setup/healthcare.py

@ -1,171 +0,0 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import datetime
import json
import frappe
from frappe.utils import getdate
from frappe.utils.make_random import get_random
from erpnext.demo.setup.setup_data import import_json
from erpnext.healthcare.doctype.lab_test.lab_test import create_test_from_template
def setup_data():
frappe.flags.mute_emails = True
make_masters()
make_patient()
make_lab_test()
make_consulation()
make_appointment()
consulation_on_appointment()
lab_test_on_encounter()
frappe.db.commit()
frappe.clear_cache()
def make_masters():
import_json("Healthcare Practitioner")
import_drug()
frappe.db.commit()
def make_patient():
file_path = get_json_path("Patient")
with open(file_path, "r") as open_file:
patient_data = json.loads(open_file.read())
count = 1
for d in enumerate(patient_data):
patient = frappe.new_doc("Patient")
patient.patient_name = d[1]['patient_name'].title()
patient.sex = d[1]['gender']
patient.blood_group = "A Positive"
patient.date_of_birth = datetime.datetime(1990, 3, 25)
patient.email_id = d[1]['patient_name'] + "_" + patient.date_of_birth.strftime('%m/%d/%Y') + "@example.com"
if count <5:
patient.insert()
frappe.db.commit()
count+=1
def make_appointment():
i = 1
while i <= 4:
practitioner = get_random("Healthcare Practitioner")
department = frappe.get_value("Healthcare Practitioner", practitioner, "department")
patient = get_random("Patient")
patient_sex = frappe.get_value("Patient", patient, "sex")
appointment = frappe.new_doc("Patient Appointment")
startDate = datetime.datetime.now()
for x in random_date(startDate,0):
appointment_datetime = x
appointment.appointment_datetime = appointment_datetime
appointment.appointment_time = appointment_datetime
appointment.appointment_date = appointment_datetime
appointment.patient = patient
appointment.patient_sex = patient_sex
appointment.practitioner = practitioner
appointment.department = department
appointment.save(ignore_permissions = True)
i += 1
def make_consulation():
for i in range(3):
practitioner = get_random("Healthcare Practitioner")
department = frappe.get_value("Healthcare Practitioner", practitioner, "department")
patient = get_random("Patient")
patient_sex = frappe.get_value("Patient", patient, "sex")
encounter = set_encounter(patient, patient_sex, practitioner, department, getdate(), i)
encounter.save(ignore_permissions=True)
def consulation_on_appointment():
for i in range(3):
appointment = get_random("Patient Appointment")
appointment = frappe.get_doc("Patient Appointment",appointment)
encounter = set_encounter(appointment.patient, appointment.patient_sex, appointment.practitioner, appointment.department, appointment.appointment_date, i)
encounter.appointment = appointment.name
encounter.save(ignore_permissions=True)
def set_encounter(patient, patient_sex, practitioner, department, encounter_date, i):
encounter = frappe.new_doc("Patient Encounter")
encounter.patient = patient
encounter.patient_sex = patient_sex
encounter.practitioner = practitioner
encounter.visit_department = department
encounter.encounter_date = encounter_date
if i > 2 and patient_sex=='Female':
encounter.symptoms = "Having chest pains for the last week."
encounter.diagnosis = """This patient's description of dull, aching,
exertion related substernal chest pain is suggestive of ischemic
cardiac origin. Her findings of a FH of early ASCVD, hypertension,
and early surgical menopause are pertinent risk factors for development
of coronary artery disease. """
else:
encounter = append_drug_rx(encounter)
encounter = append_test_rx(encounter)
return encounter
def make_lab_test():
practitioner = get_random("Healthcare Practitioner")
patient = get_random("Patient")
patient_sex = frappe.get_value("Patient", patient, "sex")
template = get_random("Lab Test Template")
set_lab_test(patient, patient_sex, practitioner, template)
def lab_test_on_encounter():
i = 1
while i <= 2:
test_rx = get_random("Lab Prescription", filters={'test_created': 0})
test_rx = frappe.get_doc("Lab Prescription", test_rx)
encounter = frappe.get_doc("Patient Encounter", test_rx.parent)
set_lab_test(encounter.patient, encounter.patient_sex, encounter.practitioner, test_rx.test_code, test_rx.name)
i += 1
def set_lab_test(patient, patient_sex, practitioner, template, rx=None):
lab_test = frappe.new_doc("Lab Test")
lab_test.practitioner = practitioner
lab_test.patient = patient
lab_test.patient_sex = patient_sex
lab_test.template = template
lab_test.prescription = rx
create_test_from_template(lab_test)
def append_test_rx(encounter):
i = 1
while i <= 2:
test_rx = encounter.append("test_prescription")
test_rx.test_code = get_random("Lab Test Template")
i += 1
return encounter
def append_drug_rx(encounter):
i = 1
while i <= 3:
drug = get_random("Item", filters={"item_group":"Drug"})
drug = frappe.get_doc("Item", drug)
drug_rx = encounter.append("drug_prescription")
drug_rx.drug_code = drug.item_code
drug_rx.drug_name = drug.item_name
drug_rx.dosage = get_random("Prescription Dosage")
drug_rx.period = get_random("Prescription Duration")
i += 1
return encounter
def random_date(start,l):
current = start
while l >= 0:
curr = current + datetime.timedelta(minutes=60)
yield curr
l-=1
def import_drug():
frappe.flags.in_import = True
data = json.loads(open(frappe.get_app_path('erpnext', 'demo', 'data', 'drug_list.json')).read())
for d in data:
doc = frappe.new_doc("Item")
doc.update(d)
doc.insert()
frappe.flags.in_import = False
def get_json_path(doctype):
return frappe.get_app_path('erpnext', 'demo', 'data', frappe.scrub(doctype) + '.json')

4
erpnext/demo/setup/setup_data.py

@ -196,10 +196,6 @@ def setup_user_roles(domain):
'Purchase Manager', 'Projects User', 'Manufacturing User', 'Manufacturing Manager',
'Support Team')
if domain == "Healthcare":
user.add_roles('Physician', 'Healthcare Administrator', 'Laboratory User',
'Nursing User', 'Patient')
if domain == "Education":
user.add_roles('Academics User')

71
erpnext/domains/healthcare.py

@ -1,71 +0,0 @@
from __future__ import unicode_literals
data = {
'desktop_icons': [
'Patient',
'Patient Appointment',
'Patient Encounter',
'Lab Test',
'Healthcare',
'Vital Signs',
'Clinical Procedure',
'Inpatient Record',
'Accounts',
'Buying',
'Stock',
'HR',
'ToDo'
],
'default_portal_role': 'Patient',
'restricted_roles': [
'Healthcare Administrator',
'LabTest Approver',
'Laboratory User',
'Nursing User',
'Physician',
'Patient'
],
'custom_fields': {
'Sales Invoice': [
{
'fieldname': 'patient', 'label': 'Patient', 'fieldtype': 'Link', 'options': 'Patient',
'insert_after': 'naming_series'
},
{
'fieldname': 'patient_name', 'label': 'Patient Name', 'fieldtype': 'Data', 'fetch_from': 'patient.patient_name',
'insert_after': 'patient', 'read_only': True
},
{
'fieldname': 'ref_practitioner', 'label': 'Referring Practitioner', 'fieldtype': 'Link', 'options': 'Healthcare Practitioner',
'insert_after': 'customer'
}
],
'Sales Invoice Item': [
{
'fieldname': 'reference_dt', 'label': 'Reference DocType', 'fieldtype': 'Link', 'options': 'DocType',
'insert_after': 'edit_references'
},
{
'fieldname': 'reference_dn', 'label': 'Reference Name', 'fieldtype': 'Dynamic Link', 'options': 'reference_dt',
'insert_after': 'reference_dt'
}
],
'Stock Entry': [
{
'fieldname': 'inpatient_medication_entry', 'label': 'Inpatient Medication Entry', 'fieldtype': 'Link', 'options': 'Inpatient Medication Entry',
'insert_after': 'credit_note', 'read_only': True
}
],
'Stock Entry Detail': [
{
'fieldname': 'patient', 'label': 'Patient', 'fieldtype': 'Link', 'options': 'Patient',
'insert_after': 'po_detail', 'read_only': True
},
{
'fieldname': 'inpatient_medication_entry_child', 'label': 'Inpatient Medication Entry Child', 'fieldtype': 'Data',
'insert_after': 'patient', 'read_only': True
}
]
},
'on_setup': 'erpnext.healthcare.setup.setup_healthcare'
}

0
erpnext/healthcare/__init__.py

26
erpnext/healthcare/dashboard_chart/clinical_procedures/clinical_procedures.json

@ -1,26 +0,0 @@
{
"chart_name": "Clinical Procedures",
"chart_type": "Group By",
"creation": "2020-07-14 18:17:54.601236",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Clinical Procedure",
"dynamic_filters_json": "[[\"Clinical Procedure\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Clinical Procedure\",\"docstatus\",\"=\",\"1\",false]]",
"group_by_based_on": "procedure_template",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2021-01-30 21:03:30.086891",
"modified": "2021-02-01 13:36:04.469863",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Clinical Procedures",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

26
erpnext/healthcare/dashboard_chart/clinical_procedures_status/clinical_procedures_status.json

@ -1,26 +0,0 @@
{
"chart_name": "Clinical Procedure Status",
"chart_type": "Group By",
"creation": "2020-07-14 18:17:54.654325",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Clinical Procedure",
"dynamic_filters_json": "[[\"Clinical Procedure\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Clinical Procedure\",\"docstatus\",\"=\",\"1\",false]]",
"group_by_based_on": "status",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2021-02-01 13:36:38.787783",
"modified": "2021-02-01 13:37:18.718275",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Clinical Procedures Status",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

25
erpnext/healthcare/dashboard_chart/department_wise_patient_appointments/department_wise_patient_appointments.json

@ -1,25 +0,0 @@
{
"chart_name": "Department wise Patient Appointments",
"chart_type": "Custom",
"creation": "2020-07-17 11:25:37.190130",
"custom_options": "{\"colors\": [\"#7CD5FA\", \"#5F62F6\", \"#7544E2\", \"#EE5555\"], \"barOptions\": {\"stacked\": 1}, \"height\": 300}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\"}",
"filters_json": "{}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 15:32:05.827566",
"modified": "2020-07-22 15:35:12.798035",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Department wise Patient Appointments",
"number_of_groups": 0,
"owner": "Administrator",
"source": "Department wise Patient Appointments",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

26
erpnext/healthcare/dashboard_chart/diagnoses/diagnoses.json

@ -1,26 +0,0 @@
{
"chart_name": "Diagnoses",
"chart_type": "Group By",
"creation": "2020-07-14 18:17:54.705698",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Patient Encounter Diagnosis",
"dynamic_filters_json": "",
"filters_json": "[]",
"group_by_based_on": "diagnosis",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2021-01-30 21:03:33.729487",
"modified": "2021-02-01 13:34:57.385335",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Diagnoses",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

26
erpnext/healthcare/dashboard_chart/in_patient_status/in_patient_status.json

@ -1,26 +0,0 @@
{
"chart_name": "In-Patient Status",
"chart_type": "Group By",
"creation": "2020-07-14 18:17:54.629199",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Inpatient Record",
"dynamic_filters_json": "[[\"Inpatient Record\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[]",
"group_by_based_on": "status",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 13:22:46.792131",
"modified": "2020-07-22 13:33:16.008150",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "In-Patient Status",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

26
erpnext/healthcare/dashboard_chart/lab_tests/lab_tests.json

@ -1,26 +0,0 @@
{
"chart_name": "Lab Tests",
"chart_type": "Group By",
"creation": "2020-07-14 18:17:54.574903",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Lab Test",
"dynamic_filters_json": "[[\"Lab Test\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Lab Test\",\"docstatus\",\"=\",\"1\",false]]",
"group_by_based_on": "template",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2021-01-30 21:03:28.272914",
"modified": "2021-02-01 13:36:08.391433",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Lab Tests",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

27
erpnext/healthcare/dashboard_chart/patient_appointments/patient_appointments.json

@ -1,27 +0,0 @@
{
"based_on": "appointment_datetime",
"chart_name": "Patient Appointments",
"chart_type": "Count",
"creation": "2020-07-14 18:17:54.525082",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Patient Appointment",
"dynamic_filters_json": "[[\"Patient Appointment\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Patient Appointment\",\"status\",\"!=\",\"Cancelled\",false]]",
"idx": 0,
"is_public": 0,
"is_standard": 1,
"last_synced_on": "2020-07-22 13:22:46.830491",
"modified": "2020-07-22 13:38:02.254190",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Patient Appointments",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Daily",
"timeseries": 1,
"timespan": "Last Month",
"type": "Line",
"use_report_chart": 0,
"y_axis": []
}

26
erpnext/healthcare/dashboard_chart/symptoms/symptoms.json

@ -1,26 +0,0 @@
{
"chart_name": "Symptoms",
"chart_type": "Group By",
"creation": "2020-07-14 18:17:54.680852",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Patient Encounter Symptom",
"dynamic_filters_json": "",
"filters_json": "[]",
"group_by_based_on": "complaint",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2021-01-30 21:03:32.067473",
"modified": "2021-02-01 13:35:30.953718",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Symptoms",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

0
erpnext/healthcare/dashboard_chart_source/__init__.py

0
erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/__init__.py

14
erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.js

@ -1,14 +0,0 @@
frappe.provide('frappe.dashboards.chart_sources');
frappe.dashboards.chart_sources["Department wise Patient Appointments"] = {
method: "erpnext.healthcare.dashboard_chart_source.department_wise_patient_appointments.department_wise_patient_appointments.get",
filters: [
{
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company")
}
]
};

13
erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.json

@ -1,13 +0,0 @@
{
"creation": "2020-05-18 19:18:42.571045",
"docstatus": 0,
"doctype": "Dashboard Chart Source",
"idx": 0,
"modified": "2020-05-18 19:18:42.571045",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Department wise Patient Appointments",
"owner": "Administrator",
"source_name": "Department wise Patient Appointments",
"timeseries": 0
}

74
erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.py

@ -1,74 +0,0 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils.dashboard import cache_source
@frappe.whitelist()
@cache_source
def get(chart_name = None, chart = None, no_cache = None, filters = None, from_date = None,
to_date = None, timespan = None, time_interval = None, heatmap_year = None):
if chart_name:
chart = frappe.get_doc('Dashboard Chart', chart_name)
else:
chart = frappe._dict(frappe.parse_json(chart))
filters = frappe.parse_json(filters)
data = frappe.db.get_list('Medical Department', fields=['name'])
if not filters:
filters = {}
status = ['Open', 'Scheduled', 'Closed', 'Cancelled']
for department in data:
filters['department'] = department.name
department['total_appointments'] = frappe.db.count('Patient Appointment', filters=filters)
for entry in status:
filters['status'] = entry
department[frappe.scrub(entry)] = frappe.db.count('Patient Appointment', filters=filters)
filters.pop('status')
sorted_department_map = sorted(data, key = lambda i: i['total_appointments'], reverse=True)
if len(sorted_department_map) > 10:
sorted_department_map = sorted_department_map[:10]
labels = []
open_appointments = []
scheduled = []
closed = []
cancelled = []
for department in sorted_department_map:
labels.append(department.name)
open_appointments.append(department.open)
scheduled.append(department.scheduled)
closed.append(department.closed)
cancelled.append(department.cancelled)
return {
'labels': labels,
'datasets': [
{
'name': 'Open',
'values': open_appointments
},
{
'name': 'Scheduled',
'values': scheduled
},
{
'name': 'Closed',
'values': closed
},
{
'name': 'Cancelled',
'values': cancelled
}
],
'type': 'bar'
}

122
erpnext/healthcare/desk_page/healthcare/healthcare.json

@ -1,122 +0,0 @@
{
"cards": [
{
"hidden": 0,
"label": "Masters",
"links": "[\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Patient\",\n\t\t\"label\": \"Patient\",\n\t\t\"onboard\": 1\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Healthcare Practitioner\",\n\t\t\"label\":\"Healthcare Practitioner\",\n\t\t\"onboard\": 1\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Practitioner Schedule\",\n\t\t\"label\": \"Practitioner Schedule\",\n\t\t\"onboard\": 1\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Medical Department\",\n\t\t\"label\": \"Medical Department\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Healthcare Service Unit Type\",\n\t\t\"label\": \"Healthcare Service Unit Type\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Healthcare Service Unit\",\n\t\t\"label\": \"Healthcare Service Unit\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Medical Code Standard\",\n\t\t\"label\": \"Medical Code Standard\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Medical Code\",\n\t\t\"label\": \"Medical Code\"\n\t}\n]"
},
{
"hidden": 0,
"label": "Consultation Setup",
"links": "[\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Appointment Type\",\n\t\t\"label\": \"Appointment Type\"\n },\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Clinical Procedure Template\",\n\t\t\"label\": \"Clinical Procedure Template\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Prescription Dosage\",\n\t\t\"label\": \"Prescription Dosage\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Prescription Duration\",\n\t\t\"label\": \"Prescription Duration\"\n\t},\n\t{\n\t \"type\": \"doctype\",\n\t\t\"name\": \"Antibiotic\",\n\t\t\"label\": \"Antibiotic\"\n\t}\n]"
},
{
"hidden": 0,
"label": "Consultation",
"links": "[\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Patient Appointment\",\n\t\t\"label\": \"Patient Appointment\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Clinical Procedure\",\n\t\t\"label\": \"Clinical Procedure\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Patient Encounter\",\n\t\t\"label\": \"Patient Encounter\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Vital Signs\",\n\t\t\"label\": \"Vital Signs\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Complaint\",\n\t\t\"label\": \"Complaint\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Diagnosis\",\n\t\t\"label\": \"Diagnosis\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Fee Validity\",\n\t\t\"label\": \"Fee Validity\"\n\t}\n]"
},
{
"hidden": 0,
"label": "Settings",
"links": "[\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Healthcare Settings\",\n\t\t\"label\": \"Healthcare Settings\",\n\t\t\"onboard\": 1\n\t}\n]"
},
{
"hidden": 0,
"label": "Laboratory Setup",
"links": "[\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Lab Test Template\",\n\t\t\"label\": \"Lab Test Template\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Lab Test Sample\",\n\t\t\"label\": \"Lab Test Sample\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Lab Test UOM\",\n\t\t\"label\": \"Lab Test UOM\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Sensitivity\",\n\t\t\"label\": \"Sensitivity\"\n\t}\n]"
},
{
"hidden": 0,
"label": "Laboratory",
"links": "[\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Lab Test\",\n\t\t\"label\": \"Lab Test\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Sample Collection\",\n\t\t\"label\": \"Sample Collection\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Dosage Form\",\n\t\t\"label\": \"Dosage Form\"\n\t}\n]"
},
{
"hidden": 0,
"label": "Inpatient",
"links": "[\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Inpatient Record\",\n\t\t\"label\": \"Inpatient Record\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Inpatient Medication Order\",\n\t\t\"label\": \"Inpatient Medication Order\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Inpatient Medication Entry\",\n\t\t\"label\": \"Inpatient Medication Entry\"\n\t}\n]"
},
{
"hidden": 0,
"label": "Rehabilitation and Physiotherapy",
"links": "[\n {\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Exercise Type\",\n\t\t\"label\": \"Exercise Type\",\n\t\t\"onboard\": 1\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Therapy Type\",\n\t\t\"label\": \"Therapy Type\",\n\t\t\"onboard\": 1\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Therapy Plan\",\n\t\t\"label\": \"Therapy Plan\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Therapy Session\",\n\t\t\"label\": \"Therapy Session\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Patient Assessment Template\",\n\t\t\"label\": \"Patient Assessment Template\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Patient Assessment\",\n\t\t\"label\": \"Patient Assessment\"\n\t}\n]"
},
{
"hidden": 0,
"label": "Records and History",
"links": "[\n\t{\n\t\t\"type\": \"page\",\n\t\t\"name\": \"patient_history\",\n\t\t\"label\": \"Patient History\"\n\t},\n\t{\n\t\t\"type\": \"page\",\n\t\t\"name\": \"patient-progress\",\n\t\t\"label\": \"Patient Progress\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Patient Medical Record\",\n\t\t\"label\": \"Patient Medical Record\"\n\t}\n]"
},
{
"hidden": 0,
"label": "Reports",
"links": "[\n\t{\n\t\t\"type\": \"report\",\n\t\t\"is_query_report\": true,\n\t\t\"name\": \"Patient Appointment Analytics\",\n\t\t\"doctype\": \"Patient Appointment\"\n\t},\n\t{\n\t\t\"type\": \"report\",\n\t\t\"is_query_report\": true,\n\t\t\"name\": \"Lab Test Report\",\n\t\t\"doctype\": \"Lab Test\",\n\t\t\"label\": \"Lab Test Report\"\n\t},\n\t{\n\t\t\"type\": \"report\",\n\t\t\"is_query_report\": true,\n\t\t\"name\": \"Inpatient Medication Orders\",\n\t\t\"doctype\": \"Inpatient Medication Order\",\n\t\t\"label\": \"Inpatient Medication Orders\"\n\t}\n]"
}
],
"category": "Domains",
"charts": [
{
"chart_name": "Patient Appointments",
"label": "Patient Appointments"
}
],
"charts_label": "",
"creation": "2020-03-02 17:23:17.919682",
"developer_mode_only": 0,
"disable_user_customization": 0,
"docstatus": 0,
"doctype": "Desk Page",
"extends_another_page": 0,
"hide_custom": 0,
"idx": 0,
"is_standard": 1,
"label": "Healthcare",
"modified": "2020-11-26 22:09:09.164584",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Healthcare",
"onboarding": "Healthcare",
"owner": "Administrator",
"pin_to_bottom": 0,
"pin_to_top": 0,
"restrict_to_domain": "Healthcare",
"shortcuts": [
{
"color": "#ffe8cd",
"format": "{} Open",
"label": "Patient Appointment",
"link_to": "Patient Appointment",
"stats_filter": "{\n \"status\": \"Open\",\n \"company\": [\"like\", '%' + frappe.defaults.get_global_default(\"company\") + '%']\n}",
"type": "DocType"
},
{
"color": "#ffe8cd",
"format": "{} Active",
"label": "Patient",
"link_to": "Patient",
"stats_filter": "{\n \"status\": \"Active\"\n}",
"type": "DocType"
},
{
"color": "#cef6d1",
"format": "{} Vacant",
"label": "Healthcare Service Unit",
"link_to": "Healthcare Service Unit",
"stats_filter": "{\n \"occupancy_status\": \"Vacant\",\n \"is_group\": 0,\n \"company\": [\"like\", \"%\" + frappe.defaults.get_global_default(\"company\") + \"%\"]\n}",
"type": "DocType"
},
{
"label": "Healthcare Practitioner",
"link_to": "Healthcare Practitioner",
"type": "DocType"
},
{
"label": "Patient History",
"link_to": "patient_history",
"type": "Page"
},
{
"label": "Dashboard",
"link_to": "Healthcare",
"type": "Dashboard"
}
]
}

0
erpnext/healthcare/doctype/__init__.py

0
erpnext/healthcare/doctype/antibiotic/__init__.py

5
erpnext/healthcare/doctype/antibiotic/antibiotic.js

@ -1,5 +0,0 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Antibiotic', {
});

151
erpnext/healthcare/doctype/antibiotic/antibiotic.json

@ -1,151 +0,0 @@
{
"allow_copy": 1,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:antibiotic_name",
"beta": 1,
"creation": "2016-02-23 11:11:30.749731",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 0,
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "antibiotic_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Antibiotic Name",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "abbr",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Abbr",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 1
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2019-10-01 17:58:23.136498",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Antibiotic",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Healthcare Administrator",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Laboratory User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 0
}
],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"restrict_to_domain": "Healthcare",
"search_fields": "antibiotic_name",
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "antibiotic_name",
"track_changes": 0,
"track_seen": 0,
"track_views": 0
}

11
erpnext/healthcare/doctype/antibiotic/antibiotic.py

@ -1,11 +0,0 @@
# -*- 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

10
erpnext/healthcare/doctype/antibiotic/test_antibiotic.py

@ -1,10 +0,0 @@
# -*- 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
erpnext/healthcare/doctype/appointment_type/__init__.py

83
erpnext/healthcare/doctype/appointment_type/appointment_type.js

@ -1,83 +0,0 @@
// Copyright (c) 2016, ESS LLP and contributors
// For license information, please see license.txt
frappe.ui.form.on('Appointment Type', {
refresh: function(frm) {
frm.set_query('price_list', function() {
return {
filters: {'selling': 1}
};
});
frm.set_query('medical_department', 'items', function(doc) {
let item_list = doc.items.map(({medical_department}) => medical_department);
return {
filters: [
['Medical Department', 'name', 'not in', item_list]
]
};
});
frm.set_query('op_consulting_charge_item', 'items', function() {
return {
filters: {
is_stock_item: 0
}
};
});
frm.set_query('inpatient_visit_charge_item', 'items', function() {
return {
filters: {
is_stock_item: 0
}
};
});
}
});
frappe.ui.form.on('Appointment Type Service Item', {
op_consulting_charge_item: function(frm, cdt, cdn) {
let d = locals[cdt][cdn];
if (frm.doc.price_list && d.op_consulting_charge_item) {
frappe.call({
'method': 'frappe.client.get_value',
args: {
'doctype': 'Item Price',
'filters': {
'item_code': d.op_consulting_charge_item,
'price_list': frm.doc.price_list
},
'fieldname': ['price_list_rate']
},
callback: function(data) {
if (data.message.price_list_rate) {
frappe.model.set_value(cdt, cdn, 'op_consulting_charge', data.message.price_list_rate);
}
}
});
}
},
inpatient_visit_charge_item: function(frm, cdt, cdn) {
let d = locals[cdt][cdn];
if (frm.doc.price_list && d.inpatient_visit_charge_item) {
frappe.call({
'method': 'frappe.client.get_value',
args: {
'doctype': 'Item Price',
'filters': {
'item_code': d.inpatient_visit_charge_item,
'price_list': frm.doc.price_list
},
'fieldname': ['price_list_rate']
},
callback: function (data) {
if (data.message.price_list_rate) {
frappe.model.set_value(cdt, cdn, 'inpatient_visit_charge', data.message.price_list_rate);
}
}
});
}
}
});

114
erpnext/healthcare/doctype/appointment_type/appointment_type.json

@ -1,114 +0,0 @@
{
"actions": [],
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:appointment_type",
"beta": 1,
"creation": "2016-07-22 11:52:34.953019",
"doctype": "DocType",
"document_type": "Setup",
"engine": "InnoDB",
"field_order": [
"appointment_type",
"ip",
"default_duration",
"color",
"billing_section",
"price_list",
"items"
],
"fields": [
{
"allow_in_quick_entry": 1,
"fieldname": "appointment_type",
"fieldtype": "Data",
"ignore_xss_filter": 1,
"in_list_view": 1,
"label": "Type",
"reqd": 1,
"translatable": 1,
"unique": 1
},
{
"bold": 1,
"default": "0",
"fieldname": "ip",
"fieldtype": "Check",
"label": "Is Inpatient",
"print_hide": 1,
"report_hide": 1
},
{
"allow_in_quick_entry": 1,
"bold": 1,
"fieldname": "default_duration",
"fieldtype": "Int",
"in_filter": 1,
"in_list_view": 1,
"label": "Default Duration (In Minutes)"
},
{
"allow_in_quick_entry": 1,
"fieldname": "color",
"fieldtype": "Color",
"in_list_view": 1,
"label": "Color",
"no_copy": 1,
"report_hide": 1
},
{
"fieldname": "billing_section",
"fieldtype": "Section Break",
"label": "Billing"
},
{
"fieldname": "price_list",
"fieldtype": "Link",
"label": "Price List",
"options": "Price List"
},
{
"fieldname": "items",
"fieldtype": "Table",
"label": "Appointment Type Service Items",
"options": "Appointment Type Service Item"
}
],
"links": [],
"modified": "2021-01-22 09:41:05.010524",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Appointment Type",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Healthcare Administrator",
"share": 1,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Physician",
"share": 1,
"write": 1
}
],
"quick_entry": 1,
"restrict_to_domain": "Healthcare",
"search_fields": "appointment_type",
"sort_field": "modified",
"sort_order": "DESC"
}

58
erpnext/healthcare/doctype/appointment_type/appointment_type.py

@ -1,58 +0,0 @@
# -*- 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 AppointmentType(Document):
def validate(self):
if self.items and self.price_list:
for item in self.items:
existing_op_item_price = frappe.db.exists('Item Price', {
'item_code': item.op_consulting_charge_item,
'price_list': self.price_list
})
if not existing_op_item_price and item.op_consulting_charge_item and item.op_consulting_charge:
make_item_price(self.price_list, item.op_consulting_charge_item, item.op_consulting_charge)
existing_ip_item_price = frappe.db.exists('Item Price', {
'item_code': item.inpatient_visit_charge_item,
'price_list': self.price_list
})
if not existing_ip_item_price and item.inpatient_visit_charge_item and item.inpatient_visit_charge:
make_item_price(self.price_list, item.inpatient_visit_charge_item, item.inpatient_visit_charge)
@frappe.whitelist()
def get_service_item_based_on_department(appointment_type, department):
item_list = frappe.db.get_value('Appointment Type Service Item',
filters = {'medical_department': department, 'parent': appointment_type},
fieldname = ['op_consulting_charge_item',
'inpatient_visit_charge_item', 'op_consulting_charge', 'inpatient_visit_charge'],
as_dict = 1
)
# if department wise items are not set up
# use the generic items
if not item_list:
item_list = frappe.db.get_value('Appointment Type Service Item',
filters = {'parent': appointment_type},
fieldname = ['op_consulting_charge_item',
'inpatient_visit_charge_item', 'op_consulting_charge', 'inpatient_visit_charge'],
as_dict = 1
)
return item_list
def make_item_price(price_list, item, item_price):
frappe.get_doc({
'doctype': 'Item Price',
'price_list': price_list,
'item_code': item,
'price_list_rate': item_price
}).insert(ignore_permissions=True, ignore_mandatory=True)

15
erpnext/healthcare/doctype/appointment_type/appointment_type_dashboard.py

@ -1,15 +0,0 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'appointment_type',
'transactions': [
{
'label': _('Patient Appointments'),
'items': ['Patient Appointment']
},
]
}

11
erpnext/healthcare/doctype/appointment_type/test_appointment_type.py

@ -1,11 +0,0 @@
# -*- 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
erpnext/healthcare/doctype/appointment_type_service_item/__init__.py

67
erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.json

@ -1,67 +0,0 @@
{
"actions": [],
"creation": "2021-01-22 09:34:53.373105",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"medical_department",
"op_consulting_charge_item",
"op_consulting_charge",
"column_break_4",
"inpatient_visit_charge_item",
"inpatient_visit_charge"
],
"fields": [
{
"fieldname": "medical_department",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Medical Department",
"options": "Medical Department"
},
{
"fieldname": "op_consulting_charge_item",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Out Patient Consulting Charge Item",
"options": "Item"
},
{
"fieldname": "op_consulting_charge",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Out Patient Consulting Charge"
},
{
"fieldname": "column_break_4",
"fieldtype": "Column Break"
},
{
"fieldname": "inpatient_visit_charge_item",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Inpatient Visit Charge Item",
"options": "Item"
},
{
"fieldname": "inpatient_visit_charge",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Inpatient Visit Charge"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-08-17 06:05:02.240812",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Appointment Type Service Item",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

12
erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.py

@ -1,12 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, 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
class AppointmentTypeServiceItem(Document):
pass

0
erpnext/healthcare/doctype/body_part/__init__.py

8
erpnext/healthcare/doctype/body_part/body_part.js

@ -1,8 +0,0 @@
// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Body Part', {
// refresh: function(frm) {
// }
});

45
erpnext/healthcare/doctype/body_part/body_part.json

@ -1,45 +0,0 @@
{
"actions": [],
"autoname": "field:body_part",
"creation": "2020-04-10 12:21:55.036402",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"body_part"
],
"fields": [
{
"fieldname": "body_part",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Body Part",
"reqd": 1,
"unique": 1
}
],
"links": [],
"modified": "2020-04-10 12:26:44.087985",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Body Part",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

12
erpnext/healthcare/doctype/body_part/body_part.py

@ -1,12 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, 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
class BodyPart(Document):
pass

11
erpnext/healthcare/doctype/body_part/test_body_part.py

@ -1,11 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestBodyPart(unittest.TestCase):
pass

0
erpnext/healthcare/doctype/body_part_link/__init__.py

32
erpnext/healthcare/doctype/body_part_link/body_part_link.json

@ -1,32 +0,0 @@
{
"actions": [],
"creation": "2020-04-10 12:23:15.259816",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"body_part"
],
"fields": [
{
"fieldname": "body_part",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Body Part",
"options": "Body Part",
"reqd": 1
}
],
"istable": 1,
"links": [],
"modified": "2020-04-10 12:25:23.101749",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Body Part Link",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

12
erpnext/healthcare/doctype/body_part_link/body_part_link.py

@ -1,12 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, 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
class BodyPartLink(Document):
pass

0
erpnext/healthcare/doctype/clinical_procedure/__init__.py

377
erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.js

@ -1,377 +0,0 @@
// Copyright (c) 2017, ESS LLP and contributors
// For license information, please see license.txt
frappe.ui.form.on('Clinical Procedure', {
setup: function(frm) {
frm.set_query('batch_no', 'items', function(doc, cdt, cdn) {
let item = locals[cdt][cdn];
if (!item.item_code) {
frappe.throw(__('Please enter Item Code to get Batch Number'));
} else {
let filters = {'item_code': item.item_code};
if (frm.doc.status == 'In Progress') {
filters['posting_date'] = frm.doc.start_date || frappe.datetime.nowdate();
if (frm.doc.warehouse) filters['warehouse'] = frm.doc.warehouse;
}
return {
query : 'erpnext.controllers.queries.get_batch_no',
filters: filters
};
}
});
},
refresh: function(frm) {
frm.set_query('patient', function () {
return {
filters: {'status': ['!=', 'Disabled']}
};
});
frm.set_query('appointment', function () {
return {
filters: {
'procedure_template': ['not in', null],
'status': ['in', 'Open, Scheduled']
}
};
});
frm.set_query('service_unit', function() {
return {
filters: {
'is_group': false,
'allow_appointments': true,
'company': frm.doc.company
}
};
});
frm.set_query('practitioner', function() {
return {
filters: {
'department': frm.doc.medical_department
}
};
});
if (frm.doc.consume_stock) {
frm.set_indicator_formatter('item_code',
function(doc) { return (doc.qty<=doc.actual_qty) ? 'green' : 'orange' ; });
}
if (frm.doc.docstatus == 1) {
if (frm.doc.status == 'In Progress') {
let btn_label = '';
let msg = '';
if (frm.doc.consume_stock) {
btn_label = __('Complete and Consume');
msg = __('Complete {0} and Consume Stock?', [frm.doc.name]);
} else {
btn_label = 'Complete';
msg = __('Complete {0}?', [frm.doc.name]);
}
frm.add_custom_button(__(btn_label), function () {
frappe.confirm(
msg,
function() {
frappe.call({
method: 'complete_procedure',
doc: frm.doc,
freeze: true,
callback: function(r) {
if (r.message) {
frappe.show_alert({
message: __('Stock Entry {0} created', ['<a class="bold" href="/app/stock-entry/'+ r.message + '">' + r.message + '</a>']),
indicator: 'green'
});
}
frm.reload_doc();
}
});
}
);
}).addClass("btn-primary");
} else if (frm.doc.status == 'Pending') {
frm.add_custom_button(__('Start'), function() {
frappe.call({
doc: frm.doc,
method: 'start_procedure',
callback: function(r) {
if (!r.exc) {
if (r.message == 'insufficient stock') {
let msg = __('Stock quantity to start the Procedure is not available in the Warehouse {0}. Do you want to record a Stock Entry?', [frm.doc.warehouse.bold()]);
frappe.confirm(
msg,
function() {
frappe.call({
doc: frm.doc,
method: 'make_material_receipt',
freeze: true,
callback: function(r) {
if (!r.exc) {
frm.reload_doc();
let doclist = frappe.model.sync(r.message);
frappe.set_route('Form', doclist[0].doctype, doclist[0].name);
}
}
});
}
);
} else {
frm.reload_doc();
}
}
}
});
}).addClass("btn-primary");
}
}
},
onload: function(frm) {
if (frm.is_new()) {
frm.add_fetch('procedure_template', 'medical_department', 'medical_department');
frm.set_value('start_time', null);
}
},
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) {
let age = '';
if (data.message.dob) {
age = calculate_age(data.message.dob);
} else if (data.message.age) {
age = data.message.age;
if (data.message.age_as_on) {
age = __('{0} as on {1}', [age, data.message.age_as_on]);
}
}
frm.set_value('patient_name', data.message.patient_name);
frm.set_value('patient_age', age);
frm.set_value('patient_sex', data.message.sex);
}
});
} else {
frm.set_value('patient_name', '');
frm.set_value('patient_age', '');
frm.set_value('patient_sex', '');
}
},
appointment: function(frm) {
if (frm.doc.appointment) {
frappe.call({
'method': 'frappe.client.get',
args: {
doctype: 'Patient Appointment',
name: frm.doc.appointment
},
callback: function(data) {
let values = {
'patient':data.message.patient,
'procedure_template': data.message.procedure_template,
'medical_department': data.message.department,
'practitioner': data.message.practitioner,
'start_date': data.message.appointment_date,
'start_time': data.message.appointment_time,
'notes': data.message.notes,
'service_unit': data.message.service_unit,
'company': data.message.company
};
frm.set_value(values);
}
});
} else {
let values = {
'patient': '',
'patient_name': '',
'patient_sex': '',
'patient_age': '',
'medical_department': '',
'procedure_template': '',
'start_date': '',
'start_time': '',
'notes': '',
'service_unit': '',
'inpatient_record': ''
};
frm.set_value(values);
}
},
procedure_template: function(frm) {
if (frm.doc.procedure_template) {
frappe.call({
'method': 'frappe.client.get',
args: {
doctype: 'Clinical Procedure Template',
name: frm.doc.procedure_template
},
callback: function (data) {
frm.set_value('medical_department', data.message.medical_department);
frm.set_value('consume_stock', data.message.consume_stock);
frm.events.set_warehouse(frm);
frm.events.set_procedure_consumables(frm);
}
});
}
},
service_unit: function(frm) {
if (frm.doc.service_unit) {
frappe.call({
method: 'frappe.client.get_value',
args:{
fieldname: 'warehouse',
doctype: 'Healthcare Service Unit',
filters:{name: frm.doc.service_unit},
},
callback: function(data) {
if (data.message) {
frm.set_value('warehouse', data.message.warehouse);
}
}
});
}
},
practitioner: function(frm) {
if (frm.doc.practitioner) {
frappe.call({
'method': 'frappe.client.get',
args: {
doctype: 'Healthcare Practitioner',
name: frm.doc.practitioner
},
callback: function (data) {
frappe.model.set_value(frm.doctype,frm.docname, 'practitioner_name', data.message.practitioner_name);
}
});
} else {
frappe.model.set_value(frm.doctype,frm.docname, 'practitioner_name', '');
}
},
set_warehouse: function(frm) {
if (!frm.doc.warehouse) {
frappe.call({
method: 'frappe.client.get_value',
args: {
doctype: 'Stock Settings',
fieldname: 'default_warehouse'
},
callback: function (data) {
frm.set_value('warehouse', data.message.default_warehouse);
}
});
}
},
set_procedure_consumables: function(frm) {
frappe.call({
method: 'erpnext.healthcare.doctype.clinical_procedure.clinical_procedure.get_procedure_consumables',
args: {
procedure_template: frm.doc.procedure_template
},
callback: function(data) {
if (data.message) {
frm.doc.items = [];
$.each(data.message, function(i, v) {
let item = frm.add_child('items');
item.item_code = v.item_code;
item.item_name = v.item_name;
item.uom = v.uom;
item.stock_uom = v.stock_uom;
item.qty = flt(v.qty);
item.transfer_qty = v.transfer_qty;
item.conversion_factor = v.conversion_factor;
item.invoice_separately_as_consumables = v.invoice_separately_as_consumables;
item.batch_no = v.batch_no;
});
refresh_field('items');
}
}
});
}
});
frappe.ui.form.on('Clinical Procedure Item', {
qty: function(frm, cdt, cdn) {
let d = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, 'transfer_qty', d.qty*d.conversion_factor);
},
uom: function(doc, cdt, cdn) {
let d = locals[cdt][cdn];
if (d.uom && d.item_code) {
return frappe.call({
method: 'erpnext.stock.doctype.stock_entry.stock_entry.get_uom_details',
args: {
item_code: d.item_code,
uom: d.uom,
qty: d.qty
},
callback: function(r) {
if (r.message) {
frappe.model.set_value(cdt, cdn, r.message);
}
}
});
}
},
item_code: function(frm, cdt, cdn) {
let d = locals[cdt][cdn];
let args = null;
if (d.item_code) {
args = {
'doctype' : 'Clinical Procedure',
'item_code' : d.item_code,
'company' : frm.doc.company,
'warehouse': frm.doc.warehouse
};
return frappe.call({
method: 'erpnext.healthcare.doctype.clinical_procedure_template.clinical_procedure_template.get_item_details',
args: {args: args},
callback: function(r) {
if (r.message) {
let d = locals[cdt][cdn];
$.each(r.message, function(k, v) {
d[k] = v;
});
refresh_field('items');
}
}
});
}
}
});
let calculate_age = function(birth) {
let ageMS = Date.parse(Date()) - Date.parse(birth);
let age = new Date();
age.setTime(ageMS);
let years = age.getFullYear() - 1970;
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
};
// List Stock items
cur_frm.set_query('item_code', 'items', function() {
return {
filters: {
is_stock_item:1
}
};
});

345
erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.json

@ -1,345 +0,0 @@
{
"actions": [],
"autoname": "naming_series:",
"beta": 1,
"creation": "2017-04-07 12:52:43.542429",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"naming_series",
"title",
"appointment",
"procedure_template",
"medical_code",
"column_break_30",
"company",
"invoiced",
"section_break_6",
"patient",
"patient_name",
"patient_sex",
"patient_age",
"inpatient_record",
"notes",
"column_break_7",
"status",
"practitioner",
"practitioner_name",
"medical_department",
"service_unit",
"start_date",
"start_time",
"sample",
"consumables_section",
"consume_stock",
"warehouse",
"items",
"section_break_24",
"invoice_separately_as_consumables",
"consumption_invoiced",
"consumable_total_amount",
"column_break_27",
"consumption_details",
"sb_refs",
"column_break_34",
"prescription",
"amended_from"
],
"fields": [
{
"fetch_from": "patient.inpatient_record",
"fieldname": "inpatient_record",
"fieldtype": "Link",
"label": "Inpatient Record",
"options": "Inpatient Record",
"read_only": 1
},
{
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Series",
"options": "HLC-CPR-.YYYY.-"
},
{
"fieldname": "appointment",
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Appointment",
"options": "Patient Appointment",
"set_only_once": 1
},
{
"fieldname": "patient",
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Patient",
"options": "Patient",
"reqd": 1
},
{
"fieldname": "patient_age",
"fieldtype": "Data",
"label": "Age",
"read_only": 1
},
{
"fieldname": "patient_sex",
"fieldtype": "Link",
"label": "Gender",
"options": "Gender",
"read_only": 1,
"set_only_once": 1
},
{
"fieldname": "prescription",
"fieldtype": "Link",
"hidden": 1,
"label": "Procedure Prescription",
"options": "Procedure Prescription",
"read_only": 1
},
{
"fieldname": "medical_department",
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Medical Department",
"options": "Medical Department"
},
{
"fieldname": "practitioner",
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Healthcare Practitioner",
"options": "Healthcare Practitioner"
},
{
"fieldname": "column_break_7",
"fieldtype": "Column Break"
},
{
"fieldname": "procedure_template",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Procedure Template",
"options": "Clinical Procedure Template",
"reqd": 1
},
{
"fieldname": "service_unit",
"fieldtype": "Link",
"label": "Service Unit",
"options": "Healthcare Service Unit",
"set_only_once": 1
},
{
"fieldname": "warehouse",
"fieldtype": "Link",
"label": "Warehouse",
"mandatory_depends_on": "eval: doc.consume_stock == 1",
"options": "Warehouse"
},
{
"default": "Today",
"fieldname": "start_date",
"fieldtype": "Date",
"label": "Start Date"
},
{
"fieldname": "start_time",
"fieldtype": "Time",
"label": "Start Time"
},
{
"fieldname": "sample",
"fieldtype": "Link",
"label": "Sample",
"options": "Sample Collection"
},
{
"default": "0",
"fieldname": "invoiced",
"fieldtype": "Check",
"label": "Invoiced",
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "notes",
"fieldtype": "Small Text",
"label": "Notes",
"set_only_once": 1
},
{
"fieldname": "company",
"fieldtype": "Link",
"label": "Company",
"options": "Company"
},
{
"default": "0",
"fieldname": "consume_stock",
"fieldtype": "Check",
"label": "Consume Stock"
},
{
"fieldname": "items",
"fieldtype": "Table",
"label": "Consumables",
"options": "Clinical Procedure Item"
},
{
"default": "0",
"fieldname": "invoice_separately_as_consumables",
"fieldtype": "Check",
"hidden": 1,
"label": "Invoice Consumables Separately",
"read_only": 1
},
{
"depends_on": "invoice_separately_as_consumables",
"fieldname": "consumable_total_amount",
"fieldtype": "Currency",
"label": "Consumable Total Amount",
"read_only": 1
},
{
"depends_on": "invoice_separately_as_consumables",
"fieldname": "consumption_details",
"fieldtype": "Small Text",
"label": "Consumption Details"
},
{
"default": "0",
"depends_on": "invoice_separately_as_consumables",
"fieldname": "consumption_invoiced",
"fieldtype": "Check",
"hidden": 1,
"label": "Consumption Invoiced",
"read_only": 1
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "status",
"fieldtype": "Select",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Status",
"options": "Draft\nSubmitted\nCancelled\nIn Progress\nCompleted\nPending",
"read_only": 1
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"label": "Amended From",
"no_copy": 1,
"options": "Clinical Procedure",
"print_hide": 1,
"read_only": 1
},
{
"collapsible": 1,
"collapsible_depends_on": "consume_stock",
"fieldname": "consumables_section",
"fieldtype": "Section Break",
"label": "Consumables"
},
{
"fieldname": "column_break_27",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_24",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_30",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_6",
"fieldtype": "Section Break"
},
{
"collapsible": 1,
"fieldname": "sb_refs",
"fieldtype": "Section Break"
},
{
"fieldname": "patient_name",
"fieldtype": "Data",
"label": "Patient Name",
"read_only": 1
},
{
"fieldname": "practitioner_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Practitioner Name",
"read_only": 1
},
{
"fieldname": "column_break_34",
"fieldtype": "Column Break"
},
{
"allow_on_submit": 1,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 1,
"label": "Title",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
},
{
"fetch_from": "procedure_template.medical_code",
"fieldname": "medical_code",
"fieldtype": "Link",
"label": "Medical Code",
"options": "Medical Code",
"read_only": 1
}
],
"is_submittable": 1,
"links": [],
"modified": "2020-06-29 14:28:11.779815",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Clinical Procedure",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Nursing User",
"share": 1,
"submit": 1,
"write": 1
},
{
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Physician",
"share": 1,
"submit": 1,
"write": 1
}
],
"restrict_to_domain": "Healthcare",
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "title",
"track_changes": 1
}

255
erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py

@ -1,255 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, 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.model.mapper import get_mapped_doc
from frappe.utils import flt, nowdate, nowtime
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_account
from erpnext.healthcare.doctype.lab_test.lab_test import create_sample_doc
from erpnext.stock.get_item_details import get_item_details
from erpnext.stock.stock_ledger import get_previous_sle
class ClinicalProcedure(Document):
def validate(self):
self.set_status()
self.set_title()
if self.consume_stock:
self.set_actual_qty()
if self.items:
self.invoice_separately_as_consumables = False
for item in self.items:
if item.invoice_separately_as_consumables:
self.invoice_separately_as_consumables = True
def before_insert(self):
if self.consume_stock:
self.set_actual_qty()
def after_insert(self):
if self.prescription:
frappe.db.set_value('Procedure Prescription', self.prescription, 'procedure_created', 1)
if self.appointment:
frappe.db.set_value('Patient Appointment', self.appointment, 'status', 'Closed')
template = frappe.get_doc('Clinical Procedure Template', self.procedure_template)
if template.sample:
patient = frappe.get_doc('Patient', self.patient)
sample_collection = create_sample_doc(template, patient, None, self.company)
frappe.db.set_value('Clinical Procedure', self.name, 'sample', sample_collection.name)
self.reload()
def set_status(self):
if self.docstatus == 0:
self.status = 'Draft'
elif self.docstatus == 1:
if self.status not in ['In Progress', 'Completed']:
self.status = 'Pending'
elif self.docstatus == 2:
self.status = 'Cancelled'
def set_title(self):
self.title = _('{0} - {1}').format(self.patient_name or self.patient, self.procedure_template)[:100]
@frappe.whitelist()
def complete_procedure(self):
if self.consume_stock and self.items:
stock_entry = make_stock_entry(self)
if self.items:
consumable_total_amount = 0
consumption_details = False
customer = frappe.db.get_value('Patient', self.patient, 'customer')
if customer:
for item in self.items:
if item.invoice_separately_as_consumables:
price_list, price_list_currency = frappe.db.get_values('Price List', {'selling': 1}, ['name', 'currency'])[0]
args = {
'doctype': 'Sales Invoice',
'item_code': item.item_code,
'company': self.company,
'warehouse': self.warehouse,
'customer': customer,
'selling_price_list': price_list,
'price_list_currency': price_list_currency,
'plc_conversion_rate': 1.0,
'conversion_rate': 1.0
}
item_details = get_item_details(args)
item_price = item_details.price_list_rate * item.qty
item_consumption_details = item_details.item_name + ' ' + str(item.qty) + ' ' + item.uom + ' ' + str(item_price)
consumable_total_amount += item_price
if not consumption_details:
consumption_details = _('Clinical Procedure ({0}):').format(self.name)
consumption_details += '\n\t' + item_consumption_details
if consumable_total_amount > 0:
frappe.db.set_value('Clinical Procedure', self.name, 'consumable_total_amount', consumable_total_amount)
frappe.db.set_value('Clinical Procedure', self.name, 'consumption_details', consumption_details)
else:
frappe.throw(_('Please set Customer in Patient {0}').format(frappe.bold(self.patient)), title=_('Customer Not Found'))
self.db_set('status', 'Completed')
if self.consume_stock and self.items:
return stock_entry
@frappe.whitelist()
def start_procedure(self):
allow_start = self.set_actual_qty()
if allow_start:
self.db_set('status', 'In Progress')
return 'success'
return 'insufficient stock'
def set_actual_qty(self):
allow_negative_stock = frappe.db.get_single_value('Stock Settings', 'allow_negative_stock')
allow_start = True
for d in self.get('items'):
d.actual_qty = get_stock_qty(d.item_code, self.warehouse)
# validate qty
if not allow_negative_stock and d.actual_qty < d.qty:
allow_start = False
break
return allow_start
@frappe.whitelist()
def make_material_receipt(self, submit=False):
stock_entry = frappe.new_doc('Stock Entry')
stock_entry.stock_entry_type = 'Material Receipt'
stock_entry.to_warehouse = self.warehouse
stock_entry.company = self.company
expense_account = get_account(None, 'expense_account', 'Healthcare Settings', self.company)
for item in self.items:
if item.qty > item.actual_qty:
se_child = stock_entry.append('items')
se_child.item_code = item.item_code
se_child.item_name = item.item_name
se_child.uom = item.uom
se_child.stock_uom = item.stock_uom
se_child.qty = flt(item.qty - item.actual_qty)
se_child.t_warehouse = self.warehouse
# in stock uom
se_child.transfer_qty = flt(item.transfer_qty)
se_child.conversion_factor = flt(item.conversion_factor)
cost_center = frappe.get_cached_value('Company', self.company, 'cost_center')
se_child.cost_center = cost_center
se_child.expense_account = expense_account
if submit:
stock_entry.submit()
return stock_entry
return stock_entry.as_dict()
def get_stock_qty(item_code, warehouse):
return get_previous_sle({
'item_code': item_code,
'warehouse': warehouse,
'posting_date': nowdate(),
'posting_time': nowtime()
}).get('qty_after_transaction') or 0
@frappe.whitelist()
def get_procedure_consumables(procedure_template):
return get_items('Clinical Procedure Item', procedure_template, 'Clinical Procedure Template')
@frappe.whitelist()
def set_stock_items(doc, stock_detail_parent, parenttype):
items = get_items('Clinical Procedure Item', stock_detail_parent, parenttype)
for item in items:
se_child = doc.append('items')
se_child.item_code = item.item_code
se_child.item_name = item.item_name
se_child.uom = item.uom
se_child.stock_uom = item.stock_uom
se_child.qty = flt(item.qty)
# in stock uom
se_child.transfer_qty = flt(item.transfer_qty)
se_child.conversion_factor = flt(item.conversion_factor)
if item.batch_no:
se_child.batch_no = item.batch_no
if parenttype == 'Clinical Procedure Template':
se_child.invoice_separately_as_consumables = item.invoice_separately_as_consumables
return doc
def get_items(table, parent, parenttype):
items = frappe.db.get_all(table, filters={
'parent': parent,
'parenttype': parenttype
}, fields=['*'])
return items
@frappe.whitelist()
def make_stock_entry(doc):
stock_entry = frappe.new_doc('Stock Entry')
stock_entry = set_stock_items(stock_entry, doc.name, 'Clinical Procedure')
stock_entry.stock_entry_type = 'Material Issue'
stock_entry.from_warehouse = doc.warehouse
stock_entry.company = doc.company
expense_account = get_account(None, 'expense_account', 'Healthcare Settings', doc.company)
for item_line in stock_entry.items:
cost_center = frappe.get_cached_value('Company', doc.company, 'cost_center')
item_line.cost_center = cost_center
item_line.expense_account = expense_account
stock_entry.save(ignore_permissions=True)
stock_entry.submit()
return stock_entry.name
@frappe.whitelist()
def make_procedure(source_name, target_doc=None):
def set_missing_values(source, target):
consume_stock = frappe.db.get_value('Clinical Procedure Template', source.procedure_template, 'consume_stock')
if consume_stock:
target.consume_stock = 1
warehouse = None
if source.service_unit:
warehouse = frappe.db.get_value('Healthcare Service Unit', source.service_unit, 'warehouse')
if not warehouse:
warehouse = frappe.db.get_value('Stock Settings', None, 'default_warehouse')
if warehouse:
target.warehouse = warehouse
set_stock_items(target, source.procedure_template, 'Clinical Procedure Template')
doc = get_mapped_doc('Patient Appointment', source_name, {
'Patient Appointment': {
'doctype': 'Clinical Procedure',
'field_map': [
['appointment', 'name'],
['patient', 'patient'],
['patient_age', 'patient_age'],
['patient_sex', 'patient_sex'],
['procedure_template', 'procedure_template'],
['prescription', 'procedure_prescription'],
['practitioner', 'practitioner'],
['medical_department', 'department'],
['start_date', 'appointment_date'],
['start_time', 'appointment_time'],
['notes', 'notes'],
['service_unit', 'service_unit'],
['company', 'company'],
['invoiced', 'invoiced']
]
}
}, target_doc, set_missing_values)
return doc

11
erpnext/healthcare/doctype/clinical_procedure/clinical_procedure_list.js

@ -1,11 +0,0 @@
frappe.listview_settings['Clinical Procedure'] = {
get_indicator: function(doc) {
var colors = {
'Completed': 'green',
'In Progress': 'orange',
'Pending': 'orange',
'Cancelled': 'grey'
};
return [__(doc.status), colors[doc.status], 'status,=,' + doc.status];
}
};

71
erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py

@ -1,71 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, ESS LLP and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest
import frappe
from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import (
create_clinical_procedure_template,
create_healthcare_docs,
)
test_dependencies = ['Item']
class TestClinicalProcedure(unittest.TestCase):
def test_procedure_template_item(self):
patient, practitioner = create_healthcare_docs()
procedure_template = create_clinical_procedure_template()
self.assertTrue(frappe.db.exists('Item', procedure_template.item))
procedure_template.disabled = 1
procedure_template.save()
self.assertEqual(frappe.db.get_value('Item', procedure_template.item, 'disabled'), 1)
def test_consumables(self):
patient, practitioner = create_healthcare_docs()
procedure_template = create_clinical_procedure_template()
procedure_template.allow_stock_consumption = 1
consumable = create_consumable()
procedure_template.append('items', {
'item_code': consumable.item_code,
'qty': 1,
'uom': consumable.stock_uom,
'stock_uom': consumable.stock_uom
})
procedure_template.save()
procedure = create_procedure(procedure_template, patient, practitioner)
result = procedure.start_procedure()
if result == 'insufficient stock':
procedure.make_material_receipt(submit=True)
result = procedure.start_procedure()
self.assertEqual(procedure.status, 'In Progress')
result = procedure.complete_procedure()
# check consumption
self.assertTrue(frappe.db.exists('Stock Entry', result))
def create_consumable():
if frappe.db.exists('Item', 'Syringe'):
return frappe.get_doc('Item', 'Syringe')
consumable = frappe.new_doc('Item')
consumable.item_code = 'Syringe'
consumable.item_group = '_Test Item Group'
consumable.stock_uom = 'Nos'
consumable.valuation_rate = 5.00
consumable.save()
return consumable
def create_procedure(procedure_template, patient, practitioner):
procedure = frappe.new_doc('Clinical Procedure')
procedure.procedure_template = procedure_template.name
procedure.patient = patient
procedure.practitioner = practitioner
procedure.consume_stock = procedure_template.allow_stock_consumption
procedure.items = procedure_template.items
procedure.company = "_Test Company"
procedure.warehouse = "_Test Warehouse - _TC"
procedure.submit()
return procedure

0
erpnext/healthcare/doctype/clinical_procedure_item/__init__.py

123
erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.json

@ -1,123 +0,0 @@
{
"actions": [],
"beta": 1,
"creation": "2017-10-05 16:15:10.876952",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"item_code",
"item_name",
"qty",
"barcode",
"uom",
"invoice_separately_as_consumables",
"column_break_5",
"batch_no",
"conversion_factor",
"stock_uom",
"transfer_qty",
"actual_qty"
],
"fields": [
{
"bold": 1,
"columns": 3,
"fieldname": "item_code",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"in_global_search": 1,
"in_list_view": 1,
"label": "Item",
"options": "Item",
"reqd": 1,
"search_index": 1
},
{
"fieldname": "barcode",
"fieldtype": "Data",
"label": "Barcode"
},
{
"fieldname": "item_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Item Name",
"read_only": 1
},
{
"fieldname": "qty",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Quantity",
"reqd": 1
},
{
"fieldname": "uom",
"fieldtype": "Link",
"in_list_view": 1,
"label": "UOM",
"options": "UOM",
"reqd": 1
},
{
"default": "0",
"fieldname": "invoice_separately_as_consumables",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Invoice Separately as Consumables"
},
{
"fieldname": "column_break_5",
"fieldtype": "Column Break"
},
{
"fieldname": "batch_no",
"fieldtype": "Link",
"label": "Batch",
"options": "Batch"
},
{
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "Conversion Factor",
"read_only": 1
},
{
"fieldname": "stock_uom",
"fieldtype": "Link",
"label": "Stock UOM",
"options": "UOM",
"read_only": 1,
"reqd": 1
},
{
"fieldname": "transfer_qty",
"fieldtype": "Float",
"label": "Transfer Qty",
"read_only": 1
},
{
"fieldname": "actual_qty",
"fieldtype": "Float",
"label": "Actual Qty (at source/target)",
"no_copy": 1,
"print_hide": 1,
"read_only": 1,
"search_index": 1
}
],
"istable": 1,
"links": [],
"modified": "2020-03-01 15:34:54.226722",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Clinical Procedure Item",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"restrict_to_domain": "Healthcare",
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

11
erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.py

@ -1,11 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, earthians and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
class ClinicalProcedureItem(Document):
pass

0
erpnext/healthcare/doctype/clinical_procedure_template/__init__.py

190
erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.js

@ -1,190 +0,0 @@
// Copyright (c) 2017, earthians and contributors
// For license information, please see license.txt
frappe.ui.form.on('Clinical Procedure Template', {
template: function(frm) {
if (!frm.doc.item_code)
frm.set_value('item_code', frm.doc.template);
if (!frm.doc.description)
frm.set_value('description', frm.doc.template);
mark_change_in_item(frm);
},
rate: function(frm) {
mark_change_in_item(frm);
},
is_billable: function (frm) {
mark_change_in_item(frm);
},
item_group: function(frm) {
mark_change_in_item(frm);
},
description: function(frm) {
mark_change_in_item(frm);
},
medical_department: function(frm) {
mark_change_in_item(frm);
},
medical_code: function(frm) {
frm.set_query("medical_code", function() {
return {
filters: {
medical_code_standard: frm.doc.medical_code_standard
}
};
});
},
refresh: function(frm) {
frm.fields_dict['items'].grid.set_column_disp('barcode', false);
frm.fields_dict['items'].grid.set_column_disp('batch_no', false);
if (!frm.doc.__islocal) {
cur_frm.add_custom_button(__('Change Item Code'), function() {
change_template_code(frm.doc);
});
}
}
});
let mark_change_in_item = function(frm) {
if (!frm.doc.__islocal) {
frm.doc.change_in_item = 1;
}
};
let change_template_code = function(doc) {
let d = new frappe.ui.Dialog({
title:__('Change Item Code'),
fields:[
{
'fieldtype': 'Data',
'label': 'Item Code',
'fieldname': 'item_code',
reqd: 1
}
],
primary_action: function() {
let values = d.get_values();
if (values) {
frappe.call({
'method': 'erpnext.healthcare.doctype.clinical_procedure_template.clinical_procedure_template.change_item_code_from_template',
'args': {item_code: values.item_code, doc: doc},
callback: function () {
cur_frm.reload_doc();
frappe.show_alert({
message: 'Item Code renamed successfully',
indicator: 'green'
});
}
});
}
d.hide();
},
primary_action_label: __('Change Item Code')
});
d.show();
d.set_values({
'item_code': doc.item_code
});
};
frappe.ui.form.on('Clinical Procedure Item', {
qty: function(frm, cdt, cdn) {
let d = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, 'transfer_qty', d.qty * d.conversion_factor);
},
uom: function(doc, cdt, cdn){
let d = locals[cdt][cdn];
if (d.uom && d.item_code) {
return frappe.call({
method: 'erpnext.stock.doctype.stock_entry.stock_entry.get_uom_details',
args: {
item_code: d.item_code,
uom: d.uom,
qty: d.qty
},
callback: function(r) {
if (r.message) {
frappe.model.set_value(cdt, cdn, r.message);
}
}
});
}
},
item_code: function(frm, cdt, cdn) {
let d = locals[cdt][cdn];
if (d.item_code) {
let args = {
'item_code' : d.item_code,
'transfer_qty' : d.transfer_qty,
'quantity' : d.qty
};
return frappe.call({
method: 'erpnext.healthcare.doctype.clinical_procedure_template.clinical_procedure_template.get_item_details',
args: {args: args},
callback: function(r) {
if (r.message) {
let d = locals[cdt][cdn];
$.each(r.message, function(k, v) {
d[k] = v;
});
refresh_field('items');
}
}
});
}
}
});
// List Stock items
cur_frm.set_query('item_code', 'items', function() {
return {
filters: {
is_stock_item:1
}
};
});
frappe.tour['Clinical Procedure Template'] = [
{
fieldname: 'template',
title: __('Template Name'),
description: __('Enter a name for the Clinical Procedure Template')
},
{
fieldname: 'item_code',
title: __('Item Code'),
description: __('Set the Item Code which will be used for billing the Clinical Procedure.')
},
{
fieldname: 'item_group',
title: __('Item Group'),
description: __('Select an Item Group for the Clinical Procedure Item.')
},
{
fieldname: 'is_billable',
title: __('Clinical Procedure Rate'),
description: __('Check this if the Clinical Procedure is billable and also set the rate.')
},
{
fieldname: 'consume_stock',
title: __('Allow Stock Consumption'),
description: __('Check this if the Clinical Procedure utilises consumables. Click ') + "<a href='https://docs.erpnext.com/docs/user/manual/en/healthcare/clinical_procedure_template#22-manage-procedure-consumables' target='_blank'>here</a>" + __(' to know more')
},
{
fieldname: 'medical_department',
title: __('Medical Department'),
description: __('You can also set the Medical Department for the template. After saving the document, an Item will automatically be created for billing this Clinical Procedure. You can then use this template while creating Clinical Procedures for Patients. Templates save you from filling up redundant data every single time. You can also create templates for other operations like Lab Tests, Therapy Sessions, etc.')
}
];

257
erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.json

@ -1,257 +0,0 @@
{
"actions": [],
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:template",
"beta": 1,
"creation": "2017-10-05 14:59:55.438359",
"description": "Procedure Template",
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"template",
"item",
"item_code",
"item_group",
"description",
"column_break_5",
"disabled",
"is_billable",
"rate",
"medical_department",
"medical_coding_section",
"medical_code_standard",
"medical_code",
"consumables",
"consume_stock",
"items",
"sample_collection",
"sample",
"sample_uom",
"sample_qty",
"column_break_21",
"sample_details",
"change_in_item"
],
"fields": [
{
"fieldname": "template",
"fieldtype": "Data",
"in_global_search": 1,
"in_list_view": 1,
"label": "Template Name",
"reqd": 1,
"unique": 1
},
{
"fieldname": "item_code",
"fieldtype": "Data",
"label": "Item Code",
"read_only_depends_on": "eval: !doc.__islocal ",
"reqd": 1
},
{
"fieldname": "item_group",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Item Group",
"options": "Item Group",
"reqd": 1
},
{
"fieldname": "medical_department",
"fieldtype": "Link",
"label": "Medical Department",
"options": "Medical Department"
},
{
"fieldname": "column_break_5",
"fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "is_billable",
"fieldtype": "Check",
"label": "Is Billable"
},
{
"depends_on": "is_billable",
"fieldname": "rate",
"fieldtype": "Float",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Rate",
"mandatory_depends_on": "is_billable"
},
{
"fieldname": "description",
"fieldtype": "Small Text",
"ignore_xss_filter": 1,
"label": "Description",
"no_copy": 1,
"reqd": 1
},
{
"default": "0",
"fieldname": "consume_stock",
"fieldtype": "Check",
"label": "Allow Stock Consumption",
"search_index": 1
},
{
"fieldname": "consumables",
"fieldtype": "Section Break",
"label": "Consumables"
},
{
"depends_on": "eval:doc.consume_stock == 1",
"fieldname": "items",
"fieldtype": "Table",
"ignore_user_permissions": 1,
"label": "Items",
"options": "Clinical Procedure Item"
},
{
"collapsible": 1,
"fieldname": "sample_collection",
"fieldtype": "Section Break",
"label": "Sample Collection"
},
{
"fieldname": "sample",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Sample",
"options": "Lab Test Sample"
},
{
"fetch_from": "sample.sample_uom",
"fieldname": "sample_uom",
"fieldtype": "Data",
"label": "Sample UOM",
"read_only": 1
},
{
"fieldname": "sample_qty",
"fieldtype": "Float",
"label": "Quantity"
},
{
"fieldname": "column_break_21",
"fieldtype": "Column Break"
},
{
"fieldname": "sample_details",
"fieldtype": "Small Text",
"ignore_xss_filter": 1,
"label": "Collection Details"
},
{
"default": "0",
"fieldname": "change_in_item",
"fieldtype": "Check",
"hidden": 1,
"label": "Change In Item",
"no_copy": 1,
"print_hide": 1,
"report_hide": 1
},
{
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"label": "Disabled"
},
{
"fieldname": "item",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Item",
"no_copy": 1,
"options": "Item",
"read_only": 1
},
{
"collapsible": 1,
"fieldname": "medical_coding_section",
"fieldtype": "Section Break",
"label": "Medical Coding"
},
{
"fieldname": "medical_code_standard",
"fieldtype": "Link",
"label": "Medical Code Standard",
"options": "Medical Code Standard"
},
{
"depends_on": "medical_code_standard",
"fieldname": "medical_code",
"fieldtype": "Link",
"label": "Medical Code",
"options": "Medical Code"
}
],
"links": [],
"modified": "2020-06-29 14:12:27.158130",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Clinical Procedure Template",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Healthcare Administrator",
"share": 1,
"write": 1
},
{
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Nursing User",
"share": 1
},
{
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Physician",
"share": 1,
"write": 1
}
],
"restrict_to_domain": "Healthcare",
"search_fields": "template",
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "template",
"track_changes": 1,
"track_seen": 1
}

124
erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py

@ -1,124 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, earthians and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import json
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.model.rename_doc import rename_doc
class ClinicalProcedureTemplate(Document):
def validate(self):
self.enable_disable_item()
def after_insert(self):
create_item_from_template(self)
def on_update(self):
if self.change_in_item:
self.update_item_and_item_price()
def enable_disable_item(self):
if self.is_billable:
if self.disabled:
frappe.db.set_value('Item', self.item, 'disabled', 1)
else:
frappe.db.set_value('Item', self.item, 'disabled', 0)
def update_item_and_item_price(self):
if self.is_billable and self.item:
item_doc = frappe.get_doc('Item', {'item_code': self.item})
item_doc.item_name = self.template
item_doc.item_group = self.item_group
item_doc.description = self.description
item_doc.disabled = 0
item_doc.save(ignore_permissions=True)
if self.rate:
item_price = frappe.get_doc('Item Price', {'item_code': self.item})
item_price.item_name = self.template
item_price.price_list_rate = self.rate
item_price.save()
elif not self.is_billable and self.item:
frappe.db.set_value('Item', self.item, 'disabled', 1)
self.db_set('change_in_item', 0)
@frappe.whitelist()
def get_item_details(args=None):
if not isinstance(args, dict):
args = json.loads(args)
item = frappe.db.get_all('Item',
filters={
'disabled': 0,
'name': args.get('item_code')
},
fields=['stock_uom', 'item_name']
)
if not item:
frappe.throw(_('Item {0} is not active').format(args.get('item_code')))
item = item[0]
ret = {
'uom': item.stock_uom,
'stock_uom': item.stock_uom,
'item_name': item.item_name,
'qty': 1,
'transfer_qty': 0,
'conversion_factor': 1
}
return ret
def create_item_from_template(doc):
disabled = doc.disabled
if doc.is_billable and not doc.disabled:
disabled = 0
uom = frappe.db.exists('UOM', 'Unit') or frappe.db.get_single_value('Stock Settings', 'stock_uom')
item = frappe.get_doc({
'doctype': 'Item',
'item_code': doc.template,
'item_name':doc.template,
'item_group': doc.item_group,
'description':doc.description,
'is_sales_item': 1,
'is_service_item': 1,
'is_purchase_item': 0,
'is_stock_item': 0,
'show_in_website': 0,
'is_pro_applicable': 0,
'disabled': disabled,
'stock_uom': uom
}).insert(ignore_permissions=True, ignore_mandatory=True)
make_item_price(item.name, doc.rate)
doc.db_set('item', item.name)
def make_item_price(item, item_price):
price_list_name = frappe.db.get_value('Price List', {'selling': 1})
frappe.get_doc({
'doctype': 'Item Price',
'price_list': price_list_name,
'item_code': item,
'price_list_rate': item_price
}).insert(ignore_permissions=True, ignore_mandatory=True)
@frappe.whitelist()
def change_item_code_from_template(item_code, doc):
doc = frappe._dict(json.loads(doc))
if frappe.db.exists('Item', {'item_code': item_code}):
frappe.throw(_('Item with Item Code {0} already exists').format(item_code))
else:
rename_doc('Item', doc.item_code, item_code, ignore_permissions=True)
frappe.db.set_value('Clinical Procedure Template', doc.name, 'item_code', item_code)
return

15
erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template_dashboard.py

@ -1,15 +0,0 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'procedure_template',
'transactions': [
{
'label': _('Consultations'),
'items': ['Clinical Procedure']
}
]
}

10
erpnext/healthcare/doctype/clinical_procedure_template/test_clinical_procedure_template.py

@ -1,10 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, earthians and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest
class TestClinicalProcedureTemplate(unittest.TestCase):
pass

0
erpnext/healthcare/doctype/codification_table/__init__.py

56
erpnext/healthcare/doctype/codification_table/codification_table.json

@ -1,56 +0,0 @@
{
"actions": [],
"allow_copy": 1,
"beta": 1,
"creation": "2017-06-22 13:09:23.159579",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"medical_code",
"code",
"description"
],
"fields": [
{
"fieldname": "medical_code",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"in_list_view": 1,
"label": "Medical Code",
"options": "Medical Code",
"reqd": 1
},
{
"fetch_from": "medical_code.code",
"fieldname": "code",
"fieldtype": "Data",
"ignore_xss_filter": 1,
"in_list_view": 1,
"label": "Code",
"read_only": 1
},
{
"fetch_from": "medical_code.description",
"fieldname": "description",
"fieldtype": "Small Text",
"ignore_xss_filter": 1,
"in_list_view": 1,
"label": "Description",
"read_only": 1
}
],
"istable": 1,
"links": [],
"modified": "2020-02-26 13:17:49.016293",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Codification Table",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"restrict_to_domain": "Healthcare",
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

11
erpnext/healthcare/doctype/codification_table/codification_table.py

@ -1,11 +0,0 @@
# -*- 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

5
erpnext/healthcare/doctype/complaint/complaint.js

@ -1,5 +0,0 @@
// 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

@ -1,116 +0,0 @@
{
"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": 1,
"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-10-05 11:18:42.017864",
"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
}

11
erpnext/healthcare/doctype/complaint/complaint.py

@ -1,11 +0,0 @@
# -*- 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

10
erpnext/healthcare/doctype/complaint/test_complaint.py

@ -1,10 +0,0 @@
# -*- 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/descriptive_test_result/__init__.py

74
erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.json

@ -1,74 +0,0 @@
{
"actions": [],
"allow_copy": 1,
"beta": 1,
"creation": "2016-02-22 15:12:36.202380",
"doctype": "DocType",
"document_type": "Document",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"lab_test_particulars",
"result_value",
"allow_blank",
"template",
"require_result_value"
],
"fields": [
{
"fieldname": "lab_test_particulars",
"fieldtype": "Data",
"ignore_xss_filter": 1,
"in_list_view": 1,
"label": "Particulars",
"read_only": 1
},
{
"depends_on": "eval:doc.require_result_value == 1",
"fieldname": "result_value",
"fieldtype": "Small Text",
"ignore_xss_filter": 1,
"in_list_view": 1,
"label": "Value"
},
{
"fieldname": "template",
"fieldtype": "Link",
"hidden": 1,
"label": "Template",
"options": "Lab Test Template",
"print_hide": 1,
"report_hide": 1
},
{
"default": "0",
"fieldname": "require_result_value",
"fieldtype": "Check",
"hidden": 1,
"label": "Require Result Value",
"print_hide": 1,
"read_only": 1,
"report_hide": 1
},
{
"default": "1",
"fieldname": "allow_blank",
"fieldtype": "Check",
"label": "Allow Blank",
"print_hide": 1,
"read_only": 1,
"report_hide": 1
}
],
"istable": 1,
"links": [],
"modified": "2020-07-23 12:33:47.693065",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Descriptive Test Result",
"owner": "Administrator",
"permissions": [],
"restrict_to_domain": "Healthcare",
"sort_field": "modified",
"sort_order": "DESC"
}

11
erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.py

@ -1,11 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, ESS and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
class DescriptiveTestResult(Document):
pass

0
erpnext/healthcare/doctype/descriptive_test_template/__init__.py

41
erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.json

@ -1,41 +0,0 @@
{
"actions": [],
"allow_copy": 1,
"beta": 1,
"creation": "2016-02-22 16:12:12.394200",
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"particulars",
"allow_blank"
],
"fields": [
{
"fieldname": "particulars",
"fieldtype": "Data",
"ignore_xss_filter": 1,
"in_list_view": 1,
"label": "Result Component"
},
{
"default": "0",
"fieldname": "allow_blank",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Allow Blank"
}
],
"istable": 1,
"links": [],
"modified": "2020-06-24 14:03:51.728863",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Descriptive Test Template",
"owner": "Administrator",
"permissions": [],
"restrict_to_domain": "Healthcare",
"sort_field": "modified",
"sort_order": "DESC"
}

11
erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.py

@ -1,11 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, ESS and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
class DescriptiveTestTemplate(Document):
pass

0
erpnext/healthcare/doctype/diagnosis/__init__.py

5
erpnext/healthcare/doctype/diagnosis/diagnosis.js

@ -1,5 +0,0 @@
// 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

@ -1,116 +0,0 @@
{
"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": 1,
"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-10-05 11:25:46.107435",
"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
}

11
erpnext/healthcare/doctype/diagnosis/diagnosis.py

@ -1,11 +0,0 @@
# -*- 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

11
erpnext/healthcare/doctype/diagnosis/test_diagnosis.py

@ -1,11 +0,0 @@
# -*- 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

5
erpnext/healthcare/doctype/dosage_form/dosage_form.js

@ -1,5 +0,0 @@
// 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

@ -1,114 +0,0 @@
{
"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": 1,
"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-10-05 11:24:57.888091",
"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
}

11
erpnext/healthcare/doctype/dosage_form/dosage_form.py

@ -1,11 +0,0 @@
# -*- 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

10
erpnext/healthcare/doctype/dosage_form/test_dosage_form.py

@ -1,10 +0,0 @@
# -*- 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

0
erpnext/healthcare/doctype/dosage_strength/__init__.py

102
erpnext/healthcare/doctype/dosage_strength/dosage_strength.json

@ -1,102 +0,0 @@
{
"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
}

11
erpnext/healthcare/doctype/dosage_strength/dosage_strength.py

@ -1,11 +0,0 @@
# -*- 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
erpnext/healthcare/doctype/drug_prescription/__init__.py

122
erpnext/healthcare/doctype/drug_prescription/drug_prescription.json

@ -1,122 +0,0 @@
{
"actions": [],
"allow_copy": 1,
"beta": 1,
"creation": "2016-09-16 16:41:45.533374",
"doctype": "DocType",
"document_type": "Document",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"drug_code",
"drug_name",
"dosage",
"period",
"dosage_form",
"column_break_7",
"comment",
"usage_interval",
"interval",
"interval_uom",
"update_schedule"
],
"fields": [
{
"fieldname": "drug_code",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"in_list_view": 1,
"label": "Drug",
"options": "Item",
"reqd": 1
},
{
"fetch_from": "drug_code.item_name",
"fieldname": "drug_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Drug Name / Description"
},
{
"fieldname": "dosage",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"in_list_view": 1,
"label": "Dosage",
"options": "Prescription Dosage",
"reqd": 1
},
{
"fieldname": "period",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"in_list_view": 1,
"label": "Period",
"options": "Prescription Duration",
"reqd": 1
},
{
"allow_in_quick_entry": 1,
"fieldname": "dosage_form",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Dosage Form",
"options": "Dosage Form",
"reqd": 1
},
{
"fieldname": "column_break_7",
"fieldtype": "Column Break"
},
{
"fieldname": "comment",
"fieldtype": "Small Text",
"ignore_xss_filter": 1,
"in_list_view": 1,
"label": "Comment"
},
{
"depends_on": "usage_interval",
"fieldname": "interval",
"fieldtype": "Int",
"in_list_view": 1,
"label": "Interval"
},
{
"default": "1",
"depends_on": "usage_interval",
"fieldname": "update_schedule",
"fieldtype": "Check",
"hidden": 1,
"label": "Update Schedule",
"print_hide": 1,
"report_hide": 1
},
{
"depends_on": "use_interval",
"fieldname": "interval_uom",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Interval UOM",
"options": "\nHour\nDay"
},
{
"default": "0",
"fieldname": "usage_interval",
"fieldtype": "Check",
"hidden": 1,
"label": "Dosage by Time Interval"
}
],
"istable": 1,
"links": [],
"modified": "2021-06-11 11:53:06.343704",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Drug Prescription",
"owner": "Administrator",
"permissions": [],
"restrict_to_domain": "Healthcare",
"sort_field": "modified",
"sort_order": "DESC"
}

36
erpnext/healthcare/doctype/drug_prescription/drug_prescription.py

@ -1,36 +0,0 @@
# -*- 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.interval_uom and self.period:
period = frappe.get_doc('Prescription Duration', self.period)
interval_in = self.interval_uom
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/exercise/__init__.py

62
erpnext/healthcare/doctype/exercise/exercise.json

@ -1,62 +0,0 @@
{
"actions": [],
"creation": "2020-03-11 09:25:00.968572",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"exercise_type",
"difficulty_level",
"counts_target",
"counts_completed",
"assistance_level"
],
"fields": [
{
"fieldname": "exercise_type",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Exercise Type",
"options": "Exercise Type",
"reqd": 1
},
{
"fetch_from": "exercise_type.difficulty_level",
"fieldname": "difficulty_level",
"fieldtype": "Link",
"label": "Difficulty Level",
"options": "Exercise Difficulty Level"
},
{
"fieldname": "counts_target",
"fieldtype": "Int",
"in_list_view": 1,
"label": "Counts Target"
},
{
"depends_on": "eval:doc.parenttype==\"Therapy\";",
"fieldname": "counts_completed",
"fieldtype": "Int",
"label": "Counts Completed",
"no_copy": 1
},
{
"fieldname": "assistance_level",
"fieldtype": "Select",
"label": "Assistance Level",
"options": "\nPassive\nActive Assist\nActive"
}
],
"istable": 1,
"links": [],
"modified": "2020-11-04 18:20:25.583491",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Exercise",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

12
erpnext/healthcare/doctype/exercise/exercise.py

@ -1,12 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, 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
class Exercise(Document):
pass

0
erpnext/healthcare/doctype/exercise_difficulty_level/__init__.py

8
erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.js

@ -1,8 +0,0 @@
// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Exercise Difficulty Level', {
// refresh: function(frm) {
// }
});

45
erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.json

@ -1,45 +0,0 @@
{
"actions": [],
"autoname": "field:difficulty_level",
"creation": "2020-03-29 21:12:55.835941",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"difficulty_level"
],
"fields": [
{
"fieldname": "difficulty_level",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Difficulty Level",
"reqd": 1,
"unique": 1
}
],
"links": [],
"modified": "2020-03-31 23:14:33.554066",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Exercise Difficulty Level",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

12
erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.py

@ -1,12 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, 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
class ExerciseDifficultyLevel(Document):
pass

11
erpnext/healthcare/doctype/exercise_difficulty_level/test_exercise_difficulty_level.py

@ -1,11 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestExerciseDifficultyLevel(unittest.TestCase):
pass

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save