CREATE TABLE `emergency_details`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `admission_id` int NOT NULL,
  `patient_id` int NOT NULL,
  `op_ip_flag` enum('O','I') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'O',
  `casualty_flag` enum('Y','N') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'N',
  `casualty_note` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
  `priority_id` int NULL DEFAULT NULL,
  `emergency_trf_date` datetime(0) NULL DEFAULT NULL,
  `emergency_trf_from` int NULL DEFAULT NULL,
  `emergency_trf_from_id` int NULL DEFAULT NULL,
  `emergency_trf_to` int NULL DEFAULT NULL,
  `emergency_trf_to_id` int NULL DEFAULT NULL,
  `created_at` datetime(0) NOT NULL,
  `created_by` int NOT NULL,
  `updated_at` datetime(0) NULL DEFAULT NULL,
  `updated_by` int NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

CREATE TABLE `emergency_priority_master`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `priority_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `priority` int NULL DEFAULT NULL,
  `color` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `status` enum('Y','N') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'Y',
  `created_by` int NULL DEFAULT NULL,
  `updated_by` int NULL DEFAULT NULL,
  `created_at` datetime(0) NOT NULL,
  `updated_at` datetime(0) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

CREATE TABLE `emergency_attendant_staffs`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `ipd_admission_id` int NOT NULL,
  `addtion_date` date NOT NULL,
  `patient_id` int NOT NULL,
  `staff_id` int NOT NULL,
  `is_active` enum('Y','N') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'Y',
  `remarks` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
  `created_at` datetime(0) NOT NULL,
  `created_by` int NOT NULL,
  `updated_at` datetime(0) NULL DEFAULT NULL,
  `updated_by` int NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 48 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;