1: <?php
2: namespace Azalea\Selenium\EHR\UI\Patients;
3:
4: class PatientDemographics extends PatientSection
5: {
6:
7: protected static $hash = "/patients/p/{pat_id}/demog";
8:
9: protected static $selectorSection = ".patients-PatientDemographicsDetailView";
10:
11: 12: 13:
14: public function expandAll()
15: {
16: $elements = $this->getElementsByCss($this->getSelectorSection()." .awa-expandable.collapsed");
17: foreach($elements as $expandable) {
18: $expandable->click();
19: }
20: }
21:
22: 23: 24: 25:
26: public function hasSystemInfo($opened = false)
27: {
28: return $this->hasSection("System Info", $opened);
29: }
30:
31: 32: 33: 34:
35: public function hasGeneralInfo($opened = false)
36: {
37: return $this->hasSection("General Info", $opened);
38: }
39:
40: 41: 42: 43:
44: public function hasContactInfo($opened = false)
45: {
46: return $this->hasSection("Contact Info", $opened);
47: }
48:
49: 50: 51: 52:
53: public function hasEmploymentInfo($opened = false)
54: {
55: return $this->hasSection("Employment Info", $opened);
56: }
57:
58: 59: 60: 61:
62: public function hasGaurantorInfo($opened = false)
63: {
64: return $this->hasSection("Guarantor Info", $opened);
65: }
66:
67: 68: 69: 70:
71: public function hasPowerOfAttorney($opened = false)
72: {
73: return $this->hasSection("Power of Attorney", $opened);
74: }
75:
76: 77: 78: 79:
80: public function hasPrimaryInsurance($opened = false)
81: {
82: return $this->hasSection("Primary Insurance", $opened);
83: }
84:
85: 86: 87: 88:
89: public function hasMeaningfulUseMeasures($opened = false)
90: {
91: return $this->hasSection("Meaningful Use Measures", $opened);
92: }
93:
94: 95: 96: 97:
98: public function isPatientSelfPay()
99: {
100: $xpath = '//*[@id="pat_system"]/tbody/tr[5]/td';
101: return (stripos($this->byXPath($xpath)->text(), "SELF PAY") !== false);
102: }
103:
104: 105: 106: 107: 108: 109:
110: protected function hasSection($label, $opened = false)
111: {
112: $elements = $this->getElementsByCss(
113: $this->getSelectorSection().' .awa-expandable'.($opened ? '.expanded' : '.collapsed')
114: );
115: if (count($elements)) {
116: foreach($elements as $element) {
117: if ($element->text() == $label) {
118: return true;
119: }
120: }
121: }
122: return false;
123: }
124:
125: 126: 127: 128:
129: public function verify($args = array())
130: {
131: if (parent::verify($args)) {
132: $this->byCss($this->getSelectorSection());
133: return true;
134: }
135:
136: return false;
137: }
138: }