-- lab_info
select `lab_requisition`.`created_at` AS `created_at`,`lab_requisition`.`facilityId` AS `facilityId`,`lab_requisition`.`id` AS `id`,`lab_requisition`.`code` AS `code`,`lab_requisition`.`booking_no` AS `booking_no`,`lab_requisition`.`patient_id` AS `patient_id`,`lab_setup`.`head` AS `head`,`lab_setup`.`subhead` AS `subhead`,`lab_setup`.`unit` AS `unit`,`lab_setup`.`range_from` AS `range_from`,`lab_setup`.`range_to` AS `range_to`,`lab_setup`.`price` AS `price`,`lab_setup`.`description` AS `description`,`lab_setup`.`specimen` AS `specimen`,`lab_setup`.`noOfLabels` AS `noOfLabels`,`lab_requisition`.`department` AS `department`,`lab_requisition`.`result` AS `result`,`lab_requisition`.`appearance` AS `appearance`,`lab_requisition`.`serology` AS `serology`,`lab_requisition`.`culture_yielded` AS `culture_yielded`,`lab_requisition`.`status` AS `status`,`lab_requisition`.`created_by` AS `created_by`,`lab_requisition`.`sample_collected_by` AS `sample_collected_by`,`lab_requisition`.`analyzed_by` AS `analyzed_by`,`lab_requisition`.`result_by` AS `result_by`,`lab_requisition`.`reviewed_by` AS `reviewed_by`,`lab_requisition`.`printed_by` AS `printed_by` from (`lab_setup` join `lab_requisition` on(`lab_setup`.`subhead` = `lab_requisition`.`test`)) where `lab_requisition`.`facilityId` = `lab_setup`.`facilityId`

-- lab_request2
select `lab_info`.`created_at` AS `created_at`,`lab_info`.`facilityId` AS `facilityId`,`lab_info`.`id` AS `id`,`lab_info`.`code` AS `code`,`lab_info`.`booking_no` AS `booking_no`,`lab_info`.`patient_id` AS `patient_id`,`lab_info`.`head` AS `head`,`lab_info`.`subhead` AS `subhead`,`lab_info`.`unit` AS `unit`,`lab_info`.`range_from` AS `range_from`,`lab_info`.`range_to` AS `range_to`,`lab_info`.`price` AS `price`,`lab_info`.`description` AS `description`,`lab_info`.`specimen` AS `specimen`,`lab_info`.`noOfLabels` AS `noOfLabels`,`lab_setup`.`description` AS `group_head`,`lab_info`.`department` AS `department`,`lab_info`.`result` AS `result`,`lab_info`.`appearance` AS `appearance`,`lab_info`.`serology` AS `serology`,`lab_info`.`culture_yielded` AS `culture_yielded`,`lab_info`.`status` AS `status`,`lab_info`.`created_by` AS `created_by`,`lab_info`.`sample_collected_by` AS `sample_collected_by`,`lab_info`.`analyzed_by` AS `analyzed_by`,`lab_info`.`result_by` AS `result_by`,`lab_info`.`reviewed_by` AS `reviewed_by`,`lab_info`.`printed_by` AS `printed_by` from `lab_info` join `lab_setup` on `lab_setup`.`subhead` = `lab_info`.`head` WHERE lab_info.facilityId=lab_setup.facilityId

-- lab_process
select `a`.`created_at` AS `created_at`,`a`.`facilityId` AS `facilityId`,`a`.`id` AS `id`,`a`.`code` AS `code`,`a`.`booking_no` AS `booking_no`,`a`.`patient_id` AS `patient_id`,`a`.`head` AS `head`,`a`.`subhead` AS `subhead`,`a`.`unit` AS `unit`,`a`.`range_from` AS `range_from`,`a`.`range_to` AS `range_to`,`a`.`price` AS `price`,`a`.`description` AS `description`,`a`.`specimen` AS `specimen`,`a`.`noOfLabels` AS `noOfLabels`,`a`.`group_head` AS `group_head`,`a`.`department` AS `department`,`b`.`description` AS `department_head`,`a`.`result` AS `result`,`a`.`appearance` AS `appearance`,`a`.`serology` AS `serology`,`a`.`culture_yielded` AS `culture_yielded`,`a`.`status` AS `status`,`a`.`created_by` AS `created_by`,`a`.`sample_collected_by` AS `sample_collected_by`,`a`.`analyzed_by` AS `analyzed_by`,`a`.`result_by` AS `result_by`,`a`.`reviewed_by` AS `reviewed_by`,`a`.`printed_by` AS `printed_by` from (`lab_request2` `a` join `lab_setup` `b` on(`a`.`department` = `b`.`subhead`)) where `a`.`facilityId` = `b`.`facilityId`