Patient medical record updation and deletion fixes (#13891)

This commit is contained in:
Jamsheer 2018-05-04 18:13:28 +05:30 committed by Nabin Hait
parent 55daa9cd24
commit bd63f0056a
3 changed files with 5 additions and 3 deletions

View File

@ -113,9 +113,11 @@ def insert_consultation_to_medical_record(doc):
def update_consultation_to_medical_record(consultation):
medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s", (consultation.name))
if(medical_record_id[0][0]):
if medical_record_id and medical_record_id[0][0]:
subject = set_subject_field(consultation)
frappe.db.set_value("Patient Medical Record", medical_record_id[0][0], "subject", subject)
else:
insert_consultation_to_medical_record(consultation)
def delete_medical_record(consultation):
frappe.db.sql("""delete from `tabPatient Medical Record` where reference_name = %s""", (consultation.name))

View File

@ -244,7 +244,7 @@ def insert_lab_test_to_medical_record(doc):
def delete_lab_test_from_medical_record(self):
medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(self.name))
if(medical_record_id[0][0]):
if medical_record_id and medical_record_id[0][0]:
frappe.delete_doc("Patient Medical Record", medical_record_id[0][0])
def create_item_line(test_code, sales_invoice):

View File

@ -27,7 +27,7 @@ def insert_vital_signs_to_medical_record(doc):
def delete_vital_signs_from_medical_record(doc):
medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(doc.name))
if(medical_record_id[0][0]):
if medical_record_id and medical_record_id[0][0]:
frappe.delete_doc("Patient Medical Record", medical_record_id[0][0])
def set_subject_field(doc):