{
 "openapi": "3.1.0",
 "info": {
  "title": "Patient Statements (EHR)",
  "version": "20261030b",
  "description": "Every statement sent, held or suppressed: previous balance, new charges, payments, adjustments, amount due, ageing and the dunning message. A patient with a portal account sees theirs there."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "patient-statements": {
    "type": "object",
    "required": [],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "statement_no": {
      "type": "string",
      "description": "Statement no",
      "readOnly": true
     },
     "run_id": {
      "type": "string",
      "format": "uuid",
      "description": "Run id",
      "readOnly": true
     },
     "patient_id": {
      "type": "string",
      "format": "uuid",
      "description": "Patient id",
      "readOnly": true
     },
     "statement_date": {
      "type": "string",
      "format": "date",
      "description": "Statement date",
      "readOnly": true
     },
     "due_date": {
      "type": "string",
      "format": "date",
      "description": "Due date",
      "readOnly": true
     },
     "previous_statement_id": {
      "type": "string",
      "format": "uuid",
      "description": "Previous statement id",
      "readOnly": true
     },
     "previous_balance": {
      "type": "string",
      "format": "decimal",
      "description": "Previous balance",
      "readOnly": true
     },
     "new_charges": {
      "type": "string",
      "format": "decimal",
      "description": "New charges",
      "readOnly": true
     },
     "payments": {
      "type": "string",
      "format": "decimal",
      "description": "Payments",
      "readOnly": true
     },
     "adjustments": {
      "type": "string",
      "format": "decimal",
      "description": "Adjustments",
      "readOnly": true
     },
     "amount_due": {
      "type": "string",
      "format": "decimal",
      "description": "Amount due",
      "readOnly": true
     },
     "insurance_pending": {
      "type": "string",
      "format": "decimal",
      "description": "Insurance pending",
      "readOnly": true
     },
     "aged_current": {
      "type": "string",
      "format": "decimal",
      "description": "Aged current",
      "readOnly": true
     },
     "aged_31_60": {
      "type": "string",
      "format": "decimal",
      "description": "Aged 31 60",
      "readOnly": true
     },
     "aged_61_90": {
      "type": "string",
      "format": "decimal",
      "description": "Aged 61 90",
      "readOnly": true
     },
     "aged_91_120": {
      "type": "string",
      "format": "decimal",
      "description": "Aged 91 120",
      "readOnly": true
     },
     "aged_over_120": {
      "type": "string",
      "format": "decimal",
      "description": "Aged over 120",
      "readOnly": true
     },
     "oldest_days": {
      "type": "integer",
      "description": "Oldest days",
      "readOnly": true
     },
     "dunning_level": {
      "type": "integer",
      "description": "Dunning level",
      "readOnly": true
     },
     "dunning_message": {
      "type": "string",
      "description": "Dunning message",
      "readOnly": true
     },
     "status": {
      "type": "string",
      "description": "Status",
      "readOnly": true
     },
     "hold_reason": {
      "type": "string",
      "description": "Hold reason",
      "readOnly": true
     },
     "portal_visible": {
      "type": "boolean",
      "description": "Portal visible",
      "readOnly": true
     },
     "payment_url": {
      "type": "string",
      "description": "Payment url",
      "readOnly": true
     },
     "address_block": {
      "type": "string",
      "description": "Address block",
      "readOnly": true
     },
     "sent_at": {
      "type": "string",
      "format": "date-time",
      "description": "Sent at",
      "readOnly": true
     },
     "viewed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Viewed at",
      "readOnly": true
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/ehr/patient-statements": {
   "get": {
    "summary": "list patient-statements",
    "operationId": "list_patient_statements_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Post patient statements",
    "operationId": "action_patient_statements_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/ehr/patient-statements/{id}": {
   "get": {
    "summary": "get patient-statements",
    "operationId": "get_patient_statements_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "Put patient statements",
    "operationId": "action_patient_statements_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Delete patient statements",
    "operationId": "action_patient_statements_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/ehr/patient-statements/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_patient_statements_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/ehr/patient-statements/{id}/release": {
   "post": {
    "summary": "Release",
    "operationId": "action_patient_statements_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/ehr/patient-statements/{id}/void": {
   "post": {
    "summary": "Void",
    "operationId": "action_patient_statements_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/ehr/patient-statements/account/{patientId}": {
   "get": {
    "summary": "Account",
    "operationId": "action_patient_statements_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/ehr/patient-statements/{id}/detail": {
   "get": {
    "summary": "Detail",
    "operationId": "action_patient_statements_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/ehr/patient-statements/{id}/pdf": {
   "get": {
    "summary": "Pdf",
    "operationId": "action_patient_statements_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}