1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
//! CarePlan
//!
//! URL: http://hl7.org/fhir/StructureDefinition/CarePlan
//!
//! Version: 5.0.0
//!
//! CarePlan Resource: Describes the intention of how one or more practitioners intend to deliver care for a particular patient, group or community for a period of time, possibly limited to care for a specific condition or set of conditions.
//!
//! FHIR: <https://build.fhir.org/>
//!
//! UML: <https://build.fhir.org/uml.html>
// Allow unused crate::r5::types as types;
#![allow(unused_imports)]
use crate::r5::types;
use ::serde::{Deserialize, Serialize};
use fhir_derive_macros::Validate;
/// Describes the intention of how one or more practitioners intend to deliver
/// care for a particular patient, group or community for a period of time,
/// possibly limited to care for a specific condition or set of conditions.
///
/// The CarePlan resource is used across many care settings to coordinate the
/// planned and ongoing activities directed at addressing a patient's health
/// concerns. It links the subject of care to the goals, addressed conditions,
/// care team, and the set of intended or performed activities that make up the
/// plan. A CarePlan may be created by a single practitioner for straightforward
/// needs, or it may be built collaboratively by a multi-disciplinary care team
/// spanning several encounters and organizations, and it can be nested or
/// chained via `part_of` and `replaces` so that plans can be superseded or
/// composed of sub-plans over time. Because it is intentional in nature, a
/// CarePlan records what is planned or has occurred, not the clinical findings
/// themselves, and it is often driven by, or drives, order and workflow
/// resources through its `based_on` and `activity` elements.
///
/// In FHIR R5 it commonly references `Goal`, `CareTeam`, and `Condition`
/// resources to build a comprehensive, longitudinal view of a patient's care.
///
/// # Related resources
///
/// - [`Patient`](crate::r5::resources::patient::Patient) - the typical subject of a care plan.
/// - [`CodeableConcept`](crate::r5::types::CodeableConcept) - used for the plan's category.
/// - `Goal`, `CareTeam`, `Condition`, and `Encounter` - frequently associated resources.
///
/// # Examples
///
/// ```
/// use fhir::r5::resources::care_plan::CarePlan;
///
/// let value = CarePlan::default();
/// let json = ::serde_json::to_value(&value).unwrap();
/// let back: CarePlan = ::serde_json::from_value(json).unwrap();
/// assert_eq!(value, back);
/// ```
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct CarePlan {
/// Logical id of this artifact
pub id: Option<types::String>,
/// Metadata about the resource
pub meta: Option<types::Meta>,
/// A set of rules under which this content was created
pub implicit_rules: Option<types::Uri>,
/// Primitive extension sibling for [`implicit_rules`](Self::implicit_rules) (FHIR `_implicitRules`).
#[serde(rename = "_implicitRules")]
pub implicit_rules_ext: Option<types::Element>,
/// Language of the resource content
pub language: Option<types::Code>,
/// Primitive extension sibling for [`language`](Self::language) (FHIR `_language`).
#[serde(rename = "_language")]
pub language_ext: Option<types::Element>,
/// Text summary of the resource, for human interpretation
pub text: Option<types::Narrative>,
/// Contained, inline Resources
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub contained: Vec<::serde_json::Value>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// External Ids for this plan
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub identifier: Vec<types::Identifier>,
/// Instantiates FHIR protocol or definition
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub instantiates_canonical: Vec<types::Canonical>,
/// Primitive extension sibling for [`instantiates_canonical`](Self::instantiates_canonical) (FHIR `_instantiatesCanonical`).
#[serde(rename = "_instantiatesCanonical")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub instantiates_canonical_ext: Vec<Option<types::Element>>,
/// Instantiates external protocol or definition
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub instantiates_uri: Vec<types::Uri>,
/// Primitive extension sibling for [`instantiates_uri`](Self::instantiates_uri) (FHIR `_instantiatesUri`).
#[serde(rename = "_instantiatesUri")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub instantiates_uri_ext: Vec<Option<types::Element>>,
/// Fulfills plan, proposal or order
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub based_on: Vec<types::Reference>,
/// CarePlan replaced by this CarePlan
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub replaces: Vec<types::Reference>,
/// Part of referenced CarePlan
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub part_of: Vec<types::Reference>,
/// Indicates whether the plan is currently in effect: draft | active | on-hold | revoked | completed | entered-in-error | unknown
pub status: crate::r5::coded::Coded<crate::r5::codes::RequestStatus>,
/// Primitive extension sibling for [`status`](Self::status) (FHIR `_status`).
#[serde(rename = "_status")]
pub status_ext: Option<types::Element>,
/// Indicates the level of authority/intentionality behind the plan: proposal | plan | order | option | directive
pub intent: types::Code,
/// Primitive extension sibling for [`intent`](Self::intent) (FHIR `_intent`).
#[serde(rename = "_intent")]
pub intent_ext: Option<types::Element>,
/// Type of plan, such as a disease-specific or discharge-oriented plan of care
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub category: Vec<types::CodeableConcept>,
/// Human-friendly name for the care plan
pub title: Option<types::String>,
/// Primitive extension sibling for [`title`](Self::title) (FHIR `_title`).
#[serde(rename = "_title")]
pub title_ext: Option<types::Element>,
/// Summary of nature of plan
pub description: Option<types::String>,
/// Primitive extension sibling for [`description`](Self::description) (FHIR `_description`).
#[serde(rename = "_description")]
pub description_ext: Option<types::Element>,
/// Who the care plan is for, typically a reference to a [`Patient`](crate::r5::resources::patient::Patient) or group
pub subject: types::Reference,
/// The Encounter during which this CarePlan was created
pub encounter: Option<types::Reference>,
/// Time period plan covers
pub period: Option<types::Period>,
/// Date record was first recorded
pub created: Option<types::DateTime>,
/// Primitive extension sibling for [`created`](Self::created) (FHIR `_created`).
#[serde(rename = "_created")]
pub created_ext: Option<types::Element>,
/// Who is the designated responsible party
pub custodian: Option<types::Reference>,
/// Who provided the content of the care plan
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub contributor: Vec<types::Reference>,
/// Who's involved in plan?
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub care_team: Vec<types::Reference>,
/// Health issues this plan addresses
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub addresses: Vec<types::CodeableReference>,
/// Information considered as part of plan
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub supporting_info: Vec<types::Reference>,
/// Desired outcome of plan
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub goal: Vec<types::Reference>,
/// The individual planned or performed activities that make up the plan of care
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub activity: Vec<CarePlanActivity>,
/// Comments about the plan
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub note: Vec<types::Annotation>,
}
/// Action to occur or has occurred as part of plan.
///
/// Identifies an action that has occurred or is a planned action to occur as
/// part of the plan. For example, a medication to be used, lab tests to perform,
/// self-monitoring, or education.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct CarePlanActivity {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extension: Vec<types::Extension>,
/// Extensions that cannot be ignored even if unrecognized
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub modifier_extension: Vec<types::Extension>,
/// Results of the activity (concept, or Appointment, Encounter, Procedure, etc.)
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub performed_activity: Vec<types::CodeableReference>,
/// Comments about the activity status/progress
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub progress: Vec<types::Annotation>,
/// Activity that is intended to be part of the care plan
pub planned_activity_reference: Option<types::Reference>,
}
#[cfg(test)]
mod tests {
use super::*;
type T = CarePlan;
#[test]
fn test_default() {
let _ = T::default();
}
#[test]
fn test_serde_round_trip() {
let value = T::default();
let json = ::serde_json::to_value(&value).expect("to_value");
let back: T = ::serde_json::from_value(json).expect("from_value");
assert_eq!(value, back);
}
}