Tross
Demo dataBook a demo
ECLINICALWORKS

Write surgical history

Add surgical history rows.

POSThttps://preview.ontross.com/api/integrations/ecw/write-surgical-history
Request Fields
input.patientId
string
required
Patient chart being read or written, from fetch-patients.
Example
"407069"
input.encounterId
string
required
Encounter being read or written, from fetch-appointments.
Example
"1870494"
input.surgeries
array
required
Surgery rows to append, resolved by CPT code, title, or verbatim.
input.surgeries[].surgery
string
Surgery title supplied by the caller. Required when writeMode is free_text; otherwise used for catalog matching when a CPT code is unavailable or cannot resolve.
Example
"amputation, above the left knee"
Default
""
input.surgeries[].cptCode
string
CPT code resolved against the catalog instead of the surgery title.
Example
"0001F"
Default
""
input.surgeries[].writeMode
string
catalog (default) resolves a CPT code or surgical-history catalog item before writing. free_text writes the supplied surgery title exactly as entered after whitespace normalization, without performing any catalog lookup.
Example
"catalog"
Default
"catalog"
Accepted values
catalogfree_text
input.surgeries[].date
string
Optional surgery date in MM/YYYY format.
Example
"05/2022"
Default
""
auth_id
string
required
Saved connection to run this operation through, from the Authentication page. It decides which practice and login the call uses.
Example
"00000000-0000-4000-8000-000000000000"
Output Fields
surgeryResults
array
Per-surgery outcome, one row per surgery you sent.
surgeryResults[].sourceText
string
Original medication text, echoed back in the write result.
Example
"Appendectomy"
surgeryResults[].sourceCptCode
string
CPT code you sent, before any catalog resolution.
Example
"44950"
surgeryResults[].date
string
Submitted operation month and year, empty when omitted.
Example
"05/2022"
surgeryResults[].catalogItemId
string
Surgical History catalog entry this surgery matched to.
Example
"900801"
surgeryResults[].writeMode
string
The mode used to write this surgical-history entry.
Example
"catalog"
surgeryResults[].matchStatus
string
Catalog-match outcome. not_attempted is returned only when writeMode is free_text, which intentionally bypasses catalog matching.
Example
"matched"
surgeryResults[].status
string
Write outcome distinguishing added, already present, and unwritten procedures.
Example
"added"
surgeryResults[].matchType
string
How the surgery matched: cpt, exact, or blank, since close is unused.
Example
"cpt"
surgeryResults[].reason
string
Why the call or hospitalization happened, saved as row text.
Example
"No matching catalog procedure found."
surgeryResults[].resolvedSurgery
string
Surgery title eCW actually stored, not your wording.
Example
"Appendectomy"
surgeryResults[].resolvedCptCode
string
CPT code eCW actually stored for this surgery.
Example
"44950"
surgicalHistorySaved
boolean
Whether eCW accepted the surgical history write.
Example
true
Code
curl --request POST \
  --url https://preview.ontross.com/api/integrations/ecw/write-surgical-history \
  --header 'X-API-Key: REPLACE_KEY_VALUE' \
  --header 'content-type: application/json' \
  --data '{"input":{"encounterId":"200001","patientId":"100001","surgeries":[{"date":"05/2022","surgery":"amputation, above the left knee"},{"cptCode":"0001F","date":"01/2024"}]},"auth_id":"auth_uuid_here"}'
Request BODY
{
  "input": {
    "encounterId": "200001",
    "patientId": "100001",
    "surgeries": [
      {
        "date": "05/2022",
        "surgery": "amputation, above the left knee"
      },
      {
        "cptCode": "0001F",
        "date": "01/2024"
      }
    ]
  },
  "auth_id": "auth_uuid_here"
}
Response BODY
{
  "id": "string",
  "workflow_id": "string",
  "auth_id": "string",
  "status": "string",
  "input": {},
  "output": {
    "surgeryResults": [
      {
        "sourceText": "Appendectomy",
        "sourceCptCode": "44950",
        "date": "05/2022",
        "catalogItemId": "900801",
        "writeMode": "catalog",
        "matchStatus": "matched",
        "status": "added",
        "matchType": "cpt",
        "reason": "No matching catalog procedure found.",
        "resolvedSurgery": "Appendectomy",
        "resolvedCptCode": "44950"
      }
    ],
    "surgicalHistorySaved": true
  },
  "files": null,
  "created_at": "2019-08-24T14:15:22Z",
  "started_at": "2019-08-24T14:15:22Z",
  "completed_at": "2019-08-24T14:15:22Z"
}