mysql 8 fixes (#1639)
[openemr.git] / library / classes / Provider.class.php
blobf9a594bab5208809586fe44f2fd5a3c736da9207
1 <?php
2 /************************************************************************
3 prescription.php - Copyright duhlman
5 /usr/share/apps/umbrello/headings/heading.php
7 This file was generated on %date% at %time%
8 The original location of this file is /home/duhlman/uml-generated-code/prescription.php
9 **************************************************************************/
11 /**
12 * class Provider
15 class Provider extends ORDataObject
18 var $id;
19 var $lname;
20 var $fname;
21 var $federal_drug_id;
22 var $insurance_numbers;
23 var $specialty;
24 var $npi;
25 var $state_license_number;
27 /**
28 * Constructor sets all Prescription attributes to their default value
30 function __construct($id = "", $prefix = "")
32 $this->id = $id;
33 $this->federal_drug_id = "";
34 $this->_table = "users";
35 $this-> npi = "";
36 $this->insurance_numbers = array();
37 $this->state_license_number = "";
38 if ($id != "") {
39 $this->populate();
43 function populate()
45 $res = sqlQuery("SELECT fname,lname,federaldrugid, specialty, npi, state_license_number FROM users where id =". add_escape_custom($this->id));
47 if (is_array($res)) {
48 $this->lname = $res['lname'];
49 $this->fname = $res['fname'];
50 $this->federal_drug_id = $res['federaldrugid'];
51 $this->specialty = $res['specialty'];
52 $this->npi = $res['npi'];
53 $this->state_license_number = $res['state_license_number'];
56 $ins = new InsuranceNumbers();
57 $this->insurance_numbers = $ins->insurance_numbers_factory($this->id);
60 function utility_provider_array()
62 $provider_array = array();
63 $res = sqlQ("Select id,fname,lname from users where authorized = 1");
64 while ($row = sqlFetchArray($res)) {
65 $provider_array[$row['id']] = $row['fname'] . " " . $row['lname'];
68 return $provider_array;
71 function providers_factory($sort = "ORDER BY lname,fname")
73 $psa = array();
74 $sql = "SELECT id FROM " . $this->_table . " where authorized = 1 " . $sort;
75 $results = sqlQ($sql);
77 while ($row = sqlFetchArray($results)) {
78 $psa[] = new Provider($row['id']);
81 return $psa;
84 function get_id()
86 return $this->id;
89 function get_name_display()
91 return $this->fname . " " . $this->lname;
94 function get_specialty()
96 return $this->specialty;
99 function get_provider_number_default()
101 if (!empty($this->insurance_numbers)) {
102 return $this->insurance_numbers[0]->get_provider_number();
106 function get_rendering_provider_number_default()
108 if (!empty($this->insurance_numbers)) {
109 return $this->insurance_numbers[0]->get_rendering_provider_number();
113 function get_insurance_numbers()
115 return $this->insurance_numbers;
118 function get_insurance_numbers_default()
120 return $this->insurance_numbers[0];
123 function get_group_number_default()
125 if (!empty($this->insurance_numbers)) {
126 return $this->insurance_numbers[0]->get_group_number();
130 function get_npi()
132 return $this->npi;
135 function get_state_license_number()
137 return $this->state_license_number;
139 } // end of Provider