Syntax change and comment fix for parseAgeInfo calls
[openemr.git] / library / classes / rulesets / library / RsPatient.php
blobbfa0b227d6e721bbea4459971724438ad74d80ca
1 <?php
2 // Copyright (C) 2011 Ken Chapple <ken@mi-squared.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 require_once( dirname(__FILE__)."/../../../patient.inc" );
11 class RsPatient
13 public $id;
14 public $dob;
16 public function __construct( $id ) {
17 $this->id = $id;
18 $this->dob = $this->get_DOB( $id );
21 /* Function to get patient dob
22 * @param $patient_id
23 * @return (string) containing date of birth in the format "YYYY mm dd"
25 private function get_DOB( $patient_id ) {
26 $dob = getPatientData( $patient_id, "DOB as TS_DOB" );
27 $dob = $dob['TS_DOB'];
28 $date = ($dob . ' 00:00:00'); // MYSQL Date Format
29 return $date;
32 public function calculateAgeOnDate( $date )
34 $ageInfo=parseAgeInfo($this->dob,$date);
35 return $ageInfo['age'];