feat: patch to setup standard doctype config in Patient History Settings
diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.json b/erpnext/healthcare/doctype/lab_test/lab_test.json
index edf1d91..ac61fea 100644
--- a/erpnext/healthcare/doctype/lab_test/lab_test.json
+++ b/erpnext/healthcare/doctype/lab_test/lab_test.json
@@ -359,6 +359,7 @@
{
"fieldname": "normal_test_items",
"fieldtype": "Table",
+ "label": "Normal Test Result",
"options": "Normal Test Result",
"print_hide": 1
},
@@ -380,6 +381,7 @@
{
"fieldname": "sensitivity_test_items",
"fieldtype": "Table",
+ "label": "Sensitivity Test Result",
"options": "Sensitivity Test Result",
"print_hide": 1,
"report_hide": 1
@@ -529,6 +531,7 @@
{
"fieldname": "descriptive_test_items",
"fieldtype": "Table",
+ "label": "Descriptive Test Result",
"options": "Descriptive Test Result",
"print_hide": 1,
"report_hide": 1
@@ -549,13 +552,14 @@
{
"fieldname": "organism_test_items",
"fieldtype": "Table",
+ "label": "Organism Test Result",
"options": "Organism Test Result",
"print_hide": 1
}
],
"is_submittable": 1,
"links": [],
- "modified": "2020-07-30 18:18:38.516215",
+ "modified": "2020-11-30 11:04:17.195848",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Lab Test",
diff --git a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.json b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.json
index 15675f4..b646ff9 100644
--- a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.json
+++ b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.json
@@ -210,7 +210,7 @@
{
"fieldname": "drug_prescription",
"fieldtype": "Table",
- "label": "Items",
+ "label": "Drug Prescription",
"options": "Drug Prescription"
},
{
@@ -328,7 +328,7 @@
],
"is_submittable": 1,
"links": [],
- "modified": "2020-05-16 21:00:08.644531",
+ "modified": "2020-11-30 10:39:00.783119",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Patient Encounter",
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
index ef4fc2b..9c9d0cb 100644
--- 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
@@ -6,6 +6,7 @@
"engine": "InnoDB",
"field_order": [
"document_type",
+ "date_fieldname",
"add_edit_fields",
"selected_fields"
],
@@ -29,12 +30,20 @@
"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-28 18:57:30.446348",
+ "modified": "2020-11-30 12:15:14.940935",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Patient History Standard Document Type",
diff --git a/erpnext/healthcare/setup.py b/erpnext/healthcare/setup.py
index 0684080..bf4df7e 100644
--- a/erpnext/healthcare/setup.py
+++ b/erpnext/healthcare/setup.py
@@ -16,6 +16,7 @@
create_healthcare_item_groups()
create_sensitivity()
add_healthcare_service_unit_tree_root()
+ setup_patient_history_settings()
def create_medical_departments():
departments = [
@@ -213,3 +214,82 @@
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"}
+ ])
+ }
\ No newline at end of file
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 25be884..fcb63ed 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -735,3 +735,4 @@
erpnext.patches.v13_0.update_reason_for_resignation_in_employee
erpnext.patches.v13_0.update_custom_fields_for_shopify
execute:frappe.delete_doc("Report", "Quoted Item Comparison")
+erpnext.patches.v13_0.setup_patient_history_settings_for_standard_doctypes
diff --git a/erpnext/patches/v13_0/setup_patient_history_settings_for_standard_doctypes.py b/erpnext/patches/v13_0/setup_patient_history_settings_for_standard_doctypes.py
new file mode 100644
index 0000000..3332be0
--- /dev/null
+++ b/erpnext/patches/v13_0/setup_patient_history_settings_for_standard_doctypes.py
@@ -0,0 +1,9 @@
+from __future__ import unicode_literals
+import frappe
+from erpnext.healthcare.setup import setup_patient_history_settings
+
+def execute():
+ if 'Healthcare' not in frappe.get_active_domains():
+ return
+
+ setup_patient_history_settings()
\ No newline at end of file