|
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\Extensions; |
|
37
|
|
|
|
|
38
|
|
|
|
|
39
|
|
|
use i3Soft\CDA\DataType\Code\CodedValue; |
|
40
|
|
|
use i3Soft\CDA\Elements\AbstractElement; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Class JobClassCode |
|
44
|
|
|
* |
|
45
|
|
|
* @package i3Soft\CDA\RIM\Extensions |
|
46
|
|
|
* @link https://hl7.org/fhir/2018Jan/v3/EmployeeJobClass/cs.html |
|
47
|
|
|
*/ |
|
48
|
|
|
class JobClassCode extends AbstractElement |
|
49
|
|
|
{ |
|
50
|
|
|
/** CodedValue */ |
|
51
|
|
|
const CODE_FULL_TIME = 'FT'; |
|
52
|
|
|
const CODE_PART_TIME = 'PT'; |
|
53
|
|
|
const DESC_FULL_TIME = 'full-time'; |
|
54
|
|
|
const DESC_PART_TIME = 'part-time'; |
|
55
|
|
|
const CODE_SYSTEM = '2.16.840.1.113883.5.1059'; |
|
56
|
|
|
const CODE_SYSTEM_DESC = 'HL7:EmployeeJobClass'; |
|
57
|
|
|
protected $coded_value; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* JobClassCode constructor. |
|
61
|
|
|
* |
|
62
|
|
|
* @param string $code |
|
63
|
|
|
*/ |
|
64
|
|
|
public function __construct (string $code) |
|
65
|
|
|
{ |
|
66
|
|
|
switch (strtoupper($code)) |
|
67
|
|
|
{ |
|
68
|
|
|
case self::CODE_FULL_TIME: |
|
69
|
|
|
$this->setCodedValue(new CodedValue( |
|
70
|
|
|
self::CODE_FULL_TIME, |
|
71
|
|
|
self::DESC_FULL_TIME, |
|
72
|
|
|
self::CODE_SYSTEM, |
|
73
|
|
|
self::CODE_SYSTEM_DESC |
|
74
|
|
|
)); |
|
75
|
|
|
break; |
|
76
|
|
|
case self::CODE_PART_TIME: |
|
77
|
|
|
$this->setCodedValue(new CodedValue( |
|
78
|
|
|
self::CODE_PART_TIME, |
|
79
|
|
|
self::DESC_PART_TIME, |
|
80
|
|
|
self::CODE_SYSTEM, |
|
81
|
|
|
self::CODE_SYSTEM_DESC |
|
82
|
|
|
)); |
|
83
|
|
|
break; |
|
84
|
|
|
default: |
|
85
|
|
|
throw new \InvalidArgumentException("The code {$code} is not valid!"); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @return CodedValue |
|
92
|
|
|
*/ |
|
93
|
|
|
public function getCodedValue (): CodedValue |
|
94
|
|
|
{ |
|
95
|
|
|
return $this->coded_value; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @param CodedValue $coded_value |
|
100
|
|
|
* |
|
101
|
|
|
* @return JobClassCode |
|
102
|
|
|
*/ |
|
103
|
|
|
public function setCodedValue (CodedValue $coded_value): self |
|
104
|
|
|
{ |
|
105
|
|
|
$this->coded_value = $coded_value; |
|
106
|
|
|
return $this; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* @param \DOMDocument $doc |
|
111
|
|
|
* |
|
112
|
|
|
* @return \DOMElement |
|
113
|
|
|
*/ |
|
114
|
|
|
public function toDOMElement (\DOMDocument $doc): \DOMElement |
|
115
|
|
|
{ |
|
116
|
|
|
return $this->createElement($doc, ['coded_value']); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* @return string |
|
121
|
|
|
*/ |
|
122
|
|
|
protected function getElementTag (): string |
|
123
|
|
|
{ |
|
124
|
|
|
return 'ext:jobClassCode'; |
|
125
|
|
|
} |
|
126
|
|
|
} |