PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
worklist_record.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2021-2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
18#pragma once
19
20#include <chrono>
21#include <optional>
22#include <string>
23
24namespace kcenon::pacs::storage {
25
31enum class worklist_status {
32 scheduled,
33 started,
35};
36
43[[nodiscard]] inline auto to_string(worklist_status status) -> std::string {
44 switch (status) {
46 return "SCHEDULED";
48 return "STARTED";
50 return "COMPLETED";
51 default:
52 return "SCHEDULED";
53 }
54}
55
62[[nodiscard]] inline auto parse_worklist_status(std::string_view str)
63 -> std::optional<worklist_status> {
64 if (str == "SCHEDULED") {
66 }
67 if (str == "STARTED") {
69 }
70 if (str == "COMPLETED") {
72 }
73 return std::nullopt;
74}
75
108 int64_t pk{0};
109
111 std::string step_id;
112
114 std::string step_status;
115
117 std::string patient_id;
118
120 std::string patient_name;
121
123 std::string birth_date;
124
126 std::string sex;
127
129 std::string accession_no;
130
132 std::string requested_proc_id;
133
135 std::string study_uid;
136
139
141 std::string station_ae;
142
144 std::string station_name;
145
147 std::string modality;
148
150 std::string procedure_desc;
151
153 std::string protocol_code;
154
156 std::string referring_phys;
157
159 std::string referring_phys_id;
160
162 std::chrono::system_clock::time_point created_at;
163
165 std::chrono::system_clock::time_point updated_at;
166
172 [[nodiscard]] auto is_valid() const noexcept -> bool {
173 return !step_id.empty() && !patient_id.empty() && !modality.empty() &&
174 !scheduled_datetime.empty();
175 }
176
184 [[nodiscard]] auto is_scheduled() const noexcept -> bool {
185 return step_status == "SCHEDULED" || step_status.empty();
186 }
187
193 [[nodiscard]] auto get_status() const -> std::optional<worklist_status> {
195 }
196};
197
216 std::optional<std::string> station_ae;
217
219 std::optional<std::string> modality;
220
222 std::optional<std::string> scheduled_date_from;
223
225 std::optional<std::string> scheduled_date_to;
226
228 std::optional<std::string> patient_id;
229
231 std::optional<std::string> patient_name;
232
234 std::optional<std::string> accession_no;
235
237 std::optional<std::string> step_id;
238
241
243 size_t limit{0};
244
246 size_t offset{0};
247
253 [[nodiscard]] auto has_criteria() const noexcept -> bool {
254 return station_ae.has_value() || modality.has_value() ||
255 scheduled_date_from.has_value() || scheduled_date_to.has_value() ||
256 patient_id.has_value() || patient_name.has_value() ||
257 accession_no.has_value() || step_id.has_value();
258 }
259};
260
261} // namespace kcenon::pacs::storage
@ completed
Procedure completed successfully.
worklist_status
Worklist step status values.
@ started
Procedure has been started (MPPS received)
@ scheduled
Procedure is scheduled (default)
@ completed
Procedure has been completed.
@ scheduled
Workitem is scheduled (initial state)
auto parse_worklist_status(std::string_view str) -> std::optional< worklist_status >
Parse string to worklist_status enum.
auto to_string(annotation_type type) -> std::string
Convert annotation_type to string.
Worklist item record from the database.
std::string referring_phys_id
Referring Physician ID.
std::string study_uid
Study Instance UID (pre-assigned for the procedure)
std::string procedure_desc
Scheduled Procedure Step Description.
std::string patient_id
Patient ID (required)
std::string birth_date
Patient's Birth Date (YYYYMMDD format)
std::string station_name
Scheduled Station Name.
auto is_scheduled() const noexcept -> bool
Check if this item is available for MWL query.
std::string scheduled_datetime
Scheduled Procedure Step Start Date/Time (YYYYMMDDHHMMSS format)
std::string step_id
Scheduled Procedure Step ID (required)
std::string sex
Patient's Sex (M, F, O)
std::string modality
Modality (CT, MR, etc.) (required)
int64_t pk
Primary key (auto-generated)
std::chrono::system_clock::time_point created_at
Record creation timestamp.
std::string protocol_code
Protocol Code Sequence (JSON serialized)
std::string requested_proc_id
Requested Procedure ID.
std::string patient_name
Patient's Name in DICOM PN format.
std::string accession_no
Accession Number.
std::string step_status
Current status of the procedure step.
std::string station_ae
Scheduled Station AE Title.
auto get_status() const -> std::optional< worklist_status >
Get the status as enum.
std::chrono::system_clock::time_point updated_at
Record last update timestamp.
auto is_valid() const noexcept -> bool
Check if this record has valid data.
std::string referring_phys
Referring Physician's Name.
std::optional< std::string > step_id
Step ID filter (exact match)
std::optional< std::string > modality
Modality filter (exact match)
std::optional< std::string > patient_name
Patient Name filter (supports wildcards with '*')
std::optional< std::string > scheduled_date_from
Scheduled date range begin (inclusive, format: YYYYMMDD)
std::optional< std::string > patient_id
Patient ID filter (supports wildcards with '*')
std::optional< std::string > scheduled_date_to
Scheduled date range end (inclusive, format: YYYYMMDD)
bool include_all_status
Include non-SCHEDULED items (default: false, only SCHEDULED)
size_t offset
Offset for pagination.
std::optional< std::string > accession_no
Accession Number filter (exact match)
auto has_criteria() const noexcept -> bool
Check if any filter criteria is set.
size_t limit
Maximum number of results to return (0 = unlimited)
std::optional< std::string > station_ae
Scheduled Station AE Title filter (exact match)