1: <?php
2: namespace Azalea\Selenium\App\Patients;
3:
4: use Azalea\Selenium\App\Patients\PatientFaker;
5: use Azalea\Selenium\Toolkit\View;
6:
7: class PatientEditDemographicsForm extends View
8: {
9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19:
20: public function fillRandom()
21: {
22:
23: $patient = new PatientFaker($this->driver->faker);
24: $patient->generate();
25:
26:
27: $this->clickElement("select[name=pat_phy_id]");
28: $this->driver->waitForAjax();
29: $providers = $this->querySelectorAll("select[name=pat_phy_id] > option");
30: $index = rand(1, count($providers) - 1);
31: $patient->pat_phy_id = $providers[$index]->attribute("value");
32: $patient->pat_phy_name = $providers[$index]->text();
33:
34: $providers = $this->querySelectorAll("select[name=pat_phy_id_requested] > option");
35: $index = rand(1, count($providers) - 1);
36: $patient->pat_phy_id_requested = $providers[$index]->attribute("value");
37: $patient->pat_phy_requested_name = $providers[$index]->text();
38:
39: $providers = $this->querySelectorAll("select[name=pat_phy_id_referring] > option");
40: $index = rand(1, count($providers) - 1);
41: $patient->pat_phy_id_referring = $providers[$index]->attribute("value");
42: $patient->pat_phy_referring_name = $providers[$index]->text();
43:
44:
45: $this->setInput(array(
46: "pat_bill_type" => 3,
47: "pat_mrn" => $patient->pat_mrn,
48: "pat_xray_num" => $patient->pat_xray_num,
49: "pat_phy_id" => $patient->pat_phy_id,
50: "pat_phy_id_requested" => $patient->pat_phy_id_requested,
51: "pat_phy_id_referring" => $patient->pat_phy_id_referring,
52: "pat_sex" => $patient->pat_sex,
53: "pat_fname" => $patient->pat_fname,
54: "pat_mname" => $patient->pat_mname,
55: "pat_lname" => $patient->pat_lname,
56: "pat_email" => $patient->pat_email,
57: "pat_dob" => $patient->pat_dob_datetime->format("m/d/Y"),
58: "pat_maritial_status" => $patient->pat_maritial_status,
59: "pat_ethnicity" => $patient->pat_ethnicity,
60: "pat_lang_id" => $patient->pat_lang_id,
61: "pat_address1" => $patient->pat_address1,
62: "pat_address2" => $patient->pat_address2,
63: "pat_zip" => $patient->pat_zip,
64: "pat_contact_method" => $patient->pat_contact_method,
65: "pat_apt_not_contact_method" => $patient->pat_apt_not_contact_method,
66: "pat_guarantor_relation" => $patient->pat_guarantor_relation
67: ));
68:
69:
70: $this->fillPhoneNumber($patient->pat_phone);
71: $this->fillPhoneWorkNumber($patient->pat_phone_work);
72: $this->fillPhoneOtherNumber($patient->pat_phone_other);
73:
74: return $patient;
75: }
76:
77: public function setAsInsurancePay()
78: {
79: $this->setInput("pat_bill_type", 2);
80: return $this;
81: }
82:
83: public function setAsSelfPay()
84: {
85: $this->setInput("pat_bill_type", 3);
86: return $this;
87: }
88:
89: public function fillPhoneNumber($number)
90: {
91:
92: $this->querySelector('[data-model-attr-field="pat_phone"] input[data-phone-pos="0"]')->value(substr($number, 0, 3));
93: $this->querySelector('[data-model-attr-field="pat_phone"] input[data-phone-pos="1"]')->value(substr($number, 3, 3));
94: $this->querySelector('[data-model-attr-field="pat_phone"] input[data-phone-pos="2"]')->value(substr($number, 6, 4));
95: return $this;
96: }
97:
98: public function fillPhoneWorkNumber($number)
99: {
100:
101: $this->querySelector('[data-model-attr-field="pat_phone_work"] input[data-phone-pos="0"]')->value(substr($number, 0, 3));
102: $this->querySelector('[data-model-attr-field="pat_phone_work"] input[data-phone-pos="1"]')->value(substr($number, 3, 3));
103: $this->querySelector('[data-model-attr-field="pat_phone_work"] input[data-phone-pos="2"]')->value(substr($number, 6, 4));
104: return $this;
105: }
106:
107: public function fillPhoneOtherNumber($number)
108: {
109:
110: $this->querySelector('[data-model-attr-field="pat_phone_other"] input[data-phone-pos="0"]')->value(substr($number, 0, 3));
111: $this->querySelector('[data-model-attr-field="pat_phone_other"] input[data-phone-pos="1"]')->value(substr($number, 3, 3));
112: $this->querySelector('[data-model-attr-field="pat_phone_other"] input[data-phone-pos="2"]')->value(substr($number, 6, 4));
113: return $this;
114: }
115:
116: public function addPrimaryInsurance()
117: {
118:
119: $this->querySelector(".btn_add_ins")->click();
120: }
121:
122: public function addSecondaryInsurance()
123: {
124:
125: $this->querySelector('.btn_add_ins[data-ins-num="2"]')->click();
126: }
127:
128: public function addTertiaryInsurance()
129: {
130:
131: $this->querySelector('.btn_add_ins[data-ins-num="3"]')->click();
132: }
133: }
134:
135: ?>