/*List of screen
1.	Ambulance Detail
2.	Driver Detail, ambulance maping
3.	Ambulance booking , on same dash board Ptient move to OPD/IPD/Emergency
*/

/*Each and every ambulance detail for an Hospital*/
Create TABLE	ambulance_details
(	id		int NOT NULL AUTO_INCREMENT,
	is_rental	enum('Y', 'N') NOT NULL DEFAULT 'N', /*Is the vehical purchase on rental or not*/
	good_receipt_details_id	int NULL DEFAULT 0, /*Table - good_receipt_details - ID, mandatory is select is_rental='N'*/
	assets_group	VARCHAR(50)	NOT NULL , /*Group of assets from Lookup-ITEM_GROUP*/
	item_id	int NOT NULL, /*Table-Items_ID*/
	purchased_on date not NUll, /*Fetch from good_receipt_details*/
	vehicle_number	VARCHAR(200)	NOT NULL , 
	vehicle_model	VARCHAR(200)	NOT NULL , 
	year_made	VARCHAR(10)	NOT NULL , 
	engine_number	VARCHAR(200)	NOT NULL , 
	chasis_number	VARCHAR(200)	NOT NULL , 
	rto_number	VARCHAR(200)	NOT NULL , 
	rto_registration_date 	DATE NULL,
	on_service_from	DATE NULL,
	is_ac_vehicle	enum('Y', 'N') NOT NULL DEFAULT 'N', 
	ambulance_doc varchar(200) NULL,
	is_active	enum('Y', 'N') NOT NULL DEFAULT 'Y',
	created_at datetime NOT NULL,
	created_by int NOT NULL,
	updated_at datetime,
	updated_by int,
	PRIMARY KEY (id) USING BTREE
) ENGINE = InnoDB;


/*Driver Detail*/
Create TABLE	ambulance_drivers
(	id		int NOT NULL AUTO_INCREMENT,
	emloyee_id	/*users table-ID*/
	driver_licence
	driver_blood_group
	driver_doc varchar(200) NULL,
	is_active	enum('Y', 'N') NOT NULL DEFAULT 'Y',
	created_at datetime NOT NULL,
	created_by int NOT NULL,
	updated_at datetime,
	updated_by int,
	PRIMARY KEY (id) USING BTREE
) ENGINE = InnoDB;


/*Ambulance wise driver mapping*/
Create TABLE	ambulance_drivers
(	id		int NOT NULL AUTO_INCREMENT,
	ambulance_driver_id /*ambulance_drivers table-ID*/
	emloyee_id	/*users table-ID*/
	ambulance_details_id	/*ambulance_detail table-ID*/
	is_active	enum('Y', 'N') NOT NULL DEFAULT 'Y',
	created_at datetime NOT NULL,
	created_by int NOT NULL,
	updated_at datetime,
	updated_by int,
	PRIMARY KEY (id) USING BTREE
) ENGINE = InnoDB;


/*Ambulance booking and patient movement to OPD/IPD/Emergency*/
Create TABLE	ambulance_booking_header
(	id					int NOT NULL AUTO_INCREMENT,
	ambulance_driver_id /*ambulance_drivers table-ID*/
	emloyee_id			/*users table-ID*/
	patient_id		
	booking_time		
	planed_from
	planed_to
	from_address
	to_address
	actual_time_from
	actual_time_to
	actual_time_taken	
	status	enum('U', 'A') NOT NULL DEFAULT 'U',
	move_to_source_dept enum('O','I', 'T', 'E', 'NA') DEFAULT 'NA', /*O-OPD, I-IPD, T-OT, E-Emergency*/
	move_to_source_id	int NULL
	created_at datetime NOT NULL,
	created_by int NOT NULL,
	updated_at datetime,
	updated_by int,
	PRIMARY KEY (id) USING BTREE
) ENGINE = InnoDB;
