Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: showing medical code r69 on prelimiary and final diagnosis #652

Merged
merged 1 commit into from
Aug 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions hms_tz/nhif/api/patient_encounter.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ frappe.ui.form.on('Patient Encounter', {
},

default_healthcare_service_unit: function (frm) {
if (frm.doc.default_healthcare_service_unit) {
if (frm.doc.default_healthcare_service_unit && frm.doc.drug_prescription) {
frm.doc.drug_prescription.forEach(row => {
if (!row.healthcare_service_unit) {
frappe.model.set_value(
Expand Down Expand Up @@ -172,7 +172,7 @@ frappe.ui.form.on('Patient Encounter', {
}, 5);
}
});
refresh_field('patient_encounter_preliminary_diagnosis');
frm.refresh_field('patient_encounter_preliminary_diagnosis');
set_medical_code(frm, true);
frm.trigger("copy_from_preliminary_diagnosis");
}
Expand Down Expand Up @@ -246,7 +246,7 @@ frappe.ui.form.on('Patient Encounter', {
}, 5);
}
});
refresh_field('drug_prescription');
frm.refresh_field('drug_prescription');
}
}
});
Expand Down Expand Up @@ -286,7 +286,7 @@ frappe.ui.form.on('Patient Encounter', {
}, 5);
}
});
refresh_field('patient_encounter_final_diagnosis');
frm.refresh_field('patient_encounter_final_diagnosis');
set_medical_code(frm);
}
if (frm.doc.patient_encounter_preliminary_diagnosis.length > 0) {
Expand All @@ -304,21 +304,21 @@ frappe.ui.form.on('Patient Encounter', {
}
},
encounter_category: function (frm) {
if (frm.doc.patient_encounter_preliminary_diagnosis && frm.doc.patient_encounter_preliminary_diagnosis.length > 0) {
if (frm.doc.patient_encounter_preliminary_diagnosis && frm.doc.patient_encounter_preliminary_diagnosis.length > 1) {
return;
} else if (frm.doc.practitioner.includes("Direct")) {
let preliminary_row = frappe.model.add_child(frm.doc, "Codification Table", "patient_encounter_preliminary_diagnosis");
preliminary_row.medical_code = "ICD-10 R69";
preliminary_row.code = "R69";
preliminary_row.description = "Illness, unspecified";
preliminary_row.mtuha = "Other";
refresh_field('patient_encounter_preliminary_diagnosis');
frm.refresh_field('patient_encounter_preliminary_diagnosis');
let final_row = frappe.model.add_child(frm.doc, "Codification Table", "patient_encounter_final_diagnosis");
final_row.medical_code = "ICD-10 R69";
final_row.code = "R69";
final_row.description = "Illness, unspecified";
final_row.mtuha = "Other";
refresh_field('patient_encounter_final_diagnosis');
frm.refresh_field('patient_encounter_final_diagnosis');
}
set_medical_code(frm, true);

Expand Down Expand Up @@ -388,7 +388,7 @@ frappe.ui.form.on('Patient Encounter', {
for (var row in r.message.lab_bundle_item) {
var child = frm.add_child("lab_test_prescription");
frappe.model.set_value(child.doctype, child.name, "lab_test_code", r.message.lab_bundle_item[row].lab_test_template);
refresh_field("lab_test_prescription");
frm.refresh_field("lab_test_prescription");
}
}
}
Expand Down Expand Up @@ -869,7 +869,7 @@ frappe.ui.form.on('Drug Prescription', {
drug_prescription_add: function (frm, cdt, cdn) {
var row = frappe.get_doc(cdt, cdn);
if (!row.healthcare_service_unit) row.healthcare_service_unit = frm.doc.default_healthcare_service_unit;
refresh_field("drug_prescription");
frm.refresh_field("drug_prescription");
}
});

Expand Down