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 NON INFRINGEMENT. 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 | |||
26 | namespace i3Soft\CDA\RIM\Act; |
||
27 | |||
28 | use i3Soft\CDA\DataType\NullType; |
||
29 | use i3Soft\CDA\Elements\Code; |
||
30 | use i3Soft\CDA\Elements\Value; |
||
31 | use i3Soft\CDA\Interfaces\ClassCodeInterface; |
||
32 | use i3Soft\CDA\Interfaces\MoodCodeInterface; |
||
33 | use i3Soft\CDA\Traits\DerivationExprTrait; |
||
34 | use i3Soft\CDA\Traits\InterpretationCodesTrait; |
||
35 | use i3Soft\CDA\Traits\MethodCodesTrait; |
||
36 | use i3Soft\CDA\Traits\ReferenceRangesTrait; |
||
37 | use i3Soft\CDA\Traits\RepeatNumberTrait; |
||
38 | use i3Soft\CDA\Traits\TargetSiteCodesTrait; |
||
39 | use i3Soft\CDA\Traits\ValuesTrait; |
||
40 | |||
41 | /** |
||
42 | * Class Observation |
||
43 | * |
||
44 | * @package i3Soft\CDA\RIM\Act |
||
45 | */ |
||
46 | class Observation extends Act |
||
47 | { |
||
48 | use TargetSiteCodesTrait; |
||
49 | use ValuesTrait; |
||
50 | use DerivationExprTrait; |
||
51 | use RepeatNumberTrait; |
||
52 | use InterpretationCodesTrait; |
||
53 | use MethodCodesTrait; |
||
54 | use ReferenceRangesTrait; |
||
55 | |||
56 | /** |
||
57 | * Observation constructor. |
||
58 | * |
||
59 | * @param null $code |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
60 | * @param null $value |
||
0 ignored issues
–
show
|
|||
61 | */ |
||
62 | public function __construct ($code = NULL, $value = NULL) |
||
63 | { |
||
64 | parent::__construct(); |
||
65 | $this->setAcceptableClassCodes(array('', ClassCodeInterface::OBSERVATION)) |
||
66 | ->setAcceptableMoodCodes(MoodCodeInterface::x_ActMoodDocumentObservation) |
||
67 | ->setMoodCode('') |
||
68 | ->setClassCode(ClassCodeInterface::OBSERVATION); |
||
69 | if ($code instanceof Code) |
||
70 | { |
||
71 | $this->setCode($code); |
||
72 | } |
||
73 | if ($value instanceof Value) |
||
74 | { |
||
75 | $this->addValue($value); |
||
76 | } |
||
77 | } |
||
78 | |||
79 | |||
80 | /** |
||
81 | * |
||
82 | * @param string $flavour |
||
83 | * |
||
84 | * @return \i3Soft\CDA\RIM\Act\Observation |
||
85 | */ |
||
86 | public static function nullObservation ($flavour = NULL): Observation |
||
87 | { |
||
88 | return (new self()) |
||
89 | ->setCode( |
||
90 | (new Code()) |
||
91 | ->setNullFlavour($flavour ?? NullType::NOT_HERE) |
||
92 | )->setMoodCode(MoodCodeInterface::DEFINITION); |
||
93 | } |
||
94 | |||
95 | public function toDOMElement (\DOMDocument $doc): \DOMElement |
||
96 | { |
||
97 | $el = $this->createElement($doc); |
||
98 | $this->renderIds($el, $doc) |
||
99 | ->renderCode($el, $doc) |
||
100 | ->renderText($el, $doc) |
||
101 | ->renderStatusCode($el, $doc) |
||
102 | ->renderEffectiveTime($el, $doc) |
||
103 | ->renderPriorityCode($el, $doc) |
||
104 | ->renderLanguageCode($el, $doc) |
||
105 | ->renderLanguageCode($el, $doc) |
||
106 | ->renderValues($el, $doc) |
||
107 | ->renderInterpretationCodes($el, $doc) |
||
108 | ->renderMethodCodes($el, $doc) |
||
109 | ->renderTargetSiteCodes($el, $doc) |
||
110 | ->renderSubject($el, $doc) |
||
111 | ->renderSpecimens($el, $doc) |
||
112 | ->renderPerformers($el, $doc) |
||
113 | ->renderAuthors($el, $doc) |
||
114 | ->renderParticipants($el, $doc) |
||
115 | ->renderEntryRelationships($el, $doc) |
||
116 | ->renderReferences($el, $doc) |
||
117 | ->renderPreconditions($el, $doc) |
||
118 | ->renderReferenceRanges($el, $doc); |
||
119 | return $el; |
||
120 | } |
||
121 | |||
122 | |||
123 | /** |
||
124 | * @return string |
||
125 | */ |
||
126 | protected function getElementTag (): string |
||
127 | { |
||
128 | return 'observation'; |
||
129 | } |
||
130 | |||
131 | } |
||
132 |