-
Notifications
You must be signed in to change notification settings - Fork 0
/
GfrCalculatorViewController.m
131 lines (87 loc) · 2.38 KB
/
GfrCalculatorViewController.m
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
128
129
130
131
//
// GfrCalculatorViewController.m
// endotools
//
// Created by Johnson Thomas on 12/29/12.
// Copyright (c) 2012 Johnson Thomas. All rights reserved.
//
#import "GfrCalculatorViewController.h"
@interface GfrCalculatorViewController ()
@end
@implementation GfrCalculatorViewController
@synthesize AfricanAmerican;
@synthesize Sex;
@synthesize Age;
@synthesize Screatinine;
@synthesize Gfr;
float age, creatinine, egfr, powercr, powerage;
float aavalue =1.212;
float sexvalue =0.742;
-(IBAction)CalculateGFR:(id)sender;{
creatinine =[ Screatinine.text floatValue];
powercr = pow(creatinine, -1.154);
age = [ Age.text floatValue];
powerage = pow(age, -0.203);
egfr = 175 * powercr * powerage * aavalue * sexvalue;
// GFR = 175 x SerumCr-1.154 * age-0.203 * 1.212 (if patient is black) * 0.742 (if female)
Gfr.text = [NSString stringWithFormat:@"%.2f", egfr];
}
-(IBAction)hidekeyboard:(id)sender;{
[sender resignFirstResponder];
}
-(IBAction)AAChnaged:(id)sender;{
switch (self.AfricanAmerican.selectedSegmentIndex) {
case 0:
{
aavalue = 1.212;
}
break;
case 1:
{
aavalue = 1;
}
break;
default:
break;
}
}
-(IBAction)Sexchanged:(id)sender;{
switch (self.Sex.selectedSegmentIndex) {
case 0:
{
sexvalue = 0.742;
}
break;
case 1:
{
sexvalue =1;
}
break;
default:
break;
}
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:255/255 green:102/255 blue:102/255 alpha:1];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)keyboardisappear:(id)sender {
[Age resignFirstResponder];
[Screatinine resignFirstResponder];
}
@end