CREATE TABLE `MU_HOSPITAL_SCHEDULE` (
  `MU_HOSPITAL_SCHEDULE_ID` varchar(25) NOT NULL COMMENT '병원 스케줄 식별자',
  `MU_HOSPITAL_ID` varchar(25) NOT NULL COMMENT '병원 식별자',
  `SCHEDULE_DATE` date NOT NULL COMMENT '스케줄 날짜',
  `OPEN_YN` char(1) NOT NULL DEFAULT 'Y' COMMENT '운영여부 (Y/N)',
  `OPEN_START_TIME` varchar(5) DEFAULT NULL COMMENT '운영 시작시간 (HH:mm)',
  `OPEN_END_TIME` varchar(5) DEFAULT NULL COMMENT '운영 종료시간 (HH:mm)',
  `BREAK_START_TIME` varchar(5) DEFAULT NULL COMMENT '휴게 시작시간 (HH:mm)',
  `BREAK_END_TIME` varchar(5) DEFAULT NULL COMMENT '휴게 종료시간 (HH:mm)',
  `WRITE_DATE` date NOT NULL COMMENT '작성일자',
  `WRITE_TIME` time NOT NULL COMMENT '작성시간',
  `REMARK` text DEFAULT NULL COMMENT '비고',
  `CUD_FLAG` char(1) DEFAULT 'C' COMMENT '작업타입',
  `USE_YN` char(1) NOT NULL DEFAULT 'Y' COMMENT '사용여부',
  `REG_ID` varchar(25) NOT NULL COMMENT '등록자',
  `REG_DATE` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '등록일시',
  `MOD_ID` varchar(25) NOT NULL COMMENT '수정자',
  `MOD_DATE` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '수정일시',
  `T_ID` varchar(13) DEFAULT NULL,
  `T_DATE` datetime DEFAULT NULL,
  PRIMARY KEY (`MU_HOSPITAL_SCHEDULE_ID`),
  UNIQUE KEY `UK_HOSPITAL_DATE` (`MU_HOSPITAL_ID`, `SCHEDULE_DATE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='병원별 날짜별 운영 스케줄 (예외처리)';

CREATE TABLE `MU_HOSPITAL_SCHEDULE_SEQ` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1;

INSERT INTO `MU_HOSPITAL_SCHEDULE_SEQ` VALUES (1,1,9999999999,1,1,0,1,0);
