In Frappe Healthcare module, I want to intergrate my existing Lab with the Outsource Lab Software using the Webhook of Frappe. Here, there is a only way to use the parent table in the webhook json data, but I want to incorporate the child table also, how can I do this?..
//the below is my json data for the lab integration,
{
“PatientId”: “{{ doc.patient or ‘N/A’ }}”,
“PatientName”: “{{ doc.patient_name or ‘N/A’ }}”,
“Age”: “{{ doc.patient_age or ‘N/A’ }}”,
“DOB”: “{{ doc.custom_dob or ‘N/A’ }}”,
“Gender”: “{{ doc.custom_gender or ‘N/A’ }}”,
“Phone_Number”: “{{ doc.custom_mobile or ‘N/A’ }}”,
“date_of_request”: “{{ doc.posting_date or ‘N/A’ }}”,
“Refering_Hospital”: “{{ doc.company or ‘N/A’ }}”,
“status”: “{{ doc.status or ‘N/A’ }}”,
“LabRequests”: [
{% set lab_requests = %}
{% set items = doc.get(“items”) %}
{% for item in items %}
{% if item.item_code and item.reference_dn %}
{% set lab_requests = lab_requests + [{“Test_Name”: item.item_code, “Test_Code”: item.reference_dn}] %}
{% endif %}
{% endfor %}
{% if lab_requests | length == 0 %}
{"Test_Name": "No Lab Tests Found", "Test_Code": "N/A"}
{% else %}
{% for lab_request in lab_requests %}
{{ lab_request | json }},
{% endfor %}
{% if lab_requests | length > 0 %}
{{ lab_requests[-1] | json }}
{% endif %}
{% endif %}
]
}
// Here I want get the field values of the “Sales Invoice Item” table “item_code” and “reference_dn” on the “Test_Name” and “Test_Code”…