forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Provider.class.php
127 lines (104 loc) · 4.12 KB
/
Provider.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
/************************************************************************
prescription.php - Copyright duhlman
/usr/share/apps/umbrello/headings/heading.php
This file was generated on %date% at %time%
The original location of this file is /home/duhlman/uml-generated-code/prescription.php
**************************************************************************/
require_once("ORDataObject.class.php");
require_once("InsuranceNumbers.class.php");
/**
* class Provider
*
*/
class Provider extends ORDataObject{
var $id;
var $lname;
var $fname;
var $federal_drug_id;
var $insurance_numbers;
var $specialty;
var $npi;
var $state_license_number;
/**
* Constructor sets all Prescription attributes to their default value
*/
function __construct ($id = "", $prefix = "") {
$this->id = $id;
$this->federal_drug_id = "";
$this->_table = "users";
$this-> npi = "";
$this->insurance_numbers = array();
$this->state_license_number = "";
if ($id != "") {
$this->populate();
}
}
function populate() {
$res = sqlQuery("SELECT fname,lname,federaldrugid, specialty, npi, state_license_number FROM users where id =". add_escape_custom($this->id));
if (is_array($res)) {
$this->lname = $res['lname'];
$this->fname = $res['fname'];
$this->federal_drug_id = $res['federaldrugid'];
$this->specialty = $res['specialty'];
$this->npi = $res['npi'];
$this->state_license_number = $res['state_license_number'];
}
$ins = new InsuranceNumbers();
$this->insurance_numbers = $ins->insurance_numbers_factory($this->id);
}
function utility_provider_array() {
$provider_array = array();
$res = sqlQ("Select id,fname,lname from users where authorized = 1");
while ($row = sqlFetchArray($res) ) {
$provider_array[$row['id']] = $row['fname'] . " " . $row['lname'];
}
return $provider_array;
}
function providers_factory($sort = "ORDER BY lname,fname") {
$psa = array();
$sql = "SELECT id FROM " . $this->_table . " where authorized = 1 " . $sort;
$results = sqlQ($sql);
while($row = sqlFetchArray($results) ) {
$psa[] = new Provider($row['id']);
}
return $psa;
}
function get_id() {
return $this->id;
}
function get_name_display() {
return $this->fname . " " . $this->lname;
}
function get_specialty() {
return $this->specialty;
}
function get_provider_number_default() {
if (!empty($this->insurance_numbers)) {
return $this->insurance_numbers[0]->get_provider_number();
}
}
function get_rendering_provider_number_default() {
if (!empty($this->insurance_numbers)) {
return $this->insurance_numbers[0]->get_rendering_provider_number();
}
}
function get_insurance_numbers() {
return $this->insurance_numbers;
}
function get_insurance_numbers_default() {
return $this->insurance_numbers[0];
}
function get_group_number_default() {
if (!empty($this->insurance_numbers)) {
return $this->insurance_numbers[0]->get_group_number();
}
}
function get_npi() {
return $this->npi;
}
function get_state_license_number() {
return $this->state_license_number;
}
} // end of Provider
?>