Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Patient Age

Status
Not open for further replies.

JonathanNYC

IS-IT--Management
Mar 29, 2003
111
US
Need help with viewing a formula(s) that seems to work most of the time. The anomaly I have noticed is that it does not work for patients born before 1930. I could be all wrong about that, but that is one thing I have noticed.

For a patient born on 9/1/31, I get 75 - which is correct
For a patient born on 6/21/29, I get -268 months
For a patient born on 9/4/23, I get -199 months

Here are my formulas:

Patient Age:
if isnull({pcxPatient.DOB}) then ""
else
if ({@PtAgeInDays}>0 and {@PtAgeInDays}<=31) then
replace(cstr({@PtAgeInDays}), ".00", "")+" days"
else
if ({@PtAgeInMonths}<=24) then
replace(cstr({@PtAgeInMonths}), ".00", "")+" mos"
else
replace(cstr({@PtAgeInYears}), ".00", "");

Patient Age in days:
if ({@PtDOB}<>"") then
if isnull({@StartTime}) then
0
else
datediff("d",cdate({@PtDOB}), {@StartTime});

Patient Age in Months:
if ({@PtDOB}<>"") then
if isnull({@StartTime}) then
0
else
datediff("m",cdate({@PtDOB}), {@StartTime});

Patient Age in years:
if ({@PtDOB}<>"") then
if isnull({@StartTime}) then
0
else
// Add year diff to birthdate. If after case date, patient has had birthday this year.
if datediff ("d", dateadd ("yyyy", datediff("yyyy",cdate({@PtDOB}), {@StartTime}), cdate({@PtDOB})), {@StartTime}) < 0 then
// Not yet reached birthday by case date
datediff("yyyy",cdate({@PtDOB}), {@StartTime}) - 1
else
// Reached birthday, so no need for correction.
datediff("yyyy",cdate({@PtDOB}), {@StartTime});

Patient date of Birth:
if not isnull({pcxPatient.DOB}) then
cstr({pcxPatient.DOB})
else
""

I am using CR10. Is there something that seems amiss in my formulas?
 
Noted. Thanks as always for your answers, feedback.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top