Status Issue in Patient Encounter Doctype

Hello,

I’m using Healthcare module in ERPNext 14 and here I’m facing an issue and I think it is a bug. I’ve added a Patient Appointment and some status is set there like Confirmed or Scheduled. Now, I’ve clicked on the Patient Encounter from the connection available in the Patient Appointment. So, in this case I’m moving many details like Patient details, appointment details etc into Patient Encounter form and status is also moving. But the status which is available in Patient Encounter is different from the Patient Appointment doctype and because the status is a readonly filed so I can’t change status and I’m not able to save Patient Encounter form also.

I’m attaching the screenshots here:

  1. I’ve added one appointment and clicked on the Patient Consultation + icon in connection.

  2. Patient Consultation opened with prefilled data where status is showing as confirmed which is not a option in Patient Consultation doctype.

  3. I can’t change the status because it is a readonly field and can’t save the form because of status is not the part of this doctype and getting this error:

Note: I’ve renamed Patient Encounter to Patient Consultation

edit your doctype goto status field and add confirmed

Yes, I can add these statuses in doctype but this is not a proper way because it will show status as Scheduled or Confirmed but in actual the status is closed or completed because Doctor added his/her comments, prescription etc in the Patient Encounter and saved it and after this if status will show as Scheduled or Confirmed then it will create a confusion.

status field is linked to the document if you have such settings it will automatically update the field in my case its happening like this

Thank you for your response. But I got a solution. I’ve added this following code in patient_appointment.py file to make the status as Open which is common in both doctypes and now I can save and submit the form.

@frappe.whitelist()
def make_encounter(source_name, target_doc=None):
    # Create a mapped document
    doc = get_mapped_doc(
        "Patient Appointment",
        source_name,
        {
            "Patient Appointment": {
                "doctype": "Patient Encounter",
                "field_map": [
                    ["appointment", "name"],
                    ["patient", "patient"],
                    ["practitioner", "practitioner"],
                    ["medical_department", "department"],
                    ["patient_sex", "patient_sex"],
                    ["invoiced", "invoiced"],
                    ["company", "company"],
                ],
            }
        },
        target_doc,
    )

    # Explicitly set the status to a valid default value (e.g., "Open")
    doc.status = "Open"

    # Return the mapped document
    return doc