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\DataType\Code\CodedWithEquivalents; |
28
|
|
|
use PHPHealth\CDA\DataType\Collection\Set; |
29
|
|
|
use PHPHealth\CDA\DataType\Collection\Interval; |
30
|
|
|
use PHPHealth\CDA\DataType\Quantity\PhysicalQuantity\PhysicalQuantity; |
31
|
|
|
use PHPHealth\CDA\Elements\TemplateId; |
32
|
|
|
use PHPHealth\CDA\Elements\Text; |
33
|
|
|
use PHPHealth\CDA\Elements\EffectiveTime; |
34
|
|
|
use PHPHealth\CDA\Elements\RouteCode; |
35
|
|
|
use PHPHealth\CDA\RIM\Participation\Consumable; |
36
|
|
|
use PHPHealth\CDA\Elements\DoseQuantity; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* |
40
|
|
|
* |
41
|
|
|
* @author Julien Fastré <[email protected]> |
42
|
|
|
*/ |
43
|
|
|
class SubstanceAdministration extends Act |
44
|
|
|
{ |
45
|
|
|
/** |
46
|
|
|
* |
47
|
|
|
* @var CodedWithEquivalents |
48
|
|
|
*/ |
49
|
|
|
private $routeCode; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* |
53
|
|
|
* @var Set|CodedWithEquivalents |
54
|
|
|
*/ |
55
|
|
|
private $approachSiteCode; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* |
59
|
|
|
* @var Interval|PhysicalQuantity |
60
|
|
|
*/ |
61
|
|
|
private $doseQuantity; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* |
65
|
|
|
* @var Interval|PhysicalQuantity |
66
|
|
|
*/ |
67
|
|
|
private $rateQuantity; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* |
71
|
|
|
* @var Consumable |
72
|
|
|
*/ |
73
|
|
|
private $consumable; |
74
|
|
|
|
75
|
|
|
private $frequencyOfAdministration; |
76
|
|
|
|
77
|
|
|
|
78
|
|
|
public function getClassCode(): string |
79
|
|
|
{ |
80
|
|
|
return 'SBADM'; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
protected function getElementTag(): string |
84
|
|
|
{ |
85
|
|
|
return 'substanceAdministration'; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* |
90
|
|
|
* @return CodedWithEquivalents |
91
|
|
|
*/ |
92
|
|
|
public function getRouteCode(): CodedWithEquivalents |
93
|
|
|
{ |
94
|
|
|
return $this->routeCode; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* |
99
|
|
|
* @return Set|CodedWithEquivalents |
100
|
|
|
*/ |
101
|
|
|
public function getApproachSiteCode() |
102
|
|
|
{ |
103
|
|
|
return $this->approachSiteCode; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* |
108
|
|
|
* @return Interval|PhysicalQuantity |
109
|
|
|
*/ |
110
|
|
|
public function getDoseQuantity() |
111
|
|
|
{ |
112
|
|
|
return $this->doseQuantity; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* |
117
|
|
|
* @return Interval|PhysicalQuantity |
118
|
|
|
*/ |
119
|
|
|
public function getRateQuantity() |
120
|
|
|
{ |
121
|
|
|
return $this->rateQuantity; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function getTimeOfAdministration() |
125
|
|
|
{ |
126
|
|
|
return parent::getEffectiveTime(); |
|
|
|
|
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
public function getFrequencyOfAdministration() |
130
|
|
|
{ |
131
|
|
|
return $this->frequencyOfAdministration; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* |
136
|
|
|
* @return Consumable |
137
|
|
|
*/ |
138
|
|
|
public function getConsumable() |
139
|
|
|
{ |
140
|
|
|
return $this->consumable; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* |
145
|
|
|
* @param CodedWithEquivalents $routeCode |
146
|
|
|
* @return $this |
147
|
|
|
*/ |
148
|
|
|
public function setRouteCode(CodedWithEquivalents $routeCode) |
149
|
|
|
{ |
150
|
|
|
$this->routeCode = $routeCode; |
151
|
|
|
return $this; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* |
156
|
|
|
* @param Set|CodedWithEquivalents $approachSiteCode |
157
|
|
|
* @return $this |
158
|
|
|
*/ |
159
|
|
|
public function setApproachSiteCode($approachSiteCode) |
160
|
|
|
{ |
161
|
|
|
$this->approachSiteCode = $approachSiteCode; |
162
|
|
|
return $this; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* |
167
|
|
|
* @param Interval|PhysicalQuantity $doseQuantity |
168
|
|
|
* @return $this |
169
|
|
|
*/ |
170
|
|
|
public function setDoseQuantity($doseQuantity) |
171
|
|
|
{ |
172
|
|
|
$this->doseQuantity = $doseQuantity; |
173
|
|
|
return $this; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* |
178
|
|
|
* @param Interval|PhysicalQuantity $rateQuantity |
179
|
|
|
* @return $this |
180
|
|
|
*/ |
181
|
|
|
public function setRateQuantity($rateQuantity) |
182
|
|
|
{ |
183
|
|
|
$this->rateQuantity = $rateQuantity; |
184
|
|
|
return $this; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
public function setTimeOfAdministration($time) |
|
|
|
|
188
|
|
|
{ |
189
|
|
|
return parent::setEffectiveTime($effectiveTime); |
|
|
|
|
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
public function setFrequencyOfAdministration($frequency) |
193
|
|
|
{ |
194
|
|
|
$this->frequencyOfAdministration = $frequency; |
195
|
|
|
|
196
|
|
|
return $this; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* |
201
|
|
|
* @param Consumable $consumable |
202
|
|
|
* @return $this |
203
|
|
|
*/ |
204
|
|
|
function setConsumable(Consumable $consumable) |
|
|
|
|
205
|
|
|
{ |
206
|
|
|
$this->consumable = $consumable; |
207
|
|
|
return $this; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
public function toDOMElement(\DOMDocument $doc): \DOMElement |
211
|
|
|
{ |
212
|
|
|
$el = $this->createElement($doc); |
213
|
|
|
|
214
|
|
|
if ($this->getTemplateIds() !== null) { |
215
|
|
|
foreach ($this->templateIds as $id) { |
216
|
|
|
$el->appendChild((new TemplateId($id))->toDOMElement($doc)); |
217
|
|
|
} |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
if ($this->getText() !== null) { |
221
|
|
|
$el->appendChild((new Text($this->getText()))->toDOMElement($doc)); |
|
|
|
|
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
if ($this->getTimeOfAdministration() !== null) { |
225
|
|
|
$el->appendChild((new EffectiveTime($this->getTimeOfAdministration())) |
226
|
|
|
->toDOMElement($doc)); |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
if ($this->getFrequencyOfAdministration() !== null) { |
230
|
|
|
$effectiveTime = new EffectiveTime($this->getFrequencyOfAdministration()); |
231
|
|
|
|
232
|
|
|
if ($this->getTimeOfAdministration() !== null) { |
233
|
|
|
$effectiveTime->setOperatorAppend(); |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
$el->appendChild($effectiveTime->toDOMElement($doc)); |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
if ($this->getRouteCode() !== null) { |
240
|
|
|
$el->appendChild((new RouteCode($this->getRouteCode())) |
241
|
|
|
->toDOMElement($doc)); |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
if ($this->getDoseQuantity() !== null) { |
245
|
|
|
$el->appendChild((new DoseQuantity($this->getDoseQuantity())) |
246
|
|
|
->toDOMElement($doc)); |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
if ($this->getConsumable() !== null) { |
250
|
|
|
$el->appendChild($this->getConsumable()->toDOMElement($doc)); |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
return $el; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
} |
257
|
|
|
|
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.