CREATE TABLE OH_PATIENT_CONSENSUS (
  PTC_ID INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  PTC_PAT_ID int(11) NOT NULL,
  PTC_CONSENSUS TINYINT(1) NOT NULL DEFAULT 0,
  PTC_SERVICE  TINYINT(1) NOT NULL DEFAULT 0,
  PTC_CREATED_BY VARCHAR(50) NULL DEFAULT NULL,
  PTC_CREATED_DATE datetime NULL DEFAULT NULL,
  PTC_LAST_MODIFIED_BY VARCHAR(50) NULL DEFAULT NULL,
  PTC_LAST_MODIFIED_DATE datetime NULL DEFAULT NULL,
  PTC_ACTIVE TINYINT(1) NOT NULL DEFAULT 1,
  PRIMARY KEY (PTC_ID),
  FOREIGN KEY (PTC_PAT_ID) REFERENCES OH_PATIENT(PAT_ID),
  UNIQUE (PTC_PAT_ID)
) ENGINE = INNODB DEFAULT CHARACTER SET utf8;

-- update previous data
INSERT INTO OH_PATIENT_CONSENSUS (PTC_PAT_ID, PTC_CONSENSUS, PTC_SERVICE, PTC_CREATED_BY, PTC_CREATED_DATE, PTC_LAST_MODIFIED_BY, PTC_LAST_MODIFIED_DATE)
SELECT PAT_ID, 1, 0, 'admin', NOW(), 'admin', NOW() FROM OH_PATIENT;
