1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* The MIT License |
5
|
|
|
* |
6
|
|
|
* Copyright 2018 Peter Gee <https://github.com/pgee70>. |
7
|
|
|
* |
8
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
9
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
10
|
|
|
* in the Software without restriction, including without limitation the rights |
11
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
12
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
13
|
|
|
* furnished to do so, subject to the following conditions: |
14
|
|
|
* |
15
|
|
|
* The above copyright notice and this permission notice shall be included in |
16
|
|
|
* all copies or substantial portions of the Software. |
17
|
|
|
* |
18
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE |
21
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
22
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
23
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
24
|
|
|
* THE SOFTWARE. |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* |
29
|
|
|
* @package i3Soft\CDA |
30
|
|
|
* @author Peter Gee <https://github.com/pgee70> |
31
|
|
|
* @link https://github.com/pgee70/cda |
32
|
|
|
* |
33
|
|
|
*/ |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
namespace i3Soft\CDA\RIM\Act; |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
use i3Soft\CDA\Elements\AbstractElement; |
40
|
|
|
use i3Soft\CDA\Elements\Procedure; |
41
|
|
|
use i3Soft\CDA\Interfaces\ContextConductionIndInterface; |
42
|
|
|
use i3Soft\CDA\Interfaces\TypeCodeInterface; |
43
|
|
|
use i3Soft\CDA\Traits\ActTrait; |
44
|
|
|
use i3Soft\CDA\Traits\ContextConductionIndTrait; |
45
|
|
|
use i3Soft\CDA\Traits\EncounterTrait; |
46
|
|
|
use i3Soft\CDA\Traits\ObservationMediaTrait; |
47
|
|
|
use i3Soft\CDA\Traits\ObservationTrait; |
48
|
|
|
use i3Soft\CDA\Traits\OrganizerTrait; |
49
|
|
|
use i3Soft\CDA\Traits\ProcedureTrait; |
50
|
|
|
use i3Soft\CDA\Traits\RegionOfInterestTrait; |
51
|
|
|
use i3Soft\CDA\Traits\SeperatableIndTrait; |
52
|
|
|
use i3Soft\CDA\Traits\SequenceNumberTrait; |
53
|
|
|
use i3Soft\CDA\Traits\SubstanceAdministrationTrait; |
54
|
|
|
use i3Soft\CDA\Traits\SupplyTrait; |
55
|
|
|
use i3Soft\CDA\Traits\TypeCodeTrait; |
56
|
|
|
|
57
|
|
|
class OrganizerComponent extends AbstractElement implements TypeCodeInterface, ContextConductionIndInterface |
58
|
|
|
{ |
59
|
|
|
use TypeCodeTrait; |
60
|
|
|
use ActTrait; |
61
|
|
|
use SequenceNumberTrait; |
62
|
|
|
use SeperatableIndTrait; |
63
|
|
|
use EncounterTrait; |
64
|
|
|
use ObservationTrait; |
65
|
|
|
use ObservationMediaTrait; |
66
|
|
|
use OrganizerTrait; |
67
|
|
|
use ProcedureTrait; |
68
|
|
|
use RegionOfInterestTrait; |
69
|
|
|
use SubstanceAdministrationTrait; |
70
|
|
|
use SupplyTrait; |
71
|
|
|
use ContextConductionIndTrait; |
72
|
|
|
|
73
|
|
|
public function __construct($choice = null) |
74
|
|
|
{ |
75
|
|
|
$this->setAcceptableTypeCodes(TypeCodeInterface::ActRelationshipHasComponent) |
76
|
|
|
->setTypeCode(''); |
77
|
|
|
if ($choice instanceOf Act) { |
78
|
|
|
$this->setAct($choice); |
79
|
|
|
} elseif ($choice instanceOf Encounter) { |
80
|
|
|
$this->setEncounter($choice); |
81
|
|
|
} elseif ($choice instanceOf Observation) { |
82
|
|
|
$this->setObservation($choice); |
83
|
|
|
} elseif ($choice instanceOf ObservationMedia) { |
84
|
|
|
$this->setObservationMedia($choice); |
85
|
|
|
} elseif ($choice instanceOf Organizer) { |
86
|
|
|
$this->setOrganizer($choice); |
87
|
|
|
} elseif ($choice instanceOf Procedure) { |
88
|
|
|
$this->setProcedure($choice); |
89
|
|
|
} elseif ($choice instanceOf SubstanceAdministration) { |
90
|
|
|
$this->setSubstanceAdministration($choice); |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @inheritDoc |
96
|
|
|
*/ |
97
|
|
|
public function toDOMElement(\DOMDocument $doc): \DOMElement |
98
|
|
|
{ |
99
|
|
|
$el = $this->createElement($doc); |
100
|
|
|
if ($this->hasSequenceNumber()) { |
101
|
|
|
$el->appendChild($this->getSequenceNumber()->toDOMElement($doc)); |
102
|
|
|
} |
103
|
|
|
if ($this->hasSeperatableInd()) { |
104
|
|
|
$el->appendChild($this->getSeperatableInd()->toDOMElement($doc)); |
105
|
|
|
} |
106
|
|
|
if ($this->hasAct()) { |
107
|
|
|
$el->appendChild($this->getAct()->toDOMElement($doc)); |
108
|
|
|
} elseif ($this->hasEncounter()) { |
109
|
|
|
$el->appendChild($this->getEncounter()->toDOMElement($doc)); |
110
|
|
|
} elseif ($this->hasObservation()) { |
111
|
|
|
$el->appendChild($this->getObservation()->toDOMElement($doc)); |
112
|
|
|
} elseif ($this->hasObservationMedia()) { |
113
|
|
|
$el->appendChild($this->getObservationMedia()->toDOMElement($doc)); |
114
|
|
|
} elseif ($this->hasOrganizer()) { |
115
|
|
|
$el->appendChild($this->getOrganizer()->toDOMElement($doc)); |
116
|
|
|
} elseif ($this->hasProcedure()) { |
117
|
|
|
$el->appendChild($this->getProcedure()->toDOMElement($doc)); |
118
|
|
|
} elseif ($this->hasRegionOfInterest()) { |
119
|
|
|
$el->appendChild($this->getRegionOfInterest()->toDOMElement($doc)); |
120
|
|
|
} elseif ($this->hasSubstanceAdministration()) { |
121
|
|
|
$el->appendChild($this->getSubstanceAdministration()->toDOMElement($doc)); |
122
|
|
|
} elseif ($this->hasSupply()) { |
123
|
|
|
$el->appendChild($this->getSupply()->toDOMElement($doc)); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
return $el; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @inheritDoc |
132
|
|
|
*/ |
133
|
|
|
protected function getElementTag(): string |
134
|
|
|
{ |
135
|
|
|
return 'component'; |
136
|
|
|
} |
137
|
|
|
} |