diff --git a/erpnext/healthcare/__init__.py b/erpnext/healthcare/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/dashboard_chart/clinical_procedures/clinical_procedures.json b/erpnext/healthcare/dashboard_chart/clinical_procedures/clinical_procedures.json
deleted file mode 100644
index 6803528156..0000000000
--- a/erpnext/healthcare/dashboard_chart/clinical_procedures/clinical_procedures.json
+++ /dev/null
@@ -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": []
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart/clinical_procedures_status/clinical_procedures_status.json b/erpnext/healthcare/dashboard_chart/clinical_procedures_status/clinical_procedures_status.json
deleted file mode 100644
index dae9db19b8..0000000000
--- a/erpnext/healthcare/dashboard_chart/clinical_procedures_status/clinical_procedures_status.json
+++ /dev/null
@@ -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": []
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart/department_wise_patient_appointments/department_wise_patient_appointments.json b/erpnext/healthcare/dashboard_chart/department_wise_patient_appointments/department_wise_patient_appointments.json
deleted file mode 100644
index b24bb345ac..0000000000
--- a/erpnext/healthcare/dashboard_chart/department_wise_patient_appointments/department_wise_patient_appointments.json
+++ /dev/null
@@ -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": []
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart/diagnoses/diagnoses.json b/erpnext/healthcare/dashboard_chart/diagnoses/diagnoses.json
deleted file mode 100644
index 82145d6024..0000000000
--- a/erpnext/healthcare/dashboard_chart/diagnoses/diagnoses.json
+++ /dev/null
@@ -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": []
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart/in_patient_status/in_patient_status.json b/erpnext/healthcare/dashboard_chart/in_patient_status/in_patient_status.json
deleted file mode 100644
index 77b47c9e15..0000000000
--- a/erpnext/healthcare/dashboard_chart/in_patient_status/in_patient_status.json
+++ /dev/null
@@ -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": []
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart/lab_tests/lab_tests.json b/erpnext/healthcare/dashboard_chart/lab_tests/lab_tests.json
deleted file mode 100644
index 70293b158e..0000000000
--- a/erpnext/healthcare/dashboard_chart/lab_tests/lab_tests.json
+++ /dev/null
@@ -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": []
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart/patient_appointments/patient_appointments.json b/erpnext/healthcare/dashboard_chart/patient_appointments/patient_appointments.json
deleted file mode 100644
index 19bfb7256f..0000000000
--- a/erpnext/healthcare/dashboard_chart/patient_appointments/patient_appointments.json
+++ /dev/null
@@ -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": []
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart/symptoms/symptoms.json b/erpnext/healthcare/dashboard_chart/symptoms/symptoms.json
deleted file mode 100644
index 65e5472aa1..0000000000
--- a/erpnext/healthcare/dashboard_chart/symptoms/symptoms.json
+++ /dev/null
@@ -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": []
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart_source/__init__.py b/erpnext/healthcare/dashboard_chart_source/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/__init__.py b/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.js b/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.js
deleted file mode 100644
index e494489d21..0000000000
--- a/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.js
+++ /dev/null
@@ -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")
- }
- ]
-};
diff --git a/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.json b/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.json
deleted file mode 100644
index 00301ef2c3..0000000000
--- a/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.py b/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.py
deleted file mode 100644
index 9c71ce86ac..0000000000
--- a/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.py
+++ /dev/null
@@ -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'
- }
diff --git a/erpnext/healthcare/desk_page/healthcare/healthcare.json b/erpnext/healthcare/desk_page/healthcare/healthcare.json
deleted file mode 100644
index af601f3eb2..0000000000
--- a/erpnext/healthcare/desk_page/healthcare/healthcare.json
+++ /dev/null
@@ -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"
- }
- ]
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/__init__.py b/erpnext/healthcare/doctype/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/antibiotic/__init__.py b/erpnext/healthcare/doctype/antibiotic/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/antibiotic/antibiotic.js b/erpnext/healthcare/doctype/antibiotic/antibiotic.js
deleted file mode 100644
index 42e6adb603..0000000000
--- a/erpnext/healthcare/doctype/antibiotic/antibiotic.js
+++ /dev/null
@@ -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', {
-});
diff --git a/erpnext/healthcare/doctype/antibiotic/antibiotic.json b/erpnext/healthcare/doctype/antibiotic/antibiotic.json
deleted file mode 100644
index 41a3e318f3..0000000000
--- a/erpnext/healthcare/doctype/antibiotic/antibiotic.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/antibiotic/antibiotic.py b/erpnext/healthcare/doctype/antibiotic/antibiotic.py
deleted file mode 100644
index 6a4b7648b9..0000000000
--- a/erpnext/healthcare/doctype/antibiotic/antibiotic.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/antibiotic/test_antibiotic.py b/erpnext/healthcare/doctype/antibiotic/test_antibiotic.py
deleted file mode 100644
index b6ec79f7ff..0000000000
--- a/erpnext/healthcare/doctype/antibiotic/test_antibiotic.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/appointment_type/__init__.py b/erpnext/healthcare/doctype/appointment_type/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/appointment_type/appointment_type.js b/erpnext/healthcare/doctype/appointment_type/appointment_type.js
deleted file mode 100644
index 99b7cb295a..0000000000
--- a/erpnext/healthcare/doctype/appointment_type/appointment_type.js
+++ /dev/null
@@ -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);
- }
- }
- });
- }
- }
-});
diff --git a/erpnext/healthcare/doctype/appointment_type/appointment_type.json b/erpnext/healthcare/doctype/appointment_type/appointment_type.json
deleted file mode 100644
index 3872318287..0000000000
--- a/erpnext/healthcare/doctype/appointment_type/appointment_type.json
+++ /dev/null
@@ -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"
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/appointment_type/appointment_type.py b/erpnext/healthcare/doctype/appointment_type/appointment_type.py
deleted file mode 100644
index 94d023f2c3..0000000000
--- a/erpnext/healthcare/doctype/appointment_type/appointment_type.py
+++ /dev/null
@@ -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)
diff --git a/erpnext/healthcare/doctype/appointment_type/appointment_type_dashboard.py b/erpnext/healthcare/doctype/appointment_type/appointment_type_dashboard.py
deleted file mode 100644
index b9c6edbb19..0000000000
--- a/erpnext/healthcare/doctype/appointment_type/appointment_type_dashboard.py
+++ /dev/null
@@ -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']
- },
- ]
- }
diff --git a/erpnext/healthcare/doctype/appointment_type/test_appointment_type.py b/erpnext/healthcare/doctype/appointment_type/test_appointment_type.py
deleted file mode 100644
index 04452e470e..0000000000
--- a/erpnext/healthcare/doctype/appointment_type/test_appointment_type.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/appointment_type_service_item/__init__.py b/erpnext/healthcare/doctype/appointment_type_service_item/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.json b/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.json
deleted file mode 100644
index ccae129ea0..0000000000
--- a/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.py b/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.py
deleted file mode 100644
index 026d5d79fd..0000000000
--- a/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/body_part/__init__.py b/erpnext/healthcare/doctype/body_part/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/body_part/body_part.js b/erpnext/healthcare/doctype/body_part/body_part.js
deleted file mode 100644
index d2f9d09937..0000000000
--- a/erpnext/healthcare/doctype/body_part/body_part.js
+++ /dev/null
@@ -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) {
-
- // }
-});
diff --git a/erpnext/healthcare/doctype/body_part/body_part.json b/erpnext/healthcare/doctype/body_part/body_part.json
deleted file mode 100644
index 6e3d1d4ce3..0000000000
--- a/erpnext/healthcare/doctype/body_part/body_part.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/body_part/body_part.py b/erpnext/healthcare/doctype/body_part/body_part.py
deleted file mode 100644
index 77e8dd90a0..0000000000
--- a/erpnext/healthcare/doctype/body_part/body_part.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/body_part/test_body_part.py b/erpnext/healthcare/doctype/body_part/test_body_part.py
deleted file mode 100644
index a81ba179bf..0000000000
--- a/erpnext/healthcare/doctype/body_part/test_body_part.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/body_part_link/__init__.py b/erpnext/healthcare/doctype/body_part_link/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/body_part_link/body_part_link.json b/erpnext/healthcare/doctype/body_part_link/body_part_link.json
deleted file mode 100644
index 400b7c6fe8..0000000000
--- a/erpnext/healthcare/doctype/body_part_link/body_part_link.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/body_part_link/body_part_link.py b/erpnext/healthcare/doctype/body_part_link/body_part_link.py
deleted file mode 100644
index 07488f0117..0000000000
--- a/erpnext/healthcare/doctype/body_part_link/body_part_link.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/clinical_procedure/__init__.py b/erpnext/healthcare/doctype/clinical_procedure/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.js b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.js
deleted file mode 100644
index b55d5d6f63..0000000000
--- a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.js
+++ /dev/null
@@ -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', ['' + r.message + ' ']),
- 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
- }
- };
-});
diff --git a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.json b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.json
deleted file mode 100644
index b1d62da032..0000000000
--- a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py
deleted file mode 100644
index df4c2ef905..0000000000
--- a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure_list.js b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure_list.js
deleted file mode 100644
index c8601f9677..0000000000
--- a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure_list.js
+++ /dev/null
@@ -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];
- }
-};
diff --git a/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py b/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py
deleted file mode 100644
index b5c3744204..0000000000
--- a/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/clinical_procedure_item/__init__.py b/erpnext/healthcare/doctype/clinical_procedure_item/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.json b/erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.json
deleted file mode 100644
index a7dde0bcd0..0000000000
--- a/erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.py b/erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.py
deleted file mode 100644
index 16c5369cfe..0000000000
--- a/erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/clinical_procedure_template/__init__.py b/erpnext/healthcare/doctype/clinical_procedure_template/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.js b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.js
deleted file mode 100644
index ae6b39bb18..0000000000
--- a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.js
+++ /dev/null
@@ -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 ') + "here " + __(' 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.')
- }
-];
diff --git a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.json b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.json
deleted file mode 100644
index 17ac7eb1f9..0000000000
--- a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py
deleted file mode 100644
index 16e0969ae4..0000000000
--- a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template_dashboard.py b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template_dashboard.py
deleted file mode 100644
index a69899d3ea..0000000000
--- a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template_dashboard.py
+++ /dev/null
@@ -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']
- }
- ]
- }
diff --git a/erpnext/healthcare/doctype/clinical_procedure_template/test_clinical_procedure_template.py b/erpnext/healthcare/doctype/clinical_procedure_template/test_clinical_procedure_template.py
deleted file mode 100644
index f754c76341..0000000000
--- a/erpnext/healthcare/doctype/clinical_procedure_template/test_clinical_procedure_template.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/codification_table/__init__.py b/erpnext/healthcare/doctype/codification_table/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/codification_table/codification_table.json b/erpnext/healthcare/doctype/codification_table/codification_table.json
deleted file mode 100644
index 9a917b4fff..0000000000
--- a/erpnext/healthcare/doctype/codification_table/codification_table.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/codification_table/codification_table.py b/erpnext/healthcare/doctype/codification_table/codification_table.py
deleted file mode 100644
index 232d92ca9d..0000000000
--- a/erpnext/healthcare/doctype/codification_table/codification_table.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/complaint/__init__.py b/erpnext/healthcare/doctype/complaint/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/complaint/complaint.js b/erpnext/healthcare/doctype/complaint/complaint.js
deleted file mode 100644
index 5a2d219fe3..0000000000
--- a/erpnext/healthcare/doctype/complaint/complaint.js
+++ /dev/null
@@ -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', {
-});
diff --git a/erpnext/healthcare/doctype/complaint/complaint.json b/erpnext/healthcare/doctype/complaint/complaint.json
deleted file mode 100644
index f600838b65..0000000000
--- a/erpnext/healthcare/doctype/complaint/complaint.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/complaint/complaint.py b/erpnext/healthcare/doctype/complaint/complaint.py
deleted file mode 100644
index 20e00f6b02..0000000000
--- a/erpnext/healthcare/doctype/complaint/complaint.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/complaint/test_complaint.py b/erpnext/healthcare/doctype/complaint/test_complaint.py
deleted file mode 100644
index d3e10692b0..0000000000
--- a/erpnext/healthcare/doctype/complaint/test_complaint.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/descriptive_test_result/__init__.py b/erpnext/healthcare/doctype/descriptive_test_result/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.json b/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.json
deleted file mode 100644
index fcd3828aa5..0000000000
--- a/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.json
+++ /dev/null
@@ -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"
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.py b/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.py
deleted file mode 100644
index c08604694a..0000000000
--- a/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/descriptive_test_template/__init__.py b/erpnext/healthcare/doctype/descriptive_test_template/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.json b/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.json
deleted file mode 100644
index 9ee8f4fc68..0000000000
--- a/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.json
+++ /dev/null
@@ -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"
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.py b/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.py
deleted file mode 100644
index 84184fbcca..0000000000
--- a/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/diagnosis/__init__.py b/erpnext/healthcare/doctype/diagnosis/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/diagnosis/diagnosis.js b/erpnext/healthcare/doctype/diagnosis/diagnosis.js
deleted file mode 100644
index fb2557face..0000000000
--- a/erpnext/healthcare/doctype/diagnosis/diagnosis.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (c) 2016, ESS LLP and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Diagnosis', {
-});
diff --git a/erpnext/healthcare/doctype/diagnosis/diagnosis.json b/erpnext/healthcare/doctype/diagnosis/diagnosis.json
deleted file mode 100644
index 936c2c50a9..0000000000
--- a/erpnext/healthcare/doctype/diagnosis/diagnosis.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/diagnosis/diagnosis.py b/erpnext/healthcare/doctype/diagnosis/diagnosis.py
deleted file mode 100644
index 05add1b530..0000000000
--- a/erpnext/healthcare/doctype/diagnosis/diagnosis.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/diagnosis/test_diagnosis.py b/erpnext/healthcare/doctype/diagnosis/test_diagnosis.py
deleted file mode 100644
index c79164db37..0000000000
--- a/erpnext/healthcare/doctype/diagnosis/test_diagnosis.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/dosage_form/__init__.py b/erpnext/healthcare/doctype/dosage_form/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/dosage_form/dosage_form.js b/erpnext/healthcare/doctype/dosage_form/dosage_form.js
deleted file mode 100644
index 60e96969f6..0000000000
--- a/erpnext/healthcare/doctype/dosage_form/dosage_form.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (c) 2017, ESS LLP and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Dosage Form', {
-});
diff --git a/erpnext/healthcare/doctype/dosage_form/dosage_form.json b/erpnext/healthcare/doctype/dosage_form/dosage_form.json
deleted file mode 100644
index 350aaedcba..0000000000
--- a/erpnext/healthcare/doctype/dosage_form/dosage_form.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/dosage_form/dosage_form.py b/erpnext/healthcare/doctype/dosage_form/dosage_form.py
deleted file mode 100644
index 6b2d88b61b..0000000000
--- a/erpnext/healthcare/doctype/dosage_form/dosage_form.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/dosage_form/test_dosage_form.py b/erpnext/healthcare/doctype/dosage_form/test_dosage_form.py
deleted file mode 100644
index 0161b82ba3..0000000000
--- a/erpnext/healthcare/doctype/dosage_form/test_dosage_form.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/dosage_strength/__init__.py b/erpnext/healthcare/doctype/dosage_strength/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/dosage_strength/dosage_strength.json b/erpnext/healthcare/doctype/dosage_strength/dosage_strength.json
deleted file mode 100644
index da4f1a7964..0000000000
--- a/erpnext/healthcare/doctype/dosage_strength/dosage_strength.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/dosage_strength/dosage_strength.py b/erpnext/healthcare/doctype/dosage_strength/dosage_strength.py
deleted file mode 100644
index 9e74743a7c..0000000000
--- a/erpnext/healthcare/doctype/dosage_strength/dosage_strength.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/drug_prescription/__init__.py b/erpnext/healthcare/doctype/drug_prescription/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/drug_prescription/drug_prescription.json b/erpnext/healthcare/doctype/drug_prescription/drug_prescription.json
deleted file mode 100644
index a65c56694e..0000000000
--- a/erpnext/healthcare/doctype/drug_prescription/drug_prescription.json
+++ /dev/null
@@ -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"
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/drug_prescription/drug_prescription.py b/erpnext/healthcare/doctype/drug_prescription/drug_prescription.py
deleted file mode 100755
index 744bdb03ef..0000000000
--- a/erpnext/healthcare/doctype/drug_prescription/drug_prescription.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/exercise/__init__.py b/erpnext/healthcare/doctype/exercise/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/exercise/exercise.json b/erpnext/healthcare/doctype/exercise/exercise.json
deleted file mode 100644
index 683cc6d3c3..0000000000
--- a/erpnext/healthcare/doctype/exercise/exercise.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/exercise/exercise.py b/erpnext/healthcare/doctype/exercise/exercise.py
deleted file mode 100644
index 5d2b1f1a96..0000000000
--- a/erpnext/healthcare/doctype/exercise/exercise.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/exercise_difficulty_level/__init__.py b/erpnext/healthcare/doctype/exercise_difficulty_level/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.js b/erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.js
deleted file mode 100644
index ff51c34f3f..0000000000
--- a/erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.js
+++ /dev/null
@@ -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) {
-
- // }
-});
diff --git a/erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.json b/erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.json
deleted file mode 100644
index a6aed75e7a..0000000000
--- a/erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.json
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.py b/erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.py
deleted file mode 100644
index bbb297275f..0000000000
--- a/erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/exercise_difficulty_level/test_exercise_difficulty_level.py b/erpnext/healthcare/doctype/exercise_difficulty_level/test_exercise_difficulty_level.py
deleted file mode 100644
index dcaea08aba..0000000000
--- a/erpnext/healthcare/doctype/exercise_difficulty_level/test_exercise_difficulty_level.py
+++ /dev/null
@@ -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
diff --git a/erpnext/healthcare/doctype/exercise_type/__init__.py b/erpnext/healthcare/doctype/exercise_type/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/exercise_type/exercise_type.js b/erpnext/healthcare/doctype/exercise_type/exercise_type.js
deleted file mode 100644
index 06146047eb..0000000000
--- a/erpnext/healthcare/doctype/exercise_type/exercise_type.js
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Exercise Type', {
- refresh: function(frm) {
- let wrapper = frm.fields_dict.steps_html.wrapper;
-
- frm.ExerciseEditor = new erpnext.ExerciseEditor(frm, wrapper);
- }
-});
-
-erpnext.ExerciseEditor = class ExerciseEditor {
- constructor(frm, wrapper) {
- this.wrapper = wrapper;
- this.frm = frm;
- this.make(frm, wrapper);
- }
-
- make(frm, wrapper) {
- $(this.wrapper).empty();
-
- this.exercise_toolbar = $('
', {
- therapy: y[0],
- name: y[1], encounter: y[2], practitioner: y[3], date: y[4],
- department: y[6] ? y[6] : '', therapy_plan: y[5]
- })).appendTo(html_field);
-
- row.find("a").click(function() {
- frm.doc.therapy_type = $(this).attr("data-therapy");
- frm.doc.practitioner = $(this).attr("data-practitioner");
- frm.doc.department = $(this).attr("data-department");
- frm.doc.therapy_plan = $(this).attr("data-therapy-plan");
- frm.refresh_field("therapy_type");
- frm.refresh_field("practitioner");
- frm.refresh_field("department");
- frm.refresh_field("therapy-plan");
- frappe.db.get_value('Therapy Type', frm.doc.therapy_type, 'default_duration', (r) => {
- if (r.default_duration) {
- frm.set_value('duration', r.default_duration)
- }
- });
- d.hide();
- return false;
- });
- });
- d.show();
-};
-
-let create_vital_signs = function(frm) {
- if (!frm.doc.patient) {
- frappe.throw(__('Please select patient'));
- }
- frappe.route_options = {
- 'patient': frm.doc.patient,
- 'appointment': frm.doc.name,
- 'company': frm.doc.company
- };
- frappe.new_doc('Vital Signs');
-};
-
-let update_status = function(frm, status) {
- let doc = frm.doc;
- frappe.confirm(__('Are you sure you want to cancel this appointment?'),
- function() {
- frappe.call({
- method: 'erpnext.healthcare.doctype.patient_appointment.patient_appointment.update_status',
- args: { appointment_id: doc.name, status: status },
- callback: function(data) {
- if (!data.exc) {
- frm.reload_doc();
- }
- }
- });
- }
- );
-};
-
-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)')}`;
-};
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.json b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.json
deleted file mode 100644
index 28d3a6dadf..0000000000
--- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.json
+++ /dev/null
@@ -1,403 +0,0 @@
-{
- "actions": [],
- "allow_copy": 1,
- "allow_import": 1,
- "autoname": "naming_series:",
- "beta": 1,
- "creation": "2017-05-04 11:52:40.941507",
- "doctype": "DocType",
- "document_type": "Document",
- "engine": "InnoDB",
- "field_order": [
- "naming_series",
- "title",
- "status",
- "patient",
- "patient_name",
- "patient_sex",
- "patient_age",
- "inpatient_record",
- "column_break_1",
- "company",
- "practitioner",
- "practitioner_name",
- "department",
- "service_unit",
- "section_break_12",
- "appointment_type",
- "duration",
- "procedure_template",
- "get_procedure_from_encounter",
- "procedure_prescription",
- "therapy_plan",
- "therapy_type",
- "get_prescribed_therapies",
- "column_break_17",
- "appointment_date",
- "appointment_time",
- "appointment_datetime",
- "section_break_16",
- "mode_of_payment",
- "billing_item",
- "invoiced",
- "column_break_2",
- "paid_amount",
- "ref_sales_invoice",
- "section_break_3",
- "referring_practitioner",
- "reminded",
- "column_break_36",
- "notes"
- ],
- "fields": [
- {
- "fetch_from": "patient.inpatient_record",
- "fieldname": "inpatient_record",
- "fieldtype": "Link",
- "label": "Inpatient Record",
- "options": "Inpatient Record",
- "read_only": 1
- },
- {
- "fieldname": "patient",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "in_list_view": 1,
- "in_standard_filter": 1,
- "label": "Patient",
- "options": "Patient",
- "reqd": 1,
- "search_index": 1,
- "set_only_once": 1
- },
- {
- "fieldname": "appointment_type",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Appointment Type",
- "options": "Appointment Type",
- "set_only_once": 1
- },
- {
- "fetch_from": "appointment_type.default_duration",
- "fieldname": "duration",
- "fieldtype": "Int",
- "in_filter": 1,
- "label": "Duration (In Minutes)",
- "set_only_once": 1
- },
- {
- "fieldname": "column_break_1",
- "fieldtype": "Column Break",
- "read_only": 1
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "status",
- "fieldtype": "Select",
- "in_filter": 1,
- "in_list_view": 1,
- "label": "Status",
- "options": "\nScheduled\nOpen\nClosed\nCancelled",
- "read_only": 1,
- "search_index": 1
- },
- {
- "depends_on": "eval:doc.patient;",
- "fieldname": "procedure_template",
- "fieldtype": "Link",
- "label": "Clinical Procedure Template",
- "options": "Clinical Procedure Template",
- "set_only_once": 1
- },
- {
- "depends_on": "eval:doc.__islocal && doc.patient",
- "fieldname": "get_procedure_from_encounter",
- "fieldtype": "Button",
- "label": "Get Prescribed Clinical Procedures"
- },
- {
- "fieldname": "procedure_prescription",
- "fieldtype": "Link",
- "hidden": 1,
- "label": "Procedure Prescription",
- "no_copy": 1,
- "options": "Procedure Prescription",
- "print_hide": 1,
- "read_only": 1
- },
- {
- "fieldname": "service_unit",
- "fieldtype": "Link",
- "label": "Service Unit",
- "options": "Healthcare Service Unit",
- "read_only": 1
- },
- {
- "depends_on": "eval:doc.practitioner;",
- "fieldname": "section_break_12",
- "fieldtype": "Section Break",
- "label": "Appointment Details"
- },
- {
- "fieldname": "practitioner",
- "fieldtype": "Link",
- "in_standard_filter": 1,
- "label": "Healthcare Practitioner",
- "options": "Healthcare Practitioner",
- "reqd": 1,
- "search_index": 1,
- "set_only_once": 1
- },
- {
- "fetch_from": "practitioner.department",
- "fieldname": "department",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "in_list_view": 1,
- "in_standard_filter": 1,
- "label": "Department",
- "options": "Medical Department",
- "search_index": 1,
- "set_only_once": 1
- },
- {
- "fieldname": "column_break_17",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "appointment_date",
- "fieldtype": "Date",
- "in_list_view": 1,
- "in_standard_filter": 1,
- "label": "Date",
- "read_only": 1,
- "reqd": 1,
- "search_index": 1
- },
- {
- "fieldname": "appointment_time",
- "fieldtype": "Time",
- "in_list_view": 1,
- "label": "Time",
- "read_only": 1,
- "reqd": 1
- },
- {
- "fieldname": "section_break_16",
- "fieldtype": "Section Break",
- "label": "Payments"
- },
- {
- "fetch_from": "patient.patient_name",
- "fieldname": "patient_name",
- "fieldtype": "Data",
- "label": "Patient Name",
- "read_only": 1
- },
- {
- "fetch_from": "patient.sex",
- "fieldname": "patient_sex",
- "fieldtype": "Link",
- "label": "Gender",
- "no_copy": 1,
- "options": "Gender",
- "print_hide": 1,
- "read_only": 1,
- "report_hide": 1
- },
- {
- "fieldname": "patient_age",
- "fieldtype": "Data",
- "label": "Patient Age",
- "read_only": 1
- },
- {
- "fieldname": "appointment_datetime",
- "fieldtype": "Datetime",
- "hidden": 1,
- "label": "Appointment Datetime",
- "print_hide": 1,
- "read_only": 1,
- "report_hide": 1,
- "search_index": 1
- },
- {
- "fieldname": "mode_of_payment",
- "fieldtype": "Link",
- "label": "Mode of Payment",
- "options": "Mode of Payment",
- "read_only_depends_on": "invoiced"
- },
- {
- "fieldname": "paid_amount",
- "fieldtype": "Currency",
- "label": "Paid Amount",
- "read_only_depends_on": "invoiced"
- },
- {
- "fieldname": "column_break_2",
- "fieldtype": "Column Break"
- },
- {
- "default": "0",
- "fieldname": "invoiced",
- "fieldtype": "Check",
- "label": "Invoiced",
- "read_only": 1
- },
- {
- "fieldname": "company",
- "fieldtype": "Link",
- "in_standard_filter": 1,
- "label": "Company",
- "no_copy": 1,
- "options": "Company",
- "reqd": 1,
- "set_only_once": 1
- },
- {
- "collapsible": 1,
- "fieldname": "section_break_3",
- "fieldtype": "Section Break",
- "label": "More Info"
- },
- {
- "fieldname": "notes",
- "fieldtype": "Small Text",
- "ignore_xss_filter": 1,
- "label": "Notes"
- },
- {
- "fieldname": "referring_practitioner",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Referring Practitioner",
- "options": "Healthcare Practitioner"
- },
- {
- "default": "0",
- "fieldname": "reminded",
- "fieldtype": "Check",
- "hidden": 1,
- "label": "Reminded",
- "print_hide": 1,
- "report_hide": 1
- },
- {
- "depends_on": "eval:doc.patient && doc.therapy_plan;",
- "fieldname": "therapy_type",
- "fieldtype": "Link",
- "label": "Therapy",
- "options": "Therapy Type",
- "set_only_once": 1
- },
- {
- "depends_on": "eval:doc.patient && doc.therapy_plan && doc.__islocal;",
- "fieldname": "get_prescribed_therapies",
- "fieldtype": "Button",
- "label": "Get Prescribed Therapies"
- },
- {
- "depends_on": "eval: doc.patient;",
- "fieldname": "therapy_plan",
- "fieldtype": "Link",
- "label": "Therapy Plan",
- "options": "Therapy Plan",
- "set_only_once": 1
- },
- {
- "fieldname": "ref_sales_invoice",
- "fieldtype": "Link",
- "label": "Reference Sales Invoice",
- "options": "Sales Invoice",
- "read_only": 1
- },
- {
- "fieldname": "naming_series",
- "fieldtype": "Select",
- "label": "Series",
- "options": "HLC-APP-.YYYY.-",
- "set_only_once": 1
- },
- {
- "fieldname": "billing_item",
- "fieldtype": "Link",
- "label": "Billing Item",
- "options": "Item",
- "read_only": 1
- },
- {
- "fieldname": "column_break_36",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "title",
- "fieldtype": "Data",
- "hidden": 1,
- "label": "Title",
- "no_copy": 1,
- "print_hide": 1,
- "read_only": 1
- },
- {
- "fetch_from": "practitioner.practitioner_name",
- "fieldname": "practitioner_name",
- "fieldtype": "Data",
- "label": "Practitioner Name",
- "read_only": 1
- }
- ],
- "links": [],
- "modified": "2021-08-30 09:00:41.329387",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient Appointment",
- "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
- },
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Nursing User",
- "share": 1,
- "write": 1
- }
- ],
- "restrict_to_domain": "Healthcare",
- "search_fields": "patient, practitioner, department, appointment_date, appointment_time",
- "show_name_in_global_search": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "title_field": "title",
- "track_changes": 1,
- "track_seen": 1
-}
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
deleted file mode 100755
index dcbcda09d8..0000000000
--- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
+++ /dev/null
@@ -1,559 +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 datetime
-import json
-
-import frappe
-from frappe import _
-from frappe.core.doctype.sms_settings.sms_settings import send_sms
-from frappe.model.document import Document
-from frappe.model.mapper import get_mapped_doc
-from frappe.utils import flt, get_link_to_form, get_time, getdate
-
-from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import (
- get_income_account,
- get_receivable_account,
-)
-from erpnext.healthcare.utils import (
- check_fee_validity,
- get_service_item_and_practitioner_charge,
- manage_fee_validity,
-)
-from erpnext.hr.doctype.employee.employee import is_holiday
-
-
-class MaximumCapacityError(frappe.ValidationError):
- pass
-class OverlapError(frappe.ValidationError):
- pass
-
-class PatientAppointment(Document):
- def validate(self):
- self.validate_overlaps()
- self.validate_service_unit()
- self.set_appointment_datetime()
- self.validate_customer_created()
- self.set_status()
- self.set_title()
-
- def after_insert(self):
- self.update_prescription_details()
- self.set_payment_details()
- invoice_appointment(self)
- self.update_fee_validity()
- send_confirmation_msg(self)
-
- def set_title(self):
- self.title = _('{0} with {1}').format(self.patient_name or self.patient,
- self.practitioner_name or self.practitioner)
-
- def set_status(self):
- today = getdate()
- appointment_date = getdate(self.appointment_date)
-
- # If appointment is created for today set status as Open else Scheduled
- if appointment_date == today:
- self.status = 'Open'
- elif appointment_date > today:
- self.status = 'Scheduled'
-
- def validate_overlaps(self):
- end_time = datetime.datetime.combine(getdate(self.appointment_date), get_time(self.appointment_time)) \
- + datetime.timedelta(minutes=flt(self.duration))
-
- # all appointments for both patient and practitioner overlapping the duration of this appointment
- overlapping_appointments = frappe.db.sql("""
- SELECT
- name, practitioner, patient, appointment_time, duration, service_unit
- FROM
- `tabPatient Appointment`
- WHERE
- appointment_date=%(appointment_date)s AND name!=%(name)s AND status NOT IN ("Closed", "Cancelled") AND
- (practitioner=%(practitioner)s OR patient=%(patient)s) AND
- ((appointment_time<%(appointment_time)s AND appointment_time + INTERVAL duration MINUTE>%(appointment_time)s) OR
- (appointment_time>%(appointment_time)s AND appointment_time<%(end_time)s) OR
- (appointment_time=%(appointment_time)s))
- """,
- {
- 'appointment_date': self.appointment_date,
- 'name': self.name,
- 'practitioner': self.practitioner,
- 'patient': self.patient,
- 'appointment_time': self.appointment_time,
- 'end_time':end_time.time()
- },
- as_dict = True
- )
-
- if not overlapping_appointments:
- return # No overlaps, nothing to validate!
-
- if self.service_unit: # validate service unit capacity if overlap enabled
- allow_overlap, service_unit_capacity = frappe.get_value('Healthcare Service Unit', self.service_unit,
- ['overlap_appointments', 'service_unit_capacity'])
- if allow_overlap:
- service_unit_appointments = list(filter(lambda appointment: appointment['service_unit'] == self.service_unit and
- appointment['patient'] != self.patient, overlapping_appointments)) # if same patient already booked, it should be an overlap
- if len(service_unit_appointments) >= (service_unit_capacity or 1):
- frappe.throw(_("Not allowed, {} cannot exceed maximum capacity {}")
- .format(frappe.bold(self.service_unit), frappe.bold(service_unit_capacity or 1)), MaximumCapacityError)
- else: # service_unit_appointments within capacity, remove from overlapping_appointments
- overlapping_appointments = [appointment for appointment in overlapping_appointments if appointment not in service_unit_appointments]
-
- if overlapping_appointments:
- frappe.throw(_("Not allowed, cannot overlap appointment {}")
- .format(frappe.bold(', '.join([appointment['name'] for appointment in overlapping_appointments]))), OverlapError)
-
-
- def validate_service_unit(self):
- if self.inpatient_record and self.service_unit:
- from erpnext.healthcare.doctype.inpatient_medication_entry.inpatient_medication_entry import (
- get_current_healthcare_service_unit,
- )
-
- is_inpatient_occupancy_unit = frappe.db.get_value('Healthcare Service Unit', self.service_unit,
- 'inpatient_occupancy')
- service_unit = get_current_healthcare_service_unit(self.inpatient_record)
- if is_inpatient_occupancy_unit and service_unit != self.service_unit:
- msg = _('Patient {0} is not admitted in the service unit {1}').format(frappe.bold(self.patient), frappe.bold(self.service_unit)) + '
'
- msg += _('Appointment for service units with Inpatient Occupancy can only be created against the unit where patient has been admitted.')
- frappe.throw(msg, title=_('Invalid Healthcare Service Unit'))
-
-
- def set_appointment_datetime(self):
- self.appointment_datetime = "%s %s" % (self.appointment_date, self.appointment_time or "00:00:00")
-
- def set_payment_details(self):
- if frappe.db.get_single_value('Healthcare Settings', 'automate_appointment_invoicing'):
- details = get_service_item_and_practitioner_charge(self)
- self.db_set('billing_item', details.get('service_item'))
- if not self.paid_amount:
- self.db_set('paid_amount', details.get('practitioner_charge'))
-
- def validate_customer_created(self):
- if frappe.db.get_single_value('Healthcare Settings', 'automate_appointment_invoicing'):
- if not frappe.db.get_value('Patient', self.patient, 'customer'):
- msg = _("Please set a Customer linked to the Patient")
- msg += "
{0} ".format(self.patient)
- frappe.throw(msg, title=_('Customer Not Found'))
-
- def update_prescription_details(self):
- if self.procedure_prescription:
- frappe.db.set_value('Procedure Prescription', self.procedure_prescription, 'appointment_booked', 1)
- if self.procedure_template:
- comments = frappe.db.get_value('Procedure Prescription', self.procedure_prescription, 'comments')
- if comments:
- frappe.db.set_value('Patient Appointment', self.name, 'notes', comments)
-
- def update_fee_validity(self):
- if not frappe.db.get_single_value('Healthcare Settings', 'enable_free_follow_ups'):
- return
-
- fee_validity = manage_fee_validity(self)
- if fee_validity:
- frappe.msgprint(_('{0}: {1} has fee validity till {2}').format(self.patient,
- frappe.bold(self.patient_name), fee_validity.valid_till))
-
- @frappe.whitelist()
- def get_therapy_types(self):
- if not self.therapy_plan:
- return
-
- therapy_types = []
- doc = frappe.get_doc('Therapy Plan', self.therapy_plan)
- for entry in doc.therapy_plan_details:
- therapy_types.append(entry.therapy_type)
-
- return therapy_types
-
-
-@frappe.whitelist()
-def check_payment_fields_reqd(patient):
- automate_invoicing = frappe.db.get_single_value('Healthcare Settings', 'automate_appointment_invoicing')
- free_follow_ups = frappe.db.get_single_value('Healthcare Settings', 'enable_free_follow_ups')
- if automate_invoicing:
- if free_follow_ups:
- fee_validity = frappe.db.exists('Fee Validity', {'patient': patient, 'status': 'Pending'})
- if fee_validity:
- return {'fee_validity': fee_validity}
- return True
- return False
-
-def invoice_appointment(appointment_doc):
- automate_invoicing = frappe.db.get_single_value('Healthcare Settings', 'automate_appointment_invoicing')
- appointment_invoiced = frappe.db.get_value('Patient Appointment', appointment_doc.name, 'invoiced')
- enable_free_follow_ups = frappe.db.get_single_value('Healthcare Settings', 'enable_free_follow_ups')
- if enable_free_follow_ups:
- fee_validity = check_fee_validity(appointment_doc)
- if fee_validity and fee_validity.status == 'Completed':
- fee_validity = None
- elif not fee_validity:
- if frappe.db.exists('Fee Validity Reference', {'appointment': appointment_doc.name}):
- return
- else:
- fee_validity = None
-
- if automate_invoicing and not appointment_invoiced and not fee_validity:
- create_sales_invoice(appointment_doc)
-
-
-def create_sales_invoice(appointment_doc):
- sales_invoice = frappe.new_doc('Sales Invoice')
- sales_invoice.patient = appointment_doc.patient
- sales_invoice.customer = frappe.get_value('Patient', appointment_doc.patient, 'customer')
- sales_invoice.appointment = appointment_doc.name
- sales_invoice.due_date = getdate()
- sales_invoice.company = appointment_doc.company
- sales_invoice.debit_to = get_receivable_account(appointment_doc.company)
-
- item = sales_invoice.append('items', {})
- item = get_appointment_item(appointment_doc, item)
-
- # Add payments if payment details are supplied else proceed to create invoice as Unpaid
- if appointment_doc.mode_of_payment and appointment_doc.paid_amount:
- sales_invoice.is_pos = 1
- payment = sales_invoice.append('payments', {})
- payment.mode_of_payment = appointment_doc.mode_of_payment
- payment.amount = appointment_doc.paid_amount
-
- sales_invoice.set_missing_values(for_validate=True)
- sales_invoice.flags.ignore_mandatory = True
- sales_invoice.save(ignore_permissions=True)
- sales_invoice.submit()
- frappe.msgprint(_('Sales Invoice {0} created').format(sales_invoice.name), alert=True)
- frappe.db.set_value('Patient Appointment', appointment_doc.name, {
- 'invoiced': 1,
- 'ref_sales_invoice': sales_invoice.name
- })
-
-
-def check_is_new_patient(patient, name=None):
- filters = {'patient': patient, 'status': ('!=','Cancelled')}
- if name:
- filters['name'] = ('!=', name)
-
- has_previous_appointment = frappe.db.exists('Patient Appointment', filters)
- return not has_previous_appointment
-
-
-def get_appointment_item(appointment_doc, item):
- details = get_service_item_and_practitioner_charge(appointment_doc)
- charge = appointment_doc.paid_amount or details.get('practitioner_charge')
- item.item_code = details.get('service_item')
- item.description = _('Consulting Charges: {0}').format(appointment_doc.practitioner)
- item.income_account = get_income_account(appointment_doc.practitioner, appointment_doc.company)
- item.cost_center = frappe.get_cached_value('Company', appointment_doc.company, 'cost_center')
- item.rate = charge
- item.amount = charge
- item.qty = 1
- item.reference_dt = 'Patient Appointment'
- item.reference_dn = appointment_doc.name
- return item
-
-
-def cancel_appointment(appointment_id):
- appointment = frappe.get_doc('Patient Appointment', appointment_id)
- if appointment.invoiced:
- sales_invoice = check_sales_invoice_exists(appointment)
- if sales_invoice and cancel_sales_invoice(sales_invoice):
- msg = _('Appointment {0} and Sales Invoice {1} cancelled').format(appointment.name, sales_invoice.name)
- else:
- msg = _('Appointment Cancelled. Please review and cancel the invoice {0}').format(sales_invoice.name)
- else:
- fee_validity = manage_fee_validity(appointment)
- msg = _('Appointment Cancelled.')
- if fee_validity:
- msg += _('Fee Validity {0} updated.').format(fee_validity.name)
-
- frappe.msgprint(msg)
-
-
-def cancel_sales_invoice(sales_invoice):
- if frappe.db.get_single_value('Healthcare Settings', 'automate_appointment_invoicing'):
- if len(sales_invoice.items) == 1:
- sales_invoice.cancel()
- return True
- return False
-
-
-def check_sales_invoice_exists(appointment):
- sales_invoice = frappe.db.get_value('Sales Invoice Item', {
- 'reference_dt': 'Patient Appointment',
- 'reference_dn': appointment.name
- }, 'parent')
-
- if sales_invoice:
- sales_invoice = frappe.get_doc('Sales Invoice', sales_invoice)
- return sales_invoice
- return False
-
-
-@frappe.whitelist()
-def get_availability_data(date, practitioner):
- """
- Get availability data of 'practitioner' on 'date'
- :param date: Date to check in schedule
- :param practitioner: Name of the practitioner
- :return: dict containing a list of available slots, list of appointments and time of appointments
- """
-
- date = getdate(date)
- weekday = date.strftime('%A')
-
- practitioner_doc = frappe.get_doc('Healthcare Practitioner', practitioner)
-
- check_employee_wise_availability(date, practitioner_doc)
-
- if practitioner_doc.practitioner_schedules:
- slot_details = get_available_slots(practitioner_doc, date)
- else:
- frappe.throw(_('{0} does not have a Healthcare Practitioner Schedule. Add it in Healthcare Practitioner master').format(
- practitioner), title=_('Practitioner Schedule Not Found'))
-
-
- if not slot_details:
- # TODO: return available slots in nearby dates
- frappe.throw(_('Healthcare Practitioner not available on {0}').format(weekday), title=_('Not Available'))
-
- return {'slot_details': slot_details}
-
-
-def check_employee_wise_availability(date, practitioner_doc):
- employee = None
- if practitioner_doc.employee:
- employee = practitioner_doc.employee
- elif practitioner_doc.user_id:
- employee = frappe.db.get_value('Employee', {'user_id': practitioner_doc.user_id}, 'name')
-
- if employee:
- # check holiday
- if is_holiday(employee, date):
- frappe.throw(_('{0} is a holiday'.format(date)), title=_('Not Available'))
-
- # check leave status
- leave_record = frappe.db.sql("""select half_day from `tabLeave Application`
- where employee = %s and %s between from_date and to_date
- and docstatus = 1""", (employee, date), as_dict=True)
- if leave_record:
- if leave_record[0].half_day:
- frappe.throw(_('{0} is on a Half day Leave on {1}').format(practitioner_doc.name, date), title=_('Not Available'))
- else:
- frappe.throw(_('{0} is on Leave on {1}').format(practitioner_doc.name, date), title=_('Not Available'))
-
-
-def get_available_slots(practitioner_doc, date):
- available_slots = slot_details = []
- weekday = date.strftime('%A')
- practitioner = practitioner_doc.name
-
- for schedule_entry in practitioner_doc.practitioner_schedules:
- validate_practitioner_schedules(schedule_entry, practitioner)
- practitioner_schedule = frappe.get_doc('Practitioner Schedule', schedule_entry.schedule)
-
- if practitioner_schedule:
- available_slots = []
- for time_slot in practitioner_schedule.time_slots:
- if weekday == time_slot.day:
- available_slots.append(time_slot)
-
- if available_slots:
- appointments = []
- allow_overlap = 0
- service_unit_capacity = 0
- # fetch all appointments to practitioner by service unit
- filters = {
- 'practitioner': practitioner,
- 'service_unit': schedule_entry.service_unit,
- 'appointment_date': date,
- 'status': ['not in',['Cancelled']]
- }
-
- if schedule_entry.service_unit:
- slot_name = f'{schedule_entry.schedule}'
- allow_overlap, service_unit_capacity = frappe.get_value('Healthcare Service Unit', schedule_entry.service_unit, ['overlap_appointments', 'service_unit_capacity'])
- if not allow_overlap:
- # fetch all appointments to service unit
- filters.pop('practitioner')
- else:
- slot_name = schedule_entry.schedule
- # fetch all appointments to practitioner without service unit
- filters['practitioner'] = practitioner
- filters.pop('service_unit')
-
- appointments = frappe.get_all(
- 'Patient Appointment',
- filters=filters,
- fields=['name', 'appointment_time', 'duration', 'status'])
-
- slot_details.append({'slot_name': slot_name, 'service_unit': schedule_entry.service_unit, 'avail_slot': available_slots,
- 'appointments': appointments, 'allow_overlap': allow_overlap, 'service_unit_capacity': service_unit_capacity})
-
- return slot_details
-
-
-def validate_practitioner_schedules(schedule_entry, practitioner):
- if schedule_entry.schedule:
- if not schedule_entry.service_unit:
- frappe.throw(_('Practitioner {0} does not have a Service Unit set against the Practitioner Schedule {1}.').format(
- get_link_to_form('Healthcare Practitioner', practitioner), frappe.bold(schedule_entry.schedule)),
- title=_('Service Unit Not Found'))
-
- else:
- frappe.throw(_('Practitioner {0} does not have a Practitioner Schedule assigned.').format(
- get_link_to_form('Healthcare Practitioner', practitioner)),
- title=_('Practitioner Schedule Not Found'))
-
-
-@frappe.whitelist()
-def update_status(appointment_id, status):
- frappe.db.set_value('Patient Appointment', appointment_id, 'status', status)
- appointment_booked = True
- if status == 'Cancelled':
- appointment_booked = False
- cancel_appointment(appointment_id)
-
- procedure_prescription = frappe.db.get_value('Patient Appointment', appointment_id, 'procedure_prescription')
- if procedure_prescription:
- frappe.db.set_value('Procedure Prescription', procedure_prescription, 'appointment_booked', appointment_booked)
-
-
-def send_confirmation_msg(doc):
- if frappe.db.get_single_value('Healthcare Settings', 'send_appointment_confirmation'):
- message = frappe.db.get_single_value('Healthcare Settings', 'appointment_confirmation_msg')
- try:
- send_message(doc, message)
- except Exception:
- frappe.log_error(frappe.get_traceback(), _('Appointment Confirmation Message Not Sent'))
- frappe.msgprint(_('Appointment Confirmation Message Not Sent'), indicator='orange')
-
-
-@frappe.whitelist()
-def make_encounter(source_name, target_doc=None):
- doc = get_mapped_doc('Patient Appointment', source_name, {
- 'Patient Appointment': {
- 'doctype': 'Patient Encounter',
- 'field_map': [
- ['appointment', 'name'],
- ['patient', 'patient'],
- ['practitioner', 'practitioner'],
- ['medical_department', 'department'],
- ['patient_sex', 'patient_sex'],
- ['invoiced', 'invoiced'],
- ['company', 'company']
- ]
- }
- }, target_doc)
- return doc
-
-
-def send_appointment_reminder():
- if frappe.db.get_single_value('Healthcare Settings', 'send_appointment_reminder'):
- remind_before = datetime.datetime.strptime(frappe.db.get_single_value('Healthcare Settings', 'remind_before'), '%H:%M:%S')
- reminder_dt = datetime.datetime.now() + datetime.timedelta(
- hours=remind_before.hour, minutes=remind_before.minute, seconds=remind_before.second)
-
- appointment_list = frappe.db.get_all('Patient Appointment', {
- 'appointment_datetime': ['between', (datetime.datetime.now(), reminder_dt)],
- 'reminded': 0,
- 'status': ['!=', 'Cancelled']
- })
-
- for appointment in appointment_list:
- doc = frappe.get_doc('Patient Appointment', appointment.name)
- message = frappe.db.get_single_value('Healthcare Settings', 'appointment_reminder_msg')
- send_message(doc, message)
- frappe.db.set_value('Patient Appointment', doc.name, 'reminded', 1)
-
-def send_message(doc, message):
- patient_mobile = frappe.db.get_value('Patient', doc.patient, 'mobile')
- if patient_mobile:
- context = {'doc': doc, 'alert': doc, 'comments': None}
- if doc.get('_comments'):
- context['comments'] = json.loads(doc.get('_comments'))
-
- # jinja to string convertion happens here
- message = frappe.render_template(message, context)
- number = [patient_mobile]
- try:
- send_sms(number, message)
- except Exception as e:
- frappe.msgprint(_('SMS not sent, please check SMS Settings'), alert=True)
-
-@frappe.whitelist()
-def get_events(start, end, filters=None):
- """Returns events for Gantt / Calendar view rendering.
-
- :param start: Start date-time.
- :param end: End date-time.
- :param filters: Filters (JSON).
- """
- from frappe.desk.calendar import get_event_conditions
- conditions = get_event_conditions('Patient Appointment', filters)
-
- data = frappe.db.sql("""
- select
- `tabPatient Appointment`.name, `tabPatient Appointment`.patient,
- `tabPatient Appointment`.practitioner, `tabPatient Appointment`.status,
- `tabPatient Appointment`.duration,
- timestamp(`tabPatient Appointment`.appointment_date, `tabPatient Appointment`.appointment_time) as 'start',
- `tabAppointment Type`.color
- from
- `tabPatient Appointment`
- left join `tabAppointment Type` on `tabPatient Appointment`.appointment_type=`tabAppointment Type`.name
- where
- (`tabPatient Appointment`.appointment_date between %(start)s and %(end)s)
- and `tabPatient Appointment`.status != 'Cancelled' and `tabPatient Appointment`.docstatus < 2 {conditions}""".format(conditions=conditions),
- {"start": start, "end": end}, as_dict=True, update={"allDay": 0})
-
- for item in data:
- item.end = item.start + datetime.timedelta(minutes = item.duration)
-
- return data
-
-
-@frappe.whitelist()
-def get_procedure_prescribed(patient):
- return frappe.db.sql(
- """
- SELECT
- pp.name, pp.procedure, pp.parent, ct.practitioner,
- ct.encounter_date, pp.practitioner, pp.date, pp.department
- FROM
- `tabPatient Encounter` ct, `tabProcedure Prescription` pp
- WHERE
- ct.patient=%(patient)s and pp.parent=ct.name and pp.appointment_booked=0
- ORDER BY
- ct.creation desc
- """, {'patient': patient}
- )
-
-
-@frappe.whitelist()
-def get_prescribed_therapies(patient):
- return frappe.db.sql(
- """
- SELECT
- t.therapy_type, t.name, t.parent, e.practitioner,
- e.encounter_date, e.therapy_plan, e.medical_department
- FROM
- `tabPatient Encounter` e, `tabTherapy Plan Detail` t
- WHERE
- e.patient=%(patient)s and t.parent=e.name
- ORDER BY
- e.creation desc
- """, {'patient': patient}
- )
-
-
-def update_appointment_status():
- # update the status of appointments daily
- appointments = frappe.get_all('Patient Appointment', {
- 'status': ('not in', ['Closed', 'Cancelled'])
- }, as_dict=1)
-
- for appointment in appointments:
- frappe.get_doc('Patient Appointment', appointment.name).set_status()
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment_calendar.js b/erpnext/healthcare/doctype/patient_appointment/patient_appointment_calendar.js
deleted file mode 100644
index 2249d2a205..0000000000
--- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment_calendar.js
+++ /dev/null
@@ -1,14 +0,0 @@
-
-frappe.views.calendar["Patient Appointment"] = {
- field_map: {
- "start": "start",
- "end": "end",
- "id": "name",
- "title": "patient",
- "allDay": "allDay",
- "eventColor": "color"
- },
- order_by: "appointment_date",
- gantt: true,
- get_events_method: "erpnext.healthcare.doctype.patient_appointment.patient_appointment.get_events"
-};
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment_dashboard.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment_dashboard.py
deleted file mode 100644
index 43c63c96e6..0000000000
--- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment_dashboard.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from __future__ import unicode_literals
-
-from frappe import _
-
-
-def get_data():
- return {
- 'fieldname': 'appointment',
- 'non_standard_fieldnames': {
- 'Patient Medical Record': 'reference_name'
- },
- 'transactions': [
- {
- 'label': _('Consultations'),
- 'items': ['Patient Encounter', 'Vital Signs', 'Patient Medical Record']
- }
- ]
- }
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment_list.js b/erpnext/healthcare/doctype/patient_appointment/patient_appointment_list.js
deleted file mode 100644
index 721887b459..0000000000
--- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment_list.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
-(c) ESS 2015-16
-*/
-frappe.listview_settings['Patient Appointment'] = {
- filters: [["status", "=", "Open"]],
- get_indicator: function(doc) {
- var colors = {
- "Open": "orange",
- "Scheduled": "yellow",
- "Closed": "green",
- "Cancelled": "red",
- "Expired": "grey"
- };
- return [__(doc.status), colors[doc.status], "status,=," + doc.status];
- }
-};
diff --git a/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py
deleted file mode 100644
index 8ca30b8cbe..0000000000
--- a/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py
+++ /dev/null
@@ -1,487 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, ESS LLP and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-import unittest
-
-import frappe
-from frappe.utils import add_days, now_datetime, nowdate
-
-from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
-from erpnext.healthcare.doctype.patient_appointment.patient_appointment import (
- check_is_new_patient,
- check_payment_fields_reqd,
- make_encounter,
- update_status,
-)
-
-
-class TestPatientAppointment(unittest.TestCase):
- def setUp(self):
- frappe.db.sql("""delete from `tabPatient Appointment`""")
- frappe.db.sql("""delete from `tabFee Validity`""")
- frappe.db.sql("""delete from `tabPatient Encounter`""")
- make_pos_profile()
- frappe.db.sql("""delete from `tabHealthcare Service Unit` where name like '_Test %'""")
- frappe.db.sql("""delete from `tabHealthcare Service Unit` where name like '_Test Service Unit Type%'""")
-
- def test_status(self):
- patient, practitioner = create_healthcare_docs()
- frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 0)
- appointment = create_appointment(patient, practitioner, nowdate())
- self.assertEqual(appointment.status, 'Open')
- appointment = create_appointment(patient, practitioner, add_days(nowdate(), 2))
- self.assertEqual(appointment.status, 'Scheduled')
- encounter = create_encounter(appointment)
- self.assertEqual(frappe.db.get_value('Patient Appointment', appointment.name, 'status'), 'Closed')
- encounter.cancel()
- self.assertEqual(frappe.db.get_value('Patient Appointment', appointment.name, 'status'), 'Open')
-
- def test_start_encounter(self):
- patient, practitioner = create_healthcare_docs()
- frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1)
- appointment = create_appointment(patient, practitioner, add_days(nowdate(), 4), invoice = 1)
- appointment.reload()
- self.assertEqual(appointment.invoiced, 1)
- encounter = make_encounter(appointment.name)
- self.assertTrue(encounter)
- self.assertEqual(encounter.company, appointment.company)
- self.assertEqual(encounter.practitioner, appointment.practitioner)
- self.assertEqual(encounter.patient, appointment.patient)
- # invoiced flag mapped from appointment
- self.assertEqual(encounter.invoiced, frappe.db.get_value('Patient Appointment', appointment.name, 'invoiced'))
-
- def test_auto_invoicing(self):
- patient, practitioner = create_healthcare_docs()
- frappe.db.set_value('Healthcare Settings', None, 'enable_free_follow_ups', 0)
- frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 0)
- appointment = create_appointment(patient, practitioner, nowdate())
- self.assertEqual(frappe.db.get_value('Patient Appointment', appointment.name, 'invoiced'), 0)
-
- frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1)
- appointment = create_appointment(patient, practitioner, add_days(nowdate(), 2), invoice=1)
- self.assertEqual(frappe.db.get_value('Patient Appointment', appointment.name, 'invoiced'), 1)
- sales_invoice_name = frappe.db.get_value('Sales Invoice Item', {'reference_dn': appointment.name}, 'parent')
- self.assertTrue(sales_invoice_name)
- self.assertEqual(frappe.db.get_value('Sales Invoice', sales_invoice_name, 'company'), appointment.company)
- self.assertEqual(frappe.db.get_value('Sales Invoice', sales_invoice_name, 'patient'), appointment.patient)
- self.assertEqual(frappe.db.get_value('Sales Invoice', sales_invoice_name, 'paid_amount'), appointment.paid_amount)
-
- def test_auto_invoicing_based_on_department(self):
- patient, practitioner = create_healthcare_docs()
- medical_department = create_medical_department()
- frappe.db.set_value('Healthcare Settings', None, 'enable_free_follow_ups', 0)
- frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1)
- appointment_type = create_appointment_type({'medical_department': medical_department})
-
- appointment = create_appointment(patient, practitioner, add_days(nowdate(), 2),
- invoice=1, appointment_type=appointment_type.name, department=medical_department)
- appointment.reload()
-
- self.assertEqual(appointment.invoiced, 1)
- self.assertEqual(appointment.billing_item, 'HLC-SI-001')
- self.assertEqual(appointment.paid_amount, 200)
-
- sales_invoice_name = frappe.db.get_value('Sales Invoice Item', {'reference_dn': appointment.name}, 'parent')
- self.assertTrue(sales_invoice_name)
- self.assertEqual(frappe.db.get_value('Sales Invoice', sales_invoice_name, 'paid_amount'), appointment.paid_amount)
-
- def test_auto_invoicing_according_to_appointment_type_charge(self):
- patient, practitioner = create_healthcare_docs()
- frappe.db.set_value('Healthcare Settings', None, 'enable_free_follow_ups', 0)
- frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1)
-
- item = create_healthcare_service_items()
- items = [{
- 'op_consulting_charge_item': item,
- 'op_consulting_charge': 300
- }]
- appointment_type = create_appointment_type(args={
- 'name': 'Generic Appointment Type charge',
- 'items': items
- })
-
- appointment = create_appointment(patient, practitioner, add_days(nowdate(), 2),
- invoice=1, appointment_type=appointment_type.name)
- appointment.reload()
-
- self.assertEqual(appointment.invoiced, 1)
- self.assertEqual(appointment.billing_item, item)
- self.assertEqual(appointment.paid_amount, 300)
-
- sales_invoice_name = frappe.db.get_value('Sales Invoice Item', {'reference_dn': appointment.name}, 'parent')
- self.assertTrue(sales_invoice_name)
-
- def test_appointment_cancel(self):
- patient, practitioner = create_healthcare_docs()
- frappe.db.set_value('Healthcare Settings', None, 'enable_free_follow_ups', 1)
- appointment = create_appointment(patient, practitioner, nowdate())
- fee_validity = frappe.db.get_value('Fee Validity', {'patient': patient, 'practitioner': practitioner})
- # fee validity created
- self.assertTrue(fee_validity)
-
- # first follow up appointment
- appointment = create_appointment(patient, practitioner, add_days(nowdate(), 1))
- self.assertEqual(frappe.db.get_value('Fee Validity', fee_validity, 'visited'), 1)
-
- update_status(appointment.name, 'Cancelled')
- # check fee validity updated
- self.assertEqual(frappe.db.get_value('Fee Validity', fee_validity, 'visited'), 0)
-
- frappe.db.set_value('Healthcare Settings', None, 'enable_free_follow_ups', 0)
- frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1)
- appointment = create_appointment(patient, practitioner, add_days(nowdate(), 1), invoice=1)
- update_status(appointment.name, 'Cancelled')
- # check invoice cancelled
- sales_invoice_name = frappe.db.get_value('Sales Invoice Item', {'reference_dn': appointment.name}, 'parent')
- self.assertEqual(frappe.db.get_value('Sales Invoice', sales_invoice_name, 'status'), 'Cancelled')
-
- def test_appointment_booking_for_admission_service_unit(self):
- from erpnext.healthcare.doctype.inpatient_record.inpatient_record import (
- admit_patient,
- discharge_patient,
- schedule_discharge,
- )
- from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import (
- create_inpatient,
- get_healthcare_service_unit,
- mark_invoiced_inpatient_occupancy,
- )
-
- frappe.db.sql("""delete from `tabInpatient Record`""")
- patient, practitioner = create_healthcare_docs()
- patient = create_patient()
- # Schedule Admission
- ip_record = create_inpatient(patient)
- ip_record.expected_length_of_stay = 0
- ip_record.save(ignore_permissions = True)
-
- # Admit
- service_unit = get_healthcare_service_unit('_Test Service Unit Ip Occupancy')
- admit_patient(ip_record, service_unit, now_datetime())
-
- appointment = create_appointment(patient, practitioner, nowdate(), service_unit=service_unit)
- self.assertEqual(appointment.service_unit, service_unit)
-
- # Discharge
- schedule_discharge(frappe.as_json({'patient': patient}))
- ip_record1 = frappe.get_doc("Inpatient Record", ip_record.name)
- mark_invoiced_inpatient_occupancy(ip_record1)
- discharge_patient(ip_record1)
-
- def test_invalid_healthcare_service_unit_validation(self):
- from erpnext.healthcare.doctype.inpatient_record.inpatient_record import (
- admit_patient,
- discharge_patient,
- schedule_discharge,
- )
- from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import (
- create_inpatient,
- get_healthcare_service_unit,
- mark_invoiced_inpatient_occupancy,
- )
-
- frappe.db.sql("""delete from `tabInpatient Record`""")
- patient, practitioner = create_healthcare_docs()
- patient = create_patient()
- # Schedule Admission
- ip_record = create_inpatient(patient)
- ip_record.expected_length_of_stay = 0
- ip_record.save(ignore_permissions = True)
-
- # Admit
- service_unit = get_healthcare_service_unit('_Test Service Unit Ip Occupancy')
- admit_patient(ip_record, service_unit, now_datetime())
-
- appointment_service_unit = get_healthcare_service_unit('_Test Service Unit Ip Occupancy for Appointment')
- appointment = create_appointment(patient, practitioner, nowdate(), service_unit=appointment_service_unit, save=0)
- self.assertRaises(frappe.exceptions.ValidationError, appointment.save)
-
- # Discharge
- schedule_discharge(frappe.as_json({'patient': patient}))
- ip_record1 = frappe.get_doc("Inpatient Record", ip_record.name)
- mark_invoiced_inpatient_occupancy(ip_record1)
- discharge_patient(ip_record1)
-
- def test_payment_should_be_mandatory_for_new_patient_appointment(self):
- frappe.db.set_value('Healthcare Settings', None, 'enable_free_follow_ups', 1)
- frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1)
- frappe.db.set_value('Healthcare Settings', None, 'max_visits', 3)
- frappe.db.set_value('Healthcare Settings', None, 'valid_days', 30)
-
- patient = create_patient()
- assert check_is_new_patient(patient)
- payment_required = check_payment_fields_reqd(patient)
- assert payment_required is True
-
- def test_sales_invoice_should_be_generated_for_new_patient_appointment(self):
- patient, practitioner = create_healthcare_docs()
- frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1)
- invoice_count = frappe.db.count('Sales Invoice')
-
- assert check_is_new_patient(patient)
- create_appointment(patient, practitioner, nowdate())
- new_invoice_count = frappe.db.count('Sales Invoice')
-
- assert new_invoice_count == invoice_count + 1
-
- def test_patient_appointment_should_consider_permissions_while_fetching_appointments(self):
- patient, practitioner = create_healthcare_docs()
- create_appointment(patient, practitioner, nowdate())
-
- patient, new_practitioner = create_healthcare_docs(id=5)
- create_appointment(patient, new_practitioner, nowdate())
-
- roles = [{"doctype": "Has Role", "role": "Physician"}]
- user = create_user(roles=roles)
- new_practitioner = frappe.get_doc('Healthcare Practitioner', new_practitioner)
- new_practitioner.user_id = user.email
- new_practitioner.save()
-
- frappe.set_user(user.name)
- appointments = frappe.get_list('Patient Appointment')
- assert len(appointments) == 1
-
- frappe.set_user("Administrator")
- appointments = frappe.get_list('Patient Appointment')
- assert len(appointments) == 2
-
- def test_overlap_appointment(self):
- from erpnext.healthcare.doctype.patient_appointment.patient_appointment import OverlapError
- patient, practitioner = create_healthcare_docs(id=1)
- patient_1, practitioner_1 = create_healthcare_docs(id=2)
- service_unit = create_service_unit(id=0)
- service_unit_1 = create_service_unit(id=1)
- appointment = create_appointment(patient, practitioner, nowdate(), service_unit=service_unit) # valid
-
- # patient and practitioner cannot have overlapping appointments
- appointment = create_appointment(patient, practitioner, nowdate(), service_unit=service_unit, save=0)
- self.assertRaises(OverlapError, appointment.save)
- appointment = create_appointment(patient, practitioner, nowdate(), service_unit=service_unit_1, save=0) # diff service unit
- self.assertRaises(OverlapError, appointment.save)
- appointment = create_appointment(patient, practitioner, nowdate(), save=0) # with no service unit link
- self.assertRaises(OverlapError, appointment.save)
-
- # patient cannot have overlapping appointments with other practitioners
- appointment = create_appointment(patient, practitioner_1, nowdate(), service_unit=service_unit, save=0)
- self.assertRaises(OverlapError, appointment.save)
- appointment = create_appointment(patient, practitioner_1, nowdate(), service_unit=service_unit_1, save=0)
- self.assertRaises(OverlapError, appointment.save)
- appointment = create_appointment(patient, practitioner_1, nowdate(), save=0)
- self.assertRaises(OverlapError, appointment.save)
-
- # practitioner cannot have overlapping appointments with other patients
- appointment = create_appointment(patient_1, practitioner, nowdate(), service_unit=service_unit, save=0)
- self.assertRaises(OverlapError, appointment.save)
- appointment = create_appointment(patient_1, practitioner, nowdate(), service_unit=service_unit_1, save=0)
- self.assertRaises(OverlapError, appointment.save)
- appointment = create_appointment(patient_1, practitioner, nowdate(), save=0)
- self.assertRaises(OverlapError, appointment.save)
-
- def test_service_unit_capacity(self):
- from erpnext.healthcare.doctype.patient_appointment.patient_appointment import (
- MaximumCapacityError,
- OverlapError,
- )
- practitioner = create_practitioner()
- capacity = 3
- overlap_service_unit_type = create_service_unit_type(id=10, allow_appointments=1, overlap_appointments=1)
- overlap_service_unit = create_service_unit(id=100, service_unit_type=overlap_service_unit_type, service_unit_capacity=capacity)
-
- for i in range(0, capacity):
- patient = create_patient(id=i)
- create_appointment(patient, practitioner, nowdate(), service_unit=overlap_service_unit) # valid
- appointment = create_appointment(patient, practitioner, nowdate(), service_unit=overlap_service_unit, save=0) # overlap
- self.assertRaises(OverlapError, appointment.save)
-
- patient = create_patient(id=capacity)
- appointment = create_appointment(patient, practitioner, nowdate(), service_unit=overlap_service_unit, save=0)
- self.assertRaises(MaximumCapacityError, appointment.save)
-
-
-def create_healthcare_docs(id=0):
- patient = create_patient(id)
- practitioner = create_practitioner(id)
-
- return patient, practitioner
-
-
-def create_patient(id=0):
- if frappe.db.exists('Patient', {'firstname':f'_Test Patient {str(id)}'}):
- patient = frappe.db.get_value('Patient', {'first_name': f'_Test Patient {str(id)}'}, ['name'])
- return patient
-
- patient = frappe.new_doc('Patient')
- patient.first_name = f'_Test Patient {str(id)}'
- patient.sex = 'Female'
- patient.save(ignore_permissions=True)
-
- return patient.name
-
-
-def create_medical_department(id=0):
- if frappe.db.exists('Medical Department', f'_Test Medical Department {str(id)}'):
- return f'_Test Medical Department {str(id)}'
-
- medical_department = frappe.new_doc('Medical Department')
- medical_department.department = f'_Test Medical Department {str(id)}'
- medical_department.save(ignore_permissions=True)
-
- return medical_department.name
-
-
-def create_practitioner(id=0, medical_department=None):
- if frappe.db.exists('Healthcare Practitioner', {'firstname':f'_Test Healthcare Practitioner {str(id)}'}):
- practitioner = frappe.db.get_value('Healthcare Practitioner', {'firstname':f'_Test Healthcare Practitioner {str(id)}'}, ['name'])
- return practitioner
-
- practitioner = frappe.new_doc('Healthcare Practitioner')
- practitioner.first_name = f'_Test Healthcare Practitioner {str(id)}'
- practitioner.gender = 'Female'
- practitioner.department = medical_department or create_medical_department(id)
- practitioner.op_consulting_charge = 500
- practitioner.inpatient_visit_charge = 500
- practitioner.save(ignore_permissions=True)
-
- return practitioner.name
-
-
-def create_encounter(appointment):
- if appointment:
- encounter = frappe.new_doc('Patient Encounter')
- encounter.appointment = appointment.name
- encounter.patient = appointment.patient
- encounter.practitioner = appointment.practitioner
- encounter.encounter_date = appointment.appointment_date
- encounter.encounter_time = appointment.appointment_time
- encounter.company = appointment.company
- encounter.save()
- encounter.submit()
-
- return encounter
-
-
-def create_appointment(patient, practitioner, appointment_date, invoice=0, procedure_template=0,
- service_unit=None, appointment_type=None, save=1, department=None):
- item = create_healthcare_service_items()
- frappe.db.set_value('Healthcare Settings', None, 'inpatient_visit_charge_item', item)
- frappe.db.set_value('Healthcare Settings', None, 'op_consulting_charge_item', item)
- appointment = frappe.new_doc('Patient Appointment')
- appointment.patient = patient
- appointment.practitioner = practitioner
- appointment.department = department or '_Test Medical Department'
- appointment.appointment_date = appointment_date
- appointment.company = '_Test Company'
- appointment.duration = 15
-
- if service_unit:
- appointment.service_unit = service_unit
- if invoice:
- appointment.mode_of_payment = 'Cash'
- if appointment_type:
- appointment.appointment_type = appointment_type
- if procedure_template:
- appointment.procedure_template = create_clinical_procedure_template().get('name')
- if save:
- appointment.save(ignore_permissions=True)
-
- return appointment
-
-
-def create_healthcare_service_items():
- if frappe.db.exists('Item', 'HLC-SI-001'):
- return 'HLC-SI-001'
-
- item = frappe.new_doc('Item')
- item.item_code = 'HLC-SI-001'
- item.item_name = 'Consulting Charges'
- item.item_group = 'Services'
- item.is_stock_item = 0
- item.stock_uom = 'Nos'
- item.save()
-
- return item.name
-
-
-def create_clinical_procedure_template():
- if frappe.db.exists('Clinical Procedure Template', 'Knee Surgery and Rehab'):
- return frappe.get_doc('Clinical Procedure Template', 'Knee Surgery and Rehab')
-
- template = frappe.new_doc('Clinical Procedure Template')
- template.template = 'Knee Surgery and Rehab'
- template.item_code = 'Knee Surgery and Rehab'
- template.item_group = 'Services'
- template.is_billable = 1
- template.description = 'Knee Surgery and Rehab'
- template.rate = 50000
- template.save()
-
- return template
-
-
-def create_appointment_type(args=None):
- if not args:
- args = frappe.local.form_dict
-
- name = args.get('name') or 'Test Appointment Type wise Charge'
-
- if frappe.db.exists('Appointment Type', name):
- return frappe.get_doc('Appointment Type', name)
-
- else:
- item = create_healthcare_service_items()
- items = [{
- 'medical_department': args.get('medical_department') or '_Test Medical Department',
- 'op_consulting_charge_item': item,
- 'op_consulting_charge': 200
- }]
- return frappe.get_doc({
- 'doctype': 'Appointment Type',
- 'appointment_type': args.get('name') or 'Test Appointment Type wise Charge',
- 'default_duration': args.get('default_duration') or 20,
- 'color': args.get('color') or '#7575ff',
- 'price_list': args.get('price_list') or frappe.db.get_value("Price List", {"selling": 1}),
- 'items': args.get('items') or items
- }).insert()
-
-def create_user(email=None, roles=None):
- if not email:
- email = '{}@frappe.com'.format(frappe.utils.random_string(10))
- user = frappe.db.exists('User', email)
- if not user:
- user = frappe.get_doc({
- "doctype": "User",
- "email": email,
- "first_name": "test_user",
- "password": "password",
- "roles": roles,
- }).insert()
- return user
-
-
-def create_service_unit_type(id=0, allow_appointments=1, overlap_appointments=0):
- if frappe.db.exists('Healthcare Service Unit Type', f'_Test Service Unit Type {str(id)}'):
- return f'_Test Service Unit Type {str(id)}'
-
- service_unit_type = frappe.new_doc('Healthcare Service Unit Type')
- service_unit_type.service_unit_type = f'_Test Service Unit Type {str(id)}'
- service_unit_type.allow_appointments = allow_appointments
- service_unit_type.overlap_appointments = overlap_appointments
- service_unit_type.save(ignore_permissions=True)
-
- return service_unit_type.name
-
-
-def create_service_unit(id=0, service_unit_type=None, service_unit_capacity=0):
- if frappe.db.exists('Healthcare Service Unit', f'_Test Service Unit {str(id)}'):
- return f'_Test service_unit {str(id)}'
-
- service_unit = frappe.new_doc('Healthcare Service Unit')
- service_unit.is_group = 0
- service_unit.healthcare_service_unit_name= f'_Test Service Unit {str(id)}'
- service_unit.service_unit_type = service_unit_type or create_service_unit_type(id)
- service_unit.service_unit_capacity = service_unit_capacity
- service_unit.save(ignore_permissions=True)
-
- return service_unit.name
diff --git a/erpnext/healthcare/doctype/patient_assessment/__init__.py b/erpnext/healthcare/doctype/patient_assessment/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.js b/erpnext/healthcare/doctype/patient_assessment/patient_assessment.js
deleted file mode 100644
index f28d32c22c..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.js
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Patient Assessment', {
- refresh: function(frm) {
- if (frm.doc.assessment_template) {
- frm.trigger('set_score_range');
- }
-
- if (!frm.doc.__islocal) {
- frm.trigger('show_patient_progress');
- }
- },
-
- assessment_template: function(frm) {
- if (frm.doc.assessment_template) {
- frappe.call({
- 'method': 'frappe.client.get',
- args: {
- doctype: 'Patient Assessment Template',
- name: frm.doc.assessment_template
- },
- callback: function(data) {
- frm.doc.assessment_sheet = [];
- $.each(data.message.parameters, function(_i, e) {
- let entry = frm.add_child('assessment_sheet');
- entry.parameter = e.assessment_parameter;
- });
-
- frm.set_value('scale_min', data.message.scale_min);
- frm.set_value('scale_max', data.message.scale_max);
- frm.set_value('assessment_description', data.message.assessment_description);
- frm.set_value('total_score', data.message.scale_max * data.message.parameters.length);
- frm.trigger('set_score_range');
- refresh_field('assessment_sheet');
- }
- });
- }
- },
-
- set_score_range: function(frm) {
- let options = [''];
- for(let i = frm.doc.scale_min; i <= frm.doc.scale_max; i++) {
- options.push(i);
- }
- frm.fields_dict.assessment_sheet.grid.update_docfield_property(
- 'score', 'options', options
- );
- },
-
- calculate_total_score: function(frm, cdt, cdn) {
- let row = locals[cdt][cdn];
- let total_score = 0;
- $.each(frm.doc.assessment_sheet || [], function(_i, item) {
- if (item.score) {
- total_score += parseInt(item.score);
- }
- });
-
- frm.set_value('total_score_obtained', total_score);
- },
-
- show_patient_progress: function(frm) {
- let bars = [];
- let message = '';
- let added_min = false;
-
- let title = __('{0} out of {1}', [frm.doc.total_score_obtained, frm.doc.total_score]);
-
- bars.push({
- 'title': title,
- 'width': (frm.doc.total_score_obtained / frm.doc.total_score * 100) + '%',
- 'progress_class': 'progress-bar-success'
- });
- if (bars[0].width == '0%') {
- bars[0].width = '0.5%';
- added_min = 0.5;
- }
- message = title;
- frm.dashboard.add_progress(__('Status'), bars, message);
- },
-});
-
-frappe.ui.form.on('Patient Assessment Sheet', {
- score: function(frm, cdt, cdn) {
- frm.events.calculate_total_score(frm, cdt, cdn);
- }
-});
diff --git a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.json b/erpnext/healthcare/doctype/patient_assessment/patient_assessment.json
deleted file mode 100644
index eb0021ff75..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.json
+++ /dev/null
@@ -1,181 +0,0 @@
-{
- "actions": [],
- "autoname": "naming_series:",
- "creation": "2020-04-19 22:45:12.356209",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "naming_series",
- "therapy_session",
- "patient",
- "assessment_template",
- "column_break_4",
- "company",
- "healthcare_practitioner",
- "assessment_datetime",
- "assessment_description",
- "section_break_7",
- "assessment_sheet",
- "section_break_9",
- "total_score_obtained",
- "column_break_11",
- "total_score",
- "scale_min",
- "scale_max",
- "amended_from"
- ],
- "fields": [
- {
- "fetch_from": "therapy_session.patient",
- "fieldname": "patient",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Patient",
- "options": "Patient",
- "reqd": 1
- },
- {
- "fieldname": "assessment_template",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Assessment Template",
- "options": "Patient Assessment Template",
- "reqd": 1
- },
- {
- "fieldname": "therapy_session",
- "fieldtype": "Link",
- "label": "Therapy Session",
- "options": "Therapy Session"
- },
- {
- "fieldname": "column_break_4",
- "fieldtype": "Column Break"
- },
- {
- "fetch_from": "therapy_session.practitioner",
- "fieldname": "healthcare_practitioner",
- "fieldtype": "Link",
- "label": "Healthcare Practitioner",
- "options": "Healthcare Practitioner"
- },
- {
- "fieldname": "assessment_datetime",
- "fieldtype": "Datetime",
- "label": "Assessment Datetime",
- "reqd": 1
- },
- {
- "fieldname": "section_break_7",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "assessment_sheet",
- "fieldtype": "Table",
- "label": "Assessment Sheet",
- "options": "Patient Assessment Sheet"
- },
- {
- "fieldname": "section_break_9",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "total_score",
- "fieldtype": "Int",
- "label": "Total Score",
- "read_only": 1
- },
- {
- "fieldname": "column_break_11",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "total_score_obtained",
- "fieldtype": "Int",
- "label": "Total Score Obtained",
- "read_only": 1
- },
- {
- "fieldname": "scale_min",
- "fieldtype": "Int",
- "hidden": 1,
- "label": "Scale Min",
- "read_only": 1
- },
- {
- "fieldname": "scale_max",
- "fieldtype": "Int",
- "hidden": 1,
- "label": "Scale Max",
- "read_only": 1
- },
- {
- "fieldname": "naming_series",
- "fieldtype": "Select",
- "label": "Naming Series",
- "options": "HLC-PA-.YYYY.-"
- },
- {
- "fieldname": "amended_from",
- "fieldtype": "Link",
- "label": "Amended From",
- "no_copy": 1,
- "options": "Patient Assessment",
- "print_hide": 1,
- "read_only": 1
- },
- {
- "fieldname": "assessment_description",
- "fieldtype": "Small Text",
- "label": "Assessment Description"
- },
- {
- "fieldname": "company",
- "fieldtype": "Link",
- "in_standard_filter": 1,
- "label": "Company",
- "options": "Company"
- }
- ],
- "is_submittable": 1,
- "links": [],
- "modified": "2020-06-25 00:25:13.208400",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient Assessment",
- "owner": "Administrator",
- "permissions": [
- {
- "cancel": 1,
- "create": 1,
- "delete": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "System Manager",
- "share": 1,
- "submit": 1,
- "write": 1
- },
- {
- "cancel": 1,
- "create": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Physician",
- "share": 1,
- "submit": 1,
- "write": 1
- }
- ],
- "sort_field": "modified",
- "sort_order": "DESC",
- "title_field": "patient",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.py b/erpnext/healthcare/doctype/patient_assessment/patient_assessment.py
deleted file mode 100644
index 90cb30035d..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.py
+++ /dev/null
@@ -1,35 +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
-from frappe.model.mapper import get_mapped_doc
-
-
-class PatientAssessment(Document):
- def validate(self):
- self.set_total_score()
-
- def set_total_score(self):
- total_score = 0
- for entry in self.assessment_sheet:
- total_score += int(entry.score)
- self.total_score_obtained = total_score
-
-@frappe.whitelist()
-def create_patient_assessment(source_name, target_doc=None):
- doc = get_mapped_doc('Therapy Session', source_name, {
- 'Therapy Session': {
- 'doctype': 'Patient Assessment',
- 'field_map': [
- ['therapy_session', 'name'],
- ['patient', 'patient'],
- ['practitioner', 'practitioner']
- ]
- }
- }, target_doc)
-
- return doc
diff --git a/erpnext/healthcare/doctype/patient_assessment/test_patient_assessment.py b/erpnext/healthcare/doctype/patient_assessment/test_patient_assessment.py
deleted file mode 100644
index 0ffbd1f504..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment/test_patient_assessment.py
+++ /dev/null
@@ -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 TestPatientAssessment(unittest.TestCase):
- pass
diff --git a/erpnext/healthcare/doctype/patient_assessment_detail/__init__.py b/erpnext/healthcare/doctype/patient_assessment_detail/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/patient_assessment_detail/patient_assessment_detail.json b/erpnext/healthcare/doctype/patient_assessment_detail/patient_assessment_detail.json
deleted file mode 100644
index 179f441044..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment_detail/patient_assessment_detail.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "actions": [],
- "creation": "2020-04-19 19:33:00.115395",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "assessment_parameter"
- ],
- "fields": [
- {
- "fieldname": "assessment_parameter",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Assessment Parameter",
- "options": "Patient Assessment Parameter",
- "reqd": 1
- }
- ],
- "istable": 1,
- "links": [],
- "modified": "2020-04-19 19:33:00.115395",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient Assessment Detail",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_assessment_detail/patient_assessment_detail.py b/erpnext/healthcare/doctype/patient_assessment_detail/patient_assessment_detail.py
deleted file mode 100644
index 4da679b889..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment_detail/patient_assessment_detail.py
+++ /dev/null
@@ -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 PatientAssessmentDetail(Document):
- pass
diff --git a/erpnext/healthcare/doctype/patient_assessment_parameter/__init__.py b/erpnext/healthcare/doctype/patient_assessment_parameter/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/patient_assessment_parameter/patient_assessment_parameter.js b/erpnext/healthcare/doctype/patient_assessment_parameter/patient_assessment_parameter.js
deleted file mode 100644
index 2c5d270d57..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment_parameter/patient_assessment_parameter.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Patient Assessment Parameter', {
- // refresh: function(frm) {
-
- // }
-});
diff --git a/erpnext/healthcare/doctype/patient_assessment_parameter/patient_assessment_parameter.json b/erpnext/healthcare/doctype/patient_assessment_parameter/patient_assessment_parameter.json
deleted file mode 100644
index 098bdefea7..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment_parameter/patient_assessment_parameter.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "actions": [],
- "autoname": "field:assessment_parameter",
- "creation": "2020-04-15 14:34:46.551042",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "assessment_parameter"
- ],
- "fields": [
- {
- "fieldname": "assessment_parameter",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Assessment Parameter",
- "reqd": 1,
- "unique": 1
- }
- ],
- "links": [],
- "modified": "2020-04-20 09:22:19.135196",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient Assessment Parameter",
- "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
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_assessment_parameter/patient_assessment_parameter.py b/erpnext/healthcare/doctype/patient_assessment_parameter/patient_assessment_parameter.py
deleted file mode 100644
index 783c537848..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment_parameter/patient_assessment_parameter.py
+++ /dev/null
@@ -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 PatientAssessmentParameter(Document):
- pass
diff --git a/erpnext/healthcare/doctype/patient_assessment_parameter/test_patient_assessment_parameter.py b/erpnext/healthcare/doctype/patient_assessment_parameter/test_patient_assessment_parameter.py
deleted file mode 100644
index f06fffb1ef..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment_parameter/test_patient_assessment_parameter.py
+++ /dev/null
@@ -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 TestPatientAssessmentParameter(unittest.TestCase):
- pass
diff --git a/erpnext/healthcare/doctype/patient_assessment_sheet/__init__.py b/erpnext/healthcare/doctype/patient_assessment_sheet/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/patient_assessment_sheet/patient_assessment_sheet.json b/erpnext/healthcare/doctype/patient_assessment_sheet/patient_assessment_sheet.json
deleted file mode 100644
index 64e4aef7cf..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment_sheet/patient_assessment_sheet.json
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "actions": [],
- "creation": "2020-04-19 23:07:02.220244",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "parameter",
- "score",
- "time",
- "column_break_4",
- "comments"
- ],
- "fields": [
- {
- "fieldname": "parameter",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Parameter",
- "options": "Patient Assessment Parameter",
- "reqd": 1
- },
- {
- "fieldname": "score",
- "fieldtype": "Select",
- "in_list_view": 1,
- "label": "Score",
- "reqd": 1
- },
- {
- "fieldname": "time",
- "fieldtype": "Time",
- "label": "Time"
- },
- {
- "fieldname": "column_break_4",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "comments",
- "fieldtype": "Small Text",
- "label": "Comments"
- }
- ],
- "istable": 1,
- "links": [],
- "modified": "2020-04-20 09:56:28.746619",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient Assessment Sheet",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_assessment_sheet/patient_assessment_sheet.py b/erpnext/healthcare/doctype/patient_assessment_sheet/patient_assessment_sheet.py
deleted file mode 100644
index 4686e9e261..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment_sheet/patient_assessment_sheet.py
+++ /dev/null
@@ -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 PatientAssessmentSheet(Document):
- pass
diff --git a/erpnext/healthcare/doctype/patient_assessment_template/__init__.py b/erpnext/healthcare/doctype/patient_assessment_template/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/patient_assessment_template/patient_assessment_template.js b/erpnext/healthcare/doctype/patient_assessment_template/patient_assessment_template.js
deleted file mode 100644
index 40419362a4..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment_template/patient_assessment_template.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Patient Assessment Template', {
- // refresh: function(frm) {
-
- // }
-});
diff --git a/erpnext/healthcare/doctype/patient_assessment_template/patient_assessment_template.json b/erpnext/healthcare/doctype/patient_assessment_template/patient_assessment_template.json
deleted file mode 100644
index de006b1805..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment_template/patient_assessment_template.json
+++ /dev/null
@@ -1,109 +0,0 @@
-{
- "actions": [],
- "autoname": "field:assessment_name",
- "creation": "2020-04-19 19:33:13.204707",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "assessment_name",
- "section_break_2",
- "parameters",
- "assessment_scale_details_section",
- "scale_min",
- "scale_max",
- "column_break_8",
- "assessment_description"
- ],
- "fields": [
- {
- "fieldname": "parameters",
- "fieldtype": "Table",
- "label": "Parameters",
- "options": "Patient Assessment Detail"
- },
- {
- "fieldname": "assessment_name",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Assessment Name",
- "reqd": 1,
- "unique": 1
- },
- {
- "fieldname": "section_break_2",
- "fieldtype": "Section Break",
- "label": "Assessment Parameters"
- },
- {
- "fieldname": "assessment_scale_details_section",
- "fieldtype": "Section Break",
- "label": "Assessment Scale"
- },
- {
- "fieldname": "scale_min",
- "fieldtype": "Int",
- "label": "Scale Minimum"
- },
- {
- "fieldname": "scale_max",
- "fieldtype": "Int",
- "label": "Scale Maximum"
- },
- {
- "fieldname": "column_break_8",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "assessment_description",
- "fieldtype": "Small Text",
- "label": "Assessment Description"
- }
- ],
- "links": [],
- "modified": "2020-04-21 13:14:19.075167",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient Assessment 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
- },
- {
- "create": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Physician",
- "share": 1,
- "write": 1
- }
- ],
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_assessment_template/patient_assessment_template.py b/erpnext/healthcare/doctype/patient_assessment_template/patient_assessment_template.py
deleted file mode 100644
index e0d8fca37f..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment_template/patient_assessment_template.py
+++ /dev/null
@@ -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 PatientAssessmentTemplate(Document):
- pass
diff --git a/erpnext/healthcare/doctype/patient_assessment_template/test_patient_assessment_template.py b/erpnext/healthcare/doctype/patient_assessment_template/test_patient_assessment_template.py
deleted file mode 100644
index 7d639cb6af..0000000000
--- a/erpnext/healthcare/doctype/patient_assessment_template/test_patient_assessment_template.py
+++ /dev/null
@@ -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 TestPatientAssessmentTemplate(unittest.TestCase):
- pass
diff --git a/erpnext/healthcare/doctype/patient_encounter/__init__.py b/erpnext/healthcare/doctype/patient_encounter/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.js b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.js
deleted file mode 100644
index c3466260d2..0000000000
--- a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.js
+++ /dev/null
@@ -1,397 +0,0 @@
-// Copyright (c) 2016, ESS LLP and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Patient Encounter', {
- setup: function(frm) {
- frm.get_field('therapies').grid.editable_fields = [
- {fieldname: 'therapy_type', columns: 8},
- {fieldname: 'no_of_sessions', columns: 2}
- ];
- frm.get_field('drug_prescription').grid.editable_fields = [
- {fieldname: 'drug_code', columns: 2},
- {fieldname: 'drug_name', columns: 2},
- {fieldname: 'dosage', columns: 2},
- {fieldname: 'period', columns: 2}
- ];
- frm.get_field('lab_test_prescription').grid.editable_fields = [
- {fieldname: 'lab_test_code', columns: 2},
- {fieldname: 'lab_test_name', columns: 4},
- {fieldname: 'lab_test_comment', columns: 4}
- ];
- },
-
- refresh: function(frm) {
- refresh_field('drug_prescription');
- refresh_field('lab_test_prescription');
-
- if (!frm.doc.__islocal) {
- if (frm.doc.docstatus === 1) {
- if (frm.doc.inpatient_status == 'Admission Scheduled' || frm.doc.inpatient_status == 'Admitted') {
- frm.add_custom_button(__('Schedule Discharge'), function() {
- schedule_discharge(frm);
- });
- } else if (frm.doc.inpatient_status != 'Discharge Scheduled') {
- frm.add_custom_button(__('Schedule Admission'), function() {
- schedule_inpatient(frm);
- });
- }
- }
-
- frm.add_custom_button(__('Patient History'), function() {
- if (frm.doc.patient) {
- frappe.route_options = {'patient': frm.doc.patient};
- frappe.set_route('patient_history');
- } else {
- frappe.msgprint(__('Please select Patient'));
- }
- },'View');
-
- frm.add_custom_button(__('Vital Signs'), function() {
- create_vital_signs(frm);
- },'Create');
-
- frm.add_custom_button(__('Medical Record'), function() {
- create_medical_record(frm);
- },'Create');
-
- frm.add_custom_button(__('Clinical Procedure'), function() {
- create_procedure(frm);
- },'Create');
-
- if (frm.doc.drug_prescription && frm.doc.inpatient_record && frm.doc.inpatient_status === "Admitted") {
- frm.add_custom_button(__('Inpatient Medication Order'), function() {
- frappe.model.open_mapped_doc({
- method: 'erpnext.healthcare.doctype.patient_encounter.patient_encounter.make_ip_medication_order',
- frm: frm
- });
- }, 'Create');
- }
- }
-
- frm.set_query('patient', function() {
- return {
- filters: {'status': 'Active'}
- };
- });
-
- frm.set_query('drug_code', 'drug_prescription', function() {
- return {
- filters: {
- is_stock_item: 1
- }
- };
- });
-
- frm.set_query('lab_test_code', 'lab_test_prescription', function() {
- return {
- filters: {
- is_billable: 1
- }
- };
- });
-
- frm.set_query('appointment', function() {
- return {
- filters: {
- // Scheduled filter for demo ...
- status:['in',['Open','Scheduled']]
- }
- };
- });
-
- frm.set_df_property('patient', 'read_only', frm.doc.appointment ? 1 : 0);
- },
-
- appointment: function(frm) {
- frm.events.set_appointment_fields(frm);
- },
-
- patient: function(frm) {
- frm.events.set_patient_info(frm);
- },
-
- practitioner: function(frm) {
- if (!frm.doc.practitioner) {
- frm.set_value('practitioner_name', '');
- }
- },
- set_appointment_fields: 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,
- 'type': data.message.appointment_type,
- 'practitioner': data.message.practitioner,
- 'invoiced': data.message.invoiced,
- 'company': data.message.company
- };
- frm.set_value(values);
- frm.set_df_property('patient', 'read_only', 1);
- }
- });
- }
- else {
- let values = {
- 'patient': '',
- 'patient_name': '',
- 'type': '',
- 'practitioner': '',
- 'invoiced': 0,
- 'patient_sex': '',
- 'patient_age': '',
- 'inpatient_record': '',
- 'inpatient_status': ''
- };
- frm.set_value(values);
- frm.set_df_property('patient', 'read_only', 0);
- }
- },
-
- set_patient_info: 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);
- }
- let values = {
- 'patient_age': age,
- 'patient_name':data.message.patient_name,
- 'patient_sex': data.message.sex,
- 'inpatient_record': data.message.inpatient_record,
- 'inpatient_status': data.message.inpatient_status
- };
- frm.set_value(values);
- }
- });
- } else {
- let values = {
- 'patient_age': '',
- 'patient_name':'',
- 'patient_sex': '',
- 'inpatient_record': '',
- 'inpatient_status': ''
- };
- frm.set_value(values);
- }
- },
-
- get_applicable_treatment_plans: function(frm) {
- frappe.call({
- method: 'get_applicable_treatment_plans',
- doc: frm.doc,
- args: {'encounter': frm.doc},
- freeze: true,
- freeze_message: __('Fetching Treatment Plans'),
- callback: function() {
- new frappe.ui.form.MultiSelectDialog({
- doctype: "Treatment Plan Template",
- target: this.cur_frm,
- setters: {
- medical_department: "",
- },
- action(selections) {
- frappe.call({
- method: 'set_treatment_plans',
- doc: frm.doc,
- args: selections,
- }).then(() => {
- frm.refresh_field('drug_prescription');
- frm.refresh_field('procedure_prescription');
- frm.refresh_field('lab_test_prescription');
- frm.refresh_field('therapies');
- });
- cur_dialog.hide();
- }
- });
-
-
- }
- });
- },
-
-});
-
-var schedule_inpatient = function(frm) {
- var dialog = new frappe.ui.Dialog({
- title: 'Patient Admission',
- fields: [
- {fieldtype: 'Link', label: 'Medical Department', fieldname: 'medical_department', options: 'Medical Department', reqd: 1},
- {fieldtype: 'Link', label: 'Healthcare Practitioner (Primary)', fieldname: 'primary_practitioner', options: 'Healthcare Practitioner', reqd: 1},
- {fieldtype: 'Link', label: 'Healthcare Practitioner (Secondary)', fieldname: 'secondary_practitioner', options: 'Healthcare Practitioner'},
- {fieldtype: 'Column Break'},
- {fieldtype: 'Date', label: 'Admission Ordered For', fieldname: 'admission_ordered_for', default: 'Today'},
- {fieldtype: 'Link', label: 'Service Unit Type', fieldname: 'service_unit_type', options: 'Healthcare Service Unit Type'},
- {fieldtype: 'Int', label: 'Expected Length of Stay', fieldname: 'expected_length_of_stay'},
- {fieldtype: 'Section Break'},
- {fieldtype: 'Long Text', label: 'Admission Instructions', fieldname: 'admission_instruction'}
- ],
- primary_action_label: __('Order Admission'),
- primary_action : function() {
- var args = {
- patient: frm.doc.patient,
- admission_encounter: frm.doc.name,
- referring_practitioner: frm.doc.practitioner,
- company: frm.doc.company,
- medical_department: dialog.get_value('medical_department'),
- primary_practitioner: dialog.get_value('primary_practitioner'),
- secondary_practitioner: dialog.get_value('secondary_practitioner'),
- admission_ordered_for: dialog.get_value('admission_ordered_for'),
- admission_service_unit_type: dialog.get_value('service_unit_type'),
- expected_length_of_stay: dialog.get_value('expected_length_of_stay'),
- admission_instruction: dialog.get_value('admission_instruction')
- }
- frappe.call({
- method: 'erpnext.healthcare.doctype.inpatient_record.inpatient_record.schedule_inpatient',
- args: {
- args: args
- },
- callback: function(data) {
- if (!data.exc) {
- frm.reload_doc();
- }
- },
- freeze: true,
- freeze_message: __('Scheduling Patient Admission')
- });
- frm.refresh_fields();
- dialog.hide();
- }
- });
-
- dialog.set_values({
- 'medical_department': frm.doc.medical_department,
- 'primary_practitioner': frm.doc.practitioner,
- });
-
- dialog.fields_dict['service_unit_type'].get_query = function() {
- return {
- filters: {
- 'inpatient_occupancy': 1,
- 'allow_appointments': 0
- }
- };
- };
-
- dialog.show();
- dialog.$wrapper.find('.modal-dialog').css('width', '800px');
-};
-
-var schedule_discharge = function(frm) {
- var dialog = new frappe.ui.Dialog ({
- title: 'Inpatient Discharge',
- fields: [
- {fieldtype: 'Date', label: 'Discharge Ordered Date', fieldname: 'discharge_ordered_date', default: 'Today', read_only: 1},
- {fieldtype: 'Date', label: 'Followup Date', fieldname: 'followup_date'},
- {fieldtype: 'Column Break'},
- {fieldtype: 'Small Text', label: 'Discharge Instructions', fieldname: 'discharge_instructions'},
- {fieldtype: 'Section Break', label:'Discharge Summary'},
- {fieldtype: 'Long Text', label: 'Discharge Note', fieldname: 'discharge_note'}
- ],
- primary_action_label: __('Order Discharge'),
- primary_action : function() {
- var args = {
- patient: frm.doc.patient,
- discharge_encounter: frm.doc.name,
- discharge_practitioner: frm.doc.practitioner,
- discharge_ordered_date: dialog.get_value('discharge_ordered_date'),
- followup_date: dialog.get_value('followup_date'),
- discharge_instructions: dialog.get_value('discharge_instructions'),
- discharge_note: dialog.get_value('discharge_note')
- }
- frappe.call ({
- method: 'erpnext.healthcare.doctype.inpatient_record.inpatient_record.schedule_discharge',
- args: {args},
- callback: function(data) {
- if(!data.exc){
- frm.reload_doc();
- }
- },
- freeze: true,
- freeze_message: 'Scheduling Inpatient Discharge'
- });
- frm.refresh_fields();
- dialog.hide();
- }
- });
-
- dialog.show();
- dialog.$wrapper.find('.modal-dialog').css('width', '800px');
-};
-
-let create_medical_record = function(frm) {
- if (!frm.doc.patient) {
- frappe.throw(__('Please select patient'));
- }
- frappe.route_options = {
- 'patient': frm.doc.patient,
- 'status': 'Open',
- 'reference_doctype': 'Patient Medical Record',
- 'reference_owner': frm.doc.owner
- };
- frappe.new_doc('Patient Medical Record');
-};
-
-let create_vital_signs = function(frm) {
- if (!frm.doc.patient) {
- frappe.throw(__('Please select patient'));
- }
- frappe.route_options = {
- 'patient': frm.doc.patient,
- 'encounter': frm.doc.name,
- 'company': frm.doc.company
- };
- frappe.new_doc('Vital Signs');
-};
-
-let create_procedure = function(frm) {
- if (!frm.doc.patient) {
- frappe.throw(__('Please select patient'));
- }
- frappe.route_options = {
- 'patient': frm.doc.patient,
- 'medical_department': frm.doc.medical_department,
- 'company': frm.doc.company
- };
- frappe.new_doc('Clinical Procedure');
-};
-
-frappe.ui.form.on('Drug Prescription', {
- dosage: function(frm, cdt, cdn){
- frappe.model.set_value(cdt, cdn, 'update_schedule', 1);
- let child = locals[cdt][cdn];
- if (child.dosage) {
- frappe.model.set_value(cdt, cdn, 'interval_uom', 'Day');
- frappe.model.set_value(cdt, cdn, 'interval', 1);
- }
- },
- period: function(frm, cdt, cdn) {
- frappe.model.set_value(cdt, cdn, 'update_schedule', 1);
- },
- interval_uom: function(frm, cdt, cdn) {
- frappe.model.set_value(cdt, cdn, 'update_schedule', 1);
- let child = locals[cdt][cdn];
- if (child.interval_uom == 'Hour') {
- frappe.model.set_value(cdt, cdn, 'dosage', null);
- }
- }
-});
-
-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)')}`;
-};
diff --git a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.json b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.json
deleted file mode 100644
index 994597dca7..0000000000
--- a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.json
+++ /dev/null
@@ -1,368 +0,0 @@
-{
- "actions": [],
- "allow_copy": 1,
- "allow_import": 1,
- "autoname": "naming_series:",
- "beta": 1,
- "creation": "2016-04-21 10:53:44.637684",
- "doctype": "DocType",
- "document_type": "Document",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "naming_series",
- "title",
- "appointment",
- "appointment_type",
- "patient",
- "patient_name",
- "patient_sex",
- "patient_age",
- "inpatient_record",
- "inpatient_status",
- "column_break_6",
- "company",
- "encounter_date",
- "encounter_time",
- "practitioner",
- "practitioner_name",
- "medical_department",
- "invoiced",
- "sb_symptoms",
- "symptoms",
- "symptoms_in_print",
- "get_applicable_treatment_plans",
- "physical_examination",
- "diagnosis",
- "diagnosis_in_print",
- "codification",
- "codification_table",
- "sb_drug_prescription",
- "drug_prescription",
- "sb_test_prescription",
- "lab_test_prescription",
- "sb_procedures",
- "procedure_prescription",
- "rehabilitation_section",
- "therapy_plan",
- "therapies",
- "section_break_33",
- "encounter_comment",
- "sb_refs",
- "amended_from"
- ],
- "fields": [
- {
- "allow_on_submit": 1,
- "fieldname": "inpatient_record",
- "fieldtype": "Link",
- "label": "Inpatient Record",
- "options": "Inpatient Record",
- "read_only": 1
- },
- {
- "fieldname": "naming_series",
- "fieldtype": "Select",
- "label": "Series",
- "no_copy": 1,
- "options": "HLC-ENC-.YYYY.-",
- "set_only_once": 1
- },
- {
- "fieldname": "appointment",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Appointment",
- "options": "Patient Appointment",
- "search_index": 1,
- "set_only_once": 1
- },
- {
- "fieldname": "patient",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "in_standard_filter": 1,
- "label": "Patient",
- "options": "Patient",
- "reqd": 1,
- "search_index": 1
- },
- {
- "fieldname": "patient_name",
- "fieldtype": "Data",
- "label": "Patient Name",
- "read_only": 1
- },
- {
- "fieldname": "patient_age",
- "fieldtype": "Data",
- "label": "Age",
- "read_only": 1
- },
- {
- "fieldname": "patient_sex",
- "fieldtype": "Link",
- "label": "Gender",
- "options": "Gender",
- "read_only": 1
- },
- {
- "fieldname": "company",
- "fieldtype": "Link",
- "label": "Company",
- "options": "Company"
- },
- {
- "fieldname": "column_break_6",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "practitioner",
- "fieldtype": "Link",
- "in_standard_filter": 1,
- "label": "Healthcare Practitioner",
- "options": "Healthcare Practitioner",
- "reqd": 1
- },
- {
- "default": "Today",
- "fieldname": "encounter_date",
- "fieldtype": "Date",
- "in_list_view": 1,
- "label": "Encounter Date",
- "reqd": 1
- },
- {
- "fieldname": "encounter_time",
- "fieldtype": "Time",
- "label": "Encounter Time",
- "reqd": 1
- },
- {
- "default": "0",
- "fieldname": "invoiced",
- "fieldtype": "Check",
- "label": "Invoiced",
- "no_copy": 1,
- "read_only": 1
- },
- {
- "fieldname": "sb_symptoms",
- "fieldtype": "Section Break",
- "label": "Encounter Impression"
- },
- {
- "fieldname": "symptoms",
- "fieldtype": "Table MultiSelect",
- "ignore_xss_filter": 1,
- "label": "Symptoms",
- "no_copy": 1,
- "options": "Patient Encounter Symptom"
- },
- {
- "default": "0",
- "depends_on": "eval: doc.symptoms != ''",
- "fieldname": "symptoms_in_print",
- "fieldtype": "Check",
- "label": "In print",
- "no_copy": 1,
- "print_hide": 1,
- "report_hide": 1
- },
- {
- "fieldname": "physical_examination",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "diagnosis",
- "fieldtype": "Table MultiSelect",
- "ignore_xss_filter": 1,
- "label": "Diagnosis",
- "no_copy": 1,
- "options": "Patient Encounter Diagnosis"
- },
- {
- "default": "1",
- "depends_on": "eval: doc.diagnosis != ''",
- "fieldname": "diagnosis_in_print",
- "fieldtype": "Check",
- "label": "In print",
- "no_copy": 1,
- "print_hide": 1,
- "report_hide": 1
- },
- {
- "collapsible": 1,
- "fieldname": "codification",
- "fieldtype": "Section Break",
- "label": "Medical Coding"
- },
- {
- "fieldname": "codification_table",
- "fieldtype": "Table",
- "label": "Medical Codes",
- "options": "Codification Table"
- },
- {
- "fieldname": "sb_drug_prescription",
- "fieldtype": "Section Break",
- "label": "Medications"
- },
- {
- "fieldname": "drug_prescription",
- "fieldtype": "Table",
- "label": "Drug Prescription",
- "options": "Drug Prescription"
- },
- {
- "fieldname": "sb_test_prescription",
- "fieldtype": "Section Break",
- "label": "Investigations"
- },
- {
- "fieldname": "lab_test_prescription",
- "fieldtype": "Table",
- "label": "Lab Tests",
- "options": "Lab Prescription"
- },
- {
- "fieldname": "sb_procedures",
- "fieldtype": "Section Break",
- "label": "Procedures"
- },
- {
- "fieldname": "procedure_prescription",
- "fieldtype": "Table",
- "label": "Clinical Procedures",
- "no_copy": 1,
- "options": "Procedure Prescription"
- },
- {
- "fieldname": "encounter_comment",
- "fieldtype": "Small Text",
- "ignore_xss_filter": 1,
- "label": "Review Details",
- "no_copy": 1
- },
- {
- "fieldname": "amended_from",
- "fieldtype": "Link",
- "label": "Amended From",
- "no_copy": 1,
- "options": "Patient Encounter",
- "print_hide": 1,
- "read_only": 1
- },
- {
- "fieldname": "rehabilitation_section",
- "fieldtype": "Section Break",
- "label": "Rehabilitation"
- },
- {
- "fieldname": "therapies",
- "fieldtype": "Table",
- "label": "Therapies",
- "options": "Therapy Plan Detail"
- },
- {
- "fieldname": "section_break_33",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "therapy_plan",
- "fieldtype": "Link",
- "hidden": 1,
- "label": "Therapy Plan",
- "options": "Therapy Plan",
- "read_only": 1
- },
- {
- "fieldname": "appointment_type",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Appointment Type",
- "no_copy": 1,
- "options": "Appointment Type",
- "print_hide": 1,
- "read_only": 1,
- "report_hide": 1
- },
- {
- "fetch_from": "practitioner.department",
- "fieldname": "medical_department",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "in_standard_filter": 1,
- "label": "Department",
- "options": "Medical Department",
- "read_only": 1
- },
- {
- "allow_on_submit": 1,
- "fieldname": "inpatient_status",
- "fieldtype": "Data",
- "label": "Inpatient Status",
- "read_only": 1
- },
- {
- "fieldname": "sb_refs",
- "fieldtype": "Section Break"
- },
- {
- "fetch_from": "practitioner.practitioner_name",
- "fieldname": "practitioner_name",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Practitioner Name",
- "read_only": 1
- },
- {
- "allow_on_submit": 1,
- "fieldname": "title",
- "fieldtype": "Data",
- "hidden": 1,
- "label": "Title",
- "no_copy": 1,
- "print_hide": 1,
- "read_only": 1
- },
- {
- "depends_on": "eval:doc.patient",
- "fieldname": "get_applicable_treatment_plans",
- "fieldtype": "Button",
- "label": "Get Applicable Treatment Plans"
- }
- ],
- "is_submittable": 1,
- "links": [],
- "modified": "2021-07-27 11:39:12.347704",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient Encounter",
- "owner": "Administrator",
- "permissions": [
- {
- "amend": 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",
- "search_fields": "patient, practitioner, medical_department, encounter_date, encounter_time",
- "show_name_in_global_search": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "title_field": "title",
- "track_changes": 1,
- "track_seen": 1
-}
diff --git a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py
deleted file mode 100644
index 2daa6c145c..0000000000
--- a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py
+++ /dev/null
@@ -1,182 +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 import _
-from frappe.model.document import Document
-from frappe.model.mapper import get_mapped_doc
-from frappe.utils import add_days, getdate
-
-
-class PatientEncounter(Document):
- def validate(self):
- self.set_title()
-
- def on_update(self):
- if self.appointment:
- frappe.db.set_value('Patient Appointment', self.appointment, 'status', 'Closed')
-
- def on_submit(self):
- if self.therapies:
- create_therapy_plan(self)
-
- def on_cancel(self):
- if self.appointment:
- frappe.db.set_value('Patient Appointment', self.appointment, 'status', 'Open')
-
- if self.inpatient_record and self.drug_prescription:
- delete_ip_medication_order(self)
-
- def set_title(self):
- self.title = _('{0} with {1}').format(self.patient_name or self.patient,
- self.practitioner_name or self.practitioner)[:100]
-
- @frappe.whitelist()
- @staticmethod
- def get_applicable_treatment_plans(encounter):
- patient = frappe.get_doc('Patient', encounter['patient'])
-
- plan_filters = {}
- plan_filters['name'] = ['in', []]
-
- age = patient.age
- if age:
- plan_filters['patient_age_from'] = ['<=', age.years]
- plan_filters['patient_age_to'] = ['>=', age.years]
-
- gender = patient.sex
- if gender:
- plan_filters['gender'] = ['in', [gender, None]]
-
- diagnosis = encounter.get('diagnosis')
- if diagnosis:
- diagnosis = [_diagnosis['diagnosis'] for _diagnosis in encounter['diagnosis']]
- filters = [
- ['diagnosis', 'in', diagnosis],
- ['parenttype', '=', 'Treatment Plan Template'],
- ]
- diagnosis = frappe.get_list('Patient Encounter Diagnosis', filters=filters, fields='*')
- plan_names = [_diagnosis['parent'] for _diagnosis in diagnosis]
- plan_filters['name'][1].extend(plan_names)
-
- symptoms = encounter.get('symptoms')
- if symptoms:
- symptoms = [symptom['complaint'] for symptom in encounter['symptoms']]
- filters = [
- ['complaint', 'in', symptoms],
- ['parenttype', '=', 'Treatment Plan Template'],
- ]
- symptoms = frappe.get_list('Patient Encounter Symptom', filters=filters, fields='*')
- plan_names = [symptom['parent'] for symptom in symptoms]
- plan_filters['name'][1].extend(plan_names)
-
- if not plan_filters['name'][1]:
- plan_filters.pop('name')
-
- plans = frappe.get_list('Treatment Plan Template', fields='*', filters=plan_filters)
-
- return plans
-
- @frappe.whitelist()
- def set_treatment_plans(self, treatment_plans=None):
- for treatment_plan in treatment_plans:
- self.set_treatment_plan(treatment_plan)
-
- def set_treatment_plan(self, plan):
- plan_items = frappe.get_list('Treatment Plan Template Item', filters={'parent': plan}, fields='*')
- for plan_item in plan_items:
- self.set_treatment_plan_item(plan_item)
-
- drugs = frappe.get_list('Drug Prescription', filters={'parent': plan}, fields='*')
- for drug in drugs:
- self.append('drug_prescription', drug)
-
- self.save()
-
- def set_treatment_plan_item(self, plan_item):
- if plan_item.type == 'Clinical Procedure Template':
- self.append('procedure_prescription', {
- 'procedure': plan_item.template
- })
-
- if plan_item.type == 'Lab Test Template':
- self.append('lab_test_prescription', {
- 'lab_test_code': plan_item.template
- })
-
- if plan_item.type == 'Therapy Type':
- self.append('therapies', {
- 'therapy_type': plan_item.template
- })
-
-
-@frappe.whitelist()
-def make_ip_medication_order(source_name, target_doc=None):
- def set_missing_values(source, target):
- target.start_date = source.encounter_date
- for entry in source.drug_prescription:
- if entry.drug_code:
- dosage = frappe.get_doc('Prescription Dosage', entry.dosage)
- dates = get_prescription_dates(entry.period, target.start_date)
- for date in dates:
- for dose in dosage.dosage_strength:
- order = target.append('medication_orders')
- order.drug = entry.drug_code
- order.drug_name = entry.drug_name
- order.dosage = dose.strength
- order.instructions = entry.comment
- order.dosage_form = entry.dosage_form
- order.date = date
- order.time = dose.strength_time
- target.end_date = dates[-1]
-
- doc = get_mapped_doc('Patient Encounter', source_name, {
- 'Patient Encounter': {
- 'doctype': 'Inpatient Medication Order',
- 'field_map': {
- 'name': 'patient_encounter',
- 'patient': 'patient',
- 'patient_name': 'patient_name',
- 'patient_age': 'patient_age',
- 'inpatient_record': 'inpatient_record',
- 'practitioner': 'practitioner',
- 'start_date': 'encounter_date'
- },
- }
- }, target_doc, set_missing_values)
-
- return doc
-
-
-def get_prescription_dates(period, start_date):
- prescription_duration = frappe.get_doc('Prescription Duration', period)
- days = prescription_duration.get_days()
- dates = [start_date]
- for i in range(1, days):
- dates.append(add_days(getdate(start_date), i))
- return dates
-
-
-def create_therapy_plan(encounter):
- if len(encounter.therapies):
- doc = frappe.new_doc('Therapy Plan')
- doc.patient = encounter.patient
- doc.start_date = encounter.encounter_date
- for entry in encounter.therapies:
- doc.append('therapy_plan_details', {
- 'therapy_type': entry.therapy_type,
- 'no_of_sessions': entry.no_of_sessions
- })
- doc.save(ignore_permissions=True)
- if doc.get('name'):
- encounter.db_set('therapy_plan', doc.name)
- frappe.msgprint(_('Therapy Plan {0} created successfully.').format(frappe.bold(doc.name)), alert=True)
-
-
-def delete_ip_medication_order(encounter):
- record = frappe.db.exists('Inpatient Medication Order', {'patient_encounter': encounter.name})
- if record:
- frappe.delete_doc('Inpatient Medication Order', record, force=1)
diff --git a/erpnext/healthcare/doctype/patient_encounter/patient_encounter_dashboard.py b/erpnext/healthcare/doctype/patient_encounter/patient_encounter_dashboard.py
deleted file mode 100644
index 3b64d98871..0000000000
--- a/erpnext/healthcare/doctype/patient_encounter/patient_encounter_dashboard.py
+++ /dev/null
@@ -1,24 +0,0 @@
-from __future__ import unicode_literals
-
-from frappe import _
-
-
-def get_data():
- return {
- 'fieldname': 'encounter',
- 'non_standard_fieldnames': {
- 'Patient Medical Record': 'reference_name',
- 'Inpatient Medication Order': 'patient_encounter'
- },
- 'transactions': [
- {
- 'label': _('Records'),
- 'items': ['Vital Signs', 'Patient Medical Record']
- },
- {
- 'label': _('Orders'),
- 'items': ['Inpatient Medication Order']
- }
- ],
- 'disable_create_buttons': ['Inpatient Medication Order']
- }
diff --git a/erpnext/healthcare/doctype/patient_encounter/patient_encounter_list.js b/erpnext/healthcare/doctype/patient_encounter/patient_encounter_list.js
deleted file mode 100644
index d8f63bd0fa..0000000000
--- a/erpnext/healthcare/doctype/patient_encounter/patient_encounter_list.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/*
-(c) ESS 2015-16
-*/
-frappe.listview_settings['Patient Encounter'] = {
- filters:[["docstatus","!=","2"]]
-};
diff --git a/erpnext/healthcare/doctype/patient_encounter/test_patient_encounter.py b/erpnext/healthcare/doctype/patient_encounter/test_patient_encounter.py
deleted file mode 100644
index fa643a31d8..0000000000
--- a/erpnext/healthcare/doctype/patient_encounter/test_patient_encounter.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-import unittest
-
-import frappe
-
-from erpnext.healthcare.doctype.patient_encounter.patient_encounter import PatientEncounter
-
-
-class TestPatientEncounter(unittest.TestCase):
- def setUp(self):
- try:
- gender_m = frappe.get_doc({
- 'doctype': 'Gender',
- 'gender': 'MALE'
- }).insert()
- gender_f = frappe.get_doc({
- 'doctype': 'Gender',
- 'gender': 'FEMALE'
- }).insert()
- except frappe.exceptions.DuplicateEntryError:
- gender_m = frappe.get_doc({
- 'doctype': 'Gender',
- 'gender': 'MALE'
- })
- gender_f = frappe.get_doc({
- 'doctype': 'Gender',
- 'gender': 'FEMALE'
- })
-
- self.patient_male = frappe.get_doc({
- 'doctype': 'Patient',
- 'first_name': 'John',
- 'sex': gender_m.gender,
- }).insert()
- self.patient_female = frappe.get_doc({
- 'doctype': 'Patient',
- 'first_name': 'Curie',
- 'sex': gender_f.gender,
- }).insert()
- self.practitioner = frappe.get_doc({
- 'doctype': 'Healthcare Practitioner',
- 'first_name': 'Doc',
- 'sex': 'MALE',
- }).insert()
- try:
- self.care_plan_male = frappe.get_doc({
- 'doctype': 'Treatment Plan Template',
- 'template_name': 'test plan - m',
- 'gender': gender_m.gender,
- }).insert()
- self.care_plan_female = frappe.get_doc({
- 'doctype': 'Treatment Plan Template',
- 'template_name': 'test plan - f',
- 'gender': gender_f.gender,
- }).insert()
- except frappe.exceptions.DuplicateEntryError:
- self.care_plan_male = frappe.get_doc({
- 'doctype': 'Treatment Plan Template',
- 'template_name': 'test plan - m',
- 'gender': gender_m.gender,
- })
- self.care_plan_female = frappe.get_doc({
- 'doctype': 'Treatment Plan Template',
- 'template_name': 'test plan - f',
- 'gender': gender_f.gender,
- })
-
- def test_treatment_plan_template_filter(self):
- encounter = frappe.get_doc({
- 'doctype': 'Patient Encounter',
- 'patient': self.patient_male.name,
- 'practitioner': self.practitioner.name,
- }).insert()
- plans = PatientEncounter.get_applicable_treatment_plans(encounter.as_dict())
- self.assertEqual(plans[0]['name'], self.care_plan_male.template_name)
-
- encounter = frappe.get_doc({
- 'doctype': 'Patient Encounter',
- 'patient': self.patient_female.name,
- 'practitioner': self.practitioner.name,
- }).insert()
- plans = PatientEncounter.get_applicable_treatment_plans(encounter.as_dict())
- self.assertEqual(plans[0]['name'], self.care_plan_female.template_name)
diff --git a/erpnext/healthcare/doctype/patient_encounter_diagnosis/__init__.py b/erpnext/healthcare/doctype/patient_encounter_diagnosis/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/patient_encounter_diagnosis/patient_encounter_diagnosis.json b/erpnext/healthcare/doctype/patient_encounter_diagnosis/patient_encounter_diagnosis.json
deleted file mode 100644
index 00ca309d63..0000000000
--- a/erpnext/healthcare/doctype/patient_encounter_diagnosis/patient_encounter_diagnosis.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "actions": [],
- "beta": 1,
- "creation": "2020-02-26 16:48:16.835105",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "diagnosis"
- ],
- "fields": [
- {
- "fieldname": "diagnosis",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Diagnosis",
- "options": "Diagnosis",
- "reqd": 1
- }
- ],
- "istable": 1,
- "links": [],
- "modified": "2020-02-26 16:58:16.480583",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient Encounter Diagnosis",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_encounter_diagnosis/patient_encounter_diagnosis.py b/erpnext/healthcare/doctype/patient_encounter_diagnosis/patient_encounter_diagnosis.py
deleted file mode 100644
index e4d2069a50..0000000000
--- a/erpnext/healthcare/doctype/patient_encounter_diagnosis/patient_encounter_diagnosis.py
+++ /dev/null
@@ -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 PatientEncounterDiagnosis(Document):
- pass
diff --git a/erpnext/healthcare/doctype/patient_encounter_symptom/__init__.py b/erpnext/healthcare/doctype/patient_encounter_symptom/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/patient_encounter_symptom/patient_encounter_symptom.json b/erpnext/healthcare/doctype/patient_encounter_symptom/patient_encounter_symptom.json
deleted file mode 100644
index bc92145867..0000000000
--- a/erpnext/healthcare/doctype/patient_encounter_symptom/patient_encounter_symptom.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "actions": [],
- "beta": 1,
- "creation": "2020-02-26 16:47:00.525657",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "complaint"
- ],
- "fields": [
- {
- "fieldname": "complaint",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Complaint",
- "options": "Complaint",
- "reqd": 1
- }
- ],
- "istable": 1,
- "links": [],
- "modified": "2020-02-26 16:57:37.997481",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient Encounter Symptom",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_encounter_symptom/patient_encounter_symptom.py b/erpnext/healthcare/doctype/patient_encounter_symptom/patient_encounter_symptom.py
deleted file mode 100644
index 47f2a2be7e..0000000000
--- a/erpnext/healthcare/doctype/patient_encounter_symptom/patient_encounter_symptom.py
+++ /dev/null
@@ -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 PatientEncounterSymptom(Document):
- pass
diff --git a/erpnext/healthcare/doctype/patient_history_custom_document_type/__init__.py b/erpnext/healthcare/doctype/patient_history_custom_document_type/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/patient_history_custom_document_type/patient_history_custom_document_type.json b/erpnext/healthcare/doctype/patient_history_custom_document_type/patient_history_custom_document_type.json
deleted file mode 100644
index 3025c7b06d..0000000000
--- a/erpnext/healthcare/doctype/patient_history_custom_document_type/patient_history_custom_document_type.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
- "actions": [],
- "creation": "2020-11-25 13:40:23.054469",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "document_type",
- "date_fieldname",
- "add_edit_fields",
- "selected_fields"
- ],
- "fields": [
- {
- "fieldname": "document_type",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Document Type",
- "options": "DocType",
- "reqd": 1
- },
- {
- "fieldname": "selected_fields",
- "fieldtype": "Code",
- "label": "Selected Fields",
- "read_only": 1
- },
- {
- "fieldname": "add_edit_fields",
- "fieldtype": "Button",
- "in_list_view": 1,
- "label": "Add / Edit Fields"
- },
- {
- "fieldname": "date_fieldname",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Date Fieldname",
- "reqd": 1
- }
- ],
- "index_web_pages_for_search": 1,
- "istable": 1,
- "links": [],
- "modified": "2020-11-30 13:54:37.474671",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient History Custom Document Type",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_history_custom_document_type/patient_history_custom_document_type.py b/erpnext/healthcare/doctype/patient_history_custom_document_type/patient_history_custom_document_type.py
deleted file mode 100644
index 34e15dc46a..0000000000
--- a/erpnext/healthcare/doctype/patient_history_custom_document_type/patient_history_custom_document_type.py
+++ /dev/null
@@ -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 PatientHistoryCustomDocumentType(Document):
- pass
diff --git a/erpnext/healthcare/doctype/patient_history_settings/__init__.py b/erpnext/healthcare/doctype/patient_history_settings/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.js b/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.js
deleted file mode 100644
index 453da6a12b..0000000000
--- a/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.js
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Patient History Settings', {
- refresh: function(frm) {
- frm.set_query('document_type', 'custom_doctypes', () => {
- return {
- filters: {
- custom: 1,
- is_submittable: 1,
- module: 'Healthcare',
- }
- };
- });
- },
-
- field_selector: function(frm, doc, standard=1) {
- let document_fields = [];
- if (doc.selected_fields)
- document_fields = (JSON.parse(doc.selected_fields)).map(f => f.fieldname);
-
- frm.call({
- method: 'get_doctype_fields',
- doc: frm.doc,
- args: {
- document_type: doc.document_type,
- fields: document_fields
- },
- freeze: true,
- callback: function(r) {
- if (r.message) {
- let doctype = 'Patient History Custom Document Type';
- if (standard)
- doctype = 'Patient History Standard Document Type';
-
- frm.events.show_field_selector_dialog(frm, doc, doctype, r.message);
- }
- }
- });
- },
-
- show_field_selector_dialog: function(frm, doc, doctype, doc_fields) {
- let d = new frappe.ui.Dialog({
- title: __('{0} Fields', [__(doc.document_type)]),
- fields: [
- {
- label: __('Select Fields'),
- fieldtype: 'MultiCheck',
- fieldname: 'fields',
- options: doc_fields,
- columns: 2
- }
- ]
- });
-
- d.$body.prepend(`
-
-
-
`
- );
-
- frappe.utils.setup_search(d.$body, '.unit-checkbox', '.label-area');
-
- d.set_primary_action(__('Save'), () => {
- let values = d.get_values().fields;
-
- let selected_fields = [];
-
- frappe.model.with_doctype(doc.document_type, function() {
- for (let idx in values) {
- let value = values[idx];
-
- let field = frappe.get_meta(doc.document_type).fields.filter((df) => df.fieldname == value)[0];
- if (field) {
- selected_fields.push({
- label: field.label,
- fieldname: field.fieldname,
- fieldtype: field.fieldtype
- });
- }
- }
-
- d.refresh();
- frappe.model.set_value(doctype, doc.name, 'selected_fields', JSON.stringify(selected_fields));
- });
-
- d.hide();
- });
-
- d.show();
- },
-
- get_date_field_for_dt: function(frm, row) {
- frm.call({
- method: 'get_date_field_for_dt',
- doc: frm.doc,
- args: {
- document_type: row.document_type
- },
- callback: function(data) {
- if (data.message) {
- frappe.model.set_value('Patient History Custom Document Type',
- row.name, 'date_fieldname', data.message);
- }
- }
- });
- }
-});
-
-frappe.ui.form.on('Patient History Custom Document Type', {
- document_type: function(frm, cdt, cdn) {
- let row = locals[cdt][cdn];
- if (row.document_type) {
- frm.events.get_date_field_for_dt(frm, row);
- }
- },
-
- add_edit_fields: function(frm, cdt, cdn) {
- let row = locals[cdt][cdn];
- if (row.document_type) {
- frm.events.field_selector(frm, row, 0);
- }
- }
-});
-
-frappe.ui.form.on('Patient History Standard Document Type', {
- add_edit_fields: function(frm, cdt, cdn) {
- let row = locals[cdt][cdn];
- if (row.document_type) {
- frm.events.field_selector(frm, row);
- }
- }
-});
diff --git a/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.json b/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.json
deleted file mode 100644
index 143e2c91eb..0000000000
--- a/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
- "actions": [],
- "creation": "2020-11-25 13:41:37.675518",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "standard_doctypes",
- "section_break_2",
- "custom_doctypes"
- ],
- "fields": [
- {
- "fieldname": "section_break_2",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "custom_doctypes",
- "fieldtype": "Table",
- "label": "Custom Document Types",
- "options": "Patient History Custom Document Type"
- },
- {
- "fieldname": "standard_doctypes",
- "fieldtype": "Table",
- "label": "Standard Document Types",
- "options": "Patient History Standard Document Type",
- "read_only": 1
- }
- ],
- "index_web_pages_for_search": 1,
- "issingle": 1,
- "links": [],
- "modified": "2020-11-25 13:43:38.511771",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient History Settings",
- "owner": "Administrator",
- "permissions": [
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "print": 1,
- "read": 1,
- "role": "System Manager",
- "share": 1,
- "write": 1
- }
- ],
- "quick_entry": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.py b/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.py
deleted file mode 100644
index b763591d3a..0000000000
--- a/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.py
+++ /dev/null
@@ -1,194 +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 json
-
-import frappe
-from frappe import _
-from frappe.model.document import Document
-from frappe.utils import cint, cstr
-
-from erpnext.healthcare.page.patient_history.patient_history import get_patient_history_doctypes
-
-
-class PatientHistorySettings(Document):
- def validate(self):
- self.validate_submittable_doctypes()
- self.validate_date_fieldnames()
-
- def validate_submittable_doctypes(self):
- for entry in self.custom_doctypes:
- if not cint(frappe.db.get_value('DocType', entry.document_type, 'is_submittable')):
- msg = _('Row #{0}: Document Type {1} is not submittable.').format(
- entry.idx, frappe.bold(entry.document_type))
- msg += _('Patient Medical Record can only be created for submittable document types.')
- frappe.throw(msg)
-
- def validate_date_fieldnames(self):
- for entry in self.custom_doctypes:
- field = frappe.get_meta(entry.document_type).get_field(entry.date_fieldname)
- if not field:
- frappe.throw(_('Row #{0}: No such Field named {1} found in the Document Type {2}.').format(
- entry.idx, frappe.bold(entry.date_fieldname), frappe.bold(entry.document_type)))
-
- if field.fieldtype not in ['Date', 'Datetime']:
- frappe.throw(_('Row #{0}: Field {1} in Document Type {2} is not a Date / Datetime field.').format(
- entry.idx, frappe.bold(entry.date_fieldname), frappe.bold(entry.document_type)))
-
- @frappe.whitelist()
- def get_doctype_fields(self, document_type, fields):
- multicheck_fields = []
- doc_fields = frappe.get_meta(document_type).fields
-
- for field in doc_fields:
- if field.fieldtype not in frappe.model.no_value_fields or \
- field.fieldtype in frappe.model.table_fields and not field.hidden:
- multicheck_fields.append({
- 'label': field.label,
- 'value': field.fieldname,
- 'checked': 1 if field.fieldname in fields else 0
- })
-
- return multicheck_fields
-
- @frappe.whitelist()
- def get_date_field_for_dt(self, document_type):
- meta = frappe.get_meta(document_type)
- date_fields = meta.get('fields', {
- 'fieldtype': ['in', ['Date', 'Datetime']]
- })
-
- if date_fields:
- return date_fields[0].get('fieldname')
-
-def create_medical_record(doc, method=None):
- medical_record_required = validate_medical_record_required(doc)
- if not medical_record_required:
- return
-
- if frappe.db.exists('Patient Medical Record', { 'reference_name': doc.name }):
- return
-
- subject = set_subject_field(doc)
- date_field = get_date_field(doc.doctype)
- medical_record = frappe.new_doc('Patient Medical Record')
- medical_record.patient = doc.patient
- medical_record.subject = subject
- medical_record.status = 'Open'
- medical_record.communication_date = doc.get(date_field)
- medical_record.reference_doctype = doc.doctype
- medical_record.reference_name = doc.name
- medical_record.reference_owner = doc.owner
- medical_record.save(ignore_permissions=True)
-
-
-def update_medical_record(doc, method=None):
- medical_record_required = validate_medical_record_required(doc)
- if not medical_record_required:
- return
-
- medical_record_id = frappe.db.exists('Patient Medical Record', { 'reference_name': doc.name })
-
- if medical_record_id:
- subject = set_subject_field(doc)
- frappe.db.set_value('Patient Medical Record', medical_record_id[0][0], 'subject', subject)
- else:
- create_medical_record(doc)
-
-
-def delete_medical_record(doc, method=None):
- medical_record_required = validate_medical_record_required(doc)
- if not medical_record_required:
- return
-
- record = frappe.db.exists('Patient Medical Record', { 'reference_name': doc.name })
- if record:
- frappe.delete_doc('Patient Medical Record', record, force=1)
-
-
-def set_subject_field(doc):
- from frappe.utils.formatters import format_value
-
- meta = frappe.get_meta(doc.doctype)
- subject = ''
- patient_history_fields = get_patient_history_fields(doc)
-
- for entry in patient_history_fields:
- fieldname = entry.get('fieldname')
- if entry.get('fieldtype') == 'Table' and doc.get(fieldname):
- formatted_value = get_formatted_value_for_table_field(doc.get(fieldname), meta.get_field(fieldname))
- subject += frappe.bold(_(entry.get('label')) + ':') + '
' + cstr(formatted_value) + '
'
-
- else:
- if doc.get(fieldname):
- formatted_value = format_value(doc.get(fieldname), meta.get_field(fieldname), doc)
- subject += frappe.bold(_(entry.get('label')) + ':') + cstr(formatted_value) + '
'
-
- return subject
-
-
-def get_date_field(doctype):
- dt = get_patient_history_config_dt(doctype)
-
- return frappe.db.get_value(dt, { 'document_type': doctype }, 'date_fieldname')
-
-
-def get_patient_history_fields(doc):
- dt = get_patient_history_config_dt(doc.doctype)
- patient_history_fields = frappe.db.get_value(dt, { 'document_type': doc.doctype }, 'selected_fields')
-
- if patient_history_fields:
- return json.loads(patient_history_fields)
-
-
-def get_formatted_value_for_table_field(items, df):
- child_meta = frappe.get_meta(df.options)
-
- table_head = ''
- table_row = ''
- html = ''
- create_head = True
- for item in items:
- table_row += '
'
- for cdf in child_meta.fields:
- if cdf.in_list_view:
- if create_head:
- table_head += '' + cdf.label + ' '
- if item.get(cdf.fieldname):
- table_row += '' + str(item.get(cdf.fieldname)) + ' '
- else:
- table_row += ' '
- create_head = False
- table_row += ' '
-
- html += "
" + table_head + table_row + "
"
-
- return html
-
-
-def get_patient_history_config_dt(doctype):
- if frappe.db.get_value('DocType', doctype, 'custom'):
- return 'Patient History Custom Document Type'
- else:
- return 'Patient History Standard Document Type'
-
-
-def validate_medical_record_required(doc):
- if frappe.flags.in_patch or frappe.flags.in_install or frappe.flags.in_setup_wizard \
- or get_module(doc) != 'Healthcare':
- return False
-
- if doc.doctype not in get_patient_history_doctypes():
- return False
-
- return True
-
-def get_module(doc):
- module = doc.meta.module
- if not module:
- module = frappe.db.get_value('DocType', doc.doctype, 'module')
-
- return module
diff --git a/erpnext/healthcare/doctype/patient_history_settings/test_patient_history_settings.py b/erpnext/healthcare/doctype/patient_history_settings/test_patient_history_settings.py
deleted file mode 100644
index c37a2adc36..0000000000
--- a/erpnext/healthcare/doctype/patient_history_settings/test_patient_history_settings.py
+++ /dev/null
@@ -1,106 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-import json
-import unittest
-
-import frappe
-from frappe.utils import getdate, strip_html
-
-from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_patient
-
-
-class TestPatientHistorySettings(unittest.TestCase):
- def setUp(self):
- dt = create_custom_doctype()
- settings = frappe.get_single("Patient History Settings")
- settings.append("custom_doctypes", {
- "document_type": dt.name,
- "date_fieldname": "date",
- "selected_fields": json.dumps([{
- "label": "Date",
- "fieldname": "date",
- "fieldtype": "Date"
- },
- {
- "label": "Rating",
- "fieldname": "rating",
- "fieldtype": "Rating"
- },
- {
- "label": "Feedback",
- "fieldname": "feedback",
- "fieldtype": "Small Text"
- }])
- })
- settings.save()
-
- def test_custom_doctype_medical_record(self):
- # tests for medical record creation of standard doctypes in test_patient_medical_record.py
- patient = create_patient()
- doc = create_doc(patient)
- # check for medical record
- medical_rec = frappe.db.exists("Patient Medical Record", {"status": "Open", "reference_name": doc.name})
- self.assertTrue(medical_rec)
-
- medical_rec = frappe.get_doc("Patient Medical Record", medical_rec)
- expected_subject = "Date:{0}Rating:3Feedback:Test Patient History Settings".format(
- frappe.utils.format_date(getdate()))
- self.assertEqual(strip_html(medical_rec.subject), expected_subject)
- self.assertEqual(medical_rec.patient, patient)
- self.assertEqual(medical_rec.communication_date, getdate())
-
-
-def create_custom_doctype():
- if not frappe.db.exists("DocType", "Test Patient Feedback"):
- doc = frappe.get_doc({
- "doctype": "DocType",
- "module": "Healthcare",
- "custom": 1,
- "is_submittable": 1,
- "fields": [{
- "label": "Date",
- "fieldname": "date",
- "fieldtype": "Date"
- },
- {
- "label": "Patient",
- "fieldname": "patient",
- "fieldtype": "Link",
- "options": "Patient"
- },
- {
- "label": "Rating",
- "fieldname": "rating",
- "fieldtype": "Rating"
- },
- {
- "label": "Feedback",
- "fieldname": "feedback",
- "fieldtype": "Small Text"
- }],
- "permissions": [{
- "role": "System Manager",
- "read": 1
- }],
- "name": "Test Patient Feedback",
- })
- doc.insert()
- return doc
- else:
- return frappe.get_doc("DocType", "Test Patient Feedback")
-
-
-def create_doc(patient):
- doc = frappe.get_doc({
- "doctype": "Test Patient Feedback",
- "patient": patient,
- "date": getdate(),
- "rating": 3,
- "feedback": "Test Patient History Settings"
- }).insert()
- doc.submit()
-
- return doc
diff --git a/erpnext/healthcare/doctype/patient_history_standard_document_type/__init__.py b/erpnext/healthcare/doctype/patient_history_standard_document_type/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/patient_history_standard_document_type/patient_history_standard_document_type.json b/erpnext/healthcare/doctype/patient_history_standard_document_type/patient_history_standard_document_type.json
deleted file mode 100644
index b43099c4ea..0000000000
--- a/erpnext/healthcare/doctype/patient_history_standard_document_type/patient_history_standard_document_type.json
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "actions": [],
- "creation": "2020-11-25 13:39:36.014814",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "document_type",
- "date_fieldname",
- "add_edit_fields",
- "selected_fields"
- ],
- "fields": [
- {
- "fieldname": "document_type",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Document Type",
- "options": "DocType",
- "read_only": 1,
- "reqd": 1
- },
- {
- "fieldname": "selected_fields",
- "fieldtype": "Code",
- "label": "Selected Fields",
- "read_only": 1
- },
- {
- "fieldname": "add_edit_fields",
- "fieldtype": "Button",
- "in_list_view": 1,
- "label": "Add / Edit Fields"
- },
- {
- "fieldname": "date_fieldname",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Date Fieldname",
- "read_only": 1,
- "reqd": 1
- }
- ],
- "index_web_pages_for_search": 1,
- "istable": 1,
- "links": [],
- "modified": "2020-11-30 13:54:56.773325",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient History Standard Document Type",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_history_standard_document_type/patient_history_standard_document_type.py b/erpnext/healthcare/doctype/patient_history_standard_document_type/patient_history_standard_document_type.py
deleted file mode 100644
index b7dd09bc10..0000000000
--- a/erpnext/healthcare/doctype/patient_history_standard_document_type/patient_history_standard_document_type.py
+++ /dev/null
@@ -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 PatientHistoryStandardDocumentType(Document):
- pass
diff --git a/erpnext/healthcare/doctype/patient_medical_record/__init__.py b/erpnext/healthcare/doctype/patient_medical_record/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.js b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.js
deleted file mode 100644
index 93ff70e643..0000000000
--- a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (c) 2016, ESS LLP and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Patient Medical Record', {
-});
diff --git a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json
deleted file mode 100644
index ed82355f33..0000000000
--- a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json
+++ /dev/null
@@ -1,155 +0,0 @@
-{
- "actions": [],
- "allow_copy": 1,
- "allow_import": 1,
- "autoname": "naming_series:",
- "beta": 1,
- "creation": "2016-06-09 11:30:44.972056",
- "doctype": "DocType",
- "document_type": "Setup",
- "engine": "InnoDB",
- "field_order": [
- "naming_series",
- "patient",
- "status",
- "column_break_2",
- "attach",
- "section_break_4",
- "subject",
- "section_break_8",
- "communication_date",
- "reference_doctype",
- "reference_name",
- "column_break_9",
- "reference_owner",
- "user"
- ],
- "fields": [
- {
- "fieldname": "naming_series",
- "fieldtype": "Select",
- "label": "Series",
- "options": "HLC-PMR-.YYYY.-",
- "print_hide": 1,
- "report_hide": 1
- },
- {
- "fieldname": "patient",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "in_list_view": 1,
- "label": "Patient",
- "options": "Patient",
- "search_index": 1
- },
- {
- "fieldname": "column_break_2",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "attach",
- "fieldtype": "Attach",
- "label": "Attach Medical Record"
- },
- {
- "fieldname": "section_break_4",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "subject",
- "fieldtype": "Text Editor",
- "ignore_xss_filter": 1,
- "label": "Subject"
- },
- {
- "fieldname": "status",
- "fieldtype": "Select",
- "label": "Status",
- "options": "Open\nClose",
- "read_only": 1
- },
- {
- "default": "Today",
- "fieldname": "communication_date",
- "fieldtype": "Date",
- "in_list_view": 1,
- "label": "Datetime",
- "read_only": 1
- },
- {
- "fieldname": "reference_doctype",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Reference DocType",
- "options": "DocType",
- "read_only": 1,
- "search_index": 1
- },
- {
- "fieldname": "reference_name",
- "fieldtype": "Dynamic Link",
- "in_list_view": 1,
- "label": "Reference Name",
- "options": "reference_doctype",
- "read_only": 1,
- "search_index": 1
- },
- {
- "fetch_from": "reference_name.owner",
- "fieldname": "reference_owner",
- "fieldtype": "Data",
- "label": "Reference Owner",
- "no_copy": 1,
- "print_hide": 1,
- "read_only": 1,
- "report_hide": 1
- },
- {
- "default": "__user",
- "fieldname": "user",
- "fieldtype": "Link",
- "label": "User",
- "options": "User",
- "print_hide": 1,
- "read_only": 1,
- "report_hide": 1
- },
- {
- "fieldname": "column_break_9",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "section_break_8",
- "fieldtype": "Section Break"
- }
- ],
- "in_create": 1,
- "links": [],
- "modified": "2020-04-29 12:26:57.679402",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient Medical Record",
- "owner": "Administrator",
- "permissions": [
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Physician",
- "share": 1,
- "write": 1
- }
- ],
- "restrict_to_domain": "Healthcare",
- "search_fields": "patient, subject, communication_date, reference_doctype, reference_name",
- "show_name_in_global_search": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "title_field": "patient",
- "track_changes": 1,
- "track_seen": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.py b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.py
deleted file mode 100644
index ac2cffa3e8..0000000000
--- a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.py
+++ /dev/null
@@ -1,14 +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 PatientMedicalRecord(Document):
- def after_insert(self):
- if self.reference_doctype == "Patient Medical Record" :
- frappe.db.set_value("Patient Medical Record", self.name, "reference_name", self.name)
diff --git a/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py b/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py
deleted file mode 100644
index 099146c7ee..0000000000
--- a/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py
+++ /dev/null
@@ -1,101 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, ESS LLP and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-import unittest
-
-import frappe
-from frappe.utils import nowdate
-
-from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
-from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import (
- create_appointment,
- create_encounter,
- create_healthcare_docs,
- create_medical_department,
-)
-
-
-class TestPatientMedicalRecord(unittest.TestCase):
- def setUp(self):
- frappe.db.set_value('Healthcare Settings', None, 'enable_free_follow_ups', 0)
- frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1)
- make_pos_profile()
-
- def test_medical_record(self):
- patient, practitioner = create_healthcare_docs()
- medical_department = create_medical_department()
- appointment = create_appointment(patient, practitioner, nowdate(), invoice=1)
- encounter = create_encounter(appointment)
-
- # check for encounter
- medical_rec = frappe.db.exists('Patient Medical Record', {'status': 'Open', 'reference_name': encounter.name})
- self.assertTrue(medical_rec)
-
- vital_signs = create_vital_signs(appointment)
- # check for vital signs
- medical_rec = frappe.db.exists('Patient Medical Record', {'status': 'Open', 'reference_name': vital_signs.name})
- self.assertTrue(medical_rec)
-
- appointment = create_appointment(patient, practitioner, nowdate(), invoice=1, procedure_template=1)
- procedure = create_procedure(appointment)
- procedure.start_procedure()
- procedure.complete_procedure()
- # check for clinical procedure
- medical_rec = frappe.db.exists('Patient Medical Record', {'status': 'Open', 'reference_name': procedure.name})
- self.assertTrue(medical_rec)
-
- template = create_lab_test_template(medical_department)
- lab_test = create_lab_test(template.name, patient)
- # check for lab test
- medical_rec = frappe.db.exists('Patient Medical Record', {'status': 'Open', 'reference_name': lab_test.name})
- self.assertTrue(medical_rec)
-
-
-def create_procedure(appointment):
- if appointment:
- procedure = frappe.new_doc('Clinical Procedure')
- procedure.procedure_template = appointment.procedure_template
- procedure.appointment = appointment.name
- procedure.patient = appointment.patient
- procedure.practitioner = appointment.practitioner
- procedure.medical_department = appointment.department
- procedure.start_dt = appointment.appointment_date
- procedure.start_time = appointment.appointment_time
- procedure.save()
- procedure.submit()
- return procedure
-
-def create_vital_signs(appointment):
- vital_signs = frappe.new_doc('Vital Signs')
- vital_signs.patient = appointment.patient
- vital_signs.signs_date = appointment.appointment_date
- vital_signs.signs_time = appointment.appointment_time
- vital_signs.temperature = 38.5
- vital_signs.save()
- vital_signs.submit()
- return vital_signs
-
-def create_lab_test_template(medical_department):
- if frappe.db.exists('Lab Test Template', 'Blood Test'):
- return frappe.get_doc('Lab Test Template', 'Blood Test')
-
- template = frappe.new_doc('Lab Test Template')
- template.lab_test_name = 'Blood Test'
- template.lab_test_code = 'Blood Test'
- template.lab_test_group = 'Services'
- template.department = medical_department
- template.is_billable = 1
- template.lab_test_rate = 2000
- template.save()
- return template
-
-def create_lab_test(template, patient):
- lab_test = frappe.new_doc('Lab Test')
- lab_test.patient = patient
- lab_test.patient_sex = frappe.db.get_value('Patient', patient, 'sex')
- lab_test.template = template
- lab_test.save()
- lab_test.submit()
- return lab_test
diff --git a/erpnext/healthcare/doctype/patient_relation/__init__.py b/erpnext/healthcare/doctype/patient_relation/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/patient_relation/patient_relation.json b/erpnext/healthcare/doctype/patient_relation/patient_relation.json
deleted file mode 100644
index 376f7f76d6..0000000000
--- a/erpnext/healthcare/doctype/patient_relation/patient_relation.json
+++ /dev/null
@@ -1,52 +0,0 @@
-{
- "actions": [],
- "allow_copy": 1,
- "beta": 1,
- "creation": "2017-04-26 15:40:11.561855",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "patient",
- "relation",
- "description"
- ],
- "fields": [
- {
- "fieldname": "relation",
- "fieldtype": "Select",
- "in_list_view": 1,
- "label": "Relation",
- "options": "\nFather\nMother\nSpouse\nSiblings\nFamily\nOther",
- "search_index": 1
- },
- {
- "fieldname": "patient",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "in_list_view": 1,
- "label": "Patient",
- "options": "Patient",
- "reqd": 1
- },
- {
- "fieldname": "description",
- "fieldtype": "Small Text",
- "ignore_xss_filter": 1,
- "label": "Description"
- }
- ],
- "istable": 1,
- "links": [],
- "modified": "2020-01-29 12:45:40.081899",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient Relation",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "restrict_to_domain": "Healthcare",
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_relation/patient_relation.py b/erpnext/healthcare/doctype/patient_relation/patient_relation.py
deleted file mode 100644
index 17bc20940d..0000000000
--- a/erpnext/healthcare/doctype/patient_relation/patient_relation.py
+++ /dev/null
@@ -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 PatientRelation(Document):
- pass
diff --git a/erpnext/healthcare/doctype/practitioner_schedule/__init__.py b/erpnext/healthcare/doctype/practitioner_schedule/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/practitioner_schedule/practitioner_schedule.js b/erpnext/healthcare/doctype/practitioner_schedule/practitioner_schedule.js
deleted file mode 100644
index 7cb7c4b65e..0000000000
--- a/erpnext/healthcare/doctype/practitioner_schedule/practitioner_schedule.js
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Practitioner Schedule', {
- refresh: function(frm) {
- cur_frm.fields_dict["time_slots"].grid.wrapper.find('.grid-add-row').hide();
- cur_frm.fields_dict["time_slots"].grid.add_custom_button(__('Add Time Slots'), () => {
- let d = new frappe.ui.Dialog({
- fields: [
- {fieldname: 'days', label: __('Select Days'), fieldtype: 'MultiSelect',
- options:[
- {value:'Sunday', label:__('Sunday')},
- {value:'Monday', label:__('Monday')},
- {value:'Tuesday', label:__('Tuesday')},
- {value:'Wednesday', label:__('Wednesday')},
- {value:'Thursday', label:__('Thursday')},
- {value:'Friday', label:__('Friday')},
- {value:'Saturday', label:__('Saturday')},
- ], reqd: 1},
- {fieldname: 'from_time', label: __('From'), fieldtype: 'Time',
- 'default': '09:00:00', reqd: 1},
- {fieldname: 'to_time', label: __('To'), fieldtype: 'Time',
- 'default': '12:00:00', reqd: 1},
- {fieldname: 'duration', label: __('Appointment Duration (mins)'),
- fieldtype:'Int', 'default': 15, reqd: 1},
- ],
- primary_action_label: __('Add Timeslots'),
- primary_action: () => {
- let values = d.get_values();
- if (values) {
- let slot_added = false;
- values.days.split(',').forEach(function(day){
- day = $.trim(day);
- if (['Sunday', 'Monday', 'Tuesday', 'Wednesday',
- 'Thursday', 'Friday', 'Saturday'].includes(day)){
- add_slots(day);
- }
- });
-
- function check_overlap_or_add_slot(week_day, cur_time, end_time, add_slots_to_child){
- let overlap = false;
- while (cur_time < end_time) {
- let add_to_child = true;
- let to_time = cur_time.clone().add(values.duration, 'minutes');
- if (to_time <= end_time) {
- if (frm.doc.time_slots){
- frm.doc.time_slots.forEach(function(slot) {
- if (slot.day == week_day){
- let slot_from_moment = moment(slot.from_time, 'HH:mm:ss');
- let slot_to_moment = moment(slot.to_time, 'HH:mm:ss');
- if (cur_time.isSame(slot_from_moment) || cur_time.isBetween(slot_from_moment, slot_to_moment) ||
- to_time.isSame(slot_to_moment) || to_time.isBetween(slot_from_moment, slot_to_moment)) {
- overlap = true;
- if (add_slots_to_child) {
- frappe.show_alert({
- message:__('Time slot skiped, the slot {0} to {1} overlap exisiting slot {2} to {3}',
- [cur_time.format('HH:mm:ss'), to_time.format('HH:mm:ss'), slot.from_time, slot.to_time]),
- indicator:'orange'
- });
- add_to_child = false;
- }
- }
- }
- });
- }
- // add a new timeslot
- if (add_to_child && add_slots_to_child) {
- frm.add_child('time_slots', {
- from_time: cur_time.format('HH:mm:ss'),
- to_time: to_time.format('HH:mm:ss'),
- day: week_day
- });
- slot_added = true;
- }
- }
- cur_time = to_time;
- }
- return overlap;
- }
-
- function add_slots(week_day) {
- let cur_time = moment(values.from_time, 'HH:mm:ss');
- let end_time = moment(values.to_time, 'HH:mm:ss');
- if (check_overlap_or_add_slot(week_day, cur_time, end_time, false)) {
- frappe.confirm(__('Schedules for {0} overlaps, do you want to proceed after skiping overlaped slots ?', [week_day]),
- function() {
- // if Yes
- check_overlap_or_add_slot(week_day, cur_time, end_time, true);
- },
- function() {
- // if No
- frappe.show_alert({
- message: __('Slots for {0} are not added to the schedule', [week_day]),
- indicator: 'red'
- });
- }
- );
- } else {
- check_overlap_or_add_slot(week_day, cur_time, end_time, true);
- }
- }
-
- frm.refresh_field('time_slots');
-
- if (slot_added) {
- frappe.show_alert({
- message: __('Time slots added'),
- indicator: 'green'
- });
- }
- }
- },
- });
- d.show();
- });
- }
-});
diff --git a/erpnext/healthcare/doctype/practitioner_schedule/practitioner_schedule.json b/erpnext/healthcare/doctype/practitioner_schedule/practitioner_schedule.json
deleted file mode 100644
index a21825ea8e..0000000000
--- a/erpnext/healthcare/doctype/practitioner_schedule/practitioner_schedule.json
+++ /dev/null
@@ -1,71 +0,0 @@
-{
- "actions": [],
- "allow_import": 1,
- "allow_rename": 1,
- "autoname": "field:schedule_name",
- "beta": 1,
- "creation": "2017-05-03 17:28:03.926787",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "disabled",
- "schedule_details_section",
- "schedule_name",
- "time_slots"
- ],
- "fields": [
- {
- "fieldname": "schedule_name",
- "fieldtype": "Data",
- "ignore_xss_filter": 1,
- "in_list_view": 1,
- "label": "Schedule Name",
- "reqd": 1,
- "unique": 1
- },
- {
- "fieldname": "time_slots",
- "fieldtype": "Table",
- "label": "Time Slots",
- "options": "Healthcare Schedule Time Slot"
- },
- {
- "default": "0",
- "fieldname": "disabled",
- "fieldtype": "Check",
- "label": "Disabled",
- "print_hide": 1
- },
- {
- "fieldname": "schedule_details_section",
- "fieldtype": "Section Break",
- "label": "Schedule Details"
- }
- ],
- "links": [],
- "modified": "2020-09-18 17:26:09.703215",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Practitioner Schedule",
- "owner": "Administrator",
- "permissions": [
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Healthcare Administrator",
- "share": 1,
- "write": 1
- }
- ],
- "restrict_to_domain": "Healthcare",
- "show_name_in_global_search": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/practitioner_schedule/practitioner_schedule.py b/erpnext/healthcare/doctype/practitioner_schedule/practitioner_schedule.py
deleted file mode 100644
index 7fa31e5fb6..0000000000
--- a/erpnext/healthcare/doctype/practitioner_schedule/practitioner_schedule.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2018, 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 PractitionerSchedule(Document):
- def autoname(self):
- self.name = self.schedule_name
diff --git a/erpnext/healthcare/doctype/practitioner_schedule/test_practitioner_schedule.py b/erpnext/healthcare/doctype/practitioner_schedule/test_practitioner_schedule.py
deleted file mode 100644
index 1ecaa47248..0000000000
--- a/erpnext/healthcare/doctype/practitioner_schedule/test_practitioner_schedule.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-import unittest
-
-
-class TestPractitionerSchedule(unittest.TestCase):
- pass
diff --git a/erpnext/healthcare/doctype/practitioner_service_unit_schedule/__init__.py b/erpnext/healthcare/doctype/practitioner_service_unit_schedule/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/practitioner_service_unit_schedule/practitioner_service_unit_schedule.json b/erpnext/healthcare/doctype/practitioner_service_unit_schedule/practitioner_service_unit_schedule.json
deleted file mode 100644
index 4c283aaf1e..0000000000
--- a/erpnext/healthcare/doctype/practitioner_service_unit_schedule/practitioner_service_unit_schedule.json
+++ /dev/null
@@ -1,110 +0,0 @@
-{
- "allow_copy": 0,
- "allow_events_in_timeline": 0,
- "allow_guest_to_view": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "beta": 1,
- "creation": "2017-11-16 12:19:17.163786",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "",
- "editable_grid": 1,
- "engine": "InnoDB",
- "fields": [
- {
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "schedule",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Schedule",
- "length": 0,
- "no_copy": 0,
- "options": "Practitioner Schedule",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 1,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "service_unit",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Service Unit",
- "length": 0,
- "no_copy": 0,
- "options": "Healthcare Service Unit",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- }
- ],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 0,
- "idx": 0,
- "image_view": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 1,
- "max_attachments": 0,
- "modified": "2018-11-04 03:33:07.936958",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Practitioner Service Unit Schedule",
- "name_case": "",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "read_only": 0,
- "read_only_onload": 0,
- "restrict_to_domain": "Healthcare",
- "show_name_in_global_search": 0,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1,
- "track_seen": 0,
- "track_views": 0
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/practitioner_service_unit_schedule/practitioner_service_unit_schedule.py b/erpnext/healthcare/doctype/practitioner_service_unit_schedule/practitioner_service_unit_schedule.py
deleted file mode 100644
index 4eba1fbf6b..0000000000
--- a/erpnext/healthcare/doctype/practitioner_service_unit_schedule/practitioner_service_unit_schedule.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2018, 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 PractitionerServiceUnitSchedule(Document):
- pass
diff --git a/erpnext/healthcare/doctype/prescription_dosage/__init__.py b/erpnext/healthcare/doctype/prescription_dosage/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.js b/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.js
deleted file mode 100644
index 94b444cbaa..0000000000
--- a/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Prescription Dosage', {
-});
diff --git a/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.json b/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.json
deleted file mode 100644
index 9fb0dbc13c..0000000000
--- a/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.json
+++ /dev/null
@@ -1,145 +0,0 @@
-{
- "allow_copy": 0,
- "allow_guest_to_view": 0,
- "allow_import": 1,
- "allow_rename": 1,
- "autoname": "field:dosage",
- "beta": 1,
- "creation": "2016-09-16 15:49:25.327610",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "Document",
- "editable_grid": 0,
- "fields": [
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "dosage",
- "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",
- "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": "dosage_strength",
- "fieldtype": "Table",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "length": 0,
- "no_copy": 0,
- "options": "Dosage Strength",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- }
- ],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 0,
- "idx": 0,
- "image_view": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 0,
- "max_attachments": 0,
- "modified": "2017-10-05 11:20:47.558464",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Prescription Dosage",
- "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": 0,
- "read_only": 0,
- "read_only_onload": 0,
- "restrict_to_domain": "Healthcare",
- "search_fields": "dosage",
- "show_name_in_global_search": 0,
- "sort_field": "modified",
- "sort_order": "DESC",
- "title_field": "",
- "track_changes": 1,
- "track_seen": 0
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.py b/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.py
deleted file mode 100644
index 19f9b70bb6..0000000000
--- a/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.py
+++ /dev/null
@@ -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 PrescriptionDosage(Document):
- pass
diff --git a/erpnext/healthcare/doctype/prescription_dosage/test_prescription_dosage.py b/erpnext/healthcare/doctype/prescription_dosage/test_prescription_dosage.py
deleted file mode 100644
index cabfd35e23..0000000000
--- a/erpnext/healthcare/doctype/prescription_dosage/test_prescription_dosage.py
+++ /dev/null
@@ -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 TestPrescriptionDosage(unittest.TestCase):
- pass
diff --git a/erpnext/healthcare/doctype/prescription_duration/__init__.py b/erpnext/healthcare/doctype/prescription_duration/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/prescription_duration/prescription_duration.js b/erpnext/healthcare/doctype/prescription_duration/prescription_duration.js
deleted file mode 100644
index dd5887c929..0000000000
--- a/erpnext/healthcare/doctype/prescription_duration/prescription_duration.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Prescription Duration', {
-});
diff --git a/erpnext/healthcare/doctype/prescription_duration/prescription_duration.json b/erpnext/healthcare/doctype/prescription_duration/prescription_duration.json
deleted file mode 100644
index c4f6c5f10d..0000000000
--- a/erpnext/healthcare/doctype/prescription_duration/prescription_duration.json
+++ /dev/null
@@ -1,145 +0,0 @@
-{
- "allow_copy": 1,
- "allow_guest_to_view": 0,
- "allow_import": 1,
- "allow_rename": 1,
- "autoname": "",
- "beta": 1,
- "creation": "2016-09-16 15:50:28.895789",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "Document",
- "editable_grid": 0,
- "fields": [
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "number",
- "fieldtype": "Int",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Number",
- "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": "period",
- "fieldtype": "Select",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Period",
- "length": 0,
- "no_copy": 0,
- "options": "Hour\nDay\nWeek\nMonth",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 1,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- }
- ],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 0,
- "idx": 0,
- "image_view": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 0,
- "max_attachments": 0,
- "modified": "2017-08-31 13:42:51.325725",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Prescription Duration",
- "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": "",
- "show_name_in_global_search": 0,
- "sort_field": "",
- "sort_order": "ASC",
- "track_changes": 1,
- "track_seen": 0
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/prescription_duration/prescription_duration.py b/erpnext/healthcare/doctype/prescription_duration/prescription_duration.py
deleted file mode 100644
index 988276da74..0000000000
--- a/erpnext/healthcare/doctype/prescription_duration/prescription_duration.py
+++ /dev/null
@@ -1,74 +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
-from frappe.utils import cstr
-
-
-class PrescriptionDuration(Document):
- def autoname(self):
- self.name = " ".join(filter(None,
- [cstr(self.get(f)).strip() for f in ["number", "period"]]))
- def get_days(self):
- days = 0
- duration = self
- if(duration.period == 'Day'):
- days = duration.number
- if(duration.period == 'Hour'):
- days = (duration.number)/24
- if(duration.period == 'Week'):
- days = (duration.number*7)
- if(duration.period == 'Month'):
- days = (duration.number*30)
- return days
- def get_weeks(self):
- weeks = 0
- duration = self
- if(duration.period == 'Day'):
- weeks = (duration.number)/7
- #if(duration.period == 'Hour'):
- # weeks = (duration.number)/x
- if(duration.period == 'Week'):
- weeks = duration.number
- if(duration.period == 'Month'):
- weeks = duration.number*4
- return weeks
- def get_months(self):
- months = 0
- duration = self
- if(duration.period == 'Day'):
- months = (duration.number)/30
- #if(duration.period == 'Hour'):
- # months = (duration.number)/x
- if(duration.period == 'Week'):
- months = (duration.number)/4
- if(duration.period == 'Month'):
- months = duration.number
- return months
- def get_hours(self):
- hours = 0
- duration = self
- if(duration.period == 'Day'):
- hours = (duration.number*24)
- if(duration.period == 'Hour'):
- hours = duration.number
- if(duration.period == 'Week'):
- hours = (duration.number*24)*7
- if(duration.period == 'Month'):
- hours = (duration.number*24)*30
- return hours
- def get_minutes(self):
- minutes = 0
- duration = self
- if(duration.period == 'Day'):
- minutes = (duration.number*1440)
- if(duration.period == 'Hour'):
- minutes = (duration.number*60)
- if(duration.period == 'Week'):
- minutes = (duration.number*10080)
- if(duration.period == 'Month'):
- minutes = (duration.number*43800)
- return minutes
diff --git a/erpnext/healthcare/doctype/prescription_duration/test_prescription_duration.py b/erpnext/healthcare/doctype/prescription_duration/test_prescription_duration.py
deleted file mode 100644
index 197bb3e7fb..0000000000
--- a/erpnext/healthcare/doctype/prescription_duration/test_prescription_duration.py
+++ /dev/null
@@ -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 TestPrescriptionDuration(unittest.TestCase):
- pass
diff --git a/erpnext/healthcare/doctype/procedure_prescription/__init__.py b/erpnext/healthcare/doctype/procedure_prescription/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/procedure_prescription/procedure_prescription.json b/erpnext/healthcare/doctype/procedure_prescription/procedure_prescription.json
deleted file mode 100644
index e4c01d79c1..0000000000
--- a/erpnext/healthcare/doctype/procedure_prescription/procedure_prescription.json
+++ /dev/null
@@ -1,99 +0,0 @@
-{
- "actions": [],
- "allow_copy": 1,
- "beta": 1,
- "creation": "2017-11-17 15:52:48.324157",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "procedure",
- "procedure_name",
- "department",
- "practitioner",
- "date",
- "comments",
- "appointment_booked",
- "procedure_created",
- "invoiced"
- ],
- "fields": [
- {
- "fieldname": "procedure",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Clinical Procedure",
- "options": "Clinical Procedure Template",
- "reqd": 1
- },
- {
- "fetch_from": "procedure.template",
- "fieldname": "procedure_name",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Procedure Name"
- },
- {
- "fetch_from": "procedure.medical_department",
- "fieldname": "department",
- "fieldtype": "Link",
- "label": "Department",
- "options": "Medical Department"
- },
- {
- "fieldname": "practitioner",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Referring Practitioner",
- "options": "Healthcare Practitioner"
- },
- {
- "fieldname": "date",
- "fieldtype": "Date",
- "in_list_view": 1,
- "label": "Date"
- },
- {
- "fieldname": "comments",
- "fieldtype": "Data",
- "label": "Comments"
- },
- {
- "default": "0",
- "fieldname": "appointment_booked",
- "fieldtype": "Check",
- "hidden": 1,
- "label": "Appointment Booked",
- "search_index": 1
- },
- {
- "default": "0",
- "fieldname": "procedure_created",
- "fieldtype": "Check",
- "hidden": 1,
- "label": "Procedure Created",
- "no_copy": 1,
- "search_index": 1
- },
- {
- "default": "0",
- "fieldname": "invoiced",
- "fieldtype": "Check",
- "label": "Invoiced",
- "read_only": 1,
- "search_index": 1
- }
- ],
- "istable": 1,
- "links": [],
- "modified": "2020-02-26 15:42:33.988081",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Procedure Prescription",
- "owner": "Administrator",
- "permissions": [],
- "restrict_to_domain": "Healthcare",
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/procedure_prescription/procedure_prescription.py b/erpnext/healthcare/doctype/procedure_prescription/procedure_prescription.py
deleted file mode 100644
index f4d29fa6a3..0000000000
--- a/erpnext/healthcare/doctype/procedure_prescription/procedure_prescription.py
+++ /dev/null
@@ -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 ProcedurePrescription(Document):
- pass
diff --git a/erpnext/healthcare/doctype/sample_collection/__init__.py b/erpnext/healthcare/doctype/sample_collection/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/sample_collection/sample_collection.js b/erpnext/healthcare/doctype/sample_collection/sample_collection.js
deleted file mode 100644
index ddf8285bc6..0000000000
--- a/erpnext/healthcare/doctype/sample_collection/sample_collection.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2016, ESS and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Sample Collection', {
- refresh: function(frm) {
- if (frappe.defaults.get_default('create_sample_collection_for_lab_test')) {
- frm.add_custom_button(__('View Lab Tests'), function() {
- frappe.route_options = {'sample': frm.doc.name};
- frappe.set_route('List', 'Lab Test');
- });
- }
- }
-});
-
-frappe.ui.form.on('Sample Collection', 'patient', function(frm) {
- if(frm.doc.patient){
- frappe.call({
- 'method': 'erpnext.healthcare.doctype.patient.patient.get_patient_detail',
- args: {
- patient: frm.doc.patient
- },
- callback: function (data) {
- var age = null;
- if (data.message.dob){
- age = calculate_age(data.message.dob);
- }
- frappe.model.set_value(frm.doctype,frm.docname, 'patient_age', age);
- frappe.model.set_value(frm.doctype,frm.docname, 'patient_sex', data.message.sex);
- }
- });
- }
-});
-
-var calculate_age = function(birth) {
- var ageMS = Date.parse(Date()) - Date.parse(birth);
- var age = new Date();
- age.setTime(ageMS);
- var years = age.getFullYear() - 1970;
- return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
-};
diff --git a/erpnext/healthcare/doctype/sample_collection/sample_collection.json b/erpnext/healthcare/doctype/sample_collection/sample_collection.json
deleted file mode 100644
index 83383e3445..0000000000
--- a/erpnext/healthcare/doctype/sample_collection/sample_collection.json
+++ /dev/null
@@ -1,256 +0,0 @@
-{
- "actions": [],
- "allow_copy": 1,
- "allow_import": 1,
- "autoname": "naming_series:",
- "beta": 1,
- "creation": "2016-04-05 15:58:18.076977",
- "doctype": "DocType",
- "document_type": "Document",
- "engine": "InnoDB",
- "field_order": [
- "patient_details_section",
- "naming_series",
- "patient",
- "patient_name",
- "patient_age",
- "patient_sex",
- "column_break_4",
- "inpatient_record",
- "company",
- "invoiced",
- "section_break_6",
- "sample",
- "sample_uom",
- "sample_qty",
- "column_break_10",
- "collected_by",
- "collected_time",
- "num_print",
- "section_break_15",
- "sample_details",
- "amended_from"
- ],
- "fields": [
- {
- "fetch_from": "patient.inpatient_record",
- "fieldname": "inpatient_record",
- "fieldtype": "Link",
- "hide_days": 1,
- "hide_seconds": 1,
- "label": "Inpatient Record",
- "options": "Inpatient Record",
- "read_only": 1
- },
- {
- "bold": 1,
- "fieldname": "naming_series",
- "fieldtype": "Select",
- "hide_days": 1,
- "hide_seconds": 1,
- "label": "Series",
- "no_copy": 1,
- "options": "HLC-SC-.YYYY.-",
- "print_hide": 1,
- "reqd": 1
- },
- {
- "default": "0",
- "fieldname": "invoiced",
- "fieldtype": "Check",
- "hide_days": 1,
- "hide_seconds": 1,
- "label": "Invoiced",
- "no_copy": 1,
- "read_only": 1,
- "search_index": 1
- },
- {
- "fetch_from": "inpatient_record.patient",
- "fieldname": "patient",
- "fieldtype": "Link",
- "hide_days": 1,
- "hide_seconds": 1,
- "ignore_user_permissions": 1,
- "in_standard_filter": 1,
- "label": "Patient",
- "options": "Patient",
- "reqd": 1,
- "search_index": 1
- },
- {
- "fieldname": "column_break_4",
- "fieldtype": "Column Break",
- "hide_days": 1,
- "hide_seconds": 1
- },
- {
- "fieldname": "patient_age",
- "fieldtype": "Data",
- "hide_days": 1,
- "hide_seconds": 1,
- "label": "Age",
- "read_only": 1
- },
- {
- "fetch_from": "patient.sex",
- "fieldname": "patient_sex",
- "fieldtype": "Link",
- "hide_days": 1,
- "hide_seconds": 1,
- "label": "Gender",
- "options": "Gender",
- "read_only": 1
- },
- {
- "fieldname": "company",
- "fieldtype": "Link",
- "hide_days": 1,
- "hide_seconds": 1,
- "in_standard_filter": 1,
- "label": "Company",
- "options": "Company"
- },
- {
- "fieldname": "section_break_6",
- "fieldtype": "Section Break",
- "hide_days": 1,
- "hide_seconds": 1,
- "label": "Sample Details"
- },
- {
- "fieldname": "sample",
- "fieldtype": "Link",
- "hide_days": 1,
- "hide_seconds": 1,
- "ignore_user_permissions": 1,
- "in_list_view": 1,
- "in_standard_filter": 1,
- "label": "Sample",
- "options": "Lab Test Sample",
- "reqd": 1,
- "search_index": 1
- },
- {
- "fetch_from": "sample.sample_uom",
- "fieldname": "sample_uom",
- "fieldtype": "Data",
- "hide_days": 1,
- "hide_seconds": 1,
- "in_list_view": 1,
- "label": "UOM",
- "read_only": 1
- },
- {
- "fieldname": "column_break_10",
- "fieldtype": "Column Break",
- "hide_days": 1,
- "hide_seconds": 1
- },
- {
- "fieldname": "collected_by",
- "fieldtype": "Link",
- "hide_days": 1,
- "hide_seconds": 1,
- "ignore_user_permissions": 1,
- "label": "Collected By",
- "options": "User"
- },
- {
- "fieldname": "collected_time",
- "fieldtype": "Datetime",
- "hide_days": 1,
- "hide_seconds": 1,
- "label": "Collected On"
- },
- {
- "allow_on_submit": 1,
- "default": "1",
- "description": "Number of prints required for labelling the samples",
- "fieldname": "num_print",
- "fieldtype": "Int",
- "hide_days": 1,
- "hide_seconds": 1,
- "label": "No. of prints",
- "print_hide": 1,
- "report_hide": 1
- },
- {
- "fieldname": "amended_from",
- "fieldtype": "Link",
- "hide_days": 1,
- "hide_seconds": 1,
- "label": "Amended From",
- "no_copy": 1,
- "options": "Sample Collection",
- "print_hide": 1,
- "read_only": 1
- },
- {
- "fieldname": "section_break_15",
- "fieldtype": "Section Break",
- "hide_days": 1,
- "hide_seconds": 1
- },
- {
- "default": "0",
- "fieldname": "sample_qty",
- "fieldtype": "Float",
- "hide_days": 1,
- "hide_seconds": 1,
- "in_list_view": 1,
- "label": "Quantity"
- },
- {
- "fieldname": "sample_details",
- "fieldtype": "Long Text",
- "hide_days": 1,
- "hide_seconds": 1,
- "ignore_xss_filter": 1,
- "label": "Collection Details"
- },
- {
- "fieldname": "patient_details_section",
- "fieldtype": "Section Break",
- "label": "Patient Details"
- },
- {
- "fetch_from": "patient.patient_name",
- "fieldname": "patient_name",
- "fieldtype": "Data",
- "label": "Patient Name",
- "read_only": 1
- }
- ],
- "is_submittable": 1,
- "links": [],
- "modified": "2020-07-30 16:53:13.076104",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Sample Collection",
- "owner": "Administrator",
- "permissions": [
- {
- "amend": 1,
- "cancel": 1,
- "create": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Laboratory User",
- "share": 1,
- "submit": 1,
- "write": 1
- }
- ],
- "restrict_to_domain": "Healthcare",
- "search_fields": "patient, sample",
- "show_name_in_global_search": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "title_field": "patient",
- "track_changes": 1,
- "track_seen": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/sample_collection/sample_collection.py b/erpnext/healthcare/doctype/sample_collection/sample_collection.py
deleted file mode 100644
index 7de6ac08ca..0000000000
--- a/erpnext/healthcare/doctype/sample_collection/sample_collection.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, ESS and contributors
-# For license information, please see license.txt
-
-from __future__ import unicode_literals
-
-import frappe
-from frappe import _
-from frappe.model.document import Document
-from frappe.utils import flt
-
-
-class SampleCollection(Document):
- def validate(self):
- if flt(self.sample_qty) <= 0:
- frappe.throw(_('Sample Quantity cannot be negative or 0'), title=_('Invalid Quantity'))
diff --git a/erpnext/healthcare/doctype/sample_collection/test_sample_collection.py b/erpnext/healthcare/doctype/sample_collection/test_sample_collection.py
deleted file mode 100644
index 0b16173dd5..0000000000
--- a/erpnext/healthcare/doctype/sample_collection/test_sample_collection.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, ESS and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-import unittest
-
-# test_records = frappe.get_test_records('Sample Collection')
-
-class TestSampleCollection(unittest.TestCase):
- pass
diff --git a/erpnext/healthcare/doctype/sensitivity/__init__.py b/erpnext/healthcare/doctype/sensitivity/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/sensitivity/sensitivity.js b/erpnext/healthcare/doctype/sensitivity/sensitivity.js
deleted file mode 100644
index f9c9002fe6..0000000000
--- a/erpnext/healthcare/doctype/sensitivity/sensitivity.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (c) 2016, ESS LLP and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Sensitivity', {
-});
diff --git a/erpnext/healthcare/doctype/sensitivity/sensitivity.json b/erpnext/healthcare/doctype/sensitivity/sensitivity.json
deleted file mode 100644
index eddfda9056..0000000000
--- a/erpnext/healthcare/doctype/sensitivity/sensitivity.json
+++ /dev/null
@@ -1,115 +0,0 @@
-{
- "allow_copy": 1,
- "allow_guest_to_view": 0,
- "allow_import": 1,
- "allow_rename": 1,
- "autoname": "field:sensitivity",
- "beta": 1,
- "creation": "2016-02-23 11:12:54.623249",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "Setup",
- "editable_grid": 0,
- "fields": [
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "sensitivity",
- "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": "Sensitivity",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 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:19:12.110308",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Sensitivity",
- "name_case": "",
- "owner": "Administrator",
- "permissions": [
- {
- "amend": 0,
- "apply_user_permissions": 0,
- "cancel": 0,
- "create": 0,
- "delete": 0,
- "email": 1,
- "export": 1,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Laboratory User",
- "set_user_permissions": 0,
- "share": 1,
- "submit": 0,
- "write": 0
- },
- {
- "amend": 0,
- "apply_user_permissions": 0,
- "cancel": 0,
- "create": 1,
- "delete": 1,
- "email": 1,
- "export": 1,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Healthcare Administrator",
- "set_user_permissions": 0,
- "share": 1,
- "submit": 0,
- "write": 1
- }
- ],
- "quick_entry": 1,
- "read_only": 0,
- "read_only_onload": 0,
- "restrict_to_domain": "Healthcare",
- "search_fields": "sensitivity",
- "show_name_in_global_search": 0,
- "sort_field": "modified",
- "sort_order": "DESC",
- "title_field": "sensitivity",
- "track_changes": 1,
- "track_seen": 0
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/sensitivity/sensitivity.py b/erpnext/healthcare/doctype/sensitivity/sensitivity.py
deleted file mode 100644
index f61781d3f8..0000000000
--- a/erpnext/healthcare/doctype/sensitivity/sensitivity.py
+++ /dev/null
@@ -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 Sensitivity(Document):
- pass
diff --git a/erpnext/healthcare/doctype/sensitivity/test_sensitivity.py b/erpnext/healthcare/doctype/sensitivity/test_sensitivity.py
deleted file mode 100644
index c772c72faf..0000000000
--- a/erpnext/healthcare/doctype/sensitivity/test_sensitivity.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, ESS and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-import unittest
-
-# test_records = frappe.get_test_records('Sensitivity')
-
-class TestSensitivity(unittest.TestCase):
- pass
diff --git a/erpnext/healthcare/doctype/sensitivity_test_result/__init__.py b/erpnext/healthcare/doctype/sensitivity_test_result/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.json b/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.json
deleted file mode 100644
index 768c17710f..0000000000
--- a/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.json
+++ /dev/null
@@ -1,103 +0,0 @@
-{
- "allow_copy": 1,
- "allow_guest_to_view": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "beta": 1,
- "creation": "2016-02-22 15:18:01.769903",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "Document",
- "editable_grid": 1,
- "fields": [
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "antibiotic",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 1,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Antibiotic",
- "length": 0,
- "no_copy": 0,
- "options": "Antibiotic",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "antibiotic_sensitivity",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 1,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Sensitivity",
- "length": 0,
- "no_copy": 0,
- "options": "Sensitivity",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- }
- ],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 0,
- "idx": 0,
- "image_view": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 1,
- "max_attachments": 0,
- "modified": "2017-10-05 11:08:06.327972",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Sensitivity Test Result",
- "name_case": "",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 0,
- "read_only": 0,
- "read_only_onload": 0,
- "restrict_to_domain": "Healthcare",
- "show_name_in_global_search": 0,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 0,
- "track_seen": 0
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.py b/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.py
deleted file mode 100644
index 53f7acc4af..0000000000
--- a/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.py
+++ /dev/null
@@ -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 SensitivityTestResult(Document):
- pass
diff --git a/erpnext/healthcare/doctype/therapy_plan/__init__.py b/erpnext/healthcare/doctype/therapy_plan/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/therapy_plan/test_therapy_plan.py b/erpnext/healthcare/doctype/therapy_plan/test_therapy_plan.py
deleted file mode 100644
index 4f96f6a706..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan/test_therapy_plan.py
+++ /dev/null
@@ -1,118 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-import unittest
-
-import frappe
-from frappe.utils import flt, getdate, nowdate
-
-from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import (
- create_appointment,
- create_healthcare_docs,
- create_medical_department,
- create_patient,
-)
-from erpnext.healthcare.doctype.therapy_plan.therapy_plan import (
- make_sales_invoice,
- make_therapy_session,
-)
-from erpnext.healthcare.doctype.therapy_type.test_therapy_type import create_therapy_type
-
-
-class TestTherapyPlan(unittest.TestCase):
- def test_creation_on_encounter_submission(self):
- patient, practitioner = create_healthcare_docs()
- medical_department = create_medical_department()
- encounter = create_encounter(patient, medical_department, practitioner)
- self.assertTrue(frappe.db.exists('Therapy Plan', encounter.therapy_plan))
-
- def test_status(self):
- plan = create_therapy_plan()
- self.assertEqual(plan.status, 'Not Started')
-
- session = make_therapy_session(plan.name, plan.patient, 'Basic Rehab', '_Test Company')
- frappe.get_doc(session).submit()
- self.assertEqual(frappe.db.get_value('Therapy Plan', plan.name, 'status'), 'In Progress')
-
- session = make_therapy_session(plan.name, plan.patient, 'Basic Rehab', '_Test Company')
- frappe.get_doc(session).submit()
- self.assertEqual(frappe.db.get_value('Therapy Plan', plan.name, 'status'), 'Completed')
-
- patient, practitioner = create_healthcare_docs()
- appointment = create_appointment(patient, practitioner, nowdate())
-
- session = make_therapy_session(plan.name, plan.patient, 'Basic Rehab', '_Test Company', appointment.name)
- session = frappe.get_doc(session)
- session.submit()
- self.assertEqual(frappe.db.get_value('Patient Appointment', appointment.name, 'status'), 'Closed')
- session.cancel()
- self.assertEqual(frappe.db.get_value('Patient Appointment', appointment.name, 'status'), 'Open')
-
- def test_therapy_plan_from_template(self):
- patient = create_patient()
- template = create_therapy_plan_template()
- # check linked item
- self.assertTrue(frappe.db.exists('Therapy Plan Template', {'linked_item': 'Complete Rehab'}))
-
- plan = create_therapy_plan(template)
- # invoice
- si = make_sales_invoice(plan.name, patient, '_Test Company', template)
- si.save()
-
- therapy_plan_template_amt = frappe.db.get_value('Therapy Plan Template', template, 'total_amount')
- self.assertEqual(si.items[0].amount, therapy_plan_template_amt)
-
-
-def create_therapy_plan(template=None):
- patient = create_patient()
- therapy_type = create_therapy_type()
- plan = frappe.new_doc('Therapy Plan')
- plan.patient = patient
- plan.start_date = getdate()
-
- if template:
- plan.therapy_plan_template = template
- plan = plan.set_therapy_details_from_template()
- else:
- plan.append('therapy_plan_details', {
- 'therapy_type': therapy_type.name,
- 'no_of_sessions': 2
- })
-
- plan.save()
- return plan
-
-def create_encounter(patient, medical_department, practitioner):
- encounter = frappe.new_doc('Patient Encounter')
- encounter.patient = patient
- encounter.practitioner = practitioner
- encounter.medical_department = medical_department
- therapy_type = create_therapy_type()
- encounter.append('therapies', {
- 'therapy_type': therapy_type.name,
- 'no_of_sessions': 2
- })
- encounter.save()
- encounter.submit()
- return encounter
-
-def create_therapy_plan_template():
- template_name = frappe.db.exists('Therapy Plan Template', 'Complete Rehab')
- if not template_name:
- therapy_type = create_therapy_type()
- template = frappe.new_doc('Therapy Plan Template')
- template.plan_name = template.item_code = template.item_name = 'Complete Rehab'
- template.item_group = 'Services'
- rate = frappe.db.get_value('Therapy Type', therapy_type.name, 'rate')
- template.append('therapy_types', {
- 'therapy_type': therapy_type.name,
- 'no_of_sessions': 2,
- 'rate': rate,
- 'amount': 2 * flt(rate)
- })
- template.save()
- template_name = template.name
-
- return template_name
diff --git a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.js b/erpnext/healthcare/doctype/therapy_plan/therapy_plan.js
deleted file mode 100644
index 42e231dc66..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.js
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Therapy Plan', {
- setup: function(frm) {
- frm.get_field('therapy_plan_details').grid.editable_fields = [
- {fieldname: 'therapy_type', columns: 6},
- {fieldname: 'no_of_sessions', columns: 2},
- {fieldname: 'sessions_completed', columns: 2}
- ];
- },
-
- refresh: function(frm) {
- if (!frm.doc.__islocal) {
- frm.trigger('show_progress_for_therapies');
- if (frm.doc.status != 'Completed') {
- let therapy_types = (frm.doc.therapy_plan_details || []).map(function(d){ return d.therapy_type; });
- const fields = [{
- fieldtype: 'Link',
- label: __('Therapy Type'),
- fieldname: 'therapy_type',
- options: 'Therapy Type',
- reqd: 1,
- get_query: function() {
- return {
- filters: { 'therapy_type': ['in', therapy_types]}
- };
- }
- }];
-
- frm.add_custom_button(__('Therapy Session'), function() {
- frappe.prompt(fields, data => {
- frappe.call({
- method: 'erpnext.healthcare.doctype.therapy_plan.therapy_plan.make_therapy_session',
- args: {
- therapy_plan: frm.doc.name,
- patient: frm.doc.patient,
- therapy_type: data.therapy_type,
- company: frm.doc.company
- },
- freeze: true,
- callback: function(r) {
- if (r.message) {
- frappe.model.sync(r.message);
- frappe.set_route('Form', r.message.doctype, r.message.name);
- }
- }
- });
- }, __('Select Therapy Type'), __('Create'));
- }, __('Create'));
- }
-
- if (frm.doc.therapy_plan_template && !frm.doc.invoiced) {
- frm.add_custom_button(__('Sales Invoice'), function() {
- frm.trigger('make_sales_invoice');
- }, __('Create'));
- }
- }
-
- if (frm.doc.therapy_plan_template) {
- frm.fields_dict.therapy_plan_details.grid.update_docfield_property(
- 'therapy_type', 'read_only', 1
- );
- frm.fields_dict.therapy_plan_details.grid.update_docfield_property(
- 'no_of_sessions', 'read_only', 1
- );
- }
- },
-
- make_sales_invoice: function(frm) {
- frappe.call({
- args: {
- 'reference_name': frm.doc.name,
- 'patient': frm.doc.patient,
- 'company': frm.doc.company,
- 'therapy_plan_template': frm.doc.therapy_plan_template
- },
- method: 'erpnext.healthcare.doctype.therapy_plan.therapy_plan.make_sales_invoice',
- callback: function(r) {
- var doclist = frappe.model.sync(r.message);
- frappe.set_route('Form', doclist[0].doctype, doclist[0].name);
- }
- });
- },
-
- therapy_plan_template: function(frm) {
- if (frm.doc.therapy_plan_template) {
- frappe.call({
- method: 'set_therapy_details_from_template',
- doc: frm.doc,
- freeze: true,
- freeze_message: __('Fetching Template Details'),
- callback: function() {
- refresh_field('therapy_plan_details');
- }
- });
- }
- },
-
- show_progress_for_therapies: function(frm) {
- let bars = [];
- let message = '';
-
- // completed sessions
- let title = __('{0} sessions completed', [frm.doc.total_sessions_completed]);
- if (frm.doc.total_sessions_completed === 1) {
- title = __('{0} session completed', [frm.doc.total_sessions_completed]);
- }
- title += __(' out of {0}', [frm.doc.total_sessions]);
-
- bars.push({
- 'title': title,
- 'width': (frm.doc.total_sessions_completed / frm.doc.total_sessions * 100) + '%',
- 'progress_class': 'progress-bar-success'
- });
- if (bars[0].width == '0%') {
- bars[0].width = '0.5%';
- }
- message = title;
- frm.dashboard.add_progress(__('Status'), bars, message);
- },
-});
-
-frappe.ui.form.on('Therapy Plan Detail', {
- no_of_sessions: function(frm) {
- let total = 0;
- $.each(frm.doc.therapy_plan_details, function(_i, e) {
- total += e.no_of_sessions;
- });
- frm.set_value('total_sessions', total);
- refresh_field('total_sessions');
- }
-});
diff --git a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.json b/erpnext/healthcare/doctype/therapy_plan/therapy_plan.json
deleted file mode 100644
index c03e9de332..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.json
+++ /dev/null
@@ -1,179 +0,0 @@
-{
- "actions": [],
- "autoname": "naming_series:",
- "creation": "2020-03-29 20:56:49.758602",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "naming_series",
- "patient",
- "patient_name",
- "invoiced",
- "column_break_4",
- "company",
- "status",
- "start_date",
- "section_break_3",
- "therapy_plan_template",
- "therapy_plan_details",
- "title",
- "section_break_9",
- "total_sessions",
- "column_break_11",
- "total_sessions_completed"
- ],
- "fields": [
- {
- "fieldname": "patient",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Patient",
- "options": "Patient",
- "reqd": 1
- },
- {
- "fieldname": "start_date",
- "fieldtype": "Date",
- "in_list_view": 1,
- "label": "Start Date",
- "reqd": 1
- },
- {
- "fieldname": "section_break_3",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "therapy_plan_details",
- "fieldtype": "Table",
- "label": "Therapy Plan Details",
- "options": "Therapy Plan Detail",
- "read_only_depends_on": "therapy_plan_template",
- "reqd": 1
- },
- {
- "fieldname": "naming_series",
- "fieldtype": "Select",
- "label": "Naming Series",
- "options": "HLC-THP-.YYYY.-"
- },
- {
- "fetch_from": "patient.patient_name",
- "fieldname": "patient_name",
- "fieldtype": "Data",
- "label": "Patient Name",
- "read_only": 1
- },
- {
- "default": "{patient_name}",
- "fieldname": "title",
- "fieldtype": "Data",
- "hidden": 1,
- "label": "Title",
- "no_copy": 1
- },
- {
- "fieldname": "column_break_4",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "section_break_9",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "total_sessions",
- "fieldtype": "Int",
- "label": "Total Sessions",
- "read_only": 1
- },
- {
- "fieldname": "column_break_11",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "total_sessions_completed",
- "fieldtype": "Int",
- "label": "Total Sessions Completed",
- "read_only": 1
- },
- {
- "fieldname": "status",
- "fieldtype": "Select",
- "label": "Status",
- "options": "Not Started\nIn Progress\nCompleted\nCancelled",
- "read_only": 1
- },
- {
- "fieldname": "company",
- "fieldtype": "Link",
- "in_standard_filter": 1,
- "label": "Company",
- "options": "Company",
- "reqd": 1
- },
- {
- "fieldname": "therapy_plan_template",
- "fieldtype": "Link",
- "label": "Therapy Plan Template",
- "options": "Therapy Plan Template",
- "set_only_once": 1
- },
- {
- "default": "0",
- "fieldname": "invoiced",
- "fieldtype": "Check",
- "label": "Invoiced",
- "no_copy": 1,
- "print_hide": 1,
- "read_only": 1
- }
- ],
- "links": [],
- "modified": "2020-11-04 18:13:13.564999",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Therapy Plan",
- "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": "Physician",
- "share": 1,
- "write": 1
- }
- ],
- "quick_entry": 1,
- "search_fields": "patient",
- "sort_field": "modified",
- "sort_order": "DESC",
- "title_field": "patient",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.py b/erpnext/healthcare/doctype/therapy_plan/therapy_plan.py
deleted file mode 100644
index 6d63f39189..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.py
+++ /dev/null
@@ -1,103 +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
-from frappe.utils import flt, today
-
-
-class TherapyPlan(Document):
- def validate(self):
- self.set_totals()
- self.set_status()
-
- def set_status(self):
- if not self.total_sessions_completed:
- self.status = 'Not Started'
- else:
- if self.total_sessions_completed < self.total_sessions:
- self.status = 'In Progress'
- elif self.total_sessions_completed == self.total_sessions:
- self.status = 'Completed'
-
- def set_totals(self):
- total_sessions = 0
- total_sessions_completed = 0
- for entry in self.therapy_plan_details:
- if entry.no_of_sessions:
- total_sessions += entry.no_of_sessions
- if entry.sessions_completed:
- total_sessions_completed += entry.sessions_completed
-
- self.db_set('total_sessions', total_sessions)
- self.db_set('total_sessions_completed', total_sessions_completed)
-
- @frappe.whitelist()
- def set_therapy_details_from_template(self):
- # Add therapy types in the child table
- self.set('therapy_plan_details', [])
- therapy_plan_template = frappe.get_doc('Therapy Plan Template', self.therapy_plan_template)
-
- for data in therapy_plan_template.therapy_types:
- self.append('therapy_plan_details', {
- 'therapy_type': data.therapy_type,
- 'no_of_sessions': data.no_of_sessions
- })
- return self
-
-
-@frappe.whitelist()
-def make_therapy_session(therapy_plan, patient, therapy_type, company, appointment=None):
- therapy_type = frappe.get_doc('Therapy Type', therapy_type)
-
- therapy_session = frappe.new_doc('Therapy Session')
- therapy_session.therapy_plan = therapy_plan
- therapy_session.company = company
- therapy_session.patient = patient
- therapy_session.therapy_type = therapy_type.name
- therapy_session.duration = therapy_type.default_duration
- therapy_session.rate = therapy_type.rate
- therapy_session.exercises = therapy_type.exercises
- therapy_session.appointment = appointment
-
- if frappe.flags.in_test:
- therapy_session.start_date = today()
- return therapy_session.as_dict()
-
-
-@frappe.whitelist()
-def make_sales_invoice(reference_name, patient, company, therapy_plan_template):
- from erpnext.stock.get_item_details import get_item_details
- si = frappe.new_doc('Sales Invoice')
- si.company = company
- si.patient = patient
- si.customer = frappe.db.get_value('Patient', patient, 'customer')
-
- item = frappe.db.get_value('Therapy Plan Template', therapy_plan_template, 'linked_item')
- price_list, price_list_currency = frappe.db.get_values('Price List', {'selling': 1}, ['name', 'currency'])[0]
- args = {
- 'doctype': 'Sales Invoice',
- 'item_code': item,
- 'company': company,
- 'customer': si.customer,
- 'selling_price_list': price_list,
- 'price_list_currency': price_list_currency,
- 'plc_conversion_rate': 1.0,
- 'conversion_rate': 1.0
- }
-
- item_line = si.append('items', {})
- item_details = get_item_details(args)
- item_line.item_code = item
- item_line.qty = 1
- item_line.rate = item_details.price_list_rate
- item_line.amount = flt(item_line.rate) * flt(item_line.qty)
- item_line.reference_dt = 'Therapy Plan'
- item_line.reference_dn = reference_name
- item_line.description = item_details.description
-
- si.set_missing_values(for_validate = True)
- return si
diff --git a/erpnext/healthcare/doctype/therapy_plan/therapy_plan_dashboard.py b/erpnext/healthcare/doctype/therapy_plan/therapy_plan_dashboard.py
deleted file mode 100644
index 25c8df1d6b..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan/therapy_plan_dashboard.py
+++ /dev/null
@@ -1,23 +0,0 @@
-from __future__ import unicode_literals
-
-from frappe import _
-
-
-def get_data():
- return {
- 'fieldname': 'therapy_plan',
- 'non_standard_fieldnames': {
- 'Sales Invoice': 'reference_dn'
- },
- 'transactions': [
- {
- 'label': _('Therapy Sessions'),
- 'items': ['Therapy Session']
- },
- {
- 'label': _('Billing'),
- 'items': ['Sales Invoice']
- }
- ],
- 'disable_create_buttons': ['Sales Invoice']
- }
diff --git a/erpnext/healthcare/doctype/therapy_plan/therapy_plan_list.js b/erpnext/healthcare/doctype/therapy_plan/therapy_plan_list.js
deleted file mode 100644
index 63967aff33..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan/therapy_plan_list.js
+++ /dev/null
@@ -1,11 +0,0 @@
-frappe.listview_settings['Therapy Plan'] = {
- get_indicator: function(doc) {
- var colors = {
- 'Completed': 'green',
- 'In Progress': 'orange',
- 'Not Started': 'red',
- 'Cancelled': 'grey'
- };
- return [__(doc.status), colors[doc.status], 'status,=,' + doc.status];
- }
-};
diff --git a/erpnext/healthcare/doctype/therapy_plan_detail/__init__.py b/erpnext/healthcare/doctype/therapy_plan_detail/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/therapy_plan_detail/therapy_plan_detail.json b/erpnext/healthcare/doctype/therapy_plan_detail/therapy_plan_detail.json
deleted file mode 100644
index 77f08af07d..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan_detail/therapy_plan_detail.json
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "actions": [],
- "creation": "2020-03-29 20:52:57.068731",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "therapy_type",
- "no_of_sessions",
- "sessions_completed"
- ],
- "fields": [
- {
- "fieldname": "therapy_type",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Therapy Type",
- "options": "Therapy Type",
- "reqd": 1
- },
- {
- "fieldname": "no_of_sessions",
- "fieldtype": "Int",
- "in_list_view": 1,
- "label": "No of Sessions"
- },
- {
- "default": "0",
- "depends_on": "eval:doc.parenttype=='Therapy Plan';",
- "fieldname": "sessions_completed",
- "fieldtype": "Int",
- "label": "Sessions Completed",
- "no_copy": 1,
- "read_only": 1
- }
- ],
- "istable": 1,
- "links": [],
- "modified": "2020-11-04 18:15:52.173450",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Therapy Plan Detail",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/therapy_plan_detail/therapy_plan_detail.py b/erpnext/healthcare/doctype/therapy_plan_detail/therapy_plan_detail.py
deleted file mode 100644
index 1842fc2197..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan_detail/therapy_plan_detail.py
+++ /dev/null
@@ -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 TherapyPlanDetail(Document):
- pass
diff --git a/erpnext/healthcare/doctype/therapy_plan_template/__init__.py b/erpnext/healthcare/doctype/therapy_plan_template/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/therapy_plan_template/test_therapy_plan_template.py b/erpnext/healthcare/doctype/therapy_plan_template/test_therapy_plan_template.py
deleted file mode 100644
index cd3d5686bc..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan_template/test_therapy_plan_template.py
+++ /dev/null
@@ -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 TestTherapyPlanTemplate(unittest.TestCase):
- pass
diff --git a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.js b/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.js
deleted file mode 100644
index 86de1928e2..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.js
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Therapy Plan Template', {
- refresh: function(frm) {
- frm.set_query('therapy_type', 'therapy_types', () => {
- return {
- filters: {
- 'is_billable': 1
- }
- };
- });
- },
-
- set_totals: function(frm) {
- let total_sessions = 0;
- let total_amount = 0.0;
- frm.doc.therapy_types.forEach((d) => {
- if (d.no_of_sessions) total_sessions += cint(d.no_of_sessions);
- if (d.amount) total_amount += flt(d.amount);
- });
- frm.set_value('total_sessions', total_sessions);
- frm.set_value('total_amount', total_amount);
- frm.refresh_fields();
- }
-});
-
-frappe.ui.form.on('Therapy Plan Template Detail', {
- therapy_type: function(frm, cdt, cdn) {
- let row = locals[cdt][cdn];
- frappe.call('frappe.client.get', {
- doctype: 'Therapy Type',
- name: row.therapy_type
- }).then((res) => {
- row.rate = res.message.rate;
- if (!row.no_of_sessions)
- row.no_of_sessions = 1;
- row.amount = flt(row.rate) * cint(row.no_of_sessions);
- frm.refresh_field('therapy_types');
- frm.trigger('set_totals');
- });
- },
-
- no_of_sessions: function(frm, cdt, cdn) {
- let row = locals[cdt][cdn];
- row.amount = flt(row.rate) * cint(row.no_of_sessions);
- frm.refresh_field('therapy_types');
- frm.trigger('set_totals');
- },
-
- rate: function(frm, cdt, cdn) {
- let row = locals[cdt][cdn];
- row.amount = flt(row.rate) * cint(row.no_of_sessions);
- frm.refresh_field('therapy_types');
- frm.trigger('set_totals');
- }
-});
diff --git a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.json b/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.json
deleted file mode 100644
index 48fc896257..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.json
+++ /dev/null
@@ -1,132 +0,0 @@
-{
- "actions": [],
- "autoname": "field:plan_name",
- "creation": "2020-09-22 17:51:38.861055",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "plan_name",
- "linked_item_details_section",
- "item_code",
- "item_name",
- "item_group",
- "column_break_6",
- "description",
- "linked_item",
- "therapy_types_section",
- "therapy_types",
- "section_break_11",
- "total_sessions",
- "column_break_13",
- "total_amount"
- ],
- "fields": [
- {
- "fieldname": "plan_name",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Plan Name",
- "reqd": 1,
- "unique": 1
- },
- {
- "fieldname": "therapy_types_section",
- "fieldtype": "Section Break",
- "label": "Therapy Types"
- },
- {
- "fieldname": "therapy_types",
- "fieldtype": "Table",
- "label": "Therapy Types",
- "options": "Therapy Plan Template Detail",
- "reqd": 1
- },
- {
- "fieldname": "linked_item",
- "fieldtype": "Link",
- "label": "Linked Item",
- "options": "Item",
- "read_only": 1
- },
- {
- "fieldname": "linked_item_details_section",
- "fieldtype": "Section Break",
- "label": "Linked Item Details"
- },
- {
- "fieldname": "item_code",
- "fieldtype": "Data",
- "label": "Item Code",
- "reqd": 1,
- "set_only_once": 1
- },
- {
- "fieldname": "item_name",
- "fieldtype": "Data",
- "label": "Item Name",
- "reqd": 1
- },
- {
- "fieldname": "item_group",
- "fieldtype": "Link",
- "label": "Item Group",
- "options": "Item Group",
- "reqd": 1
- },
- {
- "fieldname": "column_break_6",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "description",
- "fieldtype": "Small Text",
- "label": "Item Description"
- },
- {
- "fieldname": "total_amount",
- "fieldtype": "Currency",
- "label": "Total Amount",
- "read_only": 1
- },
- {
- "fieldname": "section_break_11",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "total_sessions",
- "fieldtype": "Int",
- "label": "Total Sessions",
- "read_only": 1
- },
- {
- "fieldname": "column_break_13",
- "fieldtype": "Column Break"
- }
- ],
- "index_web_pages_for_search": 1,
- "links": [],
- "modified": "2020-10-08 00:56:58.062105",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Therapy Plan Template",
- "owner": "Administrator",
- "permissions": [
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "System Manager",
- "share": 1,
- "write": 1
- }
- ],
- "quick_entry": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.py b/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.py
deleted file mode 100644
index f5512be207..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.py
+++ /dev/null
@@ -1,76 +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
-from frappe.utils import cint, flt
-
-from erpnext.healthcare.doctype.therapy_type.therapy_type import make_item_price
-
-
-class TherapyPlanTemplate(Document):
- def after_insert(self):
- self.create_item_from_template()
-
- def validate(self):
- self.set_totals()
-
- def on_update(self):
- doc_before_save = self.get_doc_before_save()
- if not doc_before_save: return
- if doc_before_save.item_name != self.item_name or doc_before_save.item_group != self.item_group \
- or doc_before_save.description != self.description:
- self.update_item()
-
- if doc_before_save.therapy_types != self.therapy_types:
- self.update_item_price()
-
- def set_totals(self):
- total_sessions = 0
- total_amount = 0
-
- for entry in self.therapy_types:
- total_sessions += cint(entry.no_of_sessions)
- total_amount += flt(entry.amount)
-
- self.total_sessions = total_sessions
- self.total_amount = total_amount
-
- def create_item_from_template(self):
- uom = frappe.db.exists('UOM', 'Nos') or frappe.db.get_single_value('Stock Settings', 'stock_uom')
-
- item = frappe.get_doc({
- 'doctype': 'Item',
- 'item_code': self.item_code,
- 'item_name': self.item_name,
- 'item_group': self.item_group,
- 'description': self.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,
- 'stock_uom': uom
- }).insert(ignore_permissions=True, ignore_mandatory=True)
-
- make_item_price(item.name, self.total_amount)
- self.db_set('linked_item', item.name)
-
- def update_item(self):
- item_doc = frappe.get_doc('Item', {'item_code': self.linked_item})
- item_doc.item_name = self.item_name
- item_doc.item_group = self.item_group
- item_doc.description = self.description
- item_doc.ignore_mandatory = True
- item_doc.save(ignore_permissions=True)
-
- def update_item_price(self):
- item_price = frappe.get_doc('Item Price', {'item_code': self.linked_item})
- item_price.item_name = self.item_name
- item_price.price_list_rate = self.total_amount
- item_price.ignore_mandatory = True
- item_price.save(ignore_permissions=True)
diff --git a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template_dashboard.py b/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template_dashboard.py
deleted file mode 100644
index def5c482d1..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template_dashboard.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from __future__ import unicode_literals
-
-from frappe import _
-
-
-def get_data():
- return {
- 'fieldname': 'therapy_plan_template',
- 'transactions': [
- {
- 'label': _('Therapy Plans'),
- 'items': ['Therapy Plan']
- }
- ]
- }
diff --git a/erpnext/healthcare/doctype/therapy_plan_template_detail/__init__.py b/erpnext/healthcare/doctype/therapy_plan_template_detail/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/therapy_plan_template_detail/therapy_plan_template_detail.json b/erpnext/healthcare/doctype/therapy_plan_template_detail/therapy_plan_template_detail.json
deleted file mode 100644
index 5553a118f8..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan_template_detail/therapy_plan_template_detail.json
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "actions": [],
- "creation": "2020-10-07 23:04:44.373381",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "therapy_type",
- "no_of_sessions",
- "rate",
- "amount"
- ],
- "fields": [
- {
- "fieldname": "therapy_type",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Therapy Type",
- "options": "Therapy Type",
- "reqd": 1
- },
- {
- "fieldname": "no_of_sessions",
- "fieldtype": "Int",
- "in_list_view": 1,
- "label": "No of Sessions"
- },
- {
- "fieldname": "rate",
- "fieldtype": "Currency",
- "in_list_view": 1,
- "label": "Rate"
- },
- {
- "fieldname": "amount",
- "fieldtype": "Currency",
- "in_list_view": 1,
- "label": "Amount",
- "read_only": 1
- }
- ],
- "istable": 1,
- "links": [],
- "modified": "2020-10-07 23:46:54.296322",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Therapy Plan Template Detail",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/therapy_plan_template_detail/therapy_plan_template_detail.py b/erpnext/healthcare/doctype/therapy_plan_template_detail/therapy_plan_template_detail.py
deleted file mode 100644
index 104c1bf28b..0000000000
--- a/erpnext/healthcare/doctype/therapy_plan_template_detail/therapy_plan_template_detail.py
+++ /dev/null
@@ -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 TherapyPlanTemplateDetail(Document):
- pass
diff --git a/erpnext/healthcare/doctype/therapy_session/__init__.py b/erpnext/healthcare/doctype/therapy_session/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/therapy_session/test_therapy_session.py b/erpnext/healthcare/doctype/therapy_session/test_therapy_session.py
deleted file mode 100644
index e4afacf3f0..0000000000
--- a/erpnext/healthcare/doctype/therapy_session/test_therapy_session.py
+++ /dev/null
@@ -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 TestTherapySession(unittest.TestCase):
- pass
diff --git a/erpnext/healthcare/doctype/therapy_session/therapy_session.js b/erpnext/healthcare/doctype/therapy_session/therapy_session.js
deleted file mode 100644
index fbfa774c91..0000000000
--- a/erpnext/healthcare/doctype/therapy_session/therapy_session.js
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Therapy Session', {
- setup: function(frm) {
- frm.get_field('exercises').grid.editable_fields = [
- {fieldname: 'exercise_type', columns: 7},
- {fieldname: 'counts_target', columns: 1},
- {fieldname: 'counts_completed', columns: 1},
- {fieldname: 'assistance_level', columns: 1}
- ];
-
- frm.set_query('service_unit', function() {
- return {
- filters: {
- 'is_group': false,
- 'allow_appointments': true,
- 'company': frm.doc.company
- }
- };
- });
-
- frm.set_query('appointment', function() {
-
- return {
- filters: {
- 'status': ['in', ['Open', 'Scheduled']]
- }
- };
- });
- },
-
- refresh: function(frm) {
- if (frm.doc.therapy_plan) {
- frm.trigger('filter_therapy_types');
- }
-
- if (!frm.doc.__islocal) {
- frm.dashboard.add_indicator(__('Counts Targeted: {0}', [frm.doc.total_counts_targeted]), 'blue');
- frm.dashboard.add_indicator(__('Counts Completed: {0}', [frm.doc.total_counts_completed]),
- (frm.doc.total_counts_completed < frm.doc.total_counts_targeted) ? 'orange' : 'green');
- }
-
- if (frm.doc.docstatus === 1) {
- frm.add_custom_button(__('Patient Assessment'), function() {
- frappe.model.open_mapped_doc({
- method: 'erpnext.healthcare.doctype.patient_assessment.patient_assessment.create_patient_assessment',
- frm: frm,
- })
- }, 'Create');
-
- frappe.db.get_value('Therapy Plan', {'name': frm.doc.therapy_plan}, 'therapy_plan_template', (r) => {
- if (r && !r.therapy_plan_template) {
- frm.add_custom_button(__('Sales Invoice'), function() {
- frappe.model.open_mapped_doc({
- method: 'erpnext.healthcare.doctype.therapy_session.therapy_session.invoice_therapy_session',
- frm: frm,
- });
- }, 'Create');
- }
- });
- }
- },
-
- therapy_plan: function(frm) {
- if (frm.doc.therapy_plan) {
- frm.trigger('filter_therapy_types');
- }
- },
-
- filter_therapy_types: function(frm) {
- frappe.call({
- 'method': 'frappe.client.get',
- args: {
- doctype: 'Therapy Plan',
- name: frm.doc.therapy_plan
- },
- callback: function(data) {
- let therapy_types = (data.message.therapy_plan_details || []).map(function(d){ return d.therapy_type; });
- frm.set_query('therapy_type', function() {
- return {
- filters: { 'therapy_type': ['in', therapy_types]}
- };
- });
- }
- });
- },
-
- 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_age', age);
- frm.set_value('gender', data.message.sex);
- frm.set_value('patient_name', data.message.patient_name);
- }
- });
- } else {
- frm.set_value('patient_age', '');
- frm.set_value('gender', '');
- frm.set_value('patient_name', '');
- }
- },
-
- 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,
- 'therapy_type': data.message.therapy_type,
- 'therapy_plan': data.message.therapy_plan,
- 'practitioner': data.message.practitioner,
- 'department': data.message.department,
- 'start_date': data.message.appointment_date,
- 'start_time': data.message.appointment_time,
- 'service_unit': data.message.service_unit,
- 'company': data.message.company,
- 'duration': data.message.duration
- };
- frm.set_value(values);
- }
- });
- }
- },
-
- therapy_type: function(frm) {
- if (frm.doc.therapy_type) {
- frappe.call({
- 'method': 'frappe.client.get',
- args: {
- doctype: 'Therapy Type',
- name: frm.doc.therapy_type
- },
- callback: function(data) {
- frm.set_value('duration', data.message.default_duration);
- frm.set_value('rate', data.message.rate);
- frm.set_value('service_unit', data.message.healthcare_service_unit);
- frm.set_value('department', data.message.medical_department);
- frm.doc.exercises = [];
- $.each(data.message.exercises, function(_i, e) {
- let exercise = frm.add_child('exercises');
- exercise.exercise_type = e.exercise_type;
- exercise.difficulty_level = e.difficulty_level;
- exercise.counts_target = e.counts_target;
- exercise.assistance_level = e.assistance_level;
- });
- refresh_field('exercises');
- }
- });
- }
- }
-});
diff --git a/erpnext/healthcare/doctype/therapy_session/therapy_session.json b/erpnext/healthcare/doctype/therapy_session/therapy_session.json
deleted file mode 100644
index 0bb2b0ef2a..0000000000
--- a/erpnext/healthcare/doctype/therapy_session/therapy_session.json
+++ /dev/null
@@ -1,264 +0,0 @@
-{
- "actions": [],
- "autoname": "naming_series:",
- "creation": "2020-03-11 08:57:40.669857",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "naming_series",
- "appointment",
- "patient",
- "patient_name",
- "patient_age",
- "gender",
- "column_break_5",
- "company",
- "therapy_plan",
- "therapy_type",
- "practitioner",
- "department",
- "details_section",
- "medical_code",
- "duration",
- "rate",
- "location",
- "column_break_12",
- "service_unit",
- "start_date",
- "start_time",
- "invoiced",
- "exercises_section",
- "exercises",
- "section_break_23",
- "total_counts_targeted",
- "column_break_25",
- "total_counts_completed",
- "amended_from"
- ],
- "fields": [
- {
- "fieldname": "naming_series",
- "fieldtype": "Select",
- "label": "Series",
- "options": "HLC-THP-.YYYY.-"
- },
- {
- "fieldname": "appointment",
- "fieldtype": "Link",
- "label": "Appointment",
- "options": "Patient Appointment",
- "set_only_once": 1
- },
- {
- "fieldname": "patient",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Patient",
- "options": "Patient",
- "reqd": 1
- },
- {
- "fetch_from": "patient.sex",
- "fieldname": "gender",
- "fieldtype": "Link",
- "label": "Gender",
- "options": "Gender",
- "read_only": 1
- },
- {
- "fieldname": "column_break_5",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "practitioner",
- "fieldtype": "Link",
- "label": "Healthcare Practitioner",
- "options": "Healthcare Practitioner"
- },
- {
- "fieldname": "department",
- "fieldtype": "Link",
- "label": "Medical Department",
- "options": "Medical Department"
- },
- {
- "fieldname": "details_section",
- "fieldtype": "Section Break",
- "label": "Details"
- },
- {
- "fetch_from": "therapy_template.default_duration",
- "fieldname": "duration",
- "fieldtype": "Int",
- "label": "Duration",
- "reqd": 1
- },
- {
- "fieldname": "location",
- "fieldtype": "Select",
- "label": "Location",
- "options": "\nCenter\nHome\nTele"
- },
- {
- "fieldname": "column_break_12",
- "fieldtype": "Column Break"
- },
- {
- "fetch_from": "therapy_template.rate",
- "fieldname": "rate",
- "fieldtype": "Currency",
- "label": "Rate"
- },
- {
- "fieldname": "exercises_section",
- "fieldtype": "Section Break",
- "label": "Exercises"
- },
- {
- "fieldname": "exercises",
- "fieldtype": "Table",
- "label": "Exercises",
- "options": "Exercise"
- },
- {
- "depends_on": "eval: doc.therapy_plan",
- "fieldname": "therapy_type",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Therapy Type",
- "options": "Therapy Type",
- "reqd": 1
- },
- {
- "fieldname": "therapy_plan",
- "fieldtype": "Link",
- "label": "Therapy Plan",
- "options": "Therapy Plan",
- "reqd": 1,
- "set_only_once": 1
- },
- {
- "fieldname": "amended_from",
- "fieldtype": "Link",
- "label": "Amended From",
- "no_copy": 1,
- "options": "Therapy Session",
- "print_hide": 1,
- "read_only": 1
- },
- {
- "fieldname": "service_unit",
- "fieldtype": "Link",
- "label": "Healthcare Service Unit",
- "options": "Healthcare Service Unit"
- },
- {
- "fieldname": "start_date",
- "fieldtype": "Date",
- "label": "Start Date",
- "reqd": 1
- },
- {
- "fieldname": "start_time",
- "fieldtype": "Time",
- "label": "Start Time"
- },
- {
- "fieldname": "company",
- "fieldtype": "Link",
- "label": "Company",
- "options": "Company",
- "reqd": 1
- },
- {
- "default": "0",
- "fieldname": "invoiced",
- "fieldtype": "Check",
- "label": "Invoiced",
- "read_only": 1
- },
- {
- "fieldname": "patient_age",
- "fieldtype": "Data",
- "label": "Patient Age",
- "read_only": 1
- },
- {
- "fieldname": "total_counts_targeted",
- "fieldtype": "Int",
- "label": "Total Counts Targeted",
- "read_only": 1
- },
- {
- "fieldname": "total_counts_completed",
- "fieldtype": "Int",
- "label": "Total Counts Completed",
- "no_copy": 1,
- "read_only": 1
- },
- {
- "fieldname": "section_break_23",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "column_break_25",
- "fieldtype": "Column Break"
- },
- {
- "fetch_from": "patient.patient_name",
- "fieldname": "patient_name",
- "fieldtype": "Data",
- "label": "Patient Name",
- "read_only": 1
- },
- {
- "fetch_from": "therapy_type.medical_code",
- "fieldname": "medical_code",
- "fieldtype": "Link",
- "label": "Medical Code",
- "options": "Medical Code",
- "read_only": 1
- }
- ],
- "is_submittable": 1,
- "links": [],
- "modified": "2020-11-04 18:14:25.999939",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Therapy Session",
- "owner": "Administrator",
- "permissions": [
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "System Manager",
- "share": 1,
- "write": 1
- },
- {
- "cancel": 1,
- "create": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Physician",
- "share": 1,
- "submit": 1,
- "write": 1
- }
- ],
- "quick_entry": 1,
- "search_fields": "patient,appointment,therapy_plan,therapy_type",
- "sort_field": "modified",
- "sort_order": "DESC",
- "title_field": "patient",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/therapy_session/therapy_session.py b/erpnext/healthcare/doctype/therapy_session/therapy_session.py
deleted file mode 100644
index 915e6e42f4..0000000000
--- a/erpnext/healthcare/doctype/therapy_session/therapy_session.py
+++ /dev/null
@@ -1,149 +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 datetime
-
-import frappe
-from frappe import _
-from frappe.model.document import Document
-from frappe.model.mapper import get_mapped_doc
-from frappe.utils import flt, get_link_to_form, get_time, getdate
-
-from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import (
- get_income_account,
- get_receivable_account,
-)
-
-
-class TherapySession(Document):
- def validate(self):
- self.validate_duplicate()
- self.set_total_counts()
-
- def validate_duplicate(self):
- end_time = datetime.datetime.combine(getdate(self.start_date), get_time(self.start_time)) \
- + datetime.timedelta(minutes=flt(self.duration))
-
- overlaps = frappe.db.sql("""
- select
- name
- from
- `tabTherapy Session`
- where
- start_date=%s and name!=%s and docstatus!=2
- and (practitioner=%s or patient=%s) and
- ((start_time<%s and start_time + INTERVAL duration MINUTE>%s) or
- (start_time>%s and start_time<%s) or
- (start_time=%s))
- """, (self.start_date, self.name, self.practitioner, self.patient,
- self.start_time, end_time.time(), self.start_time, end_time.time(), self.start_time))
-
- if overlaps:
- overlapping_details = _('Therapy Session overlaps with {0}').format(get_link_to_form('Therapy Session', overlaps[0][0]))
- frappe.throw(overlapping_details, title=_('Therapy Sessions Overlapping'))
-
- def on_submit(self):
- self.update_sessions_count_in_therapy_plan()
-
- def on_update(self):
- if self.appointment:
- frappe.db.set_value('Patient Appointment', self.appointment, 'status', 'Closed')
-
- def on_cancel(self):
- if self.appointment:
- frappe.db.set_value('Patient Appointment', self.appointment, 'status', 'Open')
-
- self.update_sessions_count_in_therapy_plan(on_cancel=True)
-
- def update_sessions_count_in_therapy_plan(self, on_cancel=False):
- therapy_plan = frappe.get_doc('Therapy Plan', self.therapy_plan)
- for entry in therapy_plan.therapy_plan_details:
- if entry.therapy_type == self.therapy_type:
- if on_cancel:
- entry.sessions_completed -= 1
- else:
- entry.sessions_completed += 1
- therapy_plan.save()
-
- def set_total_counts(self):
- target_total = 0
- counts_completed = 0
- for entry in self.exercises:
- if entry.counts_target:
- target_total += entry.counts_target
- if entry.counts_completed:
- counts_completed += entry.counts_completed
-
- self.db_set('total_counts_targeted', target_total)
- self.db_set('total_counts_completed', counts_completed)
-
-
-@frappe.whitelist()
-def create_therapy_session(source_name, target_doc=None):
- def set_missing_values(source, target):
- therapy_type = frappe.get_doc('Therapy Type', source.therapy_type)
- target.exercises = therapy_type.exercises
-
- doc = get_mapped_doc('Patient Appointment', source_name, {
- 'Patient Appointment': {
- 'doctype': 'Therapy Session',
- 'field_map': [
- ['appointment', 'name'],
- ['patient', 'patient'],
- ['patient_age', 'patient_age'],
- ['gender', 'patient_sex'],
- ['therapy_type', 'therapy_type'],
- ['therapy_plan', 'therapy_plan'],
- ['practitioner', 'practitioner'],
- ['department', 'department'],
- ['start_date', 'appointment_date'],
- ['start_time', 'appointment_time'],
- ['service_unit', 'service_unit'],
- ['company', 'company'],
- ['invoiced', 'invoiced']
- ]
- }
- }, target_doc, set_missing_values)
-
- return doc
-
-
-@frappe.whitelist()
-def invoice_therapy_session(source_name, target_doc=None):
- def set_missing_values(source, target):
- target.customer = frappe.db.get_value('Patient', source.patient, 'customer')
- target.due_date = getdate()
- target.debit_to = get_receivable_account(source.company)
- item = target.append('items', {})
- item = get_therapy_item(source, item)
- target.set_missing_values(for_validate=True)
-
- doc = get_mapped_doc('Therapy Session', source_name, {
- 'Therapy Session': {
- 'doctype': 'Sales Invoice',
- 'field_map': [
- ['patient', 'patient'],
- ['referring_practitioner', 'practitioner'],
- ['company', 'company'],
- ['due_date', 'start_date']
- ]
- }
- }, target_doc, set_missing_values)
-
- return doc
-
-
-def get_therapy_item(therapy, item):
- item.item_code = frappe.db.get_value('Therapy Type', therapy.therapy_type, 'item')
- item.description = _('Therapy Session Charges: {0}').format(therapy.practitioner)
- item.income_account = get_income_account(therapy.practitioner, therapy.company)
- item.cost_center = frappe.get_cached_value('Company', therapy.company, 'cost_center')
- item.rate = therapy.rate
- item.amount = therapy.rate
- item.qty = 1
- item.reference_dt = 'Therapy Session'
- item.reference_dn = therapy.name
- return item
diff --git a/erpnext/healthcare/doctype/therapy_session/therapy_session_dashboard.py b/erpnext/healthcare/doctype/therapy_session/therapy_session_dashboard.py
deleted file mode 100644
index b8a37820ba..0000000000
--- a/erpnext/healthcare/doctype/therapy_session/therapy_session_dashboard.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from __future__ import unicode_literals
-
-from frappe import _
-
-
-def get_data():
- return {
- 'fieldname': 'therapy_session',
- 'transactions': [
- {
- 'label': _('Assessments'),
- 'items': ['Patient Assessment']
- }
- ]
- }
diff --git a/erpnext/healthcare/doctype/therapy_type/__init__.py b/erpnext/healthcare/doctype/therapy_type/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/therapy_type/test_therapy_type.py b/erpnext/healthcare/doctype/therapy_type/test_therapy_type.py
deleted file mode 100644
index 23d542236b..0000000000
--- a/erpnext/healthcare/doctype/therapy_type/test_therapy_type.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-import unittest
-
-import frappe
-
-
-class TestTherapyType(unittest.TestCase):
- def test_therapy_type_item(self):
- therapy_type = create_therapy_type()
- self.assertTrue(frappe.db.exists('Item', therapy_type.item))
-
- therapy_type.disabled = 1
- therapy_type.save()
- self.assertEqual(frappe.db.get_value('Item', therapy_type.item, 'disabled'), 1)
-
-def create_therapy_type():
- exercise = create_exercise_type()
- therapy_type = frappe.db.exists('Therapy Type', 'Basic Rehab')
- if not therapy_type:
- therapy_type = frappe.new_doc('Therapy Type')
- therapy_type.therapy_type = 'Basic Rehab'
- therapy_type.default_duration = 30
- therapy_type.is_billable = 1
- therapy_type.rate = 5000
- therapy_type.item_code = 'Basic Rehab'
- therapy_type.item_name = 'Basic Rehab'
- therapy_type.item_group = 'Services'
- therapy_type.append('exercises', {
- 'exercise_type': exercise.name,
- 'counts_target': 10,
- 'assistance_level': 'Passive'
- })
- therapy_type.save()
- else:
- therapy_type = frappe.get_doc('Therapy Type', therapy_type)
-
- return therapy_type
-
-def create_exercise_type():
- exercise_type = frappe.db.exists('Exercise Type', 'Sit to Stand')
- if not exercise_type:
- exercise_type = frappe.new_doc('Exercise Type')
- exercise_type.exercise_name = 'Sit to Stand'
- exercise_type.append('steps_table', {
- 'title': 'Step 1',
- 'description': 'Squat and Rise'
- })
- exercise_type.save()
- else:
- exercise_type = frappe.get_doc('Exercise Type', exercise_type)
-
- return exercise_type
diff --git a/erpnext/healthcare/doctype/therapy_type/therapy_type.js b/erpnext/healthcare/doctype/therapy_type/therapy_type.js
deleted file mode 100644
index 6e155dc21f..0000000000
--- a/erpnext/healthcare/doctype/therapy_type/therapy_type.js
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Therapy Type', {
- setup: function(frm) {
- frm.get_field('exercises').grid.editable_fields = [
- {fieldname: 'exercise_type', columns: 7},
- {fieldname: 'difficulty_level', columns: 1},
- {fieldname: 'counts_target', columns: 1},
- {fieldname: 'assistance_level', columns: 1}
- ];
- },
-
- refresh: function(frm) {
- if (!frm.doc.__islocal) {
- cur_frm.add_custom_button(__('Change Item Code'), function() {
- change_template_code(frm.doc);
- });
- }
- },
-
- therapy_type: function(frm) {
- if (!frm.doc.item_code)
- frm.set_value('item_code', frm.doc.therapy_type);
- if (!frm.doc.description)
- frm.set_value('description', frm.doc.therapy_type);
- 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
- }
- };
- });
- }
-});
-
-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.therapy_type.therapy_type.change_item_code_from_therapy',
- '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
- });
-};
diff --git a/erpnext/healthcare/doctype/therapy_type/therapy_type.json b/erpnext/healthcare/doctype/therapy_type/therapy_type.json
deleted file mode 100644
index f365b1df03..0000000000
--- a/erpnext/healthcare/doctype/therapy_type/therapy_type.json
+++ /dev/null
@@ -1,234 +0,0 @@
-{
- "actions": [],
- "autoname": "field:therapy_type",
- "creation": "2020-03-29 20:48:31.715063",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "disabled",
- "section_break_2",
- "therapy_type",
- "default_duration",
- "medical_department",
- "column_break_3",
- "is_billable",
- "rate",
- "healthcare_service_unit",
- "item_details_section",
- "item",
- "item_code",
- "item_name",
- "item_group",
- "column_break_12",
- "description",
- "medical_coding_section",
- "medical_code_standard",
- "medical_code",
- "section_break_18",
- "therapy_for",
- "add_exercises",
- "section_break_6",
- "exercises",
- "change_in_item"
- ],
- "fields": [
- {
- "fieldname": "therapy_type",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Therapy Type",
- "reqd": 1,
- "unique": 1
- },
- {
- "fieldname": "column_break_3",
- "fieldtype": "Column Break"
- },
- {
- "default": "0",
- "fieldname": "is_billable",
- "fieldtype": "Check",
- "label": "Is Billable"
- },
- {
- "depends_on": "eval:doc.is_billable;",
- "fieldname": "rate",
- "fieldtype": "Currency",
- "label": "Rate",
- "mandatory_depends_on": "eval:doc.is_billable;"
- },
- {
- "fieldname": "section_break_6",
- "fieldtype": "Section Break",
- "label": "Exercises"
- },
- {
- "fieldname": "exercises",
- "fieldtype": "Table",
- "label": "Exercises",
- "options": "Exercise"
- },
- {
- "fieldname": "default_duration",
- "fieldtype": "Int",
- "label": "Default Duration (In Minutes)"
- },
- {
- "default": "0",
- "fieldname": "disabled",
- "fieldtype": "Check",
- "label": "Disabled"
- },
- {
- "fieldname": "item_details_section",
- "fieldtype": "Section Break",
- "label": "Item Details"
- },
- {
- "fieldname": "item",
- "fieldtype": "Link",
- "label": "Item",
- "options": "Item",
- "read_only": 1
- },
- {
- "fieldname": "item_code",
- "fieldtype": "Data",
- "label": "Item Code",
- "reqd": 1,
- "set_only_once": 1
- },
- {
- "fieldname": "item_group",
- "fieldtype": "Link",
- "label": "Item Group",
- "options": "Item Group",
- "reqd": 1
- },
- {
- "fieldname": "item_name",
- "fieldtype": "Data",
- "label": "Item Name",
- "reqd": 1
- },
- {
- "fieldname": "column_break_12",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "description",
- "fieldtype": "Small Text",
- "label": "Description"
- },
- {
- "fieldname": "section_break_2",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "medical_department",
- "fieldtype": "Link",
- "label": "Medical Department",
- "options": "Medical Department"
- },
- {
- "default": "0",
- "fieldname": "change_in_item",
- "fieldtype": "Check",
- "hidden": 1,
- "label": "Change In Item",
- "print_hide": 1,
- "read_only": 1,
- "report_hide": 1
- },
- {
- "fieldname": "therapy_for",
- "fieldtype": "Table MultiSelect",
- "label": "Therapy For",
- "options": "Body Part Link"
- },
- {
- "fieldname": "healthcare_service_unit",
- "fieldtype": "Link",
- "label": "Healthcare Service Unit",
- "options": "Healthcare Service Unit"
- },
- {
- "depends_on": "eval: doc.therapy_for",
- "fieldname": "add_exercises",
- "fieldtype": "Button",
- "label": "Add Exercises",
- "options": "add_exercises"
- },
- {
- "fieldname": "section_break_18",
- "fieldtype": "Section Break"
- },
- {
- "collapsible": 1,
- "fieldname": "medical_coding_section",
- "fieldtype": "Section Break",
- "label": "Medical Coding",
- "options": "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:18:50.669951",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Therapy Type",
- "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": "Physician",
- "share": 1,
- "write": 1
- }
- ],
- "quick_entry": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/therapy_type/therapy_type.py b/erpnext/healthcare/doctype/therapy_type/therapy_type.py
deleted file mode 100644
index 3517ef2c5a..0000000000
--- a/erpnext/healthcare/doctype/therapy_type/therapy_type.py
+++ /dev/null
@@ -1,126 +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 json
-
-import frappe
-from frappe import _
-from frappe.model.document import Document
-from frappe.model.rename_doc import rename_doc
-from frappe.utils import cint
-
-
-class TherapyType(Document):
- def validate(self):
- self.enable_disable_item()
-
- def after_insert(self):
- create_item_from_therapy(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.item_name
- item_doc.item_group = self.item_group
- item_doc.description = self.description
- item_doc.disabled = 0
- item_doc.ignore_mandatory = True
- 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.item_name
- item_price.price_list_rate = self.rate
- item_price.ignore_mandatory = True
- 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 add_exercises(self):
- exercises = self.get_exercises_for_body_parts()
- last_idx = max([cint(d.idx) for d in self.get('exercises')] or [0,])
- for i, d in enumerate(exercises):
- ch = self.append('exercises', {})
- ch.exercise_type = d.parent
- ch.idx = last_idx + i + 1
-
- def get_exercises_for_body_parts(self):
- body_parts = [entry.body_part for entry in self.therapy_for]
-
- exercises = frappe.db.sql(
- """
- SELECT DISTINCT
- b.parent, e.name, e.difficulty_level
- FROM
- `tabExercise Type` e, `tabBody Part Link` b
- WHERE
- b.body_part IN %(body_parts)s AND b.parent=e.name
- """, {'body_parts': body_parts}, as_dict=1)
-
- return exercises
-
-
-def create_item_from_therapy(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.item_code,
- 'item_name': doc.item_name,
- '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_therapy(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, item_code, ignore_permissions=True)
- frappe.db.set_value('Therapy Type', doc.name, 'item_code', item_code)
- return
diff --git a/erpnext/healthcare/doctype/treatment_plan_template/__init__.py b/erpnext/healthcare/doctype/treatment_plan_template/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/treatment_plan_template/test_records.json b/erpnext/healthcare/doctype/treatment_plan_template/test_records.json
deleted file mode 100644
index d661b4304f..0000000000
--- a/erpnext/healthcare/doctype/treatment_plan_template/test_records.json
+++ /dev/null
@@ -1,7 +0,0 @@
-[
- {
- "doctype": "Treatment Plan Template",
- "template_name": "Chemo",
- "patient_age_from": 21
- }
-]
diff --git a/erpnext/healthcare/doctype/treatment_plan_template/test_treatment_plan_template.py b/erpnext/healthcare/doctype/treatment_plan_template/test_treatment_plan_template.py
deleted file mode 100644
index b8a1dd7786..0000000000
--- a/erpnext/healthcare/doctype/treatment_plan_template/test_treatment_plan_template.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
-# See license.txt
-
-# import frappe
-import unittest
-
-
-class TestTreatmentPlanTemplate(unittest.TestCase):
- pass
diff --git a/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template.js b/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template.js
deleted file mode 100644
index 986c3cb6e4..0000000000
--- a/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template.js
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Treatment Plan Template', {
- refresh: function (frm) {
- frm.set_query('type', 'items', function () {
- return {
- filters: {
- 'name': ['in', ['Lab Test Template', 'Clinical Procedure Template', 'Therapy Type']],
- }
- };
- });
- },
-});
diff --git a/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template.json b/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template.json
deleted file mode 100644
index 85a312fb17..0000000000
--- a/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template.json
+++ /dev/null
@@ -1,189 +0,0 @@
-{
- "actions": [],
- "autoname": "field:template_name",
- "creation": "2021-06-10 10:14:17.901273",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "section_break_1",
- "template_name",
- "description",
- "practitioners",
- "disabled",
- "column_break_1",
- "medical_department",
- "goal",
- "order_group",
- "section_break_8",
- "patient_age_from",
- "complaints",
- "gender",
- "column_break_12",
- "patient_age_to",
- "diagnosis",
- "plan_items_section",
- "items",
- "drugs"
- ],
- "fields": [
- {
- "fieldname": "section_break_1",
- "fieldtype": "Section Break",
- "label": "Plan Details"
- },
- {
- "fieldname": "medical_department",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Medical Department",
- "options": "Medical Department"
- },
- {
- "fieldname": "description",
- "fieldtype": "Small Text",
- "label": "Description"
- },
- {
- "fieldname": "goal",
- "fieldtype": "Small Text",
- "label": "Goal"
- },
- {
- "fieldname": "practitioners",
- "fieldtype": "Table MultiSelect",
- "label": "Practitioners",
- "options": "Treatment Plan Template Practitioner"
- },
- {
- "fieldname": "order_group",
- "fieldtype": "Link",
- "label": "Order Group",
- "options": "Patient Encounter",
- "read_only": 1
- },
- {
- "fieldname": "section_break_8",
- "fieldtype": "Section Break",
- "label": "Plan Conditions"
- },
- {
- "fieldname": "template_name",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Template Name",
- "reqd": 1,
- "unique": 1
- },
- {
- "fieldname": "patient_age_from",
- "fieldtype": "Int",
- "label": "Patient Age From",
- "non_negative": 1
- },
- {
- "fieldname": "column_break_12",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "patient_age_to",
- "fieldtype": "Int",
- "label": "Patient Age To",
- "non_negative": 1
- },
- {
- "fieldname": "gender",
- "fieldtype": "Link",
- "label": "Gender",
- "options": "Gender"
- },
- {
- "fieldname": "complaints",
- "fieldtype": "Table MultiSelect",
- "label": "Complaints",
- "options": "Patient Encounter Symptom"
- },
- {
- "fieldname": "diagnosis",
- "fieldtype": "Table MultiSelect",
- "label": "Diagnosis",
- "options": "Patient Encounter Diagnosis"
- },
- {
- "fieldname": "plan_items_section",
- "fieldtype": "Section Break",
- "label": "Plan Items"
- },
- {
- "fieldname": "items",
- "fieldtype": "Table",
- "label": "Items",
- "options": "Treatment Plan Template Item"
- },
- {
- "fieldname": "drugs",
- "fieldtype": "Table",
- "label": "Drugs",
- "options": "Drug Prescription"
- },
- {
- "default": "0",
- "fieldname": "disabled",
- "fieldtype": "Check",
- "label": "Disabled"
- },
- {
- "fieldname": "column_break_1",
- "fieldtype": "Column Break"
- }
- ],
- "index_web_pages_for_search": 1,
- "links": [],
- "modified": "2021-08-18 02:41:58.354296",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Treatment Plan Template",
- "owner": "Administrator",
- "permissions": [
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "System Manager",
- "share": 1,
- "write": 1
- },
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Physician",
- "share": 1,
- "write": 1
- },
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Healthcare Administrator",
- "share": 1,
- "write": 1
- }
- ],
- "sort_field": "modified",
- "sort_order": "DESC",
- "title_field": "template_name",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template.py b/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template.py
deleted file mode 100644
index dbe0e9ae5f..0000000000
--- a/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
-# For license information, please see license.txt
-
-import frappe
-from frappe import _
-from frappe.model.document import Document
-
-
-class TreatmentPlanTemplate(Document):
- def validate(self):
- self.validate_age()
-
- def validate_age(self):
- if self.patient_age_from and self.patient_age_from < 0:
- frappe.throw(_('Patient Age From cannot be less than 0'))
- if self.patient_age_to and self.patient_age_to < 0:
- frappe.throw(_('Patient Age To cannot be less than 0'))
- if self.patient_age_to and self.patient_age_from and \
- self.patient_age_to < self.patient_age_from:
- frappe.throw(_('Patient Age To cannot be less than Patient Age From'))
diff --git a/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template_list.js b/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template_list.js
deleted file mode 100644
index 7ab31dff79..0000000000
--- a/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template_list.js
+++ /dev/null
@@ -1,10 +0,0 @@
-frappe.listview_settings['Treatment Plan Template'] = {
- get_indicator: function(doc) {
- var colors = {
- 1: 'gray',
- 0: 'blue',
- };
- let label = doc.disabled == 1 ? 'Disabled' : 'Enabled';
- return [__(label), colors[doc.disabled], 'disable,=,' + doc.disabled];
- }
-};
diff --git a/erpnext/healthcare/doctype/treatment_plan_template_item/__init__.py b/erpnext/healthcare/doctype/treatment_plan_template_item/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/treatment_plan_template_item/treatment_plan_template_item.json b/erpnext/healthcare/doctype/treatment_plan_template_item/treatment_plan_template_item.json
deleted file mode 100644
index 20a9d6793a..0000000000
--- a/erpnext/healthcare/doctype/treatment_plan_template_item/treatment_plan_template_item.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
- "actions": [],
- "creation": "2021-06-10 11:47:29.194795",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "type",
- "template",
- "qty",
- "instructions"
- ],
- "fields": [
- {
- "fieldname": "type",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Type",
- "options": "DocType",
- "reqd": 1
- },
- {
- "fieldname": "template",
- "fieldtype": "Dynamic Link",
- "in_list_view": 1,
- "label": "Template",
- "options": "type",
- "reqd": 1
- },
- {
- "default": "1",
- "fieldname": "qty",
- "fieldtype": "Int",
- "label": "Qty"
- },
- {
- "fieldname": "instructions",
- "fieldtype": "Small Text",
- "in_list_view": 1,
- "label": "Instructions"
- }
- ],
- "index_web_pages_for_search": 1,
- "istable": 1,
- "links": [],
- "modified": "2021-08-17 11:19:03.515441",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Treatment Plan Template Item",
- "owner": "Administrator",
- "permissions": [],
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/treatment_plan_template_item/treatment_plan_template_item.py b/erpnext/healthcare/doctype/treatment_plan_template_item/treatment_plan_template_item.py
deleted file mode 100644
index 8b8d89f07f..0000000000
--- a/erpnext/healthcare/doctype/treatment_plan_template_item/treatment_plan_template_item.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
-# For license information, please see license.txt
-
-# import frappe
-from frappe.model.document import Document
-
-
-class TreatmentPlanTemplateItem(Document):
- pass
diff --git a/erpnext/healthcare/doctype/treatment_plan_template_practitioner/__init__.py b/erpnext/healthcare/doctype/treatment_plan_template_practitioner/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/treatment_plan_template_practitioner/treatment_plan_template_practitioner.json b/erpnext/healthcare/doctype/treatment_plan_template_practitioner/treatment_plan_template_practitioner.json
deleted file mode 100644
index 04da387f7b..0000000000
--- a/erpnext/healthcare/doctype/treatment_plan_template_practitioner/treatment_plan_template_practitioner.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "actions": [],
- "creation": "2021-06-10 10:37:56.669416",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "practitioner"
- ],
- "fields": [
- {
- "fieldname": "practitioner",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Practitioner",
- "options": "Healthcare Practitioner",
- "reqd": 1
- }
- ],
- "index_web_pages_for_search": 1,
- "istable": 1,
- "links": [],
- "modified": "2021-06-11 16:05:06.733299",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Treatment Plan Template Practitioner",
- "owner": "Administrator",
- "permissions": [],
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/treatment_plan_template_practitioner/treatment_plan_template_practitioner.py b/erpnext/healthcare/doctype/treatment_plan_template_practitioner/treatment_plan_template_practitioner.py
deleted file mode 100644
index c2d08bcc1a..0000000000
--- a/erpnext/healthcare/doctype/treatment_plan_template_practitioner/treatment_plan_template_practitioner.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
-# For license information, please see license.txt
-
-# import frappe
-from frappe.model.document import Document
-
-
-class TreatmentPlanTemplatePractitioner(Document):
- pass
diff --git a/erpnext/healthcare/doctype/vital_signs/__init__.py b/erpnext/healthcare/doctype/vital_signs/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/doctype/vital_signs/test_vital_signs.py b/erpnext/healthcare/doctype/vital_signs/test_vital_signs.py
deleted file mode 100644
index 22b52fb482..0000000000
--- a/erpnext/healthcare/doctype/vital_signs/test_vital_signs.py
+++ /dev/null
@@ -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('Vital Signs')
-
-class TestVitalSigns(unittest.TestCase):
- pass
diff --git a/erpnext/healthcare/doctype/vital_signs/vital_signs.js b/erpnext/healthcare/doctype/vital_signs/vital_signs.js
deleted file mode 100644
index 78509e0323..0000000000
--- a/erpnext/healthcare/doctype/vital_signs/vital_signs.js
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2016, ESS LLP and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Vital Signs', {
- height: function(frm) {
- if (frm.doc.height && frm.doc.weight) {
- calculate_bmi(frm);
- }
- },
-
- weight: function(frm) {
- if (frm.doc.height && frm.doc.weight) {
- calculate_bmi(frm);
- }
- },
-
- bp_systolic: function(frm) {
- if (frm.doc.bp_systolic && frm.doc.bp_diastolic) {
- set_bp(frm);
- }
- },
-
- bp_diastolic: function(frm) {
- if (frm.doc.bp_systolic && frm.doc.bp_diastolic) {
- set_bp(frm);
- }
- }
-});
-
-let calculate_bmi = function(frm){
- // Reference https://en.wikipedia.org/wiki/Body_mass_index
- // bmi = weight (in Kg) / height * height (in Meter)
- let bmi = (frm.doc.weight / (frm.doc.height * frm.doc.height)).toFixed(2);
- let bmi_note = null;
-
- if (bmi<18.5) {
- bmi_note = 'Underweight';
- } else if (bmi>=18.5 && bmi<25) {
- bmi_note = 'Normal';
- } else if (bmi>=25 && bmi<30) {
- bmi_note = 'Overweight';
- } else if (bmi>=30) {
- bmi_note = 'Obese';
- }
- frappe.model.set_value(frm.doctype,frm.docname, 'bmi', bmi);
- frappe.model.set_value(frm.doctype,frm.docname, 'nutrition_note', bmi_note);
-};
-
-let set_bp = function(frm){
- let bp = frm.doc.bp_systolic+ '/' + frm.doc.bp_diastolic + ' mmHg';
- frappe.model.set_value(frm.doctype,frm.docname, 'bp', bp);
-};
diff --git a/erpnext/healthcare/doctype/vital_signs/vital_signs.json b/erpnext/healthcare/doctype/vital_signs/vital_signs.json
deleted file mode 100644
index 15ab5047bc..0000000000
--- a/erpnext/healthcare/doctype/vital_signs/vital_signs.json
+++ /dev/null
@@ -1,305 +0,0 @@
-{
- "actions": [],
- "allow_copy": 1,
- "allow_import": 1,
- "autoname": "naming_series:",
- "beta": 1,
- "creation": "2017-02-02 11:00:24.853005",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "naming_series",
- "title",
- "patient",
- "patient_name",
- "inpatient_record",
- "appointment",
- "encounter",
- "column_break_2",
- "company",
- "signs_date",
- "signs_time",
- "sb_vs",
- "temperature",
- "pulse",
- "respiratory_rate",
- "tongue",
- "abdomen",
- "column_break_8",
- "reflexes",
- "bp_systolic",
- "bp_diastolic",
- "bp",
- "vital_signs_note",
- "sb_nutrition_values",
- "height",
- "weight",
- "bmi",
- "column_break_14",
- "nutrition_note",
- "sb_references",
- "amended_from"
- ],
- "fields": [
- {
- "fetch_from": "patient.inpatient_record",
- "fieldname": "inpatient_record",
- "fieldtype": "Link",
- "label": "Inpatient Record",
- "options": "Inpatient Record",
- "read_only": 1
- },
- {
- "fetch_from": "inpatient_record.patient",
- "fieldname": "patient",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "in_list_view": 1,
- "in_standard_filter": 1,
- "label": "Patient",
- "options": "Patient",
- "reqd": 1
- },
- {
- "fetch_from": "patient.patient_name",
- "fieldname": "patient_name",
- "fieldtype": "Data",
- "label": "Patient Name",
- "read_only": 1
- },
- {
- "fieldname": "appointment",
- "fieldtype": "Link",
- "in_filter": 1,
- "label": "Patient Appointment",
- "no_copy": 1,
- "options": "Patient Appointment",
- "print_hide": 1,
- "read_only": 1
- },
- {
- "fieldname": "encounter",
- "fieldtype": "Link",
- "in_filter": 1,
- "label": "Patient Encounter",
- "no_copy": 1,
- "options": "Patient Encounter",
- "print_hide": 1,
- "read_only": 1
- },
- {
- "fieldname": "column_break_2",
- "fieldtype": "Column Break"
- },
- {
- "default": "Today",
- "fieldname": "signs_date",
- "fieldtype": "Date",
- "label": "Date",
- "reqd": 1
- },
- {
- "fieldname": "signs_time",
- "fieldtype": "Time",
- "label": "Time",
- "reqd": 1
- },
- {
- "fieldname": "sb_vs",
- "fieldtype": "Section Break",
- "label": "Vital Signs"
- },
- {
- "description": "Presence of a fever (temp > 38.5 \u00b0C/101.3 \u00b0F or sustained temp > 38 \u00b0C/100.4 \u00b0F)",
- "fieldname": "temperature",
- "fieldtype": "Data",
- "ignore_xss_filter": 1,
- "in_list_view": 1,
- "label": "Body Temperature"
- },
- {
- "description": "Adults' pulse rate is anywhere between 50 and 80 beats per minute.",
- "fieldname": "pulse",
- "fieldtype": "Data",
- "ignore_xss_filter": 1,
- "in_list_view": 1,
- "label": "Heart Rate / Pulse"
- },
- {
- "description": "Normal reference range for an adult is 16\u201320 breaths/minute (RCP 2012)",
- "fieldname": "respiratory_rate",
- "fieldtype": "Data",
- "ignore_xss_filter": 1,
- "in_list_view": 1,
- "label": "Respiratory rate"
- },
- {
- "fieldname": "tongue",
- "fieldtype": "Select",
- "label": "Tongue",
- "options": "\nCoated\nVery Coated\nNormal\nFurry\nCuts"
- },
- {
- "fieldname": "abdomen",
- "fieldtype": "Select",
- "label": "Abdomen",
- "options": "\nNormal\nBloated\nFull\nFluid\nConstipated"
- },
- {
- "fieldname": "column_break_8",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "reflexes",
- "fieldtype": "Select",
- "label": "Reflexes",
- "options": "\nNormal\nHyper\nVery Hyper\nOne Sided"
- },
- {
- "fieldname": "bp_systolic",
- "fieldtype": "Data",
- "ignore_xss_filter": 1,
- "in_list_view": 1,
- "label": "Blood Pressure (systolic)"
- },
- {
- "fieldname": "bp_diastolic",
- "fieldtype": "Data",
- "ignore_xss_filter": 1,
- "in_list_view": 1,
- "label": "Blood Pressure (diastolic)"
- },
- {
- "description": "Normal resting blood pressure in an adult is approximately 120 mmHg systolic, and 80 mmHg diastolic, abbreviated \"120/80 mmHg\"",
- "fieldname": "bp",
- "fieldtype": "Data",
- "label": "Blood Pressure",
- "read_only": 1
- },
- {
- "fieldname": "vital_signs_note",
- "fieldtype": "Small Text",
- "ignore_xss_filter": 1,
- "label": "Notes"
- },
- {
- "fieldname": "sb_nutrition_values",
- "fieldtype": "Section Break",
- "label": "Nutrition Values"
- },
- {
- "fieldname": "height",
- "fieldtype": "Float",
- "in_list_view": 1,
- "label": "Height (In Meter)"
- },
- {
- "fieldname": "weight",
- "fieldtype": "Float",
- "in_list_view": 1,
- "label": "Weight (In Kilogram)"
- },
- {
- "default": "0.00",
- "fieldname": "bmi",
- "fieldtype": "Float",
- "in_list_view": 1,
- "label": "BMI",
- "read_only": 1
- },
- {
- "fieldname": "column_break_14",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "nutrition_note",
- "fieldtype": "Small Text",
- "ignore_xss_filter": 1,
- "label": "Notes"
- },
- {
- "fieldname": "company",
- "fieldtype": "Link",
- "label": "Company",
- "options": "Company"
- },
- {
- "fieldname": "amended_from",
- "fieldtype": "Link",
- "label": "Amended From",
- "no_copy": 1,
- "options": "Vital Signs",
- "print_hide": 1,
- "read_only": 1
- },
- {
- "collapsible": 1,
- "fieldname": "sb_references",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "naming_series",
- "fieldtype": "Select",
- "label": "Series",
- "options": "HLC-VTS-.YYYY.-",
- "reqd": 1
- },
- {
- "allow_on_submit": 1,
- "columns": 5,
- "fieldname": "title",
- "fieldtype": "Data",
- "hidden": 1,
- "label": "Title",
- "no_copy": 1,
- "print_hide": 1,
- "read_only": 1
- }
- ],
- "is_submittable": 1,
- "links": [],
- "modified": "2020-05-17 22:23:24.632286",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Vital Signs",
- "owner": "Administrator",
- "permissions": [
- {
- "cancel": 1,
- "create": 1,
- "delete": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Physician",
- "share": 1,
- "submit": 1,
- "write": 1
- },
- {
- "cancel": 1,
- "create": 1,
- "delete": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Nursing User",
- "share": 1,
- "submit": 1,
- "write": 1
- }
- ],
- "restrict_to_domain": "Healthcare",
- "search_fields": "patient, signs_date",
- "show_name_in_global_search": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "title_field": "title",
- "track_changes": 1,
- "track_seen": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/vital_signs/vital_signs.py b/erpnext/healthcare/doctype/vital_signs/vital_signs.py
deleted file mode 100644
index 29dbeb470d..0000000000
--- a/erpnext/healthcare/doctype/vital_signs/vital_signs.py
+++ /dev/null
@@ -1,18 +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 import _
-from frappe.model.document import Document
-
-
-class VitalSigns(Document):
- def validate(self):
- self.set_title()
-
- def set_title(self):
- self.title = _('{0} on {1}').format(self.patient_name or self.patient,
- frappe.utils.format_date(self.signs_date))[:100]
diff --git a/erpnext/healthcare/healthcare_dashboard/healthcare/healthcare.json b/erpnext/healthcare/healthcare_dashboard/healthcare/healthcare.json
deleted file mode 100644
index 2fea6682ed..0000000000
--- a/erpnext/healthcare/healthcare_dashboard/healthcare/healthcare.json
+++ /dev/null
@@ -1,62 +0,0 @@
-{
- "cards": [
- {
- "card": "Total Patients"
- },
- {
- "card": "Total Patients Admitted"
- },
- {
- "card": "Open Appointments"
- },
- {
- "card": "Appointments to Bill"
- }
- ],
- "charts": [
- {
- "chart": "Patient Appointments",
- "width": "Full"
- },
- {
- "chart": "In-Patient Status",
- "width": "Half"
- },
- {
- "chart": "Clinical Procedures Status",
- "width": "Half"
- },
- {
- "chart": "Lab Tests",
- "width": "Half"
- },
- {
- "chart": "Clinical Procedures",
- "width": "Half"
- },
- {
- "chart": "Symptoms",
- "width": "Half"
- },
- {
- "chart": "Diagnoses",
- "width": "Half"
- },
- {
- "chart": "Department wise Patient Appointments",
- "width": "Full"
- }
- ],
- "creation": "2020-07-14 18:17:54.823311",
- "dashboard_name": "Healthcare",
- "docstatus": 0,
- "doctype": "Dashboard",
- "idx": 0,
- "is_default": 0,
- "is_standard": 1,
- "modified": "2020-07-22 15:36:34.220387",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Healthcare",
- "owner": "Administrator"
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/module_onboarding/healthcare/healthcare.json b/erpnext/healthcare/module_onboarding/healthcare/healthcare.json
deleted file mode 100644
index 0aa8f9a027..0000000000
--- a/erpnext/healthcare/module_onboarding/healthcare/healthcare.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
- "allow_roles": [
- {
- "role": "Healthcare Administrator"
- }
- ],
- "creation": "2020-05-19 10:32:43.025852",
- "docstatus": 0,
- "doctype": "Module Onboarding",
- "documentation_url": "https://docs.erpnext.com/docs/user/manual/en/healthcare",
- "idx": 0,
- "is_complete": 0,
- "modified": "2021-01-30 19:22:20.273766",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Healthcare",
- "owner": "Administrator",
- "steps": [
- {
- "step": "Create Patient"
- },
- {
- "step": "Create Practitioner Schedule"
- },
- {
- "step": "Introduction to Healthcare Practitioner"
- },
- {
- "step": "Create Healthcare Practitioner"
- },
- {
- "step": "Explore Healthcare Settings"
- },
- {
- "step": "Explore Clinical Procedure Templates"
- }
- ],
- "subtitle": "Patients, Practitioner Schedules, Settings, and more.",
- "success_message": "The Healthcare Module is all set up!",
- "title": "Let's Set Up the Healthcare Module."
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/number_card/appointments_to_bill/appointments_to_bill.json b/erpnext/healthcare/number_card/appointments_to_bill/appointments_to_bill.json
deleted file mode 100644
index 3e4d4e27df..0000000000
--- a/erpnext/healthcare/number_card/appointments_to_bill/appointments_to_bill.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "creation": "2020-07-14 18:17:54.792773",
- "docstatus": 0,
- "doctype": "Number Card",
- "document_type": "Patient Appointment",
- "dynamic_filters_json": "[[\"Patient Appointment\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
- "filters_json": "[[\"Patient Appointment\",\"invoiced\",\"=\",0,false]]",
- "function": "Count",
- "idx": 0,
- "is_public": 1,
- "is_standard": 1,
- "label": "Appointments To Bill",
- "modified": "2020-07-22 13:27:58.038577",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Appointments to Bill",
- "owner": "Administrator",
- "show_percentage_stats": 1,
- "stats_time_interval": "Daily",
- "type": "Document Type"
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/number_card/open_appointments/open_appointments.json b/erpnext/healthcare/number_card/open_appointments/open_appointments.json
deleted file mode 100644
index 8d121cc58a..0000000000
--- a/erpnext/healthcare/number_card/open_appointments/open_appointments.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "creation": "2020-07-14 18:17:54.771092",
- "docstatus": 0,
- "doctype": "Number Card",
- "document_type": "Patient Appointment",
- "dynamic_filters_json": "[[\"Patient Appointment\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
- "filters_json": "[[\"Patient Appointment\",\"status\",\"=\",\"Open\",false]]",
- "function": "Count",
- "idx": 0,
- "is_public": 1,
- "is_standard": 1,
- "label": "Open Appointments",
- "modified": "2020-07-22 13:27:09.542122",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Open Appointments",
- "owner": "Administrator",
- "show_percentage_stats": 1,
- "stats_time_interval": "Daily",
- "type": "Document Type"
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/number_card/total_patients/total_patients.json b/erpnext/healthcare/number_card/total_patients/total_patients.json
deleted file mode 100644
index 75441a6842..0000000000
--- a/erpnext/healthcare/number_card/total_patients/total_patients.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "creation": "2020-07-14 18:17:54.727946",
- "docstatus": 0,
- "doctype": "Number Card",
- "document_type": "Patient",
- "filters_json": "[[\"Patient\",\"status\",\"=\",\"Active\",false]]",
- "function": "Count",
- "idx": 0,
- "is_public": 1,
- "is_standard": 1,
- "label": "Total Patients",
- "modified": "2020-07-22 13:26:02.643534",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Total Patients",
- "owner": "Administrator",
- "show_percentage_stats": 1,
- "stats_time_interval": "Daily",
- "type": "Document Type"
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/number_card/total_patients_admitted/total_patients_admitted.json b/erpnext/healthcare/number_card/total_patients_admitted/total_patients_admitted.json
deleted file mode 100644
index 69a967df93..0000000000
--- a/erpnext/healthcare/number_card/total_patients_admitted/total_patients_admitted.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "creation": "2020-07-14 18:17:54.749754",
- "docstatus": 0,
- "doctype": "Number Card",
- "document_type": "Patient",
- "filters_json": "[[\"Patient\",\"inpatient_status\",\"=\",\"Admitted\",false]]",
- "function": "Count",
- "idx": 0,
- "is_public": 1,
- "is_standard": 1,
- "label": "Total Patients Admitted",
- "modified": "2020-07-22 13:26:20.027788",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Total Patients Admitted",
- "owner": "Administrator",
- "show_percentage_stats": 1,
- "stats_time_interval": "Daily",
- "type": "Document Type"
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/onboarding_step/create_healthcare_practitioner/create_healthcare_practitioner.json b/erpnext/healthcare/onboarding_step/create_healthcare_practitioner/create_healthcare_practitioner.json
deleted file mode 100644
index 3f25a9d676..0000000000
--- a/erpnext/healthcare/onboarding_step/create_healthcare_practitioner/create_healthcare_practitioner.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "action": "Create Entry",
- "creation": "2020-05-19 10:39:55.728058",
- "docstatus": 0,
- "doctype": "Onboarding Step",
- "idx": 0,
- "is_complete": 0,
- "is_single": 0,
- "is_skipped": 0,
- "modified": "2021-01-30 12:02:22.849260",
- "modified_by": "Administrator",
- "name": "Create Healthcare Practitioner",
- "owner": "Administrator",
- "reference_document": "Healthcare Practitioner",
- "show_form_tour": 0,
- "show_full_form": 1,
- "title": "Create Healthcare Practitioner",
- "validate_action": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/onboarding_step/create_patient/create_patient.json b/erpnext/healthcare/onboarding_step/create_patient/create_patient.json
deleted file mode 100644
index b46bb15b48..0000000000
--- a/erpnext/healthcare/onboarding_step/create_patient/create_patient.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "action": "Create Entry",
- "creation": "2020-05-19 10:32:27.648902",
- "docstatus": 0,
- "doctype": "Onboarding Step",
- "idx": 0,
- "is_complete": 0,
- "is_single": 0,
- "is_skipped": 0,
- "modified": "2021-01-30 00:09:28.786428",
- "modified_by": "ruchamahabal2@gmail.com",
- "name": "Create Patient",
- "owner": "Administrator",
- "reference_document": "Patient",
- "show_form_tour": 0,
- "show_full_form": 1,
- "title": "Create Patient",
- "validate_action": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/onboarding_step/create_practitioner_schedule/create_practitioner_schedule.json b/erpnext/healthcare/onboarding_step/create_practitioner_schedule/create_practitioner_schedule.json
deleted file mode 100644
index 7ce122d5c0..0000000000
--- a/erpnext/healthcare/onboarding_step/create_practitioner_schedule/create_practitioner_schedule.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "action": "Create Entry",
- "creation": "2020-05-19 10:41:19.065753",
- "docstatus": 0,
- "doctype": "Onboarding Step",
- "idx": 0,
- "is_complete": 0,
- "is_single": 0,
- "is_skipped": 0,
- "modified": "2021-01-30 00:09:28.794602",
- "modified_by": "ruchamahabal2@gmail.com",
- "name": "Create Practitioner Schedule",
- "owner": "Administrator",
- "reference_document": "Practitioner Schedule",
- "show_form_tour": 0,
- "show_full_form": 1,
- "title": "Create Practitioner Schedule",
- "validate_action": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/onboarding_step/explore_clinical_procedure_templates/explore_clinical_procedure_templates.json b/erpnext/healthcare/onboarding_step/explore_clinical_procedure_templates/explore_clinical_procedure_templates.json
deleted file mode 100644
index dfe9f71a76..0000000000
--- a/erpnext/healthcare/onboarding_step/explore_clinical_procedure_templates/explore_clinical_procedure_templates.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "action": "Show Form Tour",
- "creation": "2020-05-19 11:40:51.963741",
- "docstatus": 0,
- "doctype": "Onboarding Step",
- "idx": 0,
- "is_complete": 0,
- "is_single": 0,
- "is_skipped": 0,
- "modified": "2021-01-30 19:22:08.257160",
- "modified_by": "Administrator",
- "name": "Explore Clinical Procedure Templates",
- "owner": "Administrator",
- "reference_document": "Clinical Procedure Template",
- "show_form_tour": 0,
- "show_full_form": 0,
- "title": "Explore Clinical Procedure Templates",
- "validate_action": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/onboarding_step/explore_healthcare_settings/explore_healthcare_settings.json b/erpnext/healthcare/onboarding_step/explore_healthcare_settings/explore_healthcare_settings.json
deleted file mode 100644
index 2d952f3093..0000000000
--- a/erpnext/healthcare/onboarding_step/explore_healthcare_settings/explore_healthcare_settings.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "action": "Show Form Tour",
- "creation": "2020-05-19 11:14:33.044989",
- "docstatus": 0,
- "doctype": "Onboarding Step",
- "idx": 0,
- "is_complete": 0,
- "is_single": 1,
- "is_skipped": 0,
- "modified": "2021-01-30 19:22:07.275735",
- "modified_by": "Administrator",
- "name": "Explore Healthcare Settings",
- "owner": "Administrator",
- "reference_document": "Healthcare Settings",
- "show_form_tour": 0,
- "show_full_form": 0,
- "title": "Explore Healthcare Settings",
- "validate_action": 1
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/onboarding_step/introduction_to_healthcare_practitioner/introduction_to_healthcare_practitioner.json b/erpnext/healthcare/onboarding_step/introduction_to_healthcare_practitioner/introduction_to_healthcare_practitioner.json
deleted file mode 100644
index baa8358c06..0000000000
--- a/erpnext/healthcare/onboarding_step/introduction_to_healthcare_practitioner/introduction_to_healthcare_practitioner.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "action": "Show Form Tour",
- "creation": "2020-05-19 10:43:56.231679",
- "docstatus": 0,
- "doctype": "Onboarding Step",
- "field": "schedule",
- "idx": 0,
- "is_complete": 0,
- "is_single": 0,
- "is_skipped": 0,
- "modified": "2021-01-30 00:09:28.807129",
- "modified_by": "ruchamahabal2@gmail.com",
- "name": "Introduction to Healthcare Practitioner",
- "owner": "Administrator",
- "reference_document": "Healthcare Practitioner",
- "show_form_tour": 0,
- "show_full_form": 0,
- "title": "Introduction to Healthcare Practitioner",
- "validate_action": 0
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/page/__init__.py b/erpnext/healthcare/page/__init__.py
deleted file mode 100644
index baffc48825..0000000000
--- a/erpnext/healthcare/page/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/erpnext/healthcare/page/patient_history/__init__.py b/erpnext/healthcare/page/patient_history/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/page/patient_history/patient_history.css b/erpnext/healthcare/page/patient_history/patient_history.css
deleted file mode 100644
index 74b5e7eb91..0000000000
--- a/erpnext/healthcare/page/patient_history/patient_history.css
+++ /dev/null
@@ -1,151 +0,0 @@
-#page-medical_record .label {
- display: inline-block;
- margin-right: 7px;
-}
-
-#page-medical_record .list-row {
- border: none;
- padding: 0px;
- cursor: pointer;
-}
-
-.patient-image-container {
- margin-top: 17px;
- }
-
-.patient-image {
- display: inline-block;
- width: 100%;
- height: 0;
- padding: 50% 0px;
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center center;
- border-radius: 4px;
-}
-
-.patient-name {
- font-size: 20px;
- margin-top: 25px;
-}
-
-.medical_record-label {
- max-width: 100px;
- margin-bottom: -4px;
-}
-
-.medical_record-row > * {
- z-index: -999;
-}
-
-.date-indicator {
- background:none;
- font-size:12px;
- vertical-align:middle;
- font-weight:bold;
- color:#6c7680;
-}
-.date-indicator::after {
- margin:0 -4px 0 12px;
- content:'';
- display:inline-block;
- height:8px;
- width:8px;
- border-radius:8px;
- background: #d1d8dd;
-}
-
-.date-indicator.blue {
- color: #5e64ff;
-}
-
-.div-bg-color {
- background: #fafbfc;
-}
-
-.bg-color-white {
- background: #FFFFFF;
-}
-
-.d-flex {
- display: flex;
-}
-
-.width-full {
- width: 100%;
-}
-
-.p-3 {
- padding: 16px;
-}
-
-.mt-2 {
- margin-top: 8px;
-}
-
-.mr-3 {
- margin-right: 16px;
-}
-
-.Box {
- background-color: #fff;
- border: 1px solid #d1d5da;
- border-radius: 3px;
-}
-
-.flex-column {
- flex-direction: column;
-}
-
-.avatar {
- display: inline-block;
- overflow: hidden;
- line-height: 1;
- vertical-align: middle;
- border-radius: 3px;
-}
-
-.py-3 {
- padding-top: 16px;
- padding-bottom: 16px;
-}
-
-.border-bottom {
- border-bottom: 1px #e1e4e8 solid;
-}
-
-.date-indicator.blue::after {
- background: #5e64ff;
-}
-
-.medical_record-message {
- border-left: 1px solid #d1d8dd;
- padding: 15px;
- padding-right: 30px;
-}
-
-.medical_record-date {
- padding: 15px;
- padding-right: 0px;
-}
-
-.patient-history-filter {
- margin-left: 35px;
- width: 25%;
-}
-
-#page-medical_record .plot-wrapper {
- padding: 20px 15px;
- border-bottom: 1px solid #d1d8dd;
- text-align: center;
-}
-
-#page-medical_record .plot {
- height: 140px ;
- width: 97% ;
- margin: auto;
-}
-
-#page-medical_record .list-filters {
- display: none ;
-}
diff --git a/erpnext/healthcare/page/patient_history/patient_history.html b/erpnext/healthcare/page/patient_history/patient_history.html
deleted file mode 100644
index d16b38637c..0000000000
--- a/erpnext/healthcare/page/patient_history/patient_history.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
diff --git a/erpnext/healthcare/page/patient_history/patient_history.js b/erpnext/healthcare/page/patient_history/patient_history.js
deleted file mode 100644
index ed2dc52cb1..0000000000
--- a/erpnext/healthcare/page/patient_history/patient_history.js
+++ /dev/null
@@ -1,455 +0,0 @@
-frappe.provide('frappe.patient_history');
-frappe.pages['patient_history'].on_page_load = function(wrapper) {
- frappe.ui.make_app_page({
- parent: wrapper,
- title: __('Patient History')
- });
-
- let patient_history = new PatientHistory(wrapper);
- $(wrapper).bind('show', ()=> {
- patient_history.show();
- });
-};
-
-class PatientHistory {
- constructor(wrapper) {
- this.wrapper = $(wrapper);
- this.page = wrapper.page;
- this.sidebar = this.wrapper.find('.layout-side-section');
- this.main_section = this.wrapper.find('.layout-main-section');
- this.start = 0;
- }
-
- show() {
- frappe.breadcrumbs.add('Healthcare');
- this.sidebar.empty();
-
- let me = this;
- let patient = frappe.ui.form.make_control({
- parent: me.sidebar,
- df: {
- fieldtype: 'Link',
- options: 'Patient',
- fieldname: 'patient',
- placeholder: __('Select Patient'),
- only_select: true,
- change: () => {
- me.patient_id = '';
- if (me.patient_id != patient.get_value() && patient.get_value()) {
- me.start = 0;
- me.patient_id = patient.get_value();
- me.make_patient_profile();
- }
- }
- }
- });
- patient.refresh();
-
- if (frappe.route_options && !this.patient_id) {
- patient.set_value(frappe.route_options.patient);
- this.patient_id = frappe.route_options.patient;
- }
-
- this.sidebar.find('[data-fieldname="patient"]').append('
');
- }
-
- make_patient_profile() {
- this.page.set_title(__('Patient History'));
- this.main_section.empty().append(frappe.render_template('patient_history'));
- this.setup_filters();
- this.setup_documents();
- this.show_patient_info();
- this.setup_buttons();
- this.show_patient_vital_charts('bp', 'mmHg', 'Blood Pressure');
- }
-
- setup_filters() {
- $('.doctype-filter').empty();
- let me = this;
-
- frappe.xcall(
- 'erpnext.healthcare.page.patient_history.patient_history.get_patient_history_doctypes'
- ).then(document_types => {
- let doctype_filter = frappe.ui.form.make_control({
- parent: $('.doctype-filter'),
- df: {
- fieldtype: 'MultiSelectList',
- fieldname: 'document_type',
- placeholder: __('Select Document Type'),
- change: () => {
- me.start = 0;
- me.page.main.find('.patient_documents_list').html('');
- this.setup_documents(doctype_filter.get_value(), date_range_field.get_value());
- },
- get_data: () => {
- return document_types.map(document_type => {
- return {
- description: document_type,
- value: document_type
- };
- });
- },
- }
- });
- doctype_filter.refresh();
-
- $('.date-filter').empty();
- let date_range_field = frappe.ui.form.make_control({
- df: {
- fieldtype: 'DateRange',
- fieldname: 'date_range',
- placeholder: __('Date Range'),
- input_class: 'input-xs',
- change: () => {
- let selected_date_range = date_range_field.get_value();
- if (selected_date_range && selected_date_range.length === 2) {
- me.start = 0;
- me.page.main.find('.patient_documents_list').html('');
- this.setup_documents(doctype_filter.get_value(), date_range_field.get_value());
- }
- }
- },
- parent: $('.date-filter')
- });
- date_range_field.refresh();
- });
- }
-
- setup_documents(document_types="", selected_date_range="") {
- let filters = {
- name: this.patient_id,
- start: this.start,
- page_length: 20
- };
- if (document_types)
- filters['document_types'] = document_types;
- if (selected_date_range)
- filters['date_range'] = selected_date_range;
-
- let me = this;
- frappe.call({
- 'method': 'erpnext.healthcare.page.patient_history.patient_history.get_feed',
- args: filters,
- callback: function(r) {
- let data = r.message;
- if (data.length) {
- me.add_to_records(data);
- } else {
- me.page.main.find('.patient_documents_list').append(`
-
- ${__('No more records..')}
-
`);
- me.page.main.find('.btn-get-records').hide();
- }
- }
- });
- }
-
- add_to_records(data) {
- let details = "";
- let i;
- for (i=0; i
" + data[i].subject;
- }
- data[i] = this.add_date_separator(data[i]);
-
- if (frappe.user_info(data[i].owner).image) {
- data[i].imgsrc = frappe.utils.get_file_link(frappe.user_info(data[i].owner).image);
- } else {
- data[i].imgsrc = false;
- }
-
- let time_line_heading = data[i].practitioner ? `${data[i].practitioner} ` : ``;
- time_line_heading += data[i].reference_doctype + " - " +
- `
- ${data[i].reference_name}
- `;
-
- details += `
- `;
- }
- }
-
- this.page.main.find('.patient_documents_list').append(details);
- this.start += data.length;
-
- if (data.length === 20) {
- this.page.main.find(".btn-get-records").show();
- } else {
- this.page.main.find(".btn-get-records").hide();
- this.page.main.find(".patient_documents_list").append(`
-
- ${__('No more records..')}
-
`);
- }
- }
-
- add_date_separator(data) {
- let date = frappe.datetime.str_to_obj(data.communication_date);
- let pdate = '';
- let diff = frappe.datetime.get_day_diff(frappe.datetime.get_today(),
- frappe.datetime.obj_to_str(date));
-
- if (diff < 1) {
- pdate = __('Today');
- } else if (diff < 2) {
- pdate = __('Yesterday');
- } else {
- pdate = __('on {0}', [frappe.datetime.global_date_format(date)]);
- }
- data.date_sep = pdate;
- return data;
- }
-
- show_patient_info() {
- this.get_patient_info().then(() => {
- $('.patient-info').empty().append(frappe.render_template('patient_history_sidebar', {
- patient_image: this.patient.image,
- patient_name: this.patient.patient_name,
- patient_gender: this.patient.sex,
- patient_mobile: this.patient.mobile
- }));
- this.show_patient_details();
- });
- }
-
- show_patient_details() {
- let me = this;
- frappe.call({
- 'method': 'erpnext.healthcare.doctype.patient.patient.get_patient_detail',
- args: {
- patient: me.patient_id
- },
- callback: function(r) {
- let data = r.message;
- let details = ``;
-
- if (data.occupation) details += `
${__('Occupation')} : ${data.occupation}`;
- if (data.blood_group) details += `
${__('Blood Group')} : ${data.blood_group}`;
- if (data.allergies) details += `
${__('Allerigies')} : ${data.allergies.replace("\n", ", ")}`;
- if (data.medication) details += `
${__('Medication')} : ${data.medication.replace("\n", ", ")}`;
- if (data.alcohol_current_use) details += `
${__('Alcohol use')} : ${data.alcohol_current_use}`;
- if (data.alcohol_past_use) details += `
${__('Alcohol past use')} : ${data.alcohol_past_use}`;
- if (data.tobacco_current_use) details += `
${__('Tobacco use')} : ${data.tobacco_current_use}`;
- if (data.tobacco_past_use) details += `
${__('Tobacco past use')} : ${data.tobacco_past_use}`;
- if (data.medical_history) details += `
${__('Medical history')} : ${data.medical_history.replace("\n", ", ")}`;
- if (data.surgical_history) details += `
${__('Surgical history')} : ${data.surgical_history.replace("\n", ", ")}`;
- if (data.surrounding_factors) details += `
${__('Occupational hazards')} : ${data.surrounding_factors.replace("\n", ", ")}`;
- if (data.other_risk_factors) details += `
${__('Other risk factors')} : ${data.other_risk_factors.replace("\n", ", ")}`;
- if (data.patient_details) details += `
${__('More info')} : ${data.patient_details.replace("\n", ", ")}`;
-
- if (details) {
- details = `
` + details + `
`;
- }
-
- me.sidebar.find('.patient-details').html(details);
- }
- });
- }
-
- get_patient_info() {
- return frappe.xcall('frappe.client.get', {
- doctype: 'Patient',
- name: this.patient_id,
- }).then((patient) => {
- if (patient) {
- this.patient = patient;
- }
- });
- }
-
- setup_buttons() {
- let me = this;
- this.page.main.on("click", ".btn-show-chart", function() {
- let btn_id = $(this).attr("data-show-chart-id"), scale_unit = $(this).attr("data-pts");
- let title = $(this).attr("data-title");
- me.show_patient_vital_charts(btn_id, scale_unit, title);
- });
-
- this.page.main.on('click', '.btn-more', function() {
- let doctype = $(this).attr('data-doctype'), docname = $(this).attr('data-docname');
- if (me.page.main.find('.'+docname).parent().find('.document-html').attr('data-fetched') == '1') {
- me.page.main.find('.'+docname).hide();
- me.page.main.find('.'+docname).parent().find('.document-html').show();
- } else {
- if (doctype && docname) {
- let exclude = ['patient', 'patient_name', 'patient_sex', 'encounter_date', 'naming_series'];
- frappe.call({
- method: 'erpnext.healthcare.utils.render_doc_as_html',
- args: {
- doctype: doctype,
- docname: docname,
- exclude_fields: exclude
- },
- freeze: true,
- callback: function(r) {
- if (r.message) {
- me.page.main.find('.' + docname).hide();
-
- me.page.main.find('.' + docname).parent().find('.document-html').html(
- `${r.message.html}
-
-
- `);
-
- me.page.main.find('.' + docname).parent().find('.document-html').attr('hidden', false);
- me.page.main.find('.' + docname).parent().find('.document-html').attr('data-fetched', '1');
- }
- }
- });
- }
- }
- });
-
- this.page.main.on('click', '.btn-less', function() {
- let docname = $(this).attr('data-docname');
- me.page.main.find('.' + docname).parent().find('.document-id').show();
- me.page.main.find('.' + docname).parent().find('.document-html').hide();
- });
-
- me.page.main.on('click', '.btn-get-records', function() {
- this.setup_documents();
- });
- }
-
- show_patient_vital_charts(btn_id, scale_unit, title) {
- let me = this;
-
- frappe.call({
- method: 'erpnext.healthcare.utils.get_patient_vitals',
- args: {
- patient: me.patient_id
- },
- callback: function(r) {
- if (r.message) {
- let show_chart_btns_html = `
-
`;
-
- me.page.main.find('.show_chart_btns').html(show_chart_btns_html);
- let data = r.message;
- let labels = [], datasets = [];
- let bp_systolic = [], bp_diastolic = [], temperature = [];
- let pulse = [], respiratory_rate = [], bmi = [], height = [], weight = [];
-
- for (let i=0; i
(d + '').toUpperCase(),
- formatTooltipY: d => d + ' ' + scale_unit,
- }
- });
- me.page.main.find('.header-separator').show();
- } else {
- me.page.main.find('.patient_vital_charts').html('');
- me.page.main.find('.show_chart_btns').html('');
- me.page.main.find('.header-separator').hide();
- }
- }
- });
- }
-}
diff --git a/erpnext/healthcare/page/patient_history/patient_history.json b/erpnext/healthcare/page/patient_history/patient_history.json
deleted file mode 100644
index b3892a41c6..0000000000
--- a/erpnext/healthcare/page/patient_history/patient_history.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "content": null,
- "creation": "2018-08-08 17:09:13.816199",
- "docstatus": 0,
- "doctype": "Page",
- "icon": "",
- "idx": 0,
- "modified": "2018-08-08 17:09:55.969424",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "patient_history",
- "owner": "Administrator",
- "page_name": "patient_history",
- "restrict_to_domain": "Healthcare",
- "roles": [
- {
- "role": "Healthcare Administrator"
- },
- {
- "role": "Physician"
- }
- ],
- "script": null,
- "standard": "Yes",
- "style": null,
- "system_page": 0,
- "title": "Patient History"
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/page/patient_history/patient_history.py b/erpnext/healthcare/page/patient_history/patient_history.py
deleted file mode 100644
index 77d8846f37..0000000000
--- a/erpnext/healthcare/page/patient_history/patient_history.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2018, ESS LLP and contributors
-# For license information, please see license.txt
-
-from __future__ import unicode_literals
-
-import json
-
-import frappe
-from frappe.utils import cint
-
-
-@frappe.whitelist()
-def get_feed(name, document_types=None, date_range=None, start=0, page_length=20):
- """get feed"""
- filters = get_filters(name, document_types, date_range)
-
- result = frappe.db.get_all('Patient Medical Record',
- fields=['name', 'owner', 'communication_date',
- 'reference_doctype', 'reference_name', 'subject'],
- filters=filters,
- order_by='communication_date DESC',
- limit=cint(page_length),
- start=cint(start)
- )
-
- return result
-
-
-def get_filters(name, document_types=None, date_range=None):
- filters = {'patient': name}
- if document_types:
- document_types = json.loads(document_types)
- if len(document_types):
- filters['reference_doctype'] = ['IN', document_types]
-
- if date_range:
- try:
- date_range = json.loads(date_range)
- if date_range:
- filters['communication_date'] = ['between', [date_range[0], date_range[1]]]
- except json.decoder.JSONDecodeError:
- pass
-
- return filters
-
-
-@frappe.whitelist()
-def get_feed_for_dt(doctype, docname):
- """get feed"""
- result = frappe.db.get_all('Patient Medical Record',
- fields=['name', 'owner', 'communication_date',
- 'reference_doctype', 'reference_name', 'subject'],
- filters={
- 'reference_doctype': doctype,
- 'reference_name': docname
- },
- order_by='communication_date DESC'
- )
-
- return result
-
-
-@frappe.whitelist()
-def get_patient_history_doctypes():
- document_types = []
- settings = frappe.get_single("Patient History Settings")
-
- for entry in settings.standard_doctypes:
- document_types.append(entry.document_type)
-
- for entry in settings.custom_doctypes:
- document_types.append(entry.document_type)
-
- return document_types
diff --git a/erpnext/healthcare/page/patient_history/patient_history_sidebar.html b/erpnext/healthcare/page/patient_history/patient_history_sidebar.html
deleted file mode 100644
index fc7eab0540..0000000000
--- a/erpnext/healthcare/page/patient_history/patient_history_sidebar.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
diff --git a/erpnext/healthcare/page/patient_progress/__init__.py b/erpnext/healthcare/page/patient_progress/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress.css b/erpnext/healthcare/page/patient_progress/patient_progress.css
deleted file mode 100644
index 737b2e0ea2..0000000000
--- a/erpnext/healthcare/page/patient_progress/patient_progress.css
+++ /dev/null
@@ -1,171 +0,0 @@
-/* sidebar */
-
-.layout-side-section .frappe-control[data-fieldname='patient'] {
- max-width: 300px;
-}
-
-.patient-image-container {
- margin-top: 17px;
-}
-
-.patient-image {
- display: inline-block;
- width: 100%;
- height: 0;
- padding: 50% 0px;
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center center;
- border-radius: 4px;
-}
-
-.patient-details {
- margin: -5px 5px;
-}
-
-.important-links {
- margin: 30px 5px;
-}
-
-.patient-name {
- font-size: 20px;
- margin-top: 25px;
-}
-
-/* heatmap */
-
-.heatmap-container {
- height: 170px;
-}
-
-.patient-heatmap {
- width: 80%;
- display: inline-block;
-}
-
-.patient-heatmap .chart-container {
- margin-left: 30px;
-}
-
-.patient-heatmap .frappe-chart {
- margin-top: 5px;
-}
-
-.patient-heatmap .frappe-chart .chart-legend {
- display: none;
-}
-
-.heatmap-container .chart-filter {
- z-index: 1;
- position: relative;
- top: 5px;
- margin-right: 10px;
-}
-
-/* percentage chart */
-
-.percentage-chart-container {
- height: 130px;
-}
-
-.percentage-chart-container .chart-filter {
- position: relative;
- top: 5px;
- margin-right: 10px;
-}
-
-.therapy-session-percentage-chart .frappe-chart {
- position: absolute;
- top: 5px;
-}
-
-/* line charts */
-
-.date-field .clearfix {
- display: none;
-}
-
-.date-field .help-box {
- display: none;
-}
-
-.date-field .frappe-control {
- margin-bottom: 0px !important;
-}
-
-.date-field .form-group {
- margin-bottom: 0px !important;
-}
-
-/* common */
-
-text.title {
- text-transform: uppercase;
- font-size: 11px;
- margin-left: 20px;
- margin-top: 20px;
- display: block;
-}
-
-.chart-filter-search {
- margin-left: 35px;
- width: 25%;
-}
-
-.chart-column-container {
- margin: 5px 0;
-}
-
-.progress-graphs .progress-container {
- margin-bottom: var(--margin-xl);
-}
-
-.line-chart-container .frappe-chart {
- margin-top: -20px;
-}
-
-.line-chart-container {
- margin-bottom: 20px;
-}
-
-.chart-control {
- align-self: center;
- display: flex;
- flex-direction: row-reverse;
- margin-top: -25px;
-}
-
-.chart-control > * {
- margin-right: 10px;
-}
-
-/* mobile */
-
-@media (max-width: 991px) {
- .patient-progress-sidebar {
- display: flex;
- }
-
- .percentage-chart-container {
- border-top: 1px solid #d1d8dd;
- }
-
- .percentage-chart-container .chart-filter {
- z-index: 1;
- position: relative;
- top: 12px;
- margin-right: 10px;
- }
-
- .patient-progress-sidebar .important-links {
- margin: 0;
- }
-
- .patient-progress-sidebar .patient-details {
- width: 50%;
- }
-
- .chart-filter-search {
- width: 40%;
- }
-}
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress.html b/erpnext/healthcare/page/patient_progress/patient_progress.html
deleted file mode 100644
index ee60065618..0000000000
--- a/erpnext/healthcare/page/patient_progress/patient_progress.html
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Therapy Type and Assessment Correlation
-
-
-
-
-
-
-
-
-
Assessment Parameter Wise Progress
-
-
-
-
-
-
-
-
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress.js b/erpnext/healthcare/page/patient_progress/patient_progress.js
deleted file mode 100644
index 3f06f1feba..0000000000
--- a/erpnext/healthcare/page/patient_progress/patient_progress.js
+++ /dev/null
@@ -1,536 +0,0 @@
-frappe.pages['patient-progress'].on_page_load = function(wrapper) {
-
- frappe.ui.make_app_page({
- parent: wrapper,
- title: __('Patient Progress')
- });
-
- let patient_progress = new PatientProgress(wrapper);
- $(wrapper).bind('show', ()=> {
- patient_progress.show();
- });
-};
-
-class PatientProgress {
-
- constructor(wrapper) {
- this.wrapper = $(wrapper);
- this.page = wrapper.page;
- this.sidebar = this.wrapper.find('.layout-side-section');
- this.main_section = this.wrapper.find('.layout-main-section');
- }
-
- show() {
- frappe.breadcrumbs.add('Healthcare');
- this.sidebar.empty();
-
- let me = this;
- let patient = frappe.ui.form.make_control({
- parent: me.sidebar,
- df: {
- fieldtype: 'Link',
- options: 'Patient',
- fieldname: 'patient',
- placeholder: __('Select Patient'),
- only_select: true,
- change: () => {
- me.patient_id = '';
- if (me.patient_id != patient.get_value() && patient.get_value()) {
- me.start = 0;
- me.patient_id = patient.get_value();
- me.make_patient_profile();
- }
- }
- }
- });
- patient.refresh();
-
- if (frappe.route_options && !this.patient) {
- patient.set_value(frappe.route_options.patient);
- this.patient_id = frappe.route_options.patient;
- }
-
- this.sidebar.find('[data-fieldname="patient"]').append('
');
- }
-
- make_patient_profile() {
- this.page.set_title(__('Patient Progress'));
- this.main_section.empty().append(frappe.render_template('patient_progress'));
- this.render_patient_details();
- this.render_heatmap();
- this.render_percentage_chart('therapy_type', 'Therapy Type Distribution');
- this.create_percentage_chart_filters();
- this.show_therapy_progress();
- this.show_assessment_results();
- this.show_therapy_assessment_correlation();
- this.show_assessment_parameter_progress();
- }
-
- get_patient_info() {
- return frappe.xcall('frappe.client.get', {
- doctype: 'Patient',
- name: this.patient_id
- }).then((patient) => {
- if (patient) {
- this.patient = patient;
- }
- });
- }
-
- get_therapy_sessions_count() {
- return frappe.xcall(
- 'erpnext.healthcare.page.patient_progress.patient_progress.get_therapy_sessions_count', {
- patient: this.patient_id,
- }
- ).then(data => {
- if (data) {
- this.total_therapy_sessions = data.total_therapy_sessions;
- this.therapy_sessions_this_month = data.therapy_sessions_this_month;
- }
- });
- }
-
- render_patient_details() {
- this.get_patient_info().then(() => {
- this.get_therapy_sessions_count().then(() => {
- $('.patient-info').empty().append(frappe.render_template('patient_progress_sidebar', {
- patient_image: this.patient.image,
- patient_name: this.patient.patient_name,
- patient_gender: this.patient.sex,
- patient_mobile: this.patient.mobile,
- total_therapy_sessions: this.total_therapy_sessions,
- therapy_sessions_this_month: this.therapy_sessions_this_month
- }));
-
- this.setup_patient_profile_links();
- });
- });
- }
-
- setup_patient_profile_links() {
- this.wrapper.find('.patient-profile-link').on('click', () => {
- frappe.set_route('Form', 'Patient', this.patient_id);
- });
-
- this.wrapper.find('.therapy-plan-link').on('click', () => {
- frappe.route_options = {
- 'patient': this.patient_id,
- 'docstatus': 1
- };
- frappe.set_route('List', 'Therapy Plan');
- });
-
- this.wrapper.find('.patient-history').on('click', () => {
- frappe.route_options = {
- 'patient': this.patient_id
- };
- frappe.set_route('patient_history');
- });
- }
-
- render_heatmap() {
- this.heatmap = new frappe.Chart('.patient-heatmap', {
- type: 'heatmap',
- countLabel: 'Interactions',
- data: {},
- discreteDomains: 1,
- radius: 3,
- height: 150
- });
-
- this.update_heatmap_data();
- this.create_heatmap_chart_filters();
- }
-
- update_heatmap_data(date_from) {
- frappe.xcall('erpnext.healthcare.page.patient_progress.patient_progress.get_patient_heatmap_data', {
- patient: this.patient_id,
- date: date_from || frappe.datetime.year_start(),
- }).then((data) => {
- this.heatmap.update( {dataPoints: data} );
- });
- }
-
- create_heatmap_chart_filters() {
- this.get_patient_info().then(() => {
- let filters = [
- {
- label: frappe.dashboard_utils.get_year(frappe.datetime.now_date()),
- options: frappe.dashboard_utils.get_years_since_creation(this.patient.creation),
- action: (selected_item) => {
- this.update_heatmap_data(frappe.datetime.obj_to_str(selected_item));
- }
- },
- ];
- frappe.dashboard_utils.render_chart_filters(filters, 'chart-filter', '.heatmap-container');
- });
- }
-
- render_percentage_chart(field, title) {
- // REDESIGN-TODO: chart seems to be broken. Enable this once fixed.
- this.wrapper.find('.percentage-chart-container').hide();
- // frappe.xcall(
- // 'erpnext.healthcare.page.patient_progress.patient_progress.get_therapy_sessions_distribution_data', {
- // patient: this.patient_id,
- // field: field
- // }
- // ).then(chart => {
- // if (chart.labels.length) {
- // this.percentage_chart = new frappe.Chart('.therapy-session-percentage-chart', {
- // title: title,
- // type: 'percentage',
- // data: {
- // labels: chart.labels,
- // datasets: chart.datasets
- // },
- // truncateLegends: 1,
- // barOptions: {
- // height: 11,
- // depth: 1
- // },
- // height: 160,
- // maxSlices: 8,
- // colors: ['#5e64ff', '#743ee2', '#ff5858', '#ffa00a', '#feef72', '#28a745', '#98d85b', '#a9a7ac'],
- // });
- // } else {
- // this.wrapper.find('.percentage-chart-container').hide();
- // }
- // });
- }
-
- create_percentage_chart_filters() {
- let filters = [
- {
- label: 'Therapy Type',
- options: ['Therapy Type', 'Exercise Type'],
- fieldnames: ['therapy_type', 'exercise_type'],
- action: (selected_item, fieldname) => {
- let title = selected_item + ' Distribution';
- this.render_percentage_chart(fieldname, title);
- }
- },
- ];
- frappe.dashboard_utils.render_chart_filters(filters, 'chart-filter', '.percentage-chart-container');
- }
-
- create_time_span_filters(action_method, parent) {
- let chart_control = $(parent).find('.chart-control');
- let filters = [
- {
- label: 'Last Month',
- options: ['Select Date Range', 'Last Week', 'Last Month', 'Last Quarter', 'Last Year'],
- action: (selected_item) => {
- if (selected_item === 'Select Date Range') {
- this.render_date_range_fields(action_method, chart_control);
- } else {
- // hide date range field if visible
- let date_field = $(parent).find('.date-field');
- if (date_field.is(':visible')) {
- date_field.hide();
- }
- this[action_method](selected_item);
- }
- }
- }
- ];
- frappe.dashboard_utils.render_chart_filters(filters, 'chart-filter', chart_control, 1);
- }
-
- render_date_range_fields(action_method, parent) {
- let date_field = $(parent).find('.date-field');
-
- if (!date_field.length) {
- let date_field_wrapper = $(
- `
`
- ).appendTo(parent);
-
- let date_range_field = frappe.ui.form.make_control({
- df: {
- fieldtype: 'DateRange',
- fieldname: 'from_date',
- placeholder: 'Date Range',
- input_class: 'input-xs',
- reqd: 1,
- change: () => {
- let selected_date_range = date_range_field.get_value();
- if (selected_date_range && selected_date_range.length === 2) {
- this[action_method](selected_date_range);
- }
- }
- },
- parent: date_field_wrapper,
- render_input: 1
- });
- } else if (!date_field.is(':visible')) {
- date_field.show();
- }
- }
-
- show_therapy_progress() {
- let me = this;
- let therapy_type = frappe.ui.form.make_control({
- parent: $('.therapy-type-search'),
- df: {
- fieldtype: 'Link',
- options: 'Therapy Type',
- fieldname: 'therapy_type',
- placeholder: __('Select Therapy Type'),
- only_select: true,
- change: () => {
- if (me.therapy_type != therapy_type.get_value() && therapy_type.get_value()) {
- me.therapy_type = therapy_type.get_value();
- me.render_therapy_progress_chart();
- }
- }
- }
- });
- therapy_type.refresh();
- this.create_time_span_filters('render_therapy_progress_chart', '.therapy-progress');
- }
-
- render_therapy_progress_chart(time_span='Last Month') {
- if (!this.therapy_type) return;
-
- frappe.xcall(
- 'erpnext.healthcare.page.patient_progress.patient_progress.get_therapy_progress_data', {
- patient: this.patient_id,
- therapy_type: this.therapy_type,
- time_span: time_span
- }
- ).then(chart => {
- let data = {
- labels: chart.labels,
- datasets: chart.datasets
- }
- let parent = '.therapy-progress-line-chart';
- if (!chart.labels.length) {
- this.show_null_state(parent);
- } else {
- if (!this.therapy_line_chart) {
- this.therapy_line_chart = new frappe.Chart(parent, {
- type: 'axis-mixed',
- height: 250,
- data: data,
- lineOptions: {
- regionFill: 1
- },
- axisOptions: {
- xIsSeries: 1
- }
- });
- } else {
- $(parent).find('.chart-container').show();
- $(parent).find('.chart-empty-state').hide();
- this.therapy_line_chart.update(data);
- }
- }
- });
- }
-
- show_assessment_results() {
- let me = this;
- let assessment_template = frappe.ui.form.make_control({
- parent: $('.assessment-template-search'),
- df: {
- fieldtype: 'Link',
- options: 'Patient Assessment Template',
- fieldname: 'assessment_template',
- placeholder: __('Select Assessment Template'),
- only_select: true,
- change: () => {
- if (me.assessment_template != assessment_template.get_value() && assessment_template.get_value()) {
- me.assessment_template = assessment_template.get_value();
- me.render_assessment_result_chart();
- }
- }
- }
- });
- assessment_template.refresh();
- this.create_time_span_filters('render_assessment_result_chart', '.assessment-results');
- }
-
- render_assessment_result_chart(time_span='Last Month') {
- if (!this.assessment_template) return;
-
- frappe.xcall(
- 'erpnext.healthcare.page.patient_progress.patient_progress.get_patient_assessment_data', {
- patient: this.patient_id,
- assessment_template: this.assessment_template,
- time_span: time_span
- }
- ).then(chart => {
- let data = {
- labels: chart.labels,
- datasets: chart.datasets,
- yMarkers: [
- { label: 'Max Score', value: chart.max_score }
- ],
- }
- let parent = '.assessment-results-line-chart';
- if (!chart.labels.length) {
- this.show_null_state(parent);
- } else {
- if (!this.assessment_line_chart) {
- this.assessment_line_chart = new frappe.Chart(parent, {
- type: 'axis-mixed',
- height: 250,
- data: data,
- lineOptions: {
- regionFill: 1
- },
- axisOptions: {
- xIsSeries: 1
- },
- tooltipOptions: {
- formatTooltipY: d => __('{0} out of {1}', [d, chart.max_score])
- }
- });
- } else {
- $(parent).find('.chart-container').show();
- $(parent).find('.chart-empty-state').hide();
- this.assessment_line_chart.update(data);
- }
- }
- });
- }
-
- show_therapy_assessment_correlation() {
- let me = this;
- let assessment = frappe.ui.form.make_control({
- parent: $('.assessment-correlation-template-search'),
- df: {
- fieldtype: 'Link',
- options: 'Patient Assessment Template',
- fieldname: 'assessment',
- placeholder: __('Select Assessment Template'),
- only_select: true,
- change: () => {
- if (me.assessment != assessment.get_value() && assessment.get_value()) {
- me.assessment = assessment.get_value();
- me.render_therapy_assessment_correlation_chart();
- }
- }
- }
- });
- assessment.refresh();
- this.create_time_span_filters('render_therapy_assessment_correlation_chart', '.therapy-assessment-correlation');
- }
-
- render_therapy_assessment_correlation_chart(time_span='Last Month') {
- if (!this.assessment) return;
-
- frappe.xcall(
- 'erpnext.healthcare.page.patient_progress.patient_progress.get_therapy_assessment_correlation_data', {
- patient: this.patient_id,
- assessment_template: this.assessment,
- time_span: time_span
- }
- ).then(chart => {
- let data = {
- labels: chart.labels,
- datasets: chart.datasets,
- yMarkers: [
- { label: 'Max Score', value: chart.max_score }
- ],
- }
- let parent = '.therapy-assessment-correlation-chart';
- if (!chart.labels.length) {
- this.show_null_state(parent);
- } else {
- if (!this.correlation_chart) {
- this.correlation_chart = new frappe.Chart(parent, {
- type: 'axis-mixed',
- height: 300,
- data: data,
- axisOptions: {
- xIsSeries: 1
- }
- });
- } else {
- $(parent).find('.chart-container').show();
- $(parent).find('.chart-empty-state').hide();
- this.correlation_chart.update(data);
- }
- }
- });
- }
-
- show_assessment_parameter_progress() {
- let me = this;
- let parameter = frappe.ui.form.make_control({
- parent: $('.assessment-parameter-search'),
- df: {
- fieldtype: 'Link',
- options: 'Patient Assessment Parameter',
- fieldname: 'assessment',
- placeholder: __('Select Assessment Parameter'),
- only_select: true,
- change: () => {
- if (me.parameter != parameter.get_value() && parameter.get_value()) {
- me.parameter = parameter.get_value();
- me.render_assessment_parameter_progress_chart();
- }
- }
- }
- });
- parameter.refresh();
- this.create_time_span_filters('render_assessment_parameter_progress_chart', '.assessment-parameter-progress');
- }
-
- render_assessment_parameter_progress_chart(time_span='Last Month') {
- if (!this.parameter) return;
-
- frappe.xcall(
- 'erpnext.healthcare.page.patient_progress.patient_progress.get_assessment_parameter_data', {
- patient: this.patient_id,
- parameter: this.parameter,
- time_span: time_span
- }
- ).then(chart => {
- let data = {
- labels: chart.labels,
- datasets: chart.datasets
- }
- let parent = '.assessment-parameter-progress-chart';
- if (!chart.labels.length) {
- this.show_null_state(parent);
- } else {
- if (!this.parameter_chart) {
- this.parameter_chart = new frappe.Chart(parent, {
- type: 'line',
- height: 250,
- data: data,
- lineOptions: {
- regionFill: 1
- },
- axisOptions: {
- xIsSeries: 1
- },
- tooltipOptions: {
- formatTooltipY: d => d + '%'
- }
- });
- } else {
- $(parent).find('.chart-container').show();
- $(parent).find('.chart-empty-state').hide();
- this.parameter_chart.update(data);
- }
- }
- });
- }
-
- show_null_state(parent) {
- let null_state = $(parent).find('.chart-empty-state');
- if (null_state.length) {
- $(null_state).show();
- } else {
- null_state = $(
- `${__(
- "No Data..."
- )}
`
- );
- $(parent).append(null_state);
- }
- $(parent).find('.chart-container').hide();
- }
-}
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress.json b/erpnext/healthcare/page/patient_progress/patient_progress.json
deleted file mode 100644
index 0175cb9c45..0000000000
--- a/erpnext/healthcare/page/patient_progress/patient_progress.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "content": null,
- "creation": "2020-06-12 15:46:23.111928",
- "docstatus": 0,
- "doctype": "Page",
- "idx": 0,
- "modified": "2020-07-23 21:45:45.540055",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "patient-progress",
- "owner": "Administrator",
- "page_name": "patient-progress",
- "restrict_to_domain": "Healthcare",
- "roles": [
- {
- "role": "Healthcare Administrator"
- },
- {
- "role": "Physician"
- },
- {
- "role": "Patient"
- },
- {
- "role": "System Manager"
- }
- ],
- "script": null,
- "standard": "Yes",
- "style": null,
- "system_page": 0,
- "title": "Patient Progress"
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress.py b/erpnext/healthcare/page/patient_progress/patient_progress.py
deleted file mode 100644
index c17f10574a..0000000000
--- a/erpnext/healthcare/page/patient_progress/patient_progress.py
+++ /dev/null
@@ -1,198 +0,0 @@
-import json
-from datetime import datetime
-
-import frappe
-from frappe import _
-from frappe.utils import get_timespan_date_range, getdate
-
-
-@frappe.whitelist()
-def get_therapy_sessions_count(patient):
- total = frappe.db.count('Therapy Session', filters={
- 'docstatus': 1,
- 'patient': patient
- })
-
- month_start = datetime.today().replace(day=1)
- this_month = frappe.db.count('Therapy Session', filters={
- 'creation': ['>', month_start],
- 'docstatus': 1,
- 'patient': patient
- })
-
- return {
- 'total_therapy_sessions': total,
- 'therapy_sessions_this_month': this_month
- }
-
-
-@frappe.whitelist()
-def get_patient_heatmap_data(patient, date):
- return dict(frappe.db.sql("""
- SELECT
- unix_timestamp(communication_date), count(*)
- FROM
- `tabPatient Medical Record`
- WHERE
- communication_date > subdate(%(date)s, interval 1 year) and
- communication_date < subdate(%(date)s, interval -1 year) and
- patient = %(patient)s
- GROUP BY communication_date
- ORDER BY communication_date asc""", {'date': date, 'patient': patient}))
-
-
-@frappe.whitelist()
-def get_therapy_sessions_distribution_data(patient, field):
- if field == 'therapy_type':
- result = frappe.db.get_all('Therapy Session',
- filters = {'patient': patient, 'docstatus': 1},
- group_by = field,
- order_by = field,
- fields = [field, 'count(*)'],
- as_list = True)
-
- elif field == 'exercise_type':
- data = frappe.db.get_all('Therapy Session', filters={
- 'docstatus': 1,
- 'patient': patient
- }, as_list=True)
- therapy_sessions = [entry[0] for entry in data]
-
- result = frappe.db.get_all('Exercise',
- filters = {
- 'parenttype': 'Therapy Session',
- 'parent': ['in', therapy_sessions],
- 'docstatus': 1
- },
- group_by = field,
- order_by = field,
- fields = [field, 'count(*)'],
- as_list = True)
-
- return {
- 'labels': [r[0] for r in result if r[0] != None],
- 'datasets': [{
- 'values': [r[1] for r in result]
- }]
- }
-
-
-@frappe.whitelist()
-def get_therapy_progress_data(patient, therapy_type, time_span):
- date_range = get_date_range(time_span)
- query_values = {'from_date': date_range[0], 'to_date': date_range[1], 'therapy_type': therapy_type, 'patient': patient}
- result = frappe.db.sql("""
- SELECT
- start_date, total_counts_targeted, total_counts_completed
- FROM
- `tabTherapy Session`
- WHERE
- start_date BETWEEN %(from_date)s AND %(to_date)s and
- docstatus = 1 and
- therapy_type = %(therapy_type)s and
- patient = %(patient)s
- ORDER BY start_date""", query_values, as_list=1)
-
- return {
- 'labels': [r[0] for r in result if r[0] != None],
- 'datasets': [
- { 'name': _('Targetted'), 'values': [r[1] for r in result if r[0] != None] },
- { 'name': _('Completed'), 'values': [r[2] for r in result if r[0] != None] }
- ]
- }
-
-@frappe.whitelist()
-def get_patient_assessment_data(patient, assessment_template, time_span):
- date_range = get_date_range(time_span)
- query_values = {'from_date': date_range[0], 'to_date': date_range[1], 'assessment_template': assessment_template, 'patient': patient}
- result = frappe.db.sql("""
- SELECT
- assessment_datetime, total_score, total_score_obtained
- FROM
- `tabPatient Assessment`
- WHERE
- DATE(assessment_datetime) BETWEEN %(from_date)s AND %(to_date)s and
- docstatus = 1 and
- assessment_template = %(assessment_template)s and
- patient = %(patient)s
- ORDER BY assessment_datetime""", query_values, as_list=1)
-
- return {
- 'labels': [getdate(r[0]) for r in result if r[0] != None],
- 'datasets': [
- { 'name': _('Score Obtained'), 'values': [r[2] for r in result if r[0] != None] }
- ],
- 'max_score': result[0][1] if result else None
- }
-
-@frappe.whitelist()
-def get_therapy_assessment_correlation_data(patient, assessment_template, time_span):
- date_range = get_date_range(time_span)
- query_values = {'from_date': date_range[0], 'to_date': date_range[1], 'assessment': assessment_template, 'patient': patient}
- result = frappe.db.sql("""
- SELECT
- therapy.therapy_type, count(*), avg(assessment.total_score_obtained), total_score
- FROM
- `tabPatient Assessment` assessment INNER JOIN `tabTherapy Session` therapy
- ON
- assessment.therapy_session = therapy.name
- WHERE
- DATE(assessment.assessment_datetime) BETWEEN %(from_date)s AND %(to_date)s and
- assessment.docstatus = 1 and
- assessment.patient = %(patient)s and
- assessment.assessment_template = %(assessment)s
- GROUP BY therapy.therapy_type
- """, query_values, as_list=1)
-
- return {
- 'labels': [r[0] for r in result if r[0] != None],
- 'datasets': [
- { 'name': _('Sessions'), 'chartType': 'bar', 'values': [r[1] for r in result if r[0] != None] },
- { 'name': _('Average Score'), 'chartType': 'line', 'values': [round(r[2], 2) for r in result if r[0] != None] }
- ],
- 'max_score': result[0][1] if result else None
- }
-
-@frappe.whitelist()
-def get_assessment_parameter_data(patient, parameter, time_span):
- date_range = get_date_range(time_span)
- query_values = {'from_date': date_range[0], 'to_date': date_range[1], 'parameter': parameter, 'patient': patient}
- results = frappe.db.sql("""
- SELECT
- assessment.assessment_datetime,
- sheet.score,
- template.scale_max
- FROM
- `tabPatient Assessment Sheet` sheet
- INNER JOIN `tabPatient Assessment` assessment
- ON sheet.parent = assessment.name
- INNER JOIN `tabPatient Assessment Template` template
- ON template.name = assessment.assessment_template
- WHERE
- DATE(assessment.assessment_datetime) BETWEEN %(from_date)s AND %(to_date)s and
- assessment.docstatus = 1 and
- sheet.parameter = %(parameter)s and
- assessment.patient = %(patient)s
- ORDER BY
- assessment.assessment_datetime asc
- """, query_values, as_list=1)
-
- score_percentages = []
- for r in results:
- if r[2] != 0 and r[0] != None:
- score = round((int(r[1]) / int(r[2])) * 100, 2)
- score_percentages.append(score)
-
- return {
- 'labels': [getdate(r[0]) for r in results if r[0] != None],
- 'datasets': [
- { 'name': _('Score'), 'values': score_percentages }
- ]
- }
-
-def get_date_range(time_span):
- try:
- time_span = json.loads(time_span)
- return time_span
- except json.decoder.JSONDecodeError:
- return get_timespan_date_range(time_span.lower())
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress_sidebar.html b/erpnext/healthcare/page/patient_progress/patient_progress_sidebar.html
deleted file mode 100644
index 4ee65738ba..0000000000
--- a/erpnext/healthcare/page/patient_progress/patient_progress_sidebar.html
+++ /dev/null
@@ -1,29 +0,0 @@
-
diff --git a/erpnext/healthcare/print_format/__init__.py b/erpnext/healthcare/print_format/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/print_format/encounter_print/__init__.py b/erpnext/healthcare/print_format/encounter_print/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/print_format/encounter_print/encounter_print.json b/erpnext/healthcare/print_format/encounter_print/encounter_print.json
deleted file mode 100644
index 3c90adb0a1..0000000000
--- a/erpnext/healthcare/print_format/encounter_print/encounter_print.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "align_labels_right": 0,
- "creation": "2017-04-10 14:05:53.355863",
- "custom_format": 1,
- "disabled": 0,
- "doc_type": "Patient Encounter",
- "docstatus": 0,
- "doctype": "Print Format",
- "font": "Default",
- "html": "\n {% if letter_head and not no_letterhead -%}\n
{{ letter_head }}
\n
\n {% else %}\n
\n
{{doc.name}} \n \n {%- endif %}\n
\n
\n {% if doc.appointment %}\n\t
\n\t\t\t
\n\t\t\tAppointment \n\t\t\t
\n\t\t\t
\n\t\t\t: {{doc.appointment}}\n\t\t\t
\n\t\t
\n\t\t{%- endif -%}\n\n
\n\t\t
\n\t\t\t Patient \n\t\t
\n {% if doc.patient %}\n\t\t
\n\t\t\t : {{doc.patient}}\n\t\t
\n {% else %}\n
\n\t\t\t : Patient Name \n\t\t
\n {%- endif -%}\n\t\t
\n\t
\n\t\t\t
\n\t\t\t\tAge \n\t\t\t
\n\t\t\t
\n\t\t\t : {{doc.patient_age}}\n\t\t\t
\n\t\t
\n\n
\n
\n\t\t\t\tGender \n\t\t\t
\n\t\t\t
\n\t\t\t : {{doc.patient_sex}}\n\t\t\t
\n
\n\n
\n
\n\n
\n\t
\n\t\t Healthcare Practitioner \n\t
\n {% if doc.practitioner %}\n\t
\n\t\t\t: {{doc.practitioner}}\n\t
\n {%- endif -%}\n\t
\n\n {% if doc.encounter_date %}\n\t
\n\t\t
\n\t\tDate \n\t\t
\n\t\t
\n\t\t: {{doc.encounter_date}}\n\t\t
\n
\n\t {%- endif -%}\n {% if doc.encounter_time %}\n\t
\n\t\t
\n\t\tTime \n\t\t
\n\t\t
\n\t\t: {{doc.encounter_time}}\n\t\t
\n
\n\t {%- endif -%}\n {% if doc.medical_department %}\n\t
\n\t\t
\n\t\tDepartment \n\t\t
\n\t\t
\n\t\t: {{doc.visit_department}}\n\t\t
\n
\n {%- endif -%}\n
\n\n
\n\n
\n\n
\n {% if doc.symptoms_in_print%}\n {% if doc.symptoms %}\n Complaints:\n {{doc.symptoms}} \n \t \n {%- endif -%}\n {%- endif -%}\n\n {% if doc.diagnosis_in_print%}\n {% if doc.diagnosis %}\n \t Diagnosis:\n {{doc.diagnosis}} \n \n {%- endif -%}\n {%- endif -%}\n\n\n\n\n {% if doc.drug_prescription %}\n
\n Rx,\n
\n \n \n\n {%- for row in doc.drug_prescription -%}\n \n \n {%- if row.drug_name -%}{{ row.drug_name }} {%- endif -%}\n \n \t\n {%- if row.dosage -%}{{ row.dosage }}{%- endif -%}\n \n \t\n {%- if row.period -%}{{ row.period }}{%- endif -%}\n\t\t \n \n\t\t\t \n {%- if row.comment -%}{{ row.comment }}{%- endif -%}\n
\n\t\t \n \n\t {%- endfor -%}\n \n
\n\n\n {%- endif -%}\n
\n\n\n\n {% if doc.lab_test_prescription %}\n Investigations,\n
\n \n \n\n {%- for row in doc.lab_test_prescription -%}\n \n \n {%- if row.lab_test_name -%}{{ row.lab_test_name }} {%- endif -%}\n \n \n\t\t\t \n {%- if row.lab_test_comment -%}{{ row.lab_test_comment }}{%- endif -%}\n
\n\t\t \n \n\n\t {%- endfor -%}\n \n
\n\n\n {%- endif -%}\n
\n\n {% if doc.encounter_comment %}\n \n {{doc.encounter_comment}}\n {%- endif -%}\n
\n",
- "idx": 0,
- "line_breaks": 0,
- "modified": "2018-09-04 11:52:54.473702",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Encounter Print",
- "owner": "Administrator",
- "print_format_builder": 0,
- "print_format_type": "Jinja",
- "show_section_headings": 0,
- "standard": "Yes"
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/print_format/lab_test_print/__init__.py b/erpnext/healthcare/print_format/lab_test_print/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json b/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json
deleted file mode 100644
index f7d16769c6..0000000000
--- a/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "align_labels_right": 0,
- "creation": "2017-04-24 15:38:45.332473",
- "custom_format": 1,
- "disabled": 0,
- "doc_type": "Lab Test",
- "docstatus": 0,
- "doctype": "Print Format",
- "font": "Default",
- "html": "\n {% if letter_head and not no_letterhead -%}\n
{{ letter_head }}
\n
\n {%- endif %}\n\n {% if (doc.docstatus != 1) %}\n
WORKSHEET \n\t
\n\t
\n
\n\n
\n
\n Patient \n
\n {% if doc.patient_name %}\n
\n {{ doc.patient_name }}\n
\n {% else %}\n
\n {{ doc.patient }}\n
\n {%- endif -%}\n
\n\n
\n
\n Age \n
\n
\n {{ doc.patient_age or '' }}\n
\n
\n\n
\n
\n Gender \n
\n
\n {{ doc.patient_sex or '' }}\n
\n
\n\n
\n\n
\n\n
\n
\n Practitioner \n
\n {% if doc.practitioner_name %}\n
\n {{ doc.practitioner_name }}\n
\n {% else %}\n\t\t\t{% if doc.referring_practitioner_name %}\n
\n {{ doc.referring_practitioner_name }}\n
\n\t\t {% endif %}\n {%- endif -%}\n
\n\n {% if doc.sample_date %}\n
\n
\n Sample Date \n
\n
\n {{ doc.sample_date }}\n
\n
\n {%- endif -%}\n
\n
\n\n\t
\n
Department of {{ doc.department }} \n \n\n\t
\n \n {%- if doc.normal_test_items -%}\n \n Name of Test \n Result \n Normal Range \n \n\n {%- if doc.normal_test_items|length > 1 %}\n {{ doc.lab_test_name }} \n {%- endif -%}\n\n {%- for row in doc.normal_test_items -%}\n \n \n {%- if doc.normal_test_items|length > 1 %} {%- endif -%}\n {%- if row.lab_test_name -%}{{ row.lab_test_name }} \n {%- else -%} {%- endif -%}\n {%- if row.lab_test_event -%} {{ row.lab_test_event }}{%- endif -%}\n \n\n \n {%- if row.lab_test_uom -%} {{ row.lab_test_uom }}{%- endif -%}\n \n\n \n \n {%- if row.normal_range -%}{{ row.normal_range }}{%- endif -%}\n
\n \n \n\n {%- endfor -%}\n {%- endif -%}\n \n
\n\n\t
\n \n {%- if doc.descriptive_test_items -%}\n \n Name of Test \n Result \n \n {{ doc.lab_test_name }} \n\t\t\t{% set gr_lab_test_name = {'ltname': ''} %}\n {%- for row in doc.descriptive_test_items -%}\n\t\t\t{%- if row.lab_test_name -%}\n\t\t\t{%- if row.lab_test_name != gr_lab_test_name.ltname -%}\n\t\t\t\n\t\t\t\t {{ row.lab_test_name }} \n\t\t\t\t \n\t\t\t \n\t\t\t{% if gr_lab_test_name.update({'ltname': row.lab_test_name}) %} {% endif %}\n\t\t\t{%- endif -%}\n\t\t\t{%- endif -%}\n \n {{ row.lab_test_particulars }} \n \n \n {%- endfor -%}\n {%- endif -%}\n \n
\n
\n {% if doc.worksheet_instructions %}\n
\n Instructions \n {{ doc.worksheet_instructions }}\n {%- endif -%}\n\n {% elif (frappe.db.get_value(\"Healthcare Settings\", \"None\", \"require_test_result_approval\") == '1' and doc.status != \"Approved\") %}\n
Lab Tests have to be Approved for Print .. ! \n {%- else -%}\n
\n
\n\n
\n
\n Patient \n
\n {% if doc.patient_name %}\n
\n {{ doc.patient_name }}\n
\n {% else %}\n
\n {{ doc.patient }}\n
\n {%- endif -%}\n
\n\n
\n
\n Age \n
\n
\n {{ doc.patient_age or '' }}\n
\n
\n\n
\n
\n Gender \n
\n
\n {{ doc.patient_sex or '' }}\n
\n
\n\n
\n\n
\n\n
\n
\n Practitioner \n
\n {% if doc.practitioner_name %}\n
\n {{ doc.practitioner_name }}\n
\n\t\t{% else %}\n\t\t {% if doc.referring_practitioner_name %}\n
\n {{ doc.referring_practitioner_name }}\n
\n\t\t\t{% endif %}\n {%- endif -%}\n
\n\n {% if doc.sample_date %}\n
\n
\n Sample Date \n
\n
\n {{ doc.sample_date }}\n
\n
\n {%- endif -%}\n\n {% if doc.result_date %}\n
\n
\n Result Date \n
\n
\n {{ doc.result_date }}\n
\n
\n {%- endif -%}\n\n
\n\n
\n\n
\n
Department of {{ doc.department }} \n \n\n\t
\n\t\t{% if doc.result_legend and (doc.legend_print_position == \"Top\" or doc.legend_print_position == \"Both\")%}\n\t\tResult Legend: \n\t\t{{ doc.result_legend }}\n\t\t{%- endif -%}\n\t
\n\n
\n \n {%- if doc.normal_test_items -%}\n \n Name of Test \n Result \n Normal Range \n \n\n {%- if doc.normal_test_items|length > 1 %}\n {{ doc.lab_test_name }} \n {%- endif -%}\n\n {%- for row in doc.normal_test_items -%}\n \n \n {%- if doc.normal_test_items|length > 1 %} {%- endif -%}\n {%- if row.lab_test_name -%}{{ row.lab_test_name }} \n {%- else -%} {%- endif -%}\n {%- if row.lab_test_event -%} {{ row.lab_test_event }}{%- endif -%}\n \n\n \n\t\t\t\t\t{%- if row.result_value -%}\n\t\t\t\t\t\t{%- if row.bold -%}{% endif %}\n\t\t\t\t\t\t{%- if row.underline -%}{% endif %}\n\t\t\t\t\t\t{%- if row.italic -%}{% endif %}\n {{ row.result_value }}\n {%- if row.lab_test_uom -%} {{ row.lab_test_uom }}{%- endif -%}\n\t\t\t\t\t\t{%- if row.italic -%} {% endif %}\n\t\t\t\t\t\t{%- if row.underline -%} {% endif %}\n\t\t\t\t\t\t{%- if row.bold -%} {% endif %}\n\t\t\t\t\t{%- endif -%}\n \n\t\t\t\t\t{%- if row.secondary_uom and row.conversion_factor and row.secondary_uom_result -%}\n\t\t\t\t\t\t \n\t\t\t\t\t\t{%- if row.bold -%}{% endif %}\n\t\t\t\t\t\t{%- if row.underline -%}{% endif %}\n\t\t\t\t\t\t{%- if row.italic -%}{% endif %}\n {{ row.secondary_uom_result }}\n {{ row.secondary_uom }}\n\t\t\t\t\t\t{%- if row.italic -%} {% endif %}\n\t\t\t\t\t\t{%- if row.underline -%} {% endif %}\n\t\t\t\t\t\t{%- if row.bold -%} {% endif %}\n\t\t\t\t\t\t \n\t\t\t\t\t{%- endif -%}\n \n\n \n \n {%- if row.normal_range -%}{{ row.normal_range }}{%- endif -%}\n
\n \n \n\n {%- endfor -%}\n {%- endif -%}\n \n
\n\n
\n \n {%- if doc.descriptive_test_items -%}\n \n Name of Test \n Result \n \n {{ doc.lab_test_name }} \n\t\t\t{% set gr_lab_test_name = {'ltname': ''} %}\n {%- for row in doc.descriptive_test_items -%}\n\t\t\t{%- if row.lab_test_name -%}\n\t\t\t{%- if row.lab_test_name != gr_lab_test_name.ltname -%}\n\t\t\t\n\t\t\t\t {{ row.lab_test_name }} \n\t\t\t\t \n\t\t\t \n\t\t\t{% if gr_lab_test_name.update({'ltname': row.lab_test_name}) %} {% endif %}\n\t\t\t{%- endif -%}\n\t\t\t{%- endif -%}\n \n {{ row.lab_test_particulars }} \n \n {%- if row.result_value -%}{{ row.result_value }}{%- endif -%}\n \n \n {%- endfor -%}\n {%- endif -%}\n\n\t\t\t{%- if doc.organisms -%}\n\t\t\t\n\t\t\t\tOrganism \n\t\t\t\tColony Population \n\t\t\t \n\t\t\t{%- for row in doc.organisms -%}\n\t\t\t\n\t\t\t\t {{ row.organism }} \n\t\t\t\t\n\t\t\t\t\t{{ row.colony_population }}\n\t\t\t\t\t{% if row.colony_uom %}\n\t\t\t\t\t\t{{ row.colony_uom }}\n\t\t\t\t\t{% endif %}\n\t\t\t\t \n\t\t\t \n\t\t\t{%- endfor -%}\n\t\t\t{%- endif -%}\n\n\t\t\t{%- if doc.sensitivity_test_items -%}\n\t\t\t\n\t\t\t\tAntibiotic \n\t\t\t\tSensitivity \n\t\t\t \n\t\t\t{%- for row in doc.sensitivity_test_items -%}\n\t\t\t\n\t\t\t\t {{ row.antibiotic }} \n\t\t\t\t{{ row.antibiotic_sensitivity }} \n\t\t\t \n\t\t\t{%- endfor -%}\n\t\t\t{%- endif -%}\n\n \n
\n
\n {% if doc.custom_result %}\n
\n
{{ doc.custom_result }}
\n {%- endif -%}\n
\n\n
\n {% if doc.lab_test_comment %}\n \n Comments \n {{ doc.lab_test_comment }}\n {%- endif -%}\n
\n\n
\n {%- if (frappe.db.get_value(\"Healthcare Settings\", \"None\", \"employee_name_and_designation_in_print\") == '1') -%}\n {%- if doc.employee_name -%}\n
{{ doc.employee_name }} \n {%- endif -%}\n {%- if doc.employee_designation -%}\n {{ doc.employee_designation }} \n {%- endif -%}\n {%- else -%}\n {%- if frappe.db.get_value(\"Healthcare Settings\", \"None\", \"custom_signature_in_print\") -%}\n {{ frappe.db.get_value(\"Healthcare Settings\", \"None\", \"custom_signature_in_print\") }} \n {%- endif -%}\n {%- endif -%}\n \n\n
\n {% if doc.result_legend and (doc.legend_print_position == \"Bottom\" or doc.legend_print_position == \"Both\" or doc.legend_print_position == \"\")%}\n
\n Result Legend \n {{ doc.result_legend }}\n {%- endif -%}\n \n {%- endif -%}\n
",
- "idx": 0,
- "line_breaks": 0,
- "modified": "2020-07-08 15:34:28.866798",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Lab Test Print",
- "owner": "Administrator",
- "print_format_builder": 0,
- "print_format_type": "Jinja",
- "raw_printing": 0,
- "show_section_headings": 0,
- "standard": "Yes"
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/print_format/sample_id_print/__init__.py b/erpnext/healthcare/print_format/sample_id_print/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json b/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json
deleted file mode 100644
index 4819e6d57a..0000000000
--- a/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "align_labels_left": 0,
- "creation": "2017-02-17 17:40:52.967840",
- "custom_format": 1,
- "disabled": 0,
- "doc_type": "Sample Collection",
- "docstatus": 0,
- "doctype": "Print Format",
- "font": "Default",
- "html": "\n{% set column = 0 %}\n\n{% for _ in range(0, doc.num_print) %}\n{% if column == 0 -%}{% endif %}\n\t{{doc.name}} {{doc.patient}} \n{% if doc.patient_age %}{{doc.patient_age}}, {% endif %} {% if doc.patient_sex %}{{doc.patient_sex}}{% endif %} {% if doc.collected_time %}{{doc.collected_time}} {% endif %} {% if doc.collected_by %} {{doc.collected_by}} {% endif %} \n{% if column == 0 %}{% set column = column+1 %}\n{% elif column == 2%} {%- set column = 0 %}\n{% else %}{%- set column = column+1 -%}{%- endif %}\n\t\n{% endfor %}\n
",
- "idx": 0,
- "line_breaks": 0,
- "modified": "2017-03-30 18:09:39.537609",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Sample ID Print",
- "owner": "Administrator",
- "print_format_builder": 0,
- "print_format_type": "Jinja",
- "show_section_headings": 0,
- "standard": "Yes"
-}
diff --git a/erpnext/healthcare/report/__init__.py b/erpnext/healthcare/report/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/report/inpatient_medication_orders/__init__.py b/erpnext/healthcare/report/inpatient_medication_orders/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.js b/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.js
deleted file mode 100644
index a10f83760f..0000000000
--- a/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.js
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-/* eslint-disable */
-
-frappe.query_reports["Inpatient Medication Orders"] = {
- "filters": [
- {
- fieldname: "company",
- label: __("Company"),
- fieldtype: "Link",
- options: "Company",
- default: frappe.defaults.get_user_default("Company"),
- reqd: 1
- },
- {
- fieldname: "from_date",
- label: __("From Date"),
- fieldtype: "Date",
- default: frappe.datetime.add_months(frappe.datetime.get_today(), -1),
- reqd: 1
- },
- {
- fieldname: "to_date",
- label: __("To Date"),
- fieldtype: "Date",
- default: frappe.datetime.now_date(),
- reqd: 1
- },
- {
- fieldname: "patient",
- label: __("Patient"),
- fieldtype: "Link",
- options: "Patient"
- },
- {
- fieldname: "service_unit",
- label: __("Healthcare Service Unit"),
- fieldtype: "Link",
- options: "Healthcare Service Unit",
- get_query: () => {
- var company = frappe.query_report.get_filter_value('company');
- return {
- filters: {
- 'company': company,
- 'is_group': 0
- }
- }
- }
- },
- {
- fieldname: "show_completed_orders",
- label: __("Show Completed Orders"),
- fieldtype: "Check",
- default: 1
- }
- ]
-};
diff --git a/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.json b/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.json
deleted file mode 100644
index 9217fa1891..0000000000
--- a/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "add_total_row": 0,
- "columns": [],
- "creation": "2020-11-23 17:25:58.802949",
- "disable_prepared_report": 0,
- "disabled": 0,
- "docstatus": 0,
- "doctype": "Report",
- "filters": [],
- "idx": 0,
- "is_standard": "Yes",
- "json": "{}",
- "modified": "2020-11-23 19:40:20.227591",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Inpatient Medication Orders",
- "owner": "Administrator",
- "prepared_report": 0,
- "ref_doctype": "Inpatient Medication Order",
- "report_name": "Inpatient Medication Orders",
- "report_type": "Script Report",
- "roles": [
- {
- "role": "System Manager"
- },
- {
- "role": "Healthcare Administrator"
- },
- {
- "role": "Nursing User"
- },
- {
- "role": "Physician"
- }
- ]
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.py b/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.py
deleted file mode 100644
index 2e809fb66b..0000000000
--- a/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.py
+++ /dev/null
@@ -1,203 +0,0 @@
-# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
-# For license information, please see license.txt
-
-from __future__ import unicode_literals
-
-import frappe
-
-from erpnext.healthcare.doctype.inpatient_medication_entry.inpatient_medication_entry import (
- get_current_healthcare_service_unit,
-)
-
-
-def execute(filters=None):
- columns = get_columns()
- data = get_data(filters)
- chart = get_chart_data(data)
-
- return columns, data, None, chart
-
-def get_columns():
- return [
- {
- "fieldname": "patient",
- "fieldtype": "Link",
- "label": "Patient",
- "options": "Patient",
- "width": 200
- },
- {
- "fieldname": "healthcare_service_unit",
- "fieldtype": "Link",
- "label": "Healthcare Service Unit",
- "options": "Healthcare Service Unit",
- "width": 150
- },
- {
- "fieldname": "drug",
- "fieldtype": "Link",
- "label": "Drug Code",
- "options": "Item",
- "width": 150
- },
- {
- "fieldname": "drug_name",
- "fieldtype": "Data",
- "label": "Drug Name",
- "width": 150
- },
- {
- "fieldname": "dosage",
- "fieldtype": "Link",
- "label": "Dosage",
- "options": "Prescription Dosage",
- "width": 80
- },
- {
- "fieldname": "dosage_form",
- "fieldtype": "Link",
- "label": "Dosage Form",
- "options": "Dosage Form",
- "width": 100
- },
- {
- "fieldname": "date",
- "fieldtype": "Date",
- "label": "Date",
- "width": 100
- },
- {
- "fieldname": "time",
- "fieldtype": "Time",
- "label": "Time",
- "width": 100
- },
- {
- "fieldname": "is_completed",
- "fieldtype": "Check",
- "label": "Is Order Completed",
- "width": 100
- },
- {
- "fieldname": "healthcare_practitioner",
- "fieldtype": "Link",
- "label": "Healthcare Practitioner",
- "options": "Healthcare Practitioner",
- "width": 200
- },
- {
- "fieldname": "inpatient_medication_entry",
- "fieldtype": "Link",
- "label": "Inpatient Medication Entry",
- "options": "Inpatient Medication Entry",
- "width": 200
- },
- {
- "fieldname": "inpatient_record",
- "fieldtype": "Link",
- "label": "Inpatient Record",
- "options": "Inpatient Record",
- "width": 200
- }
- ]
-
-def get_data(filters):
- conditions, values = get_conditions(filters)
-
- data = frappe.db.sql("""
- SELECT
- parent.patient, parent.inpatient_record, parent.practitioner,
- child.drug, child.drug_name, child.dosage, child.dosage_form,
- child.date, child.time, child.is_completed, child.name
- FROM `tabInpatient Medication Order` parent
- INNER JOIN `tabInpatient Medication Order Entry` child
- ON child.parent = parent.name
- WHERE
- parent.docstatus = 1
- {conditions}
- ORDER BY date, time
- """.format(conditions=conditions), values, as_dict=1)
-
- data = get_inpatient_details(data, filters.get("service_unit"))
-
- return data
-
-def get_conditions(filters):
- conditions = ""
- values = dict()
-
- if filters.get("company"):
- conditions += " AND parent.company = %(company)s"
- values["company"] = filters.get("company")
-
- if filters.get("from_date") and filters.get("to_date"):
- conditions += " AND child.date BETWEEN %(from_date)s and %(to_date)s"
- values["from_date"] = filters.get("from_date")
- values["to_date"] = filters.get("to_date")
-
- if filters.get("patient"):
- conditions += " AND parent.patient = %(patient)s"
- values["patient"] = filters.get("patient")
-
- if not filters.get("show_completed_orders"):
- conditions += " AND child.is_completed = 0"
-
- return conditions, values
-
-
-def get_inpatient_details(data, service_unit):
- service_unit_filtered_data = []
-
- for entry in data:
- entry["healthcare_service_unit"] = get_current_healthcare_service_unit(entry.inpatient_record)
- if entry.is_completed:
- entry["inpatient_medication_entry"] = get_inpatient_medication_entry(entry.name)
-
- if service_unit and entry.healthcare_service_unit and service_unit != entry.healthcare_service_unit:
- service_unit_filtered_data.append(entry)
-
- entry.pop("name", None)
-
- for entry in service_unit_filtered_data:
- data.remove(entry)
-
- return data
-
-def get_inpatient_medication_entry(order_entry):
- return frappe.db.get_value("Inpatient Medication Entry Detail", {"against_imoe": order_entry}, "parent")
-
-def get_chart_data(data):
- if not data:
- return None
-
- labels = ["Pending", "Completed"]
- datasets = []
-
- status_wise_data = {
- "Pending": 0,
- "Completed": 0
- }
-
- for d in data:
- if d.is_completed:
- status_wise_data["Completed"] += 1
- else:
- status_wise_data["Pending"] += 1
-
- datasets.append({
- "name": "Inpatient Medication Order Status",
- "values": [status_wise_data.get("Pending"), status_wise_data.get("Completed")]
- })
-
- chart = {
- "data": {
- "labels": labels,
- "datasets": datasets
- },
- "type": "donut",
- "height": 300
- }
-
- chart["fieldtype"] = "Data"
-
- return chart
diff --git a/erpnext/healthcare/report/inpatient_medication_orders/test_inpatient_medication_orders.py b/erpnext/healthcare/report/inpatient_medication_orders/test_inpatient_medication_orders.py
deleted file mode 100644
index 7f7bebf514..0000000000
--- a/erpnext/healthcare/report/inpatient_medication_orders/test_inpatient_medication_orders.py
+++ /dev/null
@@ -1,146 +0,0 @@
-# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-
-import datetime
-import unittest
-
-import frappe
-from frappe.utils import getdate, now_datetime
-
-from erpnext.healthcare.doctype.inpatient_medication_order.test_inpatient_medication_order import (
- create_ipme,
- create_ipmo,
-)
-from erpnext.healthcare.doctype.inpatient_record.inpatient_record import (
- admit_patient,
- discharge_patient,
- schedule_discharge,
-)
-from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import (
- create_inpatient,
- create_patient,
- get_healthcare_service_unit,
- mark_invoiced_inpatient_occupancy,
-)
-from erpnext.healthcare.report.inpatient_medication_orders.inpatient_medication_orders import (
- execute,
-)
-
-
-class TestInpatientMedicationOrders(unittest.TestCase):
- @classmethod
- def setUpClass(self):
- frappe.db.sql("delete from `tabInpatient Medication Order` where company='_Test Company'")
- frappe.db.sql("delete from `tabInpatient Medication Entry` where company='_Test Company'")
- self.patient = create_patient()
- self.ip_record = create_records(self.patient)
-
- def test_inpatient_medication_orders_report(self):
- filters = {
- 'company': '_Test Company',
- 'from_date': getdate(),
- 'to_date': getdate(),
- 'patient': '_Test IPD Patient',
- 'service_unit': '_Test Service Unit Ip Occupancy - _TC'
- }
-
- report = execute(filters)
-
- expected_data = [
- {
- 'patient': '_Test IPD Patient',
- 'inpatient_record': self.ip_record.name,
- 'practitioner': None,
- 'drug': 'Dextromethorphan',
- 'drug_name': 'Dextromethorphan',
- 'dosage': 1.0,
- 'dosage_form': 'Tablet',
- 'date': getdate(),
- 'time': datetime.timedelta(seconds=32400),
- 'is_completed': 0,
- 'healthcare_service_unit': '_Test Service Unit Ip Occupancy - _TC'
- },
- {
- 'patient': '_Test IPD Patient',
- 'inpatient_record': self.ip_record.name,
- 'practitioner': None,
- 'drug': 'Dextromethorphan',
- 'drug_name': 'Dextromethorphan',
- 'dosage': 1.0,
- 'dosage_form': 'Tablet',
- 'date': getdate(),
- 'time': datetime.timedelta(seconds=50400),
- 'is_completed': 0,
- 'healthcare_service_unit': '_Test Service Unit Ip Occupancy - _TC'
- },
- {
- 'patient': '_Test IPD Patient',
- 'inpatient_record': self.ip_record.name,
- 'practitioner': None,
- 'drug': 'Dextromethorphan',
- 'drug_name': 'Dextromethorphan',
- 'dosage': 1.0,
- 'dosage_form': 'Tablet',
- 'date': getdate(),
- 'time': datetime.timedelta(seconds=75600),
- 'is_completed': 0,
- 'healthcare_service_unit': '_Test Service Unit Ip Occupancy - _TC'
- }
- ]
-
- self.assertEqual(expected_data, report[1])
-
- filters = frappe._dict(from_date=getdate(), to_date=getdate(), from_time='', to_time='')
- ipme = create_ipme(filters)
- ipme.submit()
-
- filters = {
- 'company': '_Test Company',
- 'from_date': getdate(),
- 'to_date': getdate(),
- 'patient': '_Test IPD Patient',
- 'service_unit': '_Test Service Unit Ip Occupancy - _TC',
- 'show_completed_orders': 0
- }
-
- report = execute(filters)
- self.assertEqual(len(report[1]), 0)
-
- def tearDown(self):
- if frappe.db.get_value('Patient', self.patient, 'inpatient_record'):
- # cleanup - Discharge
- schedule_discharge(frappe.as_json({'patient': self.patient}))
- self.ip_record.reload()
- mark_invoiced_inpatient_occupancy(self.ip_record)
-
- self.ip_record.reload()
- discharge_patient(self.ip_record)
-
- for entry in frappe.get_all('Inpatient Medication Entry'):
- doc = frappe.get_doc('Inpatient Medication Entry', entry.name)
- doc.cancel()
- doc.delete()
-
- for entry in frappe.get_all('Inpatient Medication Order'):
- doc = frappe.get_doc('Inpatient Medication Order', entry.name)
- doc.cancel()
- doc.delete()
-
-
-def create_records(patient):
- frappe.db.sql("""delete from `tabInpatient Record`""")
-
- # Admit
- ip_record = create_inpatient(patient)
- ip_record.expected_length_of_stay = 0
- ip_record.save()
- ip_record.reload()
- service_unit = get_healthcare_service_unit('_Test Service Unit Ip Occupancy')
- admit_patient(ip_record, service_unit, now_datetime())
-
- ipmo = create_ipmo(patient)
- ipmo.submit()
-
- return ip_record
diff --git a/erpnext/healthcare/report/lab_test_report/__init__.py b/erpnext/healthcare/report/lab_test_report/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/report/lab_test_report/lab_test_report.js b/erpnext/healthcare/report/lab_test_report/lab_test_report.js
deleted file mode 100644
index 7754e2e196..0000000000
--- a/erpnext/healthcare/report/lab_test_report/lab_test_report.js
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2016, ESS
-// License: See license.txt
-
-frappe.query_reports["Lab Test Report"] = {
- "filters": [
- {
- "fieldname": "from_date",
- "label": __("From Date"),
- "fieldtype": "Date",
- "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
- "reqd": 1
- },
- {
- "fieldname": "to_date",
- "label": __("To Date"),
- "fieldtype": "Date",
- "default": frappe.datetime.now_date(),
- "reqd": 1
- },
- {
- "fieldname": "company",
- "label": __("Company"),
- "fieldtype": "Link",
- "default": frappe.defaults.get_default("Company"),
- "options": "Company"
- },
- {
- "fieldname": "template",
- "label": __("Lab Test Template"),
- "fieldtype": "Link",
- "options": "Lab Test Template"
- },
- {
- "fieldname": "patient",
- "label": __("Patient"),
- "fieldtype": "Link",
- "options": "Patient"
- },
- {
- "fieldname": "department",
- "label": __("Medical Department"),
- "fieldtype": "Link",
- "options": "Medical Department"
- },
- {
- "fieldname": "status",
- "label": __("Status"),
- "fieldtype": "Select",
- "options": "\nCompleted\nApproved\nRejected"
- },
- {
- "fieldname": "invoiced",
- "label": __("Invoiced"),
- "fieldtype": "Check"
- }
- ]
-};
diff --git a/erpnext/healthcare/report/lab_test_report/lab_test_report.json b/erpnext/healthcare/report/lab_test_report/lab_test_report.json
deleted file mode 100644
index aeb42897b8..0000000000
--- a/erpnext/healthcare/report/lab_test_report/lab_test_report.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "add_total_row": 0,
- "creation": "2013-04-23 18:15:29",
- "disable_prepared_report": 0,
- "disabled": 0,
- "docstatus": 0,
- "doctype": "Report",
- "idx": 1,
- "is_standard": "Yes",
- "modified": "2020-07-30 18:53:20.102873",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Lab Test Report",
- "owner": "Administrator",
- "prepared_report": 0,
- "ref_doctype": "Lab Test",
- "report_name": "Lab Test Report",
- "report_type": "Script Report",
- "roles": [
- {
- "role": "Laboratory User"
- },
- {
- "role": "Nursing User"
- },
- {
- "role": "LabTest Approver"
- },
- {
- "role": "Healthcare Administrator"
- }
- ]
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/report/lab_test_report/lab_test_report.py b/erpnext/healthcare/report/lab_test_report/lab_test_report.py
deleted file mode 100644
index e2a53bb1e4..0000000000
--- a/erpnext/healthcare/report/lab_test_report/lab_test_report.py
+++ /dev/null
@@ -1,213 +0,0 @@
-# Copyright (c) 2016, ESS
-# License: See license.txt
-
-from __future__ import unicode_literals
-
-import frappe
-from frappe import _, msgprint
-
-
-def execute(filters=None):
- if not filters: filters = {}
-
- data, columns = [], []
-
- columns = get_columns()
- lab_test_list = get_lab_tests(filters)
-
- if not lab_test_list:
- msgprint(_('No records found'))
- return columns, lab_test_list
-
- data = []
- for lab_test in lab_test_list:
- row = frappe._dict({
- 'test': lab_test.name,
- 'template': lab_test.template,
- 'company': lab_test.company,
- 'patient': lab_test.patient,
- 'patient_name': lab_test.patient_name,
- 'practitioner': lab_test.practitioner,
- 'employee': lab_test.employee,
- 'status': lab_test.status,
- 'invoiced': lab_test.invoiced,
- 'result_date': lab_test.result_date,
- 'department': lab_test.department
- })
- data.append(row)
-
- chart = get_chart_data(data)
- report_summary = get_report_summary(data)
- return columns, data, None, chart, report_summary
-
-
-def get_columns():
- return [
- {
- 'fieldname': 'test',
- 'label': _('Lab Test'),
- 'fieldtype': 'Link',
- 'options': 'Lab Test',
- 'width': '120'
- },
- {
- 'fieldname': 'template',
- 'label': _('Lab Test Template'),
- 'fieldtype': 'Link',
- 'options': 'Lab Test Template',
- 'width': '120'
- },
- {
- 'fieldname': 'company',
- 'label': _('Company'),
- 'fieldtype': 'Link',
- 'options': 'Company',
- 'width': '120'
- },
- {
- 'fieldname': 'patient',
- 'label': _('Patient'),
- 'fieldtype': 'Link',
- 'options': 'Patient',
- 'width': '120'
- },
- {
- 'fieldname': 'patient_name',
- 'label': _('Patient Name'),
- 'fieldtype': 'Data',
- 'width': '120'
- },
- {
- 'fieldname': 'employee',
- 'label': _('Lab Technician'),
- 'fieldtype': 'Link',
- 'options': 'Employee',
- 'width': '120'
- },
- {
- 'fieldname': 'status',
- 'label': _('Status'),
- 'fieldtype': 'Data',
- 'width': '100'
- },
- {
- 'fieldname': 'invoiced',
- 'label': _('Invoiced'),
- 'fieldtype': 'Check',
- 'width': '100'
- },
- {
- 'fieldname': 'result_date',
- 'label': _('Result Date'),
- 'fieldtype': 'Date',
- 'width': '100'
- },
- {
- 'fieldname': 'practitioner',
- 'label': _('Requesting Practitioner'),
- 'fieldtype': 'Link',
- 'options': 'Healthcare Practitioner',
- 'width': '120'
- },
- {
- 'fieldname': 'department',
- 'label': _('Medical Department'),
- 'fieldtype': 'Link',
- 'options': 'Medical Department',
- 'width': '100'
- }
- ]
-
-def get_lab_tests(filters):
- conditions = get_conditions(filters)
- data = frappe.get_all(
- doctype='Lab Test',
- fields=['name', 'template', 'company', 'patient', 'patient_name', 'practitioner', 'employee', 'status', 'invoiced', 'result_date', 'department'],
- filters=conditions,
- order_by='submitted_date desc'
- )
- return data
-
-def get_conditions(filters):
- conditions = {
- 'docstatus': ('=', 1)
- }
-
- if filters.get('from_date') and filters.get('to_date'):
- conditions['result_date'] = ('between', (filters.get('from_date'), filters.get('to_date')))
- filters.pop('from_date')
- filters.pop('to_date')
-
- for key, value in filters.items():
- if filters.get(key):
- conditions[key] = value
-
- return conditions
-
-def get_chart_data(data):
- if not data:
- return None
-
- labels = ['Completed', 'Approved', 'Rejected']
-
- status_wise_data = {
- 'Completed': 0,
- 'Approved': 0,
- 'Rejected': 0
- }
-
- datasets = []
-
- for entry in data:
- status_wise_data[entry.status] += 1
-
- datasets.append({
- 'name': 'Lab Test Status',
- 'values': [status_wise_data.get('Completed'), status_wise_data.get('Approved'), status_wise_data.get('Rejected')]
- })
-
- chart = {
- 'data': {
- 'labels': labels,
- 'datasets': datasets
- },
- 'type': 'bar',
- 'height': 300,
- }
-
- return chart
-
-
-def get_report_summary(data):
- if not data:
- return None
-
- total_lab_tests = len(data)
- invoiced_lab_tests, unbilled_lab_tests = 0, 0
-
- for entry in data:
- if entry.invoiced:
- invoiced_lab_tests += 1
- else:
- unbilled_lab_tests += 1
-
- return [
- {
- 'value': total_lab_tests,
- 'indicator': 'Blue',
- 'label': 'Total Lab Tests',
- 'datatype': 'Int',
- },
- {
- 'value': invoiced_lab_tests,
- 'indicator': 'Green',
- 'label': 'Invoiced Lab Tests',
- 'datatype': 'Int',
- },
- {
- 'value': unbilled_lab_tests,
- 'indicator': 'Red',
- 'label': 'Unbilled Lab Tests',
- 'datatype': 'Int',
- }
- ]
diff --git a/erpnext/healthcare/report/patient_appointment_analytics/__init__.py b/erpnext/healthcare/report/patient_appointment_analytics/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.js b/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.js
deleted file mode 100644
index 18d252ede1..0000000000
--- a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.js
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-/* eslint-disable */
-
-frappe.query_reports['Patient Appointment Analytics'] = {
- "filters": [
- {
- fieldname: 'tree_type',
- label: __('Tree Type'),
- fieldtype: 'Select',
- options: ['Healthcare Practitioner', 'Medical Department'],
- default: 'Healthcare Practitioner',
- reqd: 1
- },
- {
- fieldname: 'status',
- label: __('Appointment Status'),
- fieldtype: 'Select',
- options:[
- {label: __('Scheduled'), value: 'Scheduled'},
- {label: __('Open'), value: 'Open'},
- {label: __('Closed'), value: 'Closed'},
- {label: __('Expired'), value: 'Expired'},
- {label: __('Cancelled'), value: 'Cancelled'}
- ]
- },
- {
- fieldname: 'appointment_type',
- label: __('Appointment Type'),
- fieldtype: 'Link',
- options: 'Appointment Type'
- },
- {
- fieldname: 'practitioner',
- label: __('Healthcare Practitioner'),
- fieldtype: 'Link',
- options: 'Healthcare Practitioner'
- },
- {
- fieldname: 'department',
- label: __('Medical Department'),
- fieldtype: 'Link',
- options: 'Medical Department'
- },
- {
- fieldname: 'from_date',
- label: __('From Date'),
- fieldtype: 'Date',
- default: frappe.defaults.get_user_default('year_start_date'),
- reqd: 1
- },
- {
- fieldname: 'to_date',
- label: __('To Date'),
- fieldtype: 'Date',
- default: frappe.defaults.get_user_default('year_end_date'),
- reqd: 1
- },
- {
- fieldname: 'range',
- label: __('Range'),
- fieldtype: 'Select',
- options:[
- {label: __('Weekly'), value: 'Weekly'},
- {label: __('Monthly'), value: 'Monthly'},
- {label: __('Quarterly'), value: 'Quarterly'},
- {label: __('Yearly'), value: 'Yearly'}
- ],
- default: 'Monthly',
- reqd: 1
- }
- ],
- after_datatable_render: function(datatable_obj) {
- $(datatable_obj.wrapper).find(".dt-row-0").find('input[type=checkbox]').click();
- },
- get_datatable_options(options) {
- return Object.assign(options, {
- checkboxColumn: true,
- events: {
- onCheckRow: function(data) {
- row_name = data[2].content;
- length = data.length;
-
- row_values = data.slice(3,length-1).map(function (column) {
- return column.content;
- })
-
- entry = {
- 'name': row_name,
- 'values': row_values
- }
-
- let raw_data = frappe.query_report.chart.data;
- let new_datasets = raw_data.datasets;
-
- let found = false;
- for (let i=0; i < new_datasets.length;i++) {
- if (new_datasets[i].name == row_name) {
- found = true;
- new_datasets.splice(i,1);
- break;
- }
- }
-
- if (!found) {
- new_datasets.push(entry);
- }
-
- let new_data = {
- labels: raw_data.labels,
- datasets: new_datasets
- }
-
- setTimeout(() => {
- frappe.query_report.chart.update(new_data)
- }, 500)
-
-
- setTimeout(() => {
- frappe.query_report.chart.draw(true);
- }, 1000)
-
- frappe.query_report.raw_chart_data = new_data;
- },
- }
- })
- },
-};
diff --git a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.json b/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.json
deleted file mode 100644
index 64750c012f..0000000000
--- a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "add_total_row": 1,
- "creation": "2020-03-02 15:13:16.273493",
- "disable_prepared_report": 0,
- "disabled": 0,
- "docstatus": 0,
- "doctype": "Report",
- "idx": 0,
- "is_standard": "Yes",
- "modified": "2020-03-02 15:13:16.273493",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Patient Appointment Analytics",
- "owner": "Administrator",
- "prepared_report": 0,
- "ref_doctype": "Patient Appointment",
- "report_name": "Patient Appointment Analytics",
- "report_type": "Script Report",
- "roles": [
- {
- "role": "Healthcare Administrator"
- },
- {
- "role": "LabTest Approver"
- },
- {
- "role": "Physician"
- },
- {
- "role": "Nursing User"
- },
- {
- "role": "Laboratory User"
- }
- ]
-}
\ No newline at end of file
diff --git a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py b/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py
deleted file mode 100644
index 1afb5da1fb..0000000000
--- a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py
+++ /dev/null
@@ -1,197 +0,0 @@
-# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
-# For license information, please see license.txt
-
-from __future__ import unicode_literals
-
-import frappe
-from frappe import _, scrub
-from frappe.utils import add_days, add_to_date, flt, getdate
-from six import iteritems
-
-from erpnext.accounts.utils import get_fiscal_year
-
-
-def execute(filters=None):
- return Analytics(filters).run()
-
-class Analytics(object):
- def __init__(self, filters=None):
- """Patient Appointment Analytics Report."""
- self.filters = frappe._dict(filters or {})
- self.months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
- self.get_period_date_ranges()
-
- def run(self):
- self.get_columns()
- self.get_data()
- self.get_chart_data()
-
- return self.columns, self.data, None, self.chart
-
- def get_period_date_ranges(self):
- from dateutil.relativedelta import MO, relativedelta
- from_date, to_date = getdate(self.filters.from_date), getdate(self.filters.to_date)
-
- increment = {
- 'Monthly': 1,
- 'Quarterly': 3,
- 'Half-Yearly': 6,
- 'Yearly': 12
- }.get(self.filters.range, 1)
-
- if self.filters.range in ['Monthly', 'Quarterly']:
- from_date = from_date.replace(day=1)
- elif self.filters.range == 'Yearly':
- from_date = get_fiscal_year(from_date)[1]
- else:
- from_date = from_date + relativedelta(from_date, weekday=MO(-1))
-
- self.periodic_daterange = []
- for dummy in range(1, 53):
- if self.filters.range == 'Weekly':
- period_end_date = add_days(from_date, 6)
- else:
- period_end_date = add_to_date(from_date, months=increment, days=-1)
-
- if period_end_date > to_date:
- period_end_date = to_date
-
- self.periodic_daterange.append(period_end_date)
-
- from_date = add_days(period_end_date, 1)
- if period_end_date == to_date:
- break
-
- def get_columns(self):
- self.columns = []
-
- if self.filters.tree_type == 'Healthcare Practitioner':
- self.columns.append({
- 'label': _('Healthcare Practitioner'),
- 'options': 'Healthcare Practitioner',
- 'fieldname': 'practitioner',
- 'fieldtype': 'Link',
- 'width': 200
- })
-
- elif self.filters.tree_type == 'Medical Department':
- self.columns.append({
- 'label': _('Medical Department'),
- 'fieldname': 'department',
- 'fieldtype': 'Link',
- 'options': 'Medical Department',
- 'width': 150
- })
-
- for end_date in self.periodic_daterange:
- period = self.get_period(end_date)
- self.columns.append({
- 'label': _(period),
- 'fieldname': scrub(period),
- 'fieldtype': 'Int',
- 'width': 120
- })
-
- self.columns.append({
- 'label': _('Total'),
- 'fieldname': 'total',
- 'fieldtype': 'Int',
- 'width': 120
- })
-
- def get_data(self):
- if self.filters.tree_type == 'Healthcare Practitioner':
- self.get_appointments_based_on_healthcare_practitioner()
- self.get_rows()
-
- elif self.filters.tree_type == 'Medical Department':
- self.get_appointments_based_on_medical_department()
- self.get_rows()
-
- def get_period(self, appointment_date):
- if self.filters.range == 'Weekly':
- period = 'Week ' + str(appointment_date.isocalendar()[1])
- elif self.filters.range == 'Monthly':
- period = str(self.months[appointment_date.month - 1])
- elif self.filters.range == 'Quarterly':
- period = 'Quarter ' + str(((appointment_date.month - 1) // 3) + 1)
- else:
- year = get_fiscal_year(appointment_date, company=self.filters.company)
- period = str(year[0])
-
- if getdate(self.filters.from_date).year != getdate(self.filters.to_date).year:
- period += ' ' + str(appointment_date.year)
-
- return period
-
- def get_appointments_based_on_healthcare_practitioner(self):
- filters = self.get_common_filters()
-
- self.entries = frappe.db.get_all('Patient Appointment',
- fields=['appointment_date', 'name', 'patient', 'practitioner'],
- filters=filters
- )
-
- def get_appointments_based_on_medical_department(self):
- filters = self.get_common_filters()
- if not filters.get('department'):
- filters['department'] = ('!=', '')
-
- self.entries = frappe.db.get_all('Patient Appointment',
- fields=['appointment_date', 'name', 'patient', 'practitioner', 'department'],
- filters=filters
- )
-
- def get_common_filters(self):
- filters = {}
- filters['appointment_date'] = ('between', [self.filters.from_date, self.filters.to_date])
- for entry in ['appointment_type', 'practitioner', 'department', 'status']:
- if self.filters.get(entry):
- filters[entry] = self.filters.get(entry)
-
- return filters
-
- def get_rows(self):
- self.data = []
- self.get_periodic_data()
-
- for entity, period_data in iteritems(self.appointment_periodic_data):
- if self.filters.tree_type == 'Healthcare Practitioner':
- row = {'practitioner': entity}
- elif self.filters.tree_type == 'Medical Department':
- row = {'department': entity}
-
- total = 0
- for end_date in self.periodic_daterange:
- period = self.get_period(end_date)
- amount = flt(period_data.get(period, 0.0))
- row[scrub(period)] = amount
- total += amount
-
- row['total'] = total
-
- self.data.append(row)
-
- def get_periodic_data(self):
- self.appointment_periodic_data = frappe._dict()
-
- for d in self.entries:
- period = self.get_period(d.get('appointment_date'))
- if self.filters.tree_type == 'Healthcare Practitioner':
- self.appointment_periodic_data.setdefault(d.practitioner, frappe._dict()).setdefault(period, 0.0)
- self.appointment_periodic_data[d.practitioner][period] += 1
-
- elif self.filters.tree_type == 'Medical Department':
- self.appointment_periodic_data.setdefault(d.department, frappe._dict()).setdefault(period, 0.0)
- self.appointment_periodic_data[d.department][period] += 1
-
- def get_chart_data(self):
- length = len(self.columns)
- labels = [d.get("label") for d in self.columns[1:length - 1]]
- self.chart = {
- "data": {
- 'labels': labels,
- 'datasets': []
- },
- "type": "line"
- }
diff --git a/erpnext/healthcare/setup.py b/erpnext/healthcare/setup.py
deleted file mode 100644
index 891272ddf8..0000000000
--- a/erpnext/healthcare/setup.py
+++ /dev/null
@@ -1,295 +0,0 @@
-from __future__ import unicode_literals
-import frappe
-
-from frappe import _
-from erpnext.setup.utils import insert_record
-
-def setup_healthcare():
- if frappe.db.exists('Medical Department', 'Cardiology'):
- # already setup
- return
- create_medical_departments()
- create_antibiotics()
- create_lab_test_uom()
- create_duration()
- create_dosage()
- create_healthcare_item_groups()
- create_sensitivity()
- add_healthcare_service_unit_tree_root()
- setup_patient_history_settings()
-
-def create_medical_departments():
- departments = [
- "Accident And Emergency Care" ,"Anaesthetics", "Biochemistry", "Cardiology", "Dermatology",
- "Diagnostic Imaging", "ENT", "Gastroenterology", "General Surgery", "Gynaecology",
- "Haematology", "Maternity", "Microbiology", "Nephrology", "Neurology", "Oncology",
- "Orthopaedics", "Pathology", "Physiotherapy", "Rheumatology", "Serology", "Urology"
- ]
- for department in departments:
- mediacal_department = frappe.new_doc("Medical Department")
- mediacal_department.department = _(department)
- try:
- mediacal_department.save()
- except frappe.DuplicateEntryError:
- pass
-
-def create_antibiotics():
- abt = [
- "Amoxicillin", "Ampicillin", "Bacampicillin", "Carbenicillin", "Cloxacillin", "Dicloxacillin",
- "Flucloxacillin", "Mezlocillin", "Nafcillin", "Oxacillin", "Penicillin G", "Penicillin V",
- "Piperacillin", "Pivampicillin", "Pivmecillinam", "Ticarcillin", "Cefacetrile (cephacetrile)",
- "Cefadroxil (cefadroxyl)", "Cefalexin (cephalexin)", "Cefaloglycin (cephaloglycin)",
- "Cefalonium (cephalonium)", "Cefaloridine (cephaloradine)", "Cefalotin (cephalothin)",
- "Cefapirin (cephapirin)", "Cefatrizine", "Cefazaflur", "Cefazedone", "Cefazolin (cephazolin)",
- "Cefradine (cephradine)", "Cefroxadine", "Ceftezole", "Cefaclor", "Cefamandole", "Cefmetazole",
- "Cefonicid", "Cefotetan", "Cefoxitin", "Cefprozil (cefproxil)", "Cefuroxime", "Cefuzonam",
- "Cefcapene", "Cefdaloxime", "Cefdinir", "Cefditoren", "Cefetamet", "Cefixime", "Cefmenoxime",
- "Cefodizime", "Cefotaxime", "Cefpimizole", "Cefpodoxime", "Cefteram", "Ceftibuten", "Ceftiofur",
- "Ceftiolene", "Ceftizoxime", "Ceftriaxone", "Cefoperazone", "Ceftazidime", "Cefclidine", "Cefepime",
- "Cefluprenam", "Cefoselis", "Cefozopran", "Cefpirome", "Cefquinome", "Ceftobiprole", "Ceftaroline",
- "Cefaclomezine","Cefaloram", "Cefaparole", "Cefcanel", "Cefedrolor", "Cefempidone", "Cefetrizole",
- "Cefivitril", "Cefmatilen", "Cefmepidium", "Cefovecin", "Cefoxazole", "Cefrotil", "Cefsumide",
- "Cefuracetime", "Ceftioxide", "Ceftazidime/Avibactam", "Ceftolozane/Tazobactam", "Aztreonam",
- "Imipenem", "Imipenem/cilastatin", "Doripenem", "Meropenem", "Ertapenem", "Azithromycin",
- "Erythromycin", "Clarithromycin", "Dirithromycin", "Roxithromycin", "Telithromycin", "Clindamycin",
- "Lincomycin", "Pristinamycin", "Quinupristin/dalfopristin", "Amikacin", "Gentamicin", "Kanamycin",
- "Neomycin", "Netilmicin", "Paromomycin", "Streptomycin", "Tobramycin", "Flumequine", "Nalidixic acid",
- "Oxolinic acid", "Piromidic acid", "Pipemidic acid", "Rosoxacin", "Ciprofloxacin", "Enoxacin",
- "Lomefloxacin", "Nadifloxacin", "Norfloxacin", "Ofloxacin", "Pefloxacin", "Rufloxacin", "Balofloxacin",
- "Gatifloxacin", "Grepafloxacin", "Levofloxacin", "Moxifloxacin", "Pazufloxacin", "Sparfloxacin",
- "Temafloxacin", "Tosufloxacin", "Besifloxacin", "Clinafloxacin", "Gemifloxacin",
- "Sitafloxacin", "Trovafloxacin", "Prulifloxacin", "Sulfamethizole", "Sulfamethoxazole",
- "Sulfisoxazole", "Trimethoprim-Sulfamethoxazole", "Demeclocycline", "Doxycycline", "Minocycline",
- "Oxytetracycline", "Tetracycline", "Tigecycline", "Chloramphenicol", "Metronidazole",
- "Tinidazole", "Nitrofurantoin", "Vancomycin", "Teicoplanin", "Telavancin", "Linezolid",
- "Cycloserine 2", "Rifampin", "Rifabutin", "Rifapentine", "Rifalazil", "Bacitracin", "Polymyxin B",
- "Viomycin", "Capreomycin"
- ]
-
- for a in abt:
- antibiotic = frappe.new_doc("Antibiotic")
- antibiotic.antibiotic_name = a
- try:
- antibiotic.save()
- except frappe.DuplicateEntryError:
- pass
-
-def create_lab_test_uom():
- records = [
- {"doctype": "Lab Test UOM", "name": "umol/L", "lab_test_uom": "umol/L", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "mg/L", "lab_test_uom": "mg/L", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "mg / dl", "lab_test_uom": "mg / dl", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "pg / ml", "lab_test_uom": "pg / ml", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "U/ml", "lab_test_uom": "U/ml", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "/HPF", "lab_test_uom": "/HPF", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "Million Cells / cumm", "lab_test_uom": "Million Cells / cumm", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "Lakhs Cells / cumm", "lab_test_uom": "Lakhs Cells / cumm", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "U / L", "lab_test_uom": "U / L", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "g / L", "lab_test_uom": "g / L", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "IU / ml", "lab_test_uom": "IU / ml", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "gm %", "lab_test_uom": "gm %", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "Microgram", "lab_test_uom": "Microgram", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "Micron", "lab_test_uom": "Micron", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "Cells / cumm", "lab_test_uom": "Cells / cumm", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "%", "lab_test_uom": "%", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "mm / dl", "lab_test_uom": "mm / dl", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "mm / hr", "lab_test_uom": "mm / hr", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "ulU / ml", "lab_test_uom": "ulU / ml", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "ng / ml", "lab_test_uom": "ng / ml", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "ng / dl", "lab_test_uom": "ng / dl", "uom_description": None },
- {"doctype": "Lab Test UOM", "name": "ug / dl", "lab_test_uom": "ug / dl", "uom_description": None }
- ]
-
- insert_record(records)
-
-def create_duration():
- records = [
- {"doctype": "Prescription Duration", "name": "3 Month", "number": "3", "period": "Month" },
- {"doctype": "Prescription Duration", "name": "2 Month", "number": "2", "period": "Month" },
- {"doctype": "Prescription Duration", "name": "1 Month", "number": "1", "period": "Month" },
- {"doctype": "Prescription Duration", "name": "12 Hour", "number": "12", "period": "Hour" },
- {"doctype": "Prescription Duration", "name": "11 Hour", "number": "11", "period": "Hour" },
- {"doctype": "Prescription Duration", "name": "10 Hour", "number": "10", "period": "Hour" },
- {"doctype": "Prescription Duration", "name": "9 Hour", "number": "9", "period": "Hour" },
- {"doctype": "Prescription Duration", "name": "8 Hour", "number": "8", "period": "Hour" },
- {"doctype": "Prescription Duration", "name": "7 Hour", "number": "7", "period": "Hour" },
- {"doctype": "Prescription Duration", "name": "6 Hour", "number": "6", "period": "Hour" },
- {"doctype": "Prescription Duration", "name": "5 Hour", "number": "5", "period": "Hour" },
- {"doctype": "Prescription Duration", "name": "4 Hour", "number": "4", "period": "Hour" },
- {"doctype": "Prescription Duration", "name": "3 Hour", "number": "3", "period": "Hour" },
- {"doctype": "Prescription Duration", "name": "2 Hour", "number": "2", "period": "Hour" },
- {"doctype": "Prescription Duration", "name": "1 Hour", "number": "1", "period": "Hour" },
- {"doctype": "Prescription Duration", "name": "5 Week", "number": "5", "period": "Week" },
- {"doctype": "Prescription Duration", "name": "4 Week", "number": "4", "period": "Week" },
- {"doctype": "Prescription Duration", "name": "3 Week", "number": "3", "period": "Week" },
- {"doctype": "Prescription Duration", "name": "2 Week", "number": "2", "period": "Week" },
- {"doctype": "Prescription Duration", "name": "1 Week", "number": "1", "period": "Week" },
- {"doctype": "Prescription Duration", "name": "6 Day", "number": "6", "period": "Day" },
- {"doctype": "Prescription Duration", "name": "5 Day", "number": "5", "period": "Day" },
- {"doctype": "Prescription Duration", "name": "4 Day", "number": "4", "period": "Day" },
- {"doctype": "Prescription Duration", "name": "3 Day", "number": "3", "period": "Day" },
- {"doctype": "Prescription Duration", "name": "2 Day", "number": "2", "period": "Day" },
- {"doctype": "Prescription Duration", "name": "1 Day", "number": "1", "period": "Day" }
- ]
- insert_record(records)
-
-def create_dosage():
- records = [
- {"doctype": "Prescription Dosage", "name": "1-1-1-1", "dosage": "1-1-1-1","dosage_strength":
- [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "13:00:00"},{"strength": "1.0","strength_time": "17:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
- },
- {"doctype": "Prescription Dosage", "name": "0-0-1", "dosage": "0-0-1","dosage_strength":
- [{"strength": "1.0","strength_time": "21:00:00"}]
- },
- {"doctype": "Prescription Dosage", "name": "1-0-0", "dosage": "1-0-0","dosage_strength":
- [{"strength": "1.0","strength_time": "9:00:00"}]
- },
- {"doctype": "Prescription Dosage", "name": "0-1-0", "dosage": "0-1-0","dosage_strength":
- [{"strength": "1.0","strength_time": "14:00:00"}]
- },
- {"doctype": "Prescription Dosage", "name": "1-1-1", "dosage": "1-1-1","dosage_strength":
- [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "14:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
- },
- {"doctype": "Prescription Dosage", "name": "1-0-1", "dosage": "1-0-1","dosage_strength":
- [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "21:00:00"}]
- },
- {"doctype": "Prescription Dosage", "name": "Once Bedtime", "dosage": "Once Bedtime","dosage_strength":
- [{"strength": "1.0","strength_time": "21:00:00"}]
- },
- {"doctype": "Prescription Dosage", "name": "5 times a day", "dosage": "5 times a day","dosage_strength":
- [{"strength": "1.0","strength_time": "5:00:00"}, {"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "13:00:00"},{"strength": "1.0","strength_time": "17:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
- },
- {"doctype": "Prescription Dosage", "name": "QID", "dosage": "QID","dosage_strength":
- [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "13:00:00"},{"strength": "1.0","strength_time": "17:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
- },
- {"doctype": "Prescription Dosage", "name": "TID", "dosage": "TID","dosage_strength":
- [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "14:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
- },
- {"doctype": "Prescription Dosage", "name": "BID", "dosage": "BID","dosage_strength":
- [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "21:00:00"}]
- },
- {"doctype": "Prescription Dosage", "name": "Once Daily", "dosage": "Once Daily","dosage_strength":
- [{"strength": "1.0","strength_time": "9:00:00"}]
- }
- ]
- insert_record(records)
-
-def create_healthcare_item_groups():
- records = [
- {'doctype': 'Item Group', 'item_group_name': _('Laboratory'),
- 'is_group': 0, 'parent_item_group': _('All Item Groups') },
- {'doctype': 'Item Group', 'item_group_name': _('Drug'),
- 'is_group': 0, 'parent_item_group': _('All Item Groups') }
- ]
- insert_record(records)
-
-def create_sensitivity():
- records = [
- {"doctype": "Sensitivity", "sensitivity": _("Low Sensitivity")},
- {"doctype": "Sensitivity", "sensitivity": _("High Sensitivity")},
- {"doctype": "Sensitivity", "sensitivity": _("Moderate Sensitivity")},
- {"doctype": "Sensitivity", "sensitivity": _("Susceptible")},
- {"doctype": "Sensitivity", "sensitivity": _("Resistant")},
- {"doctype": "Sensitivity", "sensitivity": _("Intermediate")}
- ]
- insert_record(records)
-
-def add_healthcare_service_unit_tree_root():
- record = [
- {
- "doctype": "Healthcare Service Unit",
- "healthcare_service_unit_name": "All Healthcare Service Units",
- "is_group": 1,
- "company": get_company()
- }
- ]
- insert_record(record)
-
-def get_company():
- company = frappe.defaults.get_defaults().company
- if company:
- return company
- else:
- company = frappe.get_list("Company", limit=1)
- if company:
- return company[0].name
- return None
-
-def setup_patient_history_settings():
- import json
-
- settings = frappe.get_single('Patient History Settings')
- configuration = get_patient_history_config()
- for dt, config in configuration.items():
- settings.append("standard_doctypes", {
- "document_type": dt,
- "date_fieldname": config[0],
- "selected_fields": json.dumps(config[1])
- })
- settings.save()
-
-def get_patient_history_config():
- return {
- "Patient Encounter": ("encounter_date", [
- {"label": "Healthcare Practitioner", "fieldname": "practitioner", "fieldtype": "Link"},
- {"label": "Symptoms", "fieldname": "symptoms", "fieldtype": "Table Multiselect"},
- {"label": "Diagnosis", "fieldname": "diagnosis", "fieldtype": "Table Multiselect"},
- {"label": "Drug Prescription", "fieldname": "drug_prescription", "fieldtype": "Table"},
- {"label": "Lab Tests", "fieldname": "lab_test_prescription", "fieldtype": "Table"},
- {"label": "Clinical Procedures", "fieldname": "procedure_prescription", "fieldtype": "Table"},
- {"label": "Therapies", "fieldname": "therapies", "fieldtype": "Table"},
- {"label": "Review Details", "fieldname": "encounter_comment", "fieldtype": "Small Text"}
- ]),
- "Clinical Procedure": ("start_date", [
- {"label": "Procedure Template", "fieldname": "procedure_template", "fieldtype": "Link"},
- {"label": "Healthcare Practitioner", "fieldname": "practitioner", "fieldtype": "Link"},
- {"label": "Notes", "fieldname": "notes", "fieldtype": "Small Text"},
- {"label": "Service Unit", "fieldname": "service_unit", "fieldtype": "Healthcare Service Unit"},
- {"label": "Start Time", "fieldname": "start_time", "fieldtype": "Time"},
- {"label": "Sample", "fieldname": "sample", "fieldtype": "Link"}
- ]),
- "Lab Test": ("result_date", [
- {"label": "Test Template", "fieldname": "template", "fieldtype": "Link"},
- {"label": "Healthcare Practitioner", "fieldname": "practitioner", "fieldtype": "Link"},
- {"label": "Test Name", "fieldname": "lab_test_name", "fieldtype": "Data"},
- {"label": "Lab Technician Name", "fieldname": "employee_name", "fieldtype": "Data"},
- {"label": "Sample ID", "fieldname": "sample", "fieldtype": "Link"},
- {"label": "Normal Test Result", "fieldname": "normal_test_items", "fieldtype": "Table"},
- {"label": "Descriptive Test Result", "fieldname": "descriptive_test_items", "fieldtype": "Table"},
- {"label": "Organism Test Result", "fieldname": "organism_test_items", "fieldtype": "Table"},
- {"label": "Sensitivity Test Result", "fieldname": "sensitivity_test_items", "fieldtype": "Table"},
- {"label": "Comments", "fieldname": "lab_test_comment", "fieldtype": "Table"}
- ]),
- "Therapy Session": ("start_date", [
- {"label": "Therapy Type", "fieldname": "therapy_type", "fieldtype": "Link"},
- {"label": "Healthcare Practitioner", "fieldname": "practitioner", "fieldtype": "Link"},
- {"label": "Therapy Plan", "fieldname": "therapy_plan", "fieldtype": "Link"},
- {"label": "Duration", "fieldname": "duration", "fieldtype": "Int"},
- {"label": "Location", "fieldname": "location", "fieldtype": "Link"},
- {"label": "Healthcare Service Unit", "fieldname": "service_unit", "fieldtype": "Link"},
- {"label": "Start Time", "fieldname": "start_time", "fieldtype": "Time"},
- {"label": "Exercises", "fieldname": "exercises", "fieldtype": "Table"},
- {"label": "Total Counts Targeted", "fieldname": "total_counts_targeted", "fieldtype": "Int"},
- {"label": "Total Counts Completed", "fieldname": "total_counts_completed", "fieldtype": "Int"}
- ]),
- "Vital Signs": ("signs_date", [
- {"label": "Body Temperature", "fieldname": "temperature", "fieldtype": "Data"},
- {"label": "Heart Rate / Pulse", "fieldname": "pulse", "fieldtype": "Data"},
- {"label": "Respiratory rate", "fieldname": "respiratory_rate", "fieldtype": "Data"},
- {"label": "Tongue", "fieldname": "tongue", "fieldtype": "Select"},
- {"label": "Abdomen", "fieldname": "abdomen", "fieldtype": "Select"},
- {"label": "Reflexes", "fieldname": "reflexes", "fieldtype": "Select"},
- {"label": "Blood Pressure", "fieldname": "bp", "fieldtype": "Data"},
- {"label": "Notes", "fieldname": "vital_signs_note", "fieldtype": "Small Text"},
- {"label": "Height (In Meter)", "fieldname": "height", "fieldtype": "Float"},
- {"label": "Weight (In Kilogram)", "fieldname": "weight", "fieldtype": "Float"},
- {"label": "BMI", "fieldname": "bmi", "fieldtype": "Float"}
- ]),
- "Inpatient Medication Order": ("start_date", [
- {"label": "Healthcare Practitioner", "fieldname": "practitioner", "fieldtype": "Link"},
- {"label": "Start Date", "fieldname": "start_date", "fieldtype": "Date"},
- {"label": "End Date", "fieldname": "end_date", "fieldtype": "Date"},
- {"label": "Medication Orders", "fieldname": "medication_orders", "fieldtype": "Table"},
- {"label": "Total Orders", "fieldname": "total_orders", "fieldtype": "Float"}
- ])
- }
diff --git a/erpnext/healthcare/utils.py b/erpnext/healthcare/utils.py
deleted file mode 100644
index cae3008ca8..0000000000
--- a/erpnext/healthcare/utils.py
+++ /dev/null
@@ -1,792 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2018, earthians and contributors
-# For license information, please see license.txt
-
-from __future__ import unicode_literals
-
-import json
-import math
-
-import frappe
-from frappe import _
-from frappe.utils import cstr, rounded, time_diff_in_hours
-from frappe.utils.formatters import format_value
-
-from erpnext.healthcare.doctype.fee_validity.fee_validity import create_fee_validity
-from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_income_account
-from erpnext.healthcare.doctype.lab_test.lab_test import create_multiple
-
-
-@frappe.whitelist()
-def get_healthcare_services_to_invoice(patient, company):
- patient = frappe.get_doc('Patient', patient)
- items_to_invoice = []
- if patient:
- validate_customer_created(patient)
- # Customer validated, build a list of billable services
- items_to_invoice += get_appointments_to_invoice(patient, company)
- items_to_invoice += get_encounters_to_invoice(patient, company)
- items_to_invoice += get_lab_tests_to_invoice(patient, company)
- items_to_invoice += get_clinical_procedures_to_invoice(patient, company)
- items_to_invoice += get_inpatient_services_to_invoice(patient, company)
- items_to_invoice += get_therapy_plans_to_invoice(patient, company)
- items_to_invoice += get_therapy_sessions_to_invoice(patient, company)
-
- return items_to_invoice
-
-
-def validate_customer_created(patient):
- if not frappe.db.get_value('Patient', patient.name, 'customer'):
- msg = _("Please set a Customer linked to the Patient")
- msg += " {0} ".format(patient.name)
- frappe.throw(msg, title=_('Customer Not Found'))
-
-
-def get_appointments_to_invoice(patient, company):
- appointments_to_invoice = []
- patient_appointments = frappe.get_list(
- 'Patient Appointment',
- fields = '*',
- filters = {'patient': patient.name, 'company': company, 'invoiced': 0, 'status': ['not in', 'Cancelled']},
- order_by = 'appointment_date'
- )
-
- for appointment in patient_appointments:
- # Procedure Appointments
- if appointment.procedure_template:
- if frappe.db.get_value('Clinical Procedure Template', appointment.procedure_template, 'is_billable'):
- appointments_to_invoice.append({
- 'reference_type': 'Patient Appointment',
- 'reference_name': appointment.name,
- 'service': appointment.procedure_template
- })
- # Consultation Appointments, should check fee validity
- else:
- if frappe.db.get_single_value('Healthcare Settings', 'enable_free_follow_ups') and \
- frappe.db.exists('Fee Validity Reference', {'appointment': appointment.name}):
- continue # Skip invoicing, fee validty present
- practitioner_charge = 0
- income_account = None
- service_item = None
- if appointment.practitioner:
- details = get_service_item_and_practitioner_charge(appointment)
- service_item = details.get('service_item')
- practitioner_charge = details.get('practitioner_charge')
- income_account = get_income_account(appointment.practitioner, appointment.company)
- appointments_to_invoice.append({
- 'reference_type': 'Patient Appointment',
- 'reference_name': appointment.name,
- 'service': service_item,
- 'rate': practitioner_charge,
- 'income_account': income_account
- })
-
- return appointments_to_invoice
-
-
-def get_encounters_to_invoice(patient, company):
- if not isinstance(patient, str):
- patient = patient.name
- encounters_to_invoice = []
- encounters = frappe.get_list(
- 'Patient Encounter',
- fields=['*'],
- filters={'patient': patient, 'company': company, 'invoiced': False, 'docstatus': 1}
- )
- if encounters:
- for encounter in encounters:
- if not encounter.appointment:
- practitioner_charge = 0
- income_account = None
- service_item = None
- if encounter.practitioner:
- if encounter.inpatient_record and \
- frappe.db.get_single_value('Healthcare Settings', 'do_not_bill_inpatient_encounters'):
- continue
-
- details = get_service_item_and_practitioner_charge(encounter)
- service_item = details.get('service_item')
- practitioner_charge = details.get('practitioner_charge')
- income_account = get_income_account(encounter.practitioner, encounter.company)
-
- encounters_to_invoice.append({
- 'reference_type': 'Patient Encounter',
- 'reference_name': encounter.name,
- 'service': service_item,
- 'rate': practitioner_charge,
- 'income_account': income_account
- })
-
- return encounters_to_invoice
-
-
-def get_lab_tests_to_invoice(patient, company):
- lab_tests_to_invoice = []
- lab_tests = frappe.get_list(
- 'Lab Test',
- fields=['name', 'template'],
- filters={'patient': patient.name, 'company': company, 'invoiced': False, 'docstatus': 1}
- )
- for lab_test in lab_tests:
- item, is_billable = frappe.get_cached_value('Lab Test Template', lab_test.template, ['item', 'is_billable'])
- if is_billable:
- lab_tests_to_invoice.append({
- 'reference_type': 'Lab Test',
- 'reference_name': lab_test.name,
- 'service': item
- })
-
- lab_prescriptions = frappe.db.sql(
- '''
- SELECT
- lp.name, lp.lab_test_code
- FROM
- `tabPatient Encounter` et, `tabLab Prescription` lp
- WHERE
- et.patient=%s
- and lp.parent=et.name
- and lp.lab_test_created=0
- and lp.invoiced=0
- ''', (patient.name), as_dict=1)
-
- for prescription in lab_prescriptions:
- item, is_billable = frappe.get_cached_value('Lab Test Template', prescription.lab_test_code, ['item', 'is_billable'])
- if prescription.lab_test_code and is_billable:
- lab_tests_to_invoice.append({
- 'reference_type': 'Lab Prescription',
- 'reference_name': prescription.name,
- 'service': item
- })
-
- return lab_tests_to_invoice
-
-
-def get_clinical_procedures_to_invoice(patient, company):
- clinical_procedures_to_invoice = []
- procedures = frappe.get_list(
- 'Clinical Procedure',
- fields='*',
- filters={'patient': patient.name, 'company': company, 'invoiced': False}
- )
- for procedure in procedures:
- if not procedure.appointment:
- item, is_billable = frappe.get_cached_value('Clinical Procedure Template', procedure.procedure_template, ['item', 'is_billable'])
- if procedure.procedure_template and is_billable:
- clinical_procedures_to_invoice.append({
- 'reference_type': 'Clinical Procedure',
- 'reference_name': procedure.name,
- 'service': item
- })
-
- # consumables
- if procedure.invoice_separately_as_consumables and procedure.consume_stock \
- and procedure.status == 'Completed' and not procedure.consumption_invoiced:
-
- service_item = frappe.db.get_single_value('Healthcare Settings', 'clinical_procedure_consumable_item')
- if not service_item:
- frappe.throw(_('Please configure Clinical Procedure Consumable Item in {0}').format(
- frappe.utils.get_link_to_form('Healthcare Settings', 'Healthcare Settings')),
- title=_('Missing Configuration'))
-
- clinical_procedures_to_invoice.append({
- 'reference_type': 'Clinical Procedure',
- 'reference_name': procedure.name,
- 'service': service_item,
- 'rate': procedure.consumable_total_amount,
- 'description': procedure.consumption_details
- })
-
- procedure_prescriptions = frappe.db.sql(
- '''
- SELECT
- pp.name, pp.procedure
- FROM
- `tabPatient Encounter` et, `tabProcedure Prescription` pp
- WHERE
- et.patient=%s
- and pp.parent=et.name
- and pp.procedure_created=0
- and pp.invoiced=0
- and pp.appointment_booked=0
- ''', (patient.name), as_dict=1)
-
- for prescription in procedure_prescriptions:
- item, is_billable = frappe.get_cached_value('Clinical Procedure Template', prescription.procedure, ['item', 'is_billable'])
- if is_billable:
- clinical_procedures_to_invoice.append({
- 'reference_type': 'Procedure Prescription',
- 'reference_name': prescription.name,
- 'service': item
- })
-
- return clinical_procedures_to_invoice
-
-
-def get_inpatient_services_to_invoice(patient, company):
- services_to_invoice = []
- inpatient_services = frappe.db.sql(
- '''
- SELECT
- io.*
- FROM
- `tabInpatient Record` ip, `tabInpatient Occupancy` io
- WHERE
- ip.patient=%s
- and ip.company=%s
- and io.parent=ip.name
- and io.left=1
- and io.invoiced=0
- ''', (patient.name, company), as_dict=1)
-
- for inpatient_occupancy in inpatient_services:
- service_unit_type = frappe.db.get_value('Healthcare Service Unit', inpatient_occupancy.service_unit, 'service_unit_type')
- service_unit_type = frappe.get_cached_doc('Healthcare Service Unit Type', service_unit_type)
- if service_unit_type and service_unit_type.is_billable:
- hours_occupied = time_diff_in_hours(inpatient_occupancy.check_out, inpatient_occupancy.check_in)
- qty = 0.5
- if hours_occupied > 0:
- actual_qty = hours_occupied / service_unit_type.no_of_hours
- floor = math.floor(actual_qty)
- decimal_part = actual_qty - floor
- if decimal_part > 0.5:
- qty = rounded(floor + 1, 1)
- elif decimal_part < 0.5 and decimal_part > 0:
- qty = rounded(floor + 0.5, 1)
- if qty <= 0:
- qty = 0.5
- services_to_invoice.append({
- 'reference_type': 'Inpatient Occupancy',
- 'reference_name': inpatient_occupancy.name,
- 'service': service_unit_type.item, 'qty': qty
- })
-
- return services_to_invoice
-
-
-def get_therapy_plans_to_invoice(patient, company):
- therapy_plans_to_invoice = []
- therapy_plans = frappe.get_list(
- 'Therapy Plan',
- fields=['therapy_plan_template', 'name'],
- filters={
- 'patient': patient.name,
- 'invoiced': 0,
- 'company': company,
- 'therapy_plan_template': ('!=', '')
- }
- )
- for plan in therapy_plans:
- therapy_plans_to_invoice.append({
- 'reference_type': 'Therapy Plan',
- 'reference_name': plan.name,
- 'service': frappe.db.get_value('Therapy Plan Template', plan.therapy_plan_template, 'linked_item')
- })
-
- return therapy_plans_to_invoice
-
-
-def get_therapy_sessions_to_invoice(patient, company):
- therapy_sessions_to_invoice = []
- therapy_plans = frappe.db.get_all('Therapy Plan', {'therapy_plan_template': ('!=', '')})
- therapy_plans_created_from_template = []
- for entry in therapy_plans:
- therapy_plans_created_from_template.append(entry.name)
-
- therapy_sessions = frappe.get_list(
- 'Therapy Session',
- fields='*',
- filters={
- 'patient': patient.name,
- 'invoiced': 0,
- 'company': company,
- 'therapy_plan': ('not in', therapy_plans_created_from_template)
- }
- )
- for therapy in therapy_sessions:
- if not therapy.appointment:
- if therapy.therapy_type and frappe.db.get_value('Therapy Type', therapy.therapy_type, 'is_billable'):
- therapy_sessions_to_invoice.append({
- 'reference_type': 'Therapy Session',
- 'reference_name': therapy.name,
- 'service': frappe.db.get_value('Therapy Type', therapy.therapy_type, 'item')
- })
-
- return therapy_sessions_to_invoice
-
-@frappe.whitelist()
-def get_service_item_and_practitioner_charge(doc):
- if isinstance(doc, str):
- doc = json.loads(doc)
- doc = frappe.get_doc(doc)
-
- service_item = None
- practitioner_charge = None
- department = doc.medical_department if doc.doctype == 'Patient Encounter' else doc.department
-
- is_inpatient = doc.inpatient_record
-
- if doc.get('appointment_type'):
- service_item, practitioner_charge = get_appointment_type_service_item(doc.appointment_type, department, is_inpatient)
-
- if not service_item and not practitioner_charge:
- service_item, practitioner_charge = get_practitioner_service_item(doc.practitioner, is_inpatient)
- if not service_item:
- service_item = get_healthcare_service_item(is_inpatient)
-
- if not service_item:
- throw_config_service_item(is_inpatient)
-
- if not practitioner_charge:
- throw_config_practitioner_charge(is_inpatient, doc.practitioner)
-
- return {'service_item': service_item, 'practitioner_charge': practitioner_charge}
-
-
-def get_appointment_type_service_item(appointment_type, department, is_inpatient):
- from erpnext.healthcare.doctype.appointment_type.appointment_type import (
- get_service_item_based_on_department,
- )
-
- item_list = get_service_item_based_on_department(appointment_type, department)
- service_item = None
- practitioner_charge = None
-
- if item_list:
- if is_inpatient:
- service_item = item_list.get('inpatient_visit_charge_item')
- practitioner_charge = item_list.get('inpatient_visit_charge')
- else:
- service_item = item_list.get('op_consulting_charge_item')
- practitioner_charge = item_list.get('op_consulting_charge')
-
- return service_item, practitioner_charge
-
-
-def throw_config_service_item(is_inpatient):
- service_item_label = _('Out Patient Consulting Charge Item')
- if is_inpatient:
- service_item_label = _('Inpatient Visit Charge Item')
-
- msg = _(('Please Configure {0} in ').format(service_item_label) \
- + '''Healthcare Settings ''')
- frappe.throw(msg, title=_('Missing Configuration'))
-
-
-def throw_config_practitioner_charge(is_inpatient, practitioner):
- charge_name = _('OP Consulting Charge')
- if is_inpatient:
- charge_name = _('Inpatient Visit Charge')
-
- msg = _(('Please Configure {0} for Healthcare Practitioner').format(charge_name) \
- + ''' {0} '''.format(practitioner))
- frappe.throw(msg, title=_('Missing Configuration'))
-
-
-def get_practitioner_service_item(practitioner, is_inpatient):
- service_item = None
- practitioner_charge = None
-
- if is_inpatient:
- service_item, practitioner_charge = frappe.db.get_value('Healthcare Practitioner', practitioner, ['inpatient_visit_charge_item', 'inpatient_visit_charge'])
- else:
- service_item, practitioner_charge = frappe.db.get_value('Healthcare Practitioner', practitioner, ['op_consulting_charge_item', 'op_consulting_charge'])
-
- return service_item, practitioner_charge
-
-
-def get_healthcare_service_item(is_inpatient):
- service_item = None
-
- if is_inpatient:
- service_item = frappe.db.get_single_value('Healthcare Settings', 'inpatient_visit_charge_item')
- else:
- service_item = frappe.db.get_single_value('Healthcare Settings', 'op_consulting_charge_item')
-
- return service_item
-
-
-def get_practitioner_charge(practitioner, is_inpatient):
- if is_inpatient:
- practitioner_charge = frappe.db.get_value('Healthcare Practitioner', practitioner, 'inpatient_visit_charge')
- else:
- practitioner_charge = frappe.db.get_value('Healthcare Practitioner', practitioner, 'op_consulting_charge')
- if practitioner_charge:
- return practitioner_charge
- return False
-
-
-def manage_invoice_submit_cancel(doc, method):
- if doc.items:
- for item in doc.items:
- if item.get('reference_dt') and item.get('reference_dn'):
- if frappe.get_meta(item.reference_dt).has_field('invoiced'):
- set_invoiced(item, method, doc.name)
-
- if method=='on_submit' and frappe.db.get_single_value('Healthcare Settings', 'create_lab_test_on_si_submit'):
- create_multiple('Sales Invoice', doc.name)
-
-
-def set_invoiced(item, method, ref_invoice=None):
- invoiced = False
- if method=='on_submit':
- validate_invoiced_on_submit(item)
- invoiced = True
-
- if item.reference_dt == 'Clinical Procedure':
- service_item = frappe.db.get_single_value('Healthcare Settings', 'clinical_procedure_consumable_item')
- if service_item == item.item_code:
- frappe.db.set_value(item.reference_dt, item.reference_dn, 'consumption_invoiced', invoiced)
- else:
- frappe.db.set_value(item.reference_dt, item.reference_dn, 'invoiced', invoiced)
- else:
- frappe.db.set_value(item.reference_dt, item.reference_dn, 'invoiced', invoiced)
-
- if item.reference_dt == 'Patient Appointment':
- if frappe.db.get_value('Patient Appointment', item.reference_dn, 'procedure_template'):
- dt_from_appointment = 'Clinical Procedure'
- else:
- dt_from_appointment = 'Patient Encounter'
- manage_doc_for_appointment(dt_from_appointment, item.reference_dn, invoiced)
-
- elif item.reference_dt == 'Lab Prescription':
- manage_prescriptions(invoiced, item.reference_dt, item.reference_dn, 'Lab Test', 'lab_test_created')
-
- elif item.reference_dt == 'Procedure Prescription':
- manage_prescriptions(invoiced, item.reference_dt, item.reference_dn, 'Clinical Procedure', 'procedure_created')
-
-
-def validate_invoiced_on_submit(item):
- if item.reference_dt == 'Clinical Procedure' and \
- frappe.db.get_single_value('Healthcare Settings', 'clinical_procedure_consumable_item') == item.item_code:
- is_invoiced = frappe.db.get_value(item.reference_dt, item.reference_dn, 'consumption_invoiced')
- else:
- is_invoiced = frappe.db.get_value(item.reference_dt, item.reference_dn, 'invoiced')
- if is_invoiced:
- frappe.throw(_('The item referenced by {0} - {1} is already invoiced').format(
- item.reference_dt, item.reference_dn))
-
-
-def manage_prescriptions(invoiced, ref_dt, ref_dn, dt, created_check_field):
- created = frappe.db.get_value(ref_dt, ref_dn, created_check_field)
- if created:
- # Fetch the doc created for the prescription
- doc_created = frappe.db.get_value(dt, {'prescription': ref_dn})
- frappe.db.set_value(dt, doc_created, 'invoiced', invoiced)
-
-
-def check_fee_validity(appointment):
- if not frappe.db.get_single_value('Healthcare Settings', 'enable_free_follow_ups'):
- return
-
- validity = frappe.db.exists('Fee Validity', {
- 'practitioner': appointment.practitioner,
- 'patient': appointment.patient,
- 'valid_till': ('>=', appointment.appointment_date)
- })
- if not validity:
- return
-
- validity = frappe.get_doc('Fee Validity', validity)
- return validity
-
-
-def manage_fee_validity(appointment):
- fee_validity = check_fee_validity(appointment)
-
- if fee_validity:
- if appointment.status == 'Cancelled' and fee_validity.visited > 0:
- fee_validity.visited -= 1
- frappe.db.delete('Fee Validity Reference', {'appointment': appointment.name})
- elif fee_validity.status == 'Completed':
- return
- else:
- fee_validity.visited += 1
- fee_validity.append('ref_appointments', {
- 'appointment': appointment.name
- })
- fee_validity.save(ignore_permissions=True)
- else:
- fee_validity = create_fee_validity(appointment)
- return fee_validity
-
-
-def manage_doc_for_appointment(dt_from_appointment, appointment, invoiced):
- dn_from_appointment = frappe.db.get_value(
- dt_from_appointment,
- filters={'appointment': appointment}
- )
- if dn_from_appointment:
- frappe.db.set_value(dt_from_appointment, dn_from_appointment, 'invoiced', invoiced)
-
-
-@frappe.whitelist()
-def get_drugs_to_invoice(encounter):
- encounter = frappe.get_doc('Patient Encounter', encounter)
- if encounter:
- patient = frappe.get_doc('Patient', encounter.patient)
- if patient:
- if patient.customer:
- items_to_invoice = []
- for drug_line in encounter.drug_prescription:
- if drug_line.drug_code:
- qty = 1
- if frappe.db.get_value('Item', drug_line.drug_code, 'stock_uom') == 'Nos':
- qty = drug_line.get_quantity()
-
- description = ''
- if drug_line.dosage and drug_line.period:
- description = _('{0} for {1}').format(drug_line.dosage, drug_line.period)
-
- items_to_invoice.append({
- 'drug_code': drug_line.drug_code,
- 'quantity': qty,
- 'description': description
- })
- return items_to_invoice
- else:
- validate_customer_created(patient)
-
-
-@frappe.whitelist()
-def get_children(doctype, parent=None, company=None, is_root=False):
- parent_fieldname = 'parent_' + doctype.lower().replace(' ', '_')
- fields = [
- 'name as value',
- 'is_group as expandable',
- 'lft',
- 'rgt'
- ]
-
- filters = [["ifnull(`{0}`,'')".format(parent_fieldname),
- '=', '' if is_root else parent]]
-
- if is_root:
- fields += ['service_unit_type'] if doctype == 'Healthcare Service Unit' else []
- filters.append(['company', '=', company])
- else:
- fields += ['service_unit_type', 'allow_appointments', 'inpatient_occupancy',
- 'occupancy_status'] if doctype == 'Healthcare Service Unit' else []
- fields += [parent_fieldname + ' as parent']
-
- service_units = frappe.get_list(doctype, fields=fields, filters=filters)
- for each in service_units:
- if each['expandable'] == 1: # group node
- available_count = frappe.db.count('Healthcare Service Unit', filters={
- 'parent_healthcare_service_unit': each['value'],
- 'inpatient_occupancy': 1})
-
- if available_count > 0:
- occupied_count = frappe.db.count('Healthcare Service Unit', {
- 'parent_healthcare_service_unit': each['value'],
- 'inpatient_occupancy': 1,
- 'occupancy_status': 'Occupied'})
- # set occupancy status of group node
- each['occupied_of_available'] = str(
- occupied_count) + ' Occupied of ' + str(available_count)
-
- return service_units
-
-
-@frappe.whitelist()
-def get_patient_vitals(patient, from_date=None, to_date=None):
- if not patient: return
-
- vitals = frappe.db.get_all('Vital Signs', filters={
- 'docstatus': 1,
- 'patient': patient
- }, order_by='signs_date, signs_time', fields=['*'])
-
- if len(vitals):
- return vitals
- return False
-
-
-@frappe.whitelist()
-def render_docs_as_html(docs):
- # docs key value pair {doctype: docname}
- docs_html = ""
- for doc in docs:
- docs_html += render_doc_as_html(doc['doctype'], doc['docname'])['html'] + ' '
- return {'html': docs_html}
-
-
-@frappe.whitelist()
-def render_doc_as_html(doctype, docname, exclude_fields = []):
- """
- Render document as HTML
- """
-
- doc = frappe.get_doc(doctype, docname)
- meta = frappe.get_meta(doctype)
- doc_html = section_html = section_label = html = ""
- sec_on = has_data = False
- col_on = 0
-
- for df in meta.fields:
- # on section break append previous section and html to doc html
- if df.fieldtype == "Section Break":
- if has_data and col_on and sec_on:
- doc_html += section_html + html + "
"
-
- elif has_data and not col_on and sec_on:
- doc_html += """
-
-
-
- """.format(section_label, section_html, html)
-
- # close divs for columns
- while col_on:
- doc_html += " "
- col_on -= 1
-
- sec_on = True
- has_data = False
- col_on = 0
- section_html = html = ""
-
- if df.label:
- section_label = df.label
- continue
-
- # on column break append html to section html or doc html
- if df.fieldtype == "Column Break":
- if sec_on and not col_on and has_data:
- section_html += """
-