1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* The MIT License |
4
|
|
|
* |
5
|
|
|
* Copyright 2016 julien. |
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\DataType\Identifier; |
26
|
|
|
|
27
|
|
|
use PHPHealth\CDA\DataType\AnyType; |
28
|
|
|
use PHPHealth\CDA\ClinicalDocument as CDA; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* An identifier that uniquely identifies a thing or object. Examples are object |
32
|
|
|
* identifier for HL7 RIM objects, medical record number, order id, service |
33
|
|
|
* catalog item id, Vehicle Identification Number (VIN), etc. Instance |
34
|
|
|
* identifiers are defined based on ISO object identifiers. |
35
|
|
|
* |
36
|
|
|
* @author julien |
37
|
|
|
*/ |
38
|
|
|
class InstanceIdentifier extends AnyType |
39
|
|
|
{ |
40
|
|
|
/** |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
private $root; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* |
48
|
|
|
* @var string |
49
|
|
|
*/ |
50
|
|
|
private $extension; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* |
54
|
|
|
* @var string |
55
|
|
|
*/ |
56
|
|
|
private $assigningAuthorityName; |
57
|
|
|
|
58
|
|
|
public function __construct( |
59
|
|
|
$root, |
60
|
|
|
$extension = null, |
61
|
|
|
$assigningAuthorityName = null |
62
|
|
|
) { |
63
|
|
|
$this->root = $root; |
64
|
|
|
$this->extension = $extension; |
65
|
|
|
$this->assigningAuthorityName = $assigningAuthorityName; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function getRoot() |
69
|
|
|
{ |
70
|
|
|
return $this->root; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function getExtension() |
74
|
|
|
{ |
75
|
|
|
return $this->extension; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getAssigningAuthorityName() |
79
|
|
|
{ |
80
|
|
|
return $this->assigningAuthorityName; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function setRoot($root) |
84
|
|
|
{ |
85
|
|
|
$this->root = $root; |
86
|
|
|
|
87
|
|
|
return $this; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function setExtension($extension) |
91
|
|
|
{ |
92
|
|
|
$this->extension = $extension; |
93
|
|
|
|
94
|
|
|
return $this; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function setAssigningAuthorityName($assigningAuthorityName) |
98
|
|
|
{ |
99
|
|
|
$this->assigningAuthorityName = $assigningAuthorityName; |
100
|
|
|
|
101
|
|
|
return $this; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function hasExtension() |
105
|
|
|
{ |
106
|
|
|
return $this->getExtension() !== null; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function hasAssigningAuthorityName() |
110
|
|
|
{ |
111
|
|
|
return $this->getAssigningAuthorityName() !== null; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function setValueToElement(\DOMElement &$el, \DOMDocument $doc = null) |
115
|
|
|
{ |
116
|
|
|
$el->setAttribute(CDA::NS_CDA."root", $this->getRoot()); |
117
|
|
|
|
118
|
|
|
if ($this->hasExtension()) { |
119
|
|
|
$el->setAttribute(CDA::NS_CDA."extension", $this->getExtension()); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
if ($this->hasAssigningAuthorityName()) { |
123
|
|
|
$el->setAttribute( |
124
|
|
|
CDA::NS_CDA."assigningAuthorityName", |
125
|
|
|
$this->getAssigningAuthorityName() |
126
|
|
|
); |
127
|
|
|
} |
128
|
|
|
} |
129
|
|
|
} |
130
|
|
|
|