fix: change Patient Medical Record subject fieldtype to Text Editor

This commit is contained in:
Rucha Mahabal 2020-04-29 13:06:52 +05:30
parent 9bf733d82e
commit 708bceba6e
5 changed files with 39 additions and 32 deletions

View File

@ -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 += '<br/>' + doc.notes

View File

@ -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 + "<br>"
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 += "<br/>"+table_row
subject += "<br>" + table_row
if doc.lab_test_comment:
subject += "<br/>"+ cstr(doc.lab_test_comment)
subject += "<br>" + cstr(doc.lab_test_comment)
medical_record = frappe.new_doc("Patient Medical Record")
medical_record.patient = doc.patient

View File

@ -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 + '<br>'
if encounter.symptoms:
subject += _('Symptoms: ') + cstr(encounter.symptoms) + '\n'
subject += frappe.bold(_('Symptoms: ')) + '<br>'
for entry in encounter.symptoms:
subject += cstr(entry.complaint) + '<br>'
else:
subject += _('No Symptoms') + '\n'
subject += frappe.bold(_('No Symptoms')) + '<br>'
if encounter.diagnosis:
subject += _('Diagnosis: ') + cstr(encounter.diagnosis) + '\n'
subject += frappe.bold(_('Diagnosis: ')) + '<br>'
for entry in encounter.diagnosis:
subject += cstr(entry.diagnosis) + '<br>'
else:
subject += _('No Diagnosis') + '\n'
subject += frappe.bold(_('No Diagnosis')) + '<br>'
if encounter.drug_prescription:
subject += '\n' + _('Drug(s) Prescribed.')
subject += '<br>' + _('Drug(s) Prescribed.')
if encounter.lab_test_prescription:
subject += '\n' + _('Test(s) Prescribed.')
subject += '<br>' + _('Test(s) Prescribed.')
if encounter.procedure_prescription:
subject += '\n' + _('Procedure(s) Prescribed.')
subject += '<br>' + _('Procedure(s) Prescribed.')
return subject

View File

@ -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",

View File

@ -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) + '<br>'
if doc.pulse:
subject += frappe.bold(_('Pulse: ')) + cstr(doc.pulse) + '<br>'
if doc.respiratory_rate:
subject += frappe.bold(_('Respiratory Rate: ')) + cstr(doc.respiratory_rate) + '<br>'
if doc.bp:
subject += frappe.bold(_('BP: ')) + cstr(doc.bp) + '<br>'
if doc.bmi:
subject += frappe.bold(_('BMI: ')) + cstr(doc.bmi) + '<br>'
if doc.nutrition_note:
subject += frappe.bold(_('Note: ')) + cstr(doc.nutrition_note) + '<br>'
return subject