3 /************************************************************************
4 prescription.php - Copyright duhlman
6 /usr/share/apps/umbrello/headings/heading.php
8 This file was generated on %date% at %time%
9 The original location of this file is /home/duhlman/uml-generated-code/prescription.php
10 **************************************************************************/
17 use OpenEMR\Common\ORDataObject\ORDataObject
;
19 class Provider
extends ORDataObject
25 var $insurance_numbers;
28 var $state_license_number;
31 * Constructor sets all Prescription attributes to their default value
33 function __construct($id = "", $prefix = "")
36 $this->federal_drug_id
= "";
37 $this->_table
= "users";
39 $this->insurance_numbers
= array();
40 $this->state_license_number
= "";
48 $res = sqlQuery("SELECT fname,lname,federaldrugid, specialty, npi, state_license_number FROM users where id ='" . add_escape_custom($this->id
) . "'");
51 $this->lname
= $res['lname'];
52 $this->fname
= $res['fname'];
53 $this->federal_drug_id
= $res['federaldrugid'];
54 $this->specialty
= $res['specialty'];
55 $this->npi
= $res['npi'];
56 $this->state_license_number
= $res['state_license_number'];
59 $ins = new InsuranceNumbers();
60 $this->insurance_numbers
= $ins->insurance_numbers_factory($this->id
);
63 function utility_provider_array()
65 $provider_array = array();
66 $res = sqlQ("Select id,fname,lname from users where authorized = 1");
67 while ($row = sqlFetchArray($res)) {
68 $provider_array[$row['id']] = $row['fname'] . " " . $row['lname'];
71 return $provider_array;
74 function providers_factory($sort = "ORDER BY lname,fname")
77 $sql = "SELECT id FROM " . $this->_table
. " where authorized = 1 " . $sort;
78 $results = sqlQ($sql);
80 while ($row = sqlFetchArray($results)) {
81 $psa[] = new Provider($row['id']);
92 function get_name_display()
94 return $this->fname
. " " . $this->lname
;
97 function get_specialty()
99 return $this->specialty
;
102 function get_provider_number_default()
104 if (!empty($this->insurance_numbers
)) {
105 return $this->insurance_numbers
[0]->get_provider_number();
109 function get_rendering_provider_number_default()
111 if (!empty($this->insurance_numbers
)) {
112 return $this->insurance_numbers
[0]->get_rendering_provider_number();
116 function get_insurance_numbers()
118 return $this->insurance_numbers
;
121 function get_insurance_numbers_default()
123 return ($this->insurance_numbers
[0] ??
null);
126 function get_group_number_default()
128 if (!empty($this->insurance_numbers
)) {
129 return $this->insurance_numbers
[0]->get_group_number();
138 function get_state_license_number()
140 return $this->state_license_number
;