From 708bceba6e7dd303c0e3f258ba347af0b0408124 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Wed, 29 Apr 2020 13:06:52 +0530 Subject: [PATCH] fix: change Patient Medical Record subject fieldtype to Text Editor --- .../clinical_procedure/clinical_procedure.py | 2 +- .../healthcare/doctype/lab_test/lab_test.py | 18 +++++++------- .../patient_encounter/patient_encounter.py | 23 +++++++++++------- .../patient_medical_record.json | 4 ++-- .../doctype/vital_signs/vital_signs.py | 24 +++++++++---------- 5 files changed, 39 insertions(+), 32 deletions(-) diff --git a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py index d6c0893914..297f1b9f4c 100644 --- a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py +++ b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py @@ -248,7 +248,7 @@ def make_procedure(source_name, target_doc=None): def insert_clinical_procedure_to_medical_record(doc): subject = cstr(doc.procedure_template) if doc.practitioner: - subject += ' ' + doc.practitioner + subject += frappe.bold(_('Healthcare Practitioner: ')) + doc.practitioner if subject and doc.notes: subject += '
' + doc.notes diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.py b/erpnext/healthcare/doctype/lab_test/lab_test.py index 4e4015d2f0..ea8ce25c97 100644 --- a/erpnext/healthcare/doctype/lab_test/lab_test.py +++ b/erpnext/healthcare/doctype/lab_test/lab_test.py @@ -288,23 +288,23 @@ def insert_lab_test_to_medical_record(doc): table_row = False subject = cstr(doc.lab_test_name) if doc.practitioner: - subject += " "+ doc.practitioner + subject += frappe.bold(_("Healthcare Practitioner: "))+ doc.practitioner + "
" if doc.normal_test_items: item = doc.normal_test_items[0] comment = "" if item.lab_test_comment: comment = str(item.lab_test_comment) - table_row = item.lab_test_name + table_row = frappe.bold(_("Lab Test Conducted: ")) + item.lab_test_name if item.lab_test_event: - table_row += " " + item.lab_test_event + table_row += frappe.bold(_("Lab Test Event: ")) + item.lab_test_event if item.result_value: - table_row += " " + item.result_value + table_row += " " + frappe.bold(_("Lab Test Result: ")) + item.result_value if item.normal_range: - table_row += " normal_range("+item.normal_range+")" - table_row += " "+comment + table_row += " " + _("Normal Range:") + item.normal_range + table_row += " " + comment elif doc.special_test_items: item = doc.special_test_items[0] @@ -316,12 +316,12 @@ def insert_lab_test_to_medical_record(doc): item = doc.sensitivity_test_items[0] if item.antibiotic and item.antibiotic_sensitivity: - table_row = item.antibiotic +" "+ item.antibiotic_sensitivity + table_row = item.antibiotic + " " + item.antibiotic_sensitivity if table_row: - subject += "
"+table_row + subject += "
" + table_row if doc.lab_test_comment: - subject += "
"+ cstr(doc.lab_test_comment) + subject += "
" + cstr(doc.lab_test_comment) medical_record = frappe.new_doc("Patient Medical Record") medical_record.patient = doc.patient diff --git a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py index 767643bc73..1734c28e52 100644 --- a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py +++ b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py @@ -18,6 +18,9 @@ class PatientEncounter(Document): def after_insert(self): insert_encounter_to_medical_record(self) + def on_submit(self): + update_encounter_medical_record(self) + def on_cancel(self): if self.appointment: frappe.db.set_value('Patient Appointment', self.appointment, 'status', 'Open') @@ -66,22 +69,26 @@ def delete_medical_record(encounter): frappe.db.delete_doc_if_exists('Patient Medical Record', 'reference_name', encounter.name) def set_subject_field(encounter): - subject = encounter.practitioner + '\n' + subject = frappe.bold(_('Healthcare Practitioner: ')) + encounter.practitioner + '
' if encounter.symptoms: - subject += _('Symptoms: ') + cstr(encounter.symptoms) + '\n' + subject += frappe.bold(_('Symptoms: ')) + '
' + for entry in encounter.symptoms: + subject += cstr(entry.complaint) + '
' else: - subject += _('No Symptoms') + '\n' + subject += frappe.bold(_('No Symptoms')) + '
' if encounter.diagnosis: - subject += _('Diagnosis: ') + cstr(encounter.diagnosis) + '\n' + subject += frappe.bold(_('Diagnosis: ')) + '
' + for entry in encounter.diagnosis: + subject += cstr(entry.diagnosis) + '
' else: - subject += _('No Diagnosis') + '\n' + subject += frappe.bold(_('No Diagnosis')) + '
' if encounter.drug_prescription: - subject += '\n' + _('Drug(s) Prescribed.') + subject += '
' + _('Drug(s) Prescribed.') if encounter.lab_test_prescription: - subject += '\n' + _('Test(s) Prescribed.') + subject += '
' + _('Test(s) Prescribed.') if encounter.procedure_prescription: - subject += '\n' + _('Procedure(s) Prescribed.') + subject += '
' + _('Procedure(s) Prescribed.') return subject diff --git a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json index 3655e24cb9..ed82355f33 100644 --- a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json +++ b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json @@ -57,7 +57,7 @@ }, { "fieldname": "subject", - "fieldtype": "Small Text", + "fieldtype": "Text Editor", "ignore_xss_filter": 1, "label": "Subject" }, @@ -125,7 +125,7 @@ ], "in_create": 1, "links": [], - "modified": "2020-03-23 19:26:59.308383", + "modified": "2020-04-29 12:26:57.679402", "modified_by": "Administrator", "module": "Healthcare", "name": "Patient Medical Record", diff --git a/erpnext/healthcare/doctype/vital_signs/vital_signs.py b/erpnext/healthcare/doctype/vital_signs/vital_signs.py index 959e8504c4..b0e78e8eb9 100644 --- a/erpnext/healthcare/doctype/vital_signs/vital_signs.py +++ b/erpnext/healthcare/doctype/vital_signs/vital_signs.py @@ -35,17 +35,17 @@ def delete_vital_signs_from_medical_record(doc): def set_subject_field(doc): subject = '' - if(doc.temperature): - subject += _('Temperature: ') + '\n'+ cstr(doc.temperature) + '. ' - if(doc.pulse): - subject += _('Pulse: ') + '\n' + cstr(doc.pulse) + '. ' - if(doc.respiratory_rate): - subject += _('Respiratory Rate: ') + '\n' + cstr(doc.respiratory_rate) + '. ' - if(doc.bp): - subject += _('BP: ') + '\n' + cstr(doc.bp) + '. ' - if(doc.bmi): - subject += _('BMI: ') + '\n' + cstr(doc.bmi) + '. ' - if(doc.nutrition_note): - subject += _('Note: ') + '\n' + cstr(doc.nutrition_note) + '. ' + if doc.temperature: + subject += frappe.bold(_('Temperature: ')) + cstr(doc.temperature) + '
' + if doc.pulse: + subject += frappe.bold(_('Pulse: ')) + cstr(doc.pulse) + '
' + if doc.respiratory_rate: + subject += frappe.bold(_('Respiratory Rate: ')) + cstr(doc.respiratory_rate) + '
' + if doc.bp: + subject += frappe.bold(_('BP: ')) + cstr(doc.bp) + '
' + if doc.bmi: + subject += frappe.bold(_('BMI: ')) + cstr(doc.bmi) + '
' + if doc.nutrition_note: + subject += frappe.bold(_('Note: ')) + cstr(doc.nutrition_note) + '
' return subject