table view.h
#import <UIKit/UIKit.h>
@interface TableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *displyLbl;
@end
table view.m
@implementation TableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
hosdet.h
#import <UIKit/UIKit.h>
#import "Header.h"
@interface HospitalDetailViewController :
UIViewController<UITextViewDelegate>
@property (strong, nonatomic) IBOutlet UITextView *textview;
@property (strong,nonatomic)NSString *hospitaldetailid1;
@property (strong,nonatomic)NSString *cityiddetail1;
@end
hpde.m
#import "HospitalDetailViewController.h"
#import "StringPOSTMethod.h"
@interface HospitalDetailViewController ()
{
NSMutableArray *array;
}
@end
@implementation HospitalDetailViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[StringPOSTMethod downloadDataFromServer:k_HOSPITALDETAIL bodyData:nil
method:@"POST" postString:[NSString
stringWithFormat:@"CITY_ID=%@&HOSPITAL_ID=%@",
_cityiddetail1,_hospitaldetailid1] withCompletionHandler
:^(NSDictionary *resultDictionary, NSError *error)
{
NSLog(@"success is %@", resultDictionary);
array = [[NSMutableArray alloc]init];
array =[[resultDictionary objectForKey:@"details"]mutableCopy];
_textview.text = [NSString stringWithFormat:@"%@",
[array valueForKey:@"detail"]];
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a
little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
hoaviewc.h
#import <UIKit/UIKit.h>
#import "Header.h"
@interface HospitalViewController :
UIViewController<UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *hospitalTable;
@property (strong,nonatomic)NSString *recivecity;
@property (strong,nonatomic)NSString *cityid;
@end
hosviec.m
#import "HospitalViewController.h"
#import "StringPOSTMethod.h"
#import "hospitalTableViewCell.h"
#import "depatmentViewController.h"
@interface HospitalViewController ()
{
NSMutableArray *hospitalarray;
NSInteger selecthospitalid;
}
@end
@implementation HospitalViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = self.recivecity;
[StringPOSTMethod downloadDataFromServer:k_HOSPITALLIST bodyData:nil
method:@"POST" postString:
[NSString stringWithFormat:@"CITY_ID=%@",_cityid]
withCompletionHandler:^(NSDictionary *resultDictionary, NSError *error)
{
NSLog(@"success is %@", resultDictionary);
hospitalarray = [[NSMutableArray alloc]init];
hospitalarray =[[resultDictionary objectForKey:@"details"]mutableCopy];
[_hospitalTable reloadData];
}];
}
#pragma mark- UITABLE View Delegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(
NSInteger)section
{
return hospitalarray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellid = @"hospitalcell";
hospitalTableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:cellid];
cell.hopitalList.text = [[hospitalarray
valueForKey:@"name"]objectAtIndex:indexPath.row];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:
(NSIndexPath *)indexPath
{
selecthospitalid=indexPath.row;
[self performSegueWithIdentifier:@"depatment" sender:self];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"depatment"]) {
depatmentViewController *obj = segue.destinationViewController;
obj.hospitalid = [[hospitalarray
valueForKey:@"hospital_id"]objectAtIndex:selecthospitalid];
obj.cityiddepartment = [NSString stringWithFormat:@"%@",_cityid];
}
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
@end
docviec.h
#import <UIKit/UIKit.h>
#include "Header.h"
@interface DoctorsViewController :
UIViewController<UITableViewDelegate,UITableViewDataSource>
@property (strong, nonatomic) IBOutlet UITableView *doctorTable;
@property(strong,nonatomic)NSString *hospitaliddoctor;
@property(strong,nonatomic)NSString *deptiddoctor;
@end
doctviec.m
#import "DoctorsViewController.h"
#import "StringPOSTMethod.h"
@interface DoctorsViewController ()
{
NSMutableArray *doctorarray;
}
@end
@implementation DoctorsViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[StringPOSTMethod downloadDataFromServer:k_DOCTORSLIST bodyData:nil
method:@"POST" postString:
[NSString stringWithFormat:@"HOSPITAL_ID=%@&DEPARTMENT_ID=%@",
self.hospitaliddoctor,self.deptiddoctor]
withCompletionHandler:^(NSDictionary *resultDictionary, NSError *error)
{
NSLog(@"success is %@", resultDictionary);
doctorarray = [[NSMutableArray alloc]init];
doctorarray =[[resultDictionary objectForKey:@"details"]mutableCopy];
[_doctorTable reloadData];
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark- UITableview
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:
(NSInteger)section
{
return doctorarray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellid = @"doctr";
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:cellid];
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:cellid];
cell.textLabel.text = [[doctorarray
valueForKey:@"spacialist_name"]objectAtIndex:indexPath.row];
return cell;
}
depviec.h
#import <UIKit/UIKit.h>
#import "Header.h"
@interface depatmentViewController :
UIViewController<UITableViewDelegate,UITableViewDataSource>
@property (strong, nonatomic) IBOutlet UITableView *tableviewDepatment;
@property (strong,nonatomic)NSString *hospitalid;
@property (strong,nonatomic)NSString *cityiddepartment;
- (IBAction)DetailsBton:(id)sender;
@end
depvi.m
#import "depatmentViewController.h"
#import "StringPOSTMethod.h"
#import "HospitalDetailViewController.h"
#import "DoctorsViewController.h"
@interface depatmentViewController ()
{
NSMutableArray *array;
NSInteger doctorselct;
}
@end
@implementation depatmentViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[StringPOSTMethod downloadDataFromServer:k_DEPARTMENTLIST bodyData:nil
method:@"POST" postString:
[NSString stringWithFormat:@"CITY_ID=%@&HOSPITAL_ID=%@",
self.cityiddepartment,self.hospitalid] withCompletionHandler:^(NSDictionary
*resultDictionary, NSError *error)
{
NSLog(@"success is %@", resultDictionary);
array = [[NSMutableArray alloc]init];
array =[[resultDictionary objectForKey:@"details"]mutableCopy];
NSLog(@"%@",array);
[_tableviewDepatment reloadData];
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark-UITable Delegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:
(NSInteger)section
{
return array.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellid=@"depatmentid";
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:cellid];
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:cellid];
cell.textLabel.text = [[array
valueForKey:@"dept_name"]objectAtIndex:indexPath.row];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
doctorselct = indexPath.row;
[self performSegueWithIdentifier:@"doctor" sender:self];
}
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"detailll"])
{
HospitalDetailViewController *obj = segue.destinationViewController;
obj.hospitaldetailid1 = self.hospitalid;
obj.cityiddetail1 = self.cityiddepartment;
}
else
{
DoctorsViewController *obj1 = segue.destinationViewController;
obj1.hospitaliddoctor = self.hospitalid;
obj1.deptiddoctor = [[array
valueForKey:@"dept_id"]objectAtIndex:doctorselct];
}
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
- (IBAction)DetailsBton:(id)sender {
[self performSegueWithIdentifier:@"detailll" sender:self];
}
@end