|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* The MIT License |
|
4
|
|
|
* |
|
5
|
|
|
* Copyright 2017 Julien Fastré <[email protected]>. |
|
6
|
|
|
* |
|
7
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
8
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
|
9
|
|
|
* in the Software without restriction, including without limitation the rights |
|
10
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
11
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
|
12
|
|
|
* furnished to do so, subject to the following conditions: |
|
13
|
|
|
* |
|
14
|
|
|
* The above copyright notice and this permission notice shall be included in |
|
15
|
|
|
* all copies or substantial portions of the Software. |
|
16
|
|
|
* |
|
17
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
18
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
19
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
20
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
21
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
22
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
23
|
|
|
* THE SOFTWARE. |
|
24
|
|
|
*/ |
|
25
|
|
|
namespace PHPHealth\CDA\RIM\Act; |
|
26
|
|
|
|
|
27
|
|
|
use PHPHealth\CDA\Elements\AbstractElement; |
|
28
|
|
|
use PHPHealth\CDA\HasClassCode; |
|
29
|
|
|
use PHPHealth\CDA\HasMoodCodeInterface; |
|
30
|
|
|
use PHPHealth\CDA\DataType\Collection\Set; |
|
31
|
|
|
use PHPHealth\CDA\DataType\Code\CodedWithEquivalents; |
|
32
|
|
|
use PHPHealth\CDA\DataType\Boolean\Boolean; |
|
33
|
|
|
use PHPHealth\CDA\DataType\TextAndMultimedia\EncapsuledData; |
|
34
|
|
|
use PHPHealth\CDA\DataType\Code\StatusCode; |
|
35
|
|
|
use PHPHealth\CDA\DataType\Identifier\InstanceIdentifier; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* A record of something that is being done, has been done, can be done, |
|
39
|
|
|
* or is intended or requested to be done. |
|
40
|
|
|
* |
|
41
|
|
|
* @author Julien Fastré <[email protected]> |
|
42
|
|
|
*/ |
|
43
|
|
|
class Act extends AbstractElement implements HasClassCode, HasMoodCodeInterface |
|
44
|
|
|
{ |
|
45
|
|
|
/** |
|
46
|
|
|
* A unique identifier for the Act. |
|
47
|
|
|
* |
|
48
|
|
|
* @var Set |
|
49
|
|
|
*/ |
|
50
|
|
|
protected $ids; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* |
|
54
|
|
|
* @var type |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $code; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* |
|
60
|
|
|
* @var Boolean |
|
61
|
|
|
*/ |
|
62
|
|
|
protected $negationInd; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* |
|
66
|
|
|
* @var EncapsuledData |
|
67
|
|
|
*/ |
|
68
|
|
|
protected $text; |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* |
|
72
|
|
|
* @var StatusCode |
|
73
|
|
|
*/ |
|
74
|
|
|
protected $statusCode; |
|
75
|
|
|
|
|
76
|
|
|
protected $effectiveTime; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* |
|
80
|
|
|
* @var array |
|
81
|
|
|
*/ |
|
82
|
|
|
protected $templateIds; |
|
83
|
|
|
|
|
84
|
|
|
protected $moodCode = 'EVN'; |
|
85
|
|
|
|
|
86
|
|
|
|
|
87
|
|
|
public function getIds(): Set |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->ids; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
public function getCode(): type |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->code; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
public function getNegationInd(): Boolean |
|
98
|
|
|
{ |
|
99
|
|
|
return $this->negationInd; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
public function getText(): EncapsuledData |
|
103
|
|
|
{ |
|
104
|
|
|
return $this->text; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
public function getStatusCode(): StatusCode |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->statusCode; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
public function getEffectiveTime() |
|
113
|
|
|
{ |
|
114
|
|
|
return $this->effectiveTime; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
public function getTemplateIds() |
|
118
|
|
|
{ |
|
119
|
|
|
return $this->templateIds; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
|
|
123
|
|
|
public function setIds(Set $ids) |
|
124
|
|
|
{ |
|
125
|
|
|
$this->ids = $ids; |
|
126
|
|
|
return $this; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
public function setCode(type $code) |
|
130
|
|
|
{ |
|
131
|
|
|
$this->code = $code; |
|
132
|
|
|
return $this; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
public function setNegationInd(Boolean $negationInd) |
|
136
|
|
|
{ |
|
137
|
|
|
$this->negationInd = $negationInd; |
|
138
|
|
|
return $this; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
public function setText(EncapsuledData $text) |
|
142
|
|
|
{ |
|
143
|
|
|
$this->text = $text; |
|
144
|
|
|
return $this; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
public function setStatusCode(StatusCode $statusCode) |
|
148
|
|
|
{ |
|
149
|
|
|
$this->statusCode = $statusCode; |
|
150
|
|
|
return $this; |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
public function setEffectiveTime($effectiveTime) |
|
154
|
|
|
{ |
|
155
|
|
|
$this->effectiveTime = $effectiveTime; |
|
156
|
|
|
return $this; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* |
|
161
|
|
|
* @param InstanceIdentifier[] $templateIds |
|
162
|
|
|
* @return $this |
|
163
|
|
|
*/ |
|
164
|
|
|
public function setTemplateIds(array $templateIds) |
|
165
|
|
|
{ |
|
166
|
|
|
// check that each element is an instance of InstanceIdentifier |
|
167
|
|
|
$result = \array_reduce($templateIds, function ($carry, $current) { |
|
168
|
|
|
if ($carry === false) { |
|
169
|
|
|
return false; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
return $current instanceof InstanceIdentifier; |
|
173
|
|
|
}); |
|
174
|
|
|
|
|
175
|
|
|
if ($result === false) { |
|
176
|
|
|
throw new \RuntimeException(sprintf("the templateIds must be " |
|
177
|
|
|
. "instance of %s", InstanceIdentifier::class)); |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
$this->templateIds = $templateIds; |
|
181
|
|
|
|
|
182
|
|
|
|
|
183
|
|
|
return $this; |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
public function addTemplateId(InstanceIdentifier $id) |
|
187
|
|
|
{ |
|
188
|
|
|
$this->templateIds[] = $id; |
|
189
|
|
|
|
|
190
|
|
|
return $this; |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
|
public function getClassCode(): string |
|
194
|
|
|
{ |
|
195
|
|
|
return 'ACT'; |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
public function getMoodCode() |
|
199
|
|
|
{ |
|
200
|
|
|
return $this->moodCode; |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
protected function getElementTag(): string |
|
204
|
|
|
{ |
|
205
|
|
|
return 'act'; |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
public function toDOMElement(\DOMDocument $doc): \DOMElement |
|
209
|
|
|
{ |
|
210
|
|
|
|
|
211
|
|
|
} |
|
212
|
|
|
|
|
213
|
|
|
} |
|
214
|
|
|
|