CREATE TABLE IF NOT EXISTS `cpone`.`email_config_nofification` (
  `Email_ConfigNofificationID` int NOT NULL AUTO_INCREMENT,
  `Email_ConfigNofificationTemplate` text NOT NULL,
  `Email_ConfigNofificationSender` varchar(100) NOT NULL,
  `Email_ConfigNofificationUsername` varchar(100) NOT NULL,
  `Email_ConfigNofificationPassword` varchar(100) NOT NULL,
  `Email_ConfigNofificationServer` varchar(100) NOT NULL,
  `Email_ConfigNofificationCreated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `Email_ConfigNofificationCreatedUserID` int NOT NULL DEFAULT '0',
  `Email_ConfigNofificationLastUpdated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `Email_ConfigNofificationLastUpdatedUserID` int NOT NULL DEFAULT '0',
  `Email_ConfigNofificationIsActive` char(1) NOT NULL DEFAULT 'Y',
  PRIMARY KEY (`Email_ConfigNofificationID`),
  KEY `idx_email_config_nofification_active` (`Email_ConfigNofificationIsActive`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `cpone`.`email_config_nofification` (
  `Email_ConfigNofificationTemplate`,
  `Email_ConfigNofificationSender`,
  `Email_ConfigNofificationUsername`,
  `Email_ConfigNofificationPassword`,
  `Email_ConfigNofificationServer`,
  `Email_ConfigNofificationCreatedUserID`,
  `Email_ConfigNofificationLastUpdatedUserID`,
  `Email_ConfigNofificationIsActive`
)
SELECT
  'Yth {PASIEN},\n<p></p>\n<p>Melalui email ini, kami ingin mengingatkan kembali jadwal pemeriksaan kesehatan (*Medical Check-Up*) Anda yang akan dilaksanakan pada:</p>\n<p><strong>Hari/Tanggal : {TANGGAL_MCU}</strong><br><strong>Lokasi       : Laboratorium Klinik <span style=\"font-weight:bold;color:blue\">WESTERINDO</span></strong></p>\n<p>Mohon kehadirannya tepat waktu dan pastikan Anda telah mengikuti instruksi persiapan (seperti puasa jika diperlukan) sebelum melakukan pemeriksaan.</p>\n<p>MOHON TIDAK DI-REPLY.</p>\nHormat kami,\n<p>Laboratorium Klinik <span style=\"font-weight:bold;color:blue\">WESTERINDO</span></p>',
  '',
  '',
  '',
  '',
  0,
  0,
  'Y'
WHERE NOT EXISTS (
  SELECT 1
  FROM `cpone`.`email_config_nofification`
  WHERE `Email_ConfigNofificationIsActive` = 'Y'
);
