Phase 1 FHIR on PHP- Provider Client and implement classes. (#1422)
[openemr.git] / phpfhir / HL7 / FHIR / STU3 / src / FHIRDomainResource / FHIREncounter.php
blob174b18425ade96079b4af1720ce1c7814cea2ce8
1 <?php namespace HL7\FHIR\STU3\FHIRDomainResource;
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\FHIRResource\FHIRDomainResource;
12 /**
13 * An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.
14 * If the element is present, it must have either a @value, an @id, or extensions
16 class FHIREncounter extends FHIRDomainResource implements \JsonSerializable
18 /**
19 * Identifier(s) by which this encounter is known.
20 * @var \HL7\FHIR\STU3\FHIRElement\FHIRIdentifier[]
22 public $identifier = [];
24 /**
25 * planned | arrived | triaged | in-progress | onleave | finished | cancelled +.
26 * @var \HL7\FHIR\STU3\FHIRElement\FHIREncounterStatus
28 public $status = null;
30 /**
31 * The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them.
32 * @var \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterStatusHistory[]
34 public $statusHistory = [];
36 /**
37 * inpatient | outpatient | ambulatory | emergency +.
38 * @var \HL7\FHIR\STU3\FHIRElement\FHIRCoding
40 public $class = null;
42 /**
43 * The class history permits the tracking of the encounters transitions without needing to go through the resource history.
45 This would be used for a case where an admission starts of as an emergency encounter, then transisions into an inpatient scenario. Doing this and not restarting a new encounter ensures that any lab/diagnostic results can more easily follow the patient and not require re-processing and not get lost or cancelled during a kindof discharge from emergency to inpatient.
46 * @var \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterClassHistory[]
48 public $classHistory = [];
50 /**
51 * Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation).
52 * @var \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept[]
54 public $type = [];
56 /**
57 * Indicates the urgency of the encounter.
58 * @var \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept
60 public $priority = null;
62 /**
63 * The patient ro group present at the encounter.
64 * @var \HL7\FHIR\STU3\FHIRElement\FHIRReference
66 public $subject = null;
68 /**
69 * Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem. The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years).
70 * @var \HL7\FHIR\STU3\FHIRElement\FHIRReference[]
72 public $episodeOfCare = [];
74 /**
75 * The referral request this encounter satisfies (incoming referral).
76 * @var \HL7\FHIR\STU3\FHIRElement\FHIRReference[]
78 public $incomingReferral = [];
80 /**
81 * The list of people responsible for providing the service.
82 * @var \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterParticipant[]
84 public $participant = [];
86 /**
87 * The appointment that scheduled this encounter.
88 * @var \HL7\FHIR\STU3\FHIRElement\FHIRReference
90 public $appointment = null;
92 /**
93 * The start and end time of the encounter.
94 * @var \HL7\FHIR\STU3\FHIRElement\FHIRPeriod
96 public $period = null;
98 /**
99 * Quantity of time the encounter lasted. This excludes the time during leaves of absence.
100 * @var \HL7\FHIR\STU3\FHIRElement\FHIRQuantity\FHIRDuration
102 public $length = null;
105 * Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis.
106 * @var \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept[]
108 public $reason = [];
111 * The list of diagnosis relevant to this encounter.
112 * @var \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterDiagnosis[]
114 public $diagnosis = [];
117 * The set of accounts that may be used for billing for this Encounter.
118 * @var \HL7\FHIR\STU3\FHIRElement\FHIRReference[]
120 public $account = [];
123 * Details about the admission to a healthcare service.
124 * @var \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterHospitalization
126 public $hospitalization = null;
129 * List of locations where the patient has been during this encounter.
130 * @var \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterLocation[]
132 public $location = [];
135 * An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.
136 * @var \HL7\FHIR\STU3\FHIRElement\FHIRReference
138 public $serviceProvider = null;
141 * Another Encounter of which this encounter is a part of (administratively or in time).
142 * @var \HL7\FHIR\STU3\FHIRElement\FHIRReference
144 public $partOf = null;
147 * @var string
149 private $_fhirElementName = 'Encounter';
152 * Identifier(s) by which this encounter is known.
153 * @return \HL7\FHIR\STU3\FHIRElement\FHIRIdentifier[]
155 public function getIdentifier()
157 return $this->identifier;
161 * Identifier(s) by which this encounter is known.
162 * @param \HL7\FHIR\STU3\FHIRElement\FHIRIdentifier $identifier
163 * @return $this
165 public function addIdentifier($identifier)
167 $this->identifier[] = $identifier;
168 return $this;
172 * planned | arrived | triaged | in-progress | onleave | finished | cancelled +.
173 * @return \HL7\FHIR\STU3\FHIRElement\FHIREncounterStatus
175 public function getStatus()
177 return $this->status;
181 * planned | arrived | triaged | in-progress | onleave | finished | cancelled +.
182 * @param \HL7\FHIR\STU3\FHIRElement\FHIREncounterStatus $status
183 * @return $this
185 public function setStatus($status)
187 $this->status = $status;
188 return $this;
192 * The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them.
193 * @return \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterStatusHistory[]
195 public function getStatusHistory()
197 return $this->statusHistory;
201 * The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them.
202 * @param \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterStatusHistory $statusHistory
203 * @return $this
205 public function addStatusHistory($statusHistory)
207 $this->statusHistory[] = $statusHistory;
208 return $this;
212 * inpatient | outpatient | ambulatory | emergency +.
213 * @return \HL7\FHIR\STU3\FHIRElement\FHIRCoding
215 public function getClass()
217 return $this->class;
221 * inpatient | outpatient | ambulatory | emergency +.
222 * @param \HL7\FHIR\STU3\FHIRElement\FHIRCoding $class
223 * @return $this
225 public function setClass($class)
227 $this->class = $class;
228 return $this;
232 * The class history permits the tracking of the encounters transitions without needing to go through the resource history.
234 This would be used for a case where an admission starts of as an emergency encounter, then transisions into an inpatient scenario. Doing this and not restarting a new encounter ensures that any lab/diagnostic results can more easily follow the patient and not require re-processing and not get lost or cancelled during a kindof discharge from emergency to inpatient.
235 * @return \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterClassHistory[]
237 public function getClassHistory()
239 return $this->classHistory;
243 * The class history permits the tracking of the encounters transitions without needing to go through the resource history.
245 This would be used for a case where an admission starts of as an emergency encounter, then transisions into an inpatient scenario. Doing this and not restarting a new encounter ensures that any lab/diagnostic results can more easily follow the patient and not require re-processing and not get lost or cancelled during a kindof discharge from emergency to inpatient.
246 * @param \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterClassHistory $classHistory
247 * @return $this
249 public function addClassHistory($classHistory)
251 $this->classHistory[] = $classHistory;
252 return $this;
256 * Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation).
257 * @return \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept[]
259 public function getType()
261 return $this->type;
265 * Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation).
266 * @param \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept $type
267 * @return $this
269 public function addType($type)
271 $this->type[] = $type;
272 return $this;
276 * Indicates the urgency of the encounter.
277 * @return \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept
279 public function getPriority()
281 return $this->priority;
285 * Indicates the urgency of the encounter.
286 * @param \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept $priority
287 * @return $this
289 public function setPriority($priority)
291 $this->priority = $priority;
292 return $this;
296 * The patient ro group present at the encounter.
297 * @return \HL7\FHIR\STU3\FHIRElement\FHIRReference
299 public function getSubject()
301 return $this->subject;
305 * The patient ro group present at the encounter.
306 * @param \HL7\FHIR\STU3\FHIRElement\FHIRReference $subject
307 * @return $this
309 public function setSubject($subject)
311 $this->subject = $subject;
312 return $this;
316 * Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem. The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years).
317 * @return \HL7\FHIR\STU3\FHIRElement\FHIRReference[]
319 public function getEpisodeOfCare()
321 return $this->episodeOfCare;
325 * Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem. The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years).
326 * @param \HL7\FHIR\STU3\FHIRElement\FHIRReference $episodeOfCare
327 * @return $this
329 public function addEpisodeOfCare($episodeOfCare)
331 $this->episodeOfCare[] = $episodeOfCare;
332 return $this;
336 * The referral request this encounter satisfies (incoming referral).
337 * @return \HL7\FHIR\STU3\FHIRElement\FHIRReference[]
339 public function getIncomingReferral()
341 return $this->incomingReferral;
345 * The referral request this encounter satisfies (incoming referral).
346 * @param \HL7\FHIR\STU3\FHIRElement\FHIRReference $incomingReferral
347 * @return $this
349 public function addIncomingReferral($incomingReferral)
351 $this->incomingReferral[] = $incomingReferral;
352 return $this;
356 * The list of people responsible for providing the service.
357 * @return \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterParticipant[]
359 public function getParticipant()
361 return $this->participant;
365 * The list of people responsible for providing the service.
366 * @param \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterParticipant $participant
367 * @return $this
369 public function addParticipant($participant)
371 $this->participant[] = $participant;
372 return $this;
376 * The appointment that scheduled this encounter.
377 * @return \HL7\FHIR\STU3\FHIRElement\FHIRReference
379 public function getAppointment()
381 return $this->appointment;
385 * The appointment that scheduled this encounter.
386 * @param \HL7\FHIR\STU3\FHIRElement\FHIRReference $appointment
387 * @return $this
389 public function setAppointment($appointment)
391 $this->appointment = $appointment;
392 return $this;
396 * The start and end time of the encounter.
397 * @return \HL7\FHIR\STU3\FHIRElement\FHIRPeriod
399 public function getPeriod()
401 return $this->period;
405 * The start and end time of the encounter.
406 * @param \HL7\FHIR\STU3\FHIRElement\FHIRPeriod $period
407 * @return $this
409 public function setPeriod($period)
411 $this->period = $period;
412 return $this;
416 * Quantity of time the encounter lasted. This excludes the time during leaves of absence.
417 * @return \HL7\FHIR\STU3\FHIRElement\FHIRQuantity\FHIRDuration
419 public function getLength()
421 return $this->length;
425 * Quantity of time the encounter lasted. This excludes the time during leaves of absence.
426 * @param \HL7\FHIR\STU3\FHIRElement\FHIRQuantity\FHIRDuration $length
427 * @return $this
429 public function setLength($length)
431 $this->length = $length;
432 return $this;
436 * Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis.
437 * @return \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept[]
439 public function getReason()
441 return $this->reason;
445 * Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis.
446 * @param \HL7\FHIR\STU3\FHIRElement\FHIRCodeableConcept $reason
447 * @return $this
449 public function addReason($reason)
451 $this->reason[] = $reason;
452 return $this;
456 * The list of diagnosis relevant to this encounter.
457 * @return \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterDiagnosis[]
459 public function getDiagnosis()
461 return $this->diagnosis;
465 * The list of diagnosis relevant to this encounter.
466 * @param \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterDiagnosis $diagnosis
467 * @return $this
469 public function addDiagnosis($diagnosis)
471 $this->diagnosis[] = $diagnosis;
472 return $this;
476 * The set of accounts that may be used for billing for this Encounter.
477 * @return \HL7\FHIR\STU3\FHIRElement\FHIRReference[]
479 public function getAccount()
481 return $this->account;
485 * The set of accounts that may be used for billing for this Encounter.
486 * @param \HL7\FHIR\STU3\FHIRElement\FHIRReference $account
487 * @return $this
489 public function addAccount($account)
491 $this->account[] = $account;
492 return $this;
496 * Details about the admission to a healthcare service.
497 * @return \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterHospitalization
499 public function getHospitalization()
501 return $this->hospitalization;
505 * Details about the admission to a healthcare service.
506 * @param \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterHospitalization $hospitalization
507 * @return $this
509 public function setHospitalization($hospitalization)
511 $this->hospitalization = $hospitalization;
512 return $this;
516 * List of locations where the patient has been during this encounter.
517 * @return \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterLocation[]
519 public function getLocation()
521 return $this->location;
525 * List of locations where the patient has been during this encounter.
526 * @param \HL7\FHIR\STU3\FHIRResource\FHIREncounter\FHIREncounterLocation $location
527 * @return $this
529 public function addLocation($location)
531 $this->location[] = $location;
532 return $this;
536 * An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.
537 * @return \HL7\FHIR\STU3\FHIRElement\FHIRReference
539 public function getServiceProvider()
541 return $this->serviceProvider;
545 * An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.
546 * @param \HL7\FHIR\STU3\FHIRElement\FHIRReference $serviceProvider
547 * @return $this
549 public function setServiceProvider($serviceProvider)
551 $this->serviceProvider = $serviceProvider;
552 return $this;
556 * Another Encounter of which this encounter is a part of (administratively or in time).
557 * @return \HL7\FHIR\STU3\FHIRElement\FHIRReference
559 public function getPartOf()
561 return $this->partOf;
565 * Another Encounter of which this encounter is a part of (administratively or in time).
566 * @param \HL7\FHIR\STU3\FHIRElement\FHIRReference $partOf
567 * @return $this
569 public function setPartOf($partOf)
571 $this->partOf = $partOf;
572 return $this;
576 * @return string
578 public function get_fhirElementName()
580 return $this->_fhirElementName;
584 * @param mixed $data
586 public function __construct($data = [])
588 if (is_array($data)) {
589 if (isset($data['identifier'])) {
590 if (is_array($data['identifier'])) {
591 foreach ($data['identifier'] as $d) {
592 $this->addIdentifier($d);
594 } else {
595 throw new \InvalidArgumentException('"identifier" must be array of objects or null, '.gettype($data['identifier']).' seen.');
598 if (isset($data['status'])) {
599 $this->setStatus($data['status']);
601 if (isset($data['statusHistory'])) {
602 if (is_array($data['statusHistory'])) {
603 foreach ($data['statusHistory'] as $d) {
604 $this->addStatusHistory($d);
606 } else {
607 throw new \InvalidArgumentException('"statusHistory" must be array of objects or null, '.gettype($data['statusHistory']).' seen.');
610 if (isset($data['class'])) {
611 $this->setClass($data['class']);
613 if (isset($data['classHistory'])) {
614 if (is_array($data['classHistory'])) {
615 foreach ($data['classHistory'] as $d) {
616 $this->addClassHistory($d);
618 } else {
619 throw new \InvalidArgumentException('"classHistory" must be array of objects or null, '.gettype($data['classHistory']).' seen.');
622 if (isset($data['type'])) {
623 if (is_array($data['type'])) {
624 foreach ($data['type'] as $d) {
625 $this->addType($d);
627 } else {
628 throw new \InvalidArgumentException('"type" must be array of objects or null, '.gettype($data['type']).' seen.');
631 if (isset($data['priority'])) {
632 $this->setPriority($data['priority']);
634 if (isset($data['subject'])) {
635 $this->setSubject($data['subject']);
637 if (isset($data['episodeOfCare'])) {
638 if (is_array($data['episodeOfCare'])) {
639 foreach ($data['episodeOfCare'] as $d) {
640 $this->addEpisodeOfCare($d);
642 } else {
643 throw new \InvalidArgumentException('"episodeOfCare" must be array of objects or null, '.gettype($data['episodeOfCare']).' seen.');
646 if (isset($data['incomingReferral'])) {
647 if (is_array($data['incomingReferral'])) {
648 foreach ($data['incomingReferral'] as $d) {
649 $this->addIncomingReferral($d);
651 } else {
652 throw new \InvalidArgumentException('"incomingReferral" must be array of objects or null, '.gettype($data['incomingReferral']).' seen.');
655 if (isset($data['participant'])) {
656 if (is_array($data['participant'])) {
657 foreach ($data['participant'] as $d) {
658 $this->addParticipant($d);
660 } else {
661 throw new \InvalidArgumentException('"participant" must be array of objects or null, '.gettype($data['participant']).' seen.');
664 if (isset($data['appointment'])) {
665 $this->setAppointment($data['appointment']);
667 if (isset($data['period'])) {
668 $this->setPeriod($data['period']);
670 if (isset($data['length'])) {
671 $this->setLength($data['length']);
673 if (isset($data['reason'])) {
674 if (is_array($data['reason'])) {
675 foreach ($data['reason'] as $d) {
676 $this->addReason($d);
678 } else {
679 throw new \InvalidArgumentException('"reason" must be array of objects or null, '.gettype($data['reason']).' seen.');
682 if (isset($data['diagnosis'])) {
683 if (is_array($data['diagnosis'])) {
684 foreach ($data['diagnosis'] as $d) {
685 $this->addDiagnosis($d);
687 } else {
688 throw new \InvalidArgumentException('"diagnosis" must be array of objects or null, '.gettype($data['diagnosis']).' seen.');
691 if (isset($data['account'])) {
692 if (is_array($data['account'])) {
693 foreach ($data['account'] as $d) {
694 $this->addAccount($d);
696 } else {
697 throw new \InvalidArgumentException('"account" must be array of objects or null, '.gettype($data['account']).' seen.');
700 if (isset($data['hospitalization'])) {
701 $this->setHospitalization($data['hospitalization']);
703 if (isset($data['location'])) {
704 if (is_array($data['location'])) {
705 foreach ($data['location'] as $d) {
706 $this->addLocation($d);
708 } else {
709 throw new \InvalidArgumentException('"location" must be array of objects or null, '.gettype($data['location']).' seen.');
712 if (isset($data['serviceProvider'])) {
713 $this->setServiceProvider($data['serviceProvider']);
715 if (isset($data['partOf'])) {
716 $this->setPartOf($data['partOf']);
718 } else if (null !== $data) {
719 throw new \InvalidArgumentException('$data expected to be array of values, saw "'.gettype($data).'"');
721 parent::__construct($data);
725 * @return string
727 public function __toString()
729 return $this->get_fhirElementName();
733 * @return array
735 public function jsonSerialize()
737 $json = parent::jsonSerialize();
738 $json['resourceType'] = $this->_fhirElementName;
739 if (0 < count($this->identifier)) {
740 $json['identifier'] = [];
741 foreach ($this->identifier as $identifier) {
742 $json['identifier'][] = $identifier;
745 if (isset($this->status)) {
746 $json['status'] = $this->status;
748 if (0 < count($this->statusHistory)) {
749 $json['statusHistory'] = [];
750 foreach ($this->statusHistory as $statusHistory) {
751 $json['statusHistory'][] = $statusHistory;
754 if (isset($this->class)) {
755 $json['class'] = $this->class;
757 if (0 < count($this->classHistory)) {
758 $json['classHistory'] = [];
759 foreach ($this->classHistory as $classHistory) {
760 $json['classHistory'][] = $classHistory;
763 if (0 < count($this->type)) {
764 $json['type'] = [];
765 foreach ($this->type as $type) {
766 $json['type'][] = $type;
769 if (isset($this->priority)) {
770 $json['priority'] = $this->priority;
772 if (isset($this->subject)) {
773 $json['subject'] = $this->subject;
775 if (0 < count($this->episodeOfCare)) {
776 $json['episodeOfCare'] = [];
777 foreach ($this->episodeOfCare as $episodeOfCare) {
778 $json['episodeOfCare'][] = $episodeOfCare;
781 if (0 < count($this->incomingReferral)) {
782 $json['incomingReferral'] = [];
783 foreach ($this->incomingReferral as $incomingReferral) {
784 $json['incomingReferral'][] = $incomingReferral;
787 if (0 < count($this->participant)) {
788 $json['participant'] = [];
789 foreach ($this->participant as $participant) {
790 $json['participant'][] = $participant;
793 if (isset($this->appointment)) {
794 $json['appointment'] = $this->appointment;
796 if (isset($this->period)) {
797 $json['period'] = $this->period;
799 if (isset($this->length)) {
800 $json['length'] = $this->length;
802 if (0 < count($this->reason)) {
803 $json['reason'] = [];
804 foreach ($this->reason as $reason) {
805 $json['reason'][] = $reason;
808 if (0 < count($this->diagnosis)) {
809 $json['diagnosis'] = [];
810 foreach ($this->diagnosis as $diagnosis) {
811 $json['diagnosis'][] = $diagnosis;
814 if (0 < count($this->account)) {
815 $json['account'] = [];
816 foreach ($this->account as $account) {
817 $json['account'][] = $account;
820 if (isset($this->hospitalization)) {
821 $json['hospitalization'] = $this->hospitalization;
823 if (0 < count($this->location)) {
824 $json['location'] = [];
825 foreach ($this->location as $location) {
826 $json['location'][] = $location;
829 if (isset($this->serviceProvider)) {
830 $json['serviceProvider'] = $this->serviceProvider;
832 if (isset($this->partOf)) {
833 $json['partOf'] = $this->partOf;
835 return $json;
839 * @param boolean $returnSXE
840 * @param \SimpleXMLElement $sxe
841 * @return string|\SimpleXMLElement
843 public function xmlSerialize($returnSXE = false, $sxe = null)
845 if (null === $sxe) {
846 $sxe = new \SimpleXMLElement('<Encounter xmlns="http://hl7.org/fhir"></Encounter>');
848 parent::xmlSerialize(true, $sxe);
849 if (0 < count($this->identifier)) {
850 foreach ($this->identifier as $identifier) {
851 $identifier->xmlSerialize(true, $sxe->addChild('identifier'));
854 if (isset($this->status)) {
855 $this->status->xmlSerialize(true, $sxe->addChild('status'));
857 if (0 < count($this->statusHistory)) {
858 foreach ($this->statusHistory as $statusHistory) {
859 $statusHistory->xmlSerialize(true, $sxe->addChild('statusHistory'));
862 if (isset($this->class)) {
863 $this->class->xmlSerialize(true, $sxe->addChild('class'));
865 if (0 < count($this->classHistory)) {
866 foreach ($this->classHistory as $classHistory) {
867 $classHistory->xmlSerialize(true, $sxe->addChild('classHistory'));
870 if (0 < count($this->type)) {
871 foreach ($this->type as $type) {
872 $type->xmlSerialize(true, $sxe->addChild('type'));
875 if (isset($this->priority)) {
876 $this->priority->xmlSerialize(true, $sxe->addChild('priority'));
878 if (isset($this->subject)) {
879 $this->subject->xmlSerialize(true, $sxe->addChild('subject'));
881 if (0 < count($this->episodeOfCare)) {
882 foreach ($this->episodeOfCare as $episodeOfCare) {
883 $episodeOfCare->xmlSerialize(true, $sxe->addChild('episodeOfCare'));
886 if (0 < count($this->incomingReferral)) {
887 foreach ($this->incomingReferral as $incomingReferral) {
888 $incomingReferral->xmlSerialize(true, $sxe->addChild('incomingReferral'));
891 if (0 < count($this->participant)) {
892 foreach ($this->participant as $participant) {
893 $participant->xmlSerialize(true, $sxe->addChild('participant'));
896 if (isset($this->appointment)) {
897 $this->appointment->xmlSerialize(true, $sxe->addChild('appointment'));
899 if (isset($this->period)) {
900 $this->period->xmlSerialize(true, $sxe->addChild('period'));
902 if (isset($this->length)) {
903 $this->length->xmlSerialize(true, $sxe->addChild('length'));
905 if (0 < count($this->reason)) {
906 foreach ($this->reason as $reason) {
907 $reason->xmlSerialize(true, $sxe->addChild('reason'));
910 if (0 < count($this->diagnosis)) {
911 foreach ($this->diagnosis as $diagnosis) {
912 $diagnosis->xmlSerialize(true, $sxe->addChild('diagnosis'));
915 if (0 < count($this->account)) {
916 foreach ($this->account as $account) {
917 $account->xmlSerialize(true, $sxe->addChild('account'));
920 if (isset($this->hospitalization)) {
921 $this->hospitalization->xmlSerialize(true, $sxe->addChild('hospitalization'));
923 if (0 < count($this->location)) {
924 foreach ($this->location as $location) {
925 $location->xmlSerialize(true, $sxe->addChild('location'));
928 if (isset($this->serviceProvider)) {
929 $this->serviceProvider->xmlSerialize(true, $sxe->addChild('serviceProvider'));
931 if (isset($this->partOf)) {
932 $this->partOf->xmlSerialize(true, $sxe->addChild('partOf'));
934 if ($returnSXE) {
935 return $sxe;
937 return $sxe->saveXML();