Update Order
Inbound HL7/SFTP documentation for order update, accession update, and sample-status update behavior.
Update Order
The inbound create-order endpoint also supports update-like behavior. This does
not call the normal UI bill-update API. Instead, /create_order_in_crelio/
detects existing bills or reports and updates accession/sample state before
attempting new bill creation.
When This Flow Runs
This flow runs inside create_order_in_crelio when the parsed payload points to
an existing active bill or report.
Supported identifiers:
| Parsed field | Typical HL7 source | Lookup behavior |
|---|---|---|
orderNumber | OBR/ORC-derived order number | Finds active bill by order number. |
lab_report_id | OBR-3 | Finds the active lab report relation. |
manual_sample_id | ZCT-12 | Finds active report by manual sample ID. |
bill_id | Vendor-specific, mainly Cerner | Finds report/bill for Cerner accession update. |
Implementation Path
| Step | Function | Description |
|---|---|---|
| Existing order detection | create_order_in_crelio | Checks order number, report ID, and manual sample ID before patient/bill creation. |
| Accession parsing | sample_accession_hl7_payload | Re-parses the original HL7 payload for accession fields. |
| Accession update | common_function_to_update_sample_id | Updates report and collected sample accession data. |
| Test/sample dismissal | dismissTestAPI | Used when inbound sample status indicates cancellation. |
Accession Parser Fields
sample_accession_hl7_payload reads a smaller payload from the same raw HL7
message.
| Parsed field | HL7 source | Description |
|---|---|---|
lab_report_id | OBR-3 | Report identifier. |
manual_sample_id | ZCT-12 | New manual sample/accession number. |
test_code | OBR-4 | Test code used as a fallback report lookup. |
orc_status | ORC-1 | Order control/status. |
sample_status | ORC-5 | Sample state such as in-lab, completed, collected, or cancel-like values. |
lrr_list | All OBR-3 values | Multi-report update list, used especially for Cerner. |
sample_location_mapping | Cerner ZCT/location fields | Sample rack/location mapping. |
Update Behavior
When a matching report/sample is found, the update flow can:
- Update the report manual sample ID.
- Update the collected sample accession number.
- Mark accession as done on the collected sample.
- Update report/sample timestamps.
- Update sample collected or received flags when
sample_statusisin-lab,completed, orcollected. - Update Elasticsearch report/sample fields.
- Write an activity log for the accession update.
Sample-Level Cancellation
If sample_status contains cancel, the flow dismisses the
matching report/test instead of updating accession fields.
The dismissal comment is:
Test dismissed through Integration by user <lab_user>This is test/sample-level cancellation. Full bill cancellation is documented in Bill Cancel.
Cerner-Specific Behavior
When integration = cerner, the update flow supports additional behavior:
- It can update an existing bill's
orderNumber. - It can update sample received state for all tests listed in
OBRsegment. - It can match tests by lab report ID, test code, or test name.
- It can update rack/location information from Cerner-specific ZCT data.
Responses
| Response | Meaning |
|---|---|
Manual sampleId updated | Existing bill/report was found and accession update succeeded. |
Manual sampleId failed to update | Existing bill/report was found but update failed. |
Accession Number was updated successfully | Cerner accession update succeeded. |
Sample Received successfully! | Cerner sample received update succeeded. |
Accession number should not be blank | Non-Cerner update did not include a manual sample/accession ID. |
No records found | No bill/report identifier could be resolved for update. |
Can not find the Lab Report... | Report lookup failed for the bill/test combination. |