minor bug fix
[openemr.git] / library / classes / Patient.class.php
blob589149d009c9b923de9d4af6abb761148c288dc6
1 <?php
2 /************************************************************************
3 aptient.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 require_once("ORDataObject.class.php");
12 require_once("Provider.class.php");
13 /**
14 * class Patient
18 class Patient extends ORDataObject{
19 var $id;
20 var $pubpid;
21 var $lname;
22 var $mname;
23 var $fname;
24 var $date_of_birth;
25 var $provider;
27 /**
28 * Constructor sets all Prescription attributes to their default value
30 function Patient($id = "") {
31 $this->id = $id;
32 $this->_table = "patient_data";
33 $this->pubpid = "";
34 $this->lname = "";
35 $this->mname = "";
36 $this->fname = "";
37 $this->dob = "";
38 $this->provider = new Provider();
39 $this->populate();
43 function populate() {
44 if (!empty($this->id)) {
45 $res = sqlQuery("SELECT providerID,fname,lname,mname ".
46 ", DATE_FORMAT(DOB,'%m/%d/%Y') as date_of_birth ".
47 ", pubpid ".
48 " from " . $this->_table ." where pid =". mysql_real_escape_string($this->id));
49 if (is_array($res)) {
50 $this->pubpid = $res['pubpid'];
51 $this->lname = $res['lname'];
52 $this->mname = $res['mname'];
53 $this->fname = $res['fname'];
54 $this->provider = new Provider($res['providerID']);
55 $this->date_of_birth = $res['date_of_birth'];
59 function get_id() { return $this->id; }
60 function get_pubpid() { return $this->pubpid; }
61 function get_lname() { return $this->lname; }
62 function get_name_display() { return $this->fname . " " . $this->lname; }
63 function get_provider_id() { return $this->provider->id; }
64 function get_provider() { return $this->provider; }
65 function get_dob () { return $this->date_of_birth; }
67 } // end of Patient