some fixes (#2481)
[openemr.git] / phpfhir / HL7 / FHIR / STU3 / src / FHIRResource / FHIRClaim / FHIRClaimDiagnosis.php
blob1c45960de935d5b937d44b71a7970a7b0ad39d78
1 <?php namespace HL7\FHIR\STU3\FHIRResource\FHIRClaim;
3 /*!
4 * This class was generated with the PHPFHIR library (https://github.com/dcarbone/php-fhir) using
5 * class definitions from HL7 FHIR (https://www.hl7.org/fhir/)
6 *
7 * Class creation date: February 10th, 2018
8 */
10 use HL7\FHIR\STU3\FHIRElement\FHIRBackboneElement;
12 /**
13 * A provider issued list of services and products provided, or to be provided, to a patient which is provided to an insurer for payment recovery.
15 class FHIRClaimDiagnosis extends FHIRBackboneElement implements \JsonSerializable
17 /**
18 * Sequence of diagnosis which serves to provide a link.
19 * @var \HL7\FHIR\STU3\FHIRElement\FHIRPositiveInt
21 public $sequence = null;
23 /**
24 * @var \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept
26 public $diagnosisCodeableConcept = null;
28 /**
29 * @var \HL7\FHIR\STU3\FHIRElement\FHIRReference
31 public $diagnosisReference = null;
33 /**
34 * The type of the Diagnosis, for example: admitting, primary, secondary, discharge.
35 * @var \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept[]
37 public $type = [];
39 /**
40 * The package billing code, for example DRG, based on the assigned grouping code system.
41 * @var \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept
43 public $packageCode = null;
45 /**
46 * @var string
48 private $_fhirElementName = 'Claim.Diagnosis';
50 /**
51 * Sequence of diagnosis which serves to provide a link.
52 * @return \HL7\FHIR\STU3\FHIRElement\FHIRPositiveInt
54 public function getSequence()
56 return $this->sequence;
59 /**
60 * Sequence of diagnosis which serves to provide a link.
61 * @param \HL7\FHIR\STU3\FHIRElement\FHIRPositiveInt $sequence
62 * @return $this
64 public function setSequence($sequence)
66 $this->sequence = $sequence;
67 return $this;
70 /**
71 * @return \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept
73 public function getDiagnosisCodeableConcept()
75 return $this->diagnosisCodeableConcept;
78 /**
79 * @param \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept $diagnosisCodeableConcept
80 * @return $this
82 public function setDiagnosisCodeableConcept($diagnosisCodeableConcept)
84 $this->diagnosisCodeableConcept = $diagnosisCodeableConcept;
85 return $this;
88 /**
89 * @return \HL7\FHIR\STU3\FHIRElement\FHIRReference
91 public function getDiagnosisReference()
93 return $this->diagnosisReference;
96 /**
97 * @param \HL7\FHIR\STU3\FHIRElement\FHIRReference $diagnosisReference
98 * @return $this
100 public function setDiagnosisReference($diagnosisReference)
102 $this->diagnosisReference = $diagnosisReference;
103 return $this;
107 * The type of the Diagnosis, for example: admitting, primary, secondary, discharge.
108 * @return \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept[]
110 public function getType()
112 return $this->type;
116 * The type of the Diagnosis, for example: admitting, primary, secondary, discharge.
117 * @param \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept $type
118 * @return $this
120 public function addType($type)
122 $this->type[] = $type;
123 return $this;
127 * The package billing code, for example DRG, based on the assigned grouping code system.
128 * @return \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept
130 public function getPackageCode()
132 return $this->packageCode;
136 * The package billing code, for example DRG, based on the assigned grouping code system.
137 * @param \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept $packageCode
138 * @return $this
140 public function setPackageCode($packageCode)
142 $this->packageCode = $packageCode;
143 return $this;
147 * @return string
149 public function get_fhirElementName()
151 return $this->_fhirElementName;
155 * @param mixed $data
157 public function __construct($data = [])
159 if (is_array($data)) {
160 if (isset($data['sequence'])) {
161 $this->setSequence($data['sequence']);
163 if (isset($data['diagnosisCodeableConcept'])) {
164 $this->setDiagnosisCodeableConcept($data['diagnosisCodeableConcept']);
166 if (isset($data['diagnosisReference'])) {
167 $this->setDiagnosisReference($data['diagnosisReference']);
169 if (isset($data['type'])) {
170 if (is_array($data['type'])) {
171 foreach ($data['type'] as $d) {
172 $this->addType($d);
174 } else {
175 throw new \InvalidArgumentException('"type" must be array of objects or null, '.gettype($data['type']).' seen.');
178 if (isset($data['packageCode'])) {
179 $this->setPackageCode($data['packageCode']);
181 } else if (null !== $data) {
182 throw new \InvalidArgumentException('$data expected to be array of values, saw "'.gettype($data).'"');
184 parent::__construct($data);
188 * @return string
190 public function __toString()
192 return $this->get_fhirElementName();
196 * @return array
198 public function jsonSerialize()
200 $json = parent::jsonSerialize();
201 if (isset($this->sequence)) {
202 $json['sequence'] = $this->sequence;
204 if (isset($this->diagnosisCodeableConcept)) {
205 $json['diagnosisCodeableConcept'] = $this->diagnosisCodeableConcept;
207 if (isset($this->diagnosisReference)) {
208 $json['diagnosisReference'] = $this->diagnosisReference;
210 if (0 < count($this->type)) {
211 $json['type'] = [];
212 foreach ($this->type as $type) {
213 $json['type'][] = $type;
216 if (isset($this->packageCode)) {
217 $json['packageCode'] = $this->packageCode;
219 return $json;
223 * @param boolean $returnSXE
224 * @param \SimpleXMLElement $sxe
225 * @return string|\SimpleXMLElement
227 public function xmlSerialize($returnSXE = false, $sxe = null)
229 if (null === $sxe) {
230 $sxe = new \SimpleXMLElement('<ClaimDiagnosis xmlns="http://hl7.org/fhir"></ClaimDiagnosis>');
232 parent::xmlSerialize(true, $sxe);
233 if (isset($this->sequence)) {
234 $this->sequence->xmlSerialize(true, $sxe->addChild('sequence'));
236 if (isset($this->diagnosisCodeableConcept)) {
237 $this->diagnosisCodeableConcept->xmlSerialize(true, $sxe->addChild('diagnosisCodeableConcept'));
239 if (isset($this->diagnosisReference)) {
240 $this->diagnosisReference->xmlSerialize(true, $sxe->addChild('diagnosisReference'));
242 if (0 < count($this->type)) {
243 foreach ($this->type as $type) {
244 $type->xmlSerialize(true, $sxe->addChild('type'));
247 if (isset($this->packageCode)) {
248 $this->packageCode->xmlSerialize(true, $sxe->addChild('packageCode'));
250 if ($returnSXE) {
251 return $sxe;
253 return $sxe->saveXML();