-- phpMyAdmin SQL Dump
-- version 3.5.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Sep 12, 2017 at 12:27 PM
-- Server version: 5.5.25a
-- PHP Version: 5.4.4

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `iccplusnew`
--

-- --------------------------------------------------------

--
-- Table structure for table `activerecordlog`
--

DROP TABLE IF EXISTS `activerecordlog`;
CREATE TABLE IF NOT EXISTS `activerecordlog` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `description` longtext,
  `action` varchar(20) DEFAULT NULL,
  `model` varchar(45) DEFAULT NULL,
  `creationdate` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `activerecordlog`
--
DROP TRIGGER IF EXISTS `trig_activerecordlog_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_activerecordlog_DELETE` BEFORE DELETE ON `activerecordlog`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.id;

set @userid='';



if  OLD.id !="" OR OLD.id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.id);



	set @chdCol=CONCAT(@chdCol,'-','id');

end if;



if  OLD.description !="" OR OLD.description is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.description);



	set @chdCol=CONCAT(@chdCol,'-','description');

end if;



if  OLD.action !="" OR OLD.action is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.action);



	set @chdCol=CONCAT(@chdCol,'-','action');

end if;



if  OLD.model !="" OR OLD.model is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.model);



	set @chdCol=CONCAT(@chdCol,'-','model');

end if;



if  OLD.creationdate !="" OR OLD.creationdate is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.creationdate);



	set @chdCol=CONCAT(@chdCol,'-','creationdate');

end if;



if  OLD.userid !="" OR OLD.userid is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.userid);



	set @chdCol=CONCAT(@chdCol,'-','userid');

end if;







INSERT INTO mirror_iccplus.activerecordlog(description,action,model,creationdate,userid) VALUES(OLD.description,OLD.action,OLD.model,OLD.creationdate,OLD.userid);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('activerecordlog', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_activerecordlog_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_activerecordlog_INSERT` AFTER INSERT ON `activerecordlog`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.id;

set @userid='';



set @newVal =CONCAT(@newVal,'-', NEW.id);

set @chdCol=CONCAT(@chdCol,'-','id');

set @newVal =CONCAT(@newVal,'-', NEW.description);

set @chdCol=CONCAT(@chdCol,'-','description');

set @newVal =CONCAT(@newVal,'-', NEW.action);

set @chdCol=CONCAT(@chdCol,'-','action');

set @newVal =CONCAT(@newVal,'-', NEW.model);

set @chdCol=CONCAT(@chdCol,'-','model');

set @newVal =CONCAT(@newVal,'-', NEW.creationdate);

set @chdCol=CONCAT(@chdCol,'-','creationdate');

set @newVal =CONCAT(@newVal,'-', NEW.userid);

set @chdCol=CONCAT(@chdCol,'-','userid');





INSERT INTO mirror_iccplus.activerecordlog(description,action,model,creationdate,userid) VALUES(NEW.description,NEW.action,NEW.model,NEW.creationdate,NEW.userid);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('activerecordlog', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_activerecordlog_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_activerecordlog_UPDATE` BEFORE UPDATE ON `activerecordlog`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.id;

set @userid='';



if  OLD.id != NEW.id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.id);

	set @newVal =CONCAT(@newVal,'-', NEW.id);

	set @chdCol=CONCAT(@chdCol,'-','id');

end if;



if  OLD.description != NEW.description

then

	set @oldval =CONCAT(@oldVal,'-',OLD.description);

	set @newVal =CONCAT(@newVal,'-', NEW.description);

	set @chdCol=CONCAT(@chdCol,'-','description');

end if;



if  OLD.action != NEW.action

then

	set @oldval =CONCAT(@oldVal,'-',OLD.action);

	set @newVal =CONCAT(@newVal,'-', NEW.action);

	set @chdCol=CONCAT(@chdCol,'-','action');

end if;



if  OLD.model != NEW.model

then

	set @oldval =CONCAT(@oldVal,'-',OLD.model);

	set @newVal =CONCAT(@newVal,'-', NEW.model);

	set @chdCol=CONCAT(@chdCol,'-','model');

end if;



if  OLD.creationdate != NEW.creationdate

then

	set @oldval =CONCAT(@oldVal,'-',OLD.creationdate);

	set @newVal =CONCAT(@newVal,'-', NEW.creationdate);

	set @chdCol=CONCAT(@chdCol,'-','creationdate');

end if;



if  OLD.userid != NEW.userid

then

	set @oldval =CONCAT(@oldVal,'-',OLD.userid);

	set @newVal =CONCAT(@newVal,'-', NEW.userid);

	set @chdCol=CONCAT(@chdCol,'-','userid');

end if;







INSERT INTO mirror_iccplus.activerecordlog(description,action,model,creationdate,userid) VALUES(NEW.description,NEW.action,NEW.model,NEW.creationdate,NEW.userid);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('activerecordlog', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `audits`
--

DROP TABLE IF EXISTS `audits`;
CREATE TABLE IF NOT EXISTS `audits` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `dateChanged` datetime NOT NULL,
  `tableName` varchar(45) NOT NULL,
  `task` char(1) DEFAULT NULL,
  `tableId` int(10) DEFAULT NULL,
  `userId` varchar(500) DEFAULT NULL,
  `newVal` varchar(500) DEFAULT NULL,
  `oldVal` varchar(500) DEFAULT NULL,
  `updatedcols` varchar(500) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_audits_tasks1_idx` (`task`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_appsettings`
--

DROP TABLE IF EXISTS `cms_appsettings`;
CREATE TABLE IF NOT EXISTS `cms_appsettings` (
  `app_stngs_id` int(11) NOT NULL AUTO_INCREMENT,
  `app_survey_id` varchar(11) NOT NULL COMMENT 'Survey',
  `app_coupons` enum('0','1') DEFAULT NULL COMMENT 'Coupons',
  `app_incentive` enum('0','1') DEFAULT NULL COMMENT 'Incentive',
  `app_control_site` enum('0','1') DEFAULT NULL,
  `app_idu` enum('0','1') DEFAULT NULL,
  `app_fin_yr` varchar(50) NOT NULL COMMENT 'Financial Year',
  `app_fin_yr_fixed` enum('0','1') NOT NULL COMMENT 'Financial Year Is Fixed?',
  `app_reimbsmnt_vchr` varchar(50) DEFAULT NULL COMMENT 'Reimbursement Voucher',
  `app_reimbsmnt_vchr_fixed` enum('0','1') DEFAULT NULL COMMENT 'Reimbursement Voucher Is Fixed?',
  `app_location` varchar(50) DEFAULT NULL COMMENT 'Default Location',
  `app_location_fixed` enum('0','1') DEFAULT NULL COMMENT 'Default Location Is Fixed?',
  `app_cupn_cde_fixed` enum('0','1') DEFAULT NULL COMMENT 'Coupon code is Participant ID?',
  `app_no_of_coupon` varchar(50) DEFAULT NULL COMMENT 'No of coupons per participant',
  `app_no_of_coupon_fixed` enum('0','1') DEFAULT NULL COMMENT 'No of coupons per participant Is Fixed?',
  `app_cupn_prd` varchar(50) DEFAULT NULL COMMENT 'Coupon Validity Period',
  `app_cupn_prd_type` varchar(50) DEFAULT NULL COMMENT 'Coupon Validity Period Type',
  `app_cupn_prd_fixed` enum('0','1') DEFAULT NULL COMMENT 'Coupon Validity Period Is Fixed?',
  `app_incentive_amt` varchar(50) DEFAULT NULL COMMENT 'Incentive Amount',
  `app_incentive_amt_fixed` enum('0','1') DEFAULT NULL COMMENT 'Incentive Amount Is Fixed?',
  `app_incentive_vchr` varchar(50) DEFAULT NULL COMMENT 'Incentive Voucher',
  `app_incentive_vchr_fixed` enum('0','1') DEFAULT NULL COMMENT 'Incentive Voucher Is Fixed?',
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  PRIMARY KEY (`app_stngs_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `cms_appsettings`
--

INSERT INTO `cms_appsettings` (`app_stngs_id`, `app_survey_id`, `app_coupons`, `app_incentive`, `app_control_site`, `app_idu`, `app_fin_yr`, `app_fin_yr_fixed`, `app_reimbsmnt_vchr`, `app_reimbsmnt_vchr_fixed`, `app_location`, `app_location_fixed`, `app_cupn_cde_fixed`, `app_no_of_coupon`, `app_no_of_coupon_fixed`, `app_cupn_prd`, `app_cupn_prd_type`, `app_cupn_prd_fixed`, `app_incentive_amt`, `app_incentive_amt_fixed`, `app_incentive_vchr`, `app_incentive_vchr_fixed`, `status`, `create_time`, `create_user`, `update_time`, `update_user`) VALUES
(1, 'ICC+', '0', '0', '0', '1', '1617', '1', NULL, NULL, 'DH', '0', '0', '', '0', '', '', '0', '', '0', NULL, NULL, '1', 1497940747, 1, 1505111594, 13);

--
-- Triggers `cms_appsettings`
--
DROP TRIGGER IF EXISTS `appsettings_update`;
DELIMITER //
CREATE TRIGGER `appsettings_update` AFTER UPDATE ON `cms_appsettings`
 FOR EACH ROW BEGIN

if NEW.app_control_site='1'
then
UPDATE cms_submenu SET status=0 WHERE sub_mnu_id in (60,61,62,63,64,74,76);
else
UPDATE cms_submenu SET status=1 WHERE sub_mnu_id in (60,61,62,63,64,74,76);
end if;

if NEW.app_idu='1'
then
UPDATE cms_submenu SET status=1 WHERE sub_mnu_id in (10,11,27,28,55,57,59,65,66,84,88,92);
else
UPDATE cms_submenu SET status=0 WHERE sub_mnu_id in (10,11,27,28,55,57,59,65,66,84,88,92);
end if;

END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_appsettings_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_appsettings_DELETE` BEFORE DELETE ON `cms_appsettings`
 FOR EACH ROW BEGIN
set @oldVal='';
set @newVal='';
set @chdCol='';
set @id=OLD.app_stngs_id;
set @userid=OLD.update_user;

if  OLD.app_stngs_id !="" OR OLD.app_stngs_id is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_stngs_id);

	set @chdCol=CONCAT(@chdCol,'-','app_stngs_id');
end if;

if  OLD.app_survey_id !="" OR OLD.app_survey_id is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_survey_id);

	set @chdCol=CONCAT(@chdCol,'-','app_survey_id');
end if;

if  OLD.app_coupons !="" OR OLD.app_coupons is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_coupons);

	set @chdCol=CONCAT(@chdCol,'-','app_coupons');
end if;

if  OLD.app_incentive !="" OR OLD.app_incentive is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_incentive);

	set @chdCol=CONCAT(@chdCol,'-','app_incentive');
end if;

if  OLD.app_fin_yr !="" OR OLD.app_fin_yr is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_fin_yr);

	set @chdCol=CONCAT(@chdCol,'-','app_fin_yr');
end if;

if  OLD.app_fin_yr_fixed !="" OR OLD.app_fin_yr_fixed is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_fin_yr_fixed);

	set @chdCol=CONCAT(@chdCol,'-','app_fin_yr_fixed');
end if;

if  OLD.app_reimbsmnt_vchr !="" OR OLD.app_reimbsmnt_vchr is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_reimbsmnt_vchr);

	set @chdCol=CONCAT(@chdCol,'-','app_reimbsmnt_vchr');
end if;

if  OLD.app_reimbsmnt_vchr_fixed !="" OR OLD.app_reimbsmnt_vchr_fixed is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_reimbsmnt_vchr_fixed);

	set @chdCol=CONCAT(@chdCol,'-','app_reimbsmnt_vchr_fixed');
end if;

if  OLD.app_location !="" OR OLD.app_location is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_location);

	set @chdCol=CONCAT(@chdCol,'-','app_location');
end if;

if  OLD.app_location_fixed !="" OR OLD.app_location_fixed is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_location_fixed);

	set @chdCol=CONCAT(@chdCol,'-','app_location_fixed');
end if;

if  OLD.app_cupn_cde_fixed !="" OR OLD.app_cupn_cde_fixed is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_cupn_cde_fixed);

	set @chdCol=CONCAT(@chdCol,'-','app_cupn_cde_fixed');
end if;

if  OLD.app_no_of_coupon !="" OR OLD.app_no_of_coupon is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_no_of_coupon);

	set @chdCol=CONCAT(@chdCol,'-','app_no_of_coupon');
end if;

if  OLD.app_no_of_coupon_fixed !="" OR OLD.app_no_of_coupon_fixed is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_no_of_coupon_fixed);

	set @chdCol=CONCAT(@chdCol,'-','app_no_of_coupon_fixed');
end if;

if  OLD.app_cupn_prd !="" OR OLD.app_cupn_prd is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_cupn_prd);

	set @chdCol=CONCAT(@chdCol,'-','app_cupn_prd');
end if;

if  OLD.app_cupn_prd_type !="" OR OLD.app_cupn_prd_type is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_cupn_prd_type);

	set @chdCol=CONCAT(@chdCol,'-','app_cupn_prd_type');
end if;

if  OLD.app_cupn_prd_fixed !="" OR OLD.app_cupn_prd_fixed is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_cupn_prd_fixed);

	set @chdCol=CONCAT(@chdCol,'-','app_cupn_prd_fixed');
end if;

if  OLD.app_incentive_amt !="" OR OLD.app_incentive_amt is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_incentive_amt);

	set @chdCol=CONCAT(@chdCol,'-','app_incentive_amt');
end if;

if  OLD.app_incentive_amt_fixed !="" OR OLD.app_incentive_amt_fixed is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_incentive_amt_fixed);

	set @chdCol=CONCAT(@chdCol,'-','app_incentive_amt_fixed');
end if;

if  OLD.app_incentive_vchr !="" OR OLD.app_incentive_vchr is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_incentive_vchr);

	set @chdCol=CONCAT(@chdCol,'-','app_incentive_vchr');
end if;

if  OLD.app_incentive_vchr_fixed !="" OR OLD.app_incentive_vchr_fixed is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_incentive_vchr_fixed);

	set @chdCol=CONCAT(@chdCol,'-','app_incentive_vchr_fixed');
end if;

if  OLD.status !="" OR OLD.status is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @chdCol=CONCAT(@chdCol,'-','status');
end if;

if  OLD.create_time !="" OR OLD.create_time is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');
end if;

if  OLD.create_user !="" OR OLD.create_user is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');
end if;

if  OLD.update_time !="" OR OLD.update_time is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');
end if;

if  OLD.update_user !="" OR OLD.update_user is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');
end if;



INSERT INTO mirror_iccplus.cms_appsettings(app_survey_id,app_coupons,app_incentive,app_fin_yr,app_fin_yr_fixed,app_reimbsmnt_vchr,app_reimbsmnt_vchr_fixed,app_location,app_location_fixed,app_cupn_cde_fixed,app_no_of_coupon,app_no_of_coupon_fixed,app_cupn_prd,app_cupn_prd_type,app_cupn_prd_fixed,app_incentive_amt,app_incentive_amt_fixed,app_incentive_vchr,app_incentive_vchr_fixed,status,create_time,create_user,update_time,update_user) VALUES(OLD.app_survey_id,OLD.app_coupons,OLD.app_incentive,OLD.app_fin_yr,OLD.app_fin_yr_fixed,OLD.app_reimbsmnt_vchr,OLD.app_reimbsmnt_vchr_fixed,OLD.app_location,OLD.app_location_fixed,OLD.app_cupn_cde_fixed,OLD.app_no_of_coupon,OLD.app_no_of_coupon_fixed,OLD.app_cupn_prd,OLD.app_cupn_prd_type,OLD.app_cupn_prd_fixed,OLD.app_incentive_amt,OLD.app_incentive_amt_fixed,OLD.app_incentive_vchr,OLD.app_incentive_vchr_fixed,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user);

 
INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_appsettings', NOW(),'d',@id,@userid,@oldVal,@newVal,'');

END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_appsettings_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_appsettings_INSERT` AFTER INSERT ON `cms_appsettings`
 FOR EACH ROW BEGIN
set @oldVal='';
set @newVal='';
set @chdCol='';
set @id=NEW.app_stngs_id;
set @userid=NEW.create_user;

set @newVal =CONCAT(@newVal,'-', NEW.app_stngs_id);
set @chdCol=CONCAT(@chdCol,'-','app_stngs_id');
set @newVal =CONCAT(@newVal,'-', NEW.app_survey_id);
set @chdCol=CONCAT(@chdCol,'-','app_survey_id');
set @newVal =CONCAT(@newVal,'-', NEW.app_coupons);
set @chdCol=CONCAT(@chdCol,'-','app_coupons');
set @newVal =CONCAT(@newVal,'-', NEW.app_incentive);
set @chdCol=CONCAT(@chdCol,'-','app_incentive');
set @newVal =CONCAT(@newVal,'-', NEW.app_fin_yr);
set @chdCol=CONCAT(@chdCol,'-','app_fin_yr');
set @newVal =CONCAT(@newVal,'-', NEW.app_fin_yr_fixed);
set @chdCol=CONCAT(@chdCol,'-','app_fin_yr_fixed');
set @newVal =CONCAT(@newVal,'-', NEW.app_reimbsmnt_vchr);
set @chdCol=CONCAT(@chdCol,'-','app_reimbsmnt_vchr');
set @newVal =CONCAT(@newVal,'-', NEW.app_reimbsmnt_vchr_fixed);
set @chdCol=CONCAT(@chdCol,'-','app_reimbsmnt_vchr_fixed');
set @newVal =CONCAT(@newVal,'-', NEW.app_location);
set @chdCol=CONCAT(@chdCol,'-','app_location');
set @newVal =CONCAT(@newVal,'-', NEW.app_location_fixed);
set @chdCol=CONCAT(@chdCol,'-','app_location_fixed');
set @newVal =CONCAT(@newVal,'-', NEW.app_cupn_cde_fixed);
set @chdCol=CONCAT(@chdCol,'-','app_cupn_cde_fixed');
set @newVal =CONCAT(@newVal,'-', NEW.app_no_of_coupon);
set @chdCol=CONCAT(@chdCol,'-','app_no_of_coupon');
set @newVal =CONCAT(@newVal,'-', NEW.app_no_of_coupon_fixed);
set @chdCol=CONCAT(@chdCol,'-','app_no_of_coupon_fixed');
set @newVal =CONCAT(@newVal,'-', NEW.app_cupn_prd);
set @chdCol=CONCAT(@chdCol,'-','app_cupn_prd');
set @newVal =CONCAT(@newVal,'-', NEW.app_cupn_prd_type);
set @chdCol=CONCAT(@chdCol,'-','app_cupn_prd_type');
set @newVal =CONCAT(@newVal,'-', NEW.app_cupn_prd_fixed);
set @chdCol=CONCAT(@chdCol,'-','app_cupn_prd_fixed');
set @newVal =CONCAT(@newVal,'-', NEW.app_incentive_amt);
set @chdCol=CONCAT(@chdCol,'-','app_incentive_amt');
set @newVal =CONCAT(@newVal,'-', NEW.app_incentive_amt_fixed);
set @chdCol=CONCAT(@chdCol,'-','app_incentive_amt_fixed');
set @newVal =CONCAT(@newVal,'-', NEW.app_incentive_vchr);
set @chdCol=CONCAT(@chdCol,'-','app_incentive_vchr');
set @newVal =CONCAT(@newVal,'-', NEW.app_incentive_vchr_fixed);
set @chdCol=CONCAT(@chdCol,'-','app_incentive_vchr_fixed');
set @newVal =CONCAT(@newVal,'-', NEW.status);
set @chdCol=CONCAT(@chdCol,'-','status');
set @newVal =CONCAT(@newVal,'-', NEW.create_time);
set @chdCol=CONCAT(@chdCol,'-','create_time');
set @newVal =CONCAT(@newVal,'-', NEW.create_user);
set @chdCol=CONCAT(@chdCol,'-','create_user');
set @newVal =CONCAT(@newVal,'-', NEW.update_time);
set @chdCol=CONCAT(@chdCol,'-','update_time');
set @newVal =CONCAT(@newVal,'-', NEW.update_user);
set @chdCol=CONCAT(@chdCol,'-','update_user');


INSERT INTO mirror_iccplus.cms_appsettings(app_survey_id,app_coupons,app_incentive,app_fin_yr,app_fin_yr_fixed,app_reimbsmnt_vchr,app_reimbsmnt_vchr_fixed,app_location,app_location_fixed,app_cupn_cde_fixed,app_no_of_coupon,app_no_of_coupon_fixed,app_cupn_prd,app_cupn_prd_type,app_cupn_prd_fixed,app_incentive_amt,app_incentive_amt_fixed,app_incentive_vchr,app_incentive_vchr_fixed,status,create_time,create_user,update_time,update_user) VALUES(NEW.app_survey_id,NEW.app_coupons,NEW.app_incentive,NEW.app_fin_yr,NEW.app_fin_yr_fixed,NEW.app_reimbsmnt_vchr,NEW.app_reimbsmnt_vchr_fixed,NEW.app_location,NEW.app_location_fixed,NEW.app_cupn_cde_fixed,NEW.app_no_of_coupon,NEW.app_no_of_coupon_fixed,NEW.app_cupn_prd,NEW.app_cupn_prd_type,NEW.app_cupn_prd_fixed,NEW.app_incentive_amt,NEW.app_incentive_amt_fixed,NEW.app_incentive_vchr,NEW.app_incentive_vchr_fixed,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user);


INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_appsettings', NOW(),'i',@id,@userid,@oldVal,@newVal,'');

END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_appsettings_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_appsettings_UPDATE` BEFORE UPDATE ON `cms_appsettings`
 FOR EACH ROW BEGIN
set @oldVal='';
set @newVal='';
set @chdCol='';
set @id=NEW.app_stngs_id;
set @userid=NEW.update_user;

if  OLD.app_stngs_id != NEW.app_stngs_id
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_stngs_id);
	set @newVal =CONCAT(@newVal,'-', NEW.app_stngs_id);
	set @chdCol=CONCAT(@chdCol,'-','app_stngs_id');
end if;

if  OLD.app_survey_id != NEW.app_survey_id
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_survey_id);
	set @newVal =CONCAT(@newVal,'-', NEW.app_survey_id);
	set @chdCol=CONCAT(@chdCol,'-','app_survey_id');
end if;

if  OLD.app_coupons != NEW.app_coupons
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_coupons);
	set @newVal =CONCAT(@newVal,'-', NEW.app_coupons);
	set @chdCol=CONCAT(@chdCol,'-','app_coupons');
end if;

if  OLD.app_incentive != NEW.app_incentive
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_incentive);
	set @newVal =CONCAT(@newVal,'-', NEW.app_incentive);
	set @chdCol=CONCAT(@chdCol,'-','app_incentive');
end if;

if  OLD.app_fin_yr != NEW.app_fin_yr
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_fin_yr);
	set @newVal =CONCAT(@newVal,'-', NEW.app_fin_yr);
	set @chdCol=CONCAT(@chdCol,'-','app_fin_yr');
end if;

if  OLD.app_fin_yr_fixed != NEW.app_fin_yr_fixed
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_fin_yr_fixed);
	set @newVal =CONCAT(@newVal,'-', NEW.app_fin_yr_fixed);
	set @chdCol=CONCAT(@chdCol,'-','app_fin_yr_fixed');
end if;

if  OLD.app_reimbsmnt_vchr != NEW.app_reimbsmnt_vchr
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_reimbsmnt_vchr);
	set @newVal =CONCAT(@newVal,'-', NEW.app_reimbsmnt_vchr);
	set @chdCol=CONCAT(@chdCol,'-','app_reimbsmnt_vchr');
end if;

if  OLD.app_reimbsmnt_vchr_fixed != NEW.app_reimbsmnt_vchr_fixed
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_reimbsmnt_vchr_fixed);
	set @newVal =CONCAT(@newVal,'-', NEW.app_reimbsmnt_vchr_fixed);
	set @chdCol=CONCAT(@chdCol,'-','app_reimbsmnt_vchr_fixed');
end if;

if  OLD.app_location != NEW.app_location
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_location);
	set @newVal =CONCAT(@newVal,'-', NEW.app_location);
	set @chdCol=CONCAT(@chdCol,'-','app_location');
end if;

if  OLD.app_location_fixed != NEW.app_location_fixed
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_location_fixed);
	set @newVal =CONCAT(@newVal,'-', NEW.app_location_fixed);
	set @chdCol=CONCAT(@chdCol,'-','app_location_fixed');
end if;

if  OLD.app_cupn_cde_fixed != NEW.app_cupn_cde_fixed
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_cupn_cde_fixed);
	set @newVal =CONCAT(@newVal,'-', NEW.app_cupn_cde_fixed);
	set @chdCol=CONCAT(@chdCol,'-','app_cupn_cde_fixed');
end if;

if  OLD.app_no_of_coupon != NEW.app_no_of_coupon
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_no_of_coupon);
	set @newVal =CONCAT(@newVal,'-', NEW.app_no_of_coupon);
	set @chdCol=CONCAT(@chdCol,'-','app_no_of_coupon');
end if;

if  OLD.app_no_of_coupon_fixed != NEW.app_no_of_coupon_fixed
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_no_of_coupon_fixed);
	set @newVal =CONCAT(@newVal,'-', NEW.app_no_of_coupon_fixed);
	set @chdCol=CONCAT(@chdCol,'-','app_no_of_coupon_fixed');
end if;

if  OLD.app_cupn_prd != NEW.app_cupn_prd
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_cupn_prd);
	set @newVal =CONCAT(@newVal,'-', NEW.app_cupn_prd);
	set @chdCol=CONCAT(@chdCol,'-','app_cupn_prd');
end if;

if  OLD.app_cupn_prd_type != NEW.app_cupn_prd_type
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_cupn_prd_type);
	set @newVal =CONCAT(@newVal,'-', NEW.app_cupn_prd_type);
	set @chdCol=CONCAT(@chdCol,'-','app_cupn_prd_type');
end if;

if  OLD.app_cupn_prd_fixed != NEW.app_cupn_prd_fixed
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_cupn_prd_fixed);
	set @newVal =CONCAT(@newVal,'-', NEW.app_cupn_prd_fixed);
	set @chdCol=CONCAT(@chdCol,'-','app_cupn_prd_fixed');
end if;

if  OLD.app_incentive_amt != NEW.app_incentive_amt
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_incentive_amt);
	set @newVal =CONCAT(@newVal,'-', NEW.app_incentive_amt);
	set @chdCol=CONCAT(@chdCol,'-','app_incentive_amt');
end if;

if  OLD.app_incentive_amt_fixed != NEW.app_incentive_amt_fixed
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_incentive_amt_fixed);
	set @newVal =CONCAT(@newVal,'-', NEW.app_incentive_amt_fixed);
	set @chdCol=CONCAT(@chdCol,'-','app_incentive_amt_fixed');
end if;

if  OLD.app_incentive_vchr != NEW.app_incentive_vchr
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_incentive_vchr);
	set @newVal =CONCAT(@newVal,'-', NEW.app_incentive_vchr);
	set @chdCol=CONCAT(@chdCol,'-','app_incentive_vchr');
end if;

if  OLD.app_incentive_vchr_fixed != NEW.app_incentive_vchr_fixed
then
	set @oldval =CONCAT(@oldVal,'-',OLD.app_incentive_vchr_fixed);
	set @newVal =CONCAT(@newVal,'-', NEW.app_incentive_vchr_fixed);
	set @chdCol=CONCAT(@chdCol,'-','app_incentive_vchr_fixed');
end if;

if  OLD.status != NEW.status
then
	set @oldval =CONCAT(@oldVal,'-',OLD.status);
	set @newVal =CONCAT(@newVal,'-', NEW.status);
	set @chdCol=CONCAT(@chdCol,'-','status');
end if;

if  OLD.create_time != NEW.create_time
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);
	set @newVal =CONCAT(@newVal,'-', NEW.create_time);
	set @chdCol=CONCAT(@chdCol,'-','create_time');
end if;

if  OLD.create_user != NEW.create_user
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);
	set @newVal =CONCAT(@newVal,'-', NEW.create_user);
	set @chdCol=CONCAT(@chdCol,'-','create_user');
end if;

if  OLD.update_time != NEW.update_time
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);
	set @newVal =CONCAT(@newVal,'-', NEW.update_time);
	set @chdCol=CONCAT(@chdCol,'-','update_time');
end if;

if  OLD.update_user != NEW.update_user
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);
	set @newVal =CONCAT(@newVal,'-', NEW.update_user);
	set @chdCol=CONCAT(@chdCol,'-','update_user');
end if;



INSERT INTO mirror_iccplus.cms_appsettings(app_survey_id,app_coupons,app_incentive,app_fin_yr,app_fin_yr_fixed,app_reimbsmnt_vchr,app_reimbsmnt_vchr_fixed,app_location,app_location_fixed,app_cupn_cde_fixed,app_no_of_coupon,app_no_of_coupon_fixed,app_cupn_prd,app_cupn_prd_type,app_cupn_prd_fixed,app_incentive_amt,app_incentive_amt_fixed,app_incentive_vchr,app_incentive_vchr_fixed,status,create_time,create_user,update_time,update_user) VALUES(NEW.app_survey_id,NEW.app_coupons,NEW.app_incentive,NEW.app_fin_yr,NEW.app_fin_yr_fixed,NEW.app_reimbsmnt_vchr,NEW.app_reimbsmnt_vchr_fixed,NEW.app_location,NEW.app_location_fixed,NEW.app_cupn_cde_fixed,NEW.app_no_of_coupon,NEW.app_no_of_coupon_fixed,NEW.app_cupn_prd,NEW.app_cupn_prd_type,NEW.app_cupn_prd_fixed,NEW.app_incentive_amt,NEW.app_incentive_amt_fixed,NEW.app_incentive_vchr,NEW.app_incentive_vchr_fixed,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user);


INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_appsettings', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);

END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_artbook`
--

DROP TABLE IF EXISTS `cms_artbook`;
CREATE TABLE IF NOT EXISTS `cms_artbook` (
  `artbook_id` int(11) NOT NULL AUTO_INCREMENT,
  `artbook_sid` varchar(100) NOT NULL COMMENT 'Survey',
  `artbook_loc` varchar(100) NOT NULL COMMENT 'Location',
  `artbook_pid` varchar(100) NOT NULL COMMENT 'ICC Client ID',
  `artbook_q1` varchar(100) NOT NULL COMMENT 'ART Book',
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`artbook_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_artbook`
--
DROP TRIGGER IF EXISTS `trig_cms_artbook_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_artbook_DELETE` BEFORE DELETE ON `cms_artbook`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.artbook_id;

set @userid=OLD.update_user;



if  OLD.artbook_id !="" OR OLD.artbook_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.artbook_id);



	set @chdCol=CONCAT(@chdCol,'-','artbook_id');

end if;



if  OLD.artbook_sid !="" OR OLD.artbook_sid is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.artbook_sid);



	set @chdCol=CONCAT(@chdCol,'-','artbook_sid');

end if;



if  OLD.artbook_loc !="" OR OLD.artbook_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.artbook_loc);



	set @chdCol=CONCAT(@chdCol,'-','artbook_loc');

end if;



if  OLD.artbook_pid !="" OR OLD.artbook_pid is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.artbook_pid);



	set @chdCol=CONCAT(@chdCol,'-','artbook_pid');

end if;



if  OLD.artbook_q1 !="" OR OLD.artbook_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.artbook_q1);



	set @chdCol=CONCAT(@chdCol,'-','artbook_q1');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_artbook(artbook_sid,artbook_loc,artbook_pid,artbook_q1,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.artbook_sid,OLD.artbook_loc,OLD.artbook_pid,OLD.artbook_q1,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_artbook', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_artbook_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_artbook_INSERT` AFTER INSERT ON `cms_artbook`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.artbook_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.artbook_id);

set @chdCol=CONCAT(@chdCol,'-','artbook_id');

set @newVal =CONCAT(@newVal,'-', NEW.artbook_sid);

set @chdCol=CONCAT(@chdCol,'-','artbook_sid');

set @newVal =CONCAT(@newVal,'-', NEW.artbook_loc);

set @chdCol=CONCAT(@chdCol,'-','artbook_loc');

set @newVal =CONCAT(@newVal,'-', NEW.artbook_pid);

set @chdCol=CONCAT(@chdCol,'-','artbook_pid');

set @newVal =CONCAT(@newVal,'-', NEW.artbook_q1);

set @chdCol=CONCAT(@chdCol,'-','artbook_q1');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_artbook(artbook_sid,artbook_loc,artbook_pid,artbook_q1,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.artbook_sid,NEW.artbook_loc,NEW.artbook_pid,NEW.artbook_q1,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_artbook', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_artbook_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_artbook_UPDATE` BEFORE UPDATE ON `cms_artbook`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.artbook_id;

set @userid=NEW.update_user;



if  OLD.artbook_id != NEW.artbook_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.artbook_id);

	set @newVal =CONCAT(@newVal,'-', NEW.artbook_id);

	set @chdCol=CONCAT(@chdCol,'-','artbook_id');

end if;



if  OLD.artbook_sid != NEW.artbook_sid

then

	set @oldval =CONCAT(@oldVal,'-',OLD.artbook_sid);

	set @newVal =CONCAT(@newVal,'-', NEW.artbook_sid);

	set @chdCol=CONCAT(@chdCol,'-','artbook_sid');

end if;



if  OLD.artbook_loc != NEW.artbook_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.artbook_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.artbook_loc);

	set @chdCol=CONCAT(@chdCol,'-','artbook_loc');

end if;



if  OLD.artbook_pid != NEW.artbook_pid

then

	set @oldval =CONCAT(@oldVal,'-',OLD.artbook_pid);

	set @newVal =CONCAT(@newVal,'-', NEW.artbook_pid);

	set @chdCol=CONCAT(@chdCol,'-','artbook_pid');

end if;



if  OLD.artbook_q1 != NEW.artbook_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.artbook_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.artbook_q1);

	set @chdCol=CONCAT(@chdCol,'-','artbook_q1');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_artbook(artbook_sid,artbook_loc,artbook_pid,artbook_q1,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.artbook_sid,NEW.artbook_loc,NEW.artbook_pid,NEW.artbook_q1,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_artbook', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_artincenmaster`
--

DROP TABLE IF EXISTS `cms_artincenmaster`;
CREATE TABLE IF NOT EXISTS `cms_artincenmaster` (
  `art_inc_id` int(11) NOT NULL AUTO_INCREMENT,
  `art_inc_survey` varchar(11) NOT NULL COMMENT 'Survey',
  `art_inc_part_id` varchar(11) NOT NULL COMMENT 'ICC Client ID',
  `art_inc_visitdate` int(11) DEFAULT NULL COMMENT 'Visit Date',
  `art_inc_q1` int(11) DEFAULT NULL COMMENT 'Payment Status',
  `art_inc_q2` int(11) DEFAULT NULL COMMENT 'Amount',
  `art_inc_q3` int(11) DEFAULT NULL COMMENT 'Paid Date',
  `art_inc_q4` varchar(50) DEFAULT NULL COMMENT 'Voucher Number',
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) NOT NULL,
  PRIMARY KEY (`art_inc_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_artincenmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_artincenmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_artincenmaster_DELETE` BEFORE DELETE ON `cms_artincenmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.art_inc_id;

set @userid=OLD.update_user;



if  OLD.art_inc_id !="" OR OLD.art_inc_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_id);



	set @chdCol=CONCAT(@chdCol,'-','art_inc_id');

end if;



if  OLD.art_inc_survey !="" OR OLD.art_inc_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_survey);



	set @chdCol=CONCAT(@chdCol,'-','art_inc_survey');

end if;



if  OLD.art_inc_part_id !="" OR OLD.art_inc_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_part_id);



	set @chdCol=CONCAT(@chdCol,'-','art_inc_part_id');

end if;



if  OLD.art_inc_visitdate !="" OR OLD.art_inc_visitdate is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_visitdate);



	set @chdCol=CONCAT(@chdCol,'-','art_inc_visitdate');

end if;



if  OLD.art_inc_q1 !="" OR OLD.art_inc_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_q1);



	set @chdCol=CONCAT(@chdCol,'-','art_inc_q1');

end if;



if  OLD.art_inc_q2 !="" OR OLD.art_inc_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_q2);



	set @chdCol=CONCAT(@chdCol,'-','art_inc_q2');

end if;



if  OLD.art_inc_q3 !="" OR OLD.art_inc_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_q3);



	set @chdCol=CONCAT(@chdCol,'-','art_inc_q3');

end if;



if  OLD.art_inc_q4 !="" OR OLD.art_inc_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_q4);



	set @chdCol=CONCAT(@chdCol,'-','art_inc_q4');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_artincenmaster(art_inc_survey,art_inc_part_id,art_inc_visitdate,art_inc_q1,art_inc_q2,art_inc_q3,art_inc_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.art_inc_survey,OLD.art_inc_part_id,OLD.art_inc_visitdate,OLD.art_inc_q1,OLD.art_inc_q2,OLD.art_inc_q3,OLD.art_inc_q4,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_artincenmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_artincenmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_artincenmaster_INSERT` AFTER INSERT ON `cms_artincenmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.art_inc_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.art_inc_id);

set @chdCol=CONCAT(@chdCol,'-','art_inc_id');

set @newVal =CONCAT(@newVal,'-', NEW.art_inc_survey);

set @chdCol=CONCAT(@chdCol,'-','art_inc_survey');

set @newVal =CONCAT(@newVal,'-', NEW.art_inc_part_id);

set @chdCol=CONCAT(@chdCol,'-','art_inc_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.art_inc_visitdate);

set @chdCol=CONCAT(@chdCol,'-','art_inc_visitdate');

set @newVal =CONCAT(@newVal,'-', NEW.art_inc_q1);

set @chdCol=CONCAT(@chdCol,'-','art_inc_q1');

set @newVal =CONCAT(@newVal,'-', NEW.art_inc_q2);

set @chdCol=CONCAT(@chdCol,'-','art_inc_q2');

set @newVal =CONCAT(@newVal,'-', NEW.art_inc_q3);

set @chdCol=CONCAT(@chdCol,'-','art_inc_q3');

set @newVal =CONCAT(@newVal,'-', NEW.art_inc_q4);

set @chdCol=CONCAT(@chdCol,'-','art_inc_q4');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_artincenmaster(art_inc_survey,art_inc_part_id,art_inc_visitdate,art_inc_q1,art_inc_q2,art_inc_q3,art_inc_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.art_inc_survey,NEW.art_inc_part_id,NEW.art_inc_visitdate,NEW.art_inc_q1,NEW.art_inc_q2,NEW.art_inc_q3,NEW.art_inc_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_artincenmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_artincenmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_artincenmaster_UPDATE` BEFORE UPDATE ON `cms_artincenmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.art_inc_id;

set @userid=NEW.update_user;



if  OLD.art_inc_id != NEW.art_inc_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_id);

	set @newVal =CONCAT(@newVal,'-', NEW.art_inc_id);

	set @chdCol=CONCAT(@chdCol,'-','art_inc_id');

end if;



if  OLD.art_inc_survey != NEW.art_inc_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.art_inc_survey);

	set @chdCol=CONCAT(@chdCol,'-','art_inc_survey');

end if;



if  OLD.art_inc_part_id != NEW.art_inc_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.art_inc_part_id);

	set @chdCol=CONCAT(@chdCol,'-','art_inc_part_id');

end if;



if  OLD.art_inc_visitdate != NEW.art_inc_visitdate

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_visitdate);

	set @newVal =CONCAT(@newVal,'-', NEW.art_inc_visitdate);

	set @chdCol=CONCAT(@chdCol,'-','art_inc_visitdate');

end if;



if  OLD.art_inc_q1 != NEW.art_inc_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.art_inc_q1);

	set @chdCol=CONCAT(@chdCol,'-','art_inc_q1');

end if;



if  OLD.art_inc_q2 != NEW.art_inc_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.art_inc_q2);

	set @chdCol=CONCAT(@chdCol,'-','art_inc_q2');

end if;



if  OLD.art_inc_q3 != NEW.art_inc_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.art_inc_q3);

	set @chdCol=CONCAT(@chdCol,'-','art_inc_q3');

end if;



if  OLD.art_inc_q4 != NEW.art_inc_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_inc_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.art_inc_q4);

	set @chdCol=CONCAT(@chdCol,'-','art_inc_q4');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_artincenmaster(art_inc_survey,art_inc_part_id,art_inc_visitdate,art_inc_q1,art_inc_q2,art_inc_q3,art_inc_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.art_inc_survey,NEW.art_inc_part_id,NEW.art_inc_visitdate,NEW.art_inc_q1,NEW.art_inc_q2,NEW.art_inc_q3,NEW.art_inc_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_artincenmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_artinitiationincentmaster`
--

DROP TABLE IF EXISTS `cms_artinitiationincentmaster`;
CREATE TABLE IF NOT EXISTS `cms_artinitiationincentmaster` (
  `art_init_inc_id` int(11) NOT NULL AUTO_INCREMENT,
  `art_init_inc_survey` varchar(11) NOT NULL,
  `art_init_inc_part_id` varchar(11) NOT NULL,
  `art_init_inc_visitdate` int(11) NOT NULL,
  `art_init_inc_q1` int(11) NOT NULL,
  `art_init_inc_q2` int(11) NOT NULL,
  `art_init_inc_q3` int(11) NOT NULL,
  `art_init_inc_q4` varchar(50) NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) NOT NULL,
  PRIMARY KEY (`art_init_inc_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_artinitiationincentmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_artinitiationincentmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_artinitiationincentmaster_DELETE` BEFORE DELETE ON `cms_artinitiationincentmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.art_init_inc_id;

set @userid=OLD.update_user;



if  OLD.art_init_inc_id !="" OR OLD.art_init_inc_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_id);



	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_id');

end if;



if  OLD.art_init_inc_survey !="" OR OLD.art_init_inc_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_survey);



	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_survey');

end if;



if  OLD.art_init_inc_part_id !="" OR OLD.art_init_inc_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_part_id);



	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_part_id');

end if;



if  OLD.art_init_inc_visitdate !="" OR OLD.art_init_inc_visitdate is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_visitdate);



	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_visitdate');

end if;



if  OLD.art_init_inc_q1 !="" OR OLD.art_init_inc_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_q1);



	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_q1');

end if;



if  OLD.art_init_inc_q2 !="" OR OLD.art_init_inc_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_q2);



	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_q2');

end if;



if  OLD.art_init_inc_q3 !="" OR OLD.art_init_inc_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_q3);



	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_q3');

end if;



if  OLD.art_init_inc_q4 !="" OR OLD.art_init_inc_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_q4);



	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_q4');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_artinitiationincentmaster(art_init_inc_survey,art_init_inc_part_id,art_init_inc_visitdate,art_init_inc_q1,art_init_inc_q2,art_init_inc_q3,art_init_inc_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.art_init_inc_survey,OLD.art_init_inc_part_id,OLD.art_init_inc_visitdate,OLD.art_init_inc_q1,OLD.art_init_inc_q2,OLD.art_init_inc_q3,OLD.art_init_inc_q4,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_artinitiationincentmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_artinitiationincentmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_artinitiationincentmaster_INSERT` AFTER INSERT ON `cms_artinitiationincentmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.art_init_inc_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_id);

set @chdCol=CONCAT(@chdCol,'-','art_init_inc_id');

set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_survey);

set @chdCol=CONCAT(@chdCol,'-','art_init_inc_survey');

set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_part_id);

set @chdCol=CONCAT(@chdCol,'-','art_init_inc_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_visitdate);

set @chdCol=CONCAT(@chdCol,'-','art_init_inc_visitdate');

set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_q1);

set @chdCol=CONCAT(@chdCol,'-','art_init_inc_q1');

set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_q2);

set @chdCol=CONCAT(@chdCol,'-','art_init_inc_q2');

set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_q3);

set @chdCol=CONCAT(@chdCol,'-','art_init_inc_q3');

set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_q4);

set @chdCol=CONCAT(@chdCol,'-','art_init_inc_q4');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_artinitiationincentmaster(art_init_inc_survey,art_init_inc_part_id,art_init_inc_visitdate,art_init_inc_q1,art_init_inc_q2,art_init_inc_q3,art_init_inc_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.art_init_inc_survey,NEW.art_init_inc_part_id,NEW.art_init_inc_visitdate,NEW.art_init_inc_q1,NEW.art_init_inc_q2,NEW.art_init_inc_q3,NEW.art_init_inc_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_artinitiationincentmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_artinitiationincentmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_artinitiationincentmaster_UPDATE` BEFORE UPDATE ON `cms_artinitiationincentmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.art_init_inc_id;

set @userid=NEW.update_user;



if  OLD.art_init_inc_id != NEW.art_init_inc_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_id);

	set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_id);

	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_id');

end if;



if  OLD.art_init_inc_survey != NEW.art_init_inc_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_survey);

	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_survey');

end if;



if  OLD.art_init_inc_part_id != NEW.art_init_inc_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_part_id);

	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_part_id');

end if;



if  OLD.art_init_inc_visitdate != NEW.art_init_inc_visitdate

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_visitdate);

	set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_visitdate);

	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_visitdate');

end if;



if  OLD.art_init_inc_q1 != NEW.art_init_inc_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_q1);

	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_q1');

end if;



if  OLD.art_init_inc_q2 != NEW.art_init_inc_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_q2);

	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_q2');

end if;



if  OLD.art_init_inc_q3 != NEW.art_init_inc_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_q3);

	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_q3');

end if;



if  OLD.art_init_inc_q4 != NEW.art_init_inc_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.art_init_inc_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.art_init_inc_q4);

	set @chdCol=CONCAT(@chdCol,'-','art_init_inc_q4');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_artinitiationincentmaster(art_init_inc_survey,art_init_inc_part_id,art_init_inc_visitdate,art_init_inc_q1,art_init_inc_q2,art_init_inc_q3,art_init_inc_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.art_init_inc_survey,NEW.art_init_inc_part_id,NEW.art_init_inc_visitdate,NEW.art_init_inc_q1,NEW.art_init_inc_q2,NEW.art_init_inc_q3,NEW.art_init_inc_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_artinitiationincentmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_arvmaster`
--

DROP TABLE IF EXISTS `cms_arvmaster`;
CREATE TABLE IF NOT EXISTS `cms_arvmaster` (
  `arv_mstr_id` int(11) NOT NULL AUTO_INCREMENT,
  `arv_mstr_code` text NOT NULL,
  `arv_mstr_name` text NOT NULL,
  `arv_mstr_qty` int(11) NOT NULL,
  `arv_mstr_dose` varchar(3) NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`arv_mstr_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;

--
-- Dumping data for table `cms_arvmaster`
--

INSERT INTO `cms_arvmaster` (`arv_mstr_id`, `arv_mstr_code`, `arv_mstr_name`, `arv_mstr_qty`, `arv_mstr_dose`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(1, '1', 'N', 60, 'BD', '1', 1488017806, 1, 1499409409, 13, 1487980800),
(2, '2', 'E', 30, 'OD', '1', 1488017862, 1, 1499409417, 13, 1487980800),
(3, '3', 'ZL', 60, 'BD', '1', 1488017916, 1, 1499409426, 13, 1487980800),
(4, '4', 'TL', 30, 'OD', '1', 1488018170, 1, 1499409434, 13, 1487980800),
(5, '5', 'ZLN', 60, 'BD', '1', 1488018184, 1, 1499409442, 13, 1487980800),
(6, '6', 'TLE', 30, 'OD', '1', 1488018311, 1, 1499409452, 13, 1487980800),
(7, '7', 'ATV/RTV', 30, 'OD', '1', 1488018362, 1, 1499409461, 13, 1487980800),
(8, '8', 'LPV/RTV', 120, '2BD', '1', 1488018395, 1, 1499409471, 13, 1487980800),
(9, '9', 'DRV', 60, 'BD', '1', 1488018471, 1, 1499409480, 13, 1487980800),
(10, '10', 'RTV-100', 60, 'BD', '1', 1488018492, 1, 1499409489, 13, 1487980800),
(11, '11', 'ABC', 30, 'BD', '1', 1488018664, 1, 1499409498, 13, 1487980800);

--
-- Triggers `cms_arvmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_arvmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_arvmaster_DELETE` BEFORE DELETE ON `cms_arvmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.arv_mstr_id;

set @userid=OLD.update_user;



if  OLD.arv_mstr_id !="" OR OLD.arv_mstr_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.arv_mstr_id);



	set @chdCol=CONCAT(@chdCol,'-','arv_mstr_id');

end if;



if  OLD.arv_mstr_code !="" OR OLD.arv_mstr_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.arv_mstr_code);



	set @chdCol=CONCAT(@chdCol,'-','arv_mstr_code');

end if;



if  OLD.arv_mstr_name !="" OR OLD.arv_mstr_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.arv_mstr_name);



	set @chdCol=CONCAT(@chdCol,'-','arv_mstr_name');

end if;



if  OLD.arv_mstr_qty !="" OR OLD.arv_mstr_qty is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.arv_mstr_qty);



	set @chdCol=CONCAT(@chdCol,'-','arv_mstr_qty');

end if;



if  OLD.arv_mstr_dose !="" OR OLD.arv_mstr_dose is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.arv_mstr_dose);



	set @chdCol=CONCAT(@chdCol,'-','arv_mstr_dose');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_arvmaster(arv_mstr_code,arv_mstr_name,arv_mstr_qty,arv_mstr_dose,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.arv_mstr_code,OLD.arv_mstr_name,OLD.arv_mstr_qty,OLD.arv_mstr_dose,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_arvmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_arvmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_arvmaster_INSERT` AFTER INSERT ON `cms_arvmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.arv_mstr_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.arv_mstr_id);

set @chdCol=CONCAT(@chdCol,'-','arv_mstr_id');

set @newVal =CONCAT(@newVal,'-', NEW.arv_mstr_code);

set @chdCol=CONCAT(@chdCol,'-','arv_mstr_code');

set @newVal =CONCAT(@newVal,'-', NEW.arv_mstr_name);

set @chdCol=CONCAT(@chdCol,'-','arv_mstr_name');

set @newVal =CONCAT(@newVal,'-', NEW.arv_mstr_qty);

set @chdCol=CONCAT(@chdCol,'-','arv_mstr_qty');

set @newVal =CONCAT(@newVal,'-', NEW.arv_mstr_dose);

set @chdCol=CONCAT(@chdCol,'-','arv_mstr_dose');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_arvmaster(arv_mstr_code,arv_mstr_name,arv_mstr_qty,arv_mstr_dose,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.arv_mstr_code,NEW.arv_mstr_name,NEW.arv_mstr_qty,NEW.arv_mstr_dose,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_arvmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_arvmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_arvmaster_UPDATE` BEFORE UPDATE ON `cms_arvmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.arv_mstr_id;

set @userid=NEW.update_user;



if  OLD.arv_mstr_id != NEW.arv_mstr_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.arv_mstr_id);

	set @newVal =CONCAT(@newVal,'-', NEW.arv_mstr_id);

	set @chdCol=CONCAT(@chdCol,'-','arv_mstr_id');

end if;



if  OLD.arv_mstr_code != NEW.arv_mstr_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.arv_mstr_code);

	set @newVal =CONCAT(@newVal,'-', NEW.arv_mstr_code);

	set @chdCol=CONCAT(@chdCol,'-','arv_mstr_code');

end if;



if  OLD.arv_mstr_name != NEW.arv_mstr_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.arv_mstr_name);

	set @newVal =CONCAT(@newVal,'-', NEW.arv_mstr_name);

	set @chdCol=CONCAT(@chdCol,'-','arv_mstr_name');

end if;



if  OLD.arv_mstr_qty != NEW.arv_mstr_qty

then

	set @oldval =CONCAT(@oldVal,'-',OLD.arv_mstr_qty);

	set @newVal =CONCAT(@newVal,'-', NEW.arv_mstr_qty);

	set @chdCol=CONCAT(@chdCol,'-','arv_mstr_qty');

end if;



if  OLD.arv_mstr_dose != NEW.arv_mstr_dose

then

	set @oldval =CONCAT(@oldVal,'-',OLD.arv_mstr_dose);

	set @newVal =CONCAT(@newVal,'-', NEW.arv_mstr_dose);

	set @chdCol=CONCAT(@chdCol,'-','arv_mstr_dose');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_arvmaster(arv_mstr_code,arv_mstr_name,arv_mstr_qty,arv_mstr_dose,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.arv_mstr_code,NEW.arv_mstr_name,NEW.arv_mstr_qty,NEW.arv_mstr_dose,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_arvmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_attandance`
--

DROP TABLE IF EXISTS `cms_attandance`;
CREATE TABLE IF NOT EXISTS `cms_attandance` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sid` varchar(20) NOT NULL,
  `location` varchar(20) NOT NULL,
  `pid` varchar(20) NOT NULL,
  `participant_id` varchar(20) DEFAULT NULL,
  `interviewer` varchar(3) NOT NULL DEFAULT '999',
  `visit` int(11) NOT NULL,
  `visit_date` int(11) NOT NULL,
  `visit_in` int(11) DEFAULT NULL,
  `out_interviewer` varchar(3) DEFAULT NULL,
  `visit_out` int(11) DEFAULT NULL,
  `remarks` varchar(250) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  `NextVisit_Date` int(11) DEFAULT NULL,
  `Injection` varchar(1) DEFAULT NULL,
  `ARM` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `pid` (`pid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_attandance`
--
DROP TRIGGER IF EXISTS `attandance_update_trigger`;
DELIMITER //
CREATE TRIGGER `attandance_update_trigger` BEFORE INSERT ON `cms_attandance`
 FOR EACH ROW BEGIN





  IF ((NEW.pid IS NULL OR NEW.pid = '') AND (NEW.participant_id IS NOT NULL OR NEW.participant_id != '')) THEN



    SET NEW.pid = NEW.participant_id;



  END IF;



  IF ((NEW.pid IS NOT NULL OR NEW.pid != '') AND (NEW.participant_id IS NULL OR NEW.participant_id = '')) THEN



    SET NEW.participant_id = NEW.pid;



  END IF;



  IF (NEW.location IS NULL OR NEW.location = '') THEN



    SET @Loc :=(SELECT app_location FROM cms_appsettings);

    SET NEW.location = @Loc;



  END IF;



  IF (NEW.sid IS NULL OR NEW.sid = '') THEN



    SET NEW.sid = "ICC+";



  END IF;



  IF (NEW.visit_in IS NULL OR NEW.visit_in = '') THEN



    SET NEW.visit_in = UNIX_TIMESTAMP(NOW());



  END IF;



  IF (NEW.status IS NULL OR NEW.status = '') THEN



    SET NEW.status = 1;



  END IF;



  IF (NEW.create_time IS NULL OR NEW.create_time = '') THEN



    SET NEW.create_time = UNIX_TIMESTAMP(NOW());



  END IF;



  IF (NEW.record_date IS NULL OR NEW.record_date = '') THEN



    SET NEW.record_date = NEW.visit_date;



  END IF;

	

END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_attandance_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_attandance_DELETE` BEFORE DELETE ON `cms_attandance`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.id;

set @userid=OLD.update_user;



if  OLD.id !="" OR OLD.id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.id);



	set @chdCol=CONCAT(@chdCol,'-','id');

end if;



if  OLD.sid !="" OR OLD.sid is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sid);



	set @chdCol=CONCAT(@chdCol,'-','sid');

end if;



if  OLD.location !="" OR OLD.location is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.location);



	set @chdCol=CONCAT(@chdCol,'-','location');

end if;



if  OLD.pid !="" OR OLD.pid is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pid);



	set @chdCol=CONCAT(@chdCol,'-','pid');

end if;



if  OLD.participant_id !="" OR OLD.participant_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.participant_id);



	set @chdCol=CONCAT(@chdCol,'-','participant_id');

end if;



if  OLD.interviewer !="" OR OLD.interviewer is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.interviewer);



	set @chdCol=CONCAT(@chdCol,'-','interviewer');

end if;



if  OLD.visit !="" OR OLD.visit is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit);



	set @chdCol=CONCAT(@chdCol,'-','visit');

end if;



if  OLD.visit_date !="" OR OLD.visit_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_date);



	set @chdCol=CONCAT(@chdCol,'-','visit_date');

end if;



if  OLD.visit_in !="" OR OLD.visit_in is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_in);



	set @chdCol=CONCAT(@chdCol,'-','visit_in');

end if;



if  OLD.out_interviewer !="" OR OLD.out_interviewer is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.out_interviewer);



	set @chdCol=CONCAT(@chdCol,'-','out_interviewer');

end if;



if  OLD.visit_out !="" OR OLD.visit_out is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_out);



	set @chdCol=CONCAT(@chdCol,'-','visit_out');

end if;



if  OLD.remarks !="" OR OLD.remarks is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.remarks);



	set @chdCol=CONCAT(@chdCol,'-','remarks');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;



if  OLD.NextVisit_Date !="" OR OLD.NextVisit_Date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.NextVisit_Date);



	set @chdCol=CONCAT(@chdCol,'-','NextVisit_Date');

end if;



if  OLD.Injection !="" OR OLD.Injection is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.Injection);



	set @chdCol=CONCAT(@chdCol,'-','Injection');

end if;



if  OLD.ARM !="" OR OLD.ARM is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ARM);



	set @chdCol=CONCAT(@chdCol,'-','ARM');

end if;







INSERT INTO mirror_iccplus.cms_attandance(sid,location,pid,participant_id,interviewer,visit,visit_date,visit_in,out_interviewer,visit_out,remarks,status,create_time,create_user,update_time,update_user,record_date,NextVisit_Date,Injection,ARM) VALUES(OLD.sid,OLD.location,OLD.pid,OLD.participant_id,OLD.interviewer,OLD.visit,OLD.visit_date,OLD.visit_in,OLD.out_interviewer,OLD.visit_out,OLD.remarks,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date,OLD.NextVisit_Date,OLD.Injection,OLD.ARM);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_attandance', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_attandance_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_attandance_INSERT` AFTER INSERT ON `cms_attandance`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.id);

set @chdCol=CONCAT(@chdCol,'-','id');

set @newVal =CONCAT(@newVal,'-', NEW.sid);

set @chdCol=CONCAT(@chdCol,'-','sid');

set @newVal =CONCAT(@newVal,'-', NEW.location);

set @chdCol=CONCAT(@chdCol,'-','location');

set @newVal =CONCAT(@newVal,'-', NEW.pid);

set @chdCol=CONCAT(@chdCol,'-','pid');

set @newVal =CONCAT(@newVal,'-', NEW.participant_id);

set @chdCol=CONCAT(@chdCol,'-','participant_id');

set @newVal =CONCAT(@newVal,'-', NEW.interviewer);

set @chdCol=CONCAT(@chdCol,'-','interviewer');

set @newVal =CONCAT(@newVal,'-', NEW.visit);

set @chdCol=CONCAT(@chdCol,'-','visit');

set @newVal =CONCAT(@newVal,'-', NEW.visit_date);

set @chdCol=CONCAT(@chdCol,'-','visit_date');

set @newVal =CONCAT(@newVal,'-', NEW.visit_in);

set @chdCol=CONCAT(@chdCol,'-','visit_in');

set @newVal =CONCAT(@newVal,'-', NEW.out_interviewer);

set @chdCol=CONCAT(@chdCol,'-','out_interviewer');

set @newVal =CONCAT(@newVal,'-', NEW.visit_out);

set @chdCol=CONCAT(@chdCol,'-','visit_out');

set @newVal =CONCAT(@newVal,'-', NEW.remarks);

set @chdCol=CONCAT(@chdCol,'-','remarks');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');

set @newVal =CONCAT(@newVal,'-', NEW.NextVisit_Date);

set @chdCol=CONCAT(@chdCol,'-','NextVisit_Date');

set @newVal =CONCAT(@newVal,'-', NEW.Injection);

set @chdCol=CONCAT(@chdCol,'-','Injection');

set @newVal =CONCAT(@newVal,'-', NEW.ARM);

set @chdCol=CONCAT(@chdCol,'-','ARM');





INSERT INTO mirror_iccplus.cms_attandance(sid,location,pid,participant_id,interviewer,visit,visit_date,visit_in,out_interviewer,visit_out,remarks,status,create_time,create_user,update_time,update_user,record_date,NextVisit_Date,Injection,ARM) VALUES(NEW.sid,NEW.location,NEW.pid,NEW.participant_id,NEW.interviewer,NEW.visit,NEW.visit_date,NEW.visit_in,NEW.out_interviewer,NEW.visit_out,NEW.remarks,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date,NEW.NextVisit_Date,NEW.Injection,NEW.ARM);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_attandance', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_attandance_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_attandance_UPDATE` BEFORE UPDATE ON `cms_attandance`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.id;

set @userid=NEW.update_user;



IF (NEW.update_time IS NULL OR NEW.update_time = '') THEN

    SET NEW.update_time = NEW.visit_out;

END IF;



if  OLD.id != NEW.id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.id);

	set @newVal =CONCAT(@newVal,'-', NEW.id);

	set @chdCol=CONCAT(@chdCol,'-','id');

end if;



if  OLD.sid != NEW.sid

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sid);

	set @newVal =CONCAT(@newVal,'-', NEW.sid);

	set @chdCol=CONCAT(@chdCol,'-','sid');

end if;



if  OLD.location != NEW.location

then

	set @oldval =CONCAT(@oldVal,'-',OLD.location);

	set @newVal =CONCAT(@newVal,'-', NEW.location);

	set @chdCol=CONCAT(@chdCol,'-','location');

end if;



if  OLD.pid != NEW.pid

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pid);

	set @newVal =CONCAT(@newVal,'-', NEW.pid);

	set @chdCol=CONCAT(@chdCol,'-','pid');

end if;



if  OLD.participant_id != NEW.participant_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.participant_id);

	set @newVal =CONCAT(@newVal,'-', NEW.participant_id);

	set @chdCol=CONCAT(@chdCol,'-','participant_id');

end if;



if  OLD.interviewer != NEW.interviewer

then

	set @oldval =CONCAT(@oldVal,'-',OLD.interviewer);

	set @newVal =CONCAT(@newVal,'-', NEW.interviewer);

	set @chdCol=CONCAT(@chdCol,'-','interviewer');

end if;



if  OLD.visit != NEW.visit

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit);

	set @newVal =CONCAT(@newVal,'-', NEW.visit);

	set @chdCol=CONCAT(@chdCol,'-','visit');

end if;



if  OLD.visit_date != NEW.visit_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_date);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_date);

	set @chdCol=CONCAT(@chdCol,'-','visit_date');

end if;



if  OLD.visit_in != NEW.visit_in

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_in);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_in);

	set @chdCol=CONCAT(@chdCol,'-','visit_in');

end if;



if  OLD.out_interviewer != NEW.out_interviewer

then

	set @oldval =CONCAT(@oldVal,'-',OLD.out_interviewer);

	set @newVal =CONCAT(@newVal,'-', NEW.out_interviewer);

	set @chdCol=CONCAT(@chdCol,'-','out_interviewer');

end if;



if  OLD.visit_out != NEW.visit_out

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_out);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_out);

	set @chdCol=CONCAT(@chdCol,'-','visit_out');

end if;



if  OLD.remarks != NEW.remarks

then

	set @oldval =CONCAT(@oldVal,'-',OLD.remarks);

	set @newVal =CONCAT(@newVal,'-', NEW.remarks);

	set @chdCol=CONCAT(@chdCol,'-','remarks');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;



if  OLD.NextVisit_Date != NEW.NextVisit_Date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.NextVisit_Date);

	set @newVal =CONCAT(@newVal,'-', NEW.NextVisit_Date);

	set @chdCol=CONCAT(@chdCol,'-','NextVisit_Date');

end if;



if  OLD.Injection != NEW.Injection

then

	set @oldval =CONCAT(@oldVal,'-',OLD.Injection);

	set @newVal =CONCAT(@newVal,'-', NEW.Injection);

	set @chdCol=CONCAT(@chdCol,'-','Injection');

end if;



if  OLD.ARM != NEW.ARM

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ARM);

	set @newVal =CONCAT(@newVal,'-', NEW.ARM);

	set @chdCol=CONCAT(@chdCol,'-','ARM');

end if;







INSERT INTO mirror_iccplus.cms_attandance(sid,location,pid,participant_id,interviewer,visit,visit_date,visit_in,out_interviewer,visit_out,remarks,status,create_time,create_user,update_time,update_user,record_date,NextVisit_Date,Injection,ARM) VALUES(NEW.sid,NEW.location,NEW.pid,NEW.participant_id,NEW.interviewer,NEW.visit,NEW.visit_date,NEW.visit_in,NEW.out_interviewer,NEW.visit_out,NEW.remarks,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date,NEW.NextVisit_Date,NEW.Injection,NEW.ARM);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_attandance', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_baseline_demographics`
--

DROP TABLE IF EXISTS `cms_baseline_demographics`;
CREATE TABLE IF NOT EXISTS `cms_baseline_demographics` (
  `demographics_id` int(11) NOT NULL AUTO_INCREMENT,
  `demographics_survey` varchar(11) NOT NULL,
  `demographics_loc` varchar(11) NOT NULL,
  `demographics_part_id` varchar(11) NOT NULL,
  `visit_code` varchar(20) NOT NULL,
  `demographics_q1` int(11) NOT NULL,
  `demographics_q2` int(11) NOT NULL,
  `demographics_q3` int(11) NOT NULL,
  `demographics_q4` int(11) NOT NULL,
  `demographics_q5` int(11) NOT NULL,
  `demographics_q6` int(11) NOT NULL,
  `demographics_q7` int(11) NOT NULL,
  `demographics_q8` int(11) NOT NULL,
  `demographics_q9` int(11) NOT NULL,
  `demographics_q10` int(11) NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`demographics_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_baseline_demographics`
--
DROP TRIGGER IF EXISTS `trig_cms_baseline_demographics_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_demographics_DELETE` BEFORE DELETE ON `cms_baseline_demographics`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.demographics_id;

set @userid=OLD.update_user;



if  OLD.demographics_id !="" OR OLD.demographics_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_id);



	set @chdCol=CONCAT(@chdCol,'-','demographics_id');

end if;



if  OLD.demographics_survey !="" OR OLD.demographics_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_survey);



	set @chdCol=CONCAT(@chdCol,'-','demographics_survey');

end if;



if  OLD.demographics_loc !="" OR OLD.demographics_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_loc);



	set @chdCol=CONCAT(@chdCol,'-','demographics_loc');

end if;



if  OLD.demographics_part_id !="" OR OLD.demographics_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_part_id);



	set @chdCol=CONCAT(@chdCol,'-','demographics_part_id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.demographics_q1 !="" OR OLD.demographics_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q1);



	set @chdCol=CONCAT(@chdCol,'-','demographics_q1');

end if;



if  OLD.demographics_q2 !="" OR OLD.demographics_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q2);



	set @chdCol=CONCAT(@chdCol,'-','demographics_q2');

end if;



if  OLD.demographics_q3 !="" OR OLD.demographics_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q3);



	set @chdCol=CONCAT(@chdCol,'-','demographics_q3');

end if;



if  OLD.demographics_q4 !="" OR OLD.demographics_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q4);



	set @chdCol=CONCAT(@chdCol,'-','demographics_q4');

end if;



if  OLD.demographics_q5 !="" OR OLD.demographics_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q5);



	set @chdCol=CONCAT(@chdCol,'-','demographics_q5');

end if;



if  OLD.demographics_q6 !="" OR OLD.demographics_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q6);



	set @chdCol=CONCAT(@chdCol,'-','demographics_q6');

end if;



if  OLD.demographics_q7 !="" OR OLD.demographics_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q7);



	set @chdCol=CONCAT(@chdCol,'-','demographics_q7');

end if;



if  OLD.demographics_q8 !="" OR OLD.demographics_q8 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q8);



	set @chdCol=CONCAT(@chdCol,'-','demographics_q8');

end if;



if  OLD.demographics_q9 !="" OR OLD.demographics_q9 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q9);



	set @chdCol=CONCAT(@chdCol,'-','demographics_q9');

end if;



if  OLD.demographics_q10 !="" OR OLD.demographics_q10 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q10);



	set @chdCol=CONCAT(@chdCol,'-','demographics_q10');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_demographics(demographics_survey,demographics_loc,demographics_part_id,visit_code,demographics_q1,demographics_q2,demographics_q3,demographics_q4,demographics_q5,demographics_q6,demographics_q7,demographics_q8,demographics_q9,demographics_q10,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.demographics_survey,OLD.demographics_loc,OLD.demographics_part_id,OLD.visit_code,OLD.demographics_q1,OLD.demographics_q2,OLD.demographics_q3,OLD.demographics_q4,OLD.demographics_q5,OLD.demographics_q6,OLD.demographics_q7,OLD.demographics_q8,OLD.demographics_q9,OLD.demographics_q10,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_demographics', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_demographics_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_demographics_INSERT` AFTER INSERT ON `cms_baseline_demographics`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.demographics_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.demographics_id);

set @chdCol=CONCAT(@chdCol,'-','demographics_id');

set @newVal =CONCAT(@newVal,'-', NEW.demographics_survey);

set @chdCol=CONCAT(@chdCol,'-','demographics_survey');

set @newVal =CONCAT(@newVal,'-', NEW.demographics_loc);

set @chdCol=CONCAT(@chdCol,'-','demographics_loc');

set @newVal =CONCAT(@newVal,'-', NEW.demographics_part_id);

set @chdCol=CONCAT(@chdCol,'-','demographics_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.demographics_q1);

set @chdCol=CONCAT(@chdCol,'-','demographics_q1');

set @newVal =CONCAT(@newVal,'-', NEW.demographics_q2);

set @chdCol=CONCAT(@chdCol,'-','demographics_q2');

set @newVal =CONCAT(@newVal,'-', NEW.demographics_q3);

set @chdCol=CONCAT(@chdCol,'-','demographics_q3');

set @newVal =CONCAT(@newVal,'-', NEW.demographics_q4);

set @chdCol=CONCAT(@chdCol,'-','demographics_q4');

set @newVal =CONCAT(@newVal,'-', NEW.demographics_q5);

set @chdCol=CONCAT(@chdCol,'-','demographics_q5');

set @newVal =CONCAT(@newVal,'-', NEW.demographics_q6);

set @chdCol=CONCAT(@chdCol,'-','demographics_q6');

set @newVal =CONCAT(@newVal,'-', NEW.demographics_q7);

set @chdCol=CONCAT(@chdCol,'-','demographics_q7');

set @newVal =CONCAT(@newVal,'-', NEW.demographics_q8);

set @chdCol=CONCAT(@chdCol,'-','demographics_q8');

set @newVal =CONCAT(@newVal,'-', NEW.demographics_q9);

set @chdCol=CONCAT(@chdCol,'-','demographics_q9');

set @newVal =CONCAT(@newVal,'-', NEW.demographics_q10);

set @chdCol=CONCAT(@chdCol,'-','demographics_q10');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_baseline_demographics(demographics_survey,demographics_loc,demographics_part_id,visit_code,demographics_q1,demographics_q2,demographics_q3,demographics_q4,demographics_q5,demographics_q6,demographics_q7,demographics_q8,demographics_q9,demographics_q10,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.demographics_survey,NEW.demographics_loc,NEW.demographics_part_id,NEW.visit_code,NEW.demographics_q1,NEW.demographics_q2,NEW.demographics_q3,NEW.demographics_q4,NEW.demographics_q5,NEW.demographics_q6,NEW.demographics_q7,NEW.demographics_q8,NEW.demographics_q9,NEW.demographics_q10,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_demographics', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_demographics_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_demographics_UPDATE` BEFORE UPDATE ON `cms_baseline_demographics`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.demographics_id;

set @userid=NEW.update_user;



if  OLD.demographics_id != NEW.demographics_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_id);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_id);

	set @chdCol=CONCAT(@chdCol,'-','demographics_id');

end if;



if  OLD.demographics_survey != NEW.demographics_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_survey);

	set @chdCol=CONCAT(@chdCol,'-','demographics_survey');

end if;



if  OLD.demographics_loc != NEW.demographics_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_loc);

	set @chdCol=CONCAT(@chdCol,'-','demographics_loc');

end if;



if  OLD.demographics_part_id != NEW.demographics_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_part_id);

	set @chdCol=CONCAT(@chdCol,'-','demographics_part_id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.demographics_q1 != NEW.demographics_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_q1);

	set @chdCol=CONCAT(@chdCol,'-','demographics_q1');

end if;



if  OLD.demographics_q2 != NEW.demographics_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_q2);

	set @chdCol=CONCAT(@chdCol,'-','demographics_q2');

end if;



if  OLD.demographics_q3 != NEW.demographics_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_q3);

	set @chdCol=CONCAT(@chdCol,'-','demographics_q3');

end if;



if  OLD.demographics_q4 != NEW.demographics_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_q4);

	set @chdCol=CONCAT(@chdCol,'-','demographics_q4');

end if;



if  OLD.demographics_q5 != NEW.demographics_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_q5);

	set @chdCol=CONCAT(@chdCol,'-','demographics_q5');

end if;



if  OLD.demographics_q6 != NEW.demographics_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_q6);

	set @chdCol=CONCAT(@chdCol,'-','demographics_q6');

end if;



if  OLD.demographics_q7 != NEW.demographics_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_q7);

	set @chdCol=CONCAT(@chdCol,'-','demographics_q7');

end if;



if  OLD.demographics_q8 != NEW.demographics_q8

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q8);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_q8);

	set @chdCol=CONCAT(@chdCol,'-','demographics_q8');

end if;



if  OLD.demographics_q9 != NEW.demographics_q9

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q9);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_q9);

	set @chdCol=CONCAT(@chdCol,'-','demographics_q9');

end if;



if  OLD.demographics_q10 != NEW.demographics_q10

then

	set @oldval =CONCAT(@oldVal,'-',OLD.demographics_q10);

	set @newVal =CONCAT(@newVal,'-', NEW.demographics_q10);

	set @chdCol=CONCAT(@chdCol,'-','demographics_q10');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_demographics(demographics_survey,demographics_loc,demographics_part_id,visit_code,demographics_q1,demographics_q2,demographics_q3,demographics_q4,demographics_q5,demographics_q6,demographics_q7,demographics_q8,demographics_q9,demographics_q10,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.demographics_survey,NEW.demographics_loc,NEW.demographics_part_id,NEW.visit_code,NEW.demographics_q1,NEW.demographics_q2,NEW.demographics_q3,NEW.demographics_q4,NEW.demographics_q5,NEW.demographics_q6,NEW.demographics_q7,NEW.demographics_q8,NEW.demographics_q9,NEW.demographics_q10,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_demographics', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_baseline_depression`
--

DROP TABLE IF EXISTS `cms_baseline_depression`;
CREATE TABLE IF NOT EXISTS `cms_baseline_depression` (
  `depression_id` int(11) NOT NULL AUTO_INCREMENT,
  `depression_survey` varchar(11) NOT NULL,
  `depression_loc` varchar(11) NOT NULL,
  `depression_part_id` varchar(11) NOT NULL,
  `visit_code` varchar(20) NOT NULL,
  `depression_q1` int(11) NOT NULL,
  `depression_q2` int(11) NOT NULL,
  `depression_q3` int(11) NOT NULL,
  `depression_q4` int(11) NOT NULL,
  `depression_q5` int(11) NOT NULL,
  `depression_q6` int(11) NOT NULL,
  `depression_q7` int(11) NOT NULL,
  `depression_q8` int(11) NOT NULL,
  `depression_q9` int(11) NOT NULL,
  `depression_q10` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`depression_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_baseline_depression`
--
DROP TRIGGER IF EXISTS `trig_cms_baseline_depression_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_depression_DELETE` BEFORE DELETE ON `cms_baseline_depression`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.depression_id;

set @userid=OLD.update_user;



if  OLD.depression_id !="" OR OLD.depression_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_id);



	set @chdCol=CONCAT(@chdCol,'-','depression_id');

end if;



if  OLD.depression_survey !="" OR OLD.depression_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_survey);



	set @chdCol=CONCAT(@chdCol,'-','depression_survey');

end if;



if  OLD.depression_loc !="" OR OLD.depression_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_loc);



	set @chdCol=CONCAT(@chdCol,'-','depression_loc');

end if;



if  OLD.depression_part_id !="" OR OLD.depression_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_part_id);



	set @chdCol=CONCAT(@chdCol,'-','depression_part_id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.depression_q1 !="" OR OLD.depression_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q1);



	set @chdCol=CONCAT(@chdCol,'-','depression_q1');

end if;



if  OLD.depression_q2 !="" OR OLD.depression_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q2);



	set @chdCol=CONCAT(@chdCol,'-','depression_q2');

end if;



if  OLD.depression_q3 !="" OR OLD.depression_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q3);



	set @chdCol=CONCAT(@chdCol,'-','depression_q3');

end if;



if  OLD.depression_q4 !="" OR OLD.depression_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q4);



	set @chdCol=CONCAT(@chdCol,'-','depression_q4');

end if;



if  OLD.depression_q5 !="" OR OLD.depression_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q5);



	set @chdCol=CONCAT(@chdCol,'-','depression_q5');

end if;



if  OLD.depression_q6 !="" OR OLD.depression_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q6);



	set @chdCol=CONCAT(@chdCol,'-','depression_q6');

end if;



if  OLD.depression_q7 !="" OR OLD.depression_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q7);



	set @chdCol=CONCAT(@chdCol,'-','depression_q7');

end if;



if  OLD.depression_q8 !="" OR OLD.depression_q8 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q8);



	set @chdCol=CONCAT(@chdCol,'-','depression_q8');

end if;



if  OLD.depression_q9 !="" OR OLD.depression_q9 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q9);



	set @chdCol=CONCAT(@chdCol,'-','depression_q9');

end if;



if  OLD.depression_q10 !="" OR OLD.depression_q10 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q10);



	set @chdCol=CONCAT(@chdCol,'-','depression_q10');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_depression(depression_survey,depression_loc,depression_part_id,visit_code,depression_q1,depression_q2,depression_q3,depression_q4,depression_q5,depression_q6,depression_q7,depression_q8,depression_q9,depression_q10,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.depression_survey,OLD.depression_loc,OLD.depression_part_id,OLD.visit_code,OLD.depression_q1,OLD.depression_q2,OLD.depression_q3,OLD.depression_q4,OLD.depression_q5,OLD.depression_q6,OLD.depression_q7,OLD.depression_q8,OLD.depression_q9,OLD.depression_q10,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_depression', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_depression_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_depression_INSERT` AFTER INSERT ON `cms_baseline_depression`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.depression_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.depression_id);

set @chdCol=CONCAT(@chdCol,'-','depression_id');

set @newVal =CONCAT(@newVal,'-', NEW.depression_survey);

set @chdCol=CONCAT(@chdCol,'-','depression_survey');

set @newVal =CONCAT(@newVal,'-', NEW.depression_loc);

set @chdCol=CONCAT(@chdCol,'-','depression_loc');

set @newVal =CONCAT(@newVal,'-', NEW.depression_part_id);

set @chdCol=CONCAT(@chdCol,'-','depression_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.depression_q1);

set @chdCol=CONCAT(@chdCol,'-','depression_q1');

set @newVal =CONCAT(@newVal,'-', NEW.depression_q2);

set @chdCol=CONCAT(@chdCol,'-','depression_q2');

set @newVal =CONCAT(@newVal,'-', NEW.depression_q3);

set @chdCol=CONCAT(@chdCol,'-','depression_q3');

set @newVal =CONCAT(@newVal,'-', NEW.depression_q4);

set @chdCol=CONCAT(@chdCol,'-','depression_q4');

set @newVal =CONCAT(@newVal,'-', NEW.depression_q5);

set @chdCol=CONCAT(@chdCol,'-','depression_q5');

set @newVal =CONCAT(@newVal,'-', NEW.depression_q6);

set @chdCol=CONCAT(@chdCol,'-','depression_q6');

set @newVal =CONCAT(@newVal,'-', NEW.depression_q7);

set @chdCol=CONCAT(@chdCol,'-','depression_q7');

set @newVal =CONCAT(@newVal,'-', NEW.depression_q8);

set @chdCol=CONCAT(@chdCol,'-','depression_q8');

set @newVal =CONCAT(@newVal,'-', NEW.depression_q9);

set @chdCol=CONCAT(@chdCol,'-','depression_q9');

set @newVal =CONCAT(@newVal,'-', NEW.depression_q10);

set @chdCol=CONCAT(@chdCol,'-','depression_q10');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_baseline_depression(depression_survey,depression_loc,depression_part_id,visit_code,depression_q1,depression_q2,depression_q3,depression_q4,depression_q5,depression_q6,depression_q7,depression_q8,depression_q9,depression_q10,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.depression_survey,NEW.depression_loc,NEW.depression_part_id,NEW.visit_code,NEW.depression_q1,NEW.depression_q2,NEW.depression_q3,NEW.depression_q4,NEW.depression_q5,NEW.depression_q6,NEW.depression_q7,NEW.depression_q8,NEW.depression_q9,NEW.depression_q10,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_depression', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_depression_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_depression_UPDATE` BEFORE UPDATE ON `cms_baseline_depression`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.depression_id;

set @userid=NEW.update_user;



if  OLD.depression_id != NEW.depression_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_id);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_id);

	set @chdCol=CONCAT(@chdCol,'-','depression_id');

end if;



if  OLD.depression_survey != NEW.depression_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_survey);

	set @chdCol=CONCAT(@chdCol,'-','depression_survey');

end if;



if  OLD.depression_loc != NEW.depression_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_loc);

	set @chdCol=CONCAT(@chdCol,'-','depression_loc');

end if;



if  OLD.depression_part_id != NEW.depression_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_part_id);

	set @chdCol=CONCAT(@chdCol,'-','depression_part_id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.depression_q1 != NEW.depression_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_q1);

	set @chdCol=CONCAT(@chdCol,'-','depression_q1');

end if;



if  OLD.depression_q2 != NEW.depression_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_q2);

	set @chdCol=CONCAT(@chdCol,'-','depression_q2');

end if;



if  OLD.depression_q3 != NEW.depression_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_q3);

	set @chdCol=CONCAT(@chdCol,'-','depression_q3');

end if;



if  OLD.depression_q4 != NEW.depression_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_q4);

	set @chdCol=CONCAT(@chdCol,'-','depression_q4');

end if;



if  OLD.depression_q5 != NEW.depression_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_q5);

	set @chdCol=CONCAT(@chdCol,'-','depression_q5');

end if;



if  OLD.depression_q6 != NEW.depression_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_q6);

	set @chdCol=CONCAT(@chdCol,'-','depression_q6');

end if;



if  OLD.depression_q7 != NEW.depression_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_q7);

	set @chdCol=CONCAT(@chdCol,'-','depression_q7');

end if;



if  OLD.depression_q8 != NEW.depression_q8

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q8);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_q8);

	set @chdCol=CONCAT(@chdCol,'-','depression_q8');

end if;



if  OLD.depression_q9 != NEW.depression_q9

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q9);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_q9);

	set @chdCol=CONCAT(@chdCol,'-','depression_q9');

end if;



if  OLD.depression_q10 != NEW.depression_q10

then

	set @oldval =CONCAT(@oldVal,'-',OLD.depression_q10);

	set @newVal =CONCAT(@newVal,'-', NEW.depression_q10);

	set @chdCol=CONCAT(@chdCol,'-','depression_q10');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_depression(depression_survey,depression_loc,depression_part_id,visit_code,depression_q1,depression_q2,depression_q3,depression_q4,depression_q5,depression_q6,depression_q7,depression_q8,depression_q9,depression_q10,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.depression_survey,NEW.depression_loc,NEW.depression_part_id,NEW.visit_code,NEW.depression_q1,NEW.depression_q2,NEW.depression_q3,NEW.depression_q4,NEW.depression_q5,NEW.depression_q6,NEW.depression_q7,NEW.depression_q8,NEW.depression_q9,NEW.depression_q10,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_depression', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_baseline_healthcareutilization`
--

DROP TABLE IF EXISTS `cms_baseline_healthcareutilization`;
CREATE TABLE IF NOT EXISTS `cms_baseline_healthcareutilization` (
  `health_care_utilization_id` int(11) NOT NULL AUTO_INCREMENT,
  `health_care_utilization_survey` varchar(11) NOT NULL,
  `health_care_utilization_loc` varchar(11) NOT NULL,
  `health_care_utilization_part_id` varchar(11) NOT NULL,
  `visit_code` varchar(20) NOT NULL,
  `health_care_utilization_q1a` int(11) NOT NULL,
  `health_care_utilization_q1b` int(11) DEFAULT NULL,
  `health_care_utilization_q1c` int(11) DEFAULT NULL,
  `health_care_utilization_q1d` int(11) DEFAULT NULL,
  `health_care_utilization_q2a` int(11) NOT NULL,
  `health_care_utilization_q2b` int(11) DEFAULT NULL,
  `health_care_utilization_q2c` int(11) DEFAULT NULL,
  `health_care_utilization_q2d` int(11) DEFAULT NULL,
  `health_care_utilization_q3a` int(11) NOT NULL,
  `health_care_utilization_q3b` int(11) DEFAULT NULL,
  `health_care_utilization_q3c` int(11) DEFAULT NULL,
  `health_care_utilization_q3d` int(11) DEFAULT NULL,
  `health_care_utilization_q4a` int(11) NOT NULL,
  `health_care_utilization_q4b` int(11) DEFAULT NULL,
  `health_care_utilization_q4c` int(11) DEFAULT NULL,
  `health_care_utilization_q4d` int(11) DEFAULT NULL,
  `health_care_utilization_q5a` int(11) NOT NULL,
  `health_care_utilization_q5b` int(11) DEFAULT NULL,
  `health_care_utilization_q5c` int(11) DEFAULT NULL,
  `health_care_utilization_q5d` int(11) DEFAULT NULL,
  `health_care_utilization_q6a` int(11) NOT NULL,
  `health_care_utilization_q6b` int(11) DEFAULT NULL,
  `health_care_utilization_q6c` int(11) DEFAULT NULL,
  `health_care_utilization_q6d` int(11) DEFAULT NULL,
  `health_care_utilization_q7` int(11) NOT NULL,
  `health_care_utilization_q8a` int(11) NOT NULL,
  `health_care_utilization_q8b` int(11) DEFAULT NULL,
  `health_care_utilization_q9a` int(11) NOT NULL,
  `health_care_utilization_q9b` int(11) DEFAULT NULL,
  `health_care_utilization_q10a` int(11) NOT NULL,
  `health_care_utilization_q10b` int(11) DEFAULT NULL,
  `health_care_utilization_q11a` int(11) NOT NULL,
  `health_care_utilization_q11b` int(11) DEFAULT NULL,
  `health_care_utilization_q12a` int(11) NOT NULL,
  `health_care_utilization_q12b` int(11) DEFAULT NULL,
  `health_care_utilization_q13` int(11) NOT NULL,
  `health_care_utilization_q14` int(11) NOT NULL,
  `health_care_utilization_q15` int(11) DEFAULT NULL,
  `health_care_utilization_q16` int(11) DEFAULT NULL,
  `health_care_utilization_q17` int(11) DEFAULT NULL,
  `health_care_utilization_q18` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`health_care_utilization_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_baseline_healthcareutilization`
--
DROP TRIGGER IF EXISTS `trig_cms_baseline_healthcareutilization_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_healthcareutilization_DELETE` BEFORE DELETE ON `cms_baseline_healthcareutilization`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.health_care_utilization_id;

set @userid=OLD.update_user;



if  OLD.health_care_utilization_id !="" OR OLD.health_care_utilization_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_id);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_id');

end if;



if  OLD.health_care_utilization_survey !="" OR OLD.health_care_utilization_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_survey);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_survey');

end if;



if  OLD.health_care_utilization_loc !="" OR OLD.health_care_utilization_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_loc);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_loc');

end if;



if  OLD.health_care_utilization_part_id !="" OR OLD.health_care_utilization_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_part_id);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_part_id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.health_care_utilization_q1a !="" OR OLD.health_care_utilization_q1a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q1a);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q1a');

end if;



if  OLD.health_care_utilization_q1b !="" OR OLD.health_care_utilization_q1b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q1b);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q1b');

end if;



if  OLD.health_care_utilization_q1c !="" OR OLD.health_care_utilization_q1c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q1c);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q1c');

end if;



if  OLD.health_care_utilization_q1d !="" OR OLD.health_care_utilization_q1d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q1d);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q1d');

end if;



if  OLD.health_care_utilization_q2a !="" OR OLD.health_care_utilization_q2a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q2a);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q2a');

end if;



if  OLD.health_care_utilization_q2b !="" OR OLD.health_care_utilization_q2b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q2b);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q2b');

end if;



if  OLD.health_care_utilization_q2c !="" OR OLD.health_care_utilization_q2c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q2c);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q2c');

end if;



if  OLD.health_care_utilization_q2d !="" OR OLD.health_care_utilization_q2d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q2d);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q2d');

end if;



if  OLD.health_care_utilization_q3a !="" OR OLD.health_care_utilization_q3a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q3a);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q3a');

end if;



if  OLD.health_care_utilization_q3b !="" OR OLD.health_care_utilization_q3b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q3b);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q3b');

end if;



if  OLD.health_care_utilization_q3c !="" OR OLD.health_care_utilization_q3c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q3c);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q3c');

end if;



if  OLD.health_care_utilization_q3d !="" OR OLD.health_care_utilization_q3d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q3d);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q3d');

end if;



if  OLD.health_care_utilization_q4a !="" OR OLD.health_care_utilization_q4a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q4a);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q4a');

end if;



if  OLD.health_care_utilization_q4b !="" OR OLD.health_care_utilization_q4b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q4b);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q4b');

end if;



if  OLD.health_care_utilization_q4c !="" OR OLD.health_care_utilization_q4c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q4c);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q4c');

end if;



if  OLD.health_care_utilization_q4d !="" OR OLD.health_care_utilization_q4d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q4d);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q4d');

end if;



if  OLD.health_care_utilization_q5a !="" OR OLD.health_care_utilization_q5a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q5a);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q5a');

end if;



if  OLD.health_care_utilization_q5b !="" OR OLD.health_care_utilization_q5b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q5b);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q5b');

end if;



if  OLD.health_care_utilization_q5c !="" OR OLD.health_care_utilization_q5c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q5c);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q5c');

end if;



if  OLD.health_care_utilization_q5d !="" OR OLD.health_care_utilization_q5d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q5d);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q5d');

end if;



if  OLD.health_care_utilization_q6a !="" OR OLD.health_care_utilization_q6a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q6a);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q6a');

end if;



if  OLD.health_care_utilization_q6b !="" OR OLD.health_care_utilization_q6b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q6b);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q6b');

end if;



if  OLD.health_care_utilization_q6c !="" OR OLD.health_care_utilization_q6c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q6c);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q6c');

end if;



if  OLD.health_care_utilization_q6d !="" OR OLD.health_care_utilization_q6d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q6d);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q6d');

end if;



if  OLD.health_care_utilization_q7 !="" OR OLD.health_care_utilization_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q7);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q7');

end if;



if  OLD.health_care_utilization_q8a !="" OR OLD.health_care_utilization_q8a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q8a);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q8a');

end if;



if  OLD.health_care_utilization_q8b !="" OR OLD.health_care_utilization_q8b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q8b);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q8b');

end if;



if  OLD.health_care_utilization_q9a !="" OR OLD.health_care_utilization_q9a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q9a);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q9a');

end if;



if  OLD.health_care_utilization_q9b !="" OR OLD.health_care_utilization_q9b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q9b);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q9b');

end if;



if  OLD.health_care_utilization_q10a !="" OR OLD.health_care_utilization_q10a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q10a);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q10a');

end if;



if  OLD.health_care_utilization_q10b !="" OR OLD.health_care_utilization_q10b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q10b);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q10b');

end if;



if  OLD.health_care_utilization_q11a !="" OR OLD.health_care_utilization_q11a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q11a);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q11a');

end if;



if  OLD.health_care_utilization_q11b !="" OR OLD.health_care_utilization_q11b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q11b);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q11b');

end if;



if  OLD.health_care_utilization_q12a !="" OR OLD.health_care_utilization_q12a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q12a);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q12a');

end if;



if  OLD.health_care_utilization_q12b !="" OR OLD.health_care_utilization_q12b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q12b);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q12b');

end if;



if  OLD.health_care_utilization_q13 !="" OR OLD.health_care_utilization_q13 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q13);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q13');

end if;



if  OLD.health_care_utilization_q14 !="" OR OLD.health_care_utilization_q14 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q14);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q14');

end if;



if  OLD.health_care_utilization_q15 !="" OR OLD.health_care_utilization_q15 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q15);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q15');

end if;



if  OLD.health_care_utilization_q16 !="" OR OLD.health_care_utilization_q16 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q16);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q16');

end if;



if  OLD.health_care_utilization_q17 !="" OR OLD.health_care_utilization_q17 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q17);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q17');

end if;



if  OLD.health_care_utilization_q18 !="" OR OLD.health_care_utilization_q18 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q18);



	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q18');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_healthcareutilization(health_care_utilization_survey,health_care_utilization_loc,health_care_utilization_part_id,visit_code,health_care_utilization_q1a,health_care_utilization_q1b,health_care_utilization_q1c,health_care_utilization_q1d,health_care_utilization_q2a,health_care_utilization_q2b,health_care_utilization_q2c,health_care_utilization_q2d,health_care_utilization_q3a,health_care_utilization_q3b,health_care_utilization_q3c,health_care_utilization_q3d,health_care_utilization_q4a,health_care_utilization_q4b,health_care_utilization_q4c,health_care_utilization_q4d,health_care_utilization_q5a,health_care_utilization_q5b,health_care_utilization_q5c,health_care_utilization_q5d,health_care_utilization_q6a,health_care_utilization_q6b,health_care_utilization_q6c,health_care_utilization_q6d,health_care_utilization_q7,health_care_utilization_q8a,health_care_utilization_q8b,health_care_utilization_q9a,health_care_utilization_q9b,health_care_utilization_q10a,health_care_utilization_q10b,health_care_utilization_q11a,health_care_utilization_q11b,health_care_utilization_q12a,health_care_utilization_q12b,health_care_utilization_q13,health_care_utilization_q14,health_care_utilization_q15,health_care_utilization_q16,health_care_utilization_q17,health_care_utilization_q18,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.health_care_utilization_survey,OLD.health_care_utilization_loc,OLD.health_care_utilization_part_id,OLD.visit_code,OLD.health_care_utilization_q1a,OLD.health_care_utilization_q1b,OLD.health_care_utilization_q1c,OLD.health_care_utilization_q1d,OLD.health_care_utilization_q2a,OLD.health_care_utilization_q2b,OLD.health_care_utilization_q2c,OLD.health_care_utilization_q2d,OLD.health_care_utilization_q3a,OLD.health_care_utilization_q3b,OLD.health_care_utilization_q3c,OLD.health_care_utilization_q3d,OLD.health_care_utilization_q4a,OLD.health_care_utilization_q4b,OLD.health_care_utilization_q4c,OLD.health_care_utilization_q4d,OLD.health_care_utilization_q5a,OLD.health_care_utilization_q5b,OLD.health_care_utilization_q5c,OLD.health_care_utilization_q5d,OLD.health_care_utilization_q6a,OLD.health_care_utilization_q6b,OLD.health_care_utilization_q6c,OLD.health_care_utilization_q6d,OLD.health_care_utilization_q7,OLD.health_care_utilization_q8a,OLD.health_care_utilization_q8b,OLD.health_care_utilization_q9a,OLD.health_care_utilization_q9b,OLD.health_care_utilization_q10a,OLD.health_care_utilization_q10b,OLD.health_care_utilization_q11a,OLD.health_care_utilization_q11b,OLD.health_care_utilization_q12a,OLD.health_care_utilization_q12b,OLD.health_care_utilization_q13,OLD.health_care_utilization_q14,OLD.health_care_utilization_q15,OLD.health_care_utilization_q16,OLD.health_care_utilization_q17,OLD.health_care_utilization_q18,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_healthcareutilization', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_healthcareutilization_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_healthcareutilization_INSERT` AFTER INSERT ON `cms_baseline_healthcareutilization`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.health_care_utilization_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_id);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_id');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_survey);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_survey');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_loc);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_loc');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_part_id);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q1a);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q1a');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q1b);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q1b');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q1c);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q1c');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q1d);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q1d');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q2a);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q2a');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q2b);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q2b');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q2c);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q2c');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q2d);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q2d');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q3a);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q3a');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q3b);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q3b');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q3c);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q3c');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q3d);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q3d');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q4a);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q4a');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q4b);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q4b');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q4c);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q4c');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q4d);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q4d');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q5a);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q5a');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q5b);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q5b');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q5c);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q5c');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q5d);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q5d');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q6a);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q6a');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q6b);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q6b');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q6c);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q6c');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q6d);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q6d');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q7);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q7');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q8a);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q8a');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q8b);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q8b');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q9a);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q9a');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q9b);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q9b');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q10a);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q10a');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q10b);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q10b');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q11a);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q11a');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q11b);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q11b');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q12a);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q12a');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q12b);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q12b');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q13);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q13');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q14);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q14');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q15);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q15');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q16);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q16');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q17);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q17');

set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q18);

set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q18');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_baseline_healthcareutilization(health_care_utilization_survey,health_care_utilization_loc,health_care_utilization_part_id,visit_code,health_care_utilization_q1a,health_care_utilization_q1b,health_care_utilization_q1c,health_care_utilization_q1d,health_care_utilization_q2a,health_care_utilization_q2b,health_care_utilization_q2c,health_care_utilization_q2d,health_care_utilization_q3a,health_care_utilization_q3b,health_care_utilization_q3c,health_care_utilization_q3d,health_care_utilization_q4a,health_care_utilization_q4b,health_care_utilization_q4c,health_care_utilization_q4d,health_care_utilization_q5a,health_care_utilization_q5b,health_care_utilization_q5c,health_care_utilization_q5d,health_care_utilization_q6a,health_care_utilization_q6b,health_care_utilization_q6c,health_care_utilization_q6d,health_care_utilization_q7,health_care_utilization_q8a,health_care_utilization_q8b,health_care_utilization_q9a,health_care_utilization_q9b,health_care_utilization_q10a,health_care_utilization_q10b,health_care_utilization_q11a,health_care_utilization_q11b,health_care_utilization_q12a,health_care_utilization_q12b,health_care_utilization_q13,health_care_utilization_q14,health_care_utilization_q15,health_care_utilization_q16,health_care_utilization_q17,health_care_utilization_q18,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.health_care_utilization_survey,NEW.health_care_utilization_loc,NEW.health_care_utilization_part_id,NEW.visit_code,NEW.health_care_utilization_q1a,NEW.health_care_utilization_q1b,NEW.health_care_utilization_q1c,NEW.health_care_utilization_q1d,NEW.health_care_utilization_q2a,NEW.health_care_utilization_q2b,NEW.health_care_utilization_q2c,NEW.health_care_utilization_q2d,NEW.health_care_utilization_q3a,NEW.health_care_utilization_q3b,NEW.health_care_utilization_q3c,NEW.health_care_utilization_q3d,NEW.health_care_utilization_q4a,NEW.health_care_utilization_q4b,NEW.health_care_utilization_q4c,NEW.health_care_utilization_q4d,NEW.health_care_utilization_q5a,NEW.health_care_utilization_q5b,NEW.health_care_utilization_q5c,NEW.health_care_utilization_q5d,NEW.health_care_utilization_q6a,NEW.health_care_utilization_q6b,NEW.health_care_utilization_q6c,NEW.health_care_utilization_q6d,NEW.health_care_utilization_q7,NEW.health_care_utilization_q8a,NEW.health_care_utilization_q8b,NEW.health_care_utilization_q9a,NEW.health_care_utilization_q9b,NEW.health_care_utilization_q10a,NEW.health_care_utilization_q10b,NEW.health_care_utilization_q11a,NEW.health_care_utilization_q11b,NEW.health_care_utilization_q12a,NEW.health_care_utilization_q12b,NEW.health_care_utilization_q13,NEW.health_care_utilization_q14,NEW.health_care_utilization_q15,NEW.health_care_utilization_q16,NEW.health_care_utilization_q17,NEW.health_care_utilization_q18,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_healthcareutilization', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_healthcareutilization_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_healthcareutilization_UPDATE` BEFORE UPDATE ON `cms_baseline_healthcareutilization`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.health_care_utilization_id;

set @userid=NEW.update_user;



if  OLD.health_care_utilization_id != NEW.health_care_utilization_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_id);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_id);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_id');

end if;



if  OLD.health_care_utilization_survey != NEW.health_care_utilization_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_survey);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_survey');

end if;



if  OLD.health_care_utilization_loc != NEW.health_care_utilization_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_loc);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_loc');

end if;



if  OLD.health_care_utilization_part_id != NEW.health_care_utilization_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_part_id);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_part_id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.health_care_utilization_q1a != NEW.health_care_utilization_q1a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q1a);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q1a);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q1a');

end if;



if  OLD.health_care_utilization_q1b != NEW.health_care_utilization_q1b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q1b);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q1b);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q1b');

end if;



if  OLD.health_care_utilization_q1c != NEW.health_care_utilization_q1c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q1c);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q1c);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q1c');

end if;



if  OLD.health_care_utilization_q1d != NEW.health_care_utilization_q1d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q1d);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q1d);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q1d');

end if;



if  OLD.health_care_utilization_q2a != NEW.health_care_utilization_q2a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q2a);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q2a);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q2a');

end if;



if  OLD.health_care_utilization_q2b != NEW.health_care_utilization_q2b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q2b);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q2b);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q2b');

end if;



if  OLD.health_care_utilization_q2c != NEW.health_care_utilization_q2c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q2c);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q2c);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q2c');

end if;



if  OLD.health_care_utilization_q2d != NEW.health_care_utilization_q2d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q2d);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q2d);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q2d');

end if;



if  OLD.health_care_utilization_q3a != NEW.health_care_utilization_q3a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q3a);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q3a);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q3a');

end if;



if  OLD.health_care_utilization_q3b != NEW.health_care_utilization_q3b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q3b);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q3b);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q3b');

end if;



if  OLD.health_care_utilization_q3c != NEW.health_care_utilization_q3c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q3c);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q3c);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q3c');

end if;



if  OLD.health_care_utilization_q3d != NEW.health_care_utilization_q3d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q3d);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q3d);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q3d');

end if;



if  OLD.health_care_utilization_q4a != NEW.health_care_utilization_q4a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q4a);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q4a);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q4a');

end if;



if  OLD.health_care_utilization_q4b != NEW.health_care_utilization_q4b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q4b);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q4b);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q4b');

end if;



if  OLD.health_care_utilization_q4c != NEW.health_care_utilization_q4c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q4c);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q4c);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q4c');

end if;



if  OLD.health_care_utilization_q4d != NEW.health_care_utilization_q4d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q4d);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q4d);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q4d');

end if;



if  OLD.health_care_utilization_q5a != NEW.health_care_utilization_q5a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q5a);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q5a);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q5a');

end if;



if  OLD.health_care_utilization_q5b != NEW.health_care_utilization_q5b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q5b);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q5b);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q5b');

end if;



if  OLD.health_care_utilization_q5c != NEW.health_care_utilization_q5c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q5c);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q5c);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q5c');

end if;



if  OLD.health_care_utilization_q5d != NEW.health_care_utilization_q5d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q5d);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q5d);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q5d');

end if;



if  OLD.health_care_utilization_q6a != NEW.health_care_utilization_q6a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q6a);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q6a);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q6a');

end if;



if  OLD.health_care_utilization_q6b != NEW.health_care_utilization_q6b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q6b);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q6b);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q6b');

end if;



if  OLD.health_care_utilization_q6c != NEW.health_care_utilization_q6c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q6c);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q6c);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q6c');

end if;



if  OLD.health_care_utilization_q6d != NEW.health_care_utilization_q6d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q6d);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q6d);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q6d');

end if;



if  OLD.health_care_utilization_q7 != NEW.health_care_utilization_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q7);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q7');

end if;



if  OLD.health_care_utilization_q8a != NEW.health_care_utilization_q8a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q8a);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q8a);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q8a');

end if;



if  OLD.health_care_utilization_q8b != NEW.health_care_utilization_q8b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q8b);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q8b);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q8b');

end if;



if  OLD.health_care_utilization_q9a != NEW.health_care_utilization_q9a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q9a);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q9a);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q9a');

end if;



if  OLD.health_care_utilization_q9b != NEW.health_care_utilization_q9b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q9b);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q9b);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q9b');

end if;



if  OLD.health_care_utilization_q10a != NEW.health_care_utilization_q10a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q10a);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q10a);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q10a');

end if;



if  OLD.health_care_utilization_q10b != NEW.health_care_utilization_q10b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q10b);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q10b);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q10b');

end if;



if  OLD.health_care_utilization_q11a != NEW.health_care_utilization_q11a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q11a);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q11a);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q11a');

end if;



if  OLD.health_care_utilization_q11b != NEW.health_care_utilization_q11b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q11b);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q11b);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q11b');

end if;



if  OLD.health_care_utilization_q12a != NEW.health_care_utilization_q12a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q12a);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q12a);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q12a');

end if;



if  OLD.health_care_utilization_q12b != NEW.health_care_utilization_q12b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q12b);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q12b);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q12b');

end if;



if  OLD.health_care_utilization_q13 != NEW.health_care_utilization_q13

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q13);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q13);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q13');

end if;



if  OLD.health_care_utilization_q14 != NEW.health_care_utilization_q14

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q14);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q14);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q14');

end if;



if  OLD.health_care_utilization_q15 != NEW.health_care_utilization_q15

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q15);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q15);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q15');

end if;



if  OLD.health_care_utilization_q16 != NEW.health_care_utilization_q16

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q16);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q16);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q16');

end if;



if  OLD.health_care_utilization_q17 != NEW.health_care_utilization_q17

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q17);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q17);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q17');

end if;



if  OLD.health_care_utilization_q18 != NEW.health_care_utilization_q18

then

	set @oldval =CONCAT(@oldVal,'-',OLD.health_care_utilization_q18);

	set @newVal =CONCAT(@newVal,'-', NEW.health_care_utilization_q18);

	set @chdCol=CONCAT(@chdCol,'-','health_care_utilization_q18');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_healthcareutilization(health_care_utilization_survey,health_care_utilization_loc,health_care_utilization_part_id,visit_code,health_care_utilization_q1a,health_care_utilization_q1b,health_care_utilization_q1c,health_care_utilization_q1d,health_care_utilization_q2a,health_care_utilization_q2b,health_care_utilization_q2c,health_care_utilization_q2d,health_care_utilization_q3a,health_care_utilization_q3b,health_care_utilization_q3c,health_care_utilization_q3d,health_care_utilization_q4a,health_care_utilization_q4b,health_care_utilization_q4c,health_care_utilization_q4d,health_care_utilization_q5a,health_care_utilization_q5b,health_care_utilization_q5c,health_care_utilization_q5d,health_care_utilization_q6a,health_care_utilization_q6b,health_care_utilization_q6c,health_care_utilization_q6d,health_care_utilization_q7,health_care_utilization_q8a,health_care_utilization_q8b,health_care_utilization_q9a,health_care_utilization_q9b,health_care_utilization_q10a,health_care_utilization_q10b,health_care_utilization_q11a,health_care_utilization_q11b,health_care_utilization_q12a,health_care_utilization_q12b,health_care_utilization_q13,health_care_utilization_q14,health_care_utilization_q15,health_care_utilization_q16,health_care_utilization_q17,health_care_utilization_q18,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.health_care_utilization_survey,NEW.health_care_utilization_loc,NEW.health_care_utilization_part_id,NEW.visit_code,NEW.health_care_utilization_q1a,NEW.health_care_utilization_q1b,NEW.health_care_utilization_q1c,NEW.health_care_utilization_q1d,NEW.health_care_utilization_q2a,NEW.health_care_utilization_q2b,NEW.health_care_utilization_q2c,NEW.health_care_utilization_q2d,NEW.health_care_utilization_q3a,NEW.health_care_utilization_q3b,NEW.health_care_utilization_q3c,NEW.health_care_utilization_q3d,NEW.health_care_utilization_q4a,NEW.health_care_utilization_q4b,NEW.health_care_utilization_q4c,NEW.health_care_utilization_q4d,NEW.health_care_utilization_q5a,NEW.health_care_utilization_q5b,NEW.health_care_utilization_q5c,NEW.health_care_utilization_q5d,NEW.health_care_utilization_q6a,NEW.health_care_utilization_q6b,NEW.health_care_utilization_q6c,NEW.health_care_utilization_q6d,NEW.health_care_utilization_q7,NEW.health_care_utilization_q8a,NEW.health_care_utilization_q8b,NEW.health_care_utilization_q9a,NEW.health_care_utilization_q9b,NEW.health_care_utilization_q10a,NEW.health_care_utilization_q10b,NEW.health_care_utilization_q11a,NEW.health_care_utilization_q11b,NEW.health_care_utilization_q12a,NEW.health_care_utilization_q12b,NEW.health_care_utilization_q13,NEW.health_care_utilization_q14,NEW.health_care_utilization_q15,NEW.health_care_utilization_q16,NEW.health_care_utilization_q17,NEW.health_care_utilization_q18,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_healthcareutilization', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_baseline_hivcontinuum`
--

DROP TABLE IF EXISTS `cms_baseline_hivcontinuum`;
CREATE TABLE IF NOT EXISTS `cms_baseline_hivcontinuum` (
  `hiv_continuum_id` int(11) NOT NULL AUTO_INCREMENT,
  `hiv_continuum_survey` varchar(11) NOT NULL,
  `hiv_continuum_loc` varchar(11) NOT NULL,
  `hiv_continuum_part_id` varchar(11) NOT NULL,
  `visit_code` varchar(20) NOT NULL,
  `hiv_continuum_q1` int(11) NOT NULL,
  `hiv_continuum_q2` int(11) DEFAULT NULL,
  `hiv_continuum_q3` int(11) DEFAULT NULL,
  `hiv_continuum_q4` int(11) DEFAULT NULL,
  `hiv_continuum_q5` int(11) DEFAULT NULL,
  `hiv_continuum_q6` int(11) DEFAULT NULL,
  `hiv_continuum_q7a` int(11) DEFAULT NULL,
  `hiv_continuum_q7b` int(11) DEFAULT NULL,
  `hiv_continuum_q7c` int(11) DEFAULT NULL,
  `hiv_continuum_q7d` int(11) DEFAULT NULL,
  `hiv_continuum_q7e` int(11) DEFAULT NULL,
  `hiv_continuum_q7f` int(11) DEFAULT NULL,
  `hiv_continuum_q7g` int(11) DEFAULT NULL,
  `hiv_continuum_q7h` int(11) DEFAULT NULL,
  `hiv_continuum_q7i` int(11) DEFAULT NULL,
  `hiv_continuum_q7j` int(11) DEFAULT NULL,
  `hiv_continuum_q7k` int(11) DEFAULT NULL,
  `hiv_continuum_q7l` int(11) DEFAULT NULL,
  `hiv_continuum_q7m` int(11) DEFAULT NULL,
  `hiv_continuum_q7n` int(11) DEFAULT NULL,
  `hiv_continuum_q7o` int(11) DEFAULT NULL,
  `hiv_continuum_q8` int(11) DEFAULT NULL,
  `hiv_continuum_q9` int(11) DEFAULT NULL,
  `hiv_continuum_q10` int(11) DEFAULT NULL,
  `hiv_continuum_q11` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`hiv_continuum_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_baseline_hivcontinuum`
--
DROP TRIGGER IF EXISTS `trig_cms_baseline_hivcontinuum_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_hivcontinuum_DELETE` BEFORE DELETE ON `cms_baseline_hivcontinuum`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.hiv_continuum_id;

set @userid=OLD.update_user;



if  OLD.hiv_continuum_id !="" OR OLD.hiv_continuum_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_id);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_id');

end if;



if  OLD.hiv_continuum_survey !="" OR OLD.hiv_continuum_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_survey);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_survey');

end if;



if  OLD.hiv_continuum_loc !="" OR OLD.hiv_continuum_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_loc);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_loc');

end if;



if  OLD.hiv_continuum_part_id !="" OR OLD.hiv_continuum_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_part_id);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_part_id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.hiv_continuum_q1 !="" OR OLD.hiv_continuum_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q1);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q1');

end if;



if  OLD.hiv_continuum_q2 !="" OR OLD.hiv_continuum_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q2);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q2');

end if;



if  OLD.hiv_continuum_q3 !="" OR OLD.hiv_continuum_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q3);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q3');

end if;



if  OLD.hiv_continuum_q4 !="" OR OLD.hiv_continuum_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q4);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q4');

end if;



if  OLD.hiv_continuum_q5 !="" OR OLD.hiv_continuum_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q5);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q5');

end if;



if  OLD.hiv_continuum_q6 !="" OR OLD.hiv_continuum_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q6);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q6');

end if;



if  OLD.hiv_continuum_q7a !="" OR OLD.hiv_continuum_q7a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7a);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7a');

end if;



if  OLD.hiv_continuum_q7b !="" OR OLD.hiv_continuum_q7b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7b);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7b');

end if;



if  OLD.hiv_continuum_q7c !="" OR OLD.hiv_continuum_q7c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7c);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7c');

end if;



if  OLD.hiv_continuum_q7d !="" OR OLD.hiv_continuum_q7d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7d);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7d');

end if;



if  OLD.hiv_continuum_q7e !="" OR OLD.hiv_continuum_q7e is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7e);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7e');

end if;



if  OLD.hiv_continuum_q7f !="" OR OLD.hiv_continuum_q7f is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7f);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7f');

end if;



if  OLD.hiv_continuum_q7g !="" OR OLD.hiv_continuum_q7g is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7g);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7g');

end if;



if  OLD.hiv_continuum_q7h !="" OR OLD.hiv_continuum_q7h is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7h);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7h');

end if;



if  OLD.hiv_continuum_q7i !="" OR OLD.hiv_continuum_q7i is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7i);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7i');

end if;



if  OLD.hiv_continuum_q7j !="" OR OLD.hiv_continuum_q7j is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7j);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7j');

end if;



if  OLD.hiv_continuum_q7k !="" OR OLD.hiv_continuum_q7k is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7k);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7k');

end if;



if  OLD.hiv_continuum_q7l !="" OR OLD.hiv_continuum_q7l is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7l);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7l');

end if;



if  OLD.hiv_continuum_q7m !="" OR OLD.hiv_continuum_q7m is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7m);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7m');

end if;



if  OLD.hiv_continuum_q7n !="" OR OLD.hiv_continuum_q7n is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7n);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7n');

end if;



if  OLD.hiv_continuum_q7o !="" OR OLD.hiv_continuum_q7o is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7o);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7o');

end if;



if  OLD.hiv_continuum_q8 !="" OR OLD.hiv_continuum_q8 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q8);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q8');

end if;



if  OLD.hiv_continuum_q9 !="" OR OLD.hiv_continuum_q9 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q9);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q9');

end if;



if  OLD.hiv_continuum_q10 !="" OR OLD.hiv_continuum_q10 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q10);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q10');

end if;



if  OLD.hiv_continuum_q11 !="" OR OLD.hiv_continuum_q11 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q11);



	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q11');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_hivcontinuum(hiv_continuum_survey,hiv_continuum_loc,hiv_continuum_part_id,visit_code,hiv_continuum_q1,hiv_continuum_q2,hiv_continuum_q3,hiv_continuum_q4,hiv_continuum_q5,hiv_continuum_q6,hiv_continuum_q7a,hiv_continuum_q7b,hiv_continuum_q7c,hiv_continuum_q7d,hiv_continuum_q7e,hiv_continuum_q7f,hiv_continuum_q7g,hiv_continuum_q7h,hiv_continuum_q7i,hiv_continuum_q7j,hiv_continuum_q7k,hiv_continuum_q7l,hiv_continuum_q7m,hiv_continuum_q7n,hiv_continuum_q7o,hiv_continuum_q8,hiv_continuum_q9,hiv_continuum_q10,hiv_continuum_q11,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.hiv_continuum_survey,OLD.hiv_continuum_loc,OLD.hiv_continuum_part_id,OLD.visit_code,OLD.hiv_continuum_q1,OLD.hiv_continuum_q2,OLD.hiv_continuum_q3,OLD.hiv_continuum_q4,OLD.hiv_continuum_q5,OLD.hiv_continuum_q6,OLD.hiv_continuum_q7a,OLD.hiv_continuum_q7b,OLD.hiv_continuum_q7c,OLD.hiv_continuum_q7d,OLD.hiv_continuum_q7e,OLD.hiv_continuum_q7f,OLD.hiv_continuum_q7g,OLD.hiv_continuum_q7h,OLD.hiv_continuum_q7i,OLD.hiv_continuum_q7j,OLD.hiv_continuum_q7k,OLD.hiv_continuum_q7l,OLD.hiv_continuum_q7m,OLD.hiv_continuum_q7n,OLD.hiv_continuum_q7o,OLD.hiv_continuum_q8,OLD.hiv_continuum_q9,OLD.hiv_continuum_q10,OLD.hiv_continuum_q11,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_hivcontinuum', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_hivcontinuum_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_hivcontinuum_INSERT` AFTER INSERT ON `cms_baseline_hivcontinuum`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hiv_continuum_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_id);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_id');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_survey);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_survey');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_loc);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_loc');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_part_id);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q1);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q1');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q2);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q2');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q3);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q3');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q4);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q4');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q5);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q5');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q6);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q6');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7a);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7a');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7b);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7b');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7c);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7c');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7d);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7d');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7e);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7e');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7f);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7f');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7g);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7g');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7h);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7h');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7i);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7i');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7j);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7j');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7k);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7k');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7l);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7l');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7m);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7m');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7n);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7n');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7o);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7o');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q8);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q8');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q9);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q9');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q10);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q10');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q11);

set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q11');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_baseline_hivcontinuum(hiv_continuum_survey,hiv_continuum_loc,hiv_continuum_part_id,visit_code,hiv_continuum_q1,hiv_continuum_q2,hiv_continuum_q3,hiv_continuum_q4,hiv_continuum_q5,hiv_continuum_q6,hiv_continuum_q7a,hiv_continuum_q7b,hiv_continuum_q7c,hiv_continuum_q7d,hiv_continuum_q7e,hiv_continuum_q7f,hiv_continuum_q7g,hiv_continuum_q7h,hiv_continuum_q7i,hiv_continuum_q7j,hiv_continuum_q7k,hiv_continuum_q7l,hiv_continuum_q7m,hiv_continuum_q7n,hiv_continuum_q7o,hiv_continuum_q8,hiv_continuum_q9,hiv_continuum_q10,hiv_continuum_q11,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hiv_continuum_survey,NEW.hiv_continuum_loc,NEW.hiv_continuum_part_id,NEW.visit_code,NEW.hiv_continuum_q1,NEW.hiv_continuum_q2,NEW.hiv_continuum_q3,NEW.hiv_continuum_q4,NEW.hiv_continuum_q5,NEW.hiv_continuum_q6,NEW.hiv_continuum_q7a,NEW.hiv_continuum_q7b,NEW.hiv_continuum_q7c,NEW.hiv_continuum_q7d,NEW.hiv_continuum_q7e,NEW.hiv_continuum_q7f,NEW.hiv_continuum_q7g,NEW.hiv_continuum_q7h,NEW.hiv_continuum_q7i,NEW.hiv_continuum_q7j,NEW.hiv_continuum_q7k,NEW.hiv_continuum_q7l,NEW.hiv_continuum_q7m,NEW.hiv_continuum_q7n,NEW.hiv_continuum_q7o,NEW.hiv_continuum_q8,NEW.hiv_continuum_q9,NEW.hiv_continuum_q10,NEW.hiv_continuum_q11,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_hivcontinuum', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_hivcontinuum_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_hivcontinuum_UPDATE` BEFORE UPDATE ON `cms_baseline_hivcontinuum`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hiv_continuum_id;

set @userid=NEW.update_user;



if  OLD.hiv_continuum_id != NEW.hiv_continuum_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_id);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_id');

end if;



if  OLD.hiv_continuum_survey != NEW.hiv_continuum_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_survey);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_survey');

end if;



if  OLD.hiv_continuum_loc != NEW.hiv_continuum_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_loc);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_loc');

end if;



if  OLD.hiv_continuum_part_id != NEW.hiv_continuum_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_part_id);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_part_id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.hiv_continuum_q1 != NEW.hiv_continuum_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q1);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q1');

end if;



if  OLD.hiv_continuum_q2 != NEW.hiv_continuum_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q2);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q2');

end if;



if  OLD.hiv_continuum_q3 != NEW.hiv_continuum_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q3);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q3');

end if;



if  OLD.hiv_continuum_q4 != NEW.hiv_continuum_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q4);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q4');

end if;



if  OLD.hiv_continuum_q5 != NEW.hiv_continuum_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q5);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q5');

end if;



if  OLD.hiv_continuum_q6 != NEW.hiv_continuum_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q6);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q6');

end if;



if  OLD.hiv_continuum_q7a != NEW.hiv_continuum_q7a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7a);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7a);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7a');

end if;



if  OLD.hiv_continuum_q7b != NEW.hiv_continuum_q7b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7b);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7b);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7b');

end if;



if  OLD.hiv_continuum_q7c != NEW.hiv_continuum_q7c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7c);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7c);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7c');

end if;



if  OLD.hiv_continuum_q7d != NEW.hiv_continuum_q7d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7d);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7d);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7d');

end if;



if  OLD.hiv_continuum_q7e != NEW.hiv_continuum_q7e

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7e);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7e);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7e');

end if;



if  OLD.hiv_continuum_q7f != NEW.hiv_continuum_q7f

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7f);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7f);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7f');

end if;



if  OLD.hiv_continuum_q7g != NEW.hiv_continuum_q7g

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7g);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7g);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7g');

end if;



if  OLD.hiv_continuum_q7h != NEW.hiv_continuum_q7h

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7h);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7h);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7h');

end if;



if  OLD.hiv_continuum_q7i != NEW.hiv_continuum_q7i

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7i);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7i);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7i');

end if;



if  OLD.hiv_continuum_q7j != NEW.hiv_continuum_q7j

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7j);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7j);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7j');

end if;



if  OLD.hiv_continuum_q7k != NEW.hiv_continuum_q7k

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7k);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7k);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7k');

end if;



if  OLD.hiv_continuum_q7l != NEW.hiv_continuum_q7l

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7l);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7l);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7l');

end if;



if  OLD.hiv_continuum_q7m != NEW.hiv_continuum_q7m

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7m);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7m);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7m');

end if;



if  OLD.hiv_continuum_q7n != NEW.hiv_continuum_q7n

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7n);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7n);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7n');

end if;



if  OLD.hiv_continuum_q7o != NEW.hiv_continuum_q7o

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q7o);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q7o);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q7o');

end if;



if  OLD.hiv_continuum_q8 != NEW.hiv_continuum_q8

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q8);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q8);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q8');

end if;



if  OLD.hiv_continuum_q9 != NEW.hiv_continuum_q9

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q9);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q9);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q9');

end if;



if  OLD.hiv_continuum_q10 != NEW.hiv_continuum_q10

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q10);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q10);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q10');

end if;



if  OLD.hiv_continuum_q11 != NEW.hiv_continuum_q11

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_continuum_q11);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_continuum_q11);

	set @chdCol=CONCAT(@chdCol,'-','hiv_continuum_q11');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_hivcontinuum(hiv_continuum_survey,hiv_continuum_loc,hiv_continuum_part_id,visit_code,hiv_continuum_q1,hiv_continuum_q2,hiv_continuum_q3,hiv_continuum_q4,hiv_continuum_q5,hiv_continuum_q6,hiv_continuum_q7a,hiv_continuum_q7b,hiv_continuum_q7c,hiv_continuum_q7d,hiv_continuum_q7e,hiv_continuum_q7f,hiv_continuum_q7g,hiv_continuum_q7h,hiv_continuum_q7i,hiv_continuum_q7j,hiv_continuum_q7k,hiv_continuum_q7l,hiv_continuum_q7m,hiv_continuum_q7n,hiv_continuum_q7o,hiv_continuum_q8,hiv_continuum_q9,hiv_continuum_q10,hiv_continuum_q11,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hiv_continuum_survey,NEW.hiv_continuum_loc,NEW.hiv_continuum_part_id,NEW.visit_code,NEW.hiv_continuum_q1,NEW.hiv_continuum_q2,NEW.hiv_continuum_q3,NEW.hiv_continuum_q4,NEW.hiv_continuum_q5,NEW.hiv_continuum_q6,NEW.hiv_continuum_q7a,NEW.hiv_continuum_q7b,NEW.hiv_continuum_q7c,NEW.hiv_continuum_q7d,NEW.hiv_continuum_q7e,NEW.hiv_continuum_q7f,NEW.hiv_continuum_q7g,NEW.hiv_continuum_q7h,NEW.hiv_continuum_q7i,NEW.hiv_continuum_q7j,NEW.hiv_continuum_q7k,NEW.hiv_continuum_q7l,NEW.hiv_continuum_q7m,NEW.hiv_continuum_q7n,NEW.hiv_continuum_q7o,NEW.hiv_continuum_q8,NEW.hiv_continuum_q9,NEW.hiv_continuum_q10,NEW.hiv_continuum_q11,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_hivcontinuum', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_baseline_postartbeliefs`
--

DROP TABLE IF EXISTS `cms_baseline_postartbeliefs`;
CREATE TABLE IF NOT EXISTS `cms_baseline_postartbeliefs` (
  `post_art_beliefs_id` int(11) NOT NULL AUTO_INCREMENT,
  `post_art_beliefs_survey` varchar(11) NOT NULL,
  `post_art_beliefs_loc` varchar(11) NOT NULL,
  `post_art_beliefs_part_id` varchar(11) NOT NULL,
  `visit_code` varchar(20) NOT NULL,
  `post_art_beliefs_q1` int(11) NOT NULL,
  `post_art_beliefs_q2` int(11) NOT NULL,
  `post_art_beliefs_q3` int(11) NOT NULL,
  `post_art_beliefs_q4` int(11) NOT NULL,
  `post_art_beliefs_q5` int(11) NOT NULL,
  `post_art_beliefs_q6` int(11) NOT NULL,
  `post_art_beliefs_q7` int(11) NOT NULL,
  `post_art_beliefs_q8` int(11) NOT NULL,
  `post_art_beliefs_q9` int(11) NOT NULL,
  `post_art_beliefs_q10` int(11) NOT NULL,
  `post_art_beliefs_q11` int(11) NOT NULL,
  `post_art_beliefs_q12` int(11) NOT NULL,
  `post_art_beliefs_q13` int(11) NOT NULL,
  `post_art_beliefs_q14` int(11) NOT NULL,
  `post_art_beliefs_q15` int(11) NOT NULL,
  `post_art_beliefs_q16` int(11) NOT NULL,
  `post_art_beliefs_q17` int(11) NOT NULL,
  `post_art_beliefs_q18` int(11) NOT NULL,
  `post_art_beliefs_q19` int(11) NOT NULL,
  `post_art_beliefs_q20` int(11) NOT NULL,
  `post_art_beliefs_q21` int(11) NOT NULL,
  `post_art_beliefs_q22` int(11) NOT NULL,
  `post_art_beliefs_q23` int(11) NOT NULL,
  `post_art_beliefs_q24` int(11) NOT NULL,
  `post_art_beliefs_q25` int(11) NOT NULL,
  `post_art_beliefs_q26` int(11) NOT NULL,
  `post_art_beliefs_q27` int(11) NOT NULL,
  `post_art_beliefs_q28` int(11) NOT NULL,
  `post_art_beliefs_q29` int(11) NOT NULL,
  `post_art_beliefs_q30` int(11) NOT NULL,
  `post_art_beliefs_q31` int(11) NOT NULL,
  `post_art_beliefs_q32` int(11) NOT NULL,
  `post_art_beliefs_q33` int(11) NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`post_art_beliefs_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_baseline_postartbeliefs`
--
DROP TRIGGER IF EXISTS `trig_cms_baseline_postartbeliefs_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_postartbeliefs_DELETE` BEFORE DELETE ON `cms_baseline_postartbeliefs`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.post_art_beliefs_id;

set @userid=OLD.update_user;



if  OLD.post_art_beliefs_id !="" OR OLD.post_art_beliefs_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_id);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_id');

end if;



if  OLD.post_art_beliefs_survey !="" OR OLD.post_art_beliefs_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_survey);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_survey');

end if;



if  OLD.post_art_beliefs_loc !="" OR OLD.post_art_beliefs_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_loc);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_loc');

end if;



if  OLD.post_art_beliefs_part_id !="" OR OLD.post_art_beliefs_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_part_id);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_part_id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.post_art_beliefs_q1 !="" OR OLD.post_art_beliefs_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q1);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q1');

end if;



if  OLD.post_art_beliefs_q2 !="" OR OLD.post_art_beliefs_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q2);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q2');

end if;



if  OLD.post_art_beliefs_q3 !="" OR OLD.post_art_beliefs_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q3);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q3');

end if;



if  OLD.post_art_beliefs_q4 !="" OR OLD.post_art_beliefs_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q4);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q4');

end if;



if  OLD.post_art_beliefs_q5 !="" OR OLD.post_art_beliefs_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q5);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q5');

end if;



if  OLD.post_art_beliefs_q6 !="" OR OLD.post_art_beliefs_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q6);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q6');

end if;



if  OLD.post_art_beliefs_q7 !="" OR OLD.post_art_beliefs_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q7);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q7');

end if;



if  OLD.post_art_beliefs_q8 !="" OR OLD.post_art_beliefs_q8 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q8);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q8');

end if;



if  OLD.post_art_beliefs_q9 !="" OR OLD.post_art_beliefs_q9 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q9);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q9');

end if;



if  OLD.post_art_beliefs_q10 !="" OR OLD.post_art_beliefs_q10 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q10);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q10');

end if;



if  OLD.post_art_beliefs_q11 !="" OR OLD.post_art_beliefs_q11 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q11);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q11');

end if;



if  OLD.post_art_beliefs_q12 !="" OR OLD.post_art_beliefs_q12 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q12);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q12');

end if;



if  OLD.post_art_beliefs_q13 !="" OR OLD.post_art_beliefs_q13 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q13);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q13');

end if;



if  OLD.post_art_beliefs_q14 !="" OR OLD.post_art_beliefs_q14 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q14);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q14');

end if;



if  OLD.post_art_beliefs_q15 !="" OR OLD.post_art_beliefs_q15 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q15);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q15');

end if;



if  OLD.post_art_beliefs_q16 !="" OR OLD.post_art_beliefs_q16 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q16);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q16');

end if;



if  OLD.post_art_beliefs_q17 !="" OR OLD.post_art_beliefs_q17 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q17);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q17');

end if;



if  OLD.post_art_beliefs_q18 !="" OR OLD.post_art_beliefs_q18 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q18);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q18');

end if;



if  OLD.post_art_beliefs_q19 !="" OR OLD.post_art_beliefs_q19 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q19);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q19');

end if;



if  OLD.post_art_beliefs_q20 !="" OR OLD.post_art_beliefs_q20 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q20);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q20');

end if;



if  OLD.post_art_beliefs_q21 !="" OR OLD.post_art_beliefs_q21 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q21);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q21');

end if;



if  OLD.post_art_beliefs_q22 !="" OR OLD.post_art_beliefs_q22 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q22);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q22');

end if;



if  OLD.post_art_beliefs_q23 !="" OR OLD.post_art_beliefs_q23 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q23);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q23');

end if;



if  OLD.post_art_beliefs_q24 !="" OR OLD.post_art_beliefs_q24 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q24);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q24');

end if;



if  OLD.post_art_beliefs_q25 !="" OR OLD.post_art_beliefs_q25 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q25);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q25');

end if;



if  OLD.post_art_beliefs_q26 !="" OR OLD.post_art_beliefs_q26 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q26);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q26');

end if;



if  OLD.post_art_beliefs_q27 !="" OR OLD.post_art_beliefs_q27 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q27);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q27');

end if;



if  OLD.post_art_beliefs_q28 !="" OR OLD.post_art_beliefs_q28 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q28);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q28');

end if;



if  OLD.post_art_beliefs_q29 !="" OR OLD.post_art_beliefs_q29 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q29);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q29');

end if;



if  OLD.post_art_beliefs_q30 !="" OR OLD.post_art_beliefs_q30 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q30);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q30');

end if;



if  OLD.post_art_beliefs_q31 !="" OR OLD.post_art_beliefs_q31 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q31);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q31');

end if;



if  OLD.post_art_beliefs_q32 !="" OR OLD.post_art_beliefs_q32 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q32);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q32');

end if;



if  OLD.post_art_beliefs_q33 !="" OR OLD.post_art_beliefs_q33 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q33);



	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q33');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_postartbeliefs(post_art_beliefs_survey,post_art_beliefs_loc,post_art_beliefs_part_id,visit_code,post_art_beliefs_q1,post_art_beliefs_q2,post_art_beliefs_q3,post_art_beliefs_q4,post_art_beliefs_q5,post_art_beliefs_q6,post_art_beliefs_q7,post_art_beliefs_q8,post_art_beliefs_q9,post_art_beliefs_q10,post_art_beliefs_q11,post_art_beliefs_q12,post_art_beliefs_q13,post_art_beliefs_q14,post_art_beliefs_q15,post_art_beliefs_q16,post_art_beliefs_q17,post_art_beliefs_q18,post_art_beliefs_q19,post_art_beliefs_q20,post_art_beliefs_q21,post_art_beliefs_q22,post_art_beliefs_q23,post_art_beliefs_q24,post_art_beliefs_q25,post_art_beliefs_q26,post_art_beliefs_q27,post_art_beliefs_q28,post_art_beliefs_q29,post_art_beliefs_q30,post_art_beliefs_q31,post_art_beliefs_q32,post_art_beliefs_q33,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.post_art_beliefs_survey,OLD.post_art_beliefs_loc,OLD.post_art_beliefs_part_id,OLD.visit_code,OLD.post_art_beliefs_q1,OLD.post_art_beliefs_q2,OLD.post_art_beliefs_q3,OLD.post_art_beliefs_q4,OLD.post_art_beliefs_q5,OLD.post_art_beliefs_q6,OLD.post_art_beliefs_q7,OLD.post_art_beliefs_q8,OLD.post_art_beliefs_q9,OLD.post_art_beliefs_q10,OLD.post_art_beliefs_q11,OLD.post_art_beliefs_q12,OLD.post_art_beliefs_q13,OLD.post_art_beliefs_q14,OLD.post_art_beliefs_q15,OLD.post_art_beliefs_q16,OLD.post_art_beliefs_q17,OLD.post_art_beliefs_q18,OLD.post_art_beliefs_q19,OLD.post_art_beliefs_q20,OLD.post_art_beliefs_q21,OLD.post_art_beliefs_q22,OLD.post_art_beliefs_q23,OLD.post_art_beliefs_q24,OLD.post_art_beliefs_q25,OLD.post_art_beliefs_q26,OLD.post_art_beliefs_q27,OLD.post_art_beliefs_q28,OLD.post_art_beliefs_q29,OLD.post_art_beliefs_q30,OLD.post_art_beliefs_q31,OLD.post_art_beliefs_q32,OLD.post_art_beliefs_q33,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_postartbeliefs', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_postartbeliefs_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_postartbeliefs_INSERT` AFTER INSERT ON `cms_baseline_postartbeliefs`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.post_art_beliefs_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_id);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_id');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_survey);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_survey');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_loc);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_loc');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_part_id);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q1);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q1');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q2);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q2');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q3);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q3');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q4);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q4');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q5);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q5');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q6);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q6');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q7);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q7');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q8);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q8');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q9);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q9');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q10);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q10');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q11);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q11');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q12);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q12');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q13);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q13');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q14);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q14');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q15);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q15');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q16);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q16');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q17);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q17');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q18);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q18');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q19);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q19');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q20);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q20');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q21);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q21');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q22);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q22');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q23);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q23');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q24);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q24');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q25);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q25');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q26);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q26');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q27);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q27');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q28);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q28');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q29);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q29');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q30);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q30');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q31);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q31');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q32);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q32');

set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q33);

set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q33');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_baseline_postartbeliefs(post_art_beliefs_survey,post_art_beliefs_loc,post_art_beliefs_part_id,visit_code,post_art_beliefs_q1,post_art_beliefs_q2,post_art_beliefs_q3,post_art_beliefs_q4,post_art_beliefs_q5,post_art_beliefs_q6,post_art_beliefs_q7,post_art_beliefs_q8,post_art_beliefs_q9,post_art_beliefs_q10,post_art_beliefs_q11,post_art_beliefs_q12,post_art_beliefs_q13,post_art_beliefs_q14,post_art_beliefs_q15,post_art_beliefs_q16,post_art_beliefs_q17,post_art_beliefs_q18,post_art_beliefs_q19,post_art_beliefs_q20,post_art_beliefs_q21,post_art_beliefs_q22,post_art_beliefs_q23,post_art_beliefs_q24,post_art_beliefs_q25,post_art_beliefs_q26,post_art_beliefs_q27,post_art_beliefs_q28,post_art_beliefs_q29,post_art_beliefs_q30,post_art_beliefs_q31,post_art_beliefs_q32,post_art_beliefs_q33,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.post_art_beliefs_survey,NEW.post_art_beliefs_loc,NEW.post_art_beliefs_part_id,NEW.visit_code,NEW.post_art_beliefs_q1,NEW.post_art_beliefs_q2,NEW.post_art_beliefs_q3,NEW.post_art_beliefs_q4,NEW.post_art_beliefs_q5,NEW.post_art_beliefs_q6,NEW.post_art_beliefs_q7,NEW.post_art_beliefs_q8,NEW.post_art_beliefs_q9,NEW.post_art_beliefs_q10,NEW.post_art_beliefs_q11,NEW.post_art_beliefs_q12,NEW.post_art_beliefs_q13,NEW.post_art_beliefs_q14,NEW.post_art_beliefs_q15,NEW.post_art_beliefs_q16,NEW.post_art_beliefs_q17,NEW.post_art_beliefs_q18,NEW.post_art_beliefs_q19,NEW.post_art_beliefs_q20,NEW.post_art_beliefs_q21,NEW.post_art_beliefs_q22,NEW.post_art_beliefs_q23,NEW.post_art_beliefs_q24,NEW.post_art_beliefs_q25,NEW.post_art_beliefs_q26,NEW.post_art_beliefs_q27,NEW.post_art_beliefs_q28,NEW.post_art_beliefs_q29,NEW.post_art_beliefs_q30,NEW.post_art_beliefs_q31,NEW.post_art_beliefs_q32,NEW.post_art_beliefs_q33,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_postartbeliefs', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_postartbeliefs_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_postartbeliefs_UPDATE` BEFORE UPDATE ON `cms_baseline_postartbeliefs`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.post_art_beliefs_id;

set @userid=NEW.update_user;



if  OLD.post_art_beliefs_id != NEW.post_art_beliefs_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_id);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_id);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_id');

end if;



if  OLD.post_art_beliefs_survey != NEW.post_art_beliefs_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_survey);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_survey');

end if;



if  OLD.post_art_beliefs_loc != NEW.post_art_beliefs_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_loc);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_loc');

end if;



if  OLD.post_art_beliefs_part_id != NEW.post_art_beliefs_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_part_id);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_part_id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.post_art_beliefs_q1 != NEW.post_art_beliefs_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q1);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q1');

end if;



if  OLD.post_art_beliefs_q2 != NEW.post_art_beliefs_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q2);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q2');

end if;



if  OLD.post_art_beliefs_q3 != NEW.post_art_beliefs_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q3);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q3');

end if;



if  OLD.post_art_beliefs_q4 != NEW.post_art_beliefs_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q4);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q4');

end if;



if  OLD.post_art_beliefs_q5 != NEW.post_art_beliefs_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q5);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q5');

end if;



if  OLD.post_art_beliefs_q6 != NEW.post_art_beliefs_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q6);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q6');

end if;



if  OLD.post_art_beliefs_q7 != NEW.post_art_beliefs_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q7);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q7');

end if;



if  OLD.post_art_beliefs_q8 != NEW.post_art_beliefs_q8

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q8);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q8);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q8');

end if;



if  OLD.post_art_beliefs_q9 != NEW.post_art_beliefs_q9

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q9);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q9);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q9');

end if;



if  OLD.post_art_beliefs_q10 != NEW.post_art_beliefs_q10

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q10);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q10);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q10');

end if;



if  OLD.post_art_beliefs_q11 != NEW.post_art_beliefs_q11

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q11);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q11);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q11');

end if;



if  OLD.post_art_beliefs_q12 != NEW.post_art_beliefs_q12

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q12);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q12);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q12');

end if;



if  OLD.post_art_beliefs_q13 != NEW.post_art_beliefs_q13

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q13);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q13);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q13');

end if;



if  OLD.post_art_beliefs_q14 != NEW.post_art_beliefs_q14

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q14);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q14);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q14');

end if;



if  OLD.post_art_beliefs_q15 != NEW.post_art_beliefs_q15

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q15);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q15);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q15');

end if;



if  OLD.post_art_beliefs_q16 != NEW.post_art_beliefs_q16

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q16);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q16);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q16');

end if;



if  OLD.post_art_beliefs_q17 != NEW.post_art_beliefs_q17

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q17);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q17);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q17');

end if;



if  OLD.post_art_beliefs_q18 != NEW.post_art_beliefs_q18

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q18);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q18);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q18');

end if;



if  OLD.post_art_beliefs_q19 != NEW.post_art_beliefs_q19

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q19);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q19);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q19');

end if;



if  OLD.post_art_beliefs_q20 != NEW.post_art_beliefs_q20

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q20);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q20);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q20');

end if;



if  OLD.post_art_beliefs_q21 != NEW.post_art_beliefs_q21

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q21);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q21);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q21');

end if;



if  OLD.post_art_beliefs_q22 != NEW.post_art_beliefs_q22

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q22);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q22);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q22');

end if;



if  OLD.post_art_beliefs_q23 != NEW.post_art_beliefs_q23

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q23);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q23);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q23');

end if;



if  OLD.post_art_beliefs_q24 != NEW.post_art_beliefs_q24

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q24);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q24);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q24');

end if;



if  OLD.post_art_beliefs_q25 != NEW.post_art_beliefs_q25

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q25);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q25);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q25');

end if;



if  OLD.post_art_beliefs_q26 != NEW.post_art_beliefs_q26

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q26);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q26);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q26');

end if;



if  OLD.post_art_beliefs_q27 != NEW.post_art_beliefs_q27

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q27);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q27);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q27');

end if;



if  OLD.post_art_beliefs_q28 != NEW.post_art_beliefs_q28

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q28);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q28);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q28');

end if;



if  OLD.post_art_beliefs_q29 != NEW.post_art_beliefs_q29

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q29);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q29);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q29');

end if;



if  OLD.post_art_beliefs_q30 != NEW.post_art_beliefs_q30

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q30);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q30);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q30');

end if;



if  OLD.post_art_beliefs_q31 != NEW.post_art_beliefs_q31

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q31);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q31);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q31');

end if;



if  OLD.post_art_beliefs_q32 != NEW.post_art_beliefs_q32

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q32);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q32);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q32');

end if;



if  OLD.post_art_beliefs_q33 != NEW.post_art_beliefs_q33

then

	set @oldval =CONCAT(@oldVal,'-',OLD.post_art_beliefs_q33);

	set @newVal =CONCAT(@newVal,'-', NEW.post_art_beliefs_q33);

	set @chdCol=CONCAT(@chdCol,'-','post_art_beliefs_q33');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_postartbeliefs(post_art_beliefs_survey,post_art_beliefs_loc,post_art_beliefs_part_id,visit_code,post_art_beliefs_q1,post_art_beliefs_q2,post_art_beliefs_q3,post_art_beliefs_q4,post_art_beliefs_q5,post_art_beliefs_q6,post_art_beliefs_q7,post_art_beliefs_q8,post_art_beliefs_q9,post_art_beliefs_q10,post_art_beliefs_q11,post_art_beliefs_q12,post_art_beliefs_q13,post_art_beliefs_q14,post_art_beliefs_q15,post_art_beliefs_q16,post_art_beliefs_q17,post_art_beliefs_q18,post_art_beliefs_q19,post_art_beliefs_q20,post_art_beliefs_q21,post_art_beliefs_q22,post_art_beliefs_q23,post_art_beliefs_q24,post_art_beliefs_q25,post_art_beliefs_q26,post_art_beliefs_q27,post_art_beliefs_q28,post_art_beliefs_q29,post_art_beliefs_q30,post_art_beliefs_q31,post_art_beliefs_q32,post_art_beliefs_q33,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.post_art_beliefs_survey,NEW.post_art_beliefs_loc,NEW.post_art_beliefs_part_id,NEW.visit_code,NEW.post_art_beliefs_q1,NEW.post_art_beliefs_q2,NEW.post_art_beliefs_q3,NEW.post_art_beliefs_q4,NEW.post_art_beliefs_q5,NEW.post_art_beliefs_q6,NEW.post_art_beliefs_q7,NEW.post_art_beliefs_q8,NEW.post_art_beliefs_q9,NEW.post_art_beliefs_q10,NEW.post_art_beliefs_q11,NEW.post_art_beliefs_q12,NEW.post_art_beliefs_q13,NEW.post_art_beliefs_q14,NEW.post_art_beliefs_q15,NEW.post_art_beliefs_q16,NEW.post_art_beliefs_q17,NEW.post_art_beliefs_q18,NEW.post_art_beliefs_q19,NEW.post_art_beliefs_q20,NEW.post_art_beliefs_q21,NEW.post_art_beliefs_q22,NEW.post_art_beliefs_q23,NEW.post_art_beliefs_q24,NEW.post_art_beliefs_q25,NEW.post_art_beliefs_q26,NEW.post_art_beliefs_q27,NEW.post_art_beliefs_q28,NEW.post_art_beliefs_q29,NEW.post_art_beliefs_q30,NEW.post_art_beliefs_q31,NEW.post_art_beliefs_q32,NEW.post_art_beliefs_q33,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_postartbeliefs', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_baseline_preartbeliefs`
--

DROP TABLE IF EXISTS `cms_baseline_preartbeliefs`;
CREATE TABLE IF NOT EXISTS `cms_baseline_preartbeliefs` (
  `pre_art_beliefs_id` int(11) NOT NULL AUTO_INCREMENT,
  `pre_art_beliefs_survey` varchar(11) NOT NULL,
  `pre_art_beliefs_loc` varchar(11) NOT NULL,
  `pre_art_beliefs_part_id` varchar(11) NOT NULL,
  `visit_code` varchar(20) NOT NULL,
  `pre_art_beliefs_q1` int(11) NOT NULL,
  `pre_art_beliefs_q2` int(11) NOT NULL,
  `pre_art_beliefs_q3` int(11) NOT NULL,
  `pre_art_beliefs_q4` int(11) NOT NULL,
  `pre_art_beliefs_q5` int(11) NOT NULL,
  `pre_art_beliefs_q6` int(11) NOT NULL,
  `pre_art_beliefs_q7` int(11) NOT NULL,
  `pre_art_beliefs_q8` int(11) NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`pre_art_beliefs_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_baseline_preartbeliefs`
--
DROP TRIGGER IF EXISTS `trig_cms_baseline_preartbeliefs_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_preartbeliefs_DELETE` BEFORE DELETE ON `cms_baseline_preartbeliefs`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.pre_art_beliefs_id;

set @userid=OLD.update_user;



if  OLD.pre_art_beliefs_id !="" OR OLD.pre_art_beliefs_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_id);



	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_id');

end if;



if  OLD.pre_art_beliefs_survey !="" OR OLD.pre_art_beliefs_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_survey);



	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_survey');

end if;



if  OLD.pre_art_beliefs_loc !="" OR OLD.pre_art_beliefs_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_loc);



	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_loc');

end if;



if  OLD.pre_art_beliefs_part_id !="" OR OLD.pre_art_beliefs_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_part_id);



	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_part_id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.pre_art_beliefs_q1 !="" OR OLD.pre_art_beliefs_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q1);



	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q1');

end if;



if  OLD.pre_art_beliefs_q2 !="" OR OLD.pre_art_beliefs_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q2);



	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q2');

end if;



if  OLD.pre_art_beliefs_q3 !="" OR OLD.pre_art_beliefs_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q3);



	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q3');

end if;



if  OLD.pre_art_beliefs_q4 !="" OR OLD.pre_art_beliefs_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q4);



	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q4');

end if;



if  OLD.pre_art_beliefs_q5 !="" OR OLD.pre_art_beliefs_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q5);



	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q5');

end if;



if  OLD.pre_art_beliefs_q6 !="" OR OLD.pre_art_beliefs_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q6);



	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q6');

end if;



if  OLD.pre_art_beliefs_q7 !="" OR OLD.pre_art_beliefs_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q7);



	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q7');

end if;



if  OLD.pre_art_beliefs_q8 !="" OR OLD.pre_art_beliefs_q8 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q8);



	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q8');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_preartbeliefs(pre_art_beliefs_survey,pre_art_beliefs_loc,pre_art_beliefs_part_id,visit_code,pre_art_beliefs_q1,pre_art_beliefs_q2,pre_art_beliefs_q3,pre_art_beliefs_q4,pre_art_beliefs_q5,pre_art_beliefs_q6,pre_art_beliefs_q7,pre_art_beliefs_q8,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.pre_art_beliefs_survey,OLD.pre_art_beliefs_loc,OLD.pre_art_beliefs_part_id,OLD.visit_code,OLD.pre_art_beliefs_q1,OLD.pre_art_beliefs_q2,OLD.pre_art_beliefs_q3,OLD.pre_art_beliefs_q4,OLD.pre_art_beliefs_q5,OLD.pre_art_beliefs_q6,OLD.pre_art_beliefs_q7,OLD.pre_art_beliefs_q8,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_preartbeliefs', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_preartbeliefs_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_preartbeliefs_INSERT` AFTER INSERT ON `cms_baseline_preartbeliefs`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.pre_art_beliefs_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_id);

set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_id');

set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_survey);

set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_survey');

set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_loc);

set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_loc');

set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_part_id);

set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q1);

set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q1');

set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q2);

set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q2');

set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q3);

set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q3');

set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q4);

set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q4');

set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q5);

set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q5');

set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q6);

set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q6');

set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q7);

set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q7');

set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q8);

set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q8');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_baseline_preartbeliefs(pre_art_beliefs_survey,pre_art_beliefs_loc,pre_art_beliefs_part_id,visit_code,pre_art_beliefs_q1,pre_art_beliefs_q2,pre_art_beliefs_q3,pre_art_beliefs_q4,pre_art_beliefs_q5,pre_art_beliefs_q6,pre_art_beliefs_q7,pre_art_beliefs_q8,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.pre_art_beliefs_survey,NEW.pre_art_beliefs_loc,NEW.pre_art_beliefs_part_id,NEW.visit_code,NEW.pre_art_beliefs_q1,NEW.pre_art_beliefs_q2,NEW.pre_art_beliefs_q3,NEW.pre_art_beliefs_q4,NEW.pre_art_beliefs_q5,NEW.pre_art_beliefs_q6,NEW.pre_art_beliefs_q7,NEW.pre_art_beliefs_q8,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_preartbeliefs', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_preartbeliefs_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_preartbeliefs_UPDATE` BEFORE UPDATE ON `cms_baseline_preartbeliefs`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.pre_art_beliefs_id;

set @userid=NEW.update_user;



if  OLD.pre_art_beliefs_id != NEW.pre_art_beliefs_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_id);

	set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_id);

	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_id');

end if;



if  OLD.pre_art_beliefs_survey != NEW.pre_art_beliefs_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_survey);

	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_survey');

end if;



if  OLD.pre_art_beliefs_loc != NEW.pre_art_beliefs_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_loc);

	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_loc');

end if;



if  OLD.pre_art_beliefs_part_id != NEW.pre_art_beliefs_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_part_id);

	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_part_id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.pre_art_beliefs_q1 != NEW.pre_art_beliefs_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q1);

	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q1');

end if;



if  OLD.pre_art_beliefs_q2 != NEW.pre_art_beliefs_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q2);

	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q2');

end if;



if  OLD.pre_art_beliefs_q3 != NEW.pre_art_beliefs_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q3);

	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q3');

end if;



if  OLD.pre_art_beliefs_q4 != NEW.pre_art_beliefs_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q4);

	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q4');

end if;



if  OLD.pre_art_beliefs_q5 != NEW.pre_art_beliefs_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q5);

	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q5');

end if;



if  OLD.pre_art_beliefs_q6 != NEW.pre_art_beliefs_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q6);

	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q6');

end if;



if  OLD.pre_art_beliefs_q7 != NEW.pre_art_beliefs_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q7);

	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q7');

end if;



if  OLD.pre_art_beliefs_q8 != NEW.pre_art_beliefs_q8

then

	set @oldval =CONCAT(@oldVal,'-',OLD.pre_art_beliefs_q8);

	set @newVal =CONCAT(@newVal,'-', NEW.pre_art_beliefs_q8);

	set @chdCol=CONCAT(@chdCol,'-','pre_art_beliefs_q8');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_preartbeliefs(pre_art_beliefs_survey,pre_art_beliefs_loc,pre_art_beliefs_part_id,visit_code,pre_art_beliefs_q1,pre_art_beliefs_q2,pre_art_beliefs_q3,pre_art_beliefs_q4,pre_art_beliefs_q5,pre_art_beliefs_q6,pre_art_beliefs_q7,pre_art_beliefs_q8,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.pre_art_beliefs_survey,NEW.pre_art_beliefs_loc,NEW.pre_art_beliefs_part_id,NEW.visit_code,NEW.pre_art_beliefs_q1,NEW.pre_art_beliefs_q2,NEW.pre_art_beliefs_q3,NEW.pre_art_beliefs_q4,NEW.pre_art_beliefs_q5,NEW.pre_art_beliefs_q6,NEW.pre_art_beliefs_q7,NEW.pre_art_beliefs_q8,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_preartbeliefs', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_baseline_qualityoflife`
--

DROP TABLE IF EXISTS `cms_baseline_qualityoflife`;
CREATE TABLE IF NOT EXISTS `cms_baseline_qualityoflife` (
  `quality_of_life_id` int(11) NOT NULL AUTO_INCREMENT,
  `quality_of_life_survey` varchar(11) NOT NULL,
  `quality_of_life_loc` varchar(11) NOT NULL,
  `quality_of_life_part_id` varchar(11) NOT NULL,
  `visit_code` varchar(20) NOT NULL,
  `quality_of_life_q1` int(11) NOT NULL,
  `quality_of_life_q2` int(11) NOT NULL,
  `quality_of_life_q3` int(11) NOT NULL,
  `quality_of_life_q4` int(11) NOT NULL,
  `quality_of_life_q5` int(11) NOT NULL,
  `quality_of_life_q6` int(11) NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`quality_of_life_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_baseline_qualityoflife`
--
DROP TRIGGER IF EXISTS `trig_cms_baseline_qualityoflife_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_qualityoflife_DELETE` BEFORE DELETE ON `cms_baseline_qualityoflife`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.quality_of_life_id;

set @userid=OLD.update_user;



if  OLD.quality_of_life_id !="" OR OLD.quality_of_life_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_id);



	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_id');

end if;



if  OLD.quality_of_life_survey !="" OR OLD.quality_of_life_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_survey);



	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_survey');

end if;



if  OLD.quality_of_life_loc !="" OR OLD.quality_of_life_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_loc);



	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_loc');

end if;



if  OLD.quality_of_life_part_id !="" OR OLD.quality_of_life_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_part_id);



	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_part_id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.quality_of_life_q1 !="" OR OLD.quality_of_life_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_q1);



	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q1');

end if;



if  OLD.quality_of_life_q2 !="" OR OLD.quality_of_life_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_q2);



	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q2');

end if;



if  OLD.quality_of_life_q3 !="" OR OLD.quality_of_life_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_q3);



	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q3');

end if;



if  OLD.quality_of_life_q4 !="" OR OLD.quality_of_life_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_q4);



	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q4');

end if;



if  OLD.quality_of_life_q5 !="" OR OLD.quality_of_life_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_q5);



	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q5');

end if;



if  OLD.quality_of_life_q6 !="" OR OLD.quality_of_life_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_q6);



	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q6');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_qualityoflife(quality_of_life_survey,quality_of_life_loc,quality_of_life_part_id,visit_code,quality_of_life_q1,quality_of_life_q2,quality_of_life_q3,quality_of_life_q4,quality_of_life_q5,quality_of_life_q6,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.quality_of_life_survey,OLD.quality_of_life_loc,OLD.quality_of_life_part_id,OLD.visit_code,OLD.quality_of_life_q1,OLD.quality_of_life_q2,OLD.quality_of_life_q3,OLD.quality_of_life_q4,OLD.quality_of_life_q5,OLD.quality_of_life_q6,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_qualityoflife', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_qualityoflife_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_qualityoflife_INSERT` AFTER INSERT ON `cms_baseline_qualityoflife`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.quality_of_life_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_id);

set @chdCol=CONCAT(@chdCol,'-','quality_of_life_id');

set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_survey);

set @chdCol=CONCAT(@chdCol,'-','quality_of_life_survey');

set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_loc);

set @chdCol=CONCAT(@chdCol,'-','quality_of_life_loc');

set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_part_id);

set @chdCol=CONCAT(@chdCol,'-','quality_of_life_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_q1);

set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q1');

set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_q2);

set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q2');

set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_q3);

set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q3');

set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_q4);

set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q4');

set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_q5);

set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q5');

set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_q6);

set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q6');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_baseline_qualityoflife(quality_of_life_survey,quality_of_life_loc,quality_of_life_part_id,visit_code,quality_of_life_q1,quality_of_life_q2,quality_of_life_q3,quality_of_life_q4,quality_of_life_q5,quality_of_life_q6,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.quality_of_life_survey,NEW.quality_of_life_loc,NEW.quality_of_life_part_id,NEW.visit_code,NEW.quality_of_life_q1,NEW.quality_of_life_q2,NEW.quality_of_life_q3,NEW.quality_of_life_q4,NEW.quality_of_life_q5,NEW.quality_of_life_q6,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_qualityoflife', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_qualityoflife_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_qualityoflife_UPDATE` BEFORE UPDATE ON `cms_baseline_qualityoflife`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.quality_of_life_id;

set @userid=NEW.update_user;



if  OLD.quality_of_life_id != NEW.quality_of_life_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_id);

	set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_id);

	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_id');

end if;



if  OLD.quality_of_life_survey != NEW.quality_of_life_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_survey);

	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_survey');

end if;



if  OLD.quality_of_life_loc != NEW.quality_of_life_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_loc);

	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_loc');

end if;



if  OLD.quality_of_life_part_id != NEW.quality_of_life_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_part_id);

	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_part_id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.quality_of_life_q1 != NEW.quality_of_life_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_q1);

	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q1');

end if;



if  OLD.quality_of_life_q2 != NEW.quality_of_life_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_q2);

	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q2');

end if;



if  OLD.quality_of_life_q3 != NEW.quality_of_life_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_q3);

	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q3');

end if;



if  OLD.quality_of_life_q4 != NEW.quality_of_life_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_q4);

	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q4');

end if;



if  OLD.quality_of_life_q5 != NEW.quality_of_life_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_q5);

	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q5');

end if;



if  OLD.quality_of_life_q6 != NEW.quality_of_life_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.quality_of_life_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.quality_of_life_q6);

	set @chdCol=CONCAT(@chdCol,'-','quality_of_life_q6');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_qualityoflife(quality_of_life_survey,quality_of_life_loc,quality_of_life_part_id,visit_code,quality_of_life_q1,quality_of_life_q2,quality_of_life_q3,quality_of_life_q4,quality_of_life_q5,quality_of_life_q6,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.quality_of_life_survey,NEW.quality_of_life_loc,NEW.quality_of_life_part_id,NEW.visit_code,NEW.quality_of_life_q1,NEW.quality_of_life_q2,NEW.quality_of_life_q3,NEW.quality_of_life_q4,NEW.quality_of_life_q5,NEW.quality_of_life_q6,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_qualityoflife', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_baseline_riskbehavior`
--

DROP TABLE IF EXISTS `cms_baseline_riskbehavior`;
CREATE TABLE IF NOT EXISTS `cms_baseline_riskbehavior` (
  `risk_behavior_id` int(11) NOT NULL AUTO_INCREMENT,
  `risk_behavior_survey` varchar(11) NOT NULL,
  `risk_behavior_loc` int(11) NOT NULL,
  `risk_behavior_part_id` varchar(11) NOT NULL,
  `visit_code` varchar(20) NOT NULL,
  `risk_behavior_q1` int(11) NOT NULL,
  `risk_behavior_q2` int(11) DEFAULT NULL,
  `risk_behavior_q3` int(11) DEFAULT NULL,
  `risk_behavior_q4` int(11) DEFAULT NULL,
  `risk_behavior_q5` int(11) DEFAULT NULL,
  `risk_behavior_q6` int(11) DEFAULT NULL,
  `risk_behavior_q7` int(11) DEFAULT NULL,
  `risk_behavior_q8` int(11) DEFAULT NULL,
  `risk_behavior_q9` int(11) DEFAULT NULL,
  `risk_behavior_q10` int(11) DEFAULT NULL,
  `risk_behavior_q11` int(11) DEFAULT NULL,
  `risk_behavior_q12` int(11) DEFAULT NULL,
  `risk_behavior_q13` int(11) DEFAULT NULL,
  `risk_behavior_q14` int(11) DEFAULT NULL,
  `risk_behavior_q15` int(11) DEFAULT NULL,
  `risk_behavior_q16` int(11) DEFAULT NULL,
  `risk_behavior_q17` int(11) DEFAULT NULL,
  `risk_behavior_q18` int(11) DEFAULT NULL,
  `risk_behavior_q19` int(11) DEFAULT NULL,
  `risk_behavior_q20` int(11) DEFAULT NULL,
  `risk_behavior_q21` int(11) DEFAULT NULL,
  `risk_behavior_q22` int(11) DEFAULT NULL,
  `risk_behavior_q23` int(11) DEFAULT NULL,
  `risk_behavior_q24` int(11) DEFAULT NULL,
  `risk_behavior_q25` int(11) DEFAULT NULL,
  `risk_behavior_q26` int(11) DEFAULT NULL,
  `risk_behavior_q27` int(11) DEFAULT NULL,
  `risk_behavior_q28` int(11) DEFAULT NULL,
  `risk_behavior_q29` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`risk_behavior_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_baseline_riskbehavior`
--
DROP TRIGGER IF EXISTS `trig_cms_baseline_riskbehavior_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_riskbehavior_DELETE` BEFORE DELETE ON `cms_baseline_riskbehavior`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.risk_behavior_id;

set @userid=OLD.update_user;



if  OLD.risk_behavior_id !="" OR OLD.risk_behavior_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_id);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_id');

end if;



if  OLD.risk_behavior_survey !="" OR OLD.risk_behavior_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_survey);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_survey');

end if;



if  OLD.risk_behavior_loc !="" OR OLD.risk_behavior_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_loc);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_loc');

end if;



if  OLD.risk_behavior_part_id !="" OR OLD.risk_behavior_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_part_id);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_part_id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.risk_behavior_q1 !="" OR OLD.risk_behavior_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q1);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q1');

end if;



if  OLD.risk_behavior_q2 !="" OR OLD.risk_behavior_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q2);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q2');

end if;



if  OLD.risk_behavior_q3 !="" OR OLD.risk_behavior_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q3);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q3');

end if;



if  OLD.risk_behavior_q4 !="" OR OLD.risk_behavior_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q4);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q4');

end if;



if  OLD.risk_behavior_q5 !="" OR OLD.risk_behavior_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q5);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q5');

end if;



if  OLD.risk_behavior_q6 !="" OR OLD.risk_behavior_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q6);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q6');

end if;



if  OLD.risk_behavior_q7 !="" OR OLD.risk_behavior_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q7);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q7');

end if;



if  OLD.risk_behavior_q8 !="" OR OLD.risk_behavior_q8 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q8);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q8');

end if;



if  OLD.risk_behavior_q9 !="" OR OLD.risk_behavior_q9 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q9);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q9');

end if;



if  OLD.risk_behavior_q10 !="" OR OLD.risk_behavior_q10 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q10);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q10');

end if;



if  OLD.risk_behavior_q11 !="" OR OLD.risk_behavior_q11 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q11);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q11');

end if;



if  OLD.risk_behavior_q12 !="" OR OLD.risk_behavior_q12 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q12);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q12');

end if;



if  OLD.risk_behavior_q13 !="" OR OLD.risk_behavior_q13 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q13);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q13');

end if;



if  OLD.risk_behavior_q14 !="" OR OLD.risk_behavior_q14 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q14);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q14');

end if;



if  OLD.risk_behavior_q15 !="" OR OLD.risk_behavior_q15 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q15);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q15');

end if;



if  OLD.risk_behavior_q16 !="" OR OLD.risk_behavior_q16 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q16);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q16');

end if;



if  OLD.risk_behavior_q17 !="" OR OLD.risk_behavior_q17 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q17);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q17');

end if;



if  OLD.risk_behavior_q18 !="" OR OLD.risk_behavior_q18 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q18);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q18');

end if;



if  OLD.risk_behavior_q19 !="" OR OLD.risk_behavior_q19 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q19);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q19');

end if;



if  OLD.risk_behavior_q20 !="" OR OLD.risk_behavior_q20 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q20);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q20');

end if;



if  OLD.risk_behavior_q21 !="" OR OLD.risk_behavior_q21 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q21);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q21');

end if;



if  OLD.risk_behavior_q22 !="" OR OLD.risk_behavior_q22 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q22);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q22');

end if;



if  OLD.risk_behavior_q23 !="" OR OLD.risk_behavior_q23 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q23);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q23');

end if;



if  OLD.risk_behavior_q24 !="" OR OLD.risk_behavior_q24 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q24);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q24');

end if;



if  OLD.risk_behavior_q25 !="" OR OLD.risk_behavior_q25 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q25);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q25');

end if;



if  OLD.risk_behavior_q26 !="" OR OLD.risk_behavior_q26 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q26);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q26');

end if;



if  OLD.risk_behavior_q27 !="" OR OLD.risk_behavior_q27 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q27);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q27');

end if;



if  OLD.risk_behavior_q28 !="" OR OLD.risk_behavior_q28 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q28);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q28');

end if;



if  OLD.risk_behavior_q29 !="" OR OLD.risk_behavior_q29 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q29);



	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q29');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_riskbehavior(risk_behavior_survey,risk_behavior_loc,risk_behavior_part_id,visit_code,risk_behavior_q1,risk_behavior_q2,risk_behavior_q3,risk_behavior_q4,risk_behavior_q5,risk_behavior_q6,risk_behavior_q7,risk_behavior_q8,risk_behavior_q9,risk_behavior_q10,risk_behavior_q11,risk_behavior_q12,risk_behavior_q13,risk_behavior_q14,risk_behavior_q15,risk_behavior_q16,risk_behavior_q17,risk_behavior_q18,risk_behavior_q19,risk_behavior_q20,risk_behavior_q21,risk_behavior_q22,risk_behavior_q23,risk_behavior_q24,risk_behavior_q25,risk_behavior_q26,risk_behavior_q27,risk_behavior_q28,risk_behavior_q29,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.risk_behavior_survey,OLD.risk_behavior_loc,OLD.risk_behavior_part_id,OLD.visit_code,OLD.risk_behavior_q1,OLD.risk_behavior_q2,OLD.risk_behavior_q3,OLD.risk_behavior_q4,OLD.risk_behavior_q5,OLD.risk_behavior_q6,OLD.risk_behavior_q7,OLD.risk_behavior_q8,OLD.risk_behavior_q9,OLD.risk_behavior_q10,OLD.risk_behavior_q11,OLD.risk_behavior_q12,OLD.risk_behavior_q13,OLD.risk_behavior_q14,OLD.risk_behavior_q15,OLD.risk_behavior_q16,OLD.risk_behavior_q17,OLD.risk_behavior_q18,OLD.risk_behavior_q19,OLD.risk_behavior_q20,OLD.risk_behavior_q21,OLD.risk_behavior_q22,OLD.risk_behavior_q23,OLD.risk_behavior_q24,OLD.risk_behavior_q25,OLD.risk_behavior_q26,OLD.risk_behavior_q27,OLD.risk_behavior_q28,OLD.risk_behavior_q29,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_riskbehavior', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_riskbehavior_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_riskbehavior_INSERT` AFTER INSERT ON `cms_baseline_riskbehavior`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.risk_behavior_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_id);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_id');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_survey);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_survey');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_loc);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_loc');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_part_id);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q1);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q1');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q2);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q2');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q3);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q3');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q4);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q4');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q5);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q5');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q6);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q6');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q7);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q7');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q8);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q8');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q9);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q9');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q10);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q10');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q11);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q11');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q12);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q12');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q13);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q13');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q14);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q14');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q15);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q15');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q16);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q16');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q17);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q17');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q18);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q18');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q19);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q19');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q20);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q20');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q21);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q21');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q22);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q22');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q23);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q23');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q24);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q24');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q25);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q25');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q26);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q26');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q27);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q27');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q28);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q28');

set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q29);

set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q29');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_baseline_riskbehavior(risk_behavior_survey,risk_behavior_loc,risk_behavior_part_id,visit_code,risk_behavior_q1,risk_behavior_q2,risk_behavior_q3,risk_behavior_q4,risk_behavior_q5,risk_behavior_q6,risk_behavior_q7,risk_behavior_q8,risk_behavior_q9,risk_behavior_q10,risk_behavior_q11,risk_behavior_q12,risk_behavior_q13,risk_behavior_q14,risk_behavior_q15,risk_behavior_q16,risk_behavior_q17,risk_behavior_q18,risk_behavior_q19,risk_behavior_q20,risk_behavior_q21,risk_behavior_q22,risk_behavior_q23,risk_behavior_q24,risk_behavior_q25,risk_behavior_q26,risk_behavior_q27,risk_behavior_q28,risk_behavior_q29,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.risk_behavior_survey,NEW.risk_behavior_loc,NEW.risk_behavior_part_id,NEW.visit_code,NEW.risk_behavior_q1,NEW.risk_behavior_q2,NEW.risk_behavior_q3,NEW.risk_behavior_q4,NEW.risk_behavior_q5,NEW.risk_behavior_q6,NEW.risk_behavior_q7,NEW.risk_behavior_q8,NEW.risk_behavior_q9,NEW.risk_behavior_q10,NEW.risk_behavior_q11,NEW.risk_behavior_q12,NEW.risk_behavior_q13,NEW.risk_behavior_q14,NEW.risk_behavior_q15,NEW.risk_behavior_q16,NEW.risk_behavior_q17,NEW.risk_behavior_q18,NEW.risk_behavior_q19,NEW.risk_behavior_q20,NEW.risk_behavior_q21,NEW.risk_behavior_q22,NEW.risk_behavior_q23,NEW.risk_behavior_q24,NEW.risk_behavior_q25,NEW.risk_behavior_q26,NEW.risk_behavior_q27,NEW.risk_behavior_q28,NEW.risk_behavior_q29,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_riskbehavior', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_riskbehavior_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_riskbehavior_UPDATE` BEFORE UPDATE ON `cms_baseline_riskbehavior`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.risk_behavior_id;

set @userid=NEW.update_user;



if  OLD.risk_behavior_id != NEW.risk_behavior_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_id);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_id);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_id');

end if;



if  OLD.risk_behavior_survey != NEW.risk_behavior_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_survey);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_survey');

end if;



if  OLD.risk_behavior_loc != NEW.risk_behavior_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_loc);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_loc');

end if;



if  OLD.risk_behavior_part_id != NEW.risk_behavior_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_part_id);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_part_id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.risk_behavior_q1 != NEW.risk_behavior_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q1);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q1');

end if;



if  OLD.risk_behavior_q2 != NEW.risk_behavior_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q2);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q2');

end if;



if  OLD.risk_behavior_q3 != NEW.risk_behavior_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q3);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q3');

end if;



if  OLD.risk_behavior_q4 != NEW.risk_behavior_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q4);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q4');

end if;



if  OLD.risk_behavior_q5 != NEW.risk_behavior_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q5);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q5');

end if;



if  OLD.risk_behavior_q6 != NEW.risk_behavior_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q6);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q6');

end if;



if  OLD.risk_behavior_q7 != NEW.risk_behavior_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q7);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q7');

end if;



if  OLD.risk_behavior_q8 != NEW.risk_behavior_q8

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q8);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q8);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q8');

end if;



if  OLD.risk_behavior_q9 != NEW.risk_behavior_q9

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q9);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q9);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q9');

end if;



if  OLD.risk_behavior_q10 != NEW.risk_behavior_q10

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q10);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q10);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q10');

end if;



if  OLD.risk_behavior_q11 != NEW.risk_behavior_q11

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q11);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q11);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q11');

end if;



if  OLD.risk_behavior_q12 != NEW.risk_behavior_q12

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q12);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q12);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q12');

end if;



if  OLD.risk_behavior_q13 != NEW.risk_behavior_q13

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q13);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q13);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q13');

end if;



if  OLD.risk_behavior_q14 != NEW.risk_behavior_q14

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q14);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q14);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q14');

end if;



if  OLD.risk_behavior_q15 != NEW.risk_behavior_q15

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q15);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q15);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q15');

end if;



if  OLD.risk_behavior_q16 != NEW.risk_behavior_q16

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q16);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q16);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q16');

end if;



if  OLD.risk_behavior_q17 != NEW.risk_behavior_q17

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q17);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q17);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q17');

end if;



if  OLD.risk_behavior_q18 != NEW.risk_behavior_q18

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q18);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q18);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q18');

end if;



if  OLD.risk_behavior_q19 != NEW.risk_behavior_q19

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q19);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q19);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q19');

end if;



if  OLD.risk_behavior_q20 != NEW.risk_behavior_q20

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q20);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q20);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q20');

end if;



if  OLD.risk_behavior_q21 != NEW.risk_behavior_q21

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q21);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q21);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q21');

end if;



if  OLD.risk_behavior_q22 != NEW.risk_behavior_q22

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q22);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q22);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q22');

end if;



if  OLD.risk_behavior_q23 != NEW.risk_behavior_q23

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q23);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q23);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q23');

end if;



if  OLD.risk_behavior_q24 != NEW.risk_behavior_q24

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q24);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q24);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q24');

end if;



if  OLD.risk_behavior_q25 != NEW.risk_behavior_q25

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q25);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q25);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q25');

end if;



if  OLD.risk_behavior_q26 != NEW.risk_behavior_q26

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q26);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q26);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q26');

end if;



if  OLD.risk_behavior_q27 != NEW.risk_behavior_q27

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q27);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q27);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q27');

end if;



if  OLD.risk_behavior_q28 != NEW.risk_behavior_q28

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q28);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q28);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q28');

end if;



if  OLD.risk_behavior_q29 != NEW.risk_behavior_q29

then

	set @oldval =CONCAT(@oldVal,'-',OLD.risk_behavior_q29);

	set @newVal =CONCAT(@newVal,'-', NEW.risk_behavior_q29);

	set @chdCol=CONCAT(@chdCol,'-','risk_behavior_q29');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_riskbehavior(risk_behavior_survey,risk_behavior_loc,risk_behavior_part_id,visit_code,risk_behavior_q1,risk_behavior_q2,risk_behavior_q3,risk_behavior_q4,risk_behavior_q5,risk_behavior_q6,risk_behavior_q7,risk_behavior_q8,risk_behavior_q9,risk_behavior_q10,risk_behavior_q11,risk_behavior_q12,risk_behavior_q13,risk_behavior_q14,risk_behavior_q15,risk_behavior_q16,risk_behavior_q17,risk_behavior_q18,risk_behavior_q19,risk_behavior_q20,risk_behavior_q21,risk_behavior_q22,risk_behavior_q23,risk_behavior_q24,risk_behavior_q25,risk_behavior_q26,risk_behavior_q27,risk_behavior_q28,risk_behavior_q29,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.risk_behavior_survey,NEW.risk_behavior_loc,NEW.risk_behavior_part_id,NEW.visit_code,NEW.risk_behavior_q1,NEW.risk_behavior_q2,NEW.risk_behavior_q3,NEW.risk_behavior_q4,NEW.risk_behavior_q5,NEW.risk_behavior_q6,NEW.risk_behavior_q7,NEW.risk_behavior_q8,NEW.risk_behavior_q9,NEW.risk_behavior_q10,NEW.risk_behavior_q11,NEW.risk_behavior_q12,NEW.risk_behavior_q13,NEW.risk_behavior_q14,NEW.risk_behavior_q15,NEW.risk_behavior_q16,NEW.risk_behavior_q17,NEW.risk_behavior_q18,NEW.risk_behavior_q19,NEW.risk_behavior_q20,NEW.risk_behavior_q21,NEW.risk_behavior_q22,NEW.risk_behavior_q23,NEW.risk_behavior_q24,NEW.risk_behavior_q25,NEW.risk_behavior_q26,NEW.risk_behavior_q27,NEW.risk_behavior_q28,NEW.risk_behavior_q29,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_riskbehavior', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_baseline_substanceuse`
--

DROP TABLE IF EXISTS `cms_baseline_substanceuse`;
CREATE TABLE IF NOT EXISTS `cms_baseline_substanceuse` (
  `substance_use_id` int(11) NOT NULL AUTO_INCREMENT,
  `substance_use_survey` varchar(11) NOT NULL,
  `substance_use_loc` varchar(11) NOT NULL,
  `substance_use_part_id` varchar(11) NOT NULL,
  `visit_code` varchar(20) NOT NULL,
  `substance_use_q1` int(11) NOT NULL,
  `substance_use_q2` int(11) DEFAULT NULL,
  `substance_use_q3` int(11) DEFAULT NULL,
  `substance_use_q4` int(11) DEFAULT NULL,
  `substance_use_q5` int(11) DEFAULT NULL,
  `substance_use_q6a` int(11) DEFAULT NULL,
  `substance_use_q6b` int(11) DEFAULT NULL,
  `substance_use_q6c` int(11) DEFAULT NULL,
  `substance_use_q6d` int(11) DEFAULT NULL,
  `substance_use_q7a` int(11) DEFAULT NULL,
  `substance_use_q7b` int(11) DEFAULT NULL,
  `substance_use_q7c` int(11) DEFAULT NULL,
  `substance_use_q7d` int(11) DEFAULT NULL,
  `substance_use_q8a` int(11) DEFAULT NULL,
  `substance_use_q8b` int(11) DEFAULT NULL,
  `substance_use_q8c` int(11) DEFAULT NULL,
  `substance_use_q8d` int(11) DEFAULT NULL,
  `substance_use_q9a` int(11) DEFAULT NULL,
  `substance_use_q9b` int(11) DEFAULT NULL,
  `substance_use_q9c` int(11) DEFAULT NULL,
  `substance_use_q9d` int(11) DEFAULT NULL,
  `substance_use_q10a` int(11) DEFAULT NULL,
  `substance_use_q10b` int(11) DEFAULT NULL,
  `substance_use_q10c` int(11) DEFAULT NULL,
  `substance_use_q10d` int(11) DEFAULT NULL,
  `substance_use_q11a` int(11) DEFAULT NULL,
  `substance_use_q11b` int(11) DEFAULT NULL,
  `substance_use_q11c` int(11) DEFAULT NULL,
  `substance_use_q11d` int(11) DEFAULT NULL,
  `substance_use_q12a` int(11) DEFAULT NULL,
  `substance_use_q12b` int(11) DEFAULT NULL,
  `substance_use_q12c` int(11) DEFAULT NULL,
  `substance_use_q12d` int(11) DEFAULT NULL,
  `substance_use_q13a` int(11) DEFAULT NULL,
  `substance_use_q13b` int(11) DEFAULT NULL,
  `substance_use_q13c` int(11) DEFAULT NULL,
  `substance_use_q13d` int(11) DEFAULT NULL,
  `substance_use_q14` int(11) DEFAULT NULL,
  `substance_use_q15` int(11) DEFAULT NULL,
  `substance_use_q16` int(11) DEFAULT NULL,
  `substance_use_q17a` int(11) DEFAULT NULL,
  `substance_use_q17b` int(11) DEFAULT NULL,
  `substance_use_q18a` int(11) DEFAULT NULL,
  `substance_use_q18b` int(11) DEFAULT NULL,
  `substance_use_q19a` int(11) DEFAULT NULL,
  `substance_use_q19b` int(11) DEFAULT NULL,
  `substance_use_q20a` int(11) DEFAULT NULL,
  `substance_use_q20b` int(11) DEFAULT NULL,
  `substance_use_q21a` int(11) DEFAULT NULL,
  `substance_use_q21b` int(11) DEFAULT NULL,
  `substance_use_q22a` int(11) DEFAULT NULL,
  `substance_use_q22b` int(11) DEFAULT NULL,
  `substance_use_q23a` int(11) DEFAULT NULL,
  `substance_use_q23b` int(11) DEFAULT NULL,
  `substance_use_q24a` int(11) DEFAULT NULL,
  `substance_use_q24b` int(11) DEFAULT NULL,
  `substance_use_q25a` int(11) DEFAULT NULL,
  `substance_use_q25b` int(11) DEFAULT NULL,
  `substance_use_q26a` int(11) DEFAULT NULL,
  `substance_use_q26b` int(11) DEFAULT NULL,
  `substance_use_q27a` int(11) DEFAULT NULL,
  `substance_use_q27b` int(11) DEFAULT NULL,
  `substance_use_q28a` int(11) DEFAULT NULL,
  `substance_use_q28b` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`substance_use_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_baseline_substanceuse`
--
DROP TRIGGER IF EXISTS `trig_cms_baseline_substanceuse_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_substanceuse_DELETE` BEFORE DELETE ON `cms_baseline_substanceuse`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.substance_use_id;

set @userid=OLD.update_user;



if  OLD.substance_use_id !="" OR OLD.substance_use_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_id);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_id');

end if;



if  OLD.substance_use_survey !="" OR OLD.substance_use_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_survey);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_survey');

end if;



if  OLD.substance_use_loc !="" OR OLD.substance_use_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_loc);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_loc');

end if;



if  OLD.substance_use_part_id !="" OR OLD.substance_use_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_part_id);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_part_id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.substance_use_q1 !="" OR OLD.substance_use_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q1);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q1');

end if;



if  OLD.substance_use_q2 !="" OR OLD.substance_use_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q2);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q2');

end if;



if  OLD.substance_use_q3 !="" OR OLD.substance_use_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q3);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q3');

end if;



if  OLD.substance_use_q4 !="" OR OLD.substance_use_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q4);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q4');

end if;



if  OLD.substance_use_q5 !="" OR OLD.substance_use_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q5);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q5');

end if;



if  OLD.substance_use_q6a !="" OR OLD.substance_use_q6a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q6a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q6a');

end if;



if  OLD.substance_use_q6b !="" OR OLD.substance_use_q6b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q6b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q6b');

end if;



if  OLD.substance_use_q6c !="" OR OLD.substance_use_q6c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q6c);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q6c');

end if;



if  OLD.substance_use_q6d !="" OR OLD.substance_use_q6d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q6d);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q6d');

end if;



if  OLD.substance_use_q7a !="" OR OLD.substance_use_q7a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q7a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q7a');

end if;



if  OLD.substance_use_q7b !="" OR OLD.substance_use_q7b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q7b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q7b');

end if;



if  OLD.substance_use_q7c !="" OR OLD.substance_use_q7c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q7c);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q7c');

end if;



if  OLD.substance_use_q7d !="" OR OLD.substance_use_q7d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q7d);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q7d');

end if;



if  OLD.substance_use_q8a !="" OR OLD.substance_use_q8a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q8a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q8a');

end if;



if  OLD.substance_use_q8b !="" OR OLD.substance_use_q8b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q8b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q8b');

end if;



if  OLD.substance_use_q8c !="" OR OLD.substance_use_q8c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q8c);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q8c');

end if;



if  OLD.substance_use_q8d !="" OR OLD.substance_use_q8d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q8d);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q8d');

end if;



if  OLD.substance_use_q9a !="" OR OLD.substance_use_q9a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q9a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q9a');

end if;



if  OLD.substance_use_q9b !="" OR OLD.substance_use_q9b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q9b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q9b');

end if;



if  OLD.substance_use_q9c !="" OR OLD.substance_use_q9c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q9c);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q9c');

end if;



if  OLD.substance_use_q9d !="" OR OLD.substance_use_q9d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q9d);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q9d');

end if;



if  OLD.substance_use_q10a !="" OR OLD.substance_use_q10a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q10a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q10a');

end if;



if  OLD.substance_use_q10b !="" OR OLD.substance_use_q10b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q10b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q10b');

end if;



if  OLD.substance_use_q10c !="" OR OLD.substance_use_q10c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q10c);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q10c');

end if;



if  OLD.substance_use_q10d !="" OR OLD.substance_use_q10d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q10d);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q10d');

end if;



if  OLD.substance_use_q11a !="" OR OLD.substance_use_q11a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q11a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q11a');

end if;



if  OLD.substance_use_q11b !="" OR OLD.substance_use_q11b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q11b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q11b');

end if;



if  OLD.substance_use_q11c !="" OR OLD.substance_use_q11c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q11c);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q11c');

end if;



if  OLD.substance_use_q11d !="" OR OLD.substance_use_q11d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q11d);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q11d');

end if;



if  OLD.substance_use_q12a !="" OR OLD.substance_use_q12a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q12a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q12a');

end if;



if  OLD.substance_use_q12b !="" OR OLD.substance_use_q12b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q12b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q12b');

end if;



if  OLD.substance_use_q12c !="" OR OLD.substance_use_q12c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q12c);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q12c');

end if;



if  OLD.substance_use_q12d !="" OR OLD.substance_use_q12d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q12d);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q12d');

end if;



if  OLD.substance_use_q13a !="" OR OLD.substance_use_q13a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q13a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q13a');

end if;



if  OLD.substance_use_q13b !="" OR OLD.substance_use_q13b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q13b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q13b');

end if;



if  OLD.substance_use_q13c !="" OR OLD.substance_use_q13c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q13c);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q13c');

end if;



if  OLD.substance_use_q13d !="" OR OLD.substance_use_q13d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q13d);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q13d');

end if;



if  OLD.substance_use_q14 !="" OR OLD.substance_use_q14 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q14);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q14');

end if;



if  OLD.substance_use_q15 !="" OR OLD.substance_use_q15 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q15);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q15');

end if;



if  OLD.substance_use_q16 !="" OR OLD.substance_use_q16 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q16);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q16');

end if;



if  OLD.substance_use_q17a !="" OR OLD.substance_use_q17a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q17a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q17a');

end if;



if  OLD.substance_use_q17b !="" OR OLD.substance_use_q17b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q17b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q17b');

end if;



if  OLD.substance_use_q18a !="" OR OLD.substance_use_q18a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q18a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q18a');

end if;



if  OLD.substance_use_q18b !="" OR OLD.substance_use_q18b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q18b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q18b');

end if;



if  OLD.substance_use_q19a !="" OR OLD.substance_use_q19a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q19a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q19a');

end if;



if  OLD.substance_use_q19b !="" OR OLD.substance_use_q19b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q19b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q19b');

end if;



if  OLD.substance_use_q20a !="" OR OLD.substance_use_q20a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q20a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q20a');

end if;



if  OLD.substance_use_q20b !="" OR OLD.substance_use_q20b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q20b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q20b');

end if;



if  OLD.substance_use_q21a !="" OR OLD.substance_use_q21a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q21a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q21a');

end if;



if  OLD.substance_use_q21b !="" OR OLD.substance_use_q21b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q21b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q21b');

end if;



if  OLD.substance_use_q22a !="" OR OLD.substance_use_q22a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q22a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q22a');

end if;



if  OLD.substance_use_q22b !="" OR OLD.substance_use_q22b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q22b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q22b');

end if;



if  OLD.substance_use_q23a !="" OR OLD.substance_use_q23a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q23a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q23a');

end if;



if  OLD.substance_use_q23b !="" OR OLD.substance_use_q23b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q23b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q23b');

end if;



if  OLD.substance_use_q24a !="" OR OLD.substance_use_q24a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q24a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q24a');

end if;



if  OLD.substance_use_q24b !="" OR OLD.substance_use_q24b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q24b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q24b');

end if;



if  OLD.substance_use_q25a !="" OR OLD.substance_use_q25a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q25a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q25a');

end if;



if  OLD.substance_use_q25b !="" OR OLD.substance_use_q25b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q25b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q25b');

end if;



if  OLD.substance_use_q26a !="" OR OLD.substance_use_q26a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q26a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q26a');

end if;



if  OLD.substance_use_q26b !="" OR OLD.substance_use_q26b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q26b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q26b');

end if;



if  OLD.substance_use_q27a !="" OR OLD.substance_use_q27a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q27a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q27a');

end if;



if  OLD.substance_use_q27b !="" OR OLD.substance_use_q27b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q27b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q27b');

end if;



if  OLD.substance_use_q28a !="" OR OLD.substance_use_q28a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q28a);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q28a');

end if;



if  OLD.substance_use_q28b !="" OR OLD.substance_use_q28b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q28b);



	set @chdCol=CONCAT(@chdCol,'-','substance_use_q28b');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_substanceuse(substance_use_survey,substance_use_loc,substance_use_part_id,visit_code,substance_use_q1,substance_use_q2,substance_use_q3,substance_use_q4,substance_use_q5,substance_use_q6a,substance_use_q6b,substance_use_q6c,substance_use_q6d,substance_use_q7a,substance_use_q7b,substance_use_q7c,substance_use_q7d,substance_use_q8a,substance_use_q8b,substance_use_q8c,substance_use_q8d,substance_use_q9a,substance_use_q9b,substance_use_q9c,substance_use_q9d,substance_use_q10a,substance_use_q10b,substance_use_q10c,substance_use_q10d,substance_use_q11a,substance_use_q11b,substance_use_q11c,substance_use_q11d,substance_use_q12a,substance_use_q12b,substance_use_q12c,substance_use_q12d,substance_use_q13a,substance_use_q13b,substance_use_q13c,substance_use_q13d,substance_use_q14,substance_use_q15,substance_use_q16,substance_use_q17a,substance_use_q17b,substance_use_q18a,substance_use_q18b,substance_use_q19a,substance_use_q19b,substance_use_q20a,substance_use_q20b,substance_use_q21a,substance_use_q21b,substance_use_q22a,substance_use_q22b,substance_use_q23a,substance_use_q23b,substance_use_q24a,substance_use_q24b,substance_use_q25a,substance_use_q25b,substance_use_q26a,substance_use_q26b,substance_use_q27a,substance_use_q27b,substance_use_q28a,substance_use_q28b,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.substance_use_survey,OLD.substance_use_loc,OLD.substance_use_part_id,OLD.visit_code,OLD.substance_use_q1,OLD.substance_use_q2,OLD.substance_use_q3,OLD.substance_use_q4,OLD.substance_use_q5,OLD.substance_use_q6a,OLD.substance_use_q6b,OLD.substance_use_q6c,OLD.substance_use_q6d,OLD.substance_use_q7a,OLD.substance_use_q7b,OLD.substance_use_q7c,OLD.substance_use_q7d,OLD.substance_use_q8a,OLD.substance_use_q8b,OLD.substance_use_q8c,OLD.substance_use_q8d,OLD.substance_use_q9a,OLD.substance_use_q9b,OLD.substance_use_q9c,OLD.substance_use_q9d,OLD.substance_use_q10a,OLD.substance_use_q10b,OLD.substance_use_q10c,OLD.substance_use_q10d,OLD.substance_use_q11a,OLD.substance_use_q11b,OLD.substance_use_q11c,OLD.substance_use_q11d,OLD.substance_use_q12a,OLD.substance_use_q12b,OLD.substance_use_q12c,OLD.substance_use_q12d,OLD.substance_use_q13a,OLD.substance_use_q13b,OLD.substance_use_q13c,OLD.substance_use_q13d,OLD.substance_use_q14,OLD.substance_use_q15,OLD.substance_use_q16,OLD.substance_use_q17a,OLD.substance_use_q17b,OLD.substance_use_q18a,OLD.substance_use_q18b,OLD.substance_use_q19a,OLD.substance_use_q19b,OLD.substance_use_q20a,OLD.substance_use_q20b,OLD.substance_use_q21a,OLD.substance_use_q21b,OLD.substance_use_q22a,OLD.substance_use_q22b,OLD.substance_use_q23a,OLD.substance_use_q23b,OLD.substance_use_q24a,OLD.substance_use_q24b,OLD.substance_use_q25a,OLD.substance_use_q25b,OLD.substance_use_q26a,OLD.substance_use_q26b,OLD.substance_use_q27a,OLD.substance_use_q27b,OLD.substance_use_q28a,OLD.substance_use_q28b,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_substanceuse', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_substanceuse_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_substanceuse_INSERT` AFTER INSERT ON `cms_baseline_substanceuse`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.substance_use_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.substance_use_id);

set @chdCol=CONCAT(@chdCol,'-','substance_use_id');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_survey);

set @chdCol=CONCAT(@chdCol,'-','substance_use_survey');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_loc);

set @chdCol=CONCAT(@chdCol,'-','substance_use_loc');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_part_id);

set @chdCol=CONCAT(@chdCol,'-','substance_use_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q1);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q1');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q2);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q2');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q3);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q3');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q4);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q4');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q5);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q5');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q6a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q6a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q6b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q6b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q6c);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q6c');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q6d);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q6d');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q7a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q7a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q7b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q7b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q7c);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q7c');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q7d);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q7d');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q8a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q8a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q8b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q8b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q8c);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q8c');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q8d);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q8d');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q9a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q9a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q9b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q9b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q9c);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q9c');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q9d);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q9d');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q10a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q10a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q10b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q10b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q10c);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q10c');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q10d);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q10d');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q11a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q11a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q11b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q11b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q11c);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q11c');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q11d);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q11d');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q12a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q12a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q12b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q12b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q12c);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q12c');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q12d);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q12d');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q13a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q13a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q13b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q13b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q13c);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q13c');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q13d);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q13d');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q14);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q14');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q15);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q15');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q16);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q16');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q17a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q17a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q17b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q17b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q18a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q18a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q18b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q18b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q19a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q19a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q19b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q19b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q20a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q20a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q20b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q20b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q21a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q21a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q21b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q21b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q22a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q22a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q22b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q22b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q23a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q23a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q23b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q23b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q24a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q24a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q24b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q24b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q25a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q25a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q25b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q25b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q26a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q26a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q26b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q26b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q27a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q27a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q27b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q27b');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q28a);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q28a');

set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q28b);

set @chdCol=CONCAT(@chdCol,'-','substance_use_q28b');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_baseline_substanceuse(substance_use_survey,substance_use_loc,substance_use_part_id,visit_code,substance_use_q1,substance_use_q2,substance_use_q3,substance_use_q4,substance_use_q5,substance_use_q6a,substance_use_q6b,substance_use_q6c,substance_use_q6d,substance_use_q7a,substance_use_q7b,substance_use_q7c,substance_use_q7d,substance_use_q8a,substance_use_q8b,substance_use_q8c,substance_use_q8d,substance_use_q9a,substance_use_q9b,substance_use_q9c,substance_use_q9d,substance_use_q10a,substance_use_q10b,substance_use_q10c,substance_use_q10d,substance_use_q11a,substance_use_q11b,substance_use_q11c,substance_use_q11d,substance_use_q12a,substance_use_q12b,substance_use_q12c,substance_use_q12d,substance_use_q13a,substance_use_q13b,substance_use_q13c,substance_use_q13d,substance_use_q14,substance_use_q15,substance_use_q16,substance_use_q17a,substance_use_q17b,substance_use_q18a,substance_use_q18b,substance_use_q19a,substance_use_q19b,substance_use_q20a,substance_use_q20b,substance_use_q21a,substance_use_q21b,substance_use_q22a,substance_use_q22b,substance_use_q23a,substance_use_q23b,substance_use_q24a,substance_use_q24b,substance_use_q25a,substance_use_q25b,substance_use_q26a,substance_use_q26b,substance_use_q27a,substance_use_q27b,substance_use_q28a,substance_use_q28b,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.substance_use_survey,NEW.substance_use_loc,NEW.substance_use_part_id,NEW.visit_code,NEW.substance_use_q1,NEW.substance_use_q2,NEW.substance_use_q3,NEW.substance_use_q4,NEW.substance_use_q5,NEW.substance_use_q6a,NEW.substance_use_q6b,NEW.substance_use_q6c,NEW.substance_use_q6d,NEW.substance_use_q7a,NEW.substance_use_q7b,NEW.substance_use_q7c,NEW.substance_use_q7d,NEW.substance_use_q8a,NEW.substance_use_q8b,NEW.substance_use_q8c,NEW.substance_use_q8d,NEW.substance_use_q9a,NEW.substance_use_q9b,NEW.substance_use_q9c,NEW.substance_use_q9d,NEW.substance_use_q10a,NEW.substance_use_q10b,NEW.substance_use_q10c,NEW.substance_use_q10d,NEW.substance_use_q11a,NEW.substance_use_q11b,NEW.substance_use_q11c,NEW.substance_use_q11d,NEW.substance_use_q12a,NEW.substance_use_q12b,NEW.substance_use_q12c,NEW.substance_use_q12d,NEW.substance_use_q13a,NEW.substance_use_q13b,NEW.substance_use_q13c,NEW.substance_use_q13d,NEW.substance_use_q14,NEW.substance_use_q15,NEW.substance_use_q16,NEW.substance_use_q17a,NEW.substance_use_q17b,NEW.substance_use_q18a,NEW.substance_use_q18b,NEW.substance_use_q19a,NEW.substance_use_q19b,NEW.substance_use_q20a,NEW.substance_use_q20b,NEW.substance_use_q21a,NEW.substance_use_q21b,NEW.substance_use_q22a,NEW.substance_use_q22b,NEW.substance_use_q23a,NEW.substance_use_q23b,NEW.substance_use_q24a,NEW.substance_use_q24b,NEW.substance_use_q25a,NEW.substance_use_q25b,NEW.substance_use_q26a,NEW.substance_use_q26b,NEW.substance_use_q27a,NEW.substance_use_q27b,NEW.substance_use_q28a,NEW.substance_use_q28b,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_substanceuse', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_baseline_substanceuse_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_baseline_substanceuse_UPDATE` BEFORE UPDATE ON `cms_baseline_substanceuse`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.substance_use_id;

set @userid=NEW.update_user;



if  OLD.substance_use_id != NEW.substance_use_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_id);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_id);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_id');

end if;



if  OLD.substance_use_survey != NEW.substance_use_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_survey);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_survey');

end if;



if  OLD.substance_use_loc != NEW.substance_use_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_loc);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_loc');

end if;



if  OLD.substance_use_part_id != NEW.substance_use_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_part_id);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_part_id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.substance_use_q1 != NEW.substance_use_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q1);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q1');

end if;



if  OLD.substance_use_q2 != NEW.substance_use_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q2);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q2');

end if;



if  OLD.substance_use_q3 != NEW.substance_use_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q3);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q3');

end if;



if  OLD.substance_use_q4 != NEW.substance_use_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q4);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q4');

end if;



if  OLD.substance_use_q5 != NEW.substance_use_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q5);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q5');

end if;



if  OLD.substance_use_q6a != NEW.substance_use_q6a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q6a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q6a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q6a');

end if;



if  OLD.substance_use_q6b != NEW.substance_use_q6b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q6b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q6b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q6b');

end if;



if  OLD.substance_use_q6c != NEW.substance_use_q6c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q6c);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q6c);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q6c');

end if;



if  OLD.substance_use_q6d != NEW.substance_use_q6d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q6d);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q6d);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q6d');

end if;



if  OLD.substance_use_q7a != NEW.substance_use_q7a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q7a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q7a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q7a');

end if;



if  OLD.substance_use_q7b != NEW.substance_use_q7b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q7b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q7b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q7b');

end if;



if  OLD.substance_use_q7c != NEW.substance_use_q7c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q7c);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q7c);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q7c');

end if;



if  OLD.substance_use_q7d != NEW.substance_use_q7d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q7d);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q7d);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q7d');

end if;



if  OLD.substance_use_q8a != NEW.substance_use_q8a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q8a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q8a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q8a');

end if;



if  OLD.substance_use_q8b != NEW.substance_use_q8b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q8b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q8b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q8b');

end if;



if  OLD.substance_use_q8c != NEW.substance_use_q8c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q8c);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q8c);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q8c');

end if;



if  OLD.substance_use_q8d != NEW.substance_use_q8d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q8d);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q8d);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q8d');

end if;



if  OLD.substance_use_q9a != NEW.substance_use_q9a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q9a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q9a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q9a');

end if;



if  OLD.substance_use_q9b != NEW.substance_use_q9b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q9b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q9b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q9b');

end if;



if  OLD.substance_use_q9c != NEW.substance_use_q9c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q9c);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q9c);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q9c');

end if;



if  OLD.substance_use_q9d != NEW.substance_use_q9d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q9d);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q9d);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q9d');

end if;



if  OLD.substance_use_q10a != NEW.substance_use_q10a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q10a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q10a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q10a');

end if;



if  OLD.substance_use_q10b != NEW.substance_use_q10b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q10b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q10b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q10b');

end if;



if  OLD.substance_use_q10c != NEW.substance_use_q10c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q10c);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q10c);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q10c');

end if;



if  OLD.substance_use_q10d != NEW.substance_use_q10d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q10d);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q10d);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q10d');

end if;



if  OLD.substance_use_q11a != NEW.substance_use_q11a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q11a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q11a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q11a');

end if;



if  OLD.substance_use_q11b != NEW.substance_use_q11b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q11b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q11b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q11b');

end if;



if  OLD.substance_use_q11c != NEW.substance_use_q11c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q11c);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q11c);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q11c');

end if;



if  OLD.substance_use_q11d != NEW.substance_use_q11d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q11d);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q11d);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q11d');

end if;



if  OLD.substance_use_q12a != NEW.substance_use_q12a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q12a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q12a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q12a');

end if;



if  OLD.substance_use_q12b != NEW.substance_use_q12b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q12b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q12b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q12b');

end if;



if  OLD.substance_use_q12c != NEW.substance_use_q12c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q12c);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q12c);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q12c');

end if;



if  OLD.substance_use_q12d != NEW.substance_use_q12d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q12d);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q12d);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q12d');

end if;



if  OLD.substance_use_q13a != NEW.substance_use_q13a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q13a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q13a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q13a');

end if;



if  OLD.substance_use_q13b != NEW.substance_use_q13b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q13b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q13b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q13b');

end if;



if  OLD.substance_use_q13c != NEW.substance_use_q13c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q13c);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q13c);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q13c');

end if;



if  OLD.substance_use_q13d != NEW.substance_use_q13d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q13d);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q13d);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q13d');

end if;



if  OLD.substance_use_q14 != NEW.substance_use_q14

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q14);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q14);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q14');

end if;



if  OLD.substance_use_q15 != NEW.substance_use_q15

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q15);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q15);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q15');

end if;



if  OLD.substance_use_q16 != NEW.substance_use_q16

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q16);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q16);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q16');

end if;



if  OLD.substance_use_q17a != NEW.substance_use_q17a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q17a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q17a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q17a');

end if;



if  OLD.substance_use_q17b != NEW.substance_use_q17b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q17b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q17b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q17b');

end if;



if  OLD.substance_use_q18a != NEW.substance_use_q18a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q18a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q18a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q18a');

end if;



if  OLD.substance_use_q18b != NEW.substance_use_q18b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q18b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q18b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q18b');

end if;



if  OLD.substance_use_q19a != NEW.substance_use_q19a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q19a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q19a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q19a');

end if;



if  OLD.substance_use_q19b != NEW.substance_use_q19b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q19b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q19b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q19b');

end if;



if  OLD.substance_use_q20a != NEW.substance_use_q20a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q20a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q20a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q20a');

end if;



if  OLD.substance_use_q20b != NEW.substance_use_q20b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q20b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q20b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q20b');

end if;



if  OLD.substance_use_q21a != NEW.substance_use_q21a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q21a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q21a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q21a');

end if;



if  OLD.substance_use_q21b != NEW.substance_use_q21b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q21b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q21b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q21b');

end if;



if  OLD.substance_use_q22a != NEW.substance_use_q22a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q22a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q22a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q22a');

end if;



if  OLD.substance_use_q22b != NEW.substance_use_q22b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q22b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q22b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q22b');

end if;



if  OLD.substance_use_q23a != NEW.substance_use_q23a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q23a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q23a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q23a');

end if;



if  OLD.substance_use_q23b != NEW.substance_use_q23b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q23b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q23b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q23b');

end if;



if  OLD.substance_use_q24a != NEW.substance_use_q24a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q24a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q24a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q24a');

end if;



if  OLD.substance_use_q24b != NEW.substance_use_q24b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q24b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q24b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q24b');

end if;



if  OLD.substance_use_q25a != NEW.substance_use_q25a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q25a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q25a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q25a');

end if;



if  OLD.substance_use_q25b != NEW.substance_use_q25b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q25b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q25b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q25b');

end if;



if  OLD.substance_use_q26a != NEW.substance_use_q26a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q26a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q26a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q26a');

end if;



if  OLD.substance_use_q26b != NEW.substance_use_q26b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q26b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q26b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q26b');

end if;



if  OLD.substance_use_q27a != NEW.substance_use_q27a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q27a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q27a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q27a');

end if;



if  OLD.substance_use_q27b != NEW.substance_use_q27b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q27b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q27b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q27b');

end if;



if  OLD.substance_use_q28a != NEW.substance_use_q28a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q28a);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q28a);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q28a');

end if;



if  OLD.substance_use_q28b != NEW.substance_use_q28b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.substance_use_q28b);

	set @newVal =CONCAT(@newVal,'-', NEW.substance_use_q28b);

	set @chdCol=CONCAT(@chdCol,'-','substance_use_q28b');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_baseline_substanceuse(substance_use_survey,substance_use_loc,substance_use_part_id,visit_code,substance_use_q1,substance_use_q2,substance_use_q3,substance_use_q4,substance_use_q5,substance_use_q6a,substance_use_q6b,substance_use_q6c,substance_use_q6d,substance_use_q7a,substance_use_q7b,substance_use_q7c,substance_use_q7d,substance_use_q8a,substance_use_q8b,substance_use_q8c,substance_use_q8d,substance_use_q9a,substance_use_q9b,substance_use_q9c,substance_use_q9d,substance_use_q10a,substance_use_q10b,substance_use_q10c,substance_use_q10d,substance_use_q11a,substance_use_q11b,substance_use_q11c,substance_use_q11d,substance_use_q12a,substance_use_q12b,substance_use_q12c,substance_use_q12d,substance_use_q13a,substance_use_q13b,substance_use_q13c,substance_use_q13d,substance_use_q14,substance_use_q15,substance_use_q16,substance_use_q17a,substance_use_q17b,substance_use_q18a,substance_use_q18b,substance_use_q19a,substance_use_q19b,substance_use_q20a,substance_use_q20b,substance_use_q21a,substance_use_q21b,substance_use_q22a,substance_use_q22b,substance_use_q23a,substance_use_q23b,substance_use_q24a,substance_use_q24b,substance_use_q25a,substance_use_q25b,substance_use_q26a,substance_use_q26b,substance_use_q27a,substance_use_q27b,substance_use_q28a,substance_use_q28b,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.substance_use_survey,NEW.substance_use_loc,NEW.substance_use_part_id,NEW.visit_code,NEW.substance_use_q1,NEW.substance_use_q2,NEW.substance_use_q3,NEW.substance_use_q4,NEW.substance_use_q5,NEW.substance_use_q6a,NEW.substance_use_q6b,NEW.substance_use_q6c,NEW.substance_use_q6d,NEW.substance_use_q7a,NEW.substance_use_q7b,NEW.substance_use_q7c,NEW.substance_use_q7d,NEW.substance_use_q8a,NEW.substance_use_q8b,NEW.substance_use_q8c,NEW.substance_use_q8d,NEW.substance_use_q9a,NEW.substance_use_q9b,NEW.substance_use_q9c,NEW.substance_use_q9d,NEW.substance_use_q10a,NEW.substance_use_q10b,NEW.substance_use_q10c,NEW.substance_use_q10d,NEW.substance_use_q11a,NEW.substance_use_q11b,NEW.substance_use_q11c,NEW.substance_use_q11d,NEW.substance_use_q12a,NEW.substance_use_q12b,NEW.substance_use_q12c,NEW.substance_use_q12d,NEW.substance_use_q13a,NEW.substance_use_q13b,NEW.substance_use_q13c,NEW.substance_use_q13d,NEW.substance_use_q14,NEW.substance_use_q15,NEW.substance_use_q16,NEW.substance_use_q17a,NEW.substance_use_q17b,NEW.substance_use_q18a,NEW.substance_use_q18b,NEW.substance_use_q19a,NEW.substance_use_q19b,NEW.substance_use_q20a,NEW.substance_use_q20b,NEW.substance_use_q21a,NEW.substance_use_q21b,NEW.substance_use_q22a,NEW.substance_use_q22b,NEW.substance_use_q23a,NEW.substance_use_q23b,NEW.substance_use_q24a,NEW.substance_use_q24b,NEW.substance_use_q25a,NEW.substance_use_q25b,NEW.substance_use_q26a,NEW.substance_use_q26b,NEW.substance_use_q27a,NEW.substance_use_q27b,NEW.substance_use_q28a,NEW.substance_use_q28b,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_baseline_substanceuse', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_cd4`
--

DROP TABLE IF EXISTS `cms_cd4`;
CREATE TABLE IF NOT EXISTS `cms_cd4` (
  `cd4_test_id` int(11) NOT NULL AUTO_INCREMENT,
  `cd4_test_survey` varchar(11) NOT NULL,
  `cd4_test_loc` varchar(11) NOT NULL,
  `cd4_test_part_id` varchar(11) NOT NULL,
  `cd4_test_q1` int(11) NOT NULL,
  `cd4_test_q2` int(11) DEFAULT NULL,
  `cd4_test_q3` int(11) DEFAULT NULL,
  `cd4_test_q4` int(11) DEFAULT NULL,
  `cd4_test_q5` int(11) DEFAULT NULL,
  `cd4_test_q6` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`cd4_test_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_cd4`
--
DROP TRIGGER IF EXISTS `trig_cms_cd4_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_cd4_DELETE` BEFORE DELETE ON `cms_cd4`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.cd4_test_id;

set @userid=OLD.update_user;



if  OLD.cd4_test_id !="" OR OLD.cd4_test_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_id);



	set @chdCol=CONCAT(@chdCol,'-','cd4_test_id');

end if;



if  OLD.cd4_test_survey !="" OR OLD.cd4_test_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_survey);



	set @chdCol=CONCAT(@chdCol,'-','cd4_test_survey');

end if;



if  OLD.cd4_test_loc !="" OR OLD.cd4_test_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_loc);



	set @chdCol=CONCAT(@chdCol,'-','cd4_test_loc');

end if;



if  OLD.cd4_test_part_id !="" OR OLD.cd4_test_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_part_id);



	set @chdCol=CONCAT(@chdCol,'-','cd4_test_part_id');

end if;



if  OLD.cd4_test_q1 !="" OR OLD.cd4_test_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_q1);



	set @chdCol=CONCAT(@chdCol,'-','cd4_test_q1');

end if;



if  OLD.cd4_test_q2 !="" OR OLD.cd4_test_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_q2);



	set @chdCol=CONCAT(@chdCol,'-','cd4_test_q2');

end if;



if  OLD.cd4_test_q3 !="" OR OLD.cd4_test_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_q3);



	set @chdCol=CONCAT(@chdCol,'-','cd4_test_q3');

end if;



if  OLD.cd4_test_q4 !="" OR OLD.cd4_test_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_q4);



	set @chdCol=CONCAT(@chdCol,'-','cd4_test_q4');

end if;



if  OLD.cd4_test_q5 !="" OR OLD.cd4_test_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_q5);



	set @chdCol=CONCAT(@chdCol,'-','cd4_test_q5');

end if;



if  OLD.cd4_test_q6 !="" OR OLD.cd4_test_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_q6);



	set @chdCol=CONCAT(@chdCol,'-','cd4_test_q6');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_cd4(cd4_test_survey,cd4_test_loc,cd4_test_part_id,cd4_test_q1,cd4_test_q2,cd4_test_q3,cd4_test_q4,cd4_test_q5,cd4_test_q6,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.cd4_test_survey,OLD.cd4_test_loc,OLD.cd4_test_part_id,OLD.cd4_test_q1,OLD.cd4_test_q2,OLD.cd4_test_q3,OLD.cd4_test_q4,OLD.cd4_test_q5,OLD.cd4_test_q6,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_cd4', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_cd4_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_cd4_INSERT` AFTER INSERT ON `cms_cd4`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.cd4_test_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_id);

set @chdCol=CONCAT(@chdCol,'-','cd4_test_id');

set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_survey);

set @chdCol=CONCAT(@chdCol,'-','cd4_test_survey');

set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_loc);

set @chdCol=CONCAT(@chdCol,'-','cd4_test_loc');

set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_part_id);

set @chdCol=CONCAT(@chdCol,'-','cd4_test_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_q1);

set @chdCol=CONCAT(@chdCol,'-','cd4_test_q1');

set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_q2);

set @chdCol=CONCAT(@chdCol,'-','cd4_test_q2');

set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_q3);

set @chdCol=CONCAT(@chdCol,'-','cd4_test_q3');

set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_q4);

set @chdCol=CONCAT(@chdCol,'-','cd4_test_q4');

set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_q5);

set @chdCol=CONCAT(@chdCol,'-','cd4_test_q5');

set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_q6);

set @chdCol=CONCAT(@chdCol,'-','cd4_test_q6');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_cd4(cd4_test_survey,cd4_test_loc,cd4_test_part_id,cd4_test_q1,cd4_test_q2,cd4_test_q3,cd4_test_q4,cd4_test_q5,cd4_test_q6,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.cd4_test_survey,NEW.cd4_test_loc,NEW.cd4_test_part_id,NEW.cd4_test_q1,NEW.cd4_test_q2,NEW.cd4_test_q3,NEW.cd4_test_q4,NEW.cd4_test_q5,NEW.cd4_test_q6,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_cd4', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_cd4_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_cd4_UPDATE` BEFORE UPDATE ON `cms_cd4`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.cd4_test_id;

set @userid=NEW.update_user;



if  OLD.cd4_test_id != NEW.cd4_test_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_id);

	set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_id);

	set @chdCol=CONCAT(@chdCol,'-','cd4_test_id');

end if;



if  OLD.cd4_test_survey != NEW.cd4_test_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_survey);

	set @chdCol=CONCAT(@chdCol,'-','cd4_test_survey');

end if;



if  OLD.cd4_test_loc != NEW.cd4_test_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_loc);

	set @chdCol=CONCAT(@chdCol,'-','cd4_test_loc');

end if;



if  OLD.cd4_test_part_id != NEW.cd4_test_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_part_id);

	set @chdCol=CONCAT(@chdCol,'-','cd4_test_part_id');

end if;



if  OLD.cd4_test_q1 != NEW.cd4_test_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_q1);

	set @chdCol=CONCAT(@chdCol,'-','cd4_test_q1');

end if;



if  OLD.cd4_test_q2 != NEW.cd4_test_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_q2);

	set @chdCol=CONCAT(@chdCol,'-','cd4_test_q2');

end if;



if  OLD.cd4_test_q3 != NEW.cd4_test_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_q3);

	set @chdCol=CONCAT(@chdCol,'-','cd4_test_q3');

end if;



if  OLD.cd4_test_q4 != NEW.cd4_test_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_q4);

	set @chdCol=CONCAT(@chdCol,'-','cd4_test_q4');

end if;



if  OLD.cd4_test_q5 != NEW.cd4_test_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_q5);

	set @chdCol=CONCAT(@chdCol,'-','cd4_test_q5');

end if;



if  OLD.cd4_test_q6 != NEW.cd4_test_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.cd4_test_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.cd4_test_q6);

	set @chdCol=CONCAT(@chdCol,'-','cd4_test_q6');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_cd4(cd4_test_survey,cd4_test_loc,cd4_test_part_id,cd4_test_q1,cd4_test_q2,cd4_test_q3,cd4_test_q4,cd4_test_q5,cd4_test_q6,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.cd4_test_survey,NEW.cd4_test_loc,NEW.cd4_test_part_id,NEW.cd4_test_q1,NEW.cd4_test_q2,NEW.cd4_test_q3,NEW.cd4_test_q4,NEW.cd4_test_q5,NEW.cd4_test_q6,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_cd4', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_clientidref`
--

DROP TABLE IF EXISTS `cms_clientidref`;
CREATE TABLE IF NOT EXISTS `cms_clientidref` (
  `clientid_ref_sur` varchar(11) NOT NULL COMMENT 'Survey',
  `clientid_ref_loc` varchar(11) NOT NULL COMMENT 'Location',
  `clientid_ref_code` int(11) NOT NULL COMMENT 'Last Client id Number',
  `record_date` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  UNIQUE KEY `clientid_ref_sur` (`clientid_ref_sur`,`clientid_ref_loc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `cms_contact`
--

DROP TABLE IF EXISTS `cms_contact`;
CREATE TABLE IF NOT EXISTS `cms_contact` (
  `contact_id` int(11) NOT NULL AUTO_INCREMENT,
  `contact_survey` varchar(11) NOT NULL,
  `contact_loc` varchar(11) NOT NULL,
  `contact_part_id` varchar(11) NOT NULL,
  `visit_code` varchar(20) NOT NULL,
  `contact_q1` varchar(100) DEFAULT NULL,
  `contact_q2` int(11) DEFAULT NULL,
  `contact_q3` varchar(11) DEFAULT NULL,
  `contact_q4` varchar(100) DEFAULT NULL,
  `contact_q5` int(11) DEFAULT NULL,
  `contact_q6` varchar(100) DEFAULT NULL,
  `contact_q7` varchar(100) DEFAULT NULL,
  `contact_q8` varchar(11) DEFAULT NULL,
  `contact_q9` varchar(100) DEFAULT NULL,
  `contact_q10` varchar(50) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) NOT NULL,
  PRIMARY KEY (`contact_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_contact`
--
DROP TRIGGER IF EXISTS `trig_cms_contact_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_contact_DELETE` BEFORE DELETE ON `cms_contact`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.contact_id;

set @userid=OLD.update_user;



if  OLD.contact_id !="" OR OLD.contact_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_id);



	set @chdCol=CONCAT(@chdCol,'-','contact_id');

end if;



if  OLD.contact_survey !="" OR OLD.contact_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_survey);



	set @chdCol=CONCAT(@chdCol,'-','contact_survey');

end if;



if  OLD.contact_loc !="" OR OLD.contact_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_loc);



	set @chdCol=CONCAT(@chdCol,'-','contact_loc');

end if;



if  OLD.contact_part_id !="" OR OLD.contact_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_part_id);



	set @chdCol=CONCAT(@chdCol,'-','contact_part_id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.contact_q1 !="" OR OLD.contact_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q1);



	set @chdCol=CONCAT(@chdCol,'-','contact_q1');

end if;



if  OLD.contact_q2 !="" OR OLD.contact_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q2);



	set @chdCol=CONCAT(@chdCol,'-','contact_q2');

end if;



if  OLD.contact_q3 !="" OR OLD.contact_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q3);



	set @chdCol=CONCAT(@chdCol,'-','contact_q3');

end if;



if  OLD.contact_q4 !="" OR OLD.contact_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q4);



	set @chdCol=CONCAT(@chdCol,'-','contact_q4');

end if;



if  OLD.contact_q5 !="" OR OLD.contact_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q5);



	set @chdCol=CONCAT(@chdCol,'-','contact_q5');

end if;



if  OLD.contact_q6 !="" OR OLD.contact_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q6);



	set @chdCol=CONCAT(@chdCol,'-','contact_q6');

end if;



if  OLD.contact_q7 !="" OR OLD.contact_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q7);



	set @chdCol=CONCAT(@chdCol,'-','contact_q7');

end if;



if  OLD.contact_q8 !="" OR OLD.contact_q8 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q8);



	set @chdCol=CONCAT(@chdCol,'-','contact_q8');

end if;



if  OLD.contact_q9 !="" OR OLD.contact_q9 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q9);



	set @chdCol=CONCAT(@chdCol,'-','contact_q9');

end if;



if  OLD.contact_q10 !="" OR OLD.contact_q10 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q10);



	set @chdCol=CONCAT(@chdCol,'-','contact_q10');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_contact(contact_survey,contact_loc,contact_part_id,visit_code,contact_q1,contact_q2,contact_q3,contact_q4,contact_q5,contact_q6,contact_q7,contact_q8,contact_q9,contact_q10,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.contact_survey,OLD.contact_loc,OLD.contact_part_id,OLD.visit_code,OLD.contact_q1,OLD.contact_q2,OLD.contact_q3,OLD.contact_q4,OLD.contact_q5,OLD.contact_q6,OLD.contact_q7,OLD.contact_q8,OLD.contact_q9,OLD.contact_q10,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_contact', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_contact_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_contact_INSERT` AFTER INSERT ON `cms_contact`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.contact_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.contact_id);

set @chdCol=CONCAT(@chdCol,'-','contact_id');

set @newVal =CONCAT(@newVal,'-', NEW.contact_survey);

set @chdCol=CONCAT(@chdCol,'-','contact_survey');

set @newVal =CONCAT(@newVal,'-', NEW.contact_loc);

set @chdCol=CONCAT(@chdCol,'-','contact_loc');

set @newVal =CONCAT(@newVal,'-', NEW.contact_part_id);

set @chdCol=CONCAT(@chdCol,'-','contact_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.contact_q1);

set @chdCol=CONCAT(@chdCol,'-','contact_q1');

set @newVal =CONCAT(@newVal,'-', NEW.contact_q2);

set @chdCol=CONCAT(@chdCol,'-','contact_q2');

set @newVal =CONCAT(@newVal,'-', NEW.contact_q3);

set @chdCol=CONCAT(@chdCol,'-','contact_q3');

set @newVal =CONCAT(@newVal,'-', NEW.contact_q4);

set @chdCol=CONCAT(@chdCol,'-','contact_q4');

set @newVal =CONCAT(@newVal,'-', NEW.contact_q5);

set @chdCol=CONCAT(@chdCol,'-','contact_q5');

set @newVal =CONCAT(@newVal,'-', NEW.contact_q6);

set @chdCol=CONCAT(@chdCol,'-','contact_q6');

set @newVal =CONCAT(@newVal,'-', NEW.contact_q7);

set @chdCol=CONCAT(@chdCol,'-','contact_q7');

set @newVal =CONCAT(@newVal,'-', NEW.contact_q8);

set @chdCol=CONCAT(@chdCol,'-','contact_q8');

set @newVal =CONCAT(@newVal,'-', NEW.contact_q9);

set @chdCol=CONCAT(@chdCol,'-','contact_q9');

set @newVal =CONCAT(@newVal,'-', NEW.contact_q10);

set @chdCol=CONCAT(@chdCol,'-','contact_q10');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_contact(contact_survey,contact_loc,contact_part_id,visit_code,contact_q1,contact_q2,contact_q3,contact_q4,contact_q5,contact_q6,contact_q7,contact_q8,contact_q9,contact_q10,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.contact_survey,NEW.contact_loc,NEW.contact_part_id,NEW.visit_code,NEW.contact_q1,NEW.contact_q2,NEW.contact_q3,NEW.contact_q4,NEW.contact_q5,NEW.contact_q6,NEW.contact_q7,NEW.contact_q8,NEW.contact_q9,NEW.contact_q10,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_contact', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_contact_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_contact_UPDATE` BEFORE UPDATE ON `cms_contact`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.contact_id;

set @userid=NEW.update_user;



if  OLD.contact_id != NEW.contact_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_id);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_id);

	set @chdCol=CONCAT(@chdCol,'-','contact_id');

end if;



if  OLD.contact_survey != NEW.contact_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_survey);

	set @chdCol=CONCAT(@chdCol,'-','contact_survey');

end if;



if  OLD.contact_loc != NEW.contact_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_loc);

	set @chdCol=CONCAT(@chdCol,'-','contact_loc');

end if;



if  OLD.contact_part_id != NEW.contact_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_part_id);

	set @chdCol=CONCAT(@chdCol,'-','contact_part_id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.contact_q1 != NEW.contact_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_q1);

	set @chdCol=CONCAT(@chdCol,'-','contact_q1');

end if;



if  OLD.contact_q2 != NEW.contact_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_q2);

	set @chdCol=CONCAT(@chdCol,'-','contact_q2');

end if;



if  OLD.contact_q3 != NEW.contact_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_q3);

	set @chdCol=CONCAT(@chdCol,'-','contact_q3');

end if;



if  OLD.contact_q4 != NEW.contact_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_q4);

	set @chdCol=CONCAT(@chdCol,'-','contact_q4');

end if;



if  OLD.contact_q5 != NEW.contact_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_q5);

	set @chdCol=CONCAT(@chdCol,'-','contact_q5');

end if;



if  OLD.contact_q6 != NEW.contact_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_q6);

	set @chdCol=CONCAT(@chdCol,'-','contact_q6');

end if;



if  OLD.contact_q7 != NEW.contact_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_q7);

	set @chdCol=CONCAT(@chdCol,'-','contact_q7');

end if;



if  OLD.contact_q8 != NEW.contact_q8

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q8);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_q8);

	set @chdCol=CONCAT(@chdCol,'-','contact_q8');

end if;



if  OLD.contact_q9 != NEW.contact_q9

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q9);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_q9);

	set @chdCol=CONCAT(@chdCol,'-','contact_q9');

end if;



if  OLD.contact_q10 != NEW.contact_q10

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_q10);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_q10);

	set @chdCol=CONCAT(@chdCol,'-','contact_q10');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_contact(contact_survey,contact_loc,contact_part_id,visit_code,contact_q1,contact_q2,contact_q3,contact_q4,contact_q5,contact_q6,contact_q7,contact_q8,contact_q9,contact_q10,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.contact_survey,NEW.contact_loc,NEW.contact_part_id,NEW.visit_code,NEW.contact_q1,NEW.contact_q2,NEW.contact_q3,NEW.contact_q4,NEW.contact_q5,NEW.contact_q6,NEW.contact_q7,NEW.contact_q8,NEW.contact_q9,NEW.contact_q10,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_contact', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_contactareas`
--

DROP TABLE IF EXISTS `cms_contactareas`;
CREATE TABLE IF NOT EXISTS `cms_contactareas` (
  `contact_area_id` int(11) NOT NULL AUTO_INCREMENT,
  `contact_id` int(11) NOT NULL,
  `contact_area_survey` varchar(11) NOT NULL,
  `contact_area_part_id` varchar(11) NOT NULL,
  `visit_code` varchar(20) NOT NULL,
  `contact_area_q1` varchar(100) DEFAULT NULL,
  `contact_area_q2` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) NOT NULL,
  PRIMARY KEY (`contact_area_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_contactareas`
--
DROP TRIGGER IF EXISTS `trig_cms_contactareas_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_contactareas_DELETE` BEFORE DELETE ON `cms_contactareas`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.contact_area_id;

set @userid=OLD.update_user;



if  OLD.contact_area_id !="" OR OLD.contact_area_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_area_id);



	set @chdCol=CONCAT(@chdCol,'-','contact_area_id');

end if;



if  OLD.contact_id !="" OR OLD.contact_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_id);



	set @chdCol=CONCAT(@chdCol,'-','contact_id');

end if;



if  OLD.contact_area_survey !="" OR OLD.contact_area_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_area_survey);



	set @chdCol=CONCAT(@chdCol,'-','contact_area_survey');

end if;



if  OLD.contact_area_part_id !="" OR OLD.contact_area_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_area_part_id);



	set @chdCol=CONCAT(@chdCol,'-','contact_area_part_id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.contact_area_q1 !="" OR OLD.contact_area_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_area_q1);



	set @chdCol=CONCAT(@chdCol,'-','contact_area_q1');

end if;



if  OLD.contact_area_q2 !="" OR OLD.contact_area_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_area_q2);



	set @chdCol=CONCAT(@chdCol,'-','contact_area_q2');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_contactareas(contact_id,contact_area_survey,contact_area_part_id,visit_code,contact_area_q1,contact_area_q2,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.contact_id,OLD.contact_area_survey,OLD.contact_area_part_id,OLD.visit_code,OLD.contact_area_q1,OLD.contact_area_q2,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_contactareas', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_contactareas_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_contactareas_INSERT` AFTER INSERT ON `cms_contactareas`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.contact_area_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.contact_area_id);

set @chdCol=CONCAT(@chdCol,'-','contact_area_id');

set @newVal =CONCAT(@newVal,'-', NEW.contact_id);

set @chdCol=CONCAT(@chdCol,'-','contact_id');

set @newVal =CONCAT(@newVal,'-', NEW.contact_area_survey);

set @chdCol=CONCAT(@chdCol,'-','contact_area_survey');

set @newVal =CONCAT(@newVal,'-', NEW.contact_area_part_id);

set @chdCol=CONCAT(@chdCol,'-','contact_area_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.contact_area_q1);

set @chdCol=CONCAT(@chdCol,'-','contact_area_q1');

set @newVal =CONCAT(@newVal,'-', NEW.contact_area_q2);

set @chdCol=CONCAT(@chdCol,'-','contact_area_q2');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_contactareas(contact_id,contact_area_survey,contact_area_part_id,visit_code,contact_area_q1,contact_area_q2,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.contact_id,NEW.contact_area_survey,NEW.contact_area_part_id,NEW.visit_code,NEW.contact_area_q1,NEW.contact_area_q2,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_contactareas', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_contactareas_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_contactareas_UPDATE` BEFORE UPDATE ON `cms_contactareas`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.contact_area_id;

set @userid=NEW.update_user;



if  OLD.contact_area_id != NEW.contact_area_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_area_id);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_area_id);

	set @chdCol=CONCAT(@chdCol,'-','contact_area_id');

end if;



if  OLD.contact_id != NEW.contact_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_id);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_id);

	set @chdCol=CONCAT(@chdCol,'-','contact_id');

end if;



if  OLD.contact_area_survey != NEW.contact_area_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_area_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_area_survey);

	set @chdCol=CONCAT(@chdCol,'-','contact_area_survey');

end if;



if  OLD.contact_area_part_id != NEW.contact_area_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_area_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_area_part_id);

	set @chdCol=CONCAT(@chdCol,'-','contact_area_part_id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.contact_area_q1 != NEW.contact_area_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_area_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_area_q1);

	set @chdCol=CONCAT(@chdCol,'-','contact_area_q1');

end if;



if  OLD.contact_area_q2 != NEW.contact_area_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_area_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_area_q2);

	set @chdCol=CONCAT(@chdCol,'-','contact_area_q2');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_contactareas(contact_id,contact_area_survey,contact_area_part_id,visit_code,contact_area_q1,contact_area_q2,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.contact_id,NEW.contact_area_survey,NEW.contact_area_part_id,NEW.visit_code,NEW.contact_area_q1,NEW.contact_area_q2,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_contactareas', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_contactclients`
--

DROP TABLE IF EXISTS `cms_contactclients`;
CREATE TABLE IF NOT EXISTS `cms_contactclients` (
  `contact_client_id` int(11) NOT NULL AUTO_INCREMENT,
  `contact_id` int(11) NOT NULL,
  `contact_client_survey` varchar(11) NOT NULL,
  `contact_client_part_id` varchar(11) NOT NULL,
  `visit_code` varchar(20) NOT NULL,
  `contact_client_q1` varchar(100) DEFAULT NULL,
  `contact_client_q2` int(11) DEFAULT NULL,
  `contact_client_q3` varchar(11) DEFAULT NULL,
  `contact_client_q4` varchar(100) DEFAULT NULL,
  `contact_client_q5` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) NOT NULL,
  PRIMARY KEY (`contact_client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_contactclients`
--
DROP TRIGGER IF EXISTS `trig_cms_contactclients_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_contactclients_DELETE` BEFORE DELETE ON `cms_contactclients`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.contact_client_id;

set @userid=OLD.update_user;



if  OLD.contact_client_id !="" OR OLD.contact_client_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_id);



	set @chdCol=CONCAT(@chdCol,'-','contact_client_id');

end if;



if  OLD.contact_id !="" OR OLD.contact_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_id);



	set @chdCol=CONCAT(@chdCol,'-','contact_id');

end if;



if  OLD.contact_client_survey !="" OR OLD.contact_client_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_survey);



	set @chdCol=CONCAT(@chdCol,'-','contact_client_survey');

end if;



if  OLD.contact_client_part_id !="" OR OLD.contact_client_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_part_id);



	set @chdCol=CONCAT(@chdCol,'-','contact_client_part_id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.contact_client_q1 !="" OR OLD.contact_client_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_q1);



	set @chdCol=CONCAT(@chdCol,'-','contact_client_q1');

end if;



if  OLD.contact_client_q2 !="" OR OLD.contact_client_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_q2);



	set @chdCol=CONCAT(@chdCol,'-','contact_client_q2');

end if;



if  OLD.contact_client_q3 !="" OR OLD.contact_client_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_q3);



	set @chdCol=CONCAT(@chdCol,'-','contact_client_q3');

end if;



if  OLD.contact_client_q4 !="" OR OLD.contact_client_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_q4);



	set @chdCol=CONCAT(@chdCol,'-','contact_client_q4');

end if;



if  OLD.contact_client_q5 !="" OR OLD.contact_client_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_q5);



	set @chdCol=CONCAT(@chdCol,'-','contact_client_q5');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_contactclients(contact_id,contact_client_survey,contact_client_part_id,visit_code,contact_client_q1,contact_client_q2,contact_client_q3,contact_client_q4,contact_client_q5,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.contact_id,OLD.contact_client_survey,OLD.contact_client_part_id,OLD.visit_code,OLD.contact_client_q1,OLD.contact_client_q2,OLD.contact_client_q3,OLD.contact_client_q4,OLD.contact_client_q5,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_contactclients', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_contactclients_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_contactclients_INSERT` AFTER INSERT ON `cms_contactclients`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.contact_client_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.contact_client_id);

set @chdCol=CONCAT(@chdCol,'-','contact_client_id');

set @newVal =CONCAT(@newVal,'-', NEW.contact_id);

set @chdCol=CONCAT(@chdCol,'-','contact_id');

set @newVal =CONCAT(@newVal,'-', NEW.contact_client_survey);

set @chdCol=CONCAT(@chdCol,'-','contact_client_survey');

set @newVal =CONCAT(@newVal,'-', NEW.contact_client_part_id);

set @chdCol=CONCAT(@chdCol,'-','contact_client_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.contact_client_q1);

set @chdCol=CONCAT(@chdCol,'-','contact_client_q1');

set @newVal =CONCAT(@newVal,'-', NEW.contact_client_q2);

set @chdCol=CONCAT(@chdCol,'-','contact_client_q2');

set @newVal =CONCAT(@newVal,'-', NEW.contact_client_q3);

set @chdCol=CONCAT(@chdCol,'-','contact_client_q3');

set @newVal =CONCAT(@newVal,'-', NEW.contact_client_q4);

set @chdCol=CONCAT(@chdCol,'-','contact_client_q4');

set @newVal =CONCAT(@newVal,'-', NEW.contact_client_q5);

set @chdCol=CONCAT(@chdCol,'-','contact_client_q5');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_contactclients(contact_id,contact_client_survey,contact_client_part_id,visit_code,contact_client_q1,contact_client_q2,contact_client_q3,contact_client_q4,contact_client_q5,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.contact_id,NEW.contact_client_survey,NEW.contact_client_part_id,NEW.visit_code,NEW.contact_client_q1,NEW.contact_client_q2,NEW.contact_client_q3,NEW.contact_client_q4,NEW.contact_client_q5,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_contactclients', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_contactclients_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_contactclients_UPDATE` BEFORE UPDATE ON `cms_contactclients`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.contact_client_id;

set @userid=NEW.update_user;



if  OLD.contact_client_id != NEW.contact_client_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_id);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_client_id);

	set @chdCol=CONCAT(@chdCol,'-','contact_client_id');

end if;



if  OLD.contact_id != NEW.contact_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_id);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_id);

	set @chdCol=CONCAT(@chdCol,'-','contact_id');

end if;



if  OLD.contact_client_survey != NEW.contact_client_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_client_survey);

	set @chdCol=CONCAT(@chdCol,'-','contact_client_survey');

end if;



if  OLD.contact_client_part_id != NEW.contact_client_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_client_part_id);

	set @chdCol=CONCAT(@chdCol,'-','contact_client_part_id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.contact_client_q1 != NEW.contact_client_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_client_q1);

	set @chdCol=CONCAT(@chdCol,'-','contact_client_q1');

end if;



if  OLD.contact_client_q2 != NEW.contact_client_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_client_q2);

	set @chdCol=CONCAT(@chdCol,'-','contact_client_q2');

end if;



if  OLD.contact_client_q3 != NEW.contact_client_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_client_q3);

	set @chdCol=CONCAT(@chdCol,'-','contact_client_q3');

end if;



if  OLD.contact_client_q4 != NEW.contact_client_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_client_q4);

	set @chdCol=CONCAT(@chdCol,'-','contact_client_q4');

end if;



if  OLD.contact_client_q5 != NEW.contact_client_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_client_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_client_q5);

	set @chdCol=CONCAT(@chdCol,'-','contact_client_q5');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_contactclients(contact_id,contact_client_survey,contact_client_part_id,visit_code,contact_client_q1,contact_client_q2,contact_client_q3,contact_client_q4,contact_client_q5,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.contact_id,NEW.contact_client_survey,NEW.contact_client_part_id,NEW.visit_code,NEW.contact_client_q1,NEW.contact_client_q2,NEW.contact_client_q3,NEW.contact_client_q4,NEW.contact_client_q5,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_contactclients', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_contactpartners`
--

DROP TABLE IF EXISTS `cms_contactpartners`;
CREATE TABLE IF NOT EXISTS `cms_contactpartners` (
  `contact_partner_id` int(11) NOT NULL AUTO_INCREMENT,
  `contact_id` int(11) NOT NULL,
  `contact_partner_survey` varchar(11) NOT NULL,
  `contact_partner_part_id` varchar(11) NOT NULL,
  `visit_code` varchar(20) NOT NULL,
  `contact_partner_q1` varchar(100) DEFAULT NULL,
  `contact_partner_q2` varchar(100) DEFAULT NULL,
  `contact_partner_q3` varchar(11) DEFAULT NULL,
  `contact_partner_q4` varchar(100) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) NOT NULL,
  PRIMARY KEY (`contact_partner_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_contactpartners`
--
DROP TRIGGER IF EXISTS `trig_cms_contactpartners_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_contactpartners_DELETE` BEFORE DELETE ON `cms_contactpartners`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.contact_partner_id;

set @userid=OLD.update_user;



if  OLD.contact_partner_id !="" OR OLD.contact_partner_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_id);



	set @chdCol=CONCAT(@chdCol,'-','contact_partner_id');

end if;



if  OLD.contact_id !="" OR OLD.contact_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_id);



	set @chdCol=CONCAT(@chdCol,'-','contact_id');

end if;



if  OLD.contact_partner_survey !="" OR OLD.contact_partner_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_survey);



	set @chdCol=CONCAT(@chdCol,'-','contact_partner_survey');

end if;



if  OLD.contact_partner_part_id !="" OR OLD.contact_partner_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_part_id);



	set @chdCol=CONCAT(@chdCol,'-','contact_partner_part_id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.contact_partner_q1 !="" OR OLD.contact_partner_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_q1);



	set @chdCol=CONCAT(@chdCol,'-','contact_partner_q1');

end if;



if  OLD.contact_partner_q2 !="" OR OLD.contact_partner_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_q2);



	set @chdCol=CONCAT(@chdCol,'-','contact_partner_q2');

end if;



if  OLD.contact_partner_q3 !="" OR OLD.contact_partner_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_q3);



	set @chdCol=CONCAT(@chdCol,'-','contact_partner_q3');

end if;



if  OLD.contact_partner_q4 !="" OR OLD.contact_partner_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_q4);



	set @chdCol=CONCAT(@chdCol,'-','contact_partner_q4');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_contactpartners(contact_id,contact_partner_survey,contact_partner_part_id,visit_code,contact_partner_q1,contact_partner_q2,contact_partner_q3,contact_partner_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.contact_id,OLD.contact_partner_survey,OLD.contact_partner_part_id,OLD.visit_code,OLD.contact_partner_q1,OLD.contact_partner_q2,OLD.contact_partner_q3,OLD.contact_partner_q4,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_contactpartners', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_contactpartners_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_contactpartners_INSERT` AFTER INSERT ON `cms_contactpartners`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.contact_partner_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_id);

set @chdCol=CONCAT(@chdCol,'-','contact_partner_id');

set @newVal =CONCAT(@newVal,'-', NEW.contact_id);

set @chdCol=CONCAT(@chdCol,'-','contact_id');

set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_survey);

set @chdCol=CONCAT(@chdCol,'-','contact_partner_survey');

set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_part_id);

set @chdCol=CONCAT(@chdCol,'-','contact_partner_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_q1);

set @chdCol=CONCAT(@chdCol,'-','contact_partner_q1');

set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_q2);

set @chdCol=CONCAT(@chdCol,'-','contact_partner_q2');

set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_q3);

set @chdCol=CONCAT(@chdCol,'-','contact_partner_q3');

set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_q4);

set @chdCol=CONCAT(@chdCol,'-','contact_partner_q4');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_contactpartners(contact_id,contact_partner_survey,contact_partner_part_id,visit_code,contact_partner_q1,contact_partner_q2,contact_partner_q3,contact_partner_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.contact_id,NEW.contact_partner_survey,NEW.contact_partner_part_id,NEW.visit_code,NEW.contact_partner_q1,NEW.contact_partner_q2,NEW.contact_partner_q3,NEW.contact_partner_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_contactpartners', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_contactpartners_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_contactpartners_UPDATE` BEFORE UPDATE ON `cms_contactpartners`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.contact_partner_id;

set @userid=NEW.update_user;



if  OLD.contact_partner_id != NEW.contact_partner_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_id);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_id);

	set @chdCol=CONCAT(@chdCol,'-','contact_partner_id');

end if;



if  OLD.contact_id != NEW.contact_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_id);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_id);

	set @chdCol=CONCAT(@chdCol,'-','contact_id');

end if;



if  OLD.contact_partner_survey != NEW.contact_partner_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_survey);

	set @chdCol=CONCAT(@chdCol,'-','contact_partner_survey');

end if;



if  OLD.contact_partner_part_id != NEW.contact_partner_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_part_id);

	set @chdCol=CONCAT(@chdCol,'-','contact_partner_part_id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.contact_partner_q1 != NEW.contact_partner_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_q1);

	set @chdCol=CONCAT(@chdCol,'-','contact_partner_q1');

end if;



if  OLD.contact_partner_q2 != NEW.contact_partner_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_q2);

	set @chdCol=CONCAT(@chdCol,'-','contact_partner_q2');

end if;



if  OLD.contact_partner_q3 != NEW.contact_partner_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_q3);

	set @chdCol=CONCAT(@chdCol,'-','contact_partner_q3');

end if;



if  OLD.contact_partner_q4 != NEW.contact_partner_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.contact_partner_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.contact_partner_q4);

	set @chdCol=CONCAT(@chdCol,'-','contact_partner_q4');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_contactpartners(contact_id,contact_partner_survey,contact_partner_part_id,visit_code,contact_partner_q1,contact_partner_q2,contact_partner_q3,contact_partner_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.contact_id,NEW.contact_partner_survey,NEW.contact_partner_part_id,NEW.visit_code,NEW.contact_partner_q1,NEW.contact_partner_q2,NEW.contact_partner_q3,NEW.contact_partner_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_contactpartners', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_coordinator`
--

DROP TABLE IF EXISTS `cms_coordinator`;
CREATE TABLE IF NOT EXISTS `cms_coordinator` (
  `corfrm_id` int(11) NOT NULL AUTO_INCREMENT,
  `corfrm_sid` varchar(100) NOT NULL,
  `corfrm_pid` varchar(100) NOT NULL,
  `corfrm_loc` varchar(100) NOT NULL,
  `corfrm_q1` varchar(100) NOT NULL,
  `corfrm_q2` varchar(11) NOT NULL,
  `corfrm_q3` int(11) NOT NULL,
  `corfrm_q4` int(11) NOT NULL,
  `corfrm_q5` int(11) NOT NULL,
  `corfrm_q6` int(11) NOT NULL,
  `corfrm_q7` int(11) NOT NULL,
  `corfrm_q8` int(11) NOT NULL,
  `corfrm_q9` int(11) NOT NULL,
  `corfrm_q10` int(11) NOT NULL,
  `corfrm_q11` int(11) NOT NULL,
  `corfrm_q12` int(11) NOT NULL,
  `ref_no` varchar(10) DEFAULT NULL,
  `tiid` varchar(100) DEFAULT NULL,
  `ictcid` varchar(100) DEFAULT NULL,
  `rntcpid` varchar(100) DEFAULT NULL,
  `artid` varchar(100) DEFAULT NULL,
  `mbid` varchar(100) DEFAULT NULL,
  `stdid` varchar(100) DEFAULT NULL,
  `ostid` varchar(100) DEFAULT NULL,
  `ost_date` int(11) DEFAULT NULL,
  `ost_2mg` int(11) DEFAULT NULL,
  `ost_04mg` int(11) DEFAULT NULL,
  `ost_02mg` int(11) DEFAULT NULL,
  `spouseid` varchar(255) DEFAULT NULL,
  `ngoname` varchar(100) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`corfrm_id`),
  KEY `corfrm_pid` (`corfrm_pid`),
  KEY `corfrm_pid_2` (`corfrm_pid`),
  KEY `corfrm_pid_3` (`corfrm_pid`),
  KEY `corfrm_pid_4` (`corfrm_pid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_counselor`
--

DROP TABLE IF EXISTS `cms_counselor`;
CREATE TABLE IF NOT EXISTS `cms_counselor` (
  `counfrm_id` int(11) NOT NULL AUTO_INCREMENT,
  `counfrm_sid` varchar(100) NOT NULL,
  `counfrm_loc` varchar(100) NOT NULL,
  `counfrm_pid` varchar(100) NOT NULL,
  `counfrm_q1` varchar(100) DEFAULT NULL,
  `counfrm_q2` varchar(100) DEFAULT NULL,
  `counfrm_q3` varchar(100) DEFAULT NULL,
  `counfrm_q4` int(11) DEFAULT NULL,
  `counfrm_q5` int(11) DEFAULT NULL,
  `counfrm_q6_no_needle` int(11) DEFAULT NULL,
  `counfrm_q7_no_condom` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`counfrm_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_counselor`
--
DROP TRIGGER IF EXISTS `trig_cms_counselor_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_counselor_DELETE` BEFORE DELETE ON `cms_counselor`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.counfrm_id;

set @userid=OLD.update_user;



if  OLD.counfrm_id !="" OR OLD.counfrm_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_id);



	set @chdCol=CONCAT(@chdCol,'-','counfrm_id');

end if;



if  OLD.counfrm_sid !="" OR OLD.counfrm_sid is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_sid);



	set @chdCol=CONCAT(@chdCol,'-','counfrm_sid');

end if;



if  OLD.counfrm_loc !="" OR OLD.counfrm_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_loc);



	set @chdCol=CONCAT(@chdCol,'-','counfrm_loc');

end if;



if  OLD.counfrm_pid !="" OR OLD.counfrm_pid is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_pid);



	set @chdCol=CONCAT(@chdCol,'-','counfrm_pid');

end if;



if  OLD.counfrm_q1 !="" OR OLD.counfrm_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q1);



	set @chdCol=CONCAT(@chdCol,'-','counfrm_q1');

end if;



if  OLD.counfrm_q2 !="" OR OLD.counfrm_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q2);



	set @chdCol=CONCAT(@chdCol,'-','counfrm_q2');

end if;



if  OLD.counfrm_q3 !="" OR OLD.counfrm_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q3);



	set @chdCol=CONCAT(@chdCol,'-','counfrm_q3');

end if;



if  OLD.counfrm_q4 !="" OR OLD.counfrm_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q4);



	set @chdCol=CONCAT(@chdCol,'-','counfrm_q4');

end if;



if  OLD.counfrm_q5 !="" OR OLD.counfrm_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q5);



	set @chdCol=CONCAT(@chdCol,'-','counfrm_q5');

end if;



if  OLD.counfrm_q6_no_needle !="" OR OLD.counfrm_q6_no_needle is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q6_no_needle);



	set @chdCol=CONCAT(@chdCol,'-','counfrm_q6_no_needle');

end if;



if  OLD.counfrm_q7_no_condom !="" OR OLD.counfrm_q7_no_condom is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q7_no_condom);



	set @chdCol=CONCAT(@chdCol,'-','counfrm_q7_no_condom');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_counselor(counfrm_sid,counfrm_loc,counfrm_pid,counfrm_q1,counfrm_q2,counfrm_q3,counfrm_q4,counfrm_q5,counfrm_q6_no_needle,counfrm_q7_no_condom,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.counfrm_sid,OLD.counfrm_loc,OLD.counfrm_pid,OLD.counfrm_q1,OLD.counfrm_q2,OLD.counfrm_q3,OLD.counfrm_q4,OLD.counfrm_q5,OLD.counfrm_q6_no_needle,OLD.counfrm_q7_no_condom,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_counselor', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_counselor_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_counselor_INSERT` AFTER INSERT ON `cms_counselor`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.counfrm_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.counfrm_id);

set @chdCol=CONCAT(@chdCol,'-','counfrm_id');

set @newVal =CONCAT(@newVal,'-', NEW.counfrm_sid);

set @chdCol=CONCAT(@chdCol,'-','counfrm_sid');

set @newVal =CONCAT(@newVal,'-', NEW.counfrm_loc);

set @chdCol=CONCAT(@chdCol,'-','counfrm_loc');

set @newVal =CONCAT(@newVal,'-', NEW.counfrm_pid);

set @chdCol=CONCAT(@chdCol,'-','counfrm_pid');

set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q1);

set @chdCol=CONCAT(@chdCol,'-','counfrm_q1');

set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q2);

set @chdCol=CONCAT(@chdCol,'-','counfrm_q2');

set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q3);

set @chdCol=CONCAT(@chdCol,'-','counfrm_q3');

set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q4);

set @chdCol=CONCAT(@chdCol,'-','counfrm_q4');

set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q5);

set @chdCol=CONCAT(@chdCol,'-','counfrm_q5');

set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q6_no_needle);

set @chdCol=CONCAT(@chdCol,'-','counfrm_q6_no_needle');

set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q7_no_condom);

set @chdCol=CONCAT(@chdCol,'-','counfrm_q7_no_condom');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_counselor(counfrm_sid,counfrm_loc,counfrm_pid,counfrm_q1,counfrm_q2,counfrm_q3,counfrm_q4,counfrm_q5,counfrm_q6_no_needle,counfrm_q7_no_condom,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.counfrm_sid,NEW.counfrm_loc,NEW.counfrm_pid,NEW.counfrm_q1,NEW.counfrm_q2,NEW.counfrm_q3,NEW.counfrm_q4,NEW.counfrm_q5,NEW.counfrm_q6_no_needle,NEW.counfrm_q7_no_condom,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_counselor', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_counselor_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_counselor_UPDATE` BEFORE UPDATE ON `cms_counselor`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.counfrm_id;

set @userid=NEW.update_user;



if  OLD.counfrm_id != NEW.counfrm_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_id);

	set @newVal =CONCAT(@newVal,'-', NEW.counfrm_id);

	set @chdCol=CONCAT(@chdCol,'-','counfrm_id');

end if;



if  OLD.counfrm_sid != NEW.counfrm_sid

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_sid);

	set @newVal =CONCAT(@newVal,'-', NEW.counfrm_sid);

	set @chdCol=CONCAT(@chdCol,'-','counfrm_sid');

end if;



if  OLD.counfrm_loc != NEW.counfrm_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.counfrm_loc);

	set @chdCol=CONCAT(@chdCol,'-','counfrm_loc');

end if;



if  OLD.counfrm_pid != NEW.counfrm_pid

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_pid);

	set @newVal =CONCAT(@newVal,'-', NEW.counfrm_pid);

	set @chdCol=CONCAT(@chdCol,'-','counfrm_pid');

end if;



if  OLD.counfrm_q1 != NEW.counfrm_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q1);

	set @chdCol=CONCAT(@chdCol,'-','counfrm_q1');

end if;



if  OLD.counfrm_q2 != NEW.counfrm_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q2);

	set @chdCol=CONCAT(@chdCol,'-','counfrm_q2');

end if;



if  OLD.counfrm_q3 != NEW.counfrm_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q3);

	set @chdCol=CONCAT(@chdCol,'-','counfrm_q3');

end if;



if  OLD.counfrm_q4 != NEW.counfrm_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q4);

	set @chdCol=CONCAT(@chdCol,'-','counfrm_q4');

end if;



if  OLD.counfrm_q5 != NEW.counfrm_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q5);

	set @chdCol=CONCAT(@chdCol,'-','counfrm_q5');

end if;



if  OLD.counfrm_q6_no_needle != NEW.counfrm_q6_no_needle

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q6_no_needle);

	set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q6_no_needle);

	set @chdCol=CONCAT(@chdCol,'-','counfrm_q6_no_needle');

end if;



if  OLD.counfrm_q7_no_condom != NEW.counfrm_q7_no_condom

then

	set @oldval =CONCAT(@oldVal,'-',OLD.counfrm_q7_no_condom);

	set @newVal =CONCAT(@newVal,'-', NEW.counfrm_q7_no_condom);

	set @chdCol=CONCAT(@chdCol,'-','counfrm_q7_no_condom');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_counselor(counfrm_sid,counfrm_loc,counfrm_pid,counfrm_q1,counfrm_q2,counfrm_q3,counfrm_q4,counfrm_q5,counfrm_q6_no_needle,counfrm_q7_no_condom,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.counfrm_sid,NEW.counfrm_loc,NEW.counfrm_pid,NEW.counfrm_q1,NEW.counfrm_q2,NEW.counfrm_q3,NEW.counfrm_q4,NEW.counfrm_q5,NEW.counfrm_q6_no_needle,NEW.counfrm_q7_no_condom,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_counselor', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_couponmaster`
--

DROP TABLE IF EXISTS `cms_couponmaster`;
CREATE TABLE IF NOT EXISTS `cms_couponmaster` (
  `coupn_id` int(11) NOT NULL AUTO_INCREMENT,
  `coupn_survey_id` varchar(11) NOT NULL,
  `coupn_reg_id` varchar(11) NOT NULL,
  `coupn_count` text NOT NULL,
  `coupn_participant_id` text NOT NULL,
  `coupn_issue_date` date NOT NULL,
  `coupn_valid_period_no` int(11) NOT NULL,
  `coupn_valid_period_type` int(11) NOT NULL,
  `coupn_valid_period` text NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` datetime DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` datetime DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  PRIMARY KEY (`coupn_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_doctorsvisit`
--

DROP TABLE IF EXISTS `cms_doctorsvisit`;
CREATE TABLE IF NOT EXISTS `cms_doctorsvisit` (
  `dtr_visit_id` int(11) NOT NULL AUTO_INCREMENT,
  `dtr_visit_survey` varchar(11) NOT NULL,
  `dtr_visit_part_id` varchar(11) NOT NULL,
  `dtr_visit_q1` int(11) NOT NULL,
  `dtr_visit_q2` int(11) DEFAULT NULL,
  `dtr_visit_q3` int(11) DEFAULT NULL,
  `dtr_visit_q4` int(11) DEFAULT NULL,
  `dtr_visit_q5` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`dtr_visit_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_fieldmaster`
--

DROP TABLE IF EXISTS `cms_fieldmaster`;
CREATE TABLE IF NOT EXISTS `cms_fieldmaster` (
  `fld_mstr_id` int(11) NOT NULL AUTO_INCREMENT,
  `fld_mstr_frmfield` varchar(300) NOT NULL COMMENT 'Form Field',
  `fld_mstr_code` varchar(300) NOT NULL COMMENT 'Code',
  `fld_mstr_desc` varchar(300) NOT NULL COMMENT 'Description',
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`fld_mstr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_fieldmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_fieldmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_fieldmaster_DELETE` BEFORE DELETE ON `cms_fieldmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.fld_mstr_id;

set @userid=OLD.update_user;



if  OLD.fld_mstr_id !="" OR OLD.fld_mstr_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.fld_mstr_id);



	set @chdCol=CONCAT(@chdCol,'-','fld_mstr_id');

end if;



if  OLD.fld_mstr_frmfield !="" OR OLD.fld_mstr_frmfield is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.fld_mstr_frmfield);



	set @chdCol=CONCAT(@chdCol,'-','fld_mstr_frmfield');

end if;



if  OLD.fld_mstr_code !="" OR OLD.fld_mstr_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.fld_mstr_code);



	set @chdCol=CONCAT(@chdCol,'-','fld_mstr_code');

end if;



if  OLD.fld_mstr_desc !="" OR OLD.fld_mstr_desc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.fld_mstr_desc);



	set @chdCol=CONCAT(@chdCol,'-','fld_mstr_desc');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_fieldmaster(fld_mstr_frmfield,fld_mstr_code,fld_mstr_desc,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.fld_mstr_frmfield,OLD.fld_mstr_code,OLD.fld_mstr_desc,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_fieldmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_fieldmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_fieldmaster_INSERT` AFTER INSERT ON `cms_fieldmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.fld_mstr_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.fld_mstr_id);

set @chdCol=CONCAT(@chdCol,'-','fld_mstr_id');

set @newVal =CONCAT(@newVal,'-', NEW.fld_mstr_frmfield);

set @chdCol=CONCAT(@chdCol,'-','fld_mstr_frmfield');

set @newVal =CONCAT(@newVal,'-', NEW.fld_mstr_code);

set @chdCol=CONCAT(@chdCol,'-','fld_mstr_code');

set @newVal =CONCAT(@newVal,'-', NEW.fld_mstr_desc);

set @chdCol=CONCAT(@chdCol,'-','fld_mstr_desc');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_fieldmaster(fld_mstr_frmfield,fld_mstr_code,fld_mstr_desc,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.fld_mstr_frmfield,NEW.fld_mstr_code,NEW.fld_mstr_desc,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_fieldmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_fieldmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_fieldmaster_UPDATE` BEFORE UPDATE ON `cms_fieldmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.fld_mstr_id;

set @userid=NEW.update_user;



if  OLD.fld_mstr_id != NEW.fld_mstr_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.fld_mstr_id);

	set @newVal =CONCAT(@newVal,'-', NEW.fld_mstr_id);

	set @chdCol=CONCAT(@chdCol,'-','fld_mstr_id');

end if;



if  OLD.fld_mstr_frmfield != NEW.fld_mstr_frmfield

then

	set @oldval =CONCAT(@oldVal,'-',OLD.fld_mstr_frmfield);

	set @newVal =CONCAT(@newVal,'-', NEW.fld_mstr_frmfield);

	set @chdCol=CONCAT(@chdCol,'-','fld_mstr_frmfield');

end if;



if  OLD.fld_mstr_code != NEW.fld_mstr_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.fld_mstr_code);

	set @newVal =CONCAT(@newVal,'-', NEW.fld_mstr_code);

	set @chdCol=CONCAT(@chdCol,'-','fld_mstr_code');

end if;



if  OLD.fld_mstr_desc != NEW.fld_mstr_desc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.fld_mstr_desc);

	set @newVal =CONCAT(@newVal,'-', NEW.fld_mstr_desc);

	set @chdCol=CONCAT(@chdCol,'-','fld_mstr_desc');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_fieldmaster(fld_mstr_frmfield,fld_mstr_code,fld_mstr_desc,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.fld_mstr_frmfield,NEW.fld_mstr_code,NEW.fld_mstr_desc,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_fieldmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_hcvlinkage`
--

DROP TABLE IF EXISTS `cms_hcvlinkage`;
CREATE TABLE IF NOT EXISTS `cms_hcvlinkage` (
  `hcv_linkage_id` int(11) NOT NULL AUTO_INCREMENT,
  `hcv_linkage_survey` varchar(11) NOT NULL,
  `hcv_linkage_loc` varchar(11) NOT NULL,
  `hcv_linkage_part_id` varchar(11) NOT NULL,
  `hcv_linkage_q1` int(11) NOT NULL,
  `hcv_linkage_q2` varchar(100) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`hcv_linkage_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_hcvlinkage`
--
DROP TRIGGER IF EXISTS `trig_cms_hcvlinkage_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_hcvlinkage_DELETE` BEFORE DELETE ON `cms_hcvlinkage`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.hcv_linkage_id;

set @userid=OLD.update_user;



if  OLD.hcv_linkage_id !="" OR OLD.hcv_linkage_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_linkage_id);



	set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_id');

end if;



if  OLD.hcv_linkage_survey !="" OR OLD.hcv_linkage_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_linkage_survey);



	set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_survey');

end if;



if  OLD.hcv_linkage_loc !="" OR OLD.hcv_linkage_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_linkage_loc);



	set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_loc');

end if;



if  OLD.hcv_linkage_part_id !="" OR OLD.hcv_linkage_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_linkage_part_id);



	set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_part_id');

end if;



if  OLD.hcv_linkage_q1 !="" OR OLD.hcv_linkage_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_linkage_q1);



	set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_q1');

end if;



if  OLD.hcv_linkage_q2 !="" OR OLD.hcv_linkage_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_linkage_q2);



	set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_q2');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_hcvlinkage(hcv_linkage_survey,hcv_linkage_loc,hcv_linkage_part_id,hcv_linkage_q1,hcv_linkage_q2,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.hcv_linkage_survey,OLD.hcv_linkage_loc,OLD.hcv_linkage_part_id,OLD.hcv_linkage_q1,OLD.hcv_linkage_q2,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hcvlinkage', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_hcvlinkage_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_hcvlinkage_INSERT` AFTER INSERT ON `cms_hcvlinkage`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hcv_linkage_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.hcv_linkage_id);

set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_id');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_linkage_survey);

set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_survey');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_linkage_loc);

set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_loc');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_linkage_part_id);

set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_linkage_q1);

set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_q1');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_linkage_q2);

set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_q2');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_hcvlinkage(hcv_linkage_survey,hcv_linkage_loc,hcv_linkage_part_id,hcv_linkage_q1,hcv_linkage_q2,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hcv_linkage_survey,NEW.hcv_linkage_loc,NEW.hcv_linkage_part_id,NEW.hcv_linkage_q1,NEW.hcv_linkage_q2,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hcvlinkage', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_hcvlinkage_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_hcvlinkage_UPDATE` BEFORE UPDATE ON `cms_hcvlinkage`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hcv_linkage_id;

set @userid=NEW.update_user;



if  OLD.hcv_linkage_id != NEW.hcv_linkage_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_linkage_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_linkage_id);

	set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_id');

end if;



if  OLD.hcv_linkage_survey != NEW.hcv_linkage_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_linkage_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_linkage_survey);

	set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_survey');

end if;



if  OLD.hcv_linkage_loc != NEW.hcv_linkage_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_linkage_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_linkage_loc);

	set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_loc');

end if;



if  OLD.hcv_linkage_part_id != NEW.hcv_linkage_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_linkage_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_linkage_part_id);

	set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_part_id');

end if;



if  OLD.hcv_linkage_q1 != NEW.hcv_linkage_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_linkage_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_linkage_q1);

	set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_q1');

end if;



if  OLD.hcv_linkage_q2 != NEW.hcv_linkage_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_linkage_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_linkage_q2);

	set @chdCol=CONCAT(@chdCol,'-','hcv_linkage_q2');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_hcvlinkage(hcv_linkage_survey,hcv_linkage_loc,hcv_linkage_part_id,hcv_linkage_q1,hcv_linkage_q2,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hcv_linkage_survey,NEW.hcv_linkage_loc,NEW.hcv_linkage_part_id,NEW.hcv_linkage_q1,NEW.hcv_linkage_q2,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hcvlinkage', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_hcvtesting`
--

DROP TABLE IF EXISTS `cms_hcvtesting`;
CREATE TABLE IF NOT EXISTS `cms_hcvtesting` (
  `hcv_test_id` int(11) NOT NULL AUTO_INCREMENT,
  `hcv_test_survey` varchar(11) NOT NULL,
  `hcv_test_loc` varchar(11) NOT NULL,
  `hcv_test_part_id` varchar(11) NOT NULL,
  `hcv_test_q1` int(11) NOT NULL,
  `hcv_test_q2` varchar(100) NOT NULL,
  `hcv_test_q3` int(11) NOT NULL,
  `hcv_test_q4` int(11) DEFAULT NULL,
  `hcv_test_q5` int(11) DEFAULT NULL,
  `hcv_test_q6` int(11) DEFAULT NULL,
  `hcv_test_q7` int(11) NOT NULL,
  `hcv_test_q8` varchar(50) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`hcv_test_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_hcvtesting`
--
DROP TRIGGER IF EXISTS `trig_cms_hcvtesting_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_hcvtesting_DELETE` BEFORE DELETE ON `cms_hcvtesting`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.hcv_test_id;

set @userid=OLD.update_user;



if  OLD.hcv_test_id !="" OR OLD.hcv_test_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_id);



	set @chdCol=CONCAT(@chdCol,'-','hcv_test_id');

end if;



if  OLD.hcv_test_survey !="" OR OLD.hcv_test_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_survey);



	set @chdCol=CONCAT(@chdCol,'-','hcv_test_survey');

end if;



if  OLD.hcv_test_loc !="" OR OLD.hcv_test_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_loc);



	set @chdCol=CONCAT(@chdCol,'-','hcv_test_loc');

end if;



if  OLD.hcv_test_part_id !="" OR OLD.hcv_test_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_part_id);



	set @chdCol=CONCAT(@chdCol,'-','hcv_test_part_id');

end if;



if  OLD.hcv_test_q1 !="" OR OLD.hcv_test_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q1);



	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q1');

end if;



if  OLD.hcv_test_q2 !="" OR OLD.hcv_test_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q2);



	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q2');

end if;



if  OLD.hcv_test_q3 !="" OR OLD.hcv_test_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q3);



	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q3');

end if;



if  OLD.hcv_test_q4 !="" OR OLD.hcv_test_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q4);



	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q4');

end if;



if  OLD.hcv_test_q5 !="" OR OLD.hcv_test_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q5);



	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q5');

end if;



if  OLD.hcv_test_q6 !="" OR OLD.hcv_test_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q6);



	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q6');

end if;



if  OLD.hcv_test_q7 !="" OR OLD.hcv_test_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q7);



	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q7');

end if;



if  OLD.hcv_test_q8 !="" OR OLD.hcv_test_q8 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q8);



	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q8');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_hcvtesting(hcv_test_survey,hcv_test_loc,hcv_test_part_id,hcv_test_q1,hcv_test_q2,hcv_test_q3,hcv_test_q4,hcv_test_q5,hcv_test_q6,hcv_test_q7,hcv_test_q8,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.hcv_test_survey,OLD.hcv_test_loc,OLD.hcv_test_part_id,OLD.hcv_test_q1,OLD.hcv_test_q2,OLD.hcv_test_q3,OLD.hcv_test_q4,OLD.hcv_test_q5,OLD.hcv_test_q6,OLD.hcv_test_q7,OLD.hcv_test_q8,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hcvtesting', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_hcvtesting_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_hcvtesting_INSERT` AFTER INSERT ON `cms_hcvtesting`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hcv_test_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_id);

set @chdCol=CONCAT(@chdCol,'-','hcv_test_id');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_survey);

set @chdCol=CONCAT(@chdCol,'-','hcv_test_survey');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_loc);

set @chdCol=CONCAT(@chdCol,'-','hcv_test_loc');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_part_id);

set @chdCol=CONCAT(@chdCol,'-','hcv_test_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q1);

set @chdCol=CONCAT(@chdCol,'-','hcv_test_q1');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q2);

set @chdCol=CONCAT(@chdCol,'-','hcv_test_q2');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q3);

set @chdCol=CONCAT(@chdCol,'-','hcv_test_q3');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q4);

set @chdCol=CONCAT(@chdCol,'-','hcv_test_q4');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q5);

set @chdCol=CONCAT(@chdCol,'-','hcv_test_q5');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q6);

set @chdCol=CONCAT(@chdCol,'-','hcv_test_q6');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q7);

set @chdCol=CONCAT(@chdCol,'-','hcv_test_q7');

set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q8);

set @chdCol=CONCAT(@chdCol,'-','hcv_test_q8');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_hcvtesting(hcv_test_survey,hcv_test_loc,hcv_test_part_id,hcv_test_q1,hcv_test_q2,hcv_test_q3,hcv_test_q4,hcv_test_q5,hcv_test_q6,hcv_test_q7,hcv_test_q8,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hcv_test_survey,NEW.hcv_test_loc,NEW.hcv_test_part_id,NEW.hcv_test_q1,NEW.hcv_test_q2,NEW.hcv_test_q3,NEW.hcv_test_q4,NEW.hcv_test_q5,NEW.hcv_test_q6,NEW.hcv_test_q7,NEW.hcv_test_q8,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hcvtesting', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_hcvtesting_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_hcvtesting_UPDATE` BEFORE UPDATE ON `cms_hcvtesting`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hcv_test_id;

set @userid=NEW.update_user;



if  OLD.hcv_test_id != NEW.hcv_test_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_id);

	set @chdCol=CONCAT(@chdCol,'-','hcv_test_id');

end if;



if  OLD.hcv_test_survey != NEW.hcv_test_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_survey);

	set @chdCol=CONCAT(@chdCol,'-','hcv_test_survey');

end if;



if  OLD.hcv_test_loc != NEW.hcv_test_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_loc);

	set @chdCol=CONCAT(@chdCol,'-','hcv_test_loc');

end if;



if  OLD.hcv_test_part_id != NEW.hcv_test_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_part_id);

	set @chdCol=CONCAT(@chdCol,'-','hcv_test_part_id');

end if;



if  OLD.hcv_test_q1 != NEW.hcv_test_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q1);

	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q1');

end if;



if  OLD.hcv_test_q2 != NEW.hcv_test_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q2);

	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q2');

end if;



if  OLD.hcv_test_q3 != NEW.hcv_test_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q3);

	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q3');

end if;



if  OLD.hcv_test_q4 != NEW.hcv_test_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q4);

	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q4');

end if;



if  OLD.hcv_test_q5 != NEW.hcv_test_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q5);

	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q5');

end if;



if  OLD.hcv_test_q6 != NEW.hcv_test_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q6);

	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q6');

end if;



if  OLD.hcv_test_q7 != NEW.hcv_test_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q7);

	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q7');

end if;



if  OLD.hcv_test_q8 != NEW.hcv_test_q8

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hcv_test_q8);

	set @newVal =CONCAT(@newVal,'-', NEW.hcv_test_q8);

	set @chdCol=CONCAT(@chdCol,'-','hcv_test_q8');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_hcvtesting(hcv_test_survey,hcv_test_loc,hcv_test_part_id,hcv_test_q1,hcv_test_q2,hcv_test_q3,hcv_test_q4,hcv_test_q5,hcv_test_q6,hcv_test_q7,hcv_test_q8,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hcv_test_survey,NEW.hcv_test_loc,NEW.hcv_test_part_id,NEW.hcv_test_q1,NEW.hcv_test_q2,NEW.hcv_test_q3,NEW.hcv_test_q4,NEW.hcv_test_q5,NEW.hcv_test_q6,NEW.hcv_test_q7,NEW.hcv_test_q8,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hcvtesting', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_hivcounseling`
--

DROP TABLE IF EXISTS `cms_hivcounseling`;
CREATE TABLE IF NOT EXISTS `cms_hivcounseling` (
  `hiv_counseling_id` int(11) NOT NULL AUTO_INCREMENT,
  `hiv_counseling_survey` varchar(11) NOT NULL,
  `hiv_counseling_loc` varchar(11) NOT NULL,
  `hiv_counseling_part_id` varchar(11) NOT NULL,
  `hiv_counseling_q1` varchar(100) NOT NULL,
  `hiv_counseling_q2` int(11) NOT NULL,
  `hiv_counseling_q3` int(11) NOT NULL,
  `hiv_counseling_q4` int(11) NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`hiv_counseling_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_hivcounseling`
--
DROP TRIGGER IF EXISTS `trig_cms_hivcounseling_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_hivcounseling_DELETE` BEFORE DELETE ON `cms_hivcounseling`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.hiv_counseling_id;

set @userid=OLD.update_user;



if  OLD.hiv_counseling_id !="" OR OLD.hiv_counseling_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_id);



	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_id');

end if;



if  OLD.hiv_counseling_survey !="" OR OLD.hiv_counseling_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_survey);



	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_survey');

end if;



if  OLD.hiv_counseling_loc !="" OR OLD.hiv_counseling_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_loc);



	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_loc');

end if;



if  OLD.hiv_counseling_part_id !="" OR OLD.hiv_counseling_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_part_id);



	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_part_id');

end if;



if  OLD.hiv_counseling_q1 !="" OR OLD.hiv_counseling_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_q1);



	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_q1');

end if;



if  OLD.hiv_counseling_q2 !="" OR OLD.hiv_counseling_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_q2);



	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_q2');

end if;



if  OLD.hiv_counseling_q3 !="" OR OLD.hiv_counseling_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_q3);



	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_q3');

end if;



if  OLD.hiv_counseling_q4 !="" OR OLD.hiv_counseling_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_q4);



	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_q4');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_hivcounseling(hiv_counseling_survey,hiv_counseling_loc,hiv_counseling_part_id,hiv_counseling_q1,hiv_counseling_q2,hiv_counseling_q3,hiv_counseling_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.hiv_counseling_survey,OLD.hiv_counseling_loc,OLD.hiv_counseling_part_id,OLD.hiv_counseling_q1,OLD.hiv_counseling_q2,OLD.hiv_counseling_q3,OLD.hiv_counseling_q4,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hivcounseling', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_hivcounseling_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_hivcounseling_INSERT` AFTER INSERT ON `cms_hivcounseling`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hiv_counseling_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_id);

set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_id');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_survey);

set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_survey');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_loc);

set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_loc');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_part_id);

set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_q1);

set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_q1');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_q2);

set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_q2');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_q3);

set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_q3');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_q4);

set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_q4');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_hivcounseling(hiv_counseling_survey,hiv_counseling_loc,hiv_counseling_part_id,hiv_counseling_q1,hiv_counseling_q2,hiv_counseling_q3,hiv_counseling_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hiv_counseling_survey,NEW.hiv_counseling_loc,NEW.hiv_counseling_part_id,NEW.hiv_counseling_q1,NEW.hiv_counseling_q2,NEW.hiv_counseling_q3,NEW.hiv_counseling_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hivcounseling', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_hivcounseling_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_hivcounseling_UPDATE` BEFORE UPDATE ON `cms_hivcounseling`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hiv_counseling_id;

set @userid=NEW.update_user;



if  OLD.hiv_counseling_id != NEW.hiv_counseling_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_id);

	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_id');

end if;



if  OLD.hiv_counseling_survey != NEW.hiv_counseling_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_survey);

	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_survey');

end if;



if  OLD.hiv_counseling_loc != NEW.hiv_counseling_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_loc);

	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_loc');

end if;



if  OLD.hiv_counseling_part_id != NEW.hiv_counseling_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_part_id);

	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_part_id');

end if;



if  OLD.hiv_counseling_q1 != NEW.hiv_counseling_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_q1);

	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_q1');

end if;



if  OLD.hiv_counseling_q2 != NEW.hiv_counseling_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_q2);

	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_q2');

end if;



if  OLD.hiv_counseling_q3 != NEW.hiv_counseling_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_q3);

	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_q3');

end if;



if  OLD.hiv_counseling_q4 != NEW.hiv_counseling_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_counseling_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_counseling_q4);

	set @chdCol=CONCAT(@chdCol,'-','hiv_counseling_q4');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_hivcounseling(hiv_counseling_survey,hiv_counseling_loc,hiv_counseling_part_id,hiv_counseling_q1,hiv_counseling_q2,hiv_counseling_q3,hiv_counseling_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hiv_counseling_survey,NEW.hiv_counseling_loc,NEW.hiv_counseling_part_id,NEW.hiv_counseling_q1,NEW.hiv_counseling_q2,NEW.hiv_counseling_q3,NEW.hiv_counseling_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hivcounseling', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_hivlinkage`
--

DROP TABLE IF EXISTS `cms_hivlinkage`;
CREATE TABLE IF NOT EXISTS `cms_hivlinkage` (
  `hiv_linkage_id` int(11) NOT NULL AUTO_INCREMENT,
  `hiv_linkage_survey` varchar(11) NOT NULL,
  `hiv_linkage_loc` varchar(11) NOT NULL,
  `hiv_linkage_part_id` varchar(11) NOT NULL,
  `hiv_linkage_q1` varchar(25) NOT NULL,
  `hiv_linkage_q2` int(11) NOT NULL,
  `hiv_linkage_q2a` int(11) NOT NULL,
  `hiv_linkage_q2b` int(11) DEFAULT NULL,
  `hiv_linkage_q3` varchar(25) DEFAULT NULL,
  `hiv_linkage_q4` int(11) DEFAULT NULL,
  `hiv_linkage_q5` varchar(25) DEFAULT NULL,
  `hiv_linkage_q6` int(11) DEFAULT NULL,
  `hiv_linkage_q7` varchar(25) DEFAULT NULL,
  `hiv_linkage_q7qty` varchar(100) DEFAULT NULL,
  `hiv_linkage_q7a` varchar(3) DEFAULT NULL,
  `hiv_linkage_q7aqty` int(11) DEFAULT NULL,
  `hiv_linkage_q7b` varchar(3) DEFAULT NULL,
  `hiv_linkage_q7bqty` int(11) DEFAULT NULL,
  `hiv_linkage_q7c` varchar(3) DEFAULT NULL,
  `hiv_linkage_q7cqty` int(11) DEFAULT NULL,
  `hiv_linkage_q7d` varchar(3) DEFAULT NULL,
  `hiv_linkage_q7dqty` int(11) DEFAULT NULL,
  `hiv_linkage_q8` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`hiv_linkage_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_hivlinkage`
--
DROP TRIGGER IF EXISTS `trig_cms_hivlinkage_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_hivlinkage_DELETE` BEFORE DELETE ON `cms_hivlinkage`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.hiv_linkage_id;

set @userid=OLD.update_user;



if  OLD.hiv_linkage_id !="" OR OLD.hiv_linkage_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_id);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_id');

end if;



if  OLD.hiv_linkage_survey !="" OR OLD.hiv_linkage_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_survey);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_survey');

end if;



if  OLD.hiv_linkage_loc !="" OR OLD.hiv_linkage_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_loc);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_loc');

end if;



if  OLD.hiv_linkage_part_id !="" OR OLD.hiv_linkage_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_part_id);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_part_id');

end if;



if  OLD.hiv_linkage_q1 !="" OR OLD.hiv_linkage_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q1);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q1');

end if;



if  OLD.hiv_linkage_q2 !="" OR OLD.hiv_linkage_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q2);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q2');

end if;



if  OLD.hiv_linkage_q2a !="" OR OLD.hiv_linkage_q2a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q2a);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q2a');

end if;



if  OLD.hiv_linkage_q2b !="" OR OLD.hiv_linkage_q2b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q2b);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q2b');

end if;



if  OLD.hiv_linkage_q3 !="" OR OLD.hiv_linkage_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q3);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q3');

end if;



if  OLD.hiv_linkage_q4 !="" OR OLD.hiv_linkage_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q4);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q4');

end if;



if  OLD.hiv_linkage_q5 !="" OR OLD.hiv_linkage_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q5);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q5');

end if;



if  OLD.hiv_linkage_q6 !="" OR OLD.hiv_linkage_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q6);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q6');

end if;



if  OLD.hiv_linkage_q7 !="" OR OLD.hiv_linkage_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7');

end if;



if  OLD.hiv_linkage_q7qty !="" OR OLD.hiv_linkage_q7qty is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7qty);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7qty');

end if;



if  OLD.hiv_linkage_q7a !="" OR OLD.hiv_linkage_q7a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7a);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7a');

end if;



if  OLD.hiv_linkage_q7aqty !="" OR OLD.hiv_linkage_q7aqty is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7aqty);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7aqty');

end if;



if  OLD.hiv_linkage_q7b !="" OR OLD.hiv_linkage_q7b is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7b);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7b');

end if;



if  OLD.hiv_linkage_q7bqty !="" OR OLD.hiv_linkage_q7bqty is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7bqty);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7bqty');

end if;



if  OLD.hiv_linkage_q7c !="" OR OLD.hiv_linkage_q7c is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7c);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7c');

end if;



if  OLD.hiv_linkage_q7cqty !="" OR OLD.hiv_linkage_q7cqty is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7cqty);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7cqty');

end if;



if  OLD.hiv_linkage_q7d !="" OR OLD.hiv_linkage_q7d is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7d);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7d');

end if;



if  OLD.hiv_linkage_q7dqty !="" OR OLD.hiv_linkage_q7dqty is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7dqty);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7dqty');

end if;



if  OLD.hiv_linkage_q8 !="" OR OLD.hiv_linkage_q8 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q8);



	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q8');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_hivlinkage(hiv_linkage_survey,hiv_linkage_loc,hiv_linkage_part_id,hiv_linkage_q1,hiv_linkage_q2,hiv_linkage_q2a,hiv_linkage_q2b,hiv_linkage_q3,hiv_linkage_q4,hiv_linkage_q5,hiv_linkage_q6,hiv_linkage_q7,hiv_linkage_q7qty,hiv_linkage_q7a,hiv_linkage_q7aqty,hiv_linkage_q7b,hiv_linkage_q7bqty,hiv_linkage_q7c,hiv_linkage_q7cqty,hiv_linkage_q7d,hiv_linkage_q7dqty,hiv_linkage_q8,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.hiv_linkage_survey,OLD.hiv_linkage_loc,OLD.hiv_linkage_part_id,OLD.hiv_linkage_q1,OLD.hiv_linkage_q2,OLD.hiv_linkage_q2a,OLD.hiv_linkage_q2b,OLD.hiv_linkage_q3,OLD.hiv_linkage_q4,OLD.hiv_linkage_q5,OLD.hiv_linkage_q6,OLD.hiv_linkage_q7,OLD.hiv_linkage_q7qty,OLD.hiv_linkage_q7a,OLD.hiv_linkage_q7aqty,OLD.hiv_linkage_q7b,OLD.hiv_linkage_q7bqty,OLD.hiv_linkage_q7c,OLD.hiv_linkage_q7cqty,OLD.hiv_linkage_q7d,OLD.hiv_linkage_q7dqty,OLD.hiv_linkage_q8,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hivlinkage', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_hivlinkage_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_hivlinkage_INSERT` AFTER INSERT ON `cms_hivlinkage`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hiv_linkage_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_id);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_id');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_survey);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_survey');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_loc);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_loc');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_part_id);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q1);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q1');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q2);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q2');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q2a);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q2a');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q2b);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q2b');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q3);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q3');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q4);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q4');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q5);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q5');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q6);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q6');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7qty);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7qty');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7a);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7a');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7aqty);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7aqty');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7b);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7b');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7bqty);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7bqty');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7c);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7c');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7cqty);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7cqty');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7d);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7d');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7dqty);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7dqty');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q8);

set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q8');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_hivlinkage(hiv_linkage_survey,hiv_linkage_loc,hiv_linkage_part_id,hiv_linkage_q1,hiv_linkage_q2,hiv_linkage_q2a,hiv_linkage_q2b,hiv_linkage_q3,hiv_linkage_q4,hiv_linkage_q5,hiv_linkage_q6,hiv_linkage_q7,hiv_linkage_q7qty,hiv_linkage_q7a,hiv_linkage_q7aqty,hiv_linkage_q7b,hiv_linkage_q7bqty,hiv_linkage_q7c,hiv_linkage_q7cqty,hiv_linkage_q7d,hiv_linkage_q7dqty,hiv_linkage_q8,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hiv_linkage_survey,NEW.hiv_linkage_loc,NEW.hiv_linkage_part_id,NEW.hiv_linkage_q1,NEW.hiv_linkage_q2,NEW.hiv_linkage_q2a,NEW.hiv_linkage_q2b,NEW.hiv_linkage_q3,NEW.hiv_linkage_q4,NEW.hiv_linkage_q5,NEW.hiv_linkage_q6,NEW.hiv_linkage_q7,NEW.hiv_linkage_q7qty,NEW.hiv_linkage_q7a,NEW.hiv_linkage_q7aqty,NEW.hiv_linkage_q7b,NEW.hiv_linkage_q7bqty,NEW.hiv_linkage_q7c,NEW.hiv_linkage_q7cqty,NEW.hiv_linkage_q7d,NEW.hiv_linkage_q7dqty,NEW.hiv_linkage_q8,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hivlinkage', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_hivlinkage_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_hivlinkage_UPDATE` BEFORE UPDATE ON `cms_hivlinkage`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hiv_linkage_id;

set @userid=NEW.update_user;



if  OLD.hiv_linkage_id != NEW.hiv_linkage_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_id);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_id');

end if;



if  OLD.hiv_linkage_survey != NEW.hiv_linkage_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_survey);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_survey');

end if;



if  OLD.hiv_linkage_loc != NEW.hiv_linkage_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_loc);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_loc');

end if;



if  OLD.hiv_linkage_part_id != NEW.hiv_linkage_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_part_id);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_part_id');

end if;



if  OLD.hiv_linkage_q1 != NEW.hiv_linkage_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q1);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q1');

end if;



if  OLD.hiv_linkage_q2 != NEW.hiv_linkage_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q2);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q2');

end if;



if  OLD.hiv_linkage_q2a != NEW.hiv_linkage_q2a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q2a);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q2a);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q2a');

end if;



if  OLD.hiv_linkage_q2b != NEW.hiv_linkage_q2b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q2b);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q2b);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q2b');

end if;



if  OLD.hiv_linkage_q3 != NEW.hiv_linkage_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q3);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q3');

end if;



if  OLD.hiv_linkage_q4 != NEW.hiv_linkage_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q4);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q4');

end if;



if  OLD.hiv_linkage_q5 != NEW.hiv_linkage_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q5);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q5');

end if;



if  OLD.hiv_linkage_q6 != NEW.hiv_linkage_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q6);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q6');

end if;



if  OLD.hiv_linkage_q7 != NEW.hiv_linkage_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7');

end if;



if  OLD.hiv_linkage_q7qty != NEW.hiv_linkage_q7qty

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7qty);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7qty);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7qty');

end if;



if  OLD.hiv_linkage_q7a != NEW.hiv_linkage_q7a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7a);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7a);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7a');

end if;



if  OLD.hiv_linkage_q7aqty != NEW.hiv_linkage_q7aqty

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7aqty);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7aqty);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7aqty');

end if;



if  OLD.hiv_linkage_q7b != NEW.hiv_linkage_q7b

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7b);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7b);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7b');

end if;



if  OLD.hiv_linkage_q7bqty != NEW.hiv_linkage_q7bqty

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7bqty);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7bqty);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7bqty');

end if;



if  OLD.hiv_linkage_q7c != NEW.hiv_linkage_q7c

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7c);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7c);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7c');

end if;



if  OLD.hiv_linkage_q7cqty != NEW.hiv_linkage_q7cqty

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7cqty);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7cqty);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7cqty');

end if;



if  OLD.hiv_linkage_q7d != NEW.hiv_linkage_q7d

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7d);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7d);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7d');

end if;



if  OLD.hiv_linkage_q7dqty != NEW.hiv_linkage_q7dqty

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q7dqty);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q7dqty);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q7dqty');

end if;



if  OLD.hiv_linkage_q8 != NEW.hiv_linkage_q8

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_linkage_q8);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_linkage_q8);

	set @chdCol=CONCAT(@chdCol,'-','hiv_linkage_q8');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_hivlinkage(hiv_linkage_survey,hiv_linkage_loc,hiv_linkage_part_id,hiv_linkage_q1,hiv_linkage_q2,hiv_linkage_q2a,hiv_linkage_q2b,hiv_linkage_q3,hiv_linkage_q4,hiv_linkage_q5,hiv_linkage_q6,hiv_linkage_q7,hiv_linkage_q7qty,hiv_linkage_q7a,hiv_linkage_q7aqty,hiv_linkage_q7b,hiv_linkage_q7bqty,hiv_linkage_q7c,hiv_linkage_q7cqty,hiv_linkage_q7d,hiv_linkage_q7dqty,hiv_linkage_q8,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hiv_linkage_survey,NEW.hiv_linkage_loc,NEW.hiv_linkage_part_id,NEW.hiv_linkage_q1,NEW.hiv_linkage_q2,NEW.hiv_linkage_q2a,NEW.hiv_linkage_q2b,NEW.hiv_linkage_q3,NEW.hiv_linkage_q4,NEW.hiv_linkage_q5,NEW.hiv_linkage_q6,NEW.hiv_linkage_q7,NEW.hiv_linkage_q7qty,NEW.hiv_linkage_q7a,NEW.hiv_linkage_q7aqty,NEW.hiv_linkage_q7b,NEW.hiv_linkage_q7bqty,NEW.hiv_linkage_q7c,NEW.hiv_linkage_q7cqty,NEW.hiv_linkage_q7d,NEW.hiv_linkage_q7dqty,NEW.hiv_linkage_q8,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hivlinkage', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_hivtesting`
--

DROP TABLE IF EXISTS `cms_hivtesting`;
CREATE TABLE IF NOT EXISTS `cms_hivtesting` (
  `hiv_test_id` int(11) NOT NULL AUTO_INCREMENT,
  `hiv_test_survey` varchar(11) NOT NULL,
  `hiv_test_loc` varchar(11) NOT NULL,
  `hiv_test_part_id` varchar(11) NOT NULL,
  `hiv_test_q1` int(11) NOT NULL,
  `hiv_test_q2` varchar(100) NOT NULL,
  `hiv_test_q3` int(11) NOT NULL,
  `hiv_test_q4` int(11) DEFAULT NULL,
  `hiv_test_q5` int(11) DEFAULT NULL,
  `hiv_test_q6` int(11) DEFAULT NULL,
  `hiv_test_q7` int(11) DEFAULT NULL,
  `hiv_test_q8` int(11) DEFAULT NULL,
  `hiv_test_q9` int(11) DEFAULT NULL,
  `hiv_test_q10` int(11) DEFAULT NULL,
  `hiv_test_q11` int(11) DEFAULT NULL,
  `hiv_test_q12` int(11) DEFAULT NULL,
  `hiv_test_q13` int(11) DEFAULT NULL,
  `hiv_test_q14` int(11) DEFAULT NULL,
  `hiv_test_q15` int(11) DEFAULT NULL,
  `hiv_test_q16` int(11) DEFAULT NULL,
  `hiv_test_q17` int(11) DEFAULT NULL,
  `hiv_test_q18` int(11) DEFAULT NULL,
  `hiv_test_q19` int(11) DEFAULT NULL,
  `hiv_test_q20` int(11) DEFAULT NULL,
  `hiv_test_q21` int(11) DEFAULT NULL,
  `hiv_test_q22` varchar(50) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`hiv_test_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_hivtesting`
--
DROP TRIGGER IF EXISTS `trig_cms_hivtesting_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_hivtesting_DELETE` BEFORE DELETE ON `cms_hivtesting`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.hiv_test_id;

set @userid=OLD.update_user;



if  OLD.hiv_test_id !="" OR OLD.hiv_test_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_id);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_id');

end if;



if  OLD.hiv_test_survey !="" OR OLD.hiv_test_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_survey);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_survey');

end if;



if  OLD.hiv_test_loc !="" OR OLD.hiv_test_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_loc);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_loc');

end if;



if  OLD.hiv_test_part_id !="" OR OLD.hiv_test_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_part_id);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_part_id');

end if;



if  OLD.hiv_test_q1 !="" OR OLD.hiv_test_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q1);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q1');

end if;



if  OLD.hiv_test_q2 !="" OR OLD.hiv_test_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q2);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q2');

end if;



if  OLD.hiv_test_q3 !="" OR OLD.hiv_test_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q3);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q3');

end if;



if  OLD.hiv_test_q4 !="" OR OLD.hiv_test_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q4);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q4');

end if;



if  OLD.hiv_test_q5 !="" OR OLD.hiv_test_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q5);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q5');

end if;



if  OLD.hiv_test_q6 !="" OR OLD.hiv_test_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q6);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q6');

end if;



if  OLD.hiv_test_q7 !="" OR OLD.hiv_test_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q7);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q7');

end if;



if  OLD.hiv_test_q8 !="" OR OLD.hiv_test_q8 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q8);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q8');

end if;



if  OLD.hiv_test_q9 !="" OR OLD.hiv_test_q9 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q9);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q9');

end if;



if  OLD.hiv_test_q10 !="" OR OLD.hiv_test_q10 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q10);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q10');

end if;



if  OLD.hiv_test_q11 !="" OR OLD.hiv_test_q11 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q11);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q11');

end if;



if  OLD.hiv_test_q12 !="" OR OLD.hiv_test_q12 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q12);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q12');

end if;



if  OLD.hiv_test_q13 !="" OR OLD.hiv_test_q13 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q13);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q13');

end if;



if  OLD.hiv_test_q14 !="" OR OLD.hiv_test_q14 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q14);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q14');

end if;



if  OLD.hiv_test_q15 !="" OR OLD.hiv_test_q15 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q15);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q15');

end if;



if  OLD.hiv_test_q16 !="" OR OLD.hiv_test_q16 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q16);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q16');

end if;



if  OLD.hiv_test_q17 !="" OR OLD.hiv_test_q17 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q17);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q17');

end if;



if  OLD.hiv_test_q18 !="" OR OLD.hiv_test_q18 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q18);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q18');

end if;



if  OLD.hiv_test_q19 !="" OR OLD.hiv_test_q19 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q19);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q19');

end if;



if  OLD.hiv_test_q20 !="" OR OLD.hiv_test_q20 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q20);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q20');

end if;



if  OLD.hiv_test_q21 !="" OR OLD.hiv_test_q21 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q21);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q21');

end if;



if  OLD.hiv_test_q22 !="" OR OLD.hiv_test_q22 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q22);



	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q22');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_hivtesting(hiv_test_survey,hiv_test_loc,hiv_test_part_id,hiv_test_q1,hiv_test_q2,hiv_test_q3,hiv_test_q4,hiv_test_q5,hiv_test_q6,hiv_test_q7,hiv_test_q8,hiv_test_q9,hiv_test_q10,hiv_test_q11,hiv_test_q12,hiv_test_q13,hiv_test_q14,hiv_test_q15,hiv_test_q16,hiv_test_q17,hiv_test_q18,hiv_test_q19,hiv_test_q20,hiv_test_q21,hiv_test_q22,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.hiv_test_survey,OLD.hiv_test_loc,OLD.hiv_test_part_id,OLD.hiv_test_q1,OLD.hiv_test_q2,OLD.hiv_test_q3,OLD.hiv_test_q4,OLD.hiv_test_q5,OLD.hiv_test_q6,OLD.hiv_test_q7,OLD.hiv_test_q8,OLD.hiv_test_q9,OLD.hiv_test_q10,OLD.hiv_test_q11,OLD.hiv_test_q12,OLD.hiv_test_q13,OLD.hiv_test_q14,OLD.hiv_test_q15,OLD.hiv_test_q16,OLD.hiv_test_q17,OLD.hiv_test_q18,OLD.hiv_test_q19,OLD.hiv_test_q20,OLD.hiv_test_q21,OLD.hiv_test_q22,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hivtesting', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_hivtesting_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_hivtesting_INSERT` AFTER INSERT ON `cms_hivtesting`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hiv_test_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_id);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_id');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_survey);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_survey');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_loc);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_loc');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_part_id);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q1);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q1');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q2);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q2');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q3);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q3');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q4);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q4');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q5);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q5');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q6);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q6');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q7);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q7');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q8);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q8');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q9);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q9');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q10);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q10');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q11);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q11');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q12);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q12');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q13);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q13');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q14);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q14');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q15);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q15');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q16);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q16');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q17);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q17');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q18);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q18');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q19);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q19');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q20);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q20');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q21);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q21');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q22);

set @chdCol=CONCAT(@chdCol,'-','hiv_test_q22');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_hivtesting(hiv_test_survey,hiv_test_loc,hiv_test_part_id,hiv_test_q1,hiv_test_q2,hiv_test_q3,hiv_test_q4,hiv_test_q5,hiv_test_q6,hiv_test_q7,hiv_test_q8,hiv_test_q9,hiv_test_q10,hiv_test_q11,hiv_test_q12,hiv_test_q13,hiv_test_q14,hiv_test_q15,hiv_test_q16,hiv_test_q17,hiv_test_q18,hiv_test_q19,hiv_test_q20,hiv_test_q21,hiv_test_q22,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hiv_test_survey,NEW.hiv_test_loc,NEW.hiv_test_part_id,NEW.hiv_test_q1,NEW.hiv_test_q2,NEW.hiv_test_q3,NEW.hiv_test_q4,NEW.hiv_test_q5,NEW.hiv_test_q6,NEW.hiv_test_q7,NEW.hiv_test_q8,NEW.hiv_test_q9,NEW.hiv_test_q10,NEW.hiv_test_q11,NEW.hiv_test_q12,NEW.hiv_test_q13,NEW.hiv_test_q14,NEW.hiv_test_q15,NEW.hiv_test_q16,NEW.hiv_test_q17,NEW.hiv_test_q18,NEW.hiv_test_q19,NEW.hiv_test_q20,NEW.hiv_test_q21,NEW.hiv_test_q22,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hivtesting', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_hivtesting_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_hivtesting_UPDATE` BEFORE UPDATE ON `cms_hivtesting`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hiv_test_id;

set @userid=NEW.update_user;



if  OLD.hiv_test_id != NEW.hiv_test_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_id);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_id');

end if;



if  OLD.hiv_test_survey != NEW.hiv_test_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_survey);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_survey');

end if;



if  OLD.hiv_test_loc != NEW.hiv_test_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_loc);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_loc');

end if;



if  OLD.hiv_test_part_id != NEW.hiv_test_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_part_id);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_part_id');

end if;



if  OLD.hiv_test_q1 != NEW.hiv_test_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q1);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q1');

end if;



if  OLD.hiv_test_q2 != NEW.hiv_test_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q2);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q2');

end if;



if  OLD.hiv_test_q3 != NEW.hiv_test_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q3);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q3');

end if;



if  OLD.hiv_test_q4 != NEW.hiv_test_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q4);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q4');

end if;



if  OLD.hiv_test_q5 != NEW.hiv_test_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q5);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q5');

end if;



if  OLD.hiv_test_q6 != NEW.hiv_test_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q6);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q6');

end if;



if  OLD.hiv_test_q7 != NEW.hiv_test_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q7);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q7');

end if;



if  OLD.hiv_test_q8 != NEW.hiv_test_q8

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q8);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q8);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q8');

end if;



if  OLD.hiv_test_q9 != NEW.hiv_test_q9

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q9);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q9);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q9');

end if;



if  OLD.hiv_test_q10 != NEW.hiv_test_q10

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q10);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q10);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q10');

end if;



if  OLD.hiv_test_q11 != NEW.hiv_test_q11

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q11);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q11);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q11');

end if;



if  OLD.hiv_test_q12 != NEW.hiv_test_q12

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q12);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q12);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q12');

end if;



if  OLD.hiv_test_q13 != NEW.hiv_test_q13

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q13);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q13);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q13');

end if;



if  OLD.hiv_test_q14 != NEW.hiv_test_q14

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q14);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q14);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q14');

end if;



if  OLD.hiv_test_q15 != NEW.hiv_test_q15

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q15);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q15);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q15');

end if;



if  OLD.hiv_test_q16 != NEW.hiv_test_q16

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q16);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q16);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q16');

end if;



if  OLD.hiv_test_q17 != NEW.hiv_test_q17

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q17);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q17);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q17');

end if;



if  OLD.hiv_test_q18 != NEW.hiv_test_q18

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q18);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q18);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q18');

end if;



if  OLD.hiv_test_q19 != NEW.hiv_test_q19

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q19);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q19);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q19');

end if;



if  OLD.hiv_test_q20 != NEW.hiv_test_q20

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q20);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q20);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q20');

end if;



if  OLD.hiv_test_q21 != NEW.hiv_test_q21

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q21);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q21);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q21');

end if;



if  OLD.hiv_test_q22 != NEW.hiv_test_q22

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_test_q22);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_test_q22);

	set @chdCol=CONCAT(@chdCol,'-','hiv_test_q22');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_hivtesting(hiv_test_survey,hiv_test_loc,hiv_test_part_id,hiv_test_q1,hiv_test_q2,hiv_test_q3,hiv_test_q4,hiv_test_q5,hiv_test_q6,hiv_test_q7,hiv_test_q8,hiv_test_q9,hiv_test_q10,hiv_test_q11,hiv_test_q12,hiv_test_q13,hiv_test_q14,hiv_test_q15,hiv_test_q16,hiv_test_q17,hiv_test_q18,hiv_test_q19,hiv_test_q20,hiv_test_q21,hiv_test_q22,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hiv_test_survey,NEW.hiv_test_loc,NEW.hiv_test_part_id,NEW.hiv_test_q1,NEW.hiv_test_q2,NEW.hiv_test_q3,NEW.hiv_test_q4,NEW.hiv_test_q5,NEW.hiv_test_q6,NEW.hiv_test_q7,NEW.hiv_test_q8,NEW.hiv_test_q9,NEW.hiv_test_q10,NEW.hiv_test_q11,NEW.hiv_test_q12,NEW.hiv_test_q13,NEW.hiv_test_q14,NEW.hiv_test_q15,NEW.hiv_test_q16,NEW.hiv_test_q17,NEW.hiv_test_q18,NEW.hiv_test_q19,NEW.hiv_test_q20,NEW.hiv_test_q21,NEW.hiv_test_q22,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hivtesting', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_hivvisit`
--

DROP TABLE IF EXISTS `cms_hivvisit`;
CREATE TABLE IF NOT EXISTS `cms_hivvisit` (
  `hiv_visit_id` int(11) NOT NULL AUTO_INCREMENT,
  `hiv_visit_survey` varchar(11) NOT NULL,
  `hiv_visit_loc` varchar(11) NOT NULL,
  `hiv_visit_part_id` varchar(11) NOT NULL,
  `hiv_visit_q1` int(11) NOT NULL,
  `hiv_visit_q2` int(11) DEFAULT NULL,
  `hiv_visit_q3` int(11) DEFAULT NULL,
  `hiv_visit_q4` int(11) DEFAULT NULL,
  `hiv_visit_q5` int(11) DEFAULT NULL,
  `hiv_visit_q6` int(11) DEFAULT NULL,
  `hiv_visit_q6a` varchar(11) DEFAULT NULL,
  `hiv_visit_q7` int(11) DEFAULT NULL,
  `hiv_visit_q7a` varchar(11) DEFAULT NULL,
  `hiv_visit_q8` int(11) DEFAULT NULL,
  `hiv_visit_q8a` varchar(11) DEFAULT NULL,
  `hiv_visit_q9` int(11) DEFAULT NULL,
  `hiv_visit_q9a` varchar(11) DEFAULT NULL,
  `hiv_visit_q10` int(11) DEFAULT NULL,
  `hiv_visit_q11` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`hiv_visit_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_hivvisit`
--
DROP TRIGGER IF EXISTS `trig_cms_hivvisit_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_hivvisit_DELETE` BEFORE DELETE ON `cms_hivvisit`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.hiv_visit_id;

set @userid=OLD.update_user;



if  OLD.hiv_visit_id !="" OR OLD.hiv_visit_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_id);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_id');

end if;



if  OLD.hiv_visit_survey !="" OR OLD.hiv_visit_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_survey);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_survey');

end if;



if  OLD.hiv_visit_loc !="" OR OLD.hiv_visit_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_loc);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_loc');

end if;



if  OLD.hiv_visit_part_id !="" OR OLD.hiv_visit_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_part_id);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_part_id');

end if;



if  OLD.hiv_visit_q1 !="" OR OLD.hiv_visit_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q1);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q1');

end if;



if  OLD.hiv_visit_q2 !="" OR OLD.hiv_visit_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q2);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q2');

end if;



if  OLD.hiv_visit_q3 !="" OR OLD.hiv_visit_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q3);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q3');

end if;



if  OLD.hiv_visit_q4 !="" OR OLD.hiv_visit_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q4);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q4');

end if;



if  OLD.hiv_visit_q5 !="" OR OLD.hiv_visit_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q5);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q5');

end if;



if  OLD.hiv_visit_q6 !="" OR OLD.hiv_visit_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q6);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q6');

end if;



if  OLD.hiv_visit_q6a !="" OR OLD.hiv_visit_q6a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q6a);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q6a');

end if;



if  OLD.hiv_visit_q7 !="" OR OLD.hiv_visit_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q7);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q7');

end if;



if  OLD.hiv_visit_q7a !="" OR OLD.hiv_visit_q7a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q7a);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q7a');

end if;



if  OLD.hiv_visit_q8 !="" OR OLD.hiv_visit_q8 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q8);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q8');

end if;



if  OLD.hiv_visit_q8a !="" OR OLD.hiv_visit_q8a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q8a);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q8a');

end if;



if  OLD.hiv_visit_q9 !="" OR OLD.hiv_visit_q9 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q9);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q9');

end if;



if  OLD.hiv_visit_q9a !="" OR OLD.hiv_visit_q9a is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q9a);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q9a');

end if;



if  OLD.hiv_visit_q10 !="" OR OLD.hiv_visit_q10 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q10);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q10');

end if;



if  OLD.hiv_visit_q11 !="" OR OLD.hiv_visit_q11 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q11);



	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q11');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_hivvisit(hiv_visit_survey,hiv_visit_loc,hiv_visit_part_id,hiv_visit_q1,hiv_visit_q2,hiv_visit_q3,hiv_visit_q4,hiv_visit_q5,hiv_visit_q6,hiv_visit_q6a,hiv_visit_q7,hiv_visit_q7a,hiv_visit_q8,hiv_visit_q8a,hiv_visit_q9,hiv_visit_q9a,hiv_visit_q10,hiv_visit_q11,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.hiv_visit_survey,OLD.hiv_visit_loc,OLD.hiv_visit_part_id,OLD.hiv_visit_q1,OLD.hiv_visit_q2,OLD.hiv_visit_q3,OLD.hiv_visit_q4,OLD.hiv_visit_q5,OLD.hiv_visit_q6,OLD.hiv_visit_q6a,OLD.hiv_visit_q7,OLD.hiv_visit_q7a,OLD.hiv_visit_q8,OLD.hiv_visit_q8a,OLD.hiv_visit_q9,OLD.hiv_visit_q9a,OLD.hiv_visit_q10,OLD.hiv_visit_q11,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hivvisit', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_hivvisit_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_hivvisit_INSERT` AFTER INSERT ON `cms_hivvisit`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hiv_visit_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_id);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_id');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_survey);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_survey');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_loc);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_loc');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_part_id);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q1);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q1');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q2);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q2');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q3);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q3');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q4);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q4');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q5);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q5');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q6);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q6');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q6a);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q6a');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q7);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q7');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q7a);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q7a');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q8);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q8');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q8a);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q8a');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q9);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q9');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q9a);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q9a');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q10);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q10');

set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q11);

set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q11');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_hivvisit(hiv_visit_survey,hiv_visit_loc,hiv_visit_part_id,hiv_visit_q1,hiv_visit_q2,hiv_visit_q3,hiv_visit_q4,hiv_visit_q5,hiv_visit_q6,hiv_visit_q6a,hiv_visit_q7,hiv_visit_q7a,hiv_visit_q8,hiv_visit_q8a,hiv_visit_q9,hiv_visit_q9a,hiv_visit_q10,hiv_visit_q11,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hiv_visit_survey,NEW.hiv_visit_loc,NEW.hiv_visit_part_id,NEW.hiv_visit_q1,NEW.hiv_visit_q2,NEW.hiv_visit_q3,NEW.hiv_visit_q4,NEW.hiv_visit_q5,NEW.hiv_visit_q6,NEW.hiv_visit_q6a,NEW.hiv_visit_q7,NEW.hiv_visit_q7a,NEW.hiv_visit_q8,NEW.hiv_visit_q8a,NEW.hiv_visit_q9,NEW.hiv_visit_q9a,NEW.hiv_visit_q10,NEW.hiv_visit_q11,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hivvisit', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_hivvisit_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_hivvisit_UPDATE` BEFORE UPDATE ON `cms_hivvisit`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.hiv_visit_id;

set @userid=NEW.update_user;



if  OLD.hiv_visit_id != NEW.hiv_visit_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_id);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_id');

end if;



if  OLD.hiv_visit_survey != NEW.hiv_visit_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_survey);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_survey');

end if;



if  OLD.hiv_visit_loc != NEW.hiv_visit_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_loc);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_loc');

end if;



if  OLD.hiv_visit_part_id != NEW.hiv_visit_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_part_id);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_part_id');

end if;



if  OLD.hiv_visit_q1 != NEW.hiv_visit_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q1);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q1');

end if;



if  OLD.hiv_visit_q2 != NEW.hiv_visit_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q2);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q2');

end if;



if  OLD.hiv_visit_q3 != NEW.hiv_visit_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q3);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q3');

end if;



if  OLD.hiv_visit_q4 != NEW.hiv_visit_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q4);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q4');

end if;



if  OLD.hiv_visit_q5 != NEW.hiv_visit_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q5);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q5');

end if;



if  OLD.hiv_visit_q6 != NEW.hiv_visit_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q6);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q6');

end if;



if  OLD.hiv_visit_q6a != NEW.hiv_visit_q6a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q6a);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q6a);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q6a');

end if;



if  OLD.hiv_visit_q7 != NEW.hiv_visit_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q7);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q7');

end if;



if  OLD.hiv_visit_q7a != NEW.hiv_visit_q7a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q7a);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q7a);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q7a');

end if;



if  OLD.hiv_visit_q8 != NEW.hiv_visit_q8

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q8);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q8);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q8');

end if;



if  OLD.hiv_visit_q8a != NEW.hiv_visit_q8a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q8a);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q8a);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q8a');

end if;



if  OLD.hiv_visit_q9 != NEW.hiv_visit_q9

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q9);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q9);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q9');

end if;



if  OLD.hiv_visit_q9a != NEW.hiv_visit_q9a

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q9a);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q9a);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q9a');

end if;



if  OLD.hiv_visit_q10 != NEW.hiv_visit_q10

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q10);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q10);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q10');

end if;



if  OLD.hiv_visit_q11 != NEW.hiv_visit_q11

then

	set @oldval =CONCAT(@oldVal,'-',OLD.hiv_visit_q11);

	set @newVal =CONCAT(@newVal,'-', NEW.hiv_visit_q11);

	set @chdCol=CONCAT(@chdCol,'-','hiv_visit_q11');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_hivvisit(hiv_visit_survey,hiv_visit_loc,hiv_visit_part_id,hiv_visit_q1,hiv_visit_q2,hiv_visit_q3,hiv_visit_q4,hiv_visit_q5,hiv_visit_q6,hiv_visit_q6a,hiv_visit_q7,hiv_visit_q7a,hiv_visit_q8,hiv_visit_q8a,hiv_visit_q9,hiv_visit_q9a,hiv_visit_q10,hiv_visit_q11,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.hiv_visit_survey,NEW.hiv_visit_loc,NEW.hiv_visit_part_id,NEW.hiv_visit_q1,NEW.hiv_visit_q2,NEW.hiv_visit_q3,NEW.hiv_visit_q4,NEW.hiv_visit_q5,NEW.hiv_visit_q6,NEW.hiv_visit_q6a,NEW.hiv_visit_q7,NEW.hiv_visit_q7a,NEW.hiv_visit_q8,NEW.hiv_visit_q8a,NEW.hiv_visit_q9,NEW.hiv_visit_q9a,NEW.hiv_visit_q10,NEW.hiv_visit_q11,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_hivvisit', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_incentivesmaster`
--

DROP TABLE IF EXISTS `cms_incentivesmaster`;
CREATE TABLE IF NOT EXISTS `cms_incentivesmaster` (
  `incentive_master_id` int(11) NOT NULL AUTO_INCREMENT,
  `incentive_master_survey` varchar(11) NOT NULL,
  `incentive_master_part_id` varchar(11) NOT NULL,
  `incentive_master_q1` int(11) NOT NULL,
  `incentive_master_q2` int(11) NOT NULL,
  `incentive_master_q3` int(11) NOT NULL,
  `incentive_master_q4` int(11) NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) NOT NULL,
  PRIMARY KEY (`incentive_master_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_incentivesmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_incentivesmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_incentivesmaster_DELETE` BEFORE DELETE ON `cms_incentivesmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.incentive_master_id;

set @userid=OLD.update_user;



if  OLD.incentive_master_id !="" OR OLD.incentive_master_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_id);



	set @chdCol=CONCAT(@chdCol,'-','incentive_master_id');

end if;



if  OLD.incentive_master_survey !="" OR OLD.incentive_master_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_survey);



	set @chdCol=CONCAT(@chdCol,'-','incentive_master_survey');

end if;



if  OLD.incentive_master_part_id !="" OR OLD.incentive_master_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_part_id);



	set @chdCol=CONCAT(@chdCol,'-','incentive_master_part_id');

end if;



if  OLD.incentive_master_q1 !="" OR OLD.incentive_master_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_q1);



	set @chdCol=CONCAT(@chdCol,'-','incentive_master_q1');

end if;



if  OLD.incentive_master_q2 !="" OR OLD.incentive_master_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_q2);



	set @chdCol=CONCAT(@chdCol,'-','incentive_master_q2');

end if;



if  OLD.incentive_master_q3 !="" OR OLD.incentive_master_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_q3);



	set @chdCol=CONCAT(@chdCol,'-','incentive_master_q3');

end if;



if  OLD.incentive_master_q4 !="" OR OLD.incentive_master_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_q4);



	set @chdCol=CONCAT(@chdCol,'-','incentive_master_q4');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_incentivesmaster(incentive_master_survey,incentive_master_part_id,incentive_master_q1,incentive_master_q2,incentive_master_q3,incentive_master_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.incentive_master_survey,OLD.incentive_master_part_id,OLD.incentive_master_q1,OLD.incentive_master_q2,OLD.incentive_master_q3,OLD.incentive_master_q4,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_incentivesmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_incentivesmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_incentivesmaster_INSERT` AFTER INSERT ON `cms_incentivesmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.incentive_master_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_id);

set @chdCol=CONCAT(@chdCol,'-','incentive_master_id');

set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_survey);

set @chdCol=CONCAT(@chdCol,'-','incentive_master_survey');

set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_part_id);

set @chdCol=CONCAT(@chdCol,'-','incentive_master_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_q1);

set @chdCol=CONCAT(@chdCol,'-','incentive_master_q1');

set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_q2);

set @chdCol=CONCAT(@chdCol,'-','incentive_master_q2');

set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_q3);

set @chdCol=CONCAT(@chdCol,'-','incentive_master_q3');

set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_q4);

set @chdCol=CONCAT(@chdCol,'-','incentive_master_q4');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_incentivesmaster(incentive_master_survey,incentive_master_part_id,incentive_master_q1,incentive_master_q2,incentive_master_q3,incentive_master_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.incentive_master_survey,NEW.incentive_master_part_id,NEW.incentive_master_q1,NEW.incentive_master_q2,NEW.incentive_master_q3,NEW.incentive_master_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_incentivesmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_incentivesmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_incentivesmaster_UPDATE` BEFORE UPDATE ON `cms_incentivesmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.incentive_master_id;

set @userid=NEW.update_user;



if  OLD.incentive_master_id != NEW.incentive_master_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_id);

	set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_id);

	set @chdCol=CONCAT(@chdCol,'-','incentive_master_id');

end if;



if  OLD.incentive_master_survey != NEW.incentive_master_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_survey);

	set @chdCol=CONCAT(@chdCol,'-','incentive_master_survey');

end if;



if  OLD.incentive_master_part_id != NEW.incentive_master_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_part_id);

	set @chdCol=CONCAT(@chdCol,'-','incentive_master_part_id');

end if;



if  OLD.incentive_master_q1 != NEW.incentive_master_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_q1);

	set @chdCol=CONCAT(@chdCol,'-','incentive_master_q1');

end if;



if  OLD.incentive_master_q2 != NEW.incentive_master_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_q2);

	set @chdCol=CONCAT(@chdCol,'-','incentive_master_q2');

end if;



if  OLD.incentive_master_q3 != NEW.incentive_master_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_q3);

	set @chdCol=CONCAT(@chdCol,'-','incentive_master_q3');

end if;



if  OLD.incentive_master_q4 != NEW.incentive_master_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.incentive_master_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.incentive_master_q4);

	set @chdCol=CONCAT(@chdCol,'-','incentive_master_q4');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_incentivesmaster(incentive_master_survey,incentive_master_part_id,incentive_master_q1,incentive_master_q2,incentive_master_q3,incentive_master_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.incentive_master_survey,NEW.incentive_master_part_id,NEW.incentive_master_q1,NEW.incentive_master_q2,NEW.incentive_master_q3,NEW.incentive_master_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_incentivesmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_labdeptmaster`
--

DROP TABLE IF EXISTS `cms_labdeptmaster`;
CREATE TABLE IF NOT EXISTS `cms_labdeptmaster` (
  `lab_dept_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Lab Department ID',
  `lab_dept_code` text NOT NULL COMMENT 'Lab Department Code',
  `lab_dept_name` text NOT NULL COMMENT 'Lab Department Name',
  `status` varchar(1) DEFAULT NULL COMMENT 'Status',
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`lab_dept_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;

--
-- Dumping data for table `cms_labdeptmaster`
--

INSERT INTO `cms_labdeptmaster` (`lab_dept_id`, `lab_dept_code`, `lab_dept_name`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(1, 'ICC1', 'HIV1&2', '1', 1487593093, 1, 1487593093, NULL, 1487593093),
(2, 'ICC2', 'HCV', '1', 1487593108, 1, 1487593108, NULL, 1487593108),
(3, 'ICC3', 'TB', '1', 1487593127, 1, 1489723899, 1, 1487593127),
(4, 'ICC4', 'Syphilis', '1', 1487593146, 1, 1496554636, 1, 1487593146),
(5, 'ICC5', 'CD4Count', '1', 1487593167, 1, 1487593167, NULL, 1487593167),
(6, 'ICC6', 'HIV Viral Load', '1', 1487593193, 1, 1487593193, NULL, 1487593193),
(7, 'ICC7', 'HCV Viral Load', '1', 1487593205, 1, 1487593205, NULL, 1487593205),
(8, 'ICC8', 'Blood Sugar', '1', 1487593216, 1, 1487593216, NULL, 1487593216),
(9, 'ICC9', 'Lab Repository', '1', 1493983831, 1, 1493983853, 1, 1493922600);

--
-- Triggers `cms_labdeptmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_labdeptmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_labdeptmaster_DELETE` BEFORE DELETE ON `cms_labdeptmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.lab_dept_id;

set @userid=OLD.update_user;



if  OLD.lab_dept_id !="" OR OLD.lab_dept_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_dept_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_dept_id');

end if;



if  OLD.lab_dept_code !="" OR OLD.lab_dept_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_dept_code);



	set @chdCol=CONCAT(@chdCol,'-','lab_dept_code');

end if;



if  OLD.lab_dept_name !="" OR OLD.lab_dept_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_dept_name);



	set @chdCol=CONCAT(@chdCol,'-','lab_dept_name');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_labdeptmaster(lab_dept_code,lab_dept_name,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.lab_dept_code,OLD.lab_dept_name,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labdeptmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_labdeptmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_labdeptmaster_INSERT` AFTER INSERT ON `cms_labdeptmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_dept_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.lab_dept_id);

set @chdCol=CONCAT(@chdCol,'-','lab_dept_id');

set @newVal =CONCAT(@newVal,'-', NEW.lab_dept_code);

set @chdCol=CONCAT(@chdCol,'-','lab_dept_code');

set @newVal =CONCAT(@newVal,'-', NEW.lab_dept_name);

set @chdCol=CONCAT(@chdCol,'-','lab_dept_name');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_labdeptmaster(lab_dept_code,lab_dept_name,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_dept_code,NEW.lab_dept_name,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labdeptmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_labdeptmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_labdeptmaster_UPDATE` BEFORE UPDATE ON `cms_labdeptmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_dept_id;

set @userid=NEW.update_user;



if  OLD.lab_dept_id != NEW.lab_dept_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_dept_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_dept_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_dept_id');

end if;



if  OLD.lab_dept_code != NEW.lab_dept_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_dept_code);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_dept_code);

	set @chdCol=CONCAT(@chdCol,'-','lab_dept_code');

end if;



if  OLD.lab_dept_name != NEW.lab_dept_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_dept_name);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_dept_name);

	set @chdCol=CONCAT(@chdCol,'-','lab_dept_name');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_labdeptmaster(lab_dept_code,lab_dept_name,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_dept_code,NEW.lab_dept_name,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labdeptmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_labmaster`
--

DROP TABLE IF EXISTS `cms_labmaster`;
CREATE TABLE IF NOT EXISTS `cms_labmaster` (
  `lab_id` int(11) NOT NULL AUTO_INCREMENT,
  `lab_dept_code` varchar(11) NOT NULL COMMENT 'Lab Department',
  `lab_test_code` text NOT NULL COMMENT 'Test Code',
  `lab_test_name` text NOT NULL COMMENT 'Test Name',
  `lab_spot_test` char(1) NOT NULL COMMENT 'Spot Test',
  `status` varchar(1) DEFAULT NULL,
  `del_status` int(11) NOT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`lab_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

--
-- Dumping data for table `cms_labmaster`
--

INSERT INTO `cms_labmaster` (`lab_id`, `lab_dept_code`, `lab_test_code`, `lab_test_name`, `lab_spot_test`, `status`, `del_status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(1, 'ICC1', '1', 'HIV-1 Antibody', '1', '1', 0, 1487593568, 1, 1487593568, NULL, 1487593568),
(2, 'ICC1', '2', 'HIV-2 Antibody', '1', '1', 0, 1487593586, 1, 1487593586, NULL, 1487593586),
(3, 'ICC2', '3', 'HCV Antibody', '1', '1', 0, 1487593610, 1, 1487593610, NULL, 1487593610),
(4, 'ICC3', '4', 'Sputum Result - TB', '1', '1', 0, 1487593636, 1, 1495751014, 1, 1487593636),
(5, 'ICC4', '5', 'Syphilis', '1', '1', 0, 1487593832, 1, 1496554457, 1, 1487593832),
(6, 'ICC5', '6', 'CD4 Cell Count', '0', '1', 0, 1487593653, 1, 1487593653, NULL, 1487593653),
(7, 'ICC6', '7', 'HIV Viral Load', '0', '1', 0, 1487593671, 1, 1487593671, NULL, 1487593671),
(8, 'ICC7', '8', 'HCV Viral Load', '0', '1', 0, 1487593685, 1, 1487593685, NULL, 1487593685),
(9, 'ICC8', '9', 'Blood Sugar/Glucose', '0', '1', 0, 1487593703, 1, 1493090878, 1, 1487593703),
(10, 'ICC9', '10', 'Specimen Banking', '0', '1', 0, 1493983995, 1, 1493984447, 1, 1493922600);

--
-- Triggers `cms_labmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_labmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_labmaster_DELETE` BEFORE DELETE ON `cms_labmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.lab_id;

set @userid=OLD.update_user;



if  OLD.lab_id !="" OR OLD.lab_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_id');

end if;



if  OLD.lab_dept_code !="" OR OLD.lab_dept_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_dept_code);



	set @chdCol=CONCAT(@chdCol,'-','lab_dept_code');

end if;



if  OLD.lab_test_code !="" OR OLD.lab_test_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_test_code);



	set @chdCol=CONCAT(@chdCol,'-','lab_test_code');

end if;



if  OLD.lab_test_name !="" OR OLD.lab_test_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_test_name);



	set @chdCol=CONCAT(@chdCol,'-','lab_test_name');

end if;



if  OLD.lab_spot_test !="" OR OLD.lab_spot_test is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_spot_test);



	set @chdCol=CONCAT(@chdCol,'-','lab_spot_test');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.del_status !="" OR OLD.del_status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.del_status);



	set @chdCol=CONCAT(@chdCol,'-','del_status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_labmaster(lab_dept_code,lab_test_code,lab_test_name,lab_spot_test,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.lab_dept_code,OLD.lab_test_code,OLD.lab_test_name,OLD.lab_spot_test,OLD.status,OLD.del_status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_labmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_labmaster_INSERT` AFTER INSERT ON `cms_labmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.lab_id);

set @chdCol=CONCAT(@chdCol,'-','lab_id');

set @newVal =CONCAT(@newVal,'-', NEW.lab_dept_code);

set @chdCol=CONCAT(@chdCol,'-','lab_dept_code');

set @newVal =CONCAT(@newVal,'-', NEW.lab_test_code);

set @chdCol=CONCAT(@chdCol,'-','lab_test_code');

set @newVal =CONCAT(@newVal,'-', NEW.lab_test_name);

set @chdCol=CONCAT(@chdCol,'-','lab_test_name');

set @newVal =CONCAT(@newVal,'-', NEW.lab_spot_test);

set @chdCol=CONCAT(@chdCol,'-','lab_spot_test');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.del_status);

set @chdCol=CONCAT(@chdCol,'-','del_status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_labmaster(lab_dept_code,lab_test_code,lab_test_name,lab_spot_test,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_dept_code,NEW.lab_test_code,NEW.lab_test_name,NEW.lab_spot_test,NEW.status,NEW.del_status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_labmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_labmaster_UPDATE` BEFORE UPDATE ON `cms_labmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_id;

set @userid=NEW.update_user;



if  OLD.lab_id != NEW.lab_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_id');

end if;



if  OLD.lab_dept_code != NEW.lab_dept_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_dept_code);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_dept_code);

	set @chdCol=CONCAT(@chdCol,'-','lab_dept_code');

end if;



if  OLD.lab_test_code != NEW.lab_test_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_test_code);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_test_code);

	set @chdCol=CONCAT(@chdCol,'-','lab_test_code');

end if;



if  OLD.lab_test_name != NEW.lab_test_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_test_name);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_test_name);

	set @chdCol=CONCAT(@chdCol,'-','lab_test_name');

end if;



if  OLD.lab_spot_test != NEW.lab_spot_test

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_spot_test);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_spot_test);

	set @chdCol=CONCAT(@chdCol,'-','lab_spot_test');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.del_status != NEW.del_status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.del_status);

	set @newVal =CONCAT(@newVal,'-', NEW.del_status);

	set @chdCol=CONCAT(@chdCol,'-','del_status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_labmaster(lab_dept_code,lab_test_code,lab_test_name,lab_spot_test,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_dept_code,NEW.lab_test_code,NEW.lab_test_name,NEW.lab_spot_test,NEW.status,NEW.del_status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_labref`
--

DROP TABLE IF EXISTS `cms_labref`;
CREATE TABLE IF NOT EXISTS `cms_labref` (
  `lab_ref_id` int(11) NOT NULL AUTO_INCREMENT,
  `lab_ref_loc` varchar(11) NOT NULL,
  `lab_ref_code` varchar(200) NOT NULL DEFAULT '',
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`lab_ref_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_labresultmapping`
--

DROP TABLE IF EXISTS `cms_labresultmapping`;
CREATE TABLE IF NOT EXISTS `cms_labresultmapping` (
  `lab_result_mapng_id` int(11) NOT NULL AUTO_INCREMENT,
  `lab_result_mapng_test` varchar(11) NOT NULL COMMENT 'Test Code',
  `lab_result_mapng_result` varchar(11) NOT NULL COMMENT 'Lab Result',
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`lab_result_mapng_id`),
  UNIQUE KEY `lab_result_mapng_sur` (`lab_result_mapng_test`,`lab_result_mapng_result`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ;

--
-- Dumping data for table `cms_labresultmapping`
--

INSERT INTO `cms_labresultmapping` (`lab_result_mapng_id`, `lab_result_mapng_test`, `lab_result_mapng_result`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(1, '1', '1', '1', 1493090665, 1, 1493090665, NULL, 1493058600),
(2, '1', '0', '1', 1493090665, 1, 1493090665, NULL, 1493058600),
(3, '1', '2', '1', 1493090665, 1, 1493090665, NULL, 1493058600),
(4, '2', '1', '1', 1493090680, 1, 1493090680, NULL, 1493058600),
(5, '2', '0', '1', 1493090680, 1, 1493090680, NULL, 1493058600),
(6, '2', '2', '1', 1493090680, 1, 1493090680, NULL, 1493058600),
(7, '3', '1', '1', 1493090709, 1, 1494399798, 1, 1493058600),
(9, '3', '0', '1', 1493090709, 1, 1494399798, 1, 1493058600),
(10, '3', '2', '1', 1494296557, NULL, 1494399798, 1, 1494268200),
(11, '4', '1', '1', 1495751064, 1, 1495751255, 1, 1495737000),
(12, '4', '0', '1', 1495751064, 1, 1495751255, 1, 1495737000),
(13, '4', '12', '1', 1495751255, NULL, 1495751255, 1, 1495737000),
(14, '4', '98', '1', 1495751255, NULL, 1495751255, 1, 1495737000),
(15, '4', '97', '1', 1495751255, NULL, 1495751255, 1, 1495737000),
(16, '5', '10', '1', 1495751278, 1, 1495751278, NULL, 1495737000),
(17, '5', '11', '1', 1495751278, 1, 1495751278, NULL, 1495737000),
(18, '5', '12', '1', 1495751278, 1, 1495751278, NULL, 1495737000),
(19, '5', '96', '1', 1495751278, 1, 1495751278, NULL, 1495737000);

--
-- Triggers `cms_labresultmapping`
--
DROP TRIGGER IF EXISTS `trig_cms_labresultmapping_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_labresultmapping_DELETE` BEFORE DELETE ON `cms_labresultmapping`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.lab_result_mapng_id;

set @userid=OLD.update_user;



if  OLD.lab_result_mapng_id !="" OR OLD.lab_result_mapng_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_result_mapng_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_result_mapng_id');

end if;



if  OLD.lab_result_mapng_test !="" OR OLD.lab_result_mapng_test is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_result_mapng_test);



	set @chdCol=CONCAT(@chdCol,'-','lab_result_mapng_test');

end if;



if  OLD.lab_result_mapng_result !="" OR OLD.lab_result_mapng_result is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_result_mapng_result);



	set @chdCol=CONCAT(@chdCol,'-','lab_result_mapng_result');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_labresultmapping(lab_result_mapng_test,lab_result_mapng_result,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.lab_result_mapng_test,OLD.lab_result_mapng_result,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labresultmapping', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_labresultmapping_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_labresultmapping_INSERT` AFTER INSERT ON `cms_labresultmapping`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_result_mapng_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.lab_result_mapng_id);

set @chdCol=CONCAT(@chdCol,'-','lab_result_mapng_id');

set @newVal =CONCAT(@newVal,'-', NEW.lab_result_mapng_test);

set @chdCol=CONCAT(@chdCol,'-','lab_result_mapng_test');

set @newVal =CONCAT(@newVal,'-', NEW.lab_result_mapng_result);

set @chdCol=CONCAT(@chdCol,'-','lab_result_mapng_result');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_labresultmapping(lab_result_mapng_test,lab_result_mapng_result,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_result_mapng_test,NEW.lab_result_mapng_result,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labresultmapping', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_labresultmapping_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_labresultmapping_UPDATE` BEFORE UPDATE ON `cms_labresultmapping`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_result_mapng_id;

set @userid=NEW.update_user;



if  OLD.lab_result_mapng_id != NEW.lab_result_mapng_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_result_mapng_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_result_mapng_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_result_mapng_id');

end if;



if  OLD.lab_result_mapng_test != NEW.lab_result_mapng_test

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_result_mapng_test);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_result_mapng_test);

	set @chdCol=CONCAT(@chdCol,'-','lab_result_mapng_test');

end if;



if  OLD.lab_result_mapng_result != NEW.lab_result_mapng_result

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_result_mapng_result);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_result_mapng_result);

	set @chdCol=CONCAT(@chdCol,'-','lab_result_mapng_result');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_labresultmapping(lab_result_mapng_test,lab_result_mapng_result,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_result_mapng_test,NEW.lab_result_mapng_result,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labresultmapping', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_labresultsmaster`
--

DROP TABLE IF EXISTS `cms_labresultsmaster`;
CREATE TABLE IF NOT EXISTS `cms_labresultsmaster` (
  `lab_result_id` int(11) NOT NULL AUTO_INCREMENT,
  `lab_result_code` text NOT NULL COMMENT 'Test Result Code',
  `lab_result_name` text NOT NULL COMMENT 'Test Result Name',
  `status` varchar(1) DEFAULT NULL,
  `del_status` int(11) NOT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`lab_result_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

--
-- Dumping data for table `cms_labresultsmaster`
--

INSERT INTO `cms_labresultsmaster` (`lab_result_id`, `lab_result_code`, `lab_result_name`, `status`, `del_status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(1, '1', 'Positive', '1', 0, 1482086606, 1, 1482086723, 1, 1482086606),
(2, '0', 'Negative', '1', 0, 1482176515, 1, 1482176515, NULL, 1482176515),
(3, '2', 'Indeterminate', '1', 0, 1482176684, 1, 1488267608, 1, 1482176684),
(4, '10', 'Non-Reactive', '1', 0, 1488267654, 1, 1488267654, NULL, 1488267654),
(5, '11', 'Reactive', '1', 0, 1488267664, 1, 1488267664, NULL, 1488267664),
(6, '12', 'Equivocal', '1', 0, 1488267682, 1, 1495751133, 1, 1488267682),
(7, '99', 'Specimen Banking', '1', 0, 1493983897, 1, 1493983897, NULL, 1493922600),
(8, '98', 'Unable to Provide Sputum', '1', 0, 1495751167, 1, 1495751167, NULL, 1495737000),
(9, '97', 'Did not go to RNTCP', '1', 0, 1495751193, 1, 1495751193, NULL, 1495737000),
(10, '96', 'Did not go to STI Lab', '1', 0, 1495751210, 1, 1495751210, NULL, 1495737000);

--
-- Triggers `cms_labresultsmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_labresultsmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_labresultsmaster_DELETE` BEFORE DELETE ON `cms_labresultsmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.lab_result_id;

set @userid=OLD.update_user;



if  OLD.lab_result_id !="" OR OLD.lab_result_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_result_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_result_id');

end if;



if  OLD.lab_result_code !="" OR OLD.lab_result_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_result_code);



	set @chdCol=CONCAT(@chdCol,'-','lab_result_code');

end if;



if  OLD.lab_result_name !="" OR OLD.lab_result_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_result_name);



	set @chdCol=CONCAT(@chdCol,'-','lab_result_name');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.del_status !="" OR OLD.del_status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.del_status);



	set @chdCol=CONCAT(@chdCol,'-','del_status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_labresultsmaster(lab_result_code,lab_result_name,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.lab_result_code,OLD.lab_result_name,OLD.status,OLD.del_status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labresultsmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_labresultsmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_labresultsmaster_INSERT` AFTER INSERT ON `cms_labresultsmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_result_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.lab_result_id);

set @chdCol=CONCAT(@chdCol,'-','lab_result_id');

set @newVal =CONCAT(@newVal,'-', NEW.lab_result_code);

set @chdCol=CONCAT(@chdCol,'-','lab_result_code');

set @newVal =CONCAT(@newVal,'-', NEW.lab_result_name);

set @chdCol=CONCAT(@chdCol,'-','lab_result_name');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.del_status);

set @chdCol=CONCAT(@chdCol,'-','del_status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_labresultsmaster(lab_result_code,lab_result_name,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_result_code,NEW.lab_result_name,NEW.status,NEW.del_status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labresultsmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_labresultsmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_labresultsmaster_UPDATE` BEFORE UPDATE ON `cms_labresultsmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_result_id;

set @userid=NEW.update_user;



if  OLD.lab_result_id != NEW.lab_result_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_result_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_result_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_result_id');

end if;



if  OLD.lab_result_code != NEW.lab_result_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_result_code);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_result_code);

	set @chdCol=CONCAT(@chdCol,'-','lab_result_code');

end if;



if  OLD.lab_result_name != NEW.lab_result_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_result_name);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_result_name);

	set @chdCol=CONCAT(@chdCol,'-','lab_result_name');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.del_status != NEW.del_status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.del_status);

	set @newVal =CONCAT(@newVal,'-', NEW.del_status);

	set @chdCol=CONCAT(@chdCol,'-','del_status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_labresultsmaster(lab_result_code,lab_result_name,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_result_code,NEW.lab_result_name,NEW.status,NEW.del_status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labresultsmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_labsamplerequest`
--

DROP TABLE IF EXISTS `cms_labsamplerequest`;
CREATE TABLE IF NOT EXISTS `cms_labsamplerequest` (
  `lab_smple_id` int(11) NOT NULL AUTO_INCREMENT,
  `lab_smple_sur_id` varchar(11) NOT NULL,
  `lab_smple_loc` varchar(11) NOT NULL,
  `lab_smple_part_id` varchar(11) NOT NULL,
  `lab_smple_acc_no` varchar(50) NOT NULL,
  `lab_smple_tst_id` varchar(11) NOT NULL,
  `lab_smple_spcmn_id` varchar(11) NOT NULL,
  `lab_smple_spcmn_clctd` int(11) NOT NULL,
  `lab_smple_date` int(11) DEFAULT NULL,
  `lab_smple_result` varchar(30) DEFAULT NULL,
  `lab_smple_resultdate` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) NOT NULL,
  PRIMARY KEY (`lab_smple_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_labsamplerequest`
--
DROP TRIGGER IF EXISTS `trig_cms_labsamplerequest_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_labsamplerequest_DELETE` BEFORE DELETE ON `cms_labsamplerequest`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.lab_smple_id;

set @userid=OLD.update_user;



if  OLD.lab_smple_id !="" OR OLD.lab_smple_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_smple_id');

end if;



if  OLD.lab_smple_sur_id !="" OR OLD.lab_smple_sur_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_sur_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_smple_sur_id');

end if;



if  OLD.lab_smple_loc !="" OR OLD.lab_smple_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_loc);



	set @chdCol=CONCAT(@chdCol,'-','lab_smple_loc');

end if;



if  OLD.lab_smple_part_id !="" OR OLD.lab_smple_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_part_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_smple_part_id');

end if;



if  OLD.lab_smple_acc_no !="" OR OLD.lab_smple_acc_no is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_acc_no);



	set @chdCol=CONCAT(@chdCol,'-','lab_smple_acc_no');

end if;



if  OLD.lab_smple_tst_id !="" OR OLD.lab_smple_tst_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_tst_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_smple_tst_id');

end if;



if  OLD.lab_smple_spcmn_id !="" OR OLD.lab_smple_spcmn_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_spcmn_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_smple_spcmn_id');

end if;



if  OLD.lab_smple_spcmn_clctd !="" OR OLD.lab_smple_spcmn_clctd is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_spcmn_clctd);



	set @chdCol=CONCAT(@chdCol,'-','lab_smple_spcmn_clctd');

end if;



if  OLD.lab_smple_date !="" OR OLD.lab_smple_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_date);



	set @chdCol=CONCAT(@chdCol,'-','lab_smple_date');

end if;



if  OLD.lab_smple_result !="" OR OLD.lab_smple_result is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_result);



	set @chdCol=CONCAT(@chdCol,'-','lab_smple_result');

end if;



if  OLD.lab_smple_resultdate !="" OR OLD.lab_smple_resultdate is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_resultdate);



	set @chdCol=CONCAT(@chdCol,'-','lab_smple_resultdate');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_labsamplerequest(lab_smple_sur_id,lab_smple_loc,lab_smple_part_id,lab_smple_acc_no,lab_smple_tst_id,lab_smple_spcmn_id,lab_smple_spcmn_clctd,lab_smple_date,lab_smple_result,lab_smple_resultdate,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.lab_smple_sur_id,OLD.lab_smple_loc,OLD.lab_smple_part_id,OLD.lab_smple_acc_no,OLD.lab_smple_tst_id,OLD.lab_smple_spcmn_id,OLD.lab_smple_spcmn_clctd,OLD.lab_smple_date,OLD.lab_smple_result,OLD.lab_smple_resultdate,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labsamplerequest', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_labsamplerequest_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_labsamplerequest_INSERT` AFTER INSERT ON `cms_labsamplerequest`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_smple_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_id);

set @chdCol=CONCAT(@chdCol,'-','lab_smple_id');

set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_sur_id);

set @chdCol=CONCAT(@chdCol,'-','lab_smple_sur_id');

set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_loc);

set @chdCol=CONCAT(@chdCol,'-','lab_smple_loc');

set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_part_id);

set @chdCol=CONCAT(@chdCol,'-','lab_smple_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_acc_no);

set @chdCol=CONCAT(@chdCol,'-','lab_smple_acc_no');

set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_tst_id);

set @chdCol=CONCAT(@chdCol,'-','lab_smple_tst_id');

set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_spcmn_id);

set @chdCol=CONCAT(@chdCol,'-','lab_smple_spcmn_id');

set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_spcmn_clctd);

set @chdCol=CONCAT(@chdCol,'-','lab_smple_spcmn_clctd');

set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_date);

set @chdCol=CONCAT(@chdCol,'-','lab_smple_date');

set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_result);

set @chdCol=CONCAT(@chdCol,'-','lab_smple_result');

set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_resultdate);

set @chdCol=CONCAT(@chdCol,'-','lab_smple_resultdate');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_labsamplerequest(lab_smple_sur_id,lab_smple_loc,lab_smple_part_id,lab_smple_acc_no,lab_smple_tst_id,lab_smple_spcmn_id,lab_smple_spcmn_clctd,lab_smple_date,lab_smple_result,lab_smple_resultdate,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_smple_sur_id,NEW.lab_smple_loc,NEW.lab_smple_part_id,NEW.lab_smple_acc_no,NEW.lab_smple_tst_id,NEW.lab_smple_spcmn_id,NEW.lab_smple_spcmn_clctd,NEW.lab_smple_date,NEW.lab_smple_result,NEW.lab_smple_resultdate,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labsamplerequest', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_labsamplerequest_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_labsamplerequest_UPDATE` BEFORE UPDATE ON `cms_labsamplerequest`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_smple_id;

set @userid=NEW.update_user;



if  OLD.lab_smple_id != NEW.lab_smple_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_smple_id');

end if;



if  OLD.lab_smple_sur_id != NEW.lab_smple_sur_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_sur_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_sur_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_smple_sur_id');

end if;



if  OLD.lab_smple_loc != NEW.lab_smple_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_loc);

	set @chdCol=CONCAT(@chdCol,'-','lab_smple_loc');

end if;



if  OLD.lab_smple_part_id != NEW.lab_smple_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_part_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_smple_part_id');

end if;



if  OLD.lab_smple_acc_no != NEW.lab_smple_acc_no

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_acc_no);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_acc_no);

	set @chdCol=CONCAT(@chdCol,'-','lab_smple_acc_no');

end if;



if  OLD.lab_smple_tst_id != NEW.lab_smple_tst_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_tst_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_tst_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_smple_tst_id');

end if;



if  OLD.lab_smple_spcmn_id != NEW.lab_smple_spcmn_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_spcmn_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_spcmn_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_smple_spcmn_id');

end if;



if  OLD.lab_smple_spcmn_clctd != NEW.lab_smple_spcmn_clctd

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_spcmn_clctd);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_spcmn_clctd);

	set @chdCol=CONCAT(@chdCol,'-','lab_smple_spcmn_clctd');

end if;



if  OLD.lab_smple_date != NEW.lab_smple_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_date);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_date);

	set @chdCol=CONCAT(@chdCol,'-','lab_smple_date');

end if;



if  OLD.lab_smple_result != NEW.lab_smple_result

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_result);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_result);

	set @chdCol=CONCAT(@chdCol,'-','lab_smple_result');

end if;



if  OLD.lab_smple_resultdate != NEW.lab_smple_resultdate

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_smple_resultdate);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_smple_resultdate);

	set @chdCol=CONCAT(@chdCol,'-','lab_smple_resultdate');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_labsamplerequest(lab_smple_sur_id,lab_smple_loc,lab_smple_part_id,lab_smple_acc_no,lab_smple_tst_id,lab_smple_spcmn_id,lab_smple_spcmn_clctd,lab_smple_date,lab_smple_result,lab_smple_resultdate,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_smple_sur_id,NEW.lab_smple_loc,NEW.lab_smple_part_id,NEW.lab_smple_acc_no,NEW.lab_smple_tst_id,NEW.lab_smple_spcmn_id,NEW.lab_smple_spcmn_clctd,NEW.lab_smple_date,NEW.lab_smple_result,NEW.lab_smple_resultdate,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labsamplerequest', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_labtestmapping`
--

DROP TABLE IF EXISTS `cms_labtestmapping`;
CREATE TABLE IF NOT EXISTS `cms_labtestmapping` (
  `lab_mapng_id` int(11) NOT NULL AUTO_INCREMENT,
  `lab_mapng_sur_id` varchar(11) NOT NULL COMMENT 'Survey',
  `lab_mapng_testmstr_id` varchar(11) NOT NULL COMMENT 'Test Name',
  `lab_mapng_spcmn_id` varchar(11) NOT NULL COMMENT 'Specimen',
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`lab_mapng_id`),
  UNIQUE KEY `lab_mapng_sur_id` (`lab_mapng_sur_id`,`lab_mapng_testmstr_id`,`lab_mapng_spcmn_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

--
-- Dumping data for table `cms_labtestmapping`
--

INSERT INTO `cms_labtestmapping` (`lab_mapng_id`, `lab_mapng_sur_id`, `lab_mapng_testmstr_id`, `lab_mapng_spcmn_id`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(1, 'ICC+', '1', 'BLD', '1', 1487594100, 1, 1496885430, 1, 1487594100),
(2, 'ICC+', '2', 'BLD', '1', 1487594100, 1, 1496885430, 1, 1487594100),
(3, 'ICC+', '3', 'BLD', '1', 1487594100, 1, 1496885430, 1, 1487594100),
(4, 'ICC+', '5', 'BLD', '1', 1487594100, 1, 1496885430, 1, 1487594100),
(5, 'ICC+', '4', 'SPU', '1', 1487594100, 1, 1496885430, 1, 1487594100),
(6, 'ICC+', '6', 'BLD', '1', 1487594100, 1, 1496885430, 1, 1487594100),
(7, 'ICC+', '7', 'PLA', '1', 1487594100, 1, 1496885430, 1, 1487594100),
(8, 'ICC+', '8', 'PLA', '1', 1487594100, 1, 1496885430, 1, 1487594100),
(9, 'ICC+', '9', 'BLD', '1', 1487594100, 1, 1496885430, 1, 1487594100),
(10, 'ICC+', '10', 'BLD', '1', 1491387952, 1, 1496885430, 1, 1491330600);

--
-- Triggers `cms_labtestmapping`
--
DROP TRIGGER IF EXISTS `trig_cms_labtestmapping_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_labtestmapping_DELETE` BEFORE DELETE ON `cms_labtestmapping`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.lab_mapng_id;

set @userid=OLD.update_user;



if  OLD.lab_mapng_id !="" OR OLD.lab_mapng_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_mapng_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_mapng_id');

end if;



if  OLD.lab_mapng_sur_id !="" OR OLD.lab_mapng_sur_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_mapng_sur_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_mapng_sur_id');

end if;



if  OLD.lab_mapng_testmstr_id !="" OR OLD.lab_mapng_testmstr_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_mapng_testmstr_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_mapng_testmstr_id');

end if;



if  OLD.lab_mapng_spcmn_id !="" OR OLD.lab_mapng_spcmn_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_mapng_spcmn_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_mapng_spcmn_id');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_labtestmapping(lab_mapng_sur_id,lab_mapng_testmstr_id,lab_mapng_spcmn_id,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.lab_mapng_sur_id,OLD.lab_mapng_testmstr_id,OLD.lab_mapng_spcmn_id,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labtestmapping', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_labtestmapping_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_labtestmapping_INSERT` AFTER INSERT ON `cms_labtestmapping`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_mapng_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.lab_mapng_id);

set @chdCol=CONCAT(@chdCol,'-','lab_mapng_id');

set @newVal =CONCAT(@newVal,'-', NEW.lab_mapng_sur_id);

set @chdCol=CONCAT(@chdCol,'-','lab_mapng_sur_id');

set @newVal =CONCAT(@newVal,'-', NEW.lab_mapng_testmstr_id);

set @chdCol=CONCAT(@chdCol,'-','lab_mapng_testmstr_id');

set @newVal =CONCAT(@newVal,'-', NEW.lab_mapng_spcmn_id);

set @chdCol=CONCAT(@chdCol,'-','lab_mapng_spcmn_id');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_labtestmapping(lab_mapng_sur_id,lab_mapng_testmstr_id,lab_mapng_spcmn_id,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_mapng_sur_id,NEW.lab_mapng_testmstr_id,NEW.lab_mapng_spcmn_id,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labtestmapping', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_labtestmapping_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_labtestmapping_UPDATE` BEFORE UPDATE ON `cms_labtestmapping`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_mapng_id;

set @userid=NEW.update_user;



if  OLD.lab_mapng_id != NEW.lab_mapng_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_mapng_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_mapng_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_mapng_id');

end if;



if  OLD.lab_mapng_sur_id != NEW.lab_mapng_sur_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_mapng_sur_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_mapng_sur_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_mapng_sur_id');

end if;



if  OLD.lab_mapng_testmstr_id != NEW.lab_mapng_testmstr_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_mapng_testmstr_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_mapng_testmstr_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_mapng_testmstr_id');

end if;



if  OLD.lab_mapng_spcmn_id != NEW.lab_mapng_spcmn_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_mapng_spcmn_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_mapng_spcmn_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_mapng_spcmn_id');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_labtestmapping(lab_mapng_sur_id,lab_mapng_testmstr_id,lab_mapng_spcmn_id,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_mapng_sur_id,NEW.lab_mapng_testmstr_id,NEW.lab_mapng_spcmn_id,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_labtestmapping', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_linkidlinkage`
--

DROP TABLE IF EXISTS `cms_linkidlinkage`;
CREATE TABLE IF NOT EXISTS `cms_linkidlinkage` (
  `link_idlinkage_id` int(11) NOT NULL AUTO_INCREMENT,
  `link_idlinkage_survey` varchar(11) NOT NULL,
  `link_idlinkage_loc` varchar(11) NOT NULL,
  `link_idlinkage_part_id` varchar(11) NOT NULL,
  `link_idlinkage_q1` varchar(25) DEFAULT NULL,
  `link_idlinkage_q2` varchar(25) DEFAULT NULL,
  `link_idlinkage_q3` varchar(25) DEFAULT NULL,
  `link_idlinkage_q4` varchar(25) DEFAULT NULL,
  `link_idlinkage_q5` varchar(25) DEFAULT NULL,
  `link_idlinkage_q6` varchar(25) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`link_idlinkage_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_linkidlinkage`
--
DROP TRIGGER IF EXISTS `trig_cms_linkidlinkage_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_linkidlinkage_DELETE` BEFORE DELETE ON `cms_linkidlinkage`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.link_idlinkage_id;

set @userid=OLD.update_user;



if  OLD.link_idlinkage_id !="" OR OLD.link_idlinkage_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_id);



	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_id');

end if;



if  OLD.link_idlinkage_survey !="" OR OLD.link_idlinkage_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_survey);



	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_survey');

end if;



if  OLD.link_idlinkage_loc !="" OR OLD.link_idlinkage_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_loc);



	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_loc');

end if;



if  OLD.link_idlinkage_part_id !="" OR OLD.link_idlinkage_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_part_id);



	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_part_id');

end if;



if  OLD.link_idlinkage_q1 !="" OR OLD.link_idlinkage_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_q1);



	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q1');

end if;



if  OLD.link_idlinkage_q2 !="" OR OLD.link_idlinkage_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_q2);



	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q2');

end if;



if  OLD.link_idlinkage_q3 !="" OR OLD.link_idlinkage_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_q3);



	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q3');

end if;



if  OLD.link_idlinkage_q4 !="" OR OLD.link_idlinkage_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_q4);



	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q4');

end if;



if  OLD.link_idlinkage_q5 !="" OR OLD.link_idlinkage_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_q5);



	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q5');

end if;



if  OLD.link_idlinkage_q6 !="" OR OLD.link_idlinkage_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_q6);



	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q6');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_linkidlinkage(link_idlinkage_survey,link_idlinkage_loc,link_idlinkage_part_id,link_idlinkage_q1,link_idlinkage_q2,link_idlinkage_q3,link_idlinkage_q4,link_idlinkage_q5,link_idlinkage_q6,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.link_idlinkage_survey,OLD.link_idlinkage_loc,OLD.link_idlinkage_part_id,OLD.link_idlinkage_q1,OLD.link_idlinkage_q2,OLD.link_idlinkage_q3,OLD.link_idlinkage_q4,OLD.link_idlinkage_q5,OLD.link_idlinkage_q6,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_linkidlinkage', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_linkidlinkage_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_linkidlinkage_INSERT` AFTER INSERT ON `cms_linkidlinkage`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.link_idlinkage_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_id);

set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_id');

set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_survey);

set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_survey');

set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_loc);

set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_loc');

set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_part_id);

set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_q1);

set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q1');

set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_q2);

set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q2');

set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_q3);

set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q3');

set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_q4);

set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q4');

set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_q5);

set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q5');

set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_q6);

set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q6');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_linkidlinkage(link_idlinkage_survey,link_idlinkage_loc,link_idlinkage_part_id,link_idlinkage_q1,link_idlinkage_q2,link_idlinkage_q3,link_idlinkage_q4,link_idlinkage_q5,link_idlinkage_q6,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.link_idlinkage_survey,NEW.link_idlinkage_loc,NEW.link_idlinkage_part_id,NEW.link_idlinkage_q1,NEW.link_idlinkage_q2,NEW.link_idlinkage_q3,NEW.link_idlinkage_q4,NEW.link_idlinkage_q5,NEW.link_idlinkage_q6,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_linkidlinkage', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_linkidlinkage_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_linkidlinkage_UPDATE` BEFORE UPDATE ON `cms_linkidlinkage`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.link_idlinkage_id;

set @userid=NEW.update_user;



if  OLD.link_idlinkage_id != NEW.link_idlinkage_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_id);

	set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_id);

	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_id');

end if;



if  OLD.link_idlinkage_survey != NEW.link_idlinkage_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_survey);

	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_survey');

end if;



if  OLD.link_idlinkage_loc != NEW.link_idlinkage_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_loc);

	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_loc');

end if;



if  OLD.link_idlinkage_part_id != NEW.link_idlinkage_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_part_id);

	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_part_id');

end if;



if  OLD.link_idlinkage_q1 != NEW.link_idlinkage_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_q1);

	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q1');

end if;



if  OLD.link_idlinkage_q2 != NEW.link_idlinkage_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_q2);

	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q2');

end if;



if  OLD.link_idlinkage_q3 != NEW.link_idlinkage_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_q3);

	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q3');

end if;



if  OLD.link_idlinkage_q4 != NEW.link_idlinkage_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_q4);

	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q4');

end if;



if  OLD.link_idlinkage_q5 != NEW.link_idlinkage_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_q5);

	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q5');

end if;



if  OLD.link_idlinkage_q6 != NEW.link_idlinkage_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.link_idlinkage_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.link_idlinkage_q6);

	set @chdCol=CONCAT(@chdCol,'-','link_idlinkage_q6');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_linkidlinkage(link_idlinkage_survey,link_idlinkage_loc,link_idlinkage_part_id,link_idlinkage_q1,link_idlinkage_q2,link_idlinkage_q3,link_idlinkage_q4,link_idlinkage_q5,link_idlinkage_q6,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.link_idlinkage_survey,NEW.link_idlinkage_loc,NEW.link_idlinkage_part_id,NEW.link_idlinkage_q1,NEW.link_idlinkage_q2,NEW.link_idlinkage_q3,NEW.link_idlinkage_q4,NEW.link_idlinkage_q5,NEW.link_idlinkage_q6,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_linkidlinkage', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_locationmapping`
--

DROP TABLE IF EXISTS `cms_locationmapping`;
CREATE TABLE IF NOT EXISTS `cms_locationmapping` (
  `loc_mapng_id` int(11) NOT NULL AUTO_INCREMENT,
  `loc_mapng_sur_id` varchar(11) NOT NULL COMMENT 'Survey',
  `loc_mapng_mstr_id` varchar(11) NOT NULL COMMENT 'Location',
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`loc_mapng_id`),
  UNIQUE KEY `loc_mapng_sur_id` (`loc_mapng_sur_id`,`loc_mapng_mstr_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

--
-- Dumping data for table `cms_locationmapping`
--

INSERT INTO `cms_locationmapping` (`loc_mapng_id`, `loc_mapng_sur_id`, `loc_mapng_mstr_id`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(6, 'ICC+', 'DH', '1', 1498978805, 1, 1501569479, 13, 1498933800);

--
-- Triggers `cms_locationmapping`
--
DROP TRIGGER IF EXISTS `trig_cms_locationmapping_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_locationmapping_DELETE` BEFORE DELETE ON `cms_locationmapping`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.loc_mapng_id;

set @userid=OLD.update_user;



if  OLD.loc_mapng_id !="" OR OLD.loc_mapng_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.loc_mapng_id);



	set @chdCol=CONCAT(@chdCol,'-','loc_mapng_id');

end if;



if  OLD.loc_mapng_sur_id !="" OR OLD.loc_mapng_sur_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.loc_mapng_sur_id);



	set @chdCol=CONCAT(@chdCol,'-','loc_mapng_sur_id');

end if;



if  OLD.loc_mapng_mstr_id !="" OR OLD.loc_mapng_mstr_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.loc_mapng_mstr_id);



	set @chdCol=CONCAT(@chdCol,'-','loc_mapng_mstr_id');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_locationmapping(loc_mapng_sur_id,loc_mapng_mstr_id,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.loc_mapng_sur_id,OLD.loc_mapng_mstr_id,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_locationmapping', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_locationmapping_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_locationmapping_INSERT` AFTER INSERT ON `cms_locationmapping`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.loc_mapng_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.loc_mapng_id);

set @chdCol=CONCAT(@chdCol,'-','loc_mapng_id');

set @newVal =CONCAT(@newVal,'-', NEW.loc_mapng_sur_id);

set @chdCol=CONCAT(@chdCol,'-','loc_mapng_sur_id');

set @newVal =CONCAT(@newVal,'-', NEW.loc_mapng_mstr_id);

set @chdCol=CONCAT(@chdCol,'-','loc_mapng_mstr_id');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_locationmapping(loc_mapng_sur_id,loc_mapng_mstr_id,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.loc_mapng_sur_id,NEW.loc_mapng_mstr_id,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_locationmapping', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_locationmapping_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_locationmapping_UPDATE` BEFORE UPDATE ON `cms_locationmapping`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.loc_mapng_id;

set @userid=NEW.update_user;



if  OLD.loc_mapng_id != NEW.loc_mapng_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.loc_mapng_id);

	set @newVal =CONCAT(@newVal,'-', NEW.loc_mapng_id);

	set @chdCol=CONCAT(@chdCol,'-','loc_mapng_id');

end if;



if  OLD.loc_mapng_sur_id != NEW.loc_mapng_sur_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.loc_mapng_sur_id);

	set @newVal =CONCAT(@newVal,'-', NEW.loc_mapng_sur_id);

	set @chdCol=CONCAT(@chdCol,'-','loc_mapng_sur_id');

end if;



if  OLD.loc_mapng_mstr_id != NEW.loc_mapng_mstr_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.loc_mapng_mstr_id);

	set @newVal =CONCAT(@newVal,'-', NEW.loc_mapng_mstr_id);

	set @chdCol=CONCAT(@chdCol,'-','loc_mapng_mstr_id');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_locationmapping(loc_mapng_sur_id,loc_mapng_mstr_id,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.loc_mapng_sur_id,NEW.loc_mapng_mstr_id,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_locationmapping', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_locationmaster`
--

DROP TABLE IF EXISTS `cms_locationmaster`;
CREATE TABLE IF NOT EXISTS `cms_locationmaster` (
  `loc_id` int(11) NOT NULL AUTO_INCREMENT,
  `loc_code` varchar(3) NOT NULL COMMENT 'Location Code',
  `loc_name` varchar(255) NOT NULL COMMENT 'Location Name',
  `status` varchar(1) DEFAULT NULL,
  `del_status` int(11) NOT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`loc_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=41 ;

--
-- Dumping data for table `cms_locationmaster`
--

INSERT INTO `cms_locationmaster` (`loc_id`, `loc_code`, `loc_name`, `status`, `del_status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(1, 'BI', 'BILASPUR', '1', 0, 1493358233, 1, 1493358233, NULL, 1493317800),
(40, 'DM', 'DIMAPUR', '1', 0, 1498979065, 13, 1498979065, NULL, 1498933800),
(39, 'KA', 'KANPUR', '1', 0, 1498979052, 13, 1498979052, NULL, 1498933800),
(38, 'DH', 'DELHI - IDU', '1', 0, 1498979042, 13, 1498979042, NULL, 1498933800),
(37, 'LD', 'LUDHIANA', '1', 0, 1498979030, 13, 1498979030, NULL, 1498933800),
(36, 'AM', 'AMRITSAR', '1', 0, 1498979018, 13, 1498979018, NULL, 1498933800),
(35, 'AZ', 'AIZAWL', '1', 0, 1498978629, 13, 1498978629, NULL, 1498933800);

--
-- Triggers `cms_locationmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_locationmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_locationmaster_DELETE` BEFORE DELETE ON `cms_locationmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.loc_id;

set @userid=OLD.update_user;



if  OLD.loc_id !="" OR OLD.loc_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.loc_id);



	set @chdCol=CONCAT(@chdCol,'-','loc_id');

end if;



if  OLD.loc_code !="" OR OLD.loc_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.loc_code);



	set @chdCol=CONCAT(@chdCol,'-','loc_code');

end if;



if  OLD.loc_name !="" OR OLD.loc_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.loc_name);



	set @chdCol=CONCAT(@chdCol,'-','loc_name');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.del_status !="" OR OLD.del_status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.del_status);



	set @chdCol=CONCAT(@chdCol,'-','del_status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_locationmaster(loc_code,loc_name,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.loc_code,OLD.loc_name,OLD.status,OLD.del_status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_locationmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_locationmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_locationmaster_INSERT` AFTER INSERT ON `cms_locationmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.loc_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.loc_id);

set @chdCol=CONCAT(@chdCol,'-','loc_id');

set @newVal =CONCAT(@newVal,'-', NEW.loc_code);

set @chdCol=CONCAT(@chdCol,'-','loc_code');

set @newVal =CONCAT(@newVal,'-', NEW.loc_name);

set @chdCol=CONCAT(@chdCol,'-','loc_name');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.del_status);

set @chdCol=CONCAT(@chdCol,'-','del_status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_locationmaster(loc_code,loc_name,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.loc_code,NEW.loc_name,NEW.status,NEW.del_status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_locationmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_locationmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_locationmaster_UPDATE` BEFORE UPDATE ON `cms_locationmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.loc_id;

set @userid=NEW.update_user;



if  OLD.loc_id != NEW.loc_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.loc_id);

	set @newVal =CONCAT(@newVal,'-', NEW.loc_id);

	set @chdCol=CONCAT(@chdCol,'-','loc_id');

end if;



if  OLD.loc_code != NEW.loc_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.loc_code);

	set @newVal =CONCAT(@newVal,'-', NEW.loc_code);

	set @chdCol=CONCAT(@chdCol,'-','loc_code');

end if;



if  OLD.loc_name != NEW.loc_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.loc_name);

	set @newVal =CONCAT(@newVal,'-', NEW.loc_name);

	set @chdCol=CONCAT(@chdCol,'-','loc_name');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.del_status != NEW.del_status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.del_status);

	set @newVal =CONCAT(@newVal,'-', NEW.del_status);

	set @chdCol=CONCAT(@chdCol,'-','del_status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_locationmaster(loc_code,loc_name,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.loc_code,NEW.loc_name,NEW.status,NEW.del_status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_locationmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_mainmenu`
--

DROP TABLE IF EXISTS `cms_mainmenu`;
CREATE TABLE IF NOT EXISTS `cms_mainmenu` (
  `min_mnu_id` int(11) NOT NULL AUTO_INCREMENT,
  `min_mnu_name` text NOT NULL,
  `min_mnu_desc` text NOT NULL,
  `min_mnu_preference` int(11) NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`min_mnu_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;

--
-- Dumping data for table `cms_mainmenu`
--

INSERT INTO `cms_mainmenu` (`min_mnu_id`, `min_mnu_name`, `min_mnu_desc`, `min_mnu_preference`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(1, 'master', 'Masters', 1, '1', 1487989798, 1, 1488435925, 2, 1487989798),
(2, 'lab', 'Lab Test', 3, '1', 1487989822, 1, 1489553741, 1, 1487989822),
(3, 'counselor', 'Counselor', 4, '1', 1487990033, 1, 1489553830, 1, 1487990033),
(4, 'nurse', 'Nurse', 5, '1', 1487990046, 1, 1489553802, 1, 1487990046),
(5, 'DE', 'Data Forms', 6, '1', 1489476768, 1, 1495041210, 1, 1489429800),
(6, 'cohort', 'Cohort Manager', 7, '1', 1488432411, 1, 1495041346, 1, 1488432411),
(7, 'administrator', 'Administration', 11, '1', 1487989891, 1, 1504349120, 1, 1487989891),
(9, 'coordinator', 'Site Coordinator', 2, '1', 1487990069, 1, 1489553729, 1, 1487990069),
(13, 'reports', 'Reports', 9, '1', 1489553859, 1, 1496634166, 1, 1489516200),
(14, 'ost', 'OST Service', 8, '1', 1496634125, 1, 1496635443, 1, 1496601000),
(15, 'Export', 'Export', 10, '1', 1504348927, 1, 1504349108, 1, 1504290600);

--
-- Triggers `cms_mainmenu`
--
DROP TRIGGER IF EXISTS `trig_cms_mainmenu_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_mainmenu_DELETE` BEFORE DELETE ON `cms_mainmenu`
 FOR EACH ROW BEGIN
set @oldVal='';
set @newVal='';
set @chdCol='';
set @id=OLD.min_mnu_id;
set @userid=OLD.update_user;

if  OLD.min_mnu_id !="" OR OLD.min_mnu_id is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.min_mnu_id);

	set @chdCol=CONCAT(@chdCol,'-','min_mnu_id');
end if;

if  OLD.min_mnu_name !="" OR OLD.min_mnu_name is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.min_mnu_name);

	set @chdCol=CONCAT(@chdCol,'-','min_mnu_name');
end if;

if  OLD.min_mnu_desc !="" OR OLD.min_mnu_desc is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.min_mnu_desc);

	set @chdCol=CONCAT(@chdCol,'-','min_mnu_desc');
end if;

if  OLD.min_mnu_preference !="" OR OLD.min_mnu_preference is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.min_mnu_preference);

	set @chdCol=CONCAT(@chdCol,'-','min_mnu_preference');
end if;

if  OLD.status !="" OR OLD.status is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @chdCol=CONCAT(@chdCol,'-','status');
end if;

if  OLD.create_time !="" OR OLD.create_time is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');
end if;

if  OLD.create_user !="" OR OLD.create_user is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');
end if;

if  OLD.update_time !="" OR OLD.update_time is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');
end if;

if  OLD.update_user !="" OR OLD.update_user is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');
end if;

if  OLD.record_date !="" OR OLD.record_date is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');
end if;



INSERT INTO mirror_iccplus.cms_mainmenu(min_mnu_name,min_mnu_desc,min_mnu_preference,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.min_mnu_name,OLD.min_mnu_desc,OLD.min_mnu_preference,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);

 
INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_mainmenu', NOW(),'d',@id,@userid,@oldVal,@newVal,'');

END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_mainmenu_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_mainmenu_INSERT` AFTER INSERT ON `cms_mainmenu`
 FOR EACH ROW BEGIN
set @oldVal='';
set @newVal='';
set @chdCol='';
set @id=NEW.min_mnu_id;
set @userid=NEW.create_user;

set @newVal =CONCAT(@newVal,'-', NEW.min_mnu_id);
set @chdCol=CONCAT(@chdCol,'-','min_mnu_id');
set @newVal =CONCAT(@newVal,'-', NEW.min_mnu_name);
set @chdCol=CONCAT(@chdCol,'-','min_mnu_name');
set @newVal =CONCAT(@newVal,'-', NEW.min_mnu_desc);
set @chdCol=CONCAT(@chdCol,'-','min_mnu_desc');
set @newVal =CONCAT(@newVal,'-', NEW.min_mnu_preference);
set @chdCol=CONCAT(@chdCol,'-','min_mnu_preference');
set @newVal =CONCAT(@newVal,'-', NEW.status);
set @chdCol=CONCAT(@chdCol,'-','status');
set @newVal =CONCAT(@newVal,'-', NEW.create_time);
set @chdCol=CONCAT(@chdCol,'-','create_time');
set @newVal =CONCAT(@newVal,'-', NEW.create_user);
set @chdCol=CONCAT(@chdCol,'-','create_user');
set @newVal =CONCAT(@newVal,'-', NEW.update_time);
set @chdCol=CONCAT(@chdCol,'-','update_time');
set @newVal =CONCAT(@newVal,'-', NEW.update_user);
set @chdCol=CONCAT(@chdCol,'-','update_user');
set @newVal =CONCAT(@newVal,'-', NEW.record_date);
set @chdCol=CONCAT(@chdCol,'-','record_date');


INSERT INTO mirror_iccplus.cms_mainmenu(min_mnu_name,min_mnu_desc,min_mnu_preference,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.min_mnu_name,NEW.min_mnu_desc,NEW.min_mnu_preference,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);


INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_mainmenu', NOW(),'i',@id,@userid,@oldVal,@newVal,'');

END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_mainmenu_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_mainmenu_UPDATE` BEFORE UPDATE ON `cms_mainmenu`
 FOR EACH ROW BEGIN
set @oldVal='';
set @newVal='';
set @chdCol='';
set @id=NEW.min_mnu_id;
set @userid=NEW.update_user;

if  OLD.min_mnu_id != NEW.min_mnu_id
then
	set @oldval =CONCAT(@oldVal,'-',OLD.min_mnu_id);
	set @newVal =CONCAT(@newVal,'-', NEW.min_mnu_id);
	set @chdCol=CONCAT(@chdCol,'-','min_mnu_id');
end if;

if  OLD.min_mnu_name != NEW.min_mnu_name
then
	set @oldval =CONCAT(@oldVal,'-',OLD.min_mnu_name);
	set @newVal =CONCAT(@newVal,'-', NEW.min_mnu_name);
	set @chdCol=CONCAT(@chdCol,'-','min_mnu_name');
end if;

if  OLD.min_mnu_desc != NEW.min_mnu_desc
then
	set @oldval =CONCAT(@oldVal,'-',OLD.min_mnu_desc);
	set @newVal =CONCAT(@newVal,'-', NEW.min_mnu_desc);
	set @chdCol=CONCAT(@chdCol,'-','min_mnu_desc');
end if;

if  OLD.min_mnu_preference != NEW.min_mnu_preference
then
	set @oldval =CONCAT(@oldVal,'-',OLD.min_mnu_preference);
	set @newVal =CONCAT(@newVal,'-', NEW.min_mnu_preference);
	set @chdCol=CONCAT(@chdCol,'-','min_mnu_preference');
end if;

if  OLD.status != NEW.status
then
	set @oldval =CONCAT(@oldVal,'-',OLD.status);
	set @newVal =CONCAT(@newVal,'-', NEW.status);
	set @chdCol=CONCAT(@chdCol,'-','status');
end if;

if  OLD.create_time != NEW.create_time
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);
	set @newVal =CONCAT(@newVal,'-', NEW.create_time);
	set @chdCol=CONCAT(@chdCol,'-','create_time');
end if;

if  OLD.create_user != NEW.create_user
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);
	set @newVal =CONCAT(@newVal,'-', NEW.create_user);
	set @chdCol=CONCAT(@chdCol,'-','create_user');
end if;

if  OLD.update_time != NEW.update_time
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);
	set @newVal =CONCAT(@newVal,'-', NEW.update_time);
	set @chdCol=CONCAT(@chdCol,'-','update_time');
end if;

if  OLD.update_user != NEW.update_user
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);
	set @newVal =CONCAT(@newVal,'-', NEW.update_user);
	set @chdCol=CONCAT(@chdCol,'-','update_user');
end if;

if  OLD.record_date != NEW.record_date
then
	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);
	set @newVal =CONCAT(@newVal,'-', NEW.record_date);
	set @chdCol=CONCAT(@chdCol,'-','record_date');
end if;



INSERT INTO mirror_iccplus.cms_mainmenu(min_mnu_name,min_mnu_desc,min_mnu_preference,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.min_mnu_name,NEW.min_mnu_desc,NEW.min_mnu_preference,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);


INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_mainmenu', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);

END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_menuprivileges`
--

DROP TABLE IF EXISTS `cms_menuprivileges`;
CREATE TABLE IF NOT EXISTS `cms_menuprivileges` (
  `mnu_acs_id` int(11) NOT NULL AUTO_INCREMENT,
  `mnu_acs_usr_id_fk` int(11) NOT NULL,
  `mnu_acs_mnu_id_fk` int(11) NOT NULL,
  `mnu_acs_sub_mnu_id_fk` int(11) NOT NULL,
  `mnu_acs_usr_status` int(11) DEFAULT NULL,
  `mnu_acs_add` int(1) DEFAULT NULL,
  `mnu_acs_edit` int(1) DEFAULT NULL,
  `mnu_acs_delete` int(1) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`mnu_acs_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=826 ;

--
-- Dumping data for table `cms_menuprivileges`
--

INSERT INTO `cms_menuprivileges` (`mnu_acs_id`, `mnu_acs_usr_id_fk`, `mnu_acs_mnu_id_fk`, `mnu_acs_sub_mnu_id_fk`, `mnu_acs_usr_status`, `mnu_acs_add`, `mnu_acs_edit`, `mnu_acs_delete`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(1, 3, 1, 1, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(2, 3, 1, 8, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(3, 3, 1, 17, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(4, 3, 1, 32, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(5, 3, 1, 19, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(6, 3, 1, 16, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(7, 3, 1, 21, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(8, 3, 1, 22, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(9, 3, 1, 27, 1, 1, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(10, 3, 1, 35, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(11, 3, 2, 18, 1, 1, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(12, 3, 7, 23, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(13, 3, 7, 30, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(14, 3, 7, 34, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(15, 3, 7, 38, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(16, 3, 7, 24, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(17, 3, 3, 11, 1, 0, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(18, 3, 3, 12, 1, 0, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(19, 3, 3, 14, 1, 0, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(20, 3, 3, 7, 1, 0, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(21, 3, 4, 26, 1, 0, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(22, 3, 9, 2, 1, 1, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(23, 3, 9, 3, 1, 1, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(24, 3, 5, 37, 1, 1, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(25, 3, 5, 10, 1, 1, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(26, 3, 5, 13, 1, 1, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(27, 3, 5, 20, 1, 1, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(28, 3, 5, 25, 1, 1, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(29, 3, 9, 29, 1, 1, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(30, 3, 5, 4, 1, 0, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(31, 3, 5, 15, 1, 0, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(32, 3, 4, 28, 1, 1, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(33, 3, 4, 33, 1, 0, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(34, 3, 4, 36, 1, 0, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(35, 3, 6, 39, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(36, 3, 6, 40, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(37, 3, 6, 31, 1, 0, 0, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(38, 3, 6, 5, 1, 1, 1, 0, '1', 1488605873, 1, 1504179720, 13, 1488565800),
(39, 1, 1, 1, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(40, 1, 1, 8, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(41, 1, 1, 17, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(42, 1, 1, 32, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(43, 1, 1, 19, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(44, 1, 1, 16, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(45, 1, 1, 21, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(46, 1, 1, 22, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(47, 1, 1, 27, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(48, 1, 1, 35, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(49, 1, 2, 18, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(50, 1, 7, 23, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(51, 1, 7, 30, 1, 0, 0, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(52, 1, 7, 34, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(53, 1, 7, 38, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(54, 1, 7, 24, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(55, 1, 3, 11, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(56, 1, 3, 12, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(57, 1, 3, 14, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(58, 1, 3, 7, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(59, 1, 4, 26, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(60, 1, 9, 2, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(61, 1, 9, 3, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(62, 1, 5, 37, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(63, 1, 5, 10, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(64, 1, 5, 13, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(65, 1, 5, 20, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(66, 1, 5, 25, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(67, 1, 9, 29, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(68, 1, 5, 4, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(69, 1, 5, 15, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(70, 1, 4, 28, 1, 1, 1, 1, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(71, 1, 4, 33, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(72, 1, 4, 36, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(73, 1, 6, 39, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(74, 1, 6, 40, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(75, 1, 6, 31, 1, 1, 0, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(76, 1, 6, 5, 1, 1, 1, 0, '1', 1488607502, 1, 1504503215, 13, 1488565800),
(77, 6, 1, 1, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(78, 6, 1, 8, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(79, 6, 1, 17, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(80, 6, 1, 32, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(81, 6, 1, 19, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(82, 6, 1, 16, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(83, 6, 1, 21, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(84, 6, 1, 22, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(85, 6, 1, 27, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(86, 6, 1, 35, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(87, 6, 2, 18, 1, 1, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(88, 6, 7, 23, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(89, 6, 7, 30, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(90, 6, 7, 34, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(91, 6, 7, 38, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(92, 6, 7, 24, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(93, 6, 3, 11, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(94, 6, 3, 12, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(95, 6, 3, 14, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(96, 6, 3, 7, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(97, 6, 4, 26, 1, 1, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(98, 6, 9, 2, 1, 1, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(99, 6, 9, 3, 1, 1, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(100, 6, 5, 37, 1, 1, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(101, 6, 5, 10, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(102, 6, 5, 13, 1, 1, 1, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(103, 6, 5, 20, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(104, 6, 5, 25, 1, 1, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(105, 6, 9, 29, 1, 1, 1, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(106, 6, 5, 4, 1, 1, 1, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(107, 6, 5, 15, 1, 1, 1, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(108, 6, 4, 28, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(109, 6, 4, 33, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(110, 6, 4, 36, 1, 0, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(111, 6, 6, 39, 1, 1, 1, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(112, 6, 6, 40, 1, 1, 1, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(113, 6, 6, 31, 1, 1, 0, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(114, 6, 6, 5, 1, 1, 1, 0, '1', 1488619273, 1, 1504179805, 13, 1488565800),
(115, 6, 1, 1, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(116, 6, 1, 8, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(117, 6, 1, 17, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(118, 6, 1, 32, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(119, 6, 1, 19, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(120, 6, 1, 16, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(121, 6, 1, 21, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(122, 6, 1, 22, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(123, 6, 1, 27, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(124, 6, 1, 35, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(125, 6, 2, 18, 1, 0, 1, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(126, 6, 4, 23, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(127, 6, 4, 30, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(128, 6, 4, 34, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(129, 6, 4, 38, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(130, 6, 4, 24, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(131, 6, 6, 11, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(132, 6, 6, 12, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(133, 6, 6, 14, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(134, 6, 7, 7, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(135, 6, 8, 26, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(136, 6, 9, 2, 1, 1, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(137, 6, 9, 3, 1, 1, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(138, 6, 9, 37, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(139, 6, 9, 10, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(140, 6, 9, 13, 1, 1, 1, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(141, 6, 9, 20, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(142, 6, 9, 25, 1, 1, 1, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(143, 6, 9, 29, 1, 1, 1, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(144, 6, 10, 4, 1, 0, 1, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(145, 6, 10, 15, 1, 0, 1, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(146, 6, 10, 28, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(147, 6, 10, 33, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(148, 6, 10, 36, 1, 0, 0, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(149, 6, 11, 39, 1, 1, 1, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(150, 6, 11, 40, 1, 1, 1, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(151, 6, 11, 31, 1, 1, 1, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(152, 6, 11, 5, 1, 1, 1, 0, '1', 1488619344, 1, 1488619344, NULL, 1488565800),
(153, 1, 6, 42, 1, 1, 1, 0, '1', 1488885959, 1, 1504503215, 13, 1488825000),
(154, 1, 6, 43, 1, 1, 1, 0, '1', 1488956621, 1, 1504503215, 13, 1488911400),
(155, 1, 6, 44, 1, 1, 1, 0, '1', 1488963408, 1, 1504503215, 13, 1488911400),
(156, 6, 6, 42, 1, 1, 1, 0, '1', 1488974680, 1, 1504179805, 13, 1488911400),
(157, 6, 6, 44, 1, 1, 1, 0, '1', 1488974680, 1, 1504179805, 13, 1488911400),
(158, 6, 6, 43, 1, 1, 1, 0, '1', 1488974680, 1, 1504179805, 13, 1488911400),
(159, 1, 13, 45, 1, 1, 0, 0, '1', 1489031123, 1, 1504503215, 13, 1488997800),
(160, 3, 6, 42, 1, 0, 0, 0, '1', 1489033479, 1, 1504179720, 13, 1488997800),
(161, 3, 6, 44, 1, 0, 0, 0, '1', 1489033479, 1, 1504179720, 13, 1488997800),
(162, 3, 6, 43, 1, 0, 0, 0, '1', 1489033479, 1, 1504179720, 13, 1488997800),
(163, 3, 13, 45, 1, 1, 0, 0, '1', 1489033479, 1, 1504179720, 13, 1488997800),
(164, 4, 1, 1, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(165, 4, 1, 8, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(166, 4, 1, 17, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(167, 4, 1, 32, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(168, 4, 1, 19, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(169, 4, 1, 16, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(170, 4, 1, 21, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(171, 4, 1, 22, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(172, 4, 1, 27, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(173, 4, 1, 35, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(174, 4, 2, 18, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(175, 4, 13, 45, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(176, 4, 7, 23, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(177, 4, 7, 30, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(178, 4, 7, 34, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(179, 4, 7, 38, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(180, 4, 7, 24, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(181, 4, 3, 11, 1, 1, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(182, 4, 3, 12, 1, 1, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(183, 4, 3, 14, 1, 1, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(184, 4, 3, 7, 1, 1, 1, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(185, 4, 4, 26, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(186, 4, 9, 2, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(187, 4, 9, 3, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(188, 4, 5, 37, 1, 1, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(189, 4, 6, 5, 1, 1, 1, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(190, 4, 5, 10, 1, 1, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(191, 4, 5, 13, 1, 1, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(192, 4, 5, 20, 1, 1, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(193, 4, 5, 25, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(194, 4, 9, 29, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(195, 4, 5, 4, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(196, 4, 5, 15, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(197, 4, 4, 28, 1, 0, 0, 0, '1', 1489033590, 1, 1495130366, 1, 1488997800),
(198, 4, 4, 33, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(199, 4, 4, 36, 1, 0, 0, 0, '1', 1489033590, 1, 1499235685, 13, 1488997800),
(200, 4, 6, 39, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(201, 4, 6, 42, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(202, 4, 6, 44, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(203, 4, 6, 43, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(204, 4, 6, 40, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(205, 4, 6, 31, 1, 0, 0, 0, '1', 1489033590, 1, 1499235684, 13, 1488997800),
(206, 5, 1, 1, 1, 0, 1, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(207, 5, 1, 8, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(208, 5, 1, 17, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(209, 5, 1, 32, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(210, 5, 1, 19, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(211, 5, 1, 16, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(212, 5, 1, 21, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(213, 5, 1, 22, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(214, 5, 1, 27, 1, 1, 1, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(215, 5, 1, 35, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(216, 5, 2, 18, 1, 1, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(217, 5, 13, 45, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(218, 5, 7, 23, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(219, 5, 7, 30, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(220, 5, 7, 34, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(221, 5, 7, 38, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(222, 5, 7, 24, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(223, 5, 3, 11, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(224, 5, 3, 12, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(225, 5, 3, 14, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(226, 5, 3, 7, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(227, 5, 4, 26, 1, 1, 1, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(228, 5, 9, 2, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(229, 5, 9, 3, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(230, 5, 5, 37, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(231, 5, 6, 5, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(232, 5, 5, 10, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(233, 5, 5, 13, 1, 1, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(234, 5, 5, 20, 1, 1, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(235, 5, 5, 25, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(236, 5, 9, 29, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(237, 5, 5, 4, 1, 1, 1, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(238, 5, 5, 15, 1, 1, 1, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(239, 5, 4, 28, 1, 1, 1, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(240, 5, 4, 33, 1, 1, 1, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(241, 5, 4, 36, 1, 1, 1, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(242, 5, 6, 39, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(243, 5, 6, 42, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(244, 5, 6, 44, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(245, 5, 6, 43, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(246, 5, 6, 40, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(247, 5, 6, 31, 1, 0, 0, 0, '1', 1489033685, 1, 1504179626, 13, 1488997800),
(248, 1, 6, 46, 1, 1, 1, 0, '1', 1489143435, 1, 1504503215, 13, 1489084200),
(249, 1, 7, 47, 1, 1, 0, 0, '1', 1489232916, 1, 1504503215, 13, 1489170600),
(250, 1, 6, 48, 1, 1, 1, 0, '1', 1489290251, 1, 1504503215, 13, 1489257000),
(251, 1, 6, 49, 1, 1, 1, 0, '1', 1489290409, 1, 1504503215, 13, 1489257000),
(252, 1, 6, 50, 1, 1, 1, 0, '1', 1489382659, 1, 1504503215, 13, 1489343400),
(253, 9, 1, 1, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(254, 9, 1, 8, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(255, 9, 1, 17, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(256, 9, 1, 32, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(257, 9, 1, 19, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(258, 9, 1, 16, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(259, 9, 1, 21, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(260, 9, 1, 22, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(261, 9, 1, 27, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(262, 9, 1, 35, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(263, 9, 2, 18, 1, 0, 1, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(264, 9, 3, 7, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(265, 9, 4, 26, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(266, 9, 5, 4, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(267, 9, 3, 11, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(268, 9, 5, 15, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(269, 9, 3, 12, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(270, 9, 3, 14, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(271, 9, 5, 28, 1, 0, 0, 0, '1', 1489606010, 1, 1493973169, 1, 1489602600),
(272, 9, 4, 33, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(273, 9, 4, 36, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(274, 9, 6, 39, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(275, 9, 6, 49, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(276, 9, 6, 50, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(277, 9, 6, 42, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(278, 9, 6, 44, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(279, 9, 6, 43, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(280, 9, 6, 40, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(281, 9, 6, 48, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(282, 9, 6, 31, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(283, 9, 6, 46, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(284, 9, 6, 5, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(285, 9, 7, 47, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(286, 9, 7, 23, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(287, 9, 7, 30, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(288, 9, 7, 34, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(289, 9, 7, 38, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(290, 9, 7, 24, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(291, 9, 9, 2, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(292, 9, 9, 3, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(293, 9, 5, 37, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(294, 9, 5, 10, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(295, 9, 5, 13, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(296, 9, 5, 20, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(297, 9, 5, 25, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(298, 9, 9, 29, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(299, 9, 13, 45, 1, 0, 0, 0, '1', 1489606010, 1, 1499235619, 13, 1489602600),
(300, 1, 1, 1, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(301, 1, 1, 8, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(302, 1, 1, 17, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(303, 1, 1, 32, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(304, 1, 1, 19, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(305, 1, 1, 16, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(306, 1, 1, 21, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(307, 1, 1, 22, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(308, 1, 1, 27, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(309, 1, 1, 35, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(310, 1, 2, 18, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(311, 1, 3, 7, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(312, 1, 4, 26, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(313, 1, 5, 4, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(314, 1, 5, 11, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(315, 1, 5, 15, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(316, 1, 5, 12, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(317, 1, 5, 14, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(318, 1, 5, 28, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(319, 1, 5, 33, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(320, 1, 5, 36, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(321, 1, 6, 39, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(322, 1, 6, 49, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(323, 1, 6, 50, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(324, 1, 6, 42, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(325, 1, 6, 44, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(326, 1, 6, 43, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(327, 1, 6, 40, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(328, 1, 6, 48, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(329, 1, 6, 31, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(330, 1, 6, 46, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(331, 1, 6, 5, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(332, 1, 7, 47, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(333, 1, 7, 23, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(334, 1, 7, 30, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(335, 1, 7, 34, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(336, 1, 7, 38, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(337, 1, 7, 24, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(338, 1, 9, 2, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(339, 1, 9, 3, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(340, 1, 9, 37, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(341, 1, 9, 10, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(342, 1, 9, 13, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(343, 1, 9, 20, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(344, 1, 5, 51, 1, 1, 1, 0, '1', 1490072438, 1, 1504503215, 13, 1490034600),
(345, 1, 9, 25, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(346, 1, 9, 29, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(347, 1, 13, 45, 1, 1, 1, 1, '1', 1490072438, 1, 1490072438, NULL, 1490034600),
(348, 3, 6, 49, 1, 0, 0, 0, '1', 1490072607, 1, 1504179720, 13, 1490034600),
(349, 3, 6, 50, 1, 0, 0, 0, '1', 1490072607, 1, 1504179720, 13, 1490034600),
(350, 3, 6, 48, 1, 0, 0, 0, '1', 1490072607, 1, 1504179720, 13, 1490034600),
(351, 3, 6, 46, 1, 0, 0, 0, '1', 1490072607, 1, 1504179720, 13, 1490034600),
(352, 3, 7, 47, 1, 0, 0, 0, '1', 1490072607, 1, 1504179720, 13, 1490034600),
(353, 3, 5, 51, 1, 1, 0, 0, '1', 1490072607, 1, 1504179720, 13, 1490034600),
(354, 1, 13, 52, 1, 1, 0, 0, '1', 1490441547, 1, 1504503215, 13, 1490380200),
(355, 1, 1, 53, 1, 1, 1, 0, '1', 1493090594, 1, 1504503215, 13, 1493058600),
(356, 1, 3, 55, 1, 1, 1, 0, '1', 1493270512, 1, 1504503215, 13, 1493231400),
(357, 1, 3, 54, 1, 1, 1, 0, '1', 1493270512, 1, 1504503215, 13, 1493231400),
(358, 1, 13, 56, 1, 1, 1, 1, '1', 1493460632, 1, 1493460632, 1, 1493404200),
(359, 1, 13, 58, 1, 1, 1, 1, '1', 1493461086, 1, 1493461086, 1, 1493404200),
(360, 1, 13, 57, 1, 1, 0, 0, '1', 1493461086, 1, 1504503215, 13, 1493404200),
(361, 1, 13, 59, 1, 1, 0, 0, '1', 1493463693, 1, 1504503215, 13, 1493404200),
(362, 3, 1, 53, 1, 0, 0, 0, '1', 1493874034, 1, 1504179720, 13, 1493836200),
(363, 3, 13, 59, 1, 1, 0, 0, '1', 1493874034, 1, 1504179720, 13, 1493836200),
(364, 3, 13, 57, 1, 1, 0, 0, '1', 1493874034, 1, 1504179720, 13, 1493836200),
(365, 3, 13, 52, 1, 1, 0, 0, '1', 1493874034, 1, 1504179720, 13, 1493836200),
(366, 3, 3, 55, 1, 0, 0, 0, '1', 1493874034, 1, 1504179720, 13, 1493836200),
(367, 3, 3, 54, 1, 0, 0, 0, '1', 1493874034, 1, 1504179720, 13, 1493836200),
(368, 9, 1, 53, 1, 0, 0, 0, '1', 1493973169, 1, 1499235619, 13, 1493922600),
(369, 9, 5, 51, 1, 0, 0, 0, '1', 1493973169, 1, 1499235619, 13, 1493922600),
(370, 9, 13, 59, 1, 0, 0, 0, '1', 1493973169, 1, 1499235619, 13, 1493922600),
(371, 9, 13, 57, 1, 0, 0, 0, '1', 1493973169, 1, 1499235619, 13, 1493922600),
(372, 9, 13, 52, 1, 0, 0, 0, '1', 1493973169, 1, 1499235619, 13, 1493922600),
(373, 9, 3, 55, 1, 0, 0, 0, '1', 1493973169, 1, 1499235619, 13, 1493922600),
(374, 9, 3, 54, 1, 0, 0, 0, '1', 1493973169, 1, 1499235619, 13, 1493922600),
(375, 4, 6, 49, 1, 0, 0, 0, '1', 1493973487, 1, 1499235684, 13, 1493922600),
(376, 4, 6, 50, 1, 0, 0, 0, '1', 1493973487, 1, 1499235684, 13, 1493922600),
(377, 4, 6, 48, 1, 0, 0, 0, '1', 1493973487, 1, 1499235684, 13, 1493922600),
(378, 4, 6, 46, 1, 0, 0, 0, '1', 1493973487, 1, 1499235684, 13, 1493922600),
(379, 4, 7, 47, 1, 0, 0, 0, '1', 1493973487, 1, 1499235684, 13, 1493922600),
(380, 4, 1, 53, 1, 0, 0, 0, '1', 1493973487, 1, 1499235684, 13, 1493922600),
(381, 4, 5, 51, 1, 0, 0, 0, '1', 1493973487, 1, 1499235685, 13, 1493922600),
(382, 4, 13, 59, 1, 0, 0, 0, '1', 1493973487, 1, 1499235685, 13, 1493922600),
(383, 4, 13, 57, 1, 0, 0, 0, '1', 1493973487, 1, 1499235685, 13, 1493922600),
(384, 4, 13, 52, 1, 0, 0, 0, '1', 1493973487, 1, 1499235685, 13, 1493922600),
(385, 4, 3, 55, 1, 1, 0, 0, '1', 1493973487, 1, 1499235685, 13, 1493922600),
(386, 4, 3, 54, 1, 1, 0, 0, '1', 1493973487, 1, 1499235685, 13, 1493922600),
(387, 6, 6, 49, 1, 1, 1, 0, '1', 1494416446, 1, 1504179805, 13, 1494354600),
(388, 6, 6, 50, 1, 1, 1, 0, '1', 1494416446, 1, 1504179805, 13, 1494354600),
(389, 6, 6, 48, 1, 1, 1, 0, '1', 1494416446, 1, 1504179805, 13, 1494354600),
(390, 6, 6, 46, 1, 1, 1, 0, '1', 1494416446, 1, 1504179805, 13, 1494354600),
(391, 6, 13, 45, 1, 0, 0, 0, '1', 1494416446, 1, 1504179805, 13, 1494354600),
(392, 6, 7, 47, 1, 0, 0, 0, '1', 1494416446, 1, 1504179805, 13, 1494354600),
(393, 6, 1, 53, 1, 1, 0, 0, '1', 1494416446, 1, 1504179805, 13, 1494354600),
(394, 6, 5, 51, 1, 0, 0, 0, '1', 1494416446, 1, 1504179805, 13, 1494354600),
(395, 6, 13, 59, 1, 0, 0, 0, '1', 1494416446, 1, 1504179805, 13, 1494354600),
(396, 6, 13, 57, 1, 0, 0, 0, '1', 1494416446, 1, 1504179805, 13, 1494354600),
(397, 6, 13, 52, 1, 1, 0, 0, '1', 1494416446, 1, 1504179805, 13, 1494354600),
(398, 6, 3, 55, 1, 0, 0, 0, '1', 1494416446, 1, 1504179805, 13, 1494354600),
(399, 6, 3, 54, 1, 0, 0, 0, '1', 1494416446, 1, 1504179805, 13, 1494354600),
(400, 10, 7, 1, 1, 1, 1, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(401, 10, 7, 8, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(402, 10, 7, 17, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(403, 10, 7, 32, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(404, 10, 7, 53, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(405, 10, 7, 19, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(406, 10, 7, 16, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(407, 10, 7, 21, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(408, 10, 7, 22, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(409, 10, 7, 27, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(410, 10, 7, 35, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(411, 10, 7, 18, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(412, 10, 7, 7, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(413, 10, 7, 55, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(414, 10, 7, 54, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(415, 10, 7, 26, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(416, 10, 7, 4, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(417, 10, 7, 11, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(418, 10, 7, 15, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(419, 10, 7, 12, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(420, 10, 7, 14, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(421, 10, 7, 28, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(422, 10, 7, 33, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(423, 10, 7, 36, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(424, 10, 7, 39, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(425, 10, 7, 49, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(426, 10, 7, 50, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(427, 10, 7, 42, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(428, 10, 7, 44, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(429, 10, 7, 43, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(430, 10, 7, 40, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(431, 10, 7, 48, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(432, 10, 7, 31, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(433, 10, 7, 46, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(434, 10, 7, 5, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(435, 10, 7, 47, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(436, 10, 7, 23, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(437, 10, 7, 30, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(438, 10, 7, 34, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(439, 10, 7, 38, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(440, 10, 7, 24, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(441, 10, 7, 2, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(442, 10, 7, 3, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(443, 10, 7, 37, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(444, 10, 7, 10, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(445, 10, 7, 13, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(446, 10, 7, 20, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(447, 10, 7, 51, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(448, 10, 7, 25, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(449, 10, 7, 29, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(450, 10, 7, 45, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(451, 10, 7, 59, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(452, 10, 7, 57, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(453, 10, 7, 52, 1, 0, 0, 0, '1', 1494417542, 1, 1494417542, NULL, 1494354600),
(454, 1, 1, 60, 1, 1, 1, 0, '1', 1495131453, 1, 1504503215, 13, 1495045800),
(455, 6, 1, 60, 1, 1, 0, 0, '1', 1495131550, 1, 1504179805, 13, 1495045800),
(456, 3, 1, 60, 1, 0, 0, 0, '1', 1495131695, 1, 1504179720, 13, 1495045800),
(457, 1, 1, 61, 1, 1, 0, 0, '1', 1495138208, 1, 1504503215, 13, 1495132200),
(458, 6, 1, 61, 1, 0, 1, 0, '1', 1495138231, 1, 1504179805, 13, 1495132200),
(459, 6, 1, 62, 1, 1, 0, 0, '1', 1495144910, 1, 1504179805, 13, 1495132200),
(460, 1, 1, 62, 1, 1, 0, 0, '1', 1495144923, 1, 1504503215, 13, 1495132200),
(461, 6, 1, 63, 1, 1, 0, 0, '1', 1495213545, 1, 1504179805, 13, 1495132200),
(462, 1, 1, 63, 1, 1, 0, 0, '1', 1495213558, 1, 1504503215, 13, 1495132200),
(463, 1, 1, 64, 1, 1, 0, 0, '1', 1495221578, 1, 1504503215, 13, 1495218600),
(464, 6, 1, 64, 1, 1, 0, 0, '1', 1496127165, 1, 1504179805, 13, 1496082600),
(465, 11, 1, 61, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(466, 11, 1, 64, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(467, 11, 1, 1, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(468, 11, 1, 60, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(469, 11, 1, 8, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(470, 11, 1, 17, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(471, 11, 1, 32, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(472, 11, 1, 53, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(473, 11, 1, 19, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(474, 11, 1, 16, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(475, 11, 1, 21, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(476, 11, 1, 22, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(477, 11, 1, 62, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(478, 11, 1, 27, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(479, 11, 1, 63, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(480, 11, 1, 35, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(481, 11, 2, 18, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(482, 11, 3, 7, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(483, 11, 3, 11, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(484, 11, 3, 12, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(485, 11, 3, 14, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(486, 11, 3, 55, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(487, 11, 3, 54, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(488, 11, 4, 26, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(489, 11, 4, 28, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(490, 11, 4, 33, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(491, 11, 4, 36, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(492, 11, 5, 4, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(493, 11, 5, 37, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(494, 11, 5, 10, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(495, 11, 5, 15, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(496, 11, 5, 13, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(497, 11, 5, 51, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(498, 11, 5, 25, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(499, 11, 5, 20, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(500, 11, 6, 39, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(501, 11, 6, 49, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(502, 11, 6, 50, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(503, 11, 6, 42, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(504, 11, 6, 44, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(505, 11, 6, 43, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(506, 11, 6, 40, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(507, 11, 6, 48, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(508, 11, 6, 31, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(509, 11, 6, 46, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(510, 11, 6, 5, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(511, 11, 7, 47, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(512, 11, 7, 23, 1, 0, 0, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(513, 11, 7, 30, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(514, 11, 7, 34, 1, 0, 0, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(515, 11, 7, 38, 1, 0, 0, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(516, 11, 7, 24, 1, 0, 0, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(517, 11, 9, 2, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(518, 11, 9, 3, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(519, 11, 9, 29, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(520, 11, 13, 45, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(521, 11, 13, 59, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(522, 11, 13, 57, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(523, 11, 13, 52, 1, 1, 1, 0, '1', 1496141754, 1, 1496142277, 1, 1496082600),
(524, 1, 4, 65, 1, 1, 1, 1, '1', 1496398638, 1, 1504503215, 13, 1496341800),
(525, 6, 4, 65, 1, 0, 0, 0, '1', 1496475473, 1, 1504179805, 13, 1496428200),
(526, 5, 1, 61, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(527, 5, 1, 64, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(528, 5, 6, 49, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(529, 5, 6, 50, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(530, 5, 6, 48, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(531, 5, 6, 46, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(532, 5, 7, 47, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(533, 5, 1, 60, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(534, 5, 1, 53, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(535, 5, 5, 51, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(536, 5, 1, 62, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(537, 5, 13, 59, 1, 1, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(538, 5, 4, 65, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(539, 5, 13, 57, 1, 1, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(540, 5, 13, 52, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(541, 5, 3, 55, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(542, 5, 3, 54, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(543, 5, 1, 63, 1, 0, 0, 0, '1', 1496550599, 1, 1504179626, 13, 1496514600),
(544, 1, 14, 66, 1, 1, 0, 0, '1', 1496634456, 1, 1504503215, 13, 1496601000),
(545, 12, 7, 61, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(546, 12, 7, 64, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(547, 12, 7, 1, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(548, 12, 7, 60, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(549, 12, 7, 8, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(550, 12, 7, 17, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(551, 12, 7, 32, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(552, 12, 7, 53, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(553, 12, 7, 19, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(554, 12, 7, 16, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(555, 12, 7, 21, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(556, 12, 7, 22, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(557, 12, 7, 62, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(558, 12, 7, 27, 1, 1, 1, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(559, 12, 7, 63, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(560, 12, 7, 35, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(561, 12, 7, 18, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(562, 12, 7, 7, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(563, 12, 7, 11, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(564, 12, 7, 12, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(565, 12, 7, 14, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(566, 12, 7, 55, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(567, 12, 7, 54, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(568, 12, 7, 26, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(569, 12, 7, 33, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(570, 12, 7, 36, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(571, 12, 7, 4, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(572, 12, 7, 37, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(573, 12, 7, 10, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(574, 12, 7, 15, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(575, 12, 7, 13, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(576, 12, 7, 51, 1, 1, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(577, 12, 7, 25, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(578, 12, 7, 20, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(579, 12, 7, 39, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(580, 12, 7, 49, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(581, 12, 7, 50, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(582, 12, 7, 42, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(583, 12, 7, 44, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(584, 12, 7, 43, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(585, 12, 7, 40, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(586, 12, 7, 48, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(587, 12, 7, 31, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(588, 12, 7, 46, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(589, 12, 7, 5, 1, 1, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(590, 12, 7, 47, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(591, 12, 7, 23, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(592, 12, 7, 30, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(593, 12, 7, 34, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(594, 12, 7, 38, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(595, 12, 7, 24, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(596, 12, 7, 2, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(597, 12, 7, 3, 1, 1, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(598, 12, 7, 29, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(599, 12, 7, 45, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(600, 12, 7, 59, 1, 1, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(601, 12, 7, 57, 1, 1, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(602, 12, 7, 52, 1, 0, 0, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(603, 12, 7, 66, 1, 1, 1, 0, '1', 1496657661, 1, 1496657661, NULL, 1496601000),
(604, 1, 1, 67, 1, 1, 0, 0, '1', 1496719222, 1, 1504503215, 13, 1496687400),
(605, 5, 14, 66, 1, 1, 1, 0, '1', 1496720887, 1, 1504179626, 13, 1496687400),
(606, 5, 1, 67, 1, 0, 0, 0, '1', 1496720887, 1, 1504179626, 13, 1496687400),
(607, 3, 1, 61, 1, 1, 0, 0, '1', 1496885383, 1, 1504179720, 13, 1496860200),
(608, 3, 1, 64, 1, 1, 0, 0, '1', 1496885383, 1, 1504179720, 13, 1496860200),
(609, 3, 1, 67, 1, 1, 0, 0, '1', 1496885383, 1, 1504179720, 13, 1496860200),
(610, 3, 14, 66, 1, 0, 1, 0, '1', 1496885383, 1, 1504179720, 13, 1496860200),
(611, 3, 1, 62, 1, 1, 0, 0, '1', 1496885383, 1, 1504179720, 13, 1496860200),
(612, 3, 1, 63, 1, 1, 0, 0, '1', 1496885383, 1, 1504179720, 13, 1496860200),
(613, 6, 1, 67, 1, 1, 1, 0, '1', 1496885820, 1, 1504179805, 13, 1496860200),
(614, 6, 14, 66, 1, 0, 0, 0, '1', 1496885820, 1, 1504179805, 13, 1496860200),
(615, 1, 1, 68, 1, 0, 0, 0, '1', 1497944988, 1, 1504503215, 13, 1497897000),
(616, 13, 1, 68, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(617, 13, 1, 61, 1, 0, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(618, 13, 1, 64, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(619, 13, 1, 1, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(620, 13, 1, 67, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(621, 13, 1, 60, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(622, 13, 1, 8, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(623, 13, 1, 17, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(624, 13, 1, 32, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(625, 13, 1, 53, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(626, 13, 1, 19, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(627, 13, 1, 16, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(628, 13, 1, 21, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(629, 13, 1, 22, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(630, 13, 1, 62, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(631, 13, 1, 27, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(632, 13, 1, 63, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(633, 13, 1, 35, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(634, 13, 2, 18, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(635, 13, 3, 7, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(636, 13, 3, 11, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(637, 13, 3, 14, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(638, 13, 3, 12, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(639, 13, 3, 55, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(640, 13, 3, 54, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(641, 13, 4, 26, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(642, 13, 4, 33, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(643, 13, 4, 36, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(644, 13, 5, 4, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(645, 13, 5, 37, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(646, 13, 5, 10, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(647, 13, 5, 15, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(648, 13, 5, 13, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(649, 13, 5, 51, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(650, 13, 5, 25, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(651, 13, 5, 20, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(652, 13, 6, 39, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(653, 13, 6, 49, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(654, 13, 6, 50, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(655, 13, 6, 42, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(656, 13, 6, 44, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(657, 13, 6, 43, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800);
INSERT INTO `cms_menuprivileges` (`mnu_acs_id`, `mnu_acs_usr_id_fk`, `mnu_acs_mnu_id_fk`, `mnu_acs_sub_mnu_id_fk`, `mnu_acs_usr_status`, `mnu_acs_add`, `mnu_acs_edit`, `mnu_acs_delete`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(658, 13, 6, 40, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(659, 13, 6, 48, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(660, 13, 6, 31, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(661, 13, 6, 46, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(662, 13, 6, 5, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(663, 13, 7, 47, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(664, 13, 7, 23, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(665, 13, 7, 30, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(666, 13, 7, 34, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(667, 13, 7, 38, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(668, 13, 7, 24, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(669, 13, 9, 2, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(670, 13, 9, 3, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(671, 13, 9, 29, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(672, 13, 13, 45, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(673, 13, 13, 59, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(674, 13, 13, 57, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(675, 13, 13, 52, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(676, 13, 14, 66, 1, 1, 1, 1, '1', 1498539668, 1, 1504853112, 13, 1498501800),
(677, 13, 1, 69, 1, 1, 1, 1, '1', 1498542412, 1, 1504853112, 13, 1498501800),
(678, 13, 1, 70, 1, 1, 1, 1, '1', 1498542412, 1, 1504853112, 13, 1498501800),
(679, 1, 1, 69, 1, 1, 0, 0, '1', 1498543947, 1, 1504503215, 13, 1498501800),
(680, 1, 1, 70, 1, 1, 1, 0, '1', 1498543947, 1, 1504503215, 13, 1498501800),
(681, 3, 1, 68, 1, 0, 0, 0, '1', 1498712245, 1, 1504179720, 13, 1498674600),
(682, 3, 1, 69, 1, 0, 0, 0, '1', 1498712245, 1, 1504179720, 13, 1498674600),
(683, 3, 1, 70, 1, 1, 1, 0, '1', 1498712245, 1, 1504179720, 13, 1498674600),
(684, 6, 1, 68, 1, 0, 0, 0, '1', 1498712414, 1, 1504179805, 13, 1498674600),
(685, 6, 1, 69, 1, 0, 0, 0, '1', 1498712414, 1, 1504179805, 13, 1498674600),
(686, 6, 1, 70, 1, 1, 1, 0, '1', 1498712414, 1, 1504179805, 13, 1498674600),
(687, 4, 1, 68, 1, 0, 0, 0, '1', 1498721409, 1, 1499235684, 13, 1498674600),
(688, 4, 1, 61, 1, 0, 0, 0, '1', 1498721409, 1, 1499235684, 13, 1498674600),
(689, 4, 1, 64, 1, 0, 0, 0, '1', 1498721409, 1, 1499235684, 13, 1498674600),
(690, 4, 1, 67, 1, 0, 0, 0, '1', 1498721409, 1, 1499235684, 13, 1498674600),
(691, 4, 14, 66, 1, 0, 0, 0, '1', 1498721409, 1, 1499235684, 13, 1498674600),
(692, 4, 1, 69, 1, 0, 0, 0, '1', 1498721409, 1, 1499235684, 13, 1498674600),
(693, 4, 1, 70, 1, 0, 0, 0, '1', 1498721409, 1, 1499235684, 13, 1498674600),
(694, 4, 1, 60, 1, 0, 0, 0, '1', 1498721409, 1, 1499235684, 13, 1498674600),
(695, 4, 1, 62, 1, 0, 0, 0, '1', 1498721409, 1, 1499235685, 13, 1498674600),
(696, 4, 1, 63, 1, 0, 0, 0, '1', 1498721409, 1, 1499235685, 13, 1498674600),
(697, 13, 1, 71, 1, 1, 1, 1, '1', 1498804771, 1, 1504853112, 13, 1498761000),
(698, 13, 13, 72, 1, 1, 1, 1, '1', 1498804771, 1, 1504853112, 13, 1498761000),
(699, 1, 1, 71, 1, 1, 1, 0, '1', 1498812114, 1, 1504503215, 13, 1498761000),
(700, 1, 13, 72, 1, 1, 0, 0, '1', 1498812114, 1, 1504503215, 13, 1498761000),
(701, 3, 1, 71, 1, 1, 1, 0, '1', 1498812155, 1, 1504179720, 13, 1498761000),
(702, 3, 13, 72, 1, 1, 0, 0, '1', 1498812155, 1, 1504179720, 13, 1498761000),
(703, 5, 1, 68, 1, 0, 0, 0, '1', 1498812191, 1, 1504179626, 13, 1498761000),
(704, 5, 1, 71, 1, 1, 1, 0, '1', 1498812191, 1, 1504179626, 13, 1498761000),
(705, 5, 13, 72, 1, 0, 0, 0, '1', 1498812191, 1, 1504179626, 13, 1498761000),
(706, 5, 1, 69, 1, 0, 0, 0, '1', 1498812191, 1, 1504179626, 13, 1498761000),
(707, 5, 1, 70, 1, 0, 0, 0, '1', 1498812191, 1, 1504179626, 13, 1498761000),
(708, 6, 1, 71, 1, 1, 1, 0, '1', 1498812220, 1, 1504179805, 13, 1498761000),
(709, 6, 13, 72, 1, 0, 0, 0, '1', 1498812220, 1, 1504179805, 13, 1498761000),
(710, 4, 1, 71, 1, 0, 0, 0, '1', 1498812252, 1, 1499235684, 13, 1498761000),
(711, 4, 13, 72, 1, 1, 0, 0, '1', 1498812252, 1, 1499235684, 13, 1498761000),
(712, 1, 13, 73, 1, 1, 1, 1, '1', 1498817152, 1, 1504503215, 13, 1498761000),
(713, 13, 13, 73, 1, 1, 1, 1, '1', 1498817271, 1, 1504853112, 13, 1498761000),
(714, 1, 13, 74, 1, 1, 1, 0, '1', 1498873939, 1, 1504503215, 13, 1498847400),
(715, 13, 13, 74, 1, 1, 1, 1, '1', 1498873991, 1, 1504853112, 13, 1498847400),
(716, 13, 6, 75, 1, 1, 1, 1, '1', 1499058558, 1, 1504853112, 13, 1499020200),
(717, 6, 6, 75, 1, 0, 0, 0, '1', 1499065151, 1, 1504179805, 13, 1499020200),
(718, 6, 13, 74, 1, 1, 0, 0, '1', 1499065151, 1, 1504179805, 13, 1499020200),
(719, 6, 13, 73, 1, 0, 0, 0, '1', 1499065151, 1, 1504179805, 13, 1499020200),
(720, 1, 6, 75, 1, 0, 0, 0, '1', 1499065313, 1, 1504503215, 13, 1499020200),
(721, 1, 13, 76, 1, 1, 1, 0, '1', 1499141973, 1, 1504503215, 13, 1499106600),
(722, 13, 13, 76, 1, 1, 1, 1, '1', 1499142026, 1, 1504853112, 13, 1499106600),
(723, 13, 13, 77, 1, 1, 1, 1, '1', 1499146899, 1, 1504853112, 13, 1499106600),
(724, 13, 7, 78, 1, 1, 1, 1, '1', 1499220661, 1, 1504853112, 13, 1499193000),
(725, 13, 13, 79, 1, 1, 1, 1, '1', 1499235532, 1, 1504853112, 13, 1499193000),
(726, 1, 13, 77, 1, 1, 0, 0, '1', 1499235558, 1, 1504503215, 13, 1499193000),
(727, 1, 13, 79, 1, 1, 0, 0, '1', 1499235558, 1, 1504503215, 13, 1499193000),
(728, 1, 7, 78, 1, 0, 0, 0, '1', 1499235558, 1, 1504503215, 13, 1499193000),
(729, 3, 13, 77, 1, 0, 1, 0, '1', 1499235591, 1, 1504179720, 13, 1499193000),
(730, 3, 6, 75, 1, 0, 0, 0, '1', 1499235591, 1, 1504179720, 13, 1499193000),
(731, 3, 13, 74, 1, 1, 0, 0, '1', 1499235591, 1, 1504179720, 13, 1499193000),
(732, 3, 13, 76, 1, 1, 0, 0, '1', 1499235591, 1, 1504179720, 13, 1499193000),
(733, 3, 13, 79, 1, 1, 0, 0, '1', 1499235591, 1, 1504179720, 13, 1499193000),
(734, 3, 7, 78, 1, 0, 0, 0, '1', 1499235591, 1, 1504179720, 13, 1499193000),
(735, 3, 13, 73, 1, 1, 0, 0, '1', 1499235591, 1, 1504179720, 13, 1499193000),
(736, 9, 1, 68, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(737, 9, 1, 71, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(738, 9, 1, 61, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(739, 9, 1, 64, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(740, 9, 13, 77, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(741, 9, 1, 67, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(742, 9, 6, 75, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(743, 9, 13, 72, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(744, 9, 14, 66, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(745, 9, 1, 69, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(746, 9, 1, 70, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(747, 9, 1, 60, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(748, 9, 13, 74, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(749, 9, 13, 76, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(750, 9, 13, 79, 1, 1, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(751, 9, 7, 78, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(752, 9, 1, 62, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(753, 9, 13, 73, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(754, 9, 1, 63, 1, 0, 0, 0, '1', 1499235619, 1, 1499235619, 13, 1499193000),
(755, 6, 13, 77, 1, 1, 0, 0, '1', 1499235652, 1, 1504179805, 13, 1499193000),
(756, 6, 13, 76, 1, 1, 0, 0, '1', 1499235652, 1, 1504179805, 13, 1499193000),
(757, 6, 13, 79, 1, 1, 0, 0, '1', 1499235652, 1, 1504179805, 13, 1499193000),
(758, 6, 7, 78, 1, 0, 0, 0, '1', 1499235652, 1, 1504179805, 13, 1499193000),
(759, 4, 13, 77, 1, 0, 0, 0, '1', 1499235684, 1, 1499235684, 13, 1499193000),
(760, 4, 6, 75, 1, 0, 0, 0, '1', 1499235684, 1, 1499235684, 13, 1499193000),
(761, 4, 13, 74, 1, 0, 0, 0, '1', 1499235684, 1, 1499235684, 13, 1499193000),
(762, 4, 13, 76, 1, 0, 0, 0, '1', 1499235684, 1, 1499235684, 13, 1499193000),
(763, 4, 13, 79, 1, 1, 0, 0, '1', 1499235684, 1, 1499235684, 13, 1499193000),
(764, 4, 7, 78, 1, 0, 0, 0, '1', 1499235685, 1, 1499235685, 13, 1499193000),
(765, 4, 13, 73, 1, 0, 0, 0, '1', 1499235685, 1, 1499235685, 13, 1499193000),
(766, 5, 13, 77, 1, 0, 0, 0, '1', 1499235720, 1, 1504179626, 13, 1499193000),
(767, 5, 6, 75, 1, 0, 0, 0, '1', 1499235720, 1, 1504179626, 13, 1499193000),
(768, 5, 13, 74, 1, 0, 0, 0, '1', 1499235720, 1, 1504179626, 13, 1499193000),
(769, 5, 13, 76, 1, 0, 0, 0, '1', 1499235720, 1, 1504179626, 13, 1499193000),
(770, 5, 13, 79, 1, 1, 0, 0, '1', 1499235720, 1, 1504179626, 13, 1499193000),
(771, 5, 7, 78, 1, 0, 0, 0, '1', 1499235720, 1, 1504179626, 13, 1499193000),
(772, 5, 13, 73, 1, 1, 0, 0, '1', 1499235720, 1, 1504179626, 13, 1499193000),
(773, 13, 13, 80, 1, 1, 1, 1, '1', 1500517970, 1, 1504853112, 13, 1500489000),
(774, 1, 13, 80, 1, 1, 0, 0, '1', 1500520156, 1, 1504503215, 13, 1500489000),
(775, 6, 13, 80, 1, 1, 0, 0, '1', 1501065233, 1, 1504179805, 13, 1501007400),
(776, 5, 13, 80, 1, 0, 0, 0, '1', 1501065321, 1, 1504179626, 13, 1501007400),
(777, 13, 13, 81, 1, 1, 0, 0, '1', 1501307548, 1, 1504853112, 13, 1501266600),
(778, 1, 13, 81, 1, 1, 0, 0, '1', 1501307577, 1, 1504503215, 13, 1501266600),
(779, 3, 13, 80, 1, 0, 1, 0, '1', 1501410253, 1, 1504179720, 13, 1501353000),
(780, 3, 13, 81, 1, 0, 1, 0, '1', 1501410253, 1, 1504179720, 13, 1501353000),
(781, 13, 15, 82, 1, 1, 0, 0, '1', 1502260099, 1, 1504853112, 13, 1502217000),
(782, 1, 15, 82, 1, 1, 0, 0, '1', 1502260618, 1, 1504503215, 13, 1502217000),
(783, 13, 15, 83, 1, 1, 0, 0, '1', 1502279959, 1, 1504853112, 13, 1502217000),
(784, 13, 15, 84, 1, 1, 1, 1, '1', 1502859283, 1, 1504853112, 13, 1502821800),
(785, 1, 15, 84, 1, 1, 0, 0, '1', 1502859343, 1, 1504503215, 13, 1502821800),
(786, 1, 15, 83, 1, 1, 0, 0, '1', 1502859343, 1, 1504503215, 13, 1502821800),
(787, 1, 15, 86, 1, 1, 0, 0, '1', 1502864064, 1, 1504503215, 13, 1502821800),
(788, 1, 15, 85, 1, 1, 0, 0, '1', 1502864064, 1, 1504503215, 13, 1502821800),
(789, 13, 15, 86, 1, 1, 0, 0, '1', 1502864183, 1, 1504853112, 13, 1502821800),
(790, 13, 15, 85, 1, 1, 0, 0, '1', 1502864183, 1, 1504853112, 13, 1502821800),
(791, 13, 13, 87, 1, 1, 0, 0, '1', 1502879988, 1, 1504853112, 13, 1502821800),
(792, 13, 4, 28, 1, 0, 0, 0, '1', 1502879988, 1, 1504853112, 13, 1502821800),
(793, 13, 4, 65, 1, 0, 0, 0, '1', 1502879988, 1, 1504853112, 13, 1502821800),
(794, 3, 13, 82, 1, 0, 0, 0, '1', 1503129750, 1, 1504179720, 13, 1503081000),
(795, 3, 13, 87, 1, 1, 0, 0, '1', 1503129750, 1, 1504179720, 13, 1503081000),
(796, 3, 13, 86, 1, 1, 0, 0, '1', 1503129750, 1, 1504179720, 13, 1503081000),
(797, 3, 13, 83, 1, 1, 0, 0, '1', 1503129750, 1, 1504179720, 13, 1503081000),
(798, 3, 13, 85, 1, 1, 0, 0, '1', 1503129750, 1, 1504179720, 13, 1503081000),
(799, 13, 13, 88, 1, 1, 0, 0, '1', 1503398050, 1, 1504853112, 13, 1503340200),
(800, 3, 13, 84, 1, 0, 0, 0, '1', 1504179571, 1, 1504179720, 13, 1504117800),
(801, 3, 13, 88, 1, 0, 0, 0, '1', 1504179572, 1, 1504179720, 13, 1504117800),
(802, 3, 4, 65, 1, 0, 0, 0, '1', 1504179572, 1, 1504179720, 13, 1504117800),
(803, 6, 13, 81, 1, 0, 0, 0, '1', 1504179594, 1, 1504179805, 13, 1504117800),
(804, 6, 13, 84, 1, 0, 0, 0, '1', 1504179594, 1, 1504179805, 13, 1504117800),
(805, 6, 13, 82, 1, 0, 0, 0, '1', 1504179594, 1, 1504179805, 13, 1504117800),
(806, 6, 13, 87, 1, 0, 0, 0, '1', 1504179594, 1, 1504179805, 13, 1504117800),
(807, 6, 13, 86, 1, 0, 0, 0, '1', 1504179594, 1, 1504179805, 13, 1504117800),
(808, 6, 13, 88, 1, 0, 0, 0, '1', 1504179594, 1, 1504179805, 13, 1504117800),
(809, 6, 13, 83, 1, 0, 0, 0, '1', 1504179594, 1, 1504179805, 13, 1504117800),
(810, 6, 13, 85, 1, 0, 0, 0, '1', 1504179594, 1, 1504179805, 13, 1504117800),
(811, 5, 13, 81, 1, 0, 0, 0, '1', 1504179626, 1, 1504179626, 13, 1504117800),
(812, 5, 13, 84, 1, 0, 0, 0, '1', 1504179626, 1, 1504179626, 13, 1504117800),
(813, 5, 13, 82, 1, 0, 0, 0, '1', 1504179626, 1, 1504179626, 13, 1504117800),
(814, 5, 13, 87, 1, 0, 0, 0, '1', 1504179626, 1, 1504179626, 13, 1504117800),
(815, 5, 13, 86, 1, 0, 0, 0, '1', 1504179626, 1, 1504179626, 13, 1504117800),
(816, 5, 13, 88, 1, 0, 0, 0, '1', 1504179626, 1, 1504179626, 13, 1504117800),
(817, 5, 13, 83, 1, 0, 0, 0, '1', 1504179626, 1, 1504179626, 13, 1504117800),
(818, 5, 13, 85, 1, 0, 0, 0, '1', 1504179626, 1, 1504179626, 13, 1504117800),
(819, 1, 13, 87, 1, 0, 0, 0, '1', 1504503215, 1, 1504503215, 13, 1504463400),
(820, 1, 13, 88, 1, 0, 0, 0, '1', 1504503215, 1, 1504503215, 13, 1504463400),
(821, 1, 15, 89, 1, 0, 0, 0, '1', 1504503215, 1, 1504503215, 13, 1504463400),
(822, 13, 15, 89, 1, 1, 0, 0, '1', 1504503283, 1, 1504853112, 13, 1504463400),
(823, 13, 15, 90, 1, 1, 0, 0, '1', 1504524105, 1, 1504853112, 13, 1504463400),
(824, 13, 13, 91, 1, 1, 0, 0, '1', 1504681975, 1, 1504853112, 13, 1504636200),
(825, 13, 13, 92, 1, 1, 0, 0, '1', 1504853112, 1, 1504853112, 13, 1504809000);

--
-- Triggers `cms_menuprivileges`
--
DROP TRIGGER IF EXISTS `trig_cms_menuprivileges_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_menuprivileges_DELETE` BEFORE DELETE ON `cms_menuprivileges`
 FOR EACH ROW BEGIN
set @oldVal='';
set @newVal='';
set @chdCol='';
set @id=OLD.mnu_acs_id;
set @userid=OLD.update_user;

if  OLD.mnu_acs_id !="" OR OLD.mnu_acs_id is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_id);

	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_id');
end if;

if  OLD.mnu_acs_usr_id_fk !="" OR OLD.mnu_acs_usr_id_fk is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_usr_id_fk);

	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_usr_id_fk');
end if;

if  OLD.mnu_acs_mnu_id_fk !="" OR OLD.mnu_acs_mnu_id_fk is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_mnu_id_fk);

	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_mnu_id_fk');
end if;

if  OLD.mnu_acs_sub_mnu_id_fk !="" OR OLD.mnu_acs_sub_mnu_id_fk is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_sub_mnu_id_fk);

	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_sub_mnu_id_fk');
end if;

if  OLD.mnu_acs_usr_status !="" OR OLD.mnu_acs_usr_status is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_usr_status);

	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_usr_status');
end if;

if  OLD.mnu_acs_add !="" OR OLD.mnu_acs_add is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_add);

	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_add');
end if;

if  OLD.mnu_acs_edit !="" OR OLD.mnu_acs_edit is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_edit);

	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_edit');
end if;

if  OLD.mnu_acs_delete !="" OR OLD.mnu_acs_delete is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_delete);

	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_delete');
end if;

if  OLD.status !="" OR OLD.status is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @chdCol=CONCAT(@chdCol,'-','status');
end if;

if  OLD.create_time !="" OR OLD.create_time is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');
end if;

if  OLD.create_user !="" OR OLD.create_user is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');
end if;

if  OLD.update_time !="" OR OLD.update_time is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');
end if;

if  OLD.update_user !="" OR OLD.update_user is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');
end if;

if  OLD.record_date !="" OR OLD.record_date is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');
end if;



INSERT INTO mirror_iccplus.cms_menuprivileges(mnu_acs_usr_id_fk,mnu_acs_mnu_id_fk,mnu_acs_sub_mnu_id_fk,mnu_acs_usr_status,mnu_acs_add,mnu_acs_edit,mnu_acs_delete,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.mnu_acs_usr_id_fk,OLD.mnu_acs_mnu_id_fk,OLD.mnu_acs_sub_mnu_id_fk,OLD.mnu_acs_usr_status,OLD.mnu_acs_add,OLD.mnu_acs_edit,OLD.mnu_acs_delete,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);

 
INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_menuprivileges', NOW(),'d',@id,@userid,@oldVal,@newVal,'');

END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_menuprivileges_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_menuprivileges_INSERT` AFTER INSERT ON `cms_menuprivileges`
 FOR EACH ROW BEGIN
set @oldVal='';
set @newVal='';
set @chdCol='';
set @id=NEW.mnu_acs_id;
set @userid=NEW.create_user;

set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_id);
set @chdCol=CONCAT(@chdCol,'-','mnu_acs_id');
set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_usr_id_fk);
set @chdCol=CONCAT(@chdCol,'-','mnu_acs_usr_id_fk');
set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_mnu_id_fk);
set @chdCol=CONCAT(@chdCol,'-','mnu_acs_mnu_id_fk');
set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_sub_mnu_id_fk);
set @chdCol=CONCAT(@chdCol,'-','mnu_acs_sub_mnu_id_fk');
set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_usr_status);
set @chdCol=CONCAT(@chdCol,'-','mnu_acs_usr_status');
set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_add);
set @chdCol=CONCAT(@chdCol,'-','mnu_acs_add');
set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_edit);
set @chdCol=CONCAT(@chdCol,'-','mnu_acs_edit');
set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_delete);
set @chdCol=CONCAT(@chdCol,'-','mnu_acs_delete');
set @newVal =CONCAT(@newVal,'-', NEW.status);
set @chdCol=CONCAT(@chdCol,'-','status');
set @newVal =CONCAT(@newVal,'-', NEW.create_time);
set @chdCol=CONCAT(@chdCol,'-','create_time');
set @newVal =CONCAT(@newVal,'-', NEW.create_user);
set @chdCol=CONCAT(@chdCol,'-','create_user');
set @newVal =CONCAT(@newVal,'-', NEW.update_time);
set @chdCol=CONCAT(@chdCol,'-','update_time');
set @newVal =CONCAT(@newVal,'-', NEW.update_user);
set @chdCol=CONCAT(@chdCol,'-','update_user');
set @newVal =CONCAT(@newVal,'-', NEW.record_date);
set @chdCol=CONCAT(@chdCol,'-','record_date');


INSERT INTO mirror_iccplus.cms_menuprivileges(mnu_acs_usr_id_fk,mnu_acs_mnu_id_fk,mnu_acs_sub_mnu_id_fk,mnu_acs_usr_status,mnu_acs_add,mnu_acs_edit,mnu_acs_delete,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.mnu_acs_usr_id_fk,NEW.mnu_acs_mnu_id_fk,NEW.mnu_acs_sub_mnu_id_fk,NEW.mnu_acs_usr_status,NEW.mnu_acs_add,NEW.mnu_acs_edit,NEW.mnu_acs_delete,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);


INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_menuprivileges', NOW(),'i',@id,@userid,@oldVal,@newVal,'');

END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_menuprivileges_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_menuprivileges_UPDATE` BEFORE UPDATE ON `cms_menuprivileges`
 FOR EACH ROW BEGIN
set @oldVal='';
set @newVal='';
set @chdCol='';
set @id=NEW.mnu_acs_id;
set @userid=NEW.update_user;

if  OLD.mnu_acs_id != NEW.mnu_acs_id
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_id);
	set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_id);
	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_id');
end if;

if  OLD.mnu_acs_usr_id_fk != NEW.mnu_acs_usr_id_fk
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_usr_id_fk);
	set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_usr_id_fk);
	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_usr_id_fk');
end if;

if  OLD.mnu_acs_mnu_id_fk != NEW.mnu_acs_mnu_id_fk
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_mnu_id_fk);
	set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_mnu_id_fk);
	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_mnu_id_fk');
end if;

if  OLD.mnu_acs_sub_mnu_id_fk != NEW.mnu_acs_sub_mnu_id_fk
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_sub_mnu_id_fk);
	set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_sub_mnu_id_fk);
	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_sub_mnu_id_fk');
end if;

if  OLD.mnu_acs_usr_status != NEW.mnu_acs_usr_status
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_usr_status);
	set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_usr_status);
	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_usr_status');
end if;

if  OLD.mnu_acs_add != NEW.mnu_acs_add
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_add);
	set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_add);
	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_add');
end if;

if  OLD.mnu_acs_edit != NEW.mnu_acs_edit
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_edit);
	set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_edit);
	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_edit');
end if;

if  OLD.mnu_acs_delete != NEW.mnu_acs_delete
then
	set @oldval =CONCAT(@oldVal,'-',OLD.mnu_acs_delete);
	set @newVal =CONCAT(@newVal,'-', NEW.mnu_acs_delete);
	set @chdCol=CONCAT(@chdCol,'-','mnu_acs_delete');
end if;

if  OLD.status != NEW.status
then
	set @oldval =CONCAT(@oldVal,'-',OLD.status);
	set @newVal =CONCAT(@newVal,'-', NEW.status);
	set @chdCol=CONCAT(@chdCol,'-','status');
end if;

if  OLD.create_time != NEW.create_time
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);
	set @newVal =CONCAT(@newVal,'-', NEW.create_time);
	set @chdCol=CONCAT(@chdCol,'-','create_time');
end if;

if  OLD.create_user != NEW.create_user
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);
	set @newVal =CONCAT(@newVal,'-', NEW.create_user);
	set @chdCol=CONCAT(@chdCol,'-','create_user');
end if;

if  OLD.update_time != NEW.update_time
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);
	set @newVal =CONCAT(@newVal,'-', NEW.update_time);
	set @chdCol=CONCAT(@chdCol,'-','update_time');
end if;

if  OLD.update_user != NEW.update_user
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);
	set @newVal =CONCAT(@newVal,'-', NEW.update_user);
	set @chdCol=CONCAT(@chdCol,'-','update_user');
end if;

if  OLD.record_date != NEW.record_date
then
	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);
	set @newVal =CONCAT(@newVal,'-', NEW.record_date);
	set @chdCol=CONCAT(@chdCol,'-','record_date');
end if;



INSERT INTO mirror_iccplus.cms_menuprivileges(mnu_acs_usr_id_fk,mnu_acs_mnu_id_fk,mnu_acs_sub_mnu_id_fk,mnu_acs_usr_status,mnu_acs_add,mnu_acs_edit,mnu_acs_delete,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.mnu_acs_usr_id_fk,NEW.mnu_acs_mnu_id_fk,NEW.mnu_acs_sub_mnu_id_fk,NEW.mnu_acs_usr_status,NEW.mnu_acs_add,NEW.mnu_acs_edit,NEW.mnu_acs_delete,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);


INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_menuprivileges', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);

END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_mobilenumbers`
--

DROP TABLE IF EXISTS `cms_mobilenumbers`;
CREATE TABLE IF NOT EXISTS `cms_mobilenumbers` (
  `mobile_id` int(11) NOT NULL AUTO_INCREMENT,
  `mobile_part_id` varchar(11) NOT NULL,
  `mobile_q1` varchar(11) NOT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`mobile_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_mobilenumbers`
--
DROP TRIGGER IF EXISTS `trig_cms_mobilenumbers_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_mobilenumbers_DELETE` BEFORE DELETE ON `cms_mobilenumbers`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.mobile_id;

set @userid='';



if  OLD.mobile_id !="" OR OLD.mobile_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mobile_id);



	set @chdCol=CONCAT(@chdCol,'-','mobile_id');

end if;



if  OLD.mobile_part_id !="" OR OLD.mobile_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mobile_part_id);



	set @chdCol=CONCAT(@chdCol,'-','mobile_part_id');

end if;



if  OLD.mobile_q1 !="" OR OLD.mobile_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mobile_q1);



	set @chdCol=CONCAT(@chdCol,'-','mobile_q1');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_mobilenumbers(mobile_part_id,mobile_q1,record_date) VALUES(OLD.mobile_part_id,OLD.mobile_q1,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_mobilenumbers', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_mobilenumbers_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_mobilenumbers_INSERT` AFTER INSERT ON `cms_mobilenumbers`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.mobile_id;

set @userid='';



set @newVal =CONCAT(@newVal,'-', NEW.mobile_id);

set @chdCol=CONCAT(@chdCol,'-','mobile_id');

set @newVal =CONCAT(@newVal,'-', NEW.mobile_part_id);

set @chdCol=CONCAT(@chdCol,'-','mobile_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.mobile_q1);

set @chdCol=CONCAT(@chdCol,'-','mobile_q1');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_mobilenumbers(mobile_part_id,mobile_q1,record_date) VALUES(NEW.mobile_part_id,NEW.mobile_q1,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_mobilenumbers', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_mobilenumbers_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_mobilenumbers_UPDATE` BEFORE UPDATE ON `cms_mobilenumbers`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.mobile_id;

set @userid='';



if  OLD.mobile_id != NEW.mobile_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mobile_id);

	set @newVal =CONCAT(@newVal,'-', NEW.mobile_id);

	set @chdCol=CONCAT(@chdCol,'-','mobile_id');

end if;



if  OLD.mobile_part_id != NEW.mobile_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mobile_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.mobile_part_id);

	set @chdCol=CONCAT(@chdCol,'-','mobile_part_id');

end if;



if  OLD.mobile_q1 != NEW.mobile_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mobile_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.mobile_q1);

	set @chdCol=CONCAT(@chdCol,'-','mobile_q1');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_mobilenumbers(mobile_part_id,mobile_q1,record_date) VALUES(NEW.mobile_part_id,NEW.mobile_q1,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_mobilenumbers', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_mortalityform`
--

DROP TABLE IF EXISTS `cms_mortalityform`;
CREATE TABLE IF NOT EXISTS `cms_mortalityform` (
  `mortality_form_id` int(11) NOT NULL AUTO_INCREMENT,
  `mortality_form_survey` varchar(11) NOT NULL,
  `mortality_form_loc` varchar(11) NOT NULL,
  `mortality_form_part_id` varchar(11) NOT NULL,
  `mortality_form_q1` varchar(100) NOT NULL,
  `mortality_form_q2` varchar(100) NOT NULL,
  `mortality_form_q3` int(11) DEFAULT NULL,
  `mortality_form_q4` int(11) NOT NULL,
  `mortality_form_q5` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`mortality_form_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_mortalityform`
--
DROP TRIGGER IF EXISTS `trig_cms_mortalityform_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_mortalityform_DELETE` BEFORE DELETE ON `cms_mortalityform`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.mortality_form_id;

set @userid=OLD.update_user;



if  OLD.mortality_form_id !="" OR OLD.mortality_form_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_id);



	set @chdCol=CONCAT(@chdCol,'-','mortality_form_id');

end if;



if  OLD.mortality_form_survey !="" OR OLD.mortality_form_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_survey);



	set @chdCol=CONCAT(@chdCol,'-','mortality_form_survey');

end if;



if  OLD.mortality_form_loc !="" OR OLD.mortality_form_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_loc);



	set @chdCol=CONCAT(@chdCol,'-','mortality_form_loc');

end if;



if  OLD.mortality_form_part_id !="" OR OLD.mortality_form_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_part_id);



	set @chdCol=CONCAT(@chdCol,'-','mortality_form_part_id');

end if;



if  OLD.mortality_form_q1 !="" OR OLD.mortality_form_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_q1);



	set @chdCol=CONCAT(@chdCol,'-','mortality_form_q1');

end if;



if  OLD.mortality_form_q2 !="" OR OLD.mortality_form_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_q2);



	set @chdCol=CONCAT(@chdCol,'-','mortality_form_q2');

end if;



if  OLD.mortality_form_q3 !="" OR OLD.mortality_form_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_q3);



	set @chdCol=CONCAT(@chdCol,'-','mortality_form_q3');

end if;



if  OLD.mortality_form_q4 !="" OR OLD.mortality_form_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_q4);



	set @chdCol=CONCAT(@chdCol,'-','mortality_form_q4');

end if;



if  OLD.mortality_form_q5 !="" OR OLD.mortality_form_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_q5);



	set @chdCol=CONCAT(@chdCol,'-','mortality_form_q5');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_mortalityform(mortality_form_survey,mortality_form_loc,mortality_form_part_id,mortality_form_q1,mortality_form_q2,mortality_form_q3,mortality_form_q4,mortality_form_q5,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.mortality_form_survey,OLD.mortality_form_loc,OLD.mortality_form_part_id,OLD.mortality_form_q1,OLD.mortality_form_q2,OLD.mortality_form_q3,OLD.mortality_form_q4,OLD.mortality_form_q5,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_mortalityform', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_mortalityform_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_mortalityform_INSERT` AFTER INSERT ON `cms_mortalityform`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.mortality_form_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_id);

set @chdCol=CONCAT(@chdCol,'-','mortality_form_id');

set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_survey);

set @chdCol=CONCAT(@chdCol,'-','mortality_form_survey');

set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_loc);

set @chdCol=CONCAT(@chdCol,'-','mortality_form_loc');

set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_part_id);

set @chdCol=CONCAT(@chdCol,'-','mortality_form_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_q1);

set @chdCol=CONCAT(@chdCol,'-','mortality_form_q1');

set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_q2);

set @chdCol=CONCAT(@chdCol,'-','mortality_form_q2');

set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_q3);

set @chdCol=CONCAT(@chdCol,'-','mortality_form_q3');

set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_q4);

set @chdCol=CONCAT(@chdCol,'-','mortality_form_q4');

set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_q5);

set @chdCol=CONCAT(@chdCol,'-','mortality_form_q5');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_mortalityform(mortality_form_survey,mortality_form_loc,mortality_form_part_id,mortality_form_q1,mortality_form_q2,mortality_form_q3,mortality_form_q4,mortality_form_q5,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.mortality_form_survey,NEW.mortality_form_loc,NEW.mortality_form_part_id,NEW.mortality_form_q1,NEW.mortality_form_q2,NEW.mortality_form_q3,NEW.mortality_form_q4,NEW.mortality_form_q5,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_mortalityform', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_mortalityform_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_mortalityform_UPDATE` BEFORE UPDATE ON `cms_mortalityform`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.mortality_form_id;

set @userid=NEW.update_user;



if  OLD.mortality_form_id != NEW.mortality_form_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_id);

	set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_id);

	set @chdCol=CONCAT(@chdCol,'-','mortality_form_id');

end if;



if  OLD.mortality_form_survey != NEW.mortality_form_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_survey);

	set @chdCol=CONCAT(@chdCol,'-','mortality_form_survey');

end if;



if  OLD.mortality_form_loc != NEW.mortality_form_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_loc);

	set @chdCol=CONCAT(@chdCol,'-','mortality_form_loc');

end if;



if  OLD.mortality_form_part_id != NEW.mortality_form_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_part_id);

	set @chdCol=CONCAT(@chdCol,'-','mortality_form_part_id');

end if;



if  OLD.mortality_form_q1 != NEW.mortality_form_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_q1);

	set @chdCol=CONCAT(@chdCol,'-','mortality_form_q1');

end if;



if  OLD.mortality_form_q2 != NEW.mortality_form_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_q2);

	set @chdCol=CONCAT(@chdCol,'-','mortality_form_q2');

end if;



if  OLD.mortality_form_q3 != NEW.mortality_form_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_q3);

	set @chdCol=CONCAT(@chdCol,'-','mortality_form_q3');

end if;



if  OLD.mortality_form_q4 != NEW.mortality_form_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_q4);

	set @chdCol=CONCAT(@chdCol,'-','mortality_form_q4');

end if;



if  OLD.mortality_form_q5 != NEW.mortality_form_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mortality_form_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.mortality_form_q5);

	set @chdCol=CONCAT(@chdCol,'-','mortality_form_q5');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_mortalityform(mortality_form_survey,mortality_form_loc,mortality_form_part_id,mortality_form_q1,mortality_form_q2,mortality_form_q3,mortality_form_q4,mortality_form_q5,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.mortality_form_survey,NEW.mortality_form_loc,NEW.mortality_form_part_id,NEW.mortality_form_q1,NEW.mortality_form_q2,NEW.mortality_form_q3,NEW.mortality_form_q4,NEW.mortality_form_q5,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_mortalityform', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_motincenmaster`
--

DROP TABLE IF EXISTS `cms_motincenmaster`;
CREATE TABLE IF NOT EXISTS `cms_motincenmaster` (
  `mot_inc_id` int(11) NOT NULL AUTO_INCREMENT,
  `mot_inc_survey` varchar(11) NOT NULL COMMENT 'Survey',
  `mot_inc_part_id` varchar(11) NOT NULL COMMENT 'ICC Client ID',
  `mot_inc_visitdate` int(11) NOT NULL COMMENT 'Visit Date',
  `mot_inc_q1` int(11) DEFAULT NULL COMMENT 'Payment Status',
  `mot_inc_q2` int(11) NOT NULL COMMENT 'Amount',
  `mot_inc_q3` int(11) DEFAULT NULL COMMENT 'Paid Date',
  `mot_inc_q4` varchar(50) DEFAULT NULL COMMENT 'Voucher Number',
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`mot_inc_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_motincenmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_motincenmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_motincenmaster_DELETE` BEFORE DELETE ON `cms_motincenmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.mot_inc_id;

set @userid=OLD.update_user;



if  OLD.mot_inc_id !="" OR OLD.mot_inc_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_id);



	set @chdCol=CONCAT(@chdCol,'-','mot_inc_id');

end if;



if  OLD.mot_inc_survey !="" OR OLD.mot_inc_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_survey);



	set @chdCol=CONCAT(@chdCol,'-','mot_inc_survey');

end if;



if  OLD.mot_inc_part_id !="" OR OLD.mot_inc_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_part_id);



	set @chdCol=CONCAT(@chdCol,'-','mot_inc_part_id');

end if;



if  OLD.mot_inc_visitdate !="" OR OLD.mot_inc_visitdate is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_visitdate);



	set @chdCol=CONCAT(@chdCol,'-','mot_inc_visitdate');

end if;



if  OLD.mot_inc_q1 !="" OR OLD.mot_inc_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_q1);



	set @chdCol=CONCAT(@chdCol,'-','mot_inc_q1');

end if;



if  OLD.mot_inc_q2 !="" OR OLD.mot_inc_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_q2);



	set @chdCol=CONCAT(@chdCol,'-','mot_inc_q2');

end if;



if  OLD.mot_inc_q3 !="" OR OLD.mot_inc_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_q3);



	set @chdCol=CONCAT(@chdCol,'-','mot_inc_q3');

end if;



if  OLD.mot_inc_q4 !="" OR OLD.mot_inc_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_q4);



	set @chdCol=CONCAT(@chdCol,'-','mot_inc_q4');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_motincenmaster(mot_inc_survey,mot_inc_part_id,mot_inc_visitdate,mot_inc_q1,mot_inc_q2,mot_inc_q3,mot_inc_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.mot_inc_survey,OLD.mot_inc_part_id,OLD.mot_inc_visitdate,OLD.mot_inc_q1,OLD.mot_inc_q2,OLD.mot_inc_q3,OLD.mot_inc_q4,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_motincenmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_motincenmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_motincenmaster_INSERT` AFTER INSERT ON `cms_motincenmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.mot_inc_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_id);

set @chdCol=CONCAT(@chdCol,'-','mot_inc_id');

set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_survey);

set @chdCol=CONCAT(@chdCol,'-','mot_inc_survey');

set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_part_id);

set @chdCol=CONCAT(@chdCol,'-','mot_inc_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_visitdate);

set @chdCol=CONCAT(@chdCol,'-','mot_inc_visitdate');

set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_q1);

set @chdCol=CONCAT(@chdCol,'-','mot_inc_q1');

set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_q2);

set @chdCol=CONCAT(@chdCol,'-','mot_inc_q2');

set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_q3);

set @chdCol=CONCAT(@chdCol,'-','mot_inc_q3');

set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_q4);

set @chdCol=CONCAT(@chdCol,'-','mot_inc_q4');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_motincenmaster(mot_inc_survey,mot_inc_part_id,mot_inc_visitdate,mot_inc_q1,mot_inc_q2,mot_inc_q3,mot_inc_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.mot_inc_survey,NEW.mot_inc_part_id,NEW.mot_inc_visitdate,NEW.mot_inc_q1,NEW.mot_inc_q2,NEW.mot_inc_q3,NEW.mot_inc_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_motincenmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_motincenmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_motincenmaster_UPDATE` BEFORE UPDATE ON `cms_motincenmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.mot_inc_id;

set @userid=NEW.update_user;



if  OLD.mot_inc_id != NEW.mot_inc_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_id);

	set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_id);

	set @chdCol=CONCAT(@chdCol,'-','mot_inc_id');

end if;



if  OLD.mot_inc_survey != NEW.mot_inc_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_survey);

	set @chdCol=CONCAT(@chdCol,'-','mot_inc_survey');

end if;



if  OLD.mot_inc_part_id != NEW.mot_inc_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_part_id);

	set @chdCol=CONCAT(@chdCol,'-','mot_inc_part_id');

end if;



if  OLD.mot_inc_visitdate != NEW.mot_inc_visitdate

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_visitdate);

	set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_visitdate);

	set @chdCol=CONCAT(@chdCol,'-','mot_inc_visitdate');

end if;



if  OLD.mot_inc_q1 != NEW.mot_inc_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_q1);

	set @chdCol=CONCAT(@chdCol,'-','mot_inc_q1');

end if;



if  OLD.mot_inc_q2 != NEW.mot_inc_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_q2);

	set @chdCol=CONCAT(@chdCol,'-','mot_inc_q2');

end if;



if  OLD.mot_inc_q3 != NEW.mot_inc_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_q3);

	set @chdCol=CONCAT(@chdCol,'-','mot_inc_q3');

end if;



if  OLD.mot_inc_q4 != NEW.mot_inc_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mot_inc_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.mot_inc_q4);

	set @chdCol=CONCAT(@chdCol,'-','mot_inc_q4');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_motincenmaster(mot_inc_survey,mot_inc_part_id,mot_inc_visitdate,mot_inc_q1,mot_inc_q2,mot_inc_q3,mot_inc_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.mot_inc_survey,NEW.mot_inc_part_id,NEW.mot_inc_visitdate,NEW.mot_inc_q1,NEW.mot_inc_q2,NEW.mot_inc_q3,NEW.mot_inc_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_motincenmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_nursevisit`
--

DROP TABLE IF EXISTS `cms_nursevisit`;
CREATE TABLE IF NOT EXISTS `cms_nursevisit` (
  `nursefrm_id` int(11) NOT NULL AUTO_INCREMENT,
  `nursefrm_sid` varchar(100) NOT NULL,
  `nursefrm_loc` varchar(11) NOT NULL,
  `nursefrm_pid` varchar(100) NOT NULL,
  `nursefrm_q1` varchar(100) DEFAULT NULL,
  `nursefrm_q2` varchar(100) DEFAULT NULL,
  `nursefrm_q3_no_needle` int(11) DEFAULT NULL,
  `nursefrm_q4_no_condom` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`nursefrm_id`),
  KEY `nursefrm_pid` (`nursefrm_pid`),
  KEY `nursefrm_pid_2` (`nursefrm_pid`),
  KEY `nursefrm_pid_3` (`nursefrm_pid`),
  KEY `nursefrm_pid_4` (`nursefrm_pid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_nursevisit`
--
DROP TRIGGER IF EXISTS `trig_cms_nursevisit_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_nursevisit_DELETE` BEFORE DELETE ON `cms_nursevisit`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.nursefrm_id;

set @userid=OLD.update_user;



if  OLD.nursefrm_id !="" OR OLD.nursefrm_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_id);



	set @chdCol=CONCAT(@chdCol,'-','nursefrm_id');

end if;



if  OLD.nursefrm_sid !="" OR OLD.nursefrm_sid is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_sid);



	set @chdCol=CONCAT(@chdCol,'-','nursefrm_sid');

end if;



if  OLD.nursefrm_loc !="" OR OLD.nursefrm_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_loc);



	set @chdCol=CONCAT(@chdCol,'-','nursefrm_loc');

end if;



if  OLD.nursefrm_pid !="" OR OLD.nursefrm_pid is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_pid);



	set @chdCol=CONCAT(@chdCol,'-','nursefrm_pid');

end if;



if  OLD.nursefrm_q1 !="" OR OLD.nursefrm_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_q1);



	set @chdCol=CONCAT(@chdCol,'-','nursefrm_q1');

end if;



if  OLD.nursefrm_q2 !="" OR OLD.nursefrm_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_q2);



	set @chdCol=CONCAT(@chdCol,'-','nursefrm_q2');

end if;



if  OLD.nursefrm_q3_no_needle !="" OR OLD.nursefrm_q3_no_needle is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_q3_no_needle);



	set @chdCol=CONCAT(@chdCol,'-','nursefrm_q3_no_needle');

end if;



if  OLD.nursefrm_q4_no_condom !="" OR OLD.nursefrm_q4_no_condom is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_q4_no_condom);



	set @chdCol=CONCAT(@chdCol,'-','nursefrm_q4_no_condom');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_nursevisit(nursefrm_sid,nursefrm_loc,nursefrm_pid,nursefrm_q1,nursefrm_q2,nursefrm_q3_no_needle,nursefrm_q4_no_condom,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.nursefrm_sid,OLD.nursefrm_loc,OLD.nursefrm_pid,OLD.nursefrm_q1,OLD.nursefrm_q2,OLD.nursefrm_q3_no_needle,OLD.nursefrm_q4_no_condom,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_nursevisit', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_nursevisit_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_nursevisit_INSERT` AFTER INSERT ON `cms_nursevisit`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.nursefrm_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_id);

set @chdCol=CONCAT(@chdCol,'-','nursefrm_id');

set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_sid);

set @chdCol=CONCAT(@chdCol,'-','nursefrm_sid');

set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_loc);

set @chdCol=CONCAT(@chdCol,'-','nursefrm_loc');

set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_pid);

set @chdCol=CONCAT(@chdCol,'-','nursefrm_pid');

set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_q1);

set @chdCol=CONCAT(@chdCol,'-','nursefrm_q1');

set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_q2);

set @chdCol=CONCAT(@chdCol,'-','nursefrm_q2');

set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_q3_no_needle);

set @chdCol=CONCAT(@chdCol,'-','nursefrm_q3_no_needle');

set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_q4_no_condom);

set @chdCol=CONCAT(@chdCol,'-','nursefrm_q4_no_condom');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_nursevisit(nursefrm_sid,nursefrm_loc,nursefrm_pid,nursefrm_q1,nursefrm_q2,nursefrm_q3_no_needle,nursefrm_q4_no_condom,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.nursefrm_sid,NEW.nursefrm_loc,NEW.nursefrm_pid,NEW.nursefrm_q1,NEW.nursefrm_q2,NEW.nursefrm_q3_no_needle,NEW.nursefrm_q4_no_condom,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_nursevisit', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_nursevisit_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_nursevisit_UPDATE` BEFORE UPDATE ON `cms_nursevisit`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.nursefrm_id;

set @userid=NEW.update_user;



if  OLD.nursefrm_id != NEW.nursefrm_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_id);

	set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_id);

	set @chdCol=CONCAT(@chdCol,'-','nursefrm_id');

end if;



if  OLD.nursefrm_sid != NEW.nursefrm_sid

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_sid);

	set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_sid);

	set @chdCol=CONCAT(@chdCol,'-','nursefrm_sid');

end if;



if  OLD.nursefrm_loc != NEW.nursefrm_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_loc);

	set @chdCol=CONCAT(@chdCol,'-','nursefrm_loc');

end if;



if  OLD.nursefrm_pid != NEW.nursefrm_pid

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_pid);

	set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_pid);

	set @chdCol=CONCAT(@chdCol,'-','nursefrm_pid');

end if;



if  OLD.nursefrm_q1 != NEW.nursefrm_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_q1);

	set @chdCol=CONCAT(@chdCol,'-','nursefrm_q1');

end if;



if  OLD.nursefrm_q2 != NEW.nursefrm_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_q2);

	set @chdCol=CONCAT(@chdCol,'-','nursefrm_q2');

end if;



if  OLD.nursefrm_q3_no_needle != NEW.nursefrm_q3_no_needle

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_q3_no_needle);

	set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_q3_no_needle);

	set @chdCol=CONCAT(@chdCol,'-','nursefrm_q3_no_needle');

end if;



if  OLD.nursefrm_q4_no_condom != NEW.nursefrm_q4_no_condom

then

	set @oldval =CONCAT(@oldVal,'-',OLD.nursefrm_q4_no_condom);

	set @newVal =CONCAT(@newVal,'-', NEW.nursefrm_q4_no_condom);

	set @chdCol=CONCAT(@chdCol,'-','nursefrm_q4_no_condom');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_nursevisit(nursefrm_sid,nursefrm_loc,nursefrm_pid,nursefrm_q1,nursefrm_q2,nursefrm_q3_no_needle,nursefrm_q4_no_condom,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.nursefrm_sid,NEW.nursefrm_loc,NEW.nursefrm_pid,NEW.nursefrm_q1,NEW.nursefrm_q2,NEW.nursefrm_q3_no_needle,NEW.nursefrm_q4_no_condom,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_nursevisit', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_ostmaster`
--

DROP TABLE IF EXISTS `cms_ostmaster`;
CREATE TABLE IF NOT EXISTS `cms_ostmaster` (
  `ost_master_id` int(11) NOT NULL AUTO_INCREMENT,
  `ost_master_survey` varchar(11) NOT NULL,
  `ost_master_loc` varchar(11) NOT NULL,
  `ost_master_part_id` varchar(11) NOT NULL,
  `ost_master_q1` varchar(25) NOT NULL,
  `ost_master_q2` int(11) NOT NULL,
  `ost_master_q3` int(11) DEFAULT NULL,
  `ost_master_q4` int(11) NOT NULL,
  `ost_master_q5` int(11) NOT NULL,
  `ost_master_q6` int(11) NOT NULL,
  `ost_master_q7` decimal(10,2) NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`ost_master_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_ostmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_ostmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_ostmaster_DELETE` BEFORE DELETE ON `cms_ostmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.ost_master_id;

set @userid=OLD.update_user;



if  OLD.ost_master_id !="" OR OLD.ost_master_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_id);



	set @chdCol=CONCAT(@chdCol,'-','ost_master_id');

end if;



if  OLD.ost_master_survey !="" OR OLD.ost_master_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_survey);



	set @chdCol=CONCAT(@chdCol,'-','ost_master_survey');

end if;



if  OLD.ost_master_loc !="" OR OLD.ost_master_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_loc);



	set @chdCol=CONCAT(@chdCol,'-','ost_master_loc');

end if;



if  OLD.ost_master_part_id !="" OR OLD.ost_master_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_part_id);



	set @chdCol=CONCAT(@chdCol,'-','ost_master_part_id');

end if;



if  OLD.ost_master_q1 !="" OR OLD.ost_master_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q1);



	set @chdCol=CONCAT(@chdCol,'-','ost_master_q1');

end if;



if  OLD.ost_master_q2 !="" OR OLD.ost_master_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q2);



	set @chdCol=CONCAT(@chdCol,'-','ost_master_q2');

end if;



if  OLD.ost_master_q3 !="" OR OLD.ost_master_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q3);



	set @chdCol=CONCAT(@chdCol,'-','ost_master_q3');

end if;



if  OLD.ost_master_q4 !="" OR OLD.ost_master_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q4);



	set @chdCol=CONCAT(@chdCol,'-','ost_master_q4');

end if;



if  OLD.ost_master_q5 !="" OR OLD.ost_master_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q5);



	set @chdCol=CONCAT(@chdCol,'-','ost_master_q5');

end if;



if  OLD.ost_master_q6 !="" OR OLD.ost_master_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q6);



	set @chdCol=CONCAT(@chdCol,'-','ost_master_q6');

end if;



if  OLD.ost_master_q7 !="" OR OLD.ost_master_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q7);



	set @chdCol=CONCAT(@chdCol,'-','ost_master_q7');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_ostmaster(ost_master_survey,ost_master_loc,ost_master_part_id,ost_master_q1,ost_master_q2,ost_master_q3,ost_master_q4,ost_master_q5,ost_master_q6,ost_master_q7,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.ost_master_survey,OLD.ost_master_loc,OLD.ost_master_part_id,OLD.ost_master_q1,OLD.ost_master_q2,OLD.ost_master_q3,OLD.ost_master_q4,OLD.ost_master_q5,OLD.ost_master_q6,OLD.ost_master_q7,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_ostmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_ostmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_ostmaster_INSERT` AFTER INSERT ON `cms_ostmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.ost_master_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.ost_master_id);

set @chdCol=CONCAT(@chdCol,'-','ost_master_id');

set @newVal =CONCAT(@newVal,'-', NEW.ost_master_survey);

set @chdCol=CONCAT(@chdCol,'-','ost_master_survey');

set @newVal =CONCAT(@newVal,'-', NEW.ost_master_loc);

set @chdCol=CONCAT(@chdCol,'-','ost_master_loc');

set @newVal =CONCAT(@newVal,'-', NEW.ost_master_part_id);

set @chdCol=CONCAT(@chdCol,'-','ost_master_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q1);

set @chdCol=CONCAT(@chdCol,'-','ost_master_q1');

set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q2);

set @chdCol=CONCAT(@chdCol,'-','ost_master_q2');

set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q3);

set @chdCol=CONCAT(@chdCol,'-','ost_master_q3');

set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q4);

set @chdCol=CONCAT(@chdCol,'-','ost_master_q4');

set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q5);

set @chdCol=CONCAT(@chdCol,'-','ost_master_q5');

set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q6);

set @chdCol=CONCAT(@chdCol,'-','ost_master_q6');

set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q7);

set @chdCol=CONCAT(@chdCol,'-','ost_master_q7');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_ostmaster(ost_master_survey,ost_master_loc,ost_master_part_id,ost_master_q1,ost_master_q2,ost_master_q3,ost_master_q4,ost_master_q5,ost_master_q6,ost_master_q7,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.ost_master_survey,NEW.ost_master_loc,NEW.ost_master_part_id,NEW.ost_master_q1,NEW.ost_master_q2,NEW.ost_master_q3,NEW.ost_master_q4,NEW.ost_master_q5,NEW.ost_master_q6,NEW.ost_master_q7,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_ostmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_ostmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_ostmaster_UPDATE` BEFORE UPDATE ON `cms_ostmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.ost_master_id;

set @userid=NEW.update_user;



if  OLD.ost_master_id != NEW.ost_master_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_id);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_master_id);

	set @chdCol=CONCAT(@chdCol,'-','ost_master_id');

end if;



if  OLD.ost_master_survey != NEW.ost_master_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_master_survey);

	set @chdCol=CONCAT(@chdCol,'-','ost_master_survey');

end if;



if  OLD.ost_master_loc != NEW.ost_master_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_master_loc);

	set @chdCol=CONCAT(@chdCol,'-','ost_master_loc');

end if;



if  OLD.ost_master_part_id != NEW.ost_master_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_master_part_id);

	set @chdCol=CONCAT(@chdCol,'-','ost_master_part_id');

end if;



if  OLD.ost_master_q1 != NEW.ost_master_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q1);

	set @chdCol=CONCAT(@chdCol,'-','ost_master_q1');

end if;



if  OLD.ost_master_q2 != NEW.ost_master_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q2);

	set @chdCol=CONCAT(@chdCol,'-','ost_master_q2');

end if;



if  OLD.ost_master_q3 != NEW.ost_master_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q3);

	set @chdCol=CONCAT(@chdCol,'-','ost_master_q3');

end if;



if  OLD.ost_master_q4 != NEW.ost_master_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q4);

	set @chdCol=CONCAT(@chdCol,'-','ost_master_q4');

end if;



if  OLD.ost_master_q5 != NEW.ost_master_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q5);

	set @chdCol=CONCAT(@chdCol,'-','ost_master_q5');

end if;



if  OLD.ost_master_q6 != NEW.ost_master_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q6);

	set @chdCol=CONCAT(@chdCol,'-','ost_master_q6');

end if;



if  OLD.ost_master_q7 != NEW.ost_master_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_master_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_master_q7);

	set @chdCol=CONCAT(@chdCol,'-','ost_master_q7');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_ostmaster(ost_master_survey,ost_master_loc,ost_master_part_id,ost_master_q1,ost_master_q2,ost_master_q3,ost_master_q4,ost_master_q5,ost_master_q6,ost_master_q7,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.ost_master_survey,NEW.ost_master_loc,NEW.ost_master_part_id,NEW.ost_master_q1,NEW.ost_master_q2,NEW.ost_master_q3,NEW.ost_master_q4,NEW.ost_master_q5,NEW.ost_master_q6,NEW.ost_master_q7,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_ostmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_ostvisit`
--

DROP TABLE IF EXISTS `cms_ostvisit`;
CREATE TABLE IF NOT EXISTS `cms_ostvisit` (
  `ost_visit_id` int(11) NOT NULL AUTO_INCREMENT,
  `ost_visit_survey` varchar(11) NOT NULL,
  `ost_visit_loc` varchar(11) NOT NULL,
  `ost_visit_part_id` varchar(11) NOT NULL,
  `ost_visit_q1` varchar(25) NOT NULL,
  `ost_visit_q2` int(11) NOT NULL,
  `ost_visit_q3` int(11) NOT NULL,
  `ost_visit_q4` int(11) NOT NULL,
  `ost_visit_q5` decimal(10,2) NOT NULL,
  `ost_visit_q6` varchar(100) DEFAULT NULL,
  `ost_visit_q7` int(11) NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`ost_visit_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_ostvisit`
--
DROP TRIGGER IF EXISTS `trig_cms_ostvisit_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_ostvisit_DELETE` BEFORE DELETE ON `cms_ostvisit`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.ost_visit_id;

set @userid=OLD.update_user;



if  OLD.ost_visit_id !="" OR OLD.ost_visit_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_id);



	set @chdCol=CONCAT(@chdCol,'-','ost_visit_id');

end if;



if  OLD.ost_visit_survey !="" OR OLD.ost_visit_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_survey);



	set @chdCol=CONCAT(@chdCol,'-','ost_visit_survey');

end if;



if  OLD.ost_visit_loc !="" OR OLD.ost_visit_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_loc);



	set @chdCol=CONCAT(@chdCol,'-','ost_visit_loc');

end if;



if  OLD.ost_visit_part_id !="" OR OLD.ost_visit_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_part_id);



	set @chdCol=CONCAT(@chdCol,'-','ost_visit_part_id');

end if;



if  OLD.ost_visit_q1 !="" OR OLD.ost_visit_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q1);



	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q1');

end if;



if  OLD.ost_visit_q2 !="" OR OLD.ost_visit_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q2);



	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q2');

end if;



if  OLD.ost_visit_q3 !="" OR OLD.ost_visit_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q3);



	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q3');

end if;



if  OLD.ost_visit_q4 !="" OR OLD.ost_visit_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q4);



	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q4');

end if;



if  OLD.ost_visit_q5 !="" OR OLD.ost_visit_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q5);



	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q5');

end if;



if  OLD.ost_visit_q6 !="" OR OLD.ost_visit_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q6);



	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q6');

end if;



if  OLD.ost_visit_q7 !="" OR OLD.ost_visit_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q7);



	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q7');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_ostvisit(ost_visit_survey,ost_visit_loc,ost_visit_part_id,ost_visit_q1,ost_visit_q2,ost_visit_q3,ost_visit_q4,ost_visit_q5,ost_visit_q6,ost_visit_q7,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.ost_visit_survey,OLD.ost_visit_loc,OLD.ost_visit_part_id,OLD.ost_visit_q1,OLD.ost_visit_q2,OLD.ost_visit_q3,OLD.ost_visit_q4,OLD.ost_visit_q5,OLD.ost_visit_q6,OLD.ost_visit_q7,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_ostvisit', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_ostvisit_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_ostvisit_INSERT` AFTER INSERT ON `cms_ostvisit`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.ost_visit_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_id);

set @chdCol=CONCAT(@chdCol,'-','ost_visit_id');

set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_survey);

set @chdCol=CONCAT(@chdCol,'-','ost_visit_survey');

set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_loc);

set @chdCol=CONCAT(@chdCol,'-','ost_visit_loc');

set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_part_id);

set @chdCol=CONCAT(@chdCol,'-','ost_visit_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q1);

set @chdCol=CONCAT(@chdCol,'-','ost_visit_q1');

set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q2);

set @chdCol=CONCAT(@chdCol,'-','ost_visit_q2');

set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q3);

set @chdCol=CONCAT(@chdCol,'-','ost_visit_q3');

set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q4);

set @chdCol=CONCAT(@chdCol,'-','ost_visit_q4');

set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q5);

set @chdCol=CONCAT(@chdCol,'-','ost_visit_q5');

set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q6);

set @chdCol=CONCAT(@chdCol,'-','ost_visit_q6');

set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q7);

set @chdCol=CONCAT(@chdCol,'-','ost_visit_q7');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_ostvisit(ost_visit_survey,ost_visit_loc,ost_visit_part_id,ost_visit_q1,ost_visit_q2,ost_visit_q3,ost_visit_q4,ost_visit_q5,ost_visit_q6,ost_visit_q7,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.ost_visit_survey,NEW.ost_visit_loc,NEW.ost_visit_part_id,NEW.ost_visit_q1,NEW.ost_visit_q2,NEW.ost_visit_q3,NEW.ost_visit_q4,NEW.ost_visit_q5,NEW.ost_visit_q6,NEW.ost_visit_q7,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_ostvisit', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_ostvisit_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_ostvisit_UPDATE` BEFORE UPDATE ON `cms_ostvisit`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.ost_visit_id;

set @userid=NEW.update_user;



if  OLD.ost_visit_id != NEW.ost_visit_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_id);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_id);

	set @chdCol=CONCAT(@chdCol,'-','ost_visit_id');

end if;



if  OLD.ost_visit_survey != NEW.ost_visit_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_survey);

	set @chdCol=CONCAT(@chdCol,'-','ost_visit_survey');

end if;



if  OLD.ost_visit_loc != NEW.ost_visit_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_loc);

	set @chdCol=CONCAT(@chdCol,'-','ost_visit_loc');

end if;



if  OLD.ost_visit_part_id != NEW.ost_visit_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_part_id);

	set @chdCol=CONCAT(@chdCol,'-','ost_visit_part_id');

end if;



if  OLD.ost_visit_q1 != NEW.ost_visit_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q1);

	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q1');

end if;



if  OLD.ost_visit_q2 != NEW.ost_visit_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q2);

	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q2');

end if;



if  OLD.ost_visit_q3 != NEW.ost_visit_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q3);

	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q3');

end if;



if  OLD.ost_visit_q4 != NEW.ost_visit_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q4);

	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q4');

end if;



if  OLD.ost_visit_q5 != NEW.ost_visit_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q5);

	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q5');

end if;



if  OLD.ost_visit_q6 != NEW.ost_visit_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q6);

	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q6');

end if;



if  OLD.ost_visit_q7 != NEW.ost_visit_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.ost_visit_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.ost_visit_q7);

	set @chdCol=CONCAT(@chdCol,'-','ost_visit_q7');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_ostvisit(ost_visit_survey,ost_visit_loc,ost_visit_part_id,ost_visit_q1,ost_visit_q2,ost_visit_q3,ost_visit_q4,ost_visit_q5,ost_visit_q6,ost_visit_q7,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.ost_visit_survey,NEW.ost_visit_loc,NEW.ost_visit_part_id,NEW.ost_visit_q1,NEW.ost_visit_q2,NEW.ost_visit_q3,NEW.ost_visit_q4,NEW.ost_visit_q5,NEW.ost_visit_q6,NEW.ost_visit_q7,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_ostvisit', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_preartincenmaster`
--

DROP TABLE IF EXISTS `cms_preartincenmaster`;
CREATE TABLE IF NOT EXISTS `cms_preartincenmaster` (
  `preart_inc_id` int(11) NOT NULL AUTO_INCREMENT,
  `preart_inc_survey` varchar(11) NOT NULL COMMENT 'Survey',
  `preart_inc_part_id` varchar(11) NOT NULL COMMENT 'ICC Client ID',
  `preart_inc_visitdate` int(11) DEFAULT NULL COMMENT 'Visit Date',
  `preart_inc_q1` int(11) DEFAULT NULL COMMENT 'Payment Status',
  `preart_inc_q2` int(11) DEFAULT NULL COMMENT 'Amount',
  `preart_inc_q3` int(11) DEFAULT NULL COMMENT 'Paid Date',
  `preart_inc_q4` varchar(50) DEFAULT NULL COMMENT 'Voucher Number',
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) NOT NULL,
  PRIMARY KEY (`preart_inc_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_preartincenmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_preartincenmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_preartincenmaster_DELETE` BEFORE DELETE ON `cms_preartincenmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.preart_inc_id;

set @userid=OLD.update_user;



if  OLD.preart_inc_id !="" OR OLD.preart_inc_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_id);



	set @chdCol=CONCAT(@chdCol,'-','preart_inc_id');

end if;



if  OLD.preart_inc_survey !="" OR OLD.preart_inc_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_survey);



	set @chdCol=CONCAT(@chdCol,'-','preart_inc_survey');

end if;



if  OLD.preart_inc_part_id !="" OR OLD.preart_inc_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_part_id);



	set @chdCol=CONCAT(@chdCol,'-','preart_inc_part_id');

end if;



if  OLD.preart_inc_visitdate !="" OR OLD.preart_inc_visitdate is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_visitdate);



	set @chdCol=CONCAT(@chdCol,'-','preart_inc_visitdate');

end if;



if  OLD.preart_inc_q1 !="" OR OLD.preart_inc_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_q1);



	set @chdCol=CONCAT(@chdCol,'-','preart_inc_q1');

end if;



if  OLD.preart_inc_q2 !="" OR OLD.preart_inc_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_q2);



	set @chdCol=CONCAT(@chdCol,'-','preart_inc_q2');

end if;



if  OLD.preart_inc_q3 !="" OR OLD.preart_inc_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_q3);



	set @chdCol=CONCAT(@chdCol,'-','preart_inc_q3');

end if;



if  OLD.preart_inc_q4 !="" OR OLD.preart_inc_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_q4);



	set @chdCol=CONCAT(@chdCol,'-','preart_inc_q4');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_preartincenmaster(preart_inc_survey,preart_inc_part_id,preart_inc_visitdate,preart_inc_q1,preart_inc_q2,preart_inc_q3,preart_inc_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.preart_inc_survey,OLD.preart_inc_part_id,OLD.preart_inc_visitdate,OLD.preart_inc_q1,OLD.preart_inc_q2,OLD.preart_inc_q3,OLD.preart_inc_q4,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_preartincenmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_preartincenmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_preartincenmaster_INSERT` AFTER INSERT ON `cms_preartincenmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.preart_inc_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_id);

set @chdCol=CONCAT(@chdCol,'-','preart_inc_id');

set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_survey);

set @chdCol=CONCAT(@chdCol,'-','preart_inc_survey');

set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_part_id);

set @chdCol=CONCAT(@chdCol,'-','preart_inc_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_visitdate);

set @chdCol=CONCAT(@chdCol,'-','preart_inc_visitdate');

set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_q1);

set @chdCol=CONCAT(@chdCol,'-','preart_inc_q1');

set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_q2);

set @chdCol=CONCAT(@chdCol,'-','preart_inc_q2');

set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_q3);

set @chdCol=CONCAT(@chdCol,'-','preart_inc_q3');

set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_q4);

set @chdCol=CONCAT(@chdCol,'-','preart_inc_q4');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_preartincenmaster(preart_inc_survey,preart_inc_part_id,preart_inc_visitdate,preart_inc_q1,preart_inc_q2,preart_inc_q3,preart_inc_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.preart_inc_survey,NEW.preart_inc_part_id,NEW.preart_inc_visitdate,NEW.preart_inc_q1,NEW.preart_inc_q2,NEW.preart_inc_q3,NEW.preart_inc_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_preartincenmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_preartincenmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_preartincenmaster_UPDATE` BEFORE UPDATE ON `cms_preartincenmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.preart_inc_id;

set @userid=NEW.update_user;



if  OLD.preart_inc_id != NEW.preart_inc_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_id);

	set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_id);

	set @chdCol=CONCAT(@chdCol,'-','preart_inc_id');

end if;



if  OLD.preart_inc_survey != NEW.preart_inc_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_survey);

	set @chdCol=CONCAT(@chdCol,'-','preart_inc_survey');

end if;



if  OLD.preart_inc_part_id != NEW.preart_inc_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_part_id);

	set @chdCol=CONCAT(@chdCol,'-','preart_inc_part_id');

end if;



if  OLD.preart_inc_visitdate != NEW.preart_inc_visitdate

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_visitdate);

	set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_visitdate);

	set @chdCol=CONCAT(@chdCol,'-','preart_inc_visitdate');

end if;



if  OLD.preart_inc_q1 != NEW.preart_inc_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_q1);

	set @chdCol=CONCAT(@chdCol,'-','preart_inc_q1');

end if;



if  OLD.preart_inc_q2 != NEW.preart_inc_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_q2);

	set @chdCol=CONCAT(@chdCol,'-','preart_inc_q2');

end if;



if  OLD.preart_inc_q3 != NEW.preart_inc_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_q3);

	set @chdCol=CONCAT(@chdCol,'-','preart_inc_q3');

end if;



if  OLD.preart_inc_q4 != NEW.preart_inc_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.preart_inc_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.preart_inc_q4);

	set @chdCol=CONCAT(@chdCol,'-','preart_inc_q4');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_preartincenmaster(preart_inc_survey,preart_inc_part_id,preart_inc_visitdate,preart_inc_q1,preart_inc_q2,preart_inc_q3,preart_inc_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.preart_inc_survey,NEW.preart_inc_part_id,NEW.preart_inc_visitdate,NEW.preart_inc_q1,NEW.preart_inc_q2,NEW.preart_inc_q3,NEW.preart_inc_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_preartincenmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_registration`
--

DROP TABLE IF EXISTS `cms_registration`;
CREATE TABLE IF NOT EXISTS `cms_registration` (
  `corfrm_id` int(11) NOT NULL AUTO_INCREMENT,
  `corfrm_sid` varchar(100) NOT NULL,
  `corfrm_pid` varchar(100) NOT NULL,
  `corfrm_loc` varchar(100) NOT NULL,
  `corfrm_q1` varchar(100) NOT NULL,
  `corfrm_q2` varchar(11) NOT NULL,
  `corfrm_q3` int(11) NOT NULL,
  `corfrm_q4` int(11) NOT NULL,
  `corfrm_q5` int(11) NOT NULL,
  `corfrm_q6` int(11) NOT NULL,
  `corfrm_q7` int(11) NOT NULL,
  `corfrm_q8` int(11) NOT NULL,
  `corfrm_q9` int(11) NOT NULL,
  `corfrm_q10` int(11) NOT NULL,
  `corfrm_q11` varchar(50) DEFAULT NULL,
  `corfrm_q12` int(11) NOT NULL,
  `corfrm_q13` int(11) NOT NULL,
  `corfrm_q14` int(11) NOT NULL,
  `corfrm_q15` int(11) NOT NULL,
  `corfrm_q16` int(11) DEFAULT NULL,
  `iccplus_date` int(11) NOT NULL,
  `icc_date` int(11) DEFAULT NULL,
  `rds1` varchar(11) DEFAULT NULL,
  `rds2` varchar(11) DEFAULT NULL,
  `no_of_finger` int(2) DEFAULT '10',
  `remarks` text,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  `RDS1Verified` varchar(1) NOT NULL DEFAULT 'N',
  `RDS2Verified` varchar(1) NOT NULL DEFAULT 'N',
  `no_of_fingers` int(11) NOT NULL DEFAULT '10',
  PRIMARY KEY (`corfrm_id`),
  KEY `corfrm_pid` (`corfrm_pid`),
  KEY `corfrm_pid_2` (`corfrm_pid`),
  KEY `corfrm_pid_3` (`corfrm_pid`),
  KEY `corfrm_pid_4` (`corfrm_pid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_registration`
--
DROP TRIGGER IF EXISTS `trig_cms_registration_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_registration_DELETE` BEFORE DELETE ON `cms_registration`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.corfrm_id;

set @userid=OLD.update_user;



if  OLD.corfrm_id !="" OR OLD.corfrm_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_id);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_id');

end if;



if  OLD.corfrm_sid !="" OR OLD.corfrm_sid is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_sid);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_sid');

end if;



if  OLD.corfrm_pid !="" OR OLD.corfrm_pid is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_pid);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_pid');

end if;



if  OLD.corfrm_loc !="" OR OLD.corfrm_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_loc);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_loc');

end if;



if  OLD.corfrm_q1 !="" OR OLD.corfrm_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q1);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q1');

end if;



if  OLD.corfrm_q2 !="" OR OLD.corfrm_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q2);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q2');

end if;



if  OLD.corfrm_q3 !="" OR OLD.corfrm_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q3);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q3');

end if;



if  OLD.corfrm_q4 !="" OR OLD.corfrm_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q4);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q4');

end if;



if  OLD.corfrm_q5 !="" OR OLD.corfrm_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q5);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q5');

end if;



if  OLD.corfrm_q6 !="" OR OLD.corfrm_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q6);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q6');

end if;



if  OLD.corfrm_q7 !="" OR OLD.corfrm_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q7);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q7');

end if;



if  OLD.corfrm_q8 !="" OR OLD.corfrm_q8 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q8);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q8');

end if;



if  OLD.corfrm_q9 !="" OR OLD.corfrm_q9 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q9);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q9');

end if;



if  OLD.corfrm_q10 !="" OR OLD.corfrm_q10 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q10);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q10');

end if;



if  OLD.corfrm_q11 !="" OR OLD.corfrm_q11 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q11);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q11');

end if;



if  OLD.corfrm_q12 !="" OR OLD.corfrm_q12 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q12);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q12');

end if;



if  OLD.corfrm_q13 !="" OR OLD.corfrm_q13 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q13);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q13');

end if;



if  OLD.corfrm_q14 !="" OR OLD.corfrm_q14 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q14);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q14');

end if;



if  OLD.corfrm_q15 !="" OR OLD.corfrm_q15 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q15);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q15');

end if;



if  OLD.corfrm_q16 !="" OR OLD.corfrm_q16 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q16);



	set @chdCol=CONCAT(@chdCol,'-','corfrm_q16');

end if;



if  OLD.iccplus_date !="" OR OLD.iccplus_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.iccplus_date);



	set @chdCol=CONCAT(@chdCol,'-','iccplus_date');

end if;



if  OLD.icc_date !="" OR OLD.icc_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.icc_date);



	set @chdCol=CONCAT(@chdCol,'-','icc_date');

end if;



if  OLD.rds1 !="" OR OLD.rds1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.rds1);



	set @chdCol=CONCAT(@chdCol,'-','rds1');

end if;



if  OLD.rds2 !="" OR OLD.rds2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.rds2);



	set @chdCol=CONCAT(@chdCol,'-','rds2');

end if;



if  OLD.no_of_finger !="" OR OLD.no_of_finger is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.no_of_finger);



	set @chdCol=CONCAT(@chdCol,'-','no_of_finger');

end if;



if  OLD.remarks !="" OR OLD.remarks is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.remarks);



	set @chdCol=CONCAT(@chdCol,'-','remarks');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;



if  OLD.RDS1Verified !="" OR OLD.RDS1Verified is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.RDS1Verified);



	set @chdCol=CONCAT(@chdCol,'-','RDS1Verified');

end if;



if  OLD.RDS2Verified !="" OR OLD.RDS2Verified is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.RDS2Verified);



	set @chdCol=CONCAT(@chdCol,'-','RDS2Verified');

end if;



if  OLD.no_of_fingers !="" OR OLD.no_of_fingers is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.no_of_fingers);



	set @chdCol=CONCAT(@chdCol,'-','no_of_fingers');

end if;







INSERT INTO mirror_iccplus.cms_registration(corfrm_sid,corfrm_pid,corfrm_loc,corfrm_q1,corfrm_q2,corfrm_q3,corfrm_q4,corfrm_q5,corfrm_q6,corfrm_q7,corfrm_q8,corfrm_q9,corfrm_q10,corfrm_q11,corfrm_q12,corfrm_q13,corfrm_q14,corfrm_q15,corfrm_q16,iccplus_date,icc_date,rds1,rds2,no_of_finger,remarks,status,create_time,create_user,update_time,update_user,record_date,RDS1Verified,RDS2Verified,no_of_fingers) VALUES(OLD.corfrm_sid,OLD.corfrm_pid,OLD.corfrm_loc,OLD.corfrm_q1,OLD.corfrm_q2,OLD.corfrm_q3,OLD.corfrm_q4,OLD.corfrm_q5,OLD.corfrm_q6,OLD.corfrm_q7,OLD.corfrm_q8,OLD.corfrm_q9,OLD.corfrm_q10,OLD.corfrm_q11,OLD.corfrm_q12,OLD.corfrm_q13,OLD.corfrm_q14,OLD.corfrm_q15,OLD.corfrm_q16,OLD.iccplus_date,OLD.icc_date,OLD.rds1,OLD.rds2,OLD.no_of_finger,OLD.remarks,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date,OLD.RDS1Verified,OLD.RDS2Verified,OLD.no_of_fingers);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_registration', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_registration_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_registration_INSERT` AFTER INSERT ON `cms_registration`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.corfrm_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.corfrm_id);

set @chdCol=CONCAT(@chdCol,'-','corfrm_id');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_sid);

set @chdCol=CONCAT(@chdCol,'-','corfrm_sid');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_pid);

set @chdCol=CONCAT(@chdCol,'-','corfrm_pid');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_loc);

set @chdCol=CONCAT(@chdCol,'-','corfrm_loc');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q1);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q1');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q2);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q2');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q3);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q3');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q4);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q4');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q5);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q5');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q6);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q6');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q7);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q7');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q8);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q8');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q9);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q9');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q10);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q10');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q11);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q11');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q12);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q12');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q13);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q13');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q14);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q14');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q15);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q15');

set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q16);

set @chdCol=CONCAT(@chdCol,'-','corfrm_q16');

set @newVal =CONCAT(@newVal,'-', NEW.iccplus_date);

set @chdCol=CONCAT(@chdCol,'-','iccplus_date');

set @newVal =CONCAT(@newVal,'-', NEW.icc_date);

set @chdCol=CONCAT(@chdCol,'-','icc_date');

set @newVal =CONCAT(@newVal,'-', NEW.rds1);

set @chdCol=CONCAT(@chdCol,'-','rds1');

set @newVal =CONCAT(@newVal,'-', NEW.rds2);

set @chdCol=CONCAT(@chdCol,'-','rds2');

set @newVal =CONCAT(@newVal,'-', NEW.no_of_finger);

set @chdCol=CONCAT(@chdCol,'-','no_of_finger');

set @newVal =CONCAT(@newVal,'-', NEW.remarks);

set @chdCol=CONCAT(@chdCol,'-','remarks');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');

set @newVal =CONCAT(@newVal,'-', NEW.RDS1Verified);

set @chdCol=CONCAT(@chdCol,'-','RDS1Verified');

set @newVal =CONCAT(@newVal,'-', NEW.RDS2Verified);

set @chdCol=CONCAT(@chdCol,'-','RDS2Verified');

set @newVal =CONCAT(@newVal,'-', NEW.no_of_fingers);

set @chdCol=CONCAT(@chdCol,'-','no_of_fingers');





INSERT INTO mirror_iccplus.cms_registration(corfrm_sid,corfrm_pid,corfrm_loc,corfrm_q1,corfrm_q2,corfrm_q3,corfrm_q4,corfrm_q5,corfrm_q6,corfrm_q7,corfrm_q8,corfrm_q9,corfrm_q10,corfrm_q11,corfrm_q12,corfrm_q13,corfrm_q14,corfrm_q15,corfrm_q16,iccplus_date,icc_date,rds1,rds2,no_of_finger,remarks,status,create_time,create_user,update_time,update_user,record_date,RDS1Verified,RDS2Verified,no_of_fingers) VALUES(NEW.corfrm_sid,NEW.corfrm_pid,NEW.corfrm_loc,NEW.corfrm_q1,NEW.corfrm_q2,NEW.corfrm_q3,NEW.corfrm_q4,NEW.corfrm_q5,NEW.corfrm_q6,NEW.corfrm_q7,NEW.corfrm_q8,NEW.corfrm_q9,NEW.corfrm_q10,NEW.corfrm_q11,NEW.corfrm_q12,NEW.corfrm_q13,NEW.corfrm_q14,NEW.corfrm_q15,NEW.corfrm_q16,NEW.iccplus_date,NEW.icc_date,NEW.rds1,NEW.rds2,NEW.no_of_finger,NEW.remarks,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date,NEW.RDS1Verified,NEW.RDS2Verified,NEW.no_of_fingers);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_registration', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_registration_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_registration_UPDATE` BEFORE UPDATE ON `cms_registration`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.corfrm_id;

set @userid=NEW.update_user;



if  OLD.corfrm_id != NEW.corfrm_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_id);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_id);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_id');

end if;



if  OLD.corfrm_sid != NEW.corfrm_sid

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_sid);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_sid);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_sid');

end if;



if  OLD.corfrm_pid != NEW.corfrm_pid

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_pid);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_pid);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_pid');

end if;



if  OLD.corfrm_loc != NEW.corfrm_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_loc);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_loc');

end if;



if  OLD.corfrm_q1 != NEW.corfrm_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q1);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q1');

end if;



if  OLD.corfrm_q2 != NEW.corfrm_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q2);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q2');

end if;



if  OLD.corfrm_q3 != NEW.corfrm_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q3);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q3');

end if;



if  OLD.corfrm_q4 != NEW.corfrm_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q4);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q4');

end if;



if  OLD.corfrm_q5 != NEW.corfrm_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q5);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q5');

end if;



if  OLD.corfrm_q6 != NEW.corfrm_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q6);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q6');

end if;



if  OLD.corfrm_q7 != NEW.corfrm_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q7);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q7');

end if;



if  OLD.corfrm_q8 != NEW.corfrm_q8

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q8);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q8);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q8');

end if;



if  OLD.corfrm_q9 != NEW.corfrm_q9

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q9);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q9);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q9');

end if;



if  OLD.corfrm_q10 != NEW.corfrm_q10

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q10);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q10);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q10');

end if;



if  OLD.corfrm_q11 != NEW.corfrm_q11

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q11);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q11);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q11');

end if;



if  OLD.corfrm_q12 != NEW.corfrm_q12

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q12);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q12);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q12');

end if;



if  OLD.corfrm_q13 != NEW.corfrm_q13

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q13);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q13);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q13');

end if;



if  OLD.corfrm_q14 != NEW.corfrm_q14

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q14);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q14);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q14');

end if;



if  OLD.corfrm_q15 != NEW.corfrm_q15

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q15);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q15);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q15');

end if;



if  OLD.corfrm_q16 != NEW.corfrm_q16

then

	set @oldval =CONCAT(@oldVal,'-',OLD.corfrm_q16);

	set @newVal =CONCAT(@newVal,'-', NEW.corfrm_q16);

	set @chdCol=CONCAT(@chdCol,'-','corfrm_q16');

end if;



if  OLD.iccplus_date != NEW.iccplus_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.iccplus_date);

	set @newVal =CONCAT(@newVal,'-', NEW.iccplus_date);

	set @chdCol=CONCAT(@chdCol,'-','iccplus_date');

end if;



if  OLD.icc_date != NEW.icc_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.icc_date);

	set @newVal =CONCAT(@newVal,'-', NEW.icc_date);

	set @chdCol=CONCAT(@chdCol,'-','icc_date');

end if;



if  OLD.rds1 != NEW.rds1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.rds1);

	set @newVal =CONCAT(@newVal,'-', NEW.rds1);

	set @chdCol=CONCAT(@chdCol,'-','rds1');

end if;



if  OLD.rds2 != NEW.rds2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.rds2);

	set @newVal =CONCAT(@newVal,'-', NEW.rds2);

	set @chdCol=CONCAT(@chdCol,'-','rds2');

end if;



if  OLD.no_of_finger != NEW.no_of_finger

then

	set @oldval =CONCAT(@oldVal,'-',OLD.no_of_finger);

	set @newVal =CONCAT(@newVal,'-', NEW.no_of_finger);

	set @chdCol=CONCAT(@chdCol,'-','no_of_finger');

end if;



if  OLD.remarks != NEW.remarks

then

	set @oldval =CONCAT(@oldVal,'-',OLD.remarks);

	set @newVal =CONCAT(@newVal,'-', NEW.remarks);

	set @chdCol=CONCAT(@chdCol,'-','remarks');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;



if  OLD.RDS1Verified != NEW.RDS1Verified

then

	set @oldval =CONCAT(@oldVal,'-',OLD.RDS1Verified);

	set @newVal =CONCAT(@newVal,'-', NEW.RDS1Verified);

	set @chdCol=CONCAT(@chdCol,'-','RDS1Verified');

end if;



if  OLD.RDS2Verified != NEW.RDS2Verified

then

	set @oldval =CONCAT(@oldVal,'-',OLD.RDS2Verified);

	set @newVal =CONCAT(@newVal,'-', NEW.RDS2Verified);

	set @chdCol=CONCAT(@chdCol,'-','RDS2Verified');

end if;



if  OLD.no_of_fingers != NEW.no_of_fingers

then

	set @oldval =CONCAT(@oldVal,'-',OLD.no_of_fingers);

	set @newVal =CONCAT(@newVal,'-', NEW.no_of_fingers);

	set @chdCol=CONCAT(@chdCol,'-','no_of_fingers');

end if;







INSERT INTO mirror_iccplus.cms_registration(corfrm_sid,corfrm_pid,corfrm_loc,corfrm_q1,corfrm_q2,corfrm_q3,corfrm_q4,corfrm_q5,corfrm_q6,corfrm_q7,corfrm_q8,corfrm_q9,corfrm_q10,corfrm_q11,corfrm_q12,corfrm_q13,corfrm_q14,corfrm_q15,corfrm_q16,iccplus_date,icc_date,rds1,rds2,no_of_finger,remarks,status,create_time,create_user,update_time,update_user,record_date,RDS1Verified,RDS2Verified,no_of_fingers) VALUES(NEW.corfrm_sid,NEW.corfrm_pid,NEW.corfrm_loc,NEW.corfrm_q1,NEW.corfrm_q2,NEW.corfrm_q3,NEW.corfrm_q4,NEW.corfrm_q5,NEW.corfrm_q6,NEW.corfrm_q7,NEW.corfrm_q8,NEW.corfrm_q9,NEW.corfrm_q10,NEW.corfrm_q11,NEW.corfrm_q12,NEW.corfrm_q13,NEW.corfrm_q14,NEW.corfrm_q15,NEW.corfrm_q16,NEW.iccplus_date,NEW.icc_date,NEW.rds1,NEW.rds2,NEW.no_of_finger,NEW.remarks,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date,NEW.RDS1Verified,NEW.RDS2Verified,NEW.no_of_fingers);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_registration', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_reimbursementheads`
--

DROP TABLE IF EXISTS `cms_reimbursementheads`;
CREATE TABLE IF NOT EXISTS `cms_reimbursementheads` (
  `reimbursement_head_id` int(11) NOT NULL AUTO_INCREMENT,
  `reimbursement_head_code` text NOT NULL COMMENT 'Reimbursement Head Code',
  `reimbursement_head_name` text NOT NULL COMMENT 'Reimbursement Head Name',
  `status` varchar(1) DEFAULT NULL,
  `del_status` varchar(1) NOT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`reimbursement_head_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_reimbursementheads`
--
DROP TRIGGER IF EXISTS `trig_cms_reimbursementheads_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_reimbursementheads_DELETE` BEFORE DELETE ON `cms_reimbursementheads`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.reimbursement_head_id;

set @userid=OLD.update_user;



if  OLD.reimbursement_head_id !="" OR OLD.reimbursement_head_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimbursement_head_id);



	set @chdCol=CONCAT(@chdCol,'-','reimbursement_head_id');

end if;



if  OLD.reimbursement_head_code !="" OR OLD.reimbursement_head_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimbursement_head_code);



	set @chdCol=CONCAT(@chdCol,'-','reimbursement_head_code');

end if;



if  OLD.reimbursement_head_name !="" OR OLD.reimbursement_head_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimbursement_head_name);



	set @chdCol=CONCAT(@chdCol,'-','reimbursement_head_name');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.del_status !="" OR OLD.del_status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.del_status);



	set @chdCol=CONCAT(@chdCol,'-','del_status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_reimbursementheads(reimbursement_head_code,reimbursement_head_name,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.reimbursement_head_code,OLD.reimbursement_head_name,OLD.status,OLD.del_status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_reimbursementheads', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_reimbursementheads_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_reimbursementheads_INSERT` AFTER INSERT ON `cms_reimbursementheads`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.reimbursement_head_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.reimbursement_head_id);

set @chdCol=CONCAT(@chdCol,'-','reimbursement_head_id');

set @newVal =CONCAT(@newVal,'-', NEW.reimbursement_head_code);

set @chdCol=CONCAT(@chdCol,'-','reimbursement_head_code');

set @newVal =CONCAT(@newVal,'-', NEW.reimbursement_head_name);

set @chdCol=CONCAT(@chdCol,'-','reimbursement_head_name');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.del_status);

set @chdCol=CONCAT(@chdCol,'-','del_status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_reimbursementheads(reimbursement_head_code,reimbursement_head_name,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.reimbursement_head_code,NEW.reimbursement_head_name,NEW.status,NEW.del_status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_reimbursementheads', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_reimbursementheads_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_reimbursementheads_UPDATE` BEFORE UPDATE ON `cms_reimbursementheads`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.reimbursement_head_id;

set @userid=NEW.update_user;



if  OLD.reimbursement_head_id != NEW.reimbursement_head_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimbursement_head_id);

	set @newVal =CONCAT(@newVal,'-', NEW.reimbursement_head_id);

	set @chdCol=CONCAT(@chdCol,'-','reimbursement_head_id');

end if;



if  OLD.reimbursement_head_code != NEW.reimbursement_head_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimbursement_head_code);

	set @newVal =CONCAT(@newVal,'-', NEW.reimbursement_head_code);

	set @chdCol=CONCAT(@chdCol,'-','reimbursement_head_code');

end if;



if  OLD.reimbursement_head_name != NEW.reimbursement_head_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimbursement_head_name);

	set @newVal =CONCAT(@newVal,'-', NEW.reimbursement_head_name);

	set @chdCol=CONCAT(@chdCol,'-','reimbursement_head_name');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.del_status != NEW.del_status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.del_status);

	set @newVal =CONCAT(@newVal,'-', NEW.del_status);

	set @chdCol=CONCAT(@chdCol,'-','del_status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_reimbursementheads(reimbursement_head_code,reimbursement_head_name,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.reimbursement_head_code,NEW.reimbursement_head_name,NEW.status,NEW.del_status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_reimbursementheads', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_reimbursementmaster`
--

DROP TABLE IF EXISTS `cms_reimbursementmaster`;
CREATE TABLE IF NOT EXISTS `cms_reimbursementmaster` (
  `reimburse_master_id` int(11) NOT NULL AUTO_INCREMENT,
  `reimburse_master_survey` varchar(11) NOT NULL COMMENT 'Survey',
  `reimburse_master_part_id` varchar(11) NOT NULL COMMENT 'ICC Client ID',
  `reimburse_master_visitcode` varchar(11) NOT NULL COMMENT 'Visit Code',
  `reimburse_master_visitdate` varchar(11) NOT NULL COMMENT 'Visit Date',
  `reimburse_master_q1` int(11) NOT NULL COMMENT 'Payment Status',
  `reimburse_master_q2` int(11) NOT NULL COMMENT 'Amount',
  `reimburse_master_q3` int(11) NOT NULL COMMENT 'Paid Date',
  `reimburse_master_q4` varchar(50) NOT NULL COMMENT 'Voucher Number',
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) NOT NULL,
  PRIMARY KEY (`reimburse_master_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_reimbursementmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_reimbursementmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_reimbursementmaster_DELETE` BEFORE DELETE ON `cms_reimbursementmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.reimburse_master_id;

set @userid=OLD.update_user;



if  OLD.reimburse_master_id !="" OR OLD.reimburse_master_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_id);



	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_id');

end if;



if  OLD.reimburse_master_survey !="" OR OLD.reimburse_master_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_survey);



	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_survey');

end if;



if  OLD.reimburse_master_part_id !="" OR OLD.reimburse_master_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_part_id);



	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_part_id');

end if;



if  OLD.reimburse_master_visitcode !="" OR OLD.reimburse_master_visitcode is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_visitcode);



	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_visitcode');

end if;



if  OLD.reimburse_master_visitdate !="" OR OLD.reimburse_master_visitdate is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_visitdate);



	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_visitdate');

end if;



if  OLD.reimburse_master_q1 !="" OR OLD.reimburse_master_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_q1);



	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_q1');

end if;



if  OLD.reimburse_master_q2 !="" OR OLD.reimburse_master_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_q2);



	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_q2');

end if;



if  OLD.reimburse_master_q3 !="" OR OLD.reimburse_master_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_q3);



	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_q3');

end if;



if  OLD.reimburse_master_q4 !="" OR OLD.reimburse_master_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_q4);



	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_q4');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_reimbursementmaster(reimburse_master_survey,reimburse_master_part_id,reimburse_master_visitcode,reimburse_master_visitdate,reimburse_master_q1,reimburse_master_q2,reimburse_master_q3,reimburse_master_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.reimburse_master_survey,OLD.reimburse_master_part_id,OLD.reimburse_master_visitcode,OLD.reimburse_master_visitdate,OLD.reimburse_master_q1,OLD.reimburse_master_q2,OLD.reimburse_master_q3,OLD.reimburse_master_q4,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_reimbursementmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_reimbursementmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_reimbursementmaster_INSERT` AFTER INSERT ON `cms_reimbursementmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.reimburse_master_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_id);

set @chdCol=CONCAT(@chdCol,'-','reimburse_master_id');

set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_survey);

set @chdCol=CONCAT(@chdCol,'-','reimburse_master_survey');

set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_part_id);

set @chdCol=CONCAT(@chdCol,'-','reimburse_master_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_visitcode);

set @chdCol=CONCAT(@chdCol,'-','reimburse_master_visitcode');

set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_visitdate);

set @chdCol=CONCAT(@chdCol,'-','reimburse_master_visitdate');

set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_q1);

set @chdCol=CONCAT(@chdCol,'-','reimburse_master_q1');

set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_q2);

set @chdCol=CONCAT(@chdCol,'-','reimburse_master_q2');

set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_q3);

set @chdCol=CONCAT(@chdCol,'-','reimburse_master_q3');

set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_q4);

set @chdCol=CONCAT(@chdCol,'-','reimburse_master_q4');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_reimbursementmaster(reimburse_master_survey,reimburse_master_part_id,reimburse_master_visitcode,reimburse_master_visitdate,reimburse_master_q1,reimburse_master_q2,reimburse_master_q3,reimburse_master_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.reimburse_master_survey,NEW.reimburse_master_part_id,NEW.reimburse_master_visitcode,NEW.reimburse_master_visitdate,NEW.reimburse_master_q1,NEW.reimburse_master_q2,NEW.reimburse_master_q3,NEW.reimburse_master_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_reimbursementmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_reimbursementmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_reimbursementmaster_UPDATE` BEFORE UPDATE ON `cms_reimbursementmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.reimburse_master_id;

set @userid=NEW.update_user;



if  OLD.reimburse_master_id != NEW.reimburse_master_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_id);

	set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_id);

	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_id');

end if;



if  OLD.reimburse_master_survey != NEW.reimburse_master_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_survey);

	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_survey');

end if;



if  OLD.reimburse_master_part_id != NEW.reimburse_master_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_part_id);

	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_part_id');

end if;



if  OLD.reimburse_master_visitcode != NEW.reimburse_master_visitcode

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_visitcode);

	set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_visitcode);

	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_visitcode');

end if;



if  OLD.reimburse_master_visitdate != NEW.reimburse_master_visitdate

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_visitdate);

	set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_visitdate);

	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_visitdate');

end if;



if  OLD.reimburse_master_q1 != NEW.reimburse_master_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_q1);

	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_q1');

end if;



if  OLD.reimburse_master_q2 != NEW.reimburse_master_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_q2);

	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_q2');

end if;



if  OLD.reimburse_master_q3 != NEW.reimburse_master_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_q3);

	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_q3');

end if;



if  OLD.reimburse_master_q4 != NEW.reimburse_master_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.reimburse_master_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.reimburse_master_q4);

	set @chdCol=CONCAT(@chdCol,'-','reimburse_master_q4');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_reimbursementmaster(reimburse_master_survey,reimburse_master_part_id,reimburse_master_visitcode,reimburse_master_visitdate,reimburse_master_q1,reimburse_master_q2,reimburse_master_q3,reimburse_master_q4,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.reimburse_master_survey,NEW.reimburse_master_part_id,NEW.reimburse_master_visitcode,NEW.reimburse_master_visitdate,NEW.reimburse_master_q1,NEW.reimburse_master_q2,NEW.reimburse_master_q3,NEW.reimburse_master_q4,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_reimbursementmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_screening`
--

DROP TABLE IF EXISTS `cms_screening`;
CREATE TABLE IF NOT EXISTS `cms_screening` (
  `mem_scrn_id` int(11) NOT NULL AUTO_INCREMENT,
  `mem_scrn_survey` varchar(11) NOT NULL,
  `mem_scrn_loc` varchar(11) NOT NULL,
  `mem_scrn_part_id` varchar(11) NOT NULL,
  `mem_scrn_q1` int(11) DEFAULT NULL,
  `mem_scrn_q2` int(11) DEFAULT NULL,
  `mem_scrn_q3` int(11) DEFAULT NULL,
  `mem_scrn_q4` int(11) DEFAULT NULL,
  `mem_scrn_q5` int(11) DEFAULT NULL,
  `mem_scrn_q6` int(11) DEFAULT NULL,
  `mem_scrn_q7` int(11) DEFAULT NULL,
  `mem_scrn_q8` int(11) DEFAULT NULL,
  `mem_scrn_q9` int(11) DEFAULT NULL,
  `mem_scrn_q10` int(11) NOT NULL,
  `mem_scrn_q11` int(11) DEFAULT NULL,
  `mem_scrn_q12` int(11) DEFAULT NULL,
  `mem_scrn_q13` int(11) DEFAULT NULL,
  `mem_scrn_q14` int(11) DEFAULT NULL,
  `mem_scrn_q15` int(11) DEFAULT NULL,
  `mem_scrn_q16` varchar(25) DEFAULT NULL,
  `mem_scrn_q17` int(11) DEFAULT NULL,
  `mem_scrn_q18` int(11) DEFAULT NULL,
  `mem_scrn_q19` varchar(25) DEFAULT NULL,
  `mem_scrn_q20` int(11) DEFAULT NULL,
  `mem_scrn_q21` int(11) DEFAULT NULL,
  `mem_scrn_q22` int(11) DEFAULT NULL,
  `mem_scrn_q23` int(11) DEFAULT NULL,
  `mem_scrn_q24` int(11) NOT NULL,
  `mem_scrn_q25` int(11) DEFAULT NULL,
  `mem_scrn_q26` int(11) DEFAULT NULL,
  `mem_scrn_q27` int(11) DEFAULT NULL,
  `mem_scrn_q28` int(11) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`mem_scrn_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_screening`
--
DROP TRIGGER IF EXISTS `trig_cms_screening_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_screening_DELETE` BEFORE DELETE ON `cms_screening`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.mem_scrn_id;

set @userid=OLD.update_user;



if  OLD.mem_scrn_id !="" OR OLD.mem_scrn_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_id);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_id');

end if;



if  OLD.mem_scrn_survey !="" OR OLD.mem_scrn_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_survey);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_survey');

end if;



if  OLD.mem_scrn_loc !="" OR OLD.mem_scrn_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_loc);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_loc');

end if;



if  OLD.mem_scrn_part_id !="" OR OLD.mem_scrn_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_part_id);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_part_id');

end if;



if  OLD.mem_scrn_q1 !="" OR OLD.mem_scrn_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q1);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q1');

end if;



if  OLD.mem_scrn_q2 !="" OR OLD.mem_scrn_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q2);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q2');

end if;



if  OLD.mem_scrn_q3 !="" OR OLD.mem_scrn_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q3);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q3');

end if;



if  OLD.mem_scrn_q4 !="" OR OLD.mem_scrn_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q4);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q4');

end if;



if  OLD.mem_scrn_q5 !="" OR OLD.mem_scrn_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q5);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q5');

end if;



if  OLD.mem_scrn_q6 !="" OR OLD.mem_scrn_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q6);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q6');

end if;



if  OLD.mem_scrn_q7 !="" OR OLD.mem_scrn_q7 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q7);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q7');

end if;



if  OLD.mem_scrn_q8 !="" OR OLD.mem_scrn_q8 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q8);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q8');

end if;



if  OLD.mem_scrn_q9 !="" OR OLD.mem_scrn_q9 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q9);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q9');

end if;



if  OLD.mem_scrn_q10 !="" OR OLD.mem_scrn_q10 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q10);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q10');

end if;



if  OLD.mem_scrn_q11 !="" OR OLD.mem_scrn_q11 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q11);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q11');

end if;



if  OLD.mem_scrn_q12 !="" OR OLD.mem_scrn_q12 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q12);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q12');

end if;



if  OLD.mem_scrn_q13 !="" OR OLD.mem_scrn_q13 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q13);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q13');

end if;



if  OLD.mem_scrn_q14 !="" OR OLD.mem_scrn_q14 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q14);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q14');

end if;



if  OLD.mem_scrn_q15 !="" OR OLD.mem_scrn_q15 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q15);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q15');

end if;



if  OLD.mem_scrn_q16 !="" OR OLD.mem_scrn_q16 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q16);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q16');

end if;



if  OLD.mem_scrn_q17 !="" OR OLD.mem_scrn_q17 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q17);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q17');

end if;



if  OLD.mem_scrn_q18 !="" OR OLD.mem_scrn_q18 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q18);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q18');

end if;



if  OLD.mem_scrn_q19 !="" OR OLD.mem_scrn_q19 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q19);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q19');

end if;



if  OLD.mem_scrn_q20 !="" OR OLD.mem_scrn_q20 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q20);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q20');

end if;



if  OLD.mem_scrn_q21 !="" OR OLD.mem_scrn_q21 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q21);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q21');

end if;



if  OLD.mem_scrn_q22 !="" OR OLD.mem_scrn_q22 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q22);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q22');

end if;



if  OLD.mem_scrn_q23 !="" OR OLD.mem_scrn_q23 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q23);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q23');

end if;



if  OLD.mem_scrn_q24 !="" OR OLD.mem_scrn_q24 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q24);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q24');

end if;



if  OLD.mem_scrn_q25 !="" OR OLD.mem_scrn_q25 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q25);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q25');

end if;



if  OLD.mem_scrn_q26 !="" OR OLD.mem_scrn_q26 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q26);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q26');

end if;



if  OLD.mem_scrn_q27 !="" OR OLD.mem_scrn_q27 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q27);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q27');

end if;



if  OLD.mem_scrn_q28 !="" OR OLD.mem_scrn_q28 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q28);



	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q28');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_screening(mem_scrn_survey,mem_scrn_loc,mem_scrn_part_id,mem_scrn_q1,mem_scrn_q2,mem_scrn_q3,mem_scrn_q4,mem_scrn_q5,mem_scrn_q6,mem_scrn_q7,mem_scrn_q8,mem_scrn_q9,mem_scrn_q10,mem_scrn_q11,mem_scrn_q12,mem_scrn_q13,mem_scrn_q14,mem_scrn_q15,mem_scrn_q16,mem_scrn_q17,mem_scrn_q18,mem_scrn_q19,mem_scrn_q20,mem_scrn_q21,mem_scrn_q22,mem_scrn_q23,mem_scrn_q24,mem_scrn_q25,mem_scrn_q26,mem_scrn_q27,mem_scrn_q28,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.mem_scrn_survey,OLD.mem_scrn_loc,OLD.mem_scrn_part_id,OLD.mem_scrn_q1,OLD.mem_scrn_q2,OLD.mem_scrn_q3,OLD.mem_scrn_q4,OLD.mem_scrn_q5,OLD.mem_scrn_q6,OLD.mem_scrn_q7,OLD.mem_scrn_q8,OLD.mem_scrn_q9,OLD.mem_scrn_q10,OLD.mem_scrn_q11,OLD.mem_scrn_q12,OLD.mem_scrn_q13,OLD.mem_scrn_q14,OLD.mem_scrn_q15,OLD.mem_scrn_q16,OLD.mem_scrn_q17,OLD.mem_scrn_q18,OLD.mem_scrn_q19,OLD.mem_scrn_q20,OLD.mem_scrn_q21,OLD.mem_scrn_q22,OLD.mem_scrn_q23,OLD.mem_scrn_q24,OLD.mem_scrn_q25,OLD.mem_scrn_q26,OLD.mem_scrn_q27,OLD.mem_scrn_q28,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_screening', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_screening_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_screening_INSERT` AFTER INSERT ON `cms_screening`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.mem_scrn_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_id);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_id');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_survey);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_survey');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_loc);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_loc');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_part_id);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q1);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q1');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q2);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q2');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q3);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q3');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q4);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q4');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q5);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q5');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q6);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q6');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q7);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q7');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q8);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q8');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q9);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q9');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q10);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q10');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q11);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q11');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q12);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q12');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q13);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q13');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q14);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q14');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q15);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q15');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q16);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q16');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q17);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q17');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q18);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q18');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q19);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q19');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q20);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q20');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q21);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q21');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q22);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q22');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q23);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q23');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q24);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q24');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q25);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q25');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q26);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q26');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q27);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q27');

set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q28);

set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q28');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_screening(mem_scrn_survey,mem_scrn_loc,mem_scrn_part_id,mem_scrn_q1,mem_scrn_q2,mem_scrn_q3,mem_scrn_q4,mem_scrn_q5,mem_scrn_q6,mem_scrn_q7,mem_scrn_q8,mem_scrn_q9,mem_scrn_q10,mem_scrn_q11,mem_scrn_q12,mem_scrn_q13,mem_scrn_q14,mem_scrn_q15,mem_scrn_q16,mem_scrn_q17,mem_scrn_q18,mem_scrn_q19,mem_scrn_q20,mem_scrn_q21,mem_scrn_q22,mem_scrn_q23,mem_scrn_q24,mem_scrn_q25,mem_scrn_q26,mem_scrn_q27,mem_scrn_q28,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.mem_scrn_survey,NEW.mem_scrn_loc,NEW.mem_scrn_part_id,NEW.mem_scrn_q1,NEW.mem_scrn_q2,NEW.mem_scrn_q3,NEW.mem_scrn_q4,NEW.mem_scrn_q5,NEW.mem_scrn_q6,NEW.mem_scrn_q7,NEW.mem_scrn_q8,NEW.mem_scrn_q9,NEW.mem_scrn_q10,NEW.mem_scrn_q11,NEW.mem_scrn_q12,NEW.mem_scrn_q13,NEW.mem_scrn_q14,NEW.mem_scrn_q15,NEW.mem_scrn_q16,NEW.mem_scrn_q17,NEW.mem_scrn_q18,NEW.mem_scrn_q19,NEW.mem_scrn_q20,NEW.mem_scrn_q21,NEW.mem_scrn_q22,NEW.mem_scrn_q23,NEW.mem_scrn_q24,NEW.mem_scrn_q25,NEW.mem_scrn_q26,NEW.mem_scrn_q27,NEW.mem_scrn_q28,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_screening', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_screening_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_screening_UPDATE` BEFORE UPDATE ON `cms_screening`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.mem_scrn_id;

set @userid=NEW.update_user;



if  OLD.mem_scrn_id != NEW.mem_scrn_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_id);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_id);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_id');

end if;



if  OLD.mem_scrn_survey != NEW.mem_scrn_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_survey);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_survey');

end if;



if  OLD.mem_scrn_loc != NEW.mem_scrn_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_loc);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_loc');

end if;



if  OLD.mem_scrn_part_id != NEW.mem_scrn_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_part_id);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_part_id');

end if;



if  OLD.mem_scrn_q1 != NEW.mem_scrn_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q1);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q1');

end if;



if  OLD.mem_scrn_q2 != NEW.mem_scrn_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q2);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q2');

end if;



if  OLD.mem_scrn_q3 != NEW.mem_scrn_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q3);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q3');

end if;



if  OLD.mem_scrn_q4 != NEW.mem_scrn_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q4);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q4');

end if;



if  OLD.mem_scrn_q5 != NEW.mem_scrn_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q5);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q5');

end if;



if  OLD.mem_scrn_q6 != NEW.mem_scrn_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q6);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q6');

end if;



if  OLD.mem_scrn_q7 != NEW.mem_scrn_q7

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q7);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q7);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q7');

end if;



if  OLD.mem_scrn_q8 != NEW.mem_scrn_q8

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q8);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q8);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q8');

end if;



if  OLD.mem_scrn_q9 != NEW.mem_scrn_q9

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q9);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q9);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q9');

end if;



if  OLD.mem_scrn_q10 != NEW.mem_scrn_q10

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q10);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q10);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q10');

end if;



if  OLD.mem_scrn_q11 != NEW.mem_scrn_q11

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q11);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q11);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q11');

end if;



if  OLD.mem_scrn_q12 != NEW.mem_scrn_q12

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q12);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q12);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q12');

end if;



if  OLD.mem_scrn_q13 != NEW.mem_scrn_q13

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q13);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q13);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q13');

end if;



if  OLD.mem_scrn_q14 != NEW.mem_scrn_q14

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q14);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q14);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q14');

end if;



if  OLD.mem_scrn_q15 != NEW.mem_scrn_q15

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q15);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q15);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q15');

end if;



if  OLD.mem_scrn_q16 != NEW.mem_scrn_q16

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q16);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q16);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q16');

end if;



if  OLD.mem_scrn_q17 != NEW.mem_scrn_q17

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q17);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q17);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q17');

end if;



if  OLD.mem_scrn_q18 != NEW.mem_scrn_q18

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q18);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q18);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q18');

end if;



if  OLD.mem_scrn_q19 != NEW.mem_scrn_q19

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q19);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q19);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q19');

end if;



if  OLD.mem_scrn_q20 != NEW.mem_scrn_q20

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q20);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q20);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q20');

end if;



if  OLD.mem_scrn_q21 != NEW.mem_scrn_q21

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q21);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q21);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q21');

end if;



if  OLD.mem_scrn_q22 != NEW.mem_scrn_q22

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q22);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q22);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q22');

end if;



if  OLD.mem_scrn_q23 != NEW.mem_scrn_q23

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q23);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q23);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q23');

end if;



if  OLD.mem_scrn_q24 != NEW.mem_scrn_q24

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q24);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q24);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q24');

end if;



if  OLD.mem_scrn_q25 != NEW.mem_scrn_q25

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q25);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q25);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q25');

end if;



if  OLD.mem_scrn_q26 != NEW.mem_scrn_q26

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q26);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q26);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q26');

end if;



if  OLD.mem_scrn_q27 != NEW.mem_scrn_q27

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q27);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q27);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q27');

end if;



if  OLD.mem_scrn_q28 != NEW.mem_scrn_q28

then

	set @oldval =CONCAT(@oldVal,'-',OLD.mem_scrn_q28);

	set @newVal =CONCAT(@newVal,'-', NEW.mem_scrn_q28);

	set @chdCol=CONCAT(@chdCol,'-','mem_scrn_q28');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_screening(mem_scrn_survey,mem_scrn_loc,mem_scrn_part_id,mem_scrn_q1,mem_scrn_q2,mem_scrn_q3,mem_scrn_q4,mem_scrn_q5,mem_scrn_q6,mem_scrn_q7,mem_scrn_q8,mem_scrn_q9,mem_scrn_q10,mem_scrn_q11,mem_scrn_q12,mem_scrn_q13,mem_scrn_q14,mem_scrn_q15,mem_scrn_q16,mem_scrn_q17,mem_scrn_q18,mem_scrn_q19,mem_scrn_q20,mem_scrn_q21,mem_scrn_q22,mem_scrn_q23,mem_scrn_q24,mem_scrn_q25,mem_scrn_q26,mem_scrn_q27,mem_scrn_q28,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.mem_scrn_survey,NEW.mem_scrn_loc,NEW.mem_scrn_part_id,NEW.mem_scrn_q1,NEW.mem_scrn_q2,NEW.mem_scrn_q3,NEW.mem_scrn_q4,NEW.mem_scrn_q5,NEW.mem_scrn_q6,NEW.mem_scrn_q7,NEW.mem_scrn_q8,NEW.mem_scrn_q9,NEW.mem_scrn_q10,NEW.mem_scrn_q11,NEW.mem_scrn_q12,NEW.mem_scrn_q13,NEW.mem_scrn_q14,NEW.mem_scrn_q15,NEW.mem_scrn_q16,NEW.mem_scrn_q17,NEW.mem_scrn_q18,NEW.mem_scrn_q19,NEW.mem_scrn_q20,NEW.mem_scrn_q21,NEW.mem_scrn_q22,NEW.mem_scrn_q23,NEW.mem_scrn_q24,NEW.mem_scrn_q25,NEW.mem_scrn_q26,NEW.mem_scrn_q27,NEW.mem_scrn_q28,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_screening', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_settings`
--

DROP TABLE IF EXISTS `cms_settings`;
CREATE TABLE IF NOT EXISTS `cms_settings` (
  `stngs_id` int(11) NOT NULL AUTO_INCREMENT,
  `stngs_app_name` text NOT NULL COMMENT 'Application Name',
  `stngs_org_logo` text NOT NULL COMMENT 'Organisation Logo',
  `stngs_org_name` text NOT NULL COMMENT 'Organisation Name',
  `stngs_org_addrs` text NOT NULL COMMENT 'Address',
  `stngs_org_phone` varchar(11) NOT NULL COMMENT 'Phone Number',
  `stngs_org_mail` text NOT NULL COMMENT 'E-Mail',
  `stngs_org_website` text COMMENT 'Website',
  `smtp_admin_name` text COMMENT 'Admin Name',
  `smtp_frm_mail` text COMMENT 'Admin E-Mail',
  `smtp_server_name` text COMMENT 'SMTP Host',
  `smtp_server_port` int(11) DEFAULT NULL COMMENT 'SMTP Port',
  `smtp_server_usrname` text COMMENT 'SMTP Username',
  `smtp_server_pwd` text COMMENT 'SMTP Password',
  `smtp_server_ssl` enum('0','1') DEFAULT NULL COMMENT 'SMTP SSL',
  `smtp_server_auth` enum('0','1') DEFAULT NULL COMMENT 'SMTP Auth',
  `stngs_timezone` varchar(50) NOT NULL COMMENT 'Time Zone',
  `stngs_dateformat` varchar(11) NOT NULL COMMENT 'Date Format',
  `stngs_pagesize` int(11) DEFAULT NULL COMMENT 'Page Size',
  `stngs_incendv_amt` int(11) DEFAULT NULL COMMENT 'Incentive Amount',
  `stngs_financial_year` int(11) DEFAULT NULL COMMENT 'Financial Year',
  `stngs_location` varchar(11) DEFAULT NULL COMMENT 'Default Location',
  `stngs_survey_code` varchar(11) DEFAULT NULL COMMENT 'Survey',
  `stngs_survey_fixed` enum('0','1') DEFAULT NULL COMMENT 'Survey Is Fixed?',
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  PRIMARY KEY (`stngs_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `cms_settings`
--

INSERT INTO `cms_settings` (`stngs_id`, `stngs_app_name`, `stngs_org_logo`, `stngs_org_name`, `stngs_org_addrs`, `stngs_org_phone`, `stngs_org_mail`, `stngs_org_website`, `smtp_admin_name`, `smtp_frm_mail`, `smtp_server_name`, `smtp_server_port`, `smtp_server_usrname`, `smtp_server_pwd`, `smtp_server_ssl`, `smtp_server_auth`, `stngs_timezone`, `stngs_dateformat`, `stngs_pagesize`, `stngs_incendv_amt`, `stngs_financial_year`, `stngs_location`, `stngs_survey_code`, `stngs_survey_fixed`, `status`, `create_time`, `create_user`, `update_time`, `update_user`) VALUES
(1, 'ICC PLUS DATABASE', 'test', 'ICC+ IDU Site - Delhi', 'Opp. Police Station Kodwalli', '8591852596', 'danishkhn69@gmail.com', 'http://www.yrgcare.org', 'Santhanam Anand', 'anand@yrgcare.org', 'pop.bizmail.yahoo.com', 25, 'anand@yrgcare.org', 'TlRNek16TTJOVFk9', '0', '1', 'Asia/Kolkata', 'dd-mm-yyyy', 0, 500, 1112, 'CH', 'ICC+', '1', '1', 2147483647, 0, 1501569576, 13);

--
-- Triggers `cms_settings`
--
DROP TRIGGER IF EXISTS `trig_cms_settings_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_settings_DELETE` BEFORE DELETE ON `cms_settings`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.stngs_id;

set @userid=OLD.update_user;



if  OLD.stngs_id !="" OR OLD.stngs_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_id);



	set @chdCol=CONCAT(@chdCol,'-','stngs_id');

end if;



if  OLD.stngs_app_name !="" OR OLD.stngs_app_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_app_name);



	set @chdCol=CONCAT(@chdCol,'-','stngs_app_name');

end if;



if  OLD.stngs_org_logo !="" OR OLD.stngs_org_logo is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_org_logo);



	set @chdCol=CONCAT(@chdCol,'-','stngs_org_logo');

end if;



if  OLD.stngs_org_name !="" OR OLD.stngs_org_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_org_name);



	set @chdCol=CONCAT(@chdCol,'-','stngs_org_name');

end if;



if  OLD.stngs_org_addrs !="" OR OLD.stngs_org_addrs is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_org_addrs);



	set @chdCol=CONCAT(@chdCol,'-','stngs_org_addrs');

end if;



if  OLD.stngs_org_phone !="" OR OLD.stngs_org_phone is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_org_phone);



	set @chdCol=CONCAT(@chdCol,'-','stngs_org_phone');

end if;



if  OLD.stngs_org_mail !="" OR OLD.stngs_org_mail is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_org_mail);



	set @chdCol=CONCAT(@chdCol,'-','stngs_org_mail');

end if;



if  OLD.stngs_org_website !="" OR OLD.stngs_org_website is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_org_website);



	set @chdCol=CONCAT(@chdCol,'-','stngs_org_website');

end if;



if  OLD.smtp_admin_name !="" OR OLD.smtp_admin_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_admin_name);



	set @chdCol=CONCAT(@chdCol,'-','smtp_admin_name');

end if;



if  OLD.smtp_frm_mail !="" OR OLD.smtp_frm_mail is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_frm_mail);



	set @chdCol=CONCAT(@chdCol,'-','smtp_frm_mail');

end if;



if  OLD.smtp_server_name !="" OR OLD.smtp_server_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_server_name);



	set @chdCol=CONCAT(@chdCol,'-','smtp_server_name');

end if;



if  OLD.smtp_server_port !="" OR OLD.smtp_server_port is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_server_port);



	set @chdCol=CONCAT(@chdCol,'-','smtp_server_port');

end if;



if  OLD.smtp_server_usrname !="" OR OLD.smtp_server_usrname is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_server_usrname);



	set @chdCol=CONCAT(@chdCol,'-','smtp_server_usrname');

end if;



if  OLD.smtp_server_pwd !="" OR OLD.smtp_server_pwd is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_server_pwd);



	set @chdCol=CONCAT(@chdCol,'-','smtp_server_pwd');

end if;



if  OLD.smtp_server_ssl !="" OR OLD.smtp_server_ssl is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_server_ssl);



	set @chdCol=CONCAT(@chdCol,'-','smtp_server_ssl');

end if;



if  OLD.smtp_server_auth !="" OR OLD.smtp_server_auth is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_server_auth);



	set @chdCol=CONCAT(@chdCol,'-','smtp_server_auth');

end if;



if  OLD.stngs_timezone !="" OR OLD.stngs_timezone is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_timezone);



	set @chdCol=CONCAT(@chdCol,'-','stngs_timezone');

end if;



if  OLD.stngs_dateformat !="" OR OLD.stngs_dateformat is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_dateformat);



	set @chdCol=CONCAT(@chdCol,'-','stngs_dateformat');

end if;



if  OLD.stngs_pagesize !="" OR OLD.stngs_pagesize is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_pagesize);



	set @chdCol=CONCAT(@chdCol,'-','stngs_pagesize');

end if;



if  OLD.stngs_incendv_amt !="" OR OLD.stngs_incendv_amt is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_incendv_amt);



	set @chdCol=CONCAT(@chdCol,'-','stngs_incendv_amt');

end if;



if  OLD.stngs_financial_year !="" OR OLD.stngs_financial_year is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_financial_year);



	set @chdCol=CONCAT(@chdCol,'-','stngs_financial_year');

end if;



if  OLD.stngs_location !="" OR OLD.stngs_location is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_location);



	set @chdCol=CONCAT(@chdCol,'-','stngs_location');

end if;



if  OLD.stngs_survey_code !="" OR OLD.stngs_survey_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_survey_code);



	set @chdCol=CONCAT(@chdCol,'-','stngs_survey_code');

end if;



if  OLD.stngs_survey_fixed !="" OR OLD.stngs_survey_fixed is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_survey_fixed);



	set @chdCol=CONCAT(@chdCol,'-','stngs_survey_fixed');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;







INSERT INTO mirror_iccplus.cms_settings(stngs_app_name,stngs_org_logo,stngs_org_name,stngs_org_addrs,stngs_org_phone,stngs_org_mail,stngs_org_website,smtp_admin_name,smtp_frm_mail,smtp_server_name,smtp_server_port,smtp_server_usrname,smtp_server_pwd,smtp_server_ssl,smtp_server_auth,stngs_timezone,stngs_dateformat,stngs_pagesize,stngs_incendv_amt,stngs_financial_year,stngs_location,stngs_survey_code,stngs_survey_fixed,status,create_time,create_user,update_time,update_user) VALUES(OLD.stngs_app_name,OLD.stngs_org_logo,OLD.stngs_org_name,OLD.stngs_org_addrs,OLD.stngs_org_phone,OLD.stngs_org_mail,OLD.stngs_org_website,OLD.smtp_admin_name,OLD.smtp_frm_mail,OLD.smtp_server_name,OLD.smtp_server_port,OLD.smtp_server_usrname,OLD.smtp_server_pwd,OLD.smtp_server_ssl,OLD.smtp_server_auth,OLD.stngs_timezone,OLD.stngs_dateformat,OLD.stngs_pagesize,OLD.stngs_incendv_amt,OLD.stngs_financial_year,OLD.stngs_location,OLD.stngs_survey_code,OLD.stngs_survey_fixed,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_settings', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_settings_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_settings_INSERT` AFTER INSERT ON `cms_settings`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.stngs_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.stngs_id);

set @chdCol=CONCAT(@chdCol,'-','stngs_id');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_app_name);

set @chdCol=CONCAT(@chdCol,'-','stngs_app_name');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_org_logo);

set @chdCol=CONCAT(@chdCol,'-','stngs_org_logo');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_org_name);

set @chdCol=CONCAT(@chdCol,'-','stngs_org_name');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_org_addrs);

set @chdCol=CONCAT(@chdCol,'-','stngs_org_addrs');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_org_phone);

set @chdCol=CONCAT(@chdCol,'-','stngs_org_phone');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_org_mail);

set @chdCol=CONCAT(@chdCol,'-','stngs_org_mail');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_org_website);

set @chdCol=CONCAT(@chdCol,'-','stngs_org_website');

set @newVal =CONCAT(@newVal,'-', NEW.smtp_admin_name);

set @chdCol=CONCAT(@chdCol,'-','smtp_admin_name');

set @newVal =CONCAT(@newVal,'-', NEW.smtp_frm_mail);

set @chdCol=CONCAT(@chdCol,'-','smtp_frm_mail');

set @newVal =CONCAT(@newVal,'-', NEW.smtp_server_name);

set @chdCol=CONCAT(@chdCol,'-','smtp_server_name');

set @newVal =CONCAT(@newVal,'-', NEW.smtp_server_port);

set @chdCol=CONCAT(@chdCol,'-','smtp_server_port');

set @newVal =CONCAT(@newVal,'-', NEW.smtp_server_usrname);

set @chdCol=CONCAT(@chdCol,'-','smtp_server_usrname');

set @newVal =CONCAT(@newVal,'-', NEW.smtp_server_pwd);

set @chdCol=CONCAT(@chdCol,'-','smtp_server_pwd');

set @newVal =CONCAT(@newVal,'-', NEW.smtp_server_ssl);

set @chdCol=CONCAT(@chdCol,'-','smtp_server_ssl');

set @newVal =CONCAT(@newVal,'-', NEW.smtp_server_auth);

set @chdCol=CONCAT(@chdCol,'-','smtp_server_auth');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_timezone);

set @chdCol=CONCAT(@chdCol,'-','stngs_timezone');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_dateformat);

set @chdCol=CONCAT(@chdCol,'-','stngs_dateformat');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_pagesize);

set @chdCol=CONCAT(@chdCol,'-','stngs_pagesize');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_incendv_amt);

set @chdCol=CONCAT(@chdCol,'-','stngs_incendv_amt');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_financial_year);

set @chdCol=CONCAT(@chdCol,'-','stngs_financial_year');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_location);

set @chdCol=CONCAT(@chdCol,'-','stngs_location');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_survey_code);

set @chdCol=CONCAT(@chdCol,'-','stngs_survey_code');

set @newVal =CONCAT(@newVal,'-', NEW.stngs_survey_fixed);

set @chdCol=CONCAT(@chdCol,'-','stngs_survey_fixed');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');





INSERT INTO mirror_iccplus.cms_settings(stngs_app_name,stngs_org_logo,stngs_org_name,stngs_org_addrs,stngs_org_phone,stngs_org_mail,stngs_org_website,smtp_admin_name,smtp_frm_mail,smtp_server_name,smtp_server_port,smtp_server_usrname,smtp_server_pwd,smtp_server_ssl,smtp_server_auth,stngs_timezone,stngs_dateformat,stngs_pagesize,stngs_incendv_amt,stngs_financial_year,stngs_location,stngs_survey_code,stngs_survey_fixed,status,create_time,create_user,update_time,update_user) VALUES(NEW.stngs_app_name,NEW.stngs_org_logo,NEW.stngs_org_name,NEW.stngs_org_addrs,NEW.stngs_org_phone,NEW.stngs_org_mail,NEW.stngs_org_website,NEW.smtp_admin_name,NEW.smtp_frm_mail,NEW.smtp_server_name,NEW.smtp_server_port,NEW.smtp_server_usrname,NEW.smtp_server_pwd,NEW.smtp_server_ssl,NEW.smtp_server_auth,NEW.stngs_timezone,NEW.stngs_dateformat,NEW.stngs_pagesize,NEW.stngs_incendv_amt,NEW.stngs_financial_year,NEW.stngs_location,NEW.stngs_survey_code,NEW.stngs_survey_fixed,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_settings', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_settings_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_settings_UPDATE` BEFORE UPDATE ON `cms_settings`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.stngs_id;

set @userid=NEW.update_user;



if  OLD.stngs_id != NEW.stngs_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_id);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_id);

	set @chdCol=CONCAT(@chdCol,'-','stngs_id');

end if;



if  OLD.stngs_app_name != NEW.stngs_app_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_app_name);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_app_name);

	set @chdCol=CONCAT(@chdCol,'-','stngs_app_name');

end if;



if  OLD.stngs_org_logo != NEW.stngs_org_logo

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_org_logo);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_org_logo);

	set @chdCol=CONCAT(@chdCol,'-','stngs_org_logo');

end if;



if  OLD.stngs_org_name != NEW.stngs_org_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_org_name);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_org_name);

	set @chdCol=CONCAT(@chdCol,'-','stngs_org_name');

end if;



if  OLD.stngs_org_addrs != NEW.stngs_org_addrs

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_org_addrs);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_org_addrs);

	set @chdCol=CONCAT(@chdCol,'-','stngs_org_addrs');

end if;



if  OLD.stngs_org_phone != NEW.stngs_org_phone

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_org_phone);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_org_phone);

	set @chdCol=CONCAT(@chdCol,'-','stngs_org_phone');

end if;



if  OLD.stngs_org_mail != NEW.stngs_org_mail

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_org_mail);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_org_mail);

	set @chdCol=CONCAT(@chdCol,'-','stngs_org_mail');

end if;



if  OLD.stngs_org_website != NEW.stngs_org_website

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_org_website);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_org_website);

	set @chdCol=CONCAT(@chdCol,'-','stngs_org_website');

end if;



if  OLD.smtp_admin_name != NEW.smtp_admin_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_admin_name);

	set @newVal =CONCAT(@newVal,'-', NEW.smtp_admin_name);

	set @chdCol=CONCAT(@chdCol,'-','smtp_admin_name');

end if;



if  OLD.smtp_frm_mail != NEW.smtp_frm_mail

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_frm_mail);

	set @newVal =CONCAT(@newVal,'-', NEW.smtp_frm_mail);

	set @chdCol=CONCAT(@chdCol,'-','smtp_frm_mail');

end if;



if  OLD.smtp_server_name != NEW.smtp_server_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_server_name);

	set @newVal =CONCAT(@newVal,'-', NEW.smtp_server_name);

	set @chdCol=CONCAT(@chdCol,'-','smtp_server_name');

end if;



if  OLD.smtp_server_port != NEW.smtp_server_port

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_server_port);

	set @newVal =CONCAT(@newVal,'-', NEW.smtp_server_port);

	set @chdCol=CONCAT(@chdCol,'-','smtp_server_port');

end if;



if  OLD.smtp_server_usrname != NEW.smtp_server_usrname

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_server_usrname);

	set @newVal =CONCAT(@newVal,'-', NEW.smtp_server_usrname);

	set @chdCol=CONCAT(@chdCol,'-','smtp_server_usrname');

end if;



if  OLD.smtp_server_pwd != NEW.smtp_server_pwd

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_server_pwd);

	set @newVal =CONCAT(@newVal,'-', NEW.smtp_server_pwd);

	set @chdCol=CONCAT(@chdCol,'-','smtp_server_pwd');

end if;



if  OLD.smtp_server_ssl != NEW.smtp_server_ssl

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_server_ssl);

	set @newVal =CONCAT(@newVal,'-', NEW.smtp_server_ssl);

	set @chdCol=CONCAT(@chdCol,'-','smtp_server_ssl');

end if;



if  OLD.smtp_server_auth != NEW.smtp_server_auth

then

	set @oldval =CONCAT(@oldVal,'-',OLD.smtp_server_auth);

	set @newVal =CONCAT(@newVal,'-', NEW.smtp_server_auth);

	set @chdCol=CONCAT(@chdCol,'-','smtp_server_auth');

end if;



if  OLD.stngs_timezone != NEW.stngs_timezone

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_timezone);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_timezone);

	set @chdCol=CONCAT(@chdCol,'-','stngs_timezone');

end if;



if  OLD.stngs_dateformat != NEW.stngs_dateformat

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_dateformat);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_dateformat);

	set @chdCol=CONCAT(@chdCol,'-','stngs_dateformat');

end if;



if  OLD.stngs_pagesize != NEW.stngs_pagesize

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_pagesize);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_pagesize);

	set @chdCol=CONCAT(@chdCol,'-','stngs_pagesize');

end if;



if  OLD.stngs_incendv_amt != NEW.stngs_incendv_amt

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_incendv_amt);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_incendv_amt);

	set @chdCol=CONCAT(@chdCol,'-','stngs_incendv_amt');

end if;



if  OLD.stngs_financial_year != NEW.stngs_financial_year

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_financial_year);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_financial_year);

	set @chdCol=CONCAT(@chdCol,'-','stngs_financial_year');

end if;



if  OLD.stngs_location != NEW.stngs_location

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_location);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_location);

	set @chdCol=CONCAT(@chdCol,'-','stngs_location');

end if;



if  OLD.stngs_survey_code != NEW.stngs_survey_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_survey_code);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_survey_code);

	set @chdCol=CONCAT(@chdCol,'-','stngs_survey_code');

end if;



if  OLD.stngs_survey_fixed != NEW.stngs_survey_fixed

then

	set @oldval =CONCAT(@oldVal,'-',OLD.stngs_survey_fixed);

	set @newVal =CONCAT(@newVal,'-', NEW.stngs_survey_fixed);

	set @chdCol=CONCAT(@chdCol,'-','stngs_survey_fixed');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;







INSERT INTO mirror_iccplus.cms_settings(stngs_app_name,stngs_org_logo,stngs_org_name,stngs_org_addrs,stngs_org_phone,stngs_org_mail,stngs_org_website,smtp_admin_name,smtp_frm_mail,smtp_server_name,smtp_server_port,smtp_server_usrname,smtp_server_pwd,smtp_server_ssl,smtp_server_auth,stngs_timezone,stngs_dateformat,stngs_pagesize,stngs_incendv_amt,stngs_financial_year,stngs_location,stngs_survey_code,stngs_survey_fixed,status,create_time,create_user,update_time,update_user) VALUES(NEW.stngs_app_name,NEW.stngs_org_logo,NEW.stngs_org_name,NEW.stngs_org_addrs,NEW.stngs_org_phone,NEW.stngs_org_mail,NEW.stngs_org_website,NEW.smtp_admin_name,NEW.smtp_frm_mail,NEW.smtp_server_name,NEW.smtp_server_port,NEW.smtp_server_usrname,NEW.smtp_server_pwd,NEW.smtp_server_ssl,NEW.smtp_server_auth,NEW.stngs_timezone,NEW.stngs_dateformat,NEW.stngs_pagesize,NEW.stngs_incendv_amt,NEW.stngs_financial_year,NEW.stngs_location,NEW.stngs_survey_code,NEW.stngs_survey_fixed,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_settings', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_specimenmaster`
--

DROP TABLE IF EXISTS `cms_specimenmaster`;
CREATE TABLE IF NOT EXISTS `cms_specimenmaster` (
  `lab_spcmn_id` int(11) NOT NULL AUTO_INCREMENT,
  `lab_spcmn_code` text NOT NULL COMMENT 'Specimen Code',
  `lab_spcmn_name` text NOT NULL COMMENT 'Specimen Name',
  `status` varchar(1) DEFAULT NULL COMMENT 'Status',
  `del_status` int(11) NOT NULL COMMENT 'Delete Status',
  `create_time` int(11) DEFAULT NULL COMMENT 'Last Updated Time',
  `create_user` int(11) DEFAULT NULL COMMENT 'Last Updated By',
  `update_time` int(11) DEFAULT NULL COMMENT 'Last Updated Time',
  `update_user` int(11) DEFAULT NULL COMMENT 'Last Updated By',
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`lab_spcmn_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;

--
-- Dumping data for table `cms_specimenmaster`
--

INSERT INTO `cms_specimenmaster` (`lab_spcmn_id`, `lab_spcmn_code`, `lab_spcmn_name`, `status`, `del_status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(1, 'BLD', 'WHOLE BLOOD', '1', 0, 1481040143, 1, 1482176353, 1, 1481040143),
(2, 'SER', 'SERUM', '1', 0, 1482176365, 1, 1482176365, NULL, 1482176365),
(3, 'PLA', 'PLASMA', '1', 0, 1482176374, 1, 1482176374, NULL, 1482176374),
(4, 'URI', 'URINE', '1', 0, 1482176386, 1, 1482176386, NULL, 1482176386),
(5, 'STL', 'STOOL', '1', 0, 1482176396, 1, 1482176396, NULL, 1482176396),
(6, 'DBS', 'DRIED BLOOD SPOT', '1', 0, 1482176406, 1, 1482176406, NULL, 1482176406),
(7, 'ES', 'ENDOCERVICAL SWAB', '1', 0, 1482176417, 1, 1482176417, NULL, 1482176417),
(8, 'SPU', 'SPUTUM', '1', 0, 1482176427, 1, 1482176427, NULL, 1482176427),
(9, 'PUS', 'PUS', '1', 0, 1482176437, 1, 1482176437, NULL, 1482176437),
(10, 'OF', 'OTHER STERILE FLUIDS', '1', 0, 1482176447, 1, 1482176447, NULL, 1482176447),
(11, 'AF', 'ASCITIC FLIUD', '1', 0, 1482176455, 1, 1482176455, NULL, 1482176455),
(12, 'CSF', 'CSF', '1', 0, 1482176463, 1, 1482176463, NULL, 1482176463),
(13, 'PS', 'PAP SMEAR', '1', 0, 1482176471, 1, 1482176471, NULL, 1482176471),
(14, 'TS', 'THROAT SWAB', '1', 0, 1482176481, 1, 1482176481, NULL, 1482176481);

--
-- Triggers `cms_specimenmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_specimenmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_specimenmaster_DELETE` BEFORE DELETE ON `cms_specimenmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.lab_spcmn_id;

set @userid=OLD.update_user;



if  OLD.lab_spcmn_id !="" OR OLD.lab_spcmn_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_spcmn_id);



	set @chdCol=CONCAT(@chdCol,'-','lab_spcmn_id');

end if;



if  OLD.lab_spcmn_code !="" OR OLD.lab_spcmn_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_spcmn_code);



	set @chdCol=CONCAT(@chdCol,'-','lab_spcmn_code');

end if;



if  OLD.lab_spcmn_name !="" OR OLD.lab_spcmn_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_spcmn_name);



	set @chdCol=CONCAT(@chdCol,'-','lab_spcmn_name');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.del_status !="" OR OLD.del_status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.del_status);



	set @chdCol=CONCAT(@chdCol,'-','del_status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_specimenmaster(lab_spcmn_code,lab_spcmn_name,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.lab_spcmn_code,OLD.lab_spcmn_name,OLD.status,OLD.del_status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_specimenmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_specimenmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_specimenmaster_INSERT` AFTER INSERT ON `cms_specimenmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_spcmn_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.lab_spcmn_id);

set @chdCol=CONCAT(@chdCol,'-','lab_spcmn_id');

set @newVal =CONCAT(@newVal,'-', NEW.lab_spcmn_code);

set @chdCol=CONCAT(@chdCol,'-','lab_spcmn_code');

set @newVal =CONCAT(@newVal,'-', NEW.lab_spcmn_name);

set @chdCol=CONCAT(@chdCol,'-','lab_spcmn_name');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.del_status);

set @chdCol=CONCAT(@chdCol,'-','del_status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_specimenmaster(lab_spcmn_code,lab_spcmn_name,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_spcmn_code,NEW.lab_spcmn_name,NEW.status,NEW.del_status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_specimenmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_specimenmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_specimenmaster_UPDATE` BEFORE UPDATE ON `cms_specimenmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.lab_spcmn_id;

set @userid=NEW.update_user;



if  OLD.lab_spcmn_id != NEW.lab_spcmn_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_spcmn_id);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_spcmn_id);

	set @chdCol=CONCAT(@chdCol,'-','lab_spcmn_id');

end if;



if  OLD.lab_spcmn_code != NEW.lab_spcmn_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_spcmn_code);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_spcmn_code);

	set @chdCol=CONCAT(@chdCol,'-','lab_spcmn_code');

end if;



if  OLD.lab_spcmn_name != NEW.lab_spcmn_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.lab_spcmn_name);

	set @newVal =CONCAT(@newVal,'-', NEW.lab_spcmn_name);

	set @chdCol=CONCAT(@chdCol,'-','lab_spcmn_name');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.del_status != NEW.del_status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.del_status);

	set @newVal =CONCAT(@newVal,'-', NEW.del_status);

	set @chdCol=CONCAT(@chdCol,'-','del_status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_specimenmaster(lab_spcmn_code,lab_spcmn_name,status,del_status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.lab_spcmn_code,NEW.lab_spcmn_name,NEW.status,NEW.del_status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_specimenmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_sti`
--

DROP TABLE IF EXISTS `cms_sti`;
CREATE TABLE IF NOT EXISTS `cms_sti` (
  `sti_test_id` int(11) NOT NULL AUTO_INCREMENT,
  `sti_test_survey` varchar(11) NOT NULL,
  `sti_test_loc` varchar(11) NOT NULL,
  `sti_test_part_id` varchar(11) NOT NULL,
  `sti_test_q1` int(11) NOT NULL,
  `sti_test_q2` varchar(100) NOT NULL,
  `sti_test_q3` varchar(100) DEFAULT NULL,
  `sti_test_q4` int(11) NOT NULL,
  `sti_test_q5` varchar(50) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`sti_test_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_sti`
--
DROP TRIGGER IF EXISTS `trig_cms_sti_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_sti_DELETE` BEFORE DELETE ON `cms_sti`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.sti_test_id;

set @userid=OLD.update_user;



if  OLD.sti_test_id !="" OR OLD.sti_test_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_id);



	set @chdCol=CONCAT(@chdCol,'-','sti_test_id');

end if;



if  OLD.sti_test_survey !="" OR OLD.sti_test_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_survey);



	set @chdCol=CONCAT(@chdCol,'-','sti_test_survey');

end if;



if  OLD.sti_test_loc !="" OR OLD.sti_test_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_loc);



	set @chdCol=CONCAT(@chdCol,'-','sti_test_loc');

end if;



if  OLD.sti_test_part_id !="" OR OLD.sti_test_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_part_id);



	set @chdCol=CONCAT(@chdCol,'-','sti_test_part_id');

end if;



if  OLD.sti_test_q1 !="" OR OLD.sti_test_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_q1);



	set @chdCol=CONCAT(@chdCol,'-','sti_test_q1');

end if;



if  OLD.sti_test_q2 !="" OR OLD.sti_test_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_q2);



	set @chdCol=CONCAT(@chdCol,'-','sti_test_q2');

end if;



if  OLD.sti_test_q3 !="" OR OLD.sti_test_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_q3);



	set @chdCol=CONCAT(@chdCol,'-','sti_test_q3');

end if;



if  OLD.sti_test_q4 !="" OR OLD.sti_test_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_q4);



	set @chdCol=CONCAT(@chdCol,'-','sti_test_q4');

end if;



if  OLD.sti_test_q5 !="" OR OLD.sti_test_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_q5);



	set @chdCol=CONCAT(@chdCol,'-','sti_test_q5');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_sti(sti_test_survey,sti_test_loc,sti_test_part_id,sti_test_q1,sti_test_q2,sti_test_q3,sti_test_q4,sti_test_q5,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.sti_test_survey,OLD.sti_test_loc,OLD.sti_test_part_id,OLD.sti_test_q1,OLD.sti_test_q2,OLD.sti_test_q3,OLD.sti_test_q4,OLD.sti_test_q5,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_sti', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_sti_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_sti_INSERT` AFTER INSERT ON `cms_sti`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.sti_test_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.sti_test_id);

set @chdCol=CONCAT(@chdCol,'-','sti_test_id');

set @newVal =CONCAT(@newVal,'-', NEW.sti_test_survey);

set @chdCol=CONCAT(@chdCol,'-','sti_test_survey');

set @newVal =CONCAT(@newVal,'-', NEW.sti_test_loc);

set @chdCol=CONCAT(@chdCol,'-','sti_test_loc');

set @newVal =CONCAT(@newVal,'-', NEW.sti_test_part_id);

set @chdCol=CONCAT(@chdCol,'-','sti_test_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.sti_test_q1);

set @chdCol=CONCAT(@chdCol,'-','sti_test_q1');

set @newVal =CONCAT(@newVal,'-', NEW.sti_test_q2);

set @chdCol=CONCAT(@chdCol,'-','sti_test_q2');

set @newVal =CONCAT(@newVal,'-', NEW.sti_test_q3);

set @chdCol=CONCAT(@chdCol,'-','sti_test_q3');

set @newVal =CONCAT(@newVal,'-', NEW.sti_test_q4);

set @chdCol=CONCAT(@chdCol,'-','sti_test_q4');

set @newVal =CONCAT(@newVal,'-', NEW.sti_test_q5);

set @chdCol=CONCAT(@chdCol,'-','sti_test_q5');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_sti(sti_test_survey,sti_test_loc,sti_test_part_id,sti_test_q1,sti_test_q2,sti_test_q3,sti_test_q4,sti_test_q5,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.sti_test_survey,NEW.sti_test_loc,NEW.sti_test_part_id,NEW.sti_test_q1,NEW.sti_test_q2,NEW.sti_test_q3,NEW.sti_test_q4,NEW.sti_test_q5,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_sti', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_sti_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_sti_UPDATE` BEFORE UPDATE ON `cms_sti`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.sti_test_id;

set @userid=NEW.update_user;



if  OLD.sti_test_id != NEW.sti_test_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_id);

	set @newVal =CONCAT(@newVal,'-', NEW.sti_test_id);

	set @chdCol=CONCAT(@chdCol,'-','sti_test_id');

end if;



if  OLD.sti_test_survey != NEW.sti_test_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.sti_test_survey);

	set @chdCol=CONCAT(@chdCol,'-','sti_test_survey');

end if;



if  OLD.sti_test_loc != NEW.sti_test_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.sti_test_loc);

	set @chdCol=CONCAT(@chdCol,'-','sti_test_loc');

end if;



if  OLD.sti_test_part_id != NEW.sti_test_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.sti_test_part_id);

	set @chdCol=CONCAT(@chdCol,'-','sti_test_part_id');

end if;



if  OLD.sti_test_q1 != NEW.sti_test_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.sti_test_q1);

	set @chdCol=CONCAT(@chdCol,'-','sti_test_q1');

end if;



if  OLD.sti_test_q2 != NEW.sti_test_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.sti_test_q2);

	set @chdCol=CONCAT(@chdCol,'-','sti_test_q2');

end if;



if  OLD.sti_test_q3 != NEW.sti_test_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.sti_test_q3);

	set @chdCol=CONCAT(@chdCol,'-','sti_test_q3');

end if;



if  OLD.sti_test_q4 != NEW.sti_test_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.sti_test_q4);

	set @chdCol=CONCAT(@chdCol,'-','sti_test_q4');

end if;



if  OLD.sti_test_q5 != NEW.sti_test_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sti_test_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.sti_test_q5);

	set @chdCol=CONCAT(@chdCol,'-','sti_test_q5');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_sti(sti_test_survey,sti_test_loc,sti_test_part_id,sti_test_q1,sti_test_q2,sti_test_q3,sti_test_q4,sti_test_q5,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.sti_test_survey,NEW.sti_test_loc,NEW.sti_test_part_id,NEW.sti_test_q1,NEW.sti_test_q2,NEW.sti_test_q3,NEW.sti_test_q4,NEW.sti_test_q5,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_sti', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_submenu`
--

DROP TABLE IF EXISTS `cms_submenu`;
CREATE TABLE IF NOT EXISTS `cms_submenu` (
  `sub_mnu_id` int(11) NOT NULL AUTO_INCREMENT,
  `min_mnu_id_fk` int(11) NOT NULL,
  `sub_mnu_name` text NOT NULL,
  `sub_mnu_desc` text NOT NULL,
  `sub_mnu_preference` int(11) NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`sub_mnu_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=93 ;

--
-- Dumping data for table `cms_submenu`
--

INSERT INTO `cms_submenu` (`sub_mnu_id`, `min_mnu_id_fk`, `sub_mnu_name`, `sub_mnu_desc`, `sub_mnu_preference`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(1, 1, 'arvmaster', 'ARV Master', 1, '1', 1487990425, 1, 1488617252, 1, 1488565800),
(2, 9, 'attandance/create', 'Attendance In Entry', 1, '1', 1487990425, 1, 1488617257, 1, 1488565800),
(3, 9, 'attandanceout/create', 'Attendance Out Entry', 2, '1', 1487990425, 1, 1488617263, 1, 1488565800),
(4, 5, 'cd4/create', 'CD4 Count Record', 3, '1', 1487990425, 1, 1489723482, 1, 1488565800),
(5, 6, 'contact/create', 'Contact', 12, '1', 1487990425, 1, 1496718000, 1, 1488565800),
(7, 3, 'counselor/create', 'Counselor Services', 1, '1', 1488389934, 1, 1488617244, 1, 1488565800),
(8, 1, 'department', 'Lab Departments', 2, '1', 1488389955, 1, 1488617280, 1, 1488565800),
(10, 5, 'hcvlinkage/create', 'HCV Linkage', 4, '1', 1488389999, 1, 1488617567, 1, 1488565800),
(11, 3, 'hcvtesting/create', 'HCV Counseling & Testing', 5, '1', 1488390015, 1, 1489723538, 1, 1488565800),
(12, 3, 'hivcounseling/create', 'HIV Motivational Counseling Form', 4, '1', 1488390030, 1, 1496820066, 1, 1488565800),
(13, 5, 'hivlinkage/create', 'HIV Linkage', 1, '1', 1488390181, 1, 1488617535, 1, 1488565800),
(14, 3, 'hivtesting/create', 'HIV Counseling & Testing', 2, '1', 1488390203, 1, 1489036368, 1, 1488565800),
(15, 5, 'hivvisit/create', 'HIV  Visit', 2, '1', 1488390228, 1, 1489723506, 1, 1488565800),
(16, 1, 'labmaster', 'Lab Test Master', 3, '1', 1488390379, 1, 1488617370, 1, 1488565800),
(17, 1, 'labresultsmaster', 'Lab Result Master', 5, '1', 1488390403, 1, 1488618557, 1, 1488565800),
(18, 2, 'labsamplerequest', 'Lab Request / Result Entry', 1, '1', 1488390429, 1, 1489404317, 1, 1488565800),
(19, 1, 'labtestmapping', 'Lab Test Mapping', 6, '1', 1488390648, 1, 1488618572, 1, 1488565800),
(20, 5, 'linkidlinkage/create', 'Other Linked IDs', 5, '1', 1488390677, 1, 1495687627, 1, 1488565800),
(21, 1, 'locationmapping', 'Location Mapping', 8, '1', 1488390702, 1, 1488618648, 1, 1488565800),
(22, 1, 'locationmaster', 'Location Master', 7, '1', 1488390716, 1, 1488618636, 1, 1488565800),
(23, 7, 'mainmenu', 'Mainmenu', 1, '1', 1488390737, 1, 1488617006, 1, 1488565800),
(24, 7, 'menuprivileges', 'User Privileges', 4, '1', 1488390751, 1, 1488617055, 1, 1488565800),
(25, 5, 'mortalityform/create', 'Mortality Form', 8, '1', 1488390763, 1, 1488617607, 1, 1488565800),
(26, 4, 'nursevisit/create', 'Nurse Services', 1, '1', 1488390775, 1, 1488617482, 1, 1488565800),
(27, 1, 'ostmaster/create', 'OST Master', 9, '1', 1488390789, 1, 1488617415, 1, 1488565800),
(28, 4, 'ostvisit', 'OST Visit', 6, '1', 1488390804, 1, 1496634547, 1, 1488565800),
(29, 9, 'registration/create', 'Registration', 3, '1', 1488390816, 1, 1488617509, 1, 1488565800),
(30, 7, 'reimbursementheads', 'Reimbursement Heads', 5, '1', 1488390877, 1, 1488617069, 1, 1488565800),
(31, 6, 'screening/create', 'Cohort - Screening Form', 2, '1', 1488390890, 1, 1489382773, 1, 1488565800),
(32, 1, 'specimenmaster', 'Lab Specimen Master', 4, '1', 1488390907, 1, 1488618544, 1, 1488565800),
(33, 4, 'sti/create', 'STI Form', 7, '1', 1488390915, 1, 1489723578, 1, 1488565800),
(34, 7, 'submenu', 'Submenu', 2, '1', 1488390925, 1, 1488617036, 1, 1488565800),
(35, 1, 'surveymaster', 'Surveymaster', 10, '1', 1488390936, 1, 1488617436, 1, 1488565800),
(36, 4, 'tb/create', 'TB Form', 8, '1', 1488390946, 1, 1489723597, 1, 1488565800),
(37, 5, 'trackingform/create', 'Client Tracking Form', 7, '1', 1488390958, 1, 1488617586, 1, 1488565800),
(38, 7, 'users', 'User Creation', 3, '1', 1488390996, 1, 1488617025, 1, 1488565800),
(39, 6, 'demographics/create', 'Cohort - Demographics Form', 3, '1', 1488432946, 1, 1489382794, 1, 1488565800),
(40, 6, 'qualityoflife/create', 'Cohort - Quality of Life Form', 4, '1', 1488436557, 1, 1488618280, 1, 1488565800),
(42, 6, 'hivcontinuum/create', 'Cohort - HIV Continuum Form', 5, '1', 1488885925, 1, 1488963276, 1, 1488825000),
(43, 6, 'preartbeliefs/create', 'Cohort - Pre-ART Beliefs Form', 6, '1', 1488956583, 1, 1488963327, 1, 1488911400),
(44, 6, 'postartbeliefs/create', 'Cohort - Post-ART Beliefs Form', 7, '1', 1488963370, 1, 1489382852, 1, 1488911400),
(45, 13, 'export', 'Data Export', 1, '1', 1489031093, 1, 1494217618, 1, 1488997800),
(46, 6, 'substanceuse/create', 'Cohort - Substance Use Form', 8, '1', 1489143404, 1, 1489382937, 1, 1489084200),
(47, 7, 'import', 'Data Import', 7, '1', 1489232881, 1, 1489232881, NULL, 1489170600),
(48, 6, 'riskbehavior/create', 'Cohort - Risk Behavior Form', 9, '1', 1489290228, 1, 1489382935, 1, 1489257000),
(49, 6, 'depression/create', 'Cohort - Depression Form', 10, '1', 1489290388, 1, 1489382931, 1, 1489257000),
(50, 6, 'healthcareutilization/create', 'Cohort - Health Care Utilization Form', 11, '1', 1489382626, 1, 1489382930, 1, 1489343400),
(51, 5, 'updatecontact/create', 'Mobile Number Updation', 9, '1', 1490072407, 1, 1490079966, 1, 1490034600),
(52, 13, 'patientcrosstabreport', 'Patient Cross Tab Report', 2, '1', 1490441519, 1, 1490441519, NULL, 1490380200),
(53, 1, 'labresultmapping', 'Lab Test & Result Mapping', 7, '1', 1493090568, 1, 1493090568, NULL, 1493058600),
(54, 3, 'counselor/posthiv', 'Post HIV Service Entry', 3, '1', 1493270454, 1, 1493270454, NULL, 1493231400),
(55, 3, 'counselor/posthcv', 'Post HCV Service Entry', 6, '1', 1493270487, 1, 1493270487, NULL, 1493231400),
(57, 13, 'ostvisitreport', 'OST Visit Report', 5, '1', 1493461031, 1, 1493461031, NULL, 1493404200),
(59, 13, 'drugdisprep', 'OST Drug Dispense Report', 7, '1', 1493463667, 1, 1493463667, NULL, 1493404200),
(60, 1, 'incentivesmaster', 'Incentive Master', 12, '1', 1495131431, 1, 1495131566, 1, 1495045800),
(61, 1, 'artinitiationincentmaster', 'ART Initiation Incentives', 13, '1', 1495138186, 1, 1495144899, 1, 1495132200),
(62, 1, 'motincenmaster', 'Motivational Counseling Incentive', 14, '1', 1495144876, 1, 1495144905, 1, 1495132200),
(63, 1, 'preartincenmaster', 'Pre-ART Incentives', 15, '1', 1495210111, 1, 1495210123, 1, 1495132200),
(64, 1, 'artincenmaster', 'ART Refill Incentives', 16, '1', 1495217268, 1, 1495217268, NULL, 1495132200),
(65, 4, 'ostvisitnew', 'OST Visit New', 6, '1', 1496398564, 1, 1496634486, 1, 1496341800),
(66, 14, 'ostvisitnew/create', 'Daily OST Entry', 1, '1', 1496634287, 1, 1496634424, 1, 1496601000),
(67, 1, 'reimbursementmaster', 'Cohort Reimbursement', 17, '1', 1496719191, 1, 1496723125, 1, 1496687400),
(68, 1, 'applicationsettings', 'Application Settings', 18, '1', 1497944932, 1, 1497944932, NULL, 1497897000),
(69, 1, 'exportmaster', 'Export Master', 19, '1', 1498542346, 1, 1498542416, 1, 1498501800),
(70, 1, 'fieldmaster', 'Field Master', 20, '1', 1498542377, 1, 1498542377, NULL, 1498501800),
(71, 1, 'artbook', 'ART Book - SCAN', 21, '1', 1498795164, 13, 1498804801, 13, 1498761000),
(72, 13, 'counselorreport', 'Counselor Service Report', 4, '1', 1498803439, 13, 1498817424, 13, 1498761000),
(73, 13, 'nursereport', 'Nurse Service Report', 3, '1', 1498817124, 13, 1498817405, 13, 1498761000),
(74, 13, 'incentivenewreport', 'Incentive Report - Client Wise', 7, '1', 1498873913, 1, 1499051805, 13, 1498847400),
(75, 6, 'visitentry', 'Cohort Visit Entry', 1, '1', 1499058543, 13, 1499065229, 13, 1499020200),
(76, 13, 'incentivereport', 'Incentive Report - Client Wise with date', 8, '1', 1499141915, 1, 1499141915, NULL, 1499106600),
(77, 13, 'hivstatusreport', 'Client wise HIV Status Report', 8, '1', 1499146879, 13, 1499146879, NULL, 1499106600),
(78, 7, 'settings', 'Main Settings', 1, '1', 1499220637, 13, 1499220637, NULL, 1499193000),
(79, 13, 'labpendingreport', 'Lab Test Pending Report', 10, '1', 1499235510, 13, 1499235510, NULL, 1499193000),
(80, 13, 'labtestreport', 'Client wise - Lab Test Results Printing', 11, '1', 1500517944, 13, 1501460285, 13, 1500489000),
(81, 13, 'visitschedulereport', 'Client Wise Visit Schedule Report', 11, '1', 1501307523, 13, 1504503129, 13, 1501266600),
(82, 15, 'hivtestreport', 'HIV Counseling & Testing Export', 2, '1', 1502260038, 13, 1504503031, 13, 1502217000),
(83, 15, 'stireport', 'STI Export', 4, '1', 1502279912, 13, 1504503151, 13, 1502217000),
(84, 15, 'hcvtestreport', 'HCV Counseling & Testing Export', 3, '1', 1502859233, 13, 1504503035, 13, 1502821800),
(85, 15, 'trackingreport', 'Tracking Form Export', 5, '1', 1502863951, 13, 1504503091, 13, 1502821800),
(86, 15, 'mortalityreport', 'Mortality Form Export', 6, '1', 1502863974, 13, 1504503087, 13, 1502821800),
(87, 13, 'labtestwisereport', 'Lab Test Wise Report', 14, '1', 1502879942, 13, 1504853197, 13, 1502821800),
(88, 13, 'ostweekreport', 'OST Summary Report', 20, '1', 1503398026, 13, 1504864499, 13, 1503340200),
(89, 15, 'registrationreport', 'Registration Export', 1, '1', 1504502977, 13, 1504502977, NULL, 1504463400),
(90, 15, 'fingerprintreport', 'Participant Finger print Export', 7, '1', 1504524050, 13, 1504524050, NULL, 1504463400),
(91, 13, 'misreport', 'MIS Report', 23, '1', 1504681884, 13, 1504683412, 13, 1504636200),
(92, 13, 'ostmonthreport', 'OST Monthly Distribution Chart', 14, '1', 1504853062, 13, 1504853143, 13, 1504809000);

--
-- Triggers `cms_submenu`
--
DROP TRIGGER IF EXISTS `trig_cms_submenu_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_submenu_DELETE` BEFORE DELETE ON `cms_submenu`
 FOR EACH ROW BEGIN
set @oldVal='';
set @newVal='';
set @chdCol='';
set @id=OLD.sub_mnu_id;
set @userid=OLD.update_user;

if  OLD.sub_mnu_id !="" OR OLD.sub_mnu_id is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.sub_mnu_id);

	set @chdCol=CONCAT(@chdCol,'-','sub_mnu_id');
end if;

if  OLD.min_mnu_id_fk !="" OR OLD.min_mnu_id_fk is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.min_mnu_id_fk);

	set @chdCol=CONCAT(@chdCol,'-','min_mnu_id_fk');
end if;

if  OLD.sub_mnu_name !="" OR OLD.sub_mnu_name is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.sub_mnu_name);

	set @chdCol=CONCAT(@chdCol,'-','sub_mnu_name');
end if;

if  OLD.sub_mnu_desc !="" OR OLD.sub_mnu_desc is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.sub_mnu_desc);

	set @chdCol=CONCAT(@chdCol,'-','sub_mnu_desc');
end if;

if  OLD.sub_mnu_preference !="" OR OLD.sub_mnu_preference is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.sub_mnu_preference);

	set @chdCol=CONCAT(@chdCol,'-','sub_mnu_preference');
end if;

if  OLD.status !="" OR OLD.status is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @chdCol=CONCAT(@chdCol,'-','status');
end if;

if  OLD.create_time !="" OR OLD.create_time is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');
end if;

if  OLD.create_user !="" OR OLD.create_user is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');
end if;

if  OLD.update_time !="" OR OLD.update_time is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');
end if;

if  OLD.update_user !="" OR OLD.update_user is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');
end if;

if  OLD.record_date !="" OR OLD.record_date is not null 
then
	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');
end if;



INSERT INTO mirror_iccplus.cms_submenu(min_mnu_id_fk,sub_mnu_name,sub_mnu_desc,sub_mnu_preference,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.min_mnu_id_fk,OLD.sub_mnu_name,OLD.sub_mnu_desc,OLD.sub_mnu_preference,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);

 
INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_submenu', NOW(),'d',@id,@userid,@oldVal,@newVal,'');

END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_submenu_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_submenu_INSERT` AFTER INSERT ON `cms_submenu`
 FOR EACH ROW BEGIN
set @oldVal='';
set @newVal='';
set @chdCol='';
set @id=NEW.sub_mnu_id;
set @userid=NEW.create_user;

set @newVal =CONCAT(@newVal,'-', NEW.sub_mnu_id);
set @chdCol=CONCAT(@chdCol,'-','sub_mnu_id');
set @newVal =CONCAT(@newVal,'-', NEW.min_mnu_id_fk);
set @chdCol=CONCAT(@chdCol,'-','min_mnu_id_fk');
set @newVal =CONCAT(@newVal,'-', NEW.sub_mnu_name);
set @chdCol=CONCAT(@chdCol,'-','sub_mnu_name');
set @newVal =CONCAT(@newVal,'-', NEW.sub_mnu_desc);
set @chdCol=CONCAT(@chdCol,'-','sub_mnu_desc');
set @newVal =CONCAT(@newVal,'-', NEW.sub_mnu_preference);
set @chdCol=CONCAT(@chdCol,'-','sub_mnu_preference');
set @newVal =CONCAT(@newVal,'-', NEW.status);
set @chdCol=CONCAT(@chdCol,'-','status');
set @newVal =CONCAT(@newVal,'-', NEW.create_time);
set @chdCol=CONCAT(@chdCol,'-','create_time');
set @newVal =CONCAT(@newVal,'-', NEW.create_user);
set @chdCol=CONCAT(@chdCol,'-','create_user');
set @newVal =CONCAT(@newVal,'-', NEW.update_time);
set @chdCol=CONCAT(@chdCol,'-','update_time');
set @newVal =CONCAT(@newVal,'-', NEW.update_user);
set @chdCol=CONCAT(@chdCol,'-','update_user');
set @newVal =CONCAT(@newVal,'-', NEW.record_date);
set @chdCol=CONCAT(@chdCol,'-','record_date');


INSERT INTO mirror_iccplus.cms_submenu(min_mnu_id_fk,sub_mnu_name,sub_mnu_desc,sub_mnu_preference,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.min_mnu_id_fk,NEW.sub_mnu_name,NEW.sub_mnu_desc,NEW.sub_mnu_preference,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);


INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_submenu', NOW(),'i',@id,@userid,@oldVal,@newVal,'');

END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_submenu_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_submenu_UPDATE` BEFORE UPDATE ON `cms_submenu`
 FOR EACH ROW BEGIN
set @oldVal='';
set @newVal='';
set @chdCol='';
set @id=NEW.sub_mnu_id;
set @userid=NEW.update_user;

if  OLD.sub_mnu_id != NEW.sub_mnu_id
then
	set @oldval =CONCAT(@oldVal,'-',OLD.sub_mnu_id);
	set @newVal =CONCAT(@newVal,'-', NEW.sub_mnu_id);
	set @chdCol=CONCAT(@chdCol,'-','sub_mnu_id');
end if;

if  OLD.min_mnu_id_fk != NEW.min_mnu_id_fk
then
	set @oldval =CONCAT(@oldVal,'-',OLD.min_mnu_id_fk);
	set @newVal =CONCAT(@newVal,'-', NEW.min_mnu_id_fk);
	set @chdCol=CONCAT(@chdCol,'-','min_mnu_id_fk');
end if;

if  OLD.sub_mnu_name != NEW.sub_mnu_name
then
	set @oldval =CONCAT(@oldVal,'-',OLD.sub_mnu_name);
	set @newVal =CONCAT(@newVal,'-', NEW.sub_mnu_name);
	set @chdCol=CONCAT(@chdCol,'-','sub_mnu_name');
end if;

if  OLD.sub_mnu_desc != NEW.sub_mnu_desc
then
	set @oldval =CONCAT(@oldVal,'-',OLD.sub_mnu_desc);
	set @newVal =CONCAT(@newVal,'-', NEW.sub_mnu_desc);
	set @chdCol=CONCAT(@chdCol,'-','sub_mnu_desc');
end if;

if  OLD.sub_mnu_preference != NEW.sub_mnu_preference
then
	set @oldval =CONCAT(@oldVal,'-',OLD.sub_mnu_preference);
	set @newVal =CONCAT(@newVal,'-', NEW.sub_mnu_preference);
	set @chdCol=CONCAT(@chdCol,'-','sub_mnu_preference');
end if;

if  OLD.status != NEW.status
then
	set @oldval =CONCAT(@oldVal,'-',OLD.status);
	set @newVal =CONCAT(@newVal,'-', NEW.status);
	set @chdCol=CONCAT(@chdCol,'-','status');
end if;

if  OLD.create_time != NEW.create_time
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);
	set @newVal =CONCAT(@newVal,'-', NEW.create_time);
	set @chdCol=CONCAT(@chdCol,'-','create_time');
end if;

if  OLD.create_user != NEW.create_user
then
	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);
	set @newVal =CONCAT(@newVal,'-', NEW.create_user);
	set @chdCol=CONCAT(@chdCol,'-','create_user');
end if;

if  OLD.update_time != NEW.update_time
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);
	set @newVal =CONCAT(@newVal,'-', NEW.update_time);
	set @chdCol=CONCAT(@chdCol,'-','update_time');
end if;

if  OLD.update_user != NEW.update_user
then
	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);
	set @newVal =CONCAT(@newVal,'-', NEW.update_user);
	set @chdCol=CONCAT(@chdCol,'-','update_user');
end if;

if  OLD.record_date != NEW.record_date
then
	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);
	set @newVal =CONCAT(@newVal,'-', NEW.record_date);
	set @chdCol=CONCAT(@chdCol,'-','record_date');
end if;



INSERT INTO mirror_iccplus.cms_submenu(min_mnu_id_fk,sub_mnu_name,sub_mnu_desc,sub_mnu_preference,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.min_mnu_id_fk,NEW.sub_mnu_name,NEW.sub_mnu_desc,NEW.sub_mnu_preference,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);


INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_submenu', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);

END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_surveymaster`
--

DROP TABLE IF EXISTS `cms_surveymaster`;
CREATE TABLE IF NOT EXISTS `cms_surveymaster` (
  `sur_id` int(11) NOT NULL AUTO_INCREMENT,
  `sur_code` text NOT NULL,
  `sur_title` text NOT NULL,
  `sur_url` text NOT NULL,
  `sur_onlne_id` text NOT NULL,
  `sur_pri_db_name` text NOT NULL,
  `sur_pri_db_server` text NOT NULL,
  `sur_pri_db_usrnme` text NOT NULL,
  `sur_pri_db_paswrd` blob NOT NULL,
  `sur_sec_db_name` text,
  `sur_sec_db_server` text,
  `sur_sec_db_usrnme` text,
  `sur_sec_db_paswrd` blob,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`sur_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;

--
-- Dumping data for table `cms_surveymaster`
--

INSERT INTO `cms_surveymaster` (`sur_id`, `sur_code`, `sur_title`, `sur_url`, `sur_onlne_id`, `sur_pri_db_name`, `sur_pri_db_server`, `sur_pri_db_usrnme`, `sur_pri_db_paswrd`, `sur_sec_db_name`, `sur_sec_db_server`, `sur_sec_db_usrnme`, `sur_sec_db_paswrd`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(8, 'ICC+', 'ICC PLUS - IDU', '-', '12345', 'icc', 'localhost', 'yrgbs', 0x5952476273313233, '', '', '', '', '1', 1485187865, 1, 1498801505, 13, 1485187865);

--
-- Triggers `cms_surveymaster`
--
DROP TRIGGER IF EXISTS `trig_cms_surveymaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_surveymaster_DELETE` BEFORE DELETE ON `cms_surveymaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.sur_id;

set @userid=OLD.update_user;



if  OLD.sur_id !="" OR OLD.sur_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_id);



	set @chdCol=CONCAT(@chdCol,'-','sur_id');

end if;



if  OLD.sur_code !="" OR OLD.sur_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_code);



	set @chdCol=CONCAT(@chdCol,'-','sur_code');

end if;



if  OLD.sur_title !="" OR OLD.sur_title is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_title);



	set @chdCol=CONCAT(@chdCol,'-','sur_title');

end if;



if  OLD.sur_url !="" OR OLD.sur_url is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_url);



	set @chdCol=CONCAT(@chdCol,'-','sur_url');

end if;



if  OLD.sur_onlne_id !="" OR OLD.sur_onlne_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_onlne_id);



	set @chdCol=CONCAT(@chdCol,'-','sur_onlne_id');

end if;



if  OLD.sur_pri_db_name !="" OR OLD.sur_pri_db_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_pri_db_name);



	set @chdCol=CONCAT(@chdCol,'-','sur_pri_db_name');

end if;



if  OLD.sur_pri_db_server !="" OR OLD.sur_pri_db_server is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_pri_db_server);



	set @chdCol=CONCAT(@chdCol,'-','sur_pri_db_server');

end if;



if  OLD.sur_pri_db_usrnme !="" OR OLD.sur_pri_db_usrnme is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_pri_db_usrnme);



	set @chdCol=CONCAT(@chdCol,'-','sur_pri_db_usrnme');

end if;



if  OLD.sur_pri_db_paswrd !="" OR OLD.sur_pri_db_paswrd is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_pri_db_paswrd);



	set @chdCol=CONCAT(@chdCol,'-','sur_pri_db_paswrd');

end if;



if  OLD.sur_sec_db_name !="" OR OLD.sur_sec_db_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_sec_db_name);



	set @chdCol=CONCAT(@chdCol,'-','sur_sec_db_name');

end if;



if  OLD.sur_sec_db_server !="" OR OLD.sur_sec_db_server is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_sec_db_server);



	set @chdCol=CONCAT(@chdCol,'-','sur_sec_db_server');

end if;



if  OLD.sur_sec_db_usrnme !="" OR OLD.sur_sec_db_usrnme is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_sec_db_usrnme);



	set @chdCol=CONCAT(@chdCol,'-','sur_sec_db_usrnme');

end if;



if  OLD.sur_sec_db_paswrd !="" OR OLD.sur_sec_db_paswrd is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_sec_db_paswrd);



	set @chdCol=CONCAT(@chdCol,'-','sur_sec_db_paswrd');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_surveymaster(sur_code,sur_title,sur_url,sur_onlne_id,sur_pri_db_name,sur_pri_db_server,sur_pri_db_usrnme,sur_pri_db_paswrd,sur_sec_db_name,sur_sec_db_server,sur_sec_db_usrnme,sur_sec_db_paswrd,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.sur_code,OLD.sur_title,OLD.sur_url,OLD.sur_onlne_id,OLD.sur_pri_db_name,OLD.sur_pri_db_server,OLD.sur_pri_db_usrnme,OLD.sur_pri_db_paswrd,OLD.sur_sec_db_name,OLD.sur_sec_db_server,OLD.sur_sec_db_usrnme,OLD.sur_sec_db_paswrd,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_surveymaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_surveymaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_surveymaster_INSERT` AFTER INSERT ON `cms_surveymaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.sur_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.sur_id);

set @chdCol=CONCAT(@chdCol,'-','sur_id');

set @newVal =CONCAT(@newVal,'-', NEW.sur_code);

set @chdCol=CONCAT(@chdCol,'-','sur_code');

set @newVal =CONCAT(@newVal,'-', NEW.sur_title);

set @chdCol=CONCAT(@chdCol,'-','sur_title');

set @newVal =CONCAT(@newVal,'-', NEW.sur_url);

set @chdCol=CONCAT(@chdCol,'-','sur_url');

set @newVal =CONCAT(@newVal,'-', NEW.sur_onlne_id);

set @chdCol=CONCAT(@chdCol,'-','sur_onlne_id');

set @newVal =CONCAT(@newVal,'-', NEW.sur_pri_db_name);

set @chdCol=CONCAT(@chdCol,'-','sur_pri_db_name');

set @newVal =CONCAT(@newVal,'-', NEW.sur_pri_db_server);

set @chdCol=CONCAT(@chdCol,'-','sur_pri_db_server');

set @newVal =CONCAT(@newVal,'-', NEW.sur_pri_db_usrnme);

set @chdCol=CONCAT(@chdCol,'-','sur_pri_db_usrnme');

set @newVal =CONCAT(@newVal,'-', NEW.sur_pri_db_paswrd);

set @chdCol=CONCAT(@chdCol,'-','sur_pri_db_paswrd');

set @newVal =CONCAT(@newVal,'-', NEW.sur_sec_db_name);

set @chdCol=CONCAT(@chdCol,'-','sur_sec_db_name');

set @newVal =CONCAT(@newVal,'-', NEW.sur_sec_db_server);

set @chdCol=CONCAT(@chdCol,'-','sur_sec_db_server');

set @newVal =CONCAT(@newVal,'-', NEW.sur_sec_db_usrnme);

set @chdCol=CONCAT(@chdCol,'-','sur_sec_db_usrnme');

set @newVal =CONCAT(@newVal,'-', NEW.sur_sec_db_paswrd);

set @chdCol=CONCAT(@chdCol,'-','sur_sec_db_paswrd');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_surveymaster(sur_code,sur_title,sur_url,sur_onlne_id,sur_pri_db_name,sur_pri_db_server,sur_pri_db_usrnme,sur_pri_db_paswrd,sur_sec_db_name,sur_sec_db_server,sur_sec_db_usrnme,sur_sec_db_paswrd,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.sur_code,NEW.sur_title,NEW.sur_url,NEW.sur_onlne_id,NEW.sur_pri_db_name,NEW.sur_pri_db_server,NEW.sur_pri_db_usrnme,NEW.sur_pri_db_paswrd,NEW.sur_sec_db_name,NEW.sur_sec_db_server,NEW.sur_sec_db_usrnme,NEW.sur_sec_db_paswrd,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_surveymaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_surveymaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_surveymaster_UPDATE` BEFORE UPDATE ON `cms_surveymaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.sur_id;

set @userid=NEW.update_user;



if  OLD.sur_id != NEW.sur_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_id);

	set @newVal =CONCAT(@newVal,'-', NEW.sur_id);

	set @chdCol=CONCAT(@chdCol,'-','sur_id');

end if;



if  OLD.sur_code != NEW.sur_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_code);

	set @newVal =CONCAT(@newVal,'-', NEW.sur_code);

	set @chdCol=CONCAT(@chdCol,'-','sur_code');

end if;



if  OLD.sur_title != NEW.sur_title

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_title);

	set @newVal =CONCAT(@newVal,'-', NEW.sur_title);

	set @chdCol=CONCAT(@chdCol,'-','sur_title');

end if;



if  OLD.sur_url != NEW.sur_url

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_url);

	set @newVal =CONCAT(@newVal,'-', NEW.sur_url);

	set @chdCol=CONCAT(@chdCol,'-','sur_url');

end if;



if  OLD.sur_onlne_id != NEW.sur_onlne_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_onlne_id);

	set @newVal =CONCAT(@newVal,'-', NEW.sur_onlne_id);

	set @chdCol=CONCAT(@chdCol,'-','sur_onlne_id');

end if;



if  OLD.sur_pri_db_name != NEW.sur_pri_db_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_pri_db_name);

	set @newVal =CONCAT(@newVal,'-', NEW.sur_pri_db_name);

	set @chdCol=CONCAT(@chdCol,'-','sur_pri_db_name');

end if;



if  OLD.sur_pri_db_server != NEW.sur_pri_db_server

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_pri_db_server);

	set @newVal =CONCAT(@newVal,'-', NEW.sur_pri_db_server);

	set @chdCol=CONCAT(@chdCol,'-','sur_pri_db_server');

end if;



if  OLD.sur_pri_db_usrnme != NEW.sur_pri_db_usrnme

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_pri_db_usrnme);

	set @newVal =CONCAT(@newVal,'-', NEW.sur_pri_db_usrnme);

	set @chdCol=CONCAT(@chdCol,'-','sur_pri_db_usrnme');

end if;



if  OLD.sur_pri_db_paswrd != NEW.sur_pri_db_paswrd

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_pri_db_paswrd);

	set @newVal =CONCAT(@newVal,'-', NEW.sur_pri_db_paswrd);

	set @chdCol=CONCAT(@chdCol,'-','sur_pri_db_paswrd');

end if;



if  OLD.sur_sec_db_name != NEW.sur_sec_db_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_sec_db_name);

	set @newVal =CONCAT(@newVal,'-', NEW.sur_sec_db_name);

	set @chdCol=CONCAT(@chdCol,'-','sur_sec_db_name');

end if;



if  OLD.sur_sec_db_server != NEW.sur_sec_db_server

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_sec_db_server);

	set @newVal =CONCAT(@newVal,'-', NEW.sur_sec_db_server);

	set @chdCol=CONCAT(@chdCol,'-','sur_sec_db_server');

end if;



if  OLD.sur_sec_db_usrnme != NEW.sur_sec_db_usrnme

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_sec_db_usrnme);

	set @newVal =CONCAT(@newVal,'-', NEW.sur_sec_db_usrnme);

	set @chdCol=CONCAT(@chdCol,'-','sur_sec_db_usrnme');

end if;



if  OLD.sur_sec_db_paswrd != NEW.sur_sec_db_paswrd

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sur_sec_db_paswrd);

	set @newVal =CONCAT(@newVal,'-', NEW.sur_sec_db_paswrd);

	set @chdCol=CONCAT(@chdCol,'-','sur_sec_db_paswrd');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_surveymaster(sur_code,sur_title,sur_url,sur_onlne_id,sur_pri_db_name,sur_pri_db_server,sur_pri_db_usrnme,sur_pri_db_paswrd,sur_sec_db_name,sur_sec_db_server,sur_sec_db_usrnme,sur_sec_db_paswrd,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.sur_code,NEW.sur_title,NEW.sur_url,NEW.sur_onlne_id,NEW.sur_pri_db_name,NEW.sur_pri_db_server,NEW.sur_pri_db_usrnme,NEW.sur_pri_db_paswrd,NEW.sur_sec_db_name,NEW.sur_sec_db_server,NEW.sur_sec_db_usrnme,NEW.sur_sec_db_paswrd,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_surveymaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_tb`
--

DROP TABLE IF EXISTS `cms_tb`;
CREATE TABLE IF NOT EXISTS `cms_tb` (
  `tb_test_id` int(11) NOT NULL AUTO_INCREMENT,
  `tb_test_survey` varchar(11) NOT NULL,
  `tb_test_loc` varchar(11) NOT NULL,
  `tb_test_part_id` varchar(11) NOT NULL,
  `tb_test_q1` int(11) NOT NULL,
  `tb_test_q2` int(11) NOT NULL,
  `tb_test_q3` int(11) NOT NULL,
  `tb_test_q4` int(11) NOT NULL,
  `tb_test_q5` int(11) DEFAULT NULL,
  `tb_test_q6` varchar(50) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`tb_test_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_tb`
--
DROP TRIGGER IF EXISTS `trig_cms_tb_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_tb_DELETE` BEFORE DELETE ON `cms_tb`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.tb_test_id;

set @userid=OLD.update_user;



if  OLD.tb_test_id !="" OR OLD.tb_test_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_id);



	set @chdCol=CONCAT(@chdCol,'-','tb_test_id');

end if;



if  OLD.tb_test_survey !="" OR OLD.tb_test_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_survey);



	set @chdCol=CONCAT(@chdCol,'-','tb_test_survey');

end if;



if  OLD.tb_test_loc !="" OR OLD.tb_test_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_loc);



	set @chdCol=CONCAT(@chdCol,'-','tb_test_loc');

end if;



if  OLD.tb_test_part_id !="" OR OLD.tb_test_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_part_id);



	set @chdCol=CONCAT(@chdCol,'-','tb_test_part_id');

end if;



if  OLD.tb_test_q1 !="" OR OLD.tb_test_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_q1);



	set @chdCol=CONCAT(@chdCol,'-','tb_test_q1');

end if;



if  OLD.tb_test_q2 !="" OR OLD.tb_test_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_q2);



	set @chdCol=CONCAT(@chdCol,'-','tb_test_q2');

end if;



if  OLD.tb_test_q3 !="" OR OLD.tb_test_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_q3);



	set @chdCol=CONCAT(@chdCol,'-','tb_test_q3');

end if;



if  OLD.tb_test_q4 !="" OR OLD.tb_test_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_q4);



	set @chdCol=CONCAT(@chdCol,'-','tb_test_q4');

end if;



if  OLD.tb_test_q5 !="" OR OLD.tb_test_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_q5);



	set @chdCol=CONCAT(@chdCol,'-','tb_test_q5');

end if;



if  OLD.tb_test_q6 !="" OR OLD.tb_test_q6 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_q6);



	set @chdCol=CONCAT(@chdCol,'-','tb_test_q6');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_tb(tb_test_survey,tb_test_loc,tb_test_part_id,tb_test_q1,tb_test_q2,tb_test_q3,tb_test_q4,tb_test_q5,tb_test_q6,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.tb_test_survey,OLD.tb_test_loc,OLD.tb_test_part_id,OLD.tb_test_q1,OLD.tb_test_q2,OLD.tb_test_q3,OLD.tb_test_q4,OLD.tb_test_q5,OLD.tb_test_q6,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_tb', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_tb_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_tb_INSERT` AFTER INSERT ON `cms_tb`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.tb_test_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.tb_test_id);

set @chdCol=CONCAT(@chdCol,'-','tb_test_id');

set @newVal =CONCAT(@newVal,'-', NEW.tb_test_survey);

set @chdCol=CONCAT(@chdCol,'-','tb_test_survey');

set @newVal =CONCAT(@newVal,'-', NEW.tb_test_loc);

set @chdCol=CONCAT(@chdCol,'-','tb_test_loc');

set @newVal =CONCAT(@newVal,'-', NEW.tb_test_part_id);

set @chdCol=CONCAT(@chdCol,'-','tb_test_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.tb_test_q1);

set @chdCol=CONCAT(@chdCol,'-','tb_test_q1');

set @newVal =CONCAT(@newVal,'-', NEW.tb_test_q2);

set @chdCol=CONCAT(@chdCol,'-','tb_test_q2');

set @newVal =CONCAT(@newVal,'-', NEW.tb_test_q3);

set @chdCol=CONCAT(@chdCol,'-','tb_test_q3');

set @newVal =CONCAT(@newVal,'-', NEW.tb_test_q4);

set @chdCol=CONCAT(@chdCol,'-','tb_test_q4');

set @newVal =CONCAT(@newVal,'-', NEW.tb_test_q5);

set @chdCol=CONCAT(@chdCol,'-','tb_test_q5');

set @newVal =CONCAT(@newVal,'-', NEW.tb_test_q6);

set @chdCol=CONCAT(@chdCol,'-','tb_test_q6');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_tb(tb_test_survey,tb_test_loc,tb_test_part_id,tb_test_q1,tb_test_q2,tb_test_q3,tb_test_q4,tb_test_q5,tb_test_q6,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.tb_test_survey,NEW.tb_test_loc,NEW.tb_test_part_id,NEW.tb_test_q1,NEW.tb_test_q2,NEW.tb_test_q3,NEW.tb_test_q4,NEW.tb_test_q5,NEW.tb_test_q6,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_tb', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_tb_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_tb_UPDATE` BEFORE UPDATE ON `cms_tb`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.tb_test_id;

set @userid=NEW.update_user;



if  OLD.tb_test_id != NEW.tb_test_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_id);

	set @newVal =CONCAT(@newVal,'-', NEW.tb_test_id);

	set @chdCol=CONCAT(@chdCol,'-','tb_test_id');

end if;



if  OLD.tb_test_survey != NEW.tb_test_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.tb_test_survey);

	set @chdCol=CONCAT(@chdCol,'-','tb_test_survey');

end if;



if  OLD.tb_test_loc != NEW.tb_test_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.tb_test_loc);

	set @chdCol=CONCAT(@chdCol,'-','tb_test_loc');

end if;



if  OLD.tb_test_part_id != NEW.tb_test_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.tb_test_part_id);

	set @chdCol=CONCAT(@chdCol,'-','tb_test_part_id');

end if;



if  OLD.tb_test_q1 != NEW.tb_test_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.tb_test_q1);

	set @chdCol=CONCAT(@chdCol,'-','tb_test_q1');

end if;



if  OLD.tb_test_q2 != NEW.tb_test_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.tb_test_q2);

	set @chdCol=CONCAT(@chdCol,'-','tb_test_q2');

end if;



if  OLD.tb_test_q3 != NEW.tb_test_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.tb_test_q3);

	set @chdCol=CONCAT(@chdCol,'-','tb_test_q3');

end if;



if  OLD.tb_test_q4 != NEW.tb_test_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.tb_test_q4);

	set @chdCol=CONCAT(@chdCol,'-','tb_test_q4');

end if;



if  OLD.tb_test_q5 != NEW.tb_test_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.tb_test_q5);

	set @chdCol=CONCAT(@chdCol,'-','tb_test_q5');

end if;



if  OLD.tb_test_q6 != NEW.tb_test_q6

then

	set @oldval =CONCAT(@oldVal,'-',OLD.tb_test_q6);

	set @newVal =CONCAT(@newVal,'-', NEW.tb_test_q6);

	set @chdCol=CONCAT(@chdCol,'-','tb_test_q6');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_tb(tb_test_survey,tb_test_loc,tb_test_part_id,tb_test_q1,tb_test_q2,tb_test_q3,tb_test_q4,tb_test_q5,tb_test_q6,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.tb_test_survey,NEW.tb_test_loc,NEW.tb_test_part_id,NEW.tb_test_q1,NEW.tb_test_q2,NEW.tb_test_q3,NEW.tb_test_q4,NEW.tb_test_q5,NEW.tb_test_q6,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_tb', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_trackingform`
--

DROP TABLE IF EXISTS `cms_trackingform`;
CREATE TABLE IF NOT EXISTS `cms_trackingform` (
  `track_form_id` int(11) NOT NULL AUTO_INCREMENT,
  `track_form_survey` varchar(11) NOT NULL,
  `track_form_loc` varchar(11) NOT NULL,
  `track_form_part_id` varchar(11) NOT NULL,
  `track_form_q1` int(11) NOT NULL,
  `track_form_q2` varchar(100) NOT NULL,
  `track_form_q3` varchar(100) NOT NULL,
  `track_form_q4` int(11) NOT NULL,
  `track_form_q5` varchar(250) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`track_form_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_trackingform`
--
DROP TRIGGER IF EXISTS `trig_cms_trackingform_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_trackingform_DELETE` BEFORE DELETE ON `cms_trackingform`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.track_form_id;

set @userid=OLD.update_user;



if  OLD.track_form_id !="" OR OLD.track_form_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_id);



	set @chdCol=CONCAT(@chdCol,'-','track_form_id');

end if;



if  OLD.track_form_survey !="" OR OLD.track_form_survey is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_survey);



	set @chdCol=CONCAT(@chdCol,'-','track_form_survey');

end if;



if  OLD.track_form_loc !="" OR OLD.track_form_loc is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_loc);



	set @chdCol=CONCAT(@chdCol,'-','track_form_loc');

end if;



if  OLD.track_form_part_id !="" OR OLD.track_form_part_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_part_id);



	set @chdCol=CONCAT(@chdCol,'-','track_form_part_id');

end if;



if  OLD.track_form_q1 !="" OR OLD.track_form_q1 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_q1);



	set @chdCol=CONCAT(@chdCol,'-','track_form_q1');

end if;



if  OLD.track_form_q2 !="" OR OLD.track_form_q2 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_q2);



	set @chdCol=CONCAT(@chdCol,'-','track_form_q2');

end if;



if  OLD.track_form_q3 !="" OR OLD.track_form_q3 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_q3);



	set @chdCol=CONCAT(@chdCol,'-','track_form_q3');

end if;



if  OLD.track_form_q4 !="" OR OLD.track_form_q4 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_q4);



	set @chdCol=CONCAT(@chdCol,'-','track_form_q4');

end if;



if  OLD.track_form_q5 !="" OR OLD.track_form_q5 is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_q5);



	set @chdCol=CONCAT(@chdCol,'-','track_form_q5');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_trackingform(track_form_survey,track_form_loc,track_form_part_id,track_form_q1,track_form_q2,track_form_q3,track_form_q4,track_form_q5,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.track_form_survey,OLD.track_form_loc,OLD.track_form_part_id,OLD.track_form_q1,OLD.track_form_q2,OLD.track_form_q3,OLD.track_form_q4,OLD.track_form_q5,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_trackingform', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_trackingform_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_trackingform_INSERT` AFTER INSERT ON `cms_trackingform`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.track_form_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.track_form_id);

set @chdCol=CONCAT(@chdCol,'-','track_form_id');

set @newVal =CONCAT(@newVal,'-', NEW.track_form_survey);

set @chdCol=CONCAT(@chdCol,'-','track_form_survey');

set @newVal =CONCAT(@newVal,'-', NEW.track_form_loc);

set @chdCol=CONCAT(@chdCol,'-','track_form_loc');

set @newVal =CONCAT(@newVal,'-', NEW.track_form_part_id);

set @chdCol=CONCAT(@chdCol,'-','track_form_part_id');

set @newVal =CONCAT(@newVal,'-', NEW.track_form_q1);

set @chdCol=CONCAT(@chdCol,'-','track_form_q1');

set @newVal =CONCAT(@newVal,'-', NEW.track_form_q2);

set @chdCol=CONCAT(@chdCol,'-','track_form_q2');

set @newVal =CONCAT(@newVal,'-', NEW.track_form_q3);

set @chdCol=CONCAT(@chdCol,'-','track_form_q3');

set @newVal =CONCAT(@newVal,'-', NEW.track_form_q4);

set @chdCol=CONCAT(@chdCol,'-','track_form_q4');

set @newVal =CONCAT(@newVal,'-', NEW.track_form_q5);

set @chdCol=CONCAT(@chdCol,'-','track_form_q5');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_trackingform(track_form_survey,track_form_loc,track_form_part_id,track_form_q1,track_form_q2,track_form_q3,track_form_q4,track_form_q5,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.track_form_survey,NEW.track_form_loc,NEW.track_form_part_id,NEW.track_form_q1,NEW.track_form_q2,NEW.track_form_q3,NEW.track_form_q4,NEW.track_form_q5,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_trackingform', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_trackingform_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_trackingform_UPDATE` BEFORE UPDATE ON `cms_trackingform`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.track_form_id;

set @userid=NEW.update_user;



if  OLD.track_form_id != NEW.track_form_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_id);

	set @newVal =CONCAT(@newVal,'-', NEW.track_form_id);

	set @chdCol=CONCAT(@chdCol,'-','track_form_id');

end if;



if  OLD.track_form_survey != NEW.track_form_survey

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_survey);

	set @newVal =CONCAT(@newVal,'-', NEW.track_form_survey);

	set @chdCol=CONCAT(@chdCol,'-','track_form_survey');

end if;



if  OLD.track_form_loc != NEW.track_form_loc

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_loc);

	set @newVal =CONCAT(@newVal,'-', NEW.track_form_loc);

	set @chdCol=CONCAT(@chdCol,'-','track_form_loc');

end if;



if  OLD.track_form_part_id != NEW.track_form_part_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_part_id);

	set @newVal =CONCAT(@newVal,'-', NEW.track_form_part_id);

	set @chdCol=CONCAT(@chdCol,'-','track_form_part_id');

end if;



if  OLD.track_form_q1 != NEW.track_form_q1

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_q1);

	set @newVal =CONCAT(@newVal,'-', NEW.track_form_q1);

	set @chdCol=CONCAT(@chdCol,'-','track_form_q1');

end if;



if  OLD.track_form_q2 != NEW.track_form_q2

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_q2);

	set @newVal =CONCAT(@newVal,'-', NEW.track_form_q2);

	set @chdCol=CONCAT(@chdCol,'-','track_form_q2');

end if;



if  OLD.track_form_q3 != NEW.track_form_q3

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_q3);

	set @newVal =CONCAT(@newVal,'-', NEW.track_form_q3);

	set @chdCol=CONCAT(@chdCol,'-','track_form_q3');

end if;



if  OLD.track_form_q4 != NEW.track_form_q4

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_q4);

	set @newVal =CONCAT(@newVal,'-', NEW.track_form_q4);

	set @chdCol=CONCAT(@chdCol,'-','track_form_q4');

end if;



if  OLD.track_form_q5 != NEW.track_form_q5

then

	set @oldval =CONCAT(@oldVal,'-',OLD.track_form_q5);

	set @newVal =CONCAT(@newVal,'-', NEW.track_form_q5);

	set @chdCol=CONCAT(@chdCol,'-','track_form_q5');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_trackingform(track_form_survey,track_form_loc,track_form_part_id,track_form_q1,track_form_q2,track_form_q3,track_form_q4,track_form_q5,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.track_form_survey,NEW.track_form_loc,NEW.track_form_part_id,NEW.track_form_q1,NEW.track_form_q2,NEW.track_form_q3,NEW.track_form_q4,NEW.track_form_q5,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_trackingform', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_users`
--

DROP TABLE IF EXISTS `cms_users`;
CREATE TABLE IF NOT EXISTS `cms_users` (
  `usr_id` int(11) NOT NULL AUTO_INCREMENT,
  `users_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `password` longtext COLLATE utf8_unicode_ci NOT NULL,
  `auth_key` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `full_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(320) COLLATE utf8_unicode_ci DEFAULT NULL,
  `status` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `user_type` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`usr_id`),
  UNIQUE KEY `users_name` (`users_name`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=14 ;

--
-- Dumping data for table `cms_users`
--

INSERT INTO `cms_users` (`usr_id`, `users_name`, `password`, `auth_key`, `password_reset_token`, `full_name`, `email`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `user_type`, `record_date`) VALUES
(1, 'Admin', '2578122e61ffb19065ddfc3cf6863ba9', 'NJH1-wLWIYIgFqXOBgHPEAZMMTCoa6vE', NULL, 'Santhanam Anand', 'anand@yrgcare.org', '1', 1349086634, 1, 1496965545, 1, NULL, 1349049600),
(3, 'SC', 'd0b0f2de16210822bb93b36aff1d8fd3', 'kbKZAGg6xWBnXElbsUomA5ZTVS5i2sBM', NULL, 'Site Coordinator', 'coordinator@yrgcare.org', '1', 1488605792, 1, 1496965464, 1, NULL, 1488565800),
(4, 'couns', 'd0b0f2de16210822bb93b36aff1d8fd3', 'ROnMjETkRMoEeF2bRFCll7N5IFSBt8eE', NULL, 'Site Counselor', 'counselor@yrgcare.org', '1', 1488619151, 1, 1496965475, 1, NULL, 1488565800),
(5, 'nurse', 'd0b0f2de16210822bb93b36aff1d8fd3', 'Bc-thw_h5gznb1GRxASE16V67mY8DKUA', NULL, 'Site Nurse', 'nurse@yrgcare.org', '1', 1488619177, 1, 1496965487, 1, NULL, 1488565800),
(6, 'cm', 'd0b0f2de16210822bb93b36aff1d8fd3', 'J7aMXp2tMR8dQg8UmTBZ_ASDv73qKXcR', NULL, 'Cohort Supervisor', 'cm@yrgcare.org', '1', 1488619199, 1, 1496965499, 1, NULL, 1488565800),
(9, 'LT', 'd0b0f2de16210822bb93b36aff1d8fd3', 'seDg8ANNkDFIHWOGqwbwoAz_kmSirGzp', NULL, 'Lab Technician', 'lt@yrgcare.org', '1', 1489721936, 1, 1496965452, 1, NULL, 1489689000),
(12, 'OST', 'd0b0f2de16210822bb93b36aff1d8fd3', 'MHsRm5fucSjjg0IQ6GQXUm_0M6EgrYtK', NULL, 'OST Service Provider', 'ost@yrgcare.org', '1', 1496657585, 1, 1496965432, 1, NULL, 1496601000),
(13, 'Administrator', 'ebfaf968ba8e04d258014462075c8128', 'DzE3GncV6I1uvnahcTC4qrYtVOHp-wTB', NULL, 'Santhanam Anand', 'anand@yrgcare.org', '1', 1498539646, 1, 1498539646, NULL, NULL, 1498501800);

--
-- Triggers `cms_users`
--
DROP TRIGGER IF EXISTS `trig_cms_users_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_users_DELETE` BEFORE DELETE ON `cms_users`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.usr_id;

set @userid=OLD.update_user;



if  OLD.usr_id !="" OR OLD.usr_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.usr_id);



	set @chdCol=CONCAT(@chdCol,'-','usr_id');

end if;



if  OLD.users_name !="" OR OLD.users_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.users_name);



	set @chdCol=CONCAT(@chdCol,'-','users_name');

end if;



if  OLD.password !="" OR OLD.password is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.password);



	set @chdCol=CONCAT(@chdCol,'-','password');

end if;



if  OLD.auth_key !="" OR OLD.auth_key is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.auth_key);



	set @chdCol=CONCAT(@chdCol,'-','auth_key');

end if;



if  OLD.password_reset_token !="" OR OLD.password_reset_token is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.password_reset_token);



	set @chdCol=CONCAT(@chdCol,'-','password_reset_token');

end if;



if  OLD.full_name !="" OR OLD.full_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.full_name);



	set @chdCol=CONCAT(@chdCol,'-','full_name');

end if;



if  OLD.email !="" OR OLD.email is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.email);



	set @chdCol=CONCAT(@chdCol,'-','email');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.user_type !="" OR OLD.user_type is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.user_type);



	set @chdCol=CONCAT(@chdCol,'-','user_type');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_users(users_name,password,auth_key,password_reset_token,full_name,email,status,create_time,create_user,update_time,update_user,user_type,record_date) VALUES(OLD.users_name,OLD.password,OLD.auth_key,OLD.password_reset_token,OLD.full_name,OLD.email,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.user_type,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_users', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_users_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_users_INSERT` AFTER INSERT ON `cms_users`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.usr_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.usr_id);

set @chdCol=CONCAT(@chdCol,'-','usr_id');

set @newVal =CONCAT(@newVal,'-', NEW.users_name);

set @chdCol=CONCAT(@chdCol,'-','users_name');

set @newVal =CONCAT(@newVal,'-', NEW.password);

set @chdCol=CONCAT(@chdCol,'-','password');

set @newVal =CONCAT(@newVal,'-', NEW.auth_key);

set @chdCol=CONCAT(@chdCol,'-','auth_key');

set @newVal =CONCAT(@newVal,'-', NEW.password_reset_token);

set @chdCol=CONCAT(@chdCol,'-','password_reset_token');

set @newVal =CONCAT(@newVal,'-', NEW.full_name);

set @chdCol=CONCAT(@chdCol,'-','full_name');

set @newVal =CONCAT(@newVal,'-', NEW.email);

set @chdCol=CONCAT(@chdCol,'-','email');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.user_type);

set @chdCol=CONCAT(@chdCol,'-','user_type');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_users(users_name,password,auth_key,password_reset_token,full_name,email,status,create_time,create_user,update_time,update_user,user_type,record_date) VALUES(NEW.users_name,NEW.password,NEW.auth_key,NEW.password_reset_token,NEW.full_name,NEW.email,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.user_type,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_users', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_users_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_users_UPDATE` BEFORE UPDATE ON `cms_users`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.usr_id;

set @userid=NEW.update_user;



if  OLD.usr_id != NEW.usr_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.usr_id);

	set @newVal =CONCAT(@newVal,'-', NEW.usr_id);

	set @chdCol=CONCAT(@chdCol,'-','usr_id');

end if;



if  OLD.users_name != NEW.users_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.users_name);

	set @newVal =CONCAT(@newVal,'-', NEW.users_name);

	set @chdCol=CONCAT(@chdCol,'-','users_name');

end if;



if  OLD.password != NEW.password

then

	set @oldval =CONCAT(@oldVal,'-',OLD.password);

	set @newVal =CONCAT(@newVal,'-', NEW.password);

	set @chdCol=CONCAT(@chdCol,'-','password');

end if;



if  OLD.auth_key != NEW.auth_key

then

	set @oldval =CONCAT(@oldVal,'-',OLD.auth_key);

	set @newVal =CONCAT(@newVal,'-', NEW.auth_key);

	set @chdCol=CONCAT(@chdCol,'-','auth_key');

end if;



if  OLD.password_reset_token != NEW.password_reset_token

then

	set @oldval =CONCAT(@oldVal,'-',OLD.password_reset_token);

	set @newVal =CONCAT(@newVal,'-', NEW.password_reset_token);

	set @chdCol=CONCAT(@chdCol,'-','password_reset_token');

end if;



if  OLD.full_name != NEW.full_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.full_name);

	set @newVal =CONCAT(@newVal,'-', NEW.full_name);

	set @chdCol=CONCAT(@chdCol,'-','full_name');

end if;



if  OLD.email != NEW.email

then

	set @oldval =CONCAT(@oldVal,'-',OLD.email);

	set @newVal =CONCAT(@newVal,'-', NEW.email);

	set @chdCol=CONCAT(@chdCol,'-','email');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.user_type != NEW.user_type

then

	set @oldval =CONCAT(@oldVal,'-',OLD.user_type);

	set @newVal =CONCAT(@newVal,'-', NEW.user_type);

	set @chdCol=CONCAT(@chdCol,'-','user_type');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_users(users_name,password,auth_key,password_reset_token,full_name,email,status,create_time,create_user,update_time,update_user,user_type,record_date) VALUES(NEW.users_name,NEW.password,NEW.auth_key,NEW.password_reset_token,NEW.full_name,NEW.email,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.user_type,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_users', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_visitmaster`
--

DROP TABLE IF EXISTS `cms_visitmaster`;
CREATE TABLE IF NOT EXISTS `cms_visitmaster` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `visit_code` int(11) NOT NULL,
  `visit_name` varchar(255) NOT NULL,
  `visit_interval` int(11) DEFAULT NULL,
  `visit_order` int(11) NOT NULL,
  `status` int(11) DEFAULT '0',
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3506 ;

--
-- Dumping data for table `cms_visitmaster`
--

INSERT INTO `cms_visitmaster` (`id`, `visit_code`, `visit_name`, `visit_interval`, `visit_order`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(1, -4, 'CF4', 24, 0, 1, 0, 0, 0, 0, 0),
(2, -3, 'CF3', 18, 0, 1, 0, 0, 0, 0, 0),
(3, -2, 'CF2', 12, 0, 1, 0, 0, 0, 0, 0),
(4, -1, 'CF1', 6, 0, 1, 0, 0, 0, 0, 0),
(5, 1, 'Baseline', 0, 0, 1, 0, 0, 0, 0, 0),
(6, 2, 'RF1', NULL, 1, 1, 0, 0, 0, 0, 0),
(7, 3, 'RF2', NULL, 2, 1, 0, 0, 0, 0, 0),
(8, 4, 'RF3', NULL, 3, 1, 0, 0, 0, 0, 0),
(9, 5, 'RF4', NULL, 4, 1, 0, 0, 0, 0, 0),
(10, 6, 'RF5', NULL, 5, 1, 0, 0, 0, 0, 0),
(11, 7, 'RF6', NULL, 6, 1, 0, 0, 0, 0, 0),
(12, 8, 'RF7', NULL, 7, 1, 0, 0, 0, 0, 0),
(13, 9, 'RF8', NULL, 8, 1, 0, 0, 0, 0, 0),
(14, 10, 'RF9', NULL, 9, 1, 0, 0, 0, 0, 0),
(15, 11, 'RF10', NULL, 10, 1, 0, 0, 0, 0, 0),
(16, 12, 'RF11', NULL, 11, 1, 0, 0, 0, 0, 0),
(17, 13, 'RF12', NULL, 12, 1, 0, 0, 0, 0, 0),
(18, 14, 'RF13', NULL, 13, 1, 0, 0, 0, 0, 0),
(19, 15, 'RF14', NULL, 14, 1, 0, 0, 0, 0, 0),
(20, 16, 'RF15', NULL, 15, 1, 0, 0, 0, 0, 0),
(21, 17, 'RF16', NULL, 16, 1, 0, 0, 0, 0, 0),
(22, 18, 'RF17', NULL, 17, 1, 0, 0, 0, 0, 0),
(23, 19, 'RF18', NULL, 18, 1, 0, 0, 0, 0, 0),
(24, 20, 'RF19', NULL, 19, 1, 0, 0, 0, 0, 0),
(25, 21, 'RF20', NULL, 20, 1, 0, 0, 0, 0, 0),
(26, 22, 'RF21', NULL, 21, 1, 0, 0, 0, 0, 0),
(27, 23, 'RF22', NULL, 22, 1, 0, 0, 0, 0, 0),
(28, 24, 'RF23', NULL, 23, 1, 0, 0, 0, 0, 0),
(29, 25, 'RF24', NULL, 24, 1, 0, 0, 0, 0, 0),
(30, 26, 'RF25', NULL, 25, 1, 0, 0, 0, 0, 0),
(31, 27, 'RF26', NULL, 26, 1, 0, 0, 0, 0, 0),
(32, 28, 'RF27', NULL, 27, 1, 0, 0, 0, 0, 0),
(33, 29, 'RF28', NULL, 28, 1, 0, 0, 0, 0, 0),
(34, 30, 'RF29', NULL, 29, 1, 0, 0, 0, 0, 0),
(35, 31, 'RF30', NULL, 30, 1, 0, 0, 0, 0, 0),
(36, 32, 'RF31', NULL, 31, 1, 0, 0, 0, 0, 0),
(37, 33, 'RF32', NULL, 32, 1, 0, 0, 0, 0, 0),
(38, 34, 'RF33', NULL, 33, 1, 0, 0, 0, 0, 0),
(39, 35, 'RF34', NULL, 34, 1, 0, 0, 0, 0, 0),
(40, 36, 'RF35', NULL, 35, 1, 0, 0, 0, 0, 0),
(41, 37, 'RF36', NULL, 36, 1, 0, 0, 0, 0, 0),
(42, 38, 'RF37', NULL, 37, 1, 0, 0, 0, 0, 0),
(43, 39, 'RF38', NULL, 38, 1, 0, 0, 0, 0, 0),
(44, 40, 'RF39', NULL, 39, 1, 0, 0, 0, 0, 0),
(45, 41, 'RF40', NULL, 40, 1, 0, 0, 0, 0, 0),
(46, 42, 'RF41', NULL, 41, 1, 0, 0, 0, 0, 0),
(47, 43, 'RF42', NULL, 42, 1, 0, 0, 0, 0, 0),
(48, 44, 'RF43', NULL, 43, 1, 0, 0, 0, 0, 0),
(49, 45, 'RF44', NULL, 44, 1, 0, 0, 0, 0, 0),
(50, 46, 'RF45', NULL, 45, 1, 0, 0, 0, 0, 0),
(51, 47, 'RF46', NULL, 46, 1, 0, 0, 0, 0, 0),
(52, 48, 'RF47', NULL, 47, 1, 0, 0, 0, 0, 0),
(53, 49, 'RF48', NULL, 48, 1, 0, 0, 0, 0, 0),
(54, 50, 'RF49', NULL, 49, 1, 0, 0, 0, 0, 0),
(55, 51, 'RF50', NULL, 50, 1, 0, 0, 0, 0, 0),
(56, 52, 'RF51', NULL, 51, 1, 0, 0, 0, 0, 0),
(57, 53, 'RF52', NULL, 52, 1, 0, 0, 0, 0, 0),
(58, 54, 'RF53', NULL, 53, 1, 0, 0, 0, 0, 0),
(59, 55, 'RF54', NULL, 54, 1, 0, 0, 0, 0, 0),
(60, 56, 'RF55', NULL, 55, 1, 0, 0, 0, 0, 0),
(61, 57, 'RF56', NULL, 56, 1, 0, 0, 0, 0, 0),
(62, 58, 'RF57', NULL, 57, 1, 0, 0, 0, 0, 0),
(63, 59, 'RF58', NULL, 58, 1, 0, 0, 0, 0, 0),
(64, 60, 'RF59', NULL, 59, 1, 0, 0, 0, 0, 0),
(65, 61, 'RF60', NULL, 60, 1, 0, 0, 0, 0, 0),
(66, 62, 'RF61', NULL, 61, 1, 0, 0, 0, 0, 0),
(67, 63, 'RF62', NULL, 62, 1, 0, 0, 0, 0, 0),
(68, 64, 'RF63', NULL, 63, 1, 0, 0, 0, 0, 0),
(69, 65, 'RF64', NULL, 64, 1, 0, 0, 0, 0, 0),
(70, 66, 'RF65', NULL, 65, 1, 0, 0, 0, 0, 0),
(71, 67, 'RF66', NULL, 66, 1, 0, 0, 0, 0, 0),
(72, 68, 'RF67', NULL, 67, 1, 0, 0, 0, 0, 0),
(73, 69, 'RF68', NULL, 68, 1, 0, 0, 0, 0, 0),
(74, 70, 'RF69', NULL, 69, 1, 0, 0, 0, 0, 0),
(75, 71, 'RF70', NULL, 70, 1, 0, 0, 0, 0, 0),
(76, 72, 'RF71', NULL, 71, 1, 0, 0, 0, 0, 0),
(77, 73, 'RF72', NULL, 72, 1, 0, 0, 0, 0, 0),
(78, 74, 'RF73', NULL, 73, 1, 0, 0, 0, 0, 0),
(79, 75, 'RF74', NULL, 74, 1, 0, 0, 0, 0, 0),
(80, 76, 'RF75', NULL, 75, 1, 0, 0, 0, 0, 0),
(81, 77, 'RF76', NULL, 76, 1, 0, 0, 0, 0, 0),
(82, 78, 'RF77', NULL, 77, 1, 0, 0, 0, 0, 0),
(83, 79, 'RF78', NULL, 78, 1, 0, 0, 0, 0, 0),
(84, 80, 'RF79', NULL, 79, 1, 0, 0, 0, 0, 0),
(85, 81, 'RF80', NULL, 80, 1, 0, 0, 0, 0, 0),
(86, 82, 'RF81', NULL, 81, 1, 0, 0, 0, 0, 0),
(87, 83, 'RF82', NULL, 82, 1, 0, 0, 0, 0, 0),
(88, 84, 'RF83', NULL, 83, 1, 0, 0, 0, 0, 0),
(89, 85, 'RF84', NULL, 84, 1, 0, 0, 0, 0, 0),
(90, 86, 'RF85', NULL, 85, 1, 0, 0, 0, 0, 0),
(91, 87, 'RF86', NULL, 86, 1, 0, 0, 0, 0, 0),
(92, 88, 'RF87', NULL, 87, 1, 0, 0, 0, 0, 0),
(93, 89, 'RF88', NULL, 88, 1, 0, 0, 0, 0, 0),
(94, 90, 'RF89', NULL, 89, 1, 0, 0, 0, 0, 0),
(95, 91, 'RF90', NULL, 90, 1, 0, 0, 0, 0, 0),
(96, 92, 'RF91', NULL, 91, 1, 0, 0, 0, 0, 0),
(97, 93, 'RF92', NULL, 92, 1, 0, 0, 0, 0, 0),
(98, 94, 'RF93', NULL, 93, 1, 0, 0, 0, 0, 0),
(99, 95, 'RF94', NULL, 94, 1, 0, 0, 0, 0, 0),
(100, 96, 'RF95', NULL, 95, 1, 0, 0, 0, 0, 0),
(101, 97, 'RF96', NULL, 96, 1, 0, 0, 0, 0, 0),
(102, 98, 'RF97', NULL, 97, 1, 0, 0, 0, 0, 0),
(103, 99, 'RF98', NULL, 98, 1, 0, 0, 0, 0, 0),
(104, 100, 'RF99', NULL, 99, 1, 0, 0, 0, 0, 0),
(105, 101, 'RF100', NULL, 100, 1, 0, 0, 0, 0, 0),
(106, 102, 'RF101', NULL, 101, 1, 0, 0, 0, 0, 0),
(107, 103, 'RF102', NULL, 102, 1, 0, 0, 0, 0, 0),
(108, 104, 'RF103', NULL, 103, 1, 0, 0, 0, 0, 0),
(109, 105, 'RF104', NULL, 104, 1, 0, 0, 0, 0, 0),
(110, 106, 'RF105', NULL, 105, 1, 0, 0, 0, 0, 0),
(111, 107, 'RF106', NULL, 106, 1, 0, 0, 0, 0, 0),
(112, 108, 'RF107', NULL, 107, 1, 0, 0, 0, 0, 0),
(113, 109, 'RF108', NULL, 108, 1, 0, 0, 0, 0, 0),
(114, 110, 'RF109', NULL, 109, 1, 0, 0, 0, 0, 0),
(115, 111, 'RF110', NULL, 110, 1, 0, 0, 0, 0, 0),
(116, 112, 'RF111', NULL, 111, 1, 0, 0, 0, 0, 0),
(117, 113, 'RF112', NULL, 112, 1, 0, 0, 0, 0, 0),
(118, 114, 'RF113', NULL, 113, 1, 0, 0, 0, 0, 0),
(119, 115, 'RF114', NULL, 114, 1, 0, 0, 0, 0, 0),
(120, 116, 'RF115', NULL, 115, 1, 0, 0, 0, 0, 0),
(121, 117, 'RF116', NULL, 116, 1, 0, 0, 0, 0, 0),
(122, 118, 'RF117', NULL, 117, 1, 0, 0, 0, 0, 0),
(123, 119, 'RF118', NULL, 118, 1, 0, 0, 0, 0, 0),
(124, 120, 'RF119', NULL, 119, 1, 0, 0, 0, 0, 0),
(125, 121, 'RF120', NULL, 120, 1, 0, 0, 0, 0, 0),
(126, 122, 'RF121', NULL, 121, 1, 0, 0, 0, 0, 0),
(127, 123, 'RF122', NULL, 122, 1, 0, 0, 0, 0, 0),
(128, 124, 'RF123', NULL, 123, 1, 0, 0, 0, 0, 0),
(129, 125, 'RF124', NULL, 124, 1, 0, 0, 0, 0, 0),
(130, 126, 'RF125', NULL, 125, 1, 0, 0, 0, 0, 0),
(131, 127, 'RF126', NULL, 126, 1, 0, 0, 0, 0, 0),
(132, 128, 'RF127', NULL, 127, 1, 0, 0, 0, 0, 0),
(133, 129, 'RF128', NULL, 128, 1, 0, 0, 0, 0, 0),
(134, 130, 'RF129', NULL, 129, 1, 0, 0, 0, 0, 0),
(135, 131, 'RF130', NULL, 130, 1, 0, 0, 0, 0, 0),
(136, 132, 'RF131', NULL, 131, 1, 0, 0, 0, 0, 0),
(137, 133, 'RF132', NULL, 132, 1, 0, 0, 0, 0, 0),
(138, 134, 'RF133', NULL, 133, 1, 0, 0, 0, 0, 0),
(139, 135, 'RF134', NULL, 134, 1, 0, 0, 0, 0, 0),
(140, 136, 'RF135', NULL, 135, 1, 0, 0, 0, 0, 0),
(141, 137, 'RF136', NULL, 136, 1, 0, 0, 0, 0, 0),
(142, 138, 'RF137', NULL, 137, 1, 0, 0, 0, 0, 0),
(143, 139, 'RF138', NULL, 138, 1, 0, 0, 0, 0, 0),
(144, 140, 'RF139', NULL, 139, 1, 0, 0, 0, 0, 0),
(145, 141, 'RF140', NULL, 140, 1, 0, 0, 0, 0, 0),
(146, 142, 'RF141', NULL, 141, 1, 0, 0, 0, 0, 0),
(147, 143, 'RF142', NULL, 142, 1, 0, 0, 0, 0, 0),
(148, 144, 'RF143', NULL, 143, 1, 0, 0, 0, 0, 0),
(149, 145, 'RF144', NULL, 144, 1, 0, 0, 0, 0, 0),
(150, 146, 'RF145', NULL, 145, 1, 0, 0, 0, 0, 0),
(151, 147, 'RF146', NULL, 146, 1, 0, 0, 0, 0, 0),
(152, 148, 'RF147', NULL, 147, 1, 0, 0, 0, 0, 0),
(153, 149, 'RF148', NULL, 148, 1, 0, 0, 0, 0, 0),
(154, 150, 'RF149', NULL, 149, 1, 0, 0, 0, 0, 0),
(155, 151, 'RF150', NULL, 150, 1, 0, 0, 0, 0, 0),
(156, 152, 'RF151', NULL, 151, 1, 0, 0, 0, 0, 0),
(157, 153, 'RF152', NULL, 152, 1, 0, 0, 0, 0, 0),
(158, 154, 'RF153', NULL, 153, 1, 0, 0, 0, 0, 0),
(159, 155, 'RF154', NULL, 154, 1, 0, 0, 0, 0, 0),
(160, 156, 'RF155', NULL, 155, 1, 0, 0, 0, 0, 0),
(161, 157, 'RF156', NULL, 156, 1, 0, 0, 0, 0, 0),
(162, 158, 'RF157', NULL, 157, 1, 0, 0, 0, 0, 0),
(163, 159, 'RF158', NULL, 158, 1, 0, 0, 0, 0, 0),
(164, 160, 'RF159', NULL, 159, 1, 0, 0, 0, 0, 0),
(165, 161, 'RF160', NULL, 160, 1, 0, 0, 0, 0, 0),
(166, 162, 'RF161', NULL, 161, 1, 0, 0, 0, 0, 0),
(167, 163, 'RF162', NULL, 162, 1, 0, 0, 0, 0, 0),
(168, 164, 'RF163', NULL, 163, 1, 0, 0, 0, 0, 0),
(169, 165, 'RF164', NULL, 164, 1, 0, 0, 0, 0, 0),
(170, 166, 'RF165', NULL, 165, 1, 0, 0, 0, 0, 0),
(171, 167, 'RF166', NULL, 166, 1, 0, 0, 0, 0, 0),
(172, 168, 'RF167', NULL, 167, 1, 0, 0, 0, 0, 0),
(173, 169, 'RF168', NULL, 168, 1, 0, 0, 0, 0, 0),
(174, 170, 'RF169', NULL, 169, 1, 0, 0, 0, 0, 0),
(175, 171, 'RF170', NULL, 170, 1, 0, 0, 0, 0, 0),
(176, 172, 'RF171', NULL, 171, 1, 0, 0, 0, 0, 0),
(177, 173, 'RF172', NULL, 172, 1, 0, 0, 0, 0, 0),
(178, 174, 'RF173', NULL, 173, 1, 0, 0, 0, 0, 0),
(179, 175, 'RF174', NULL, 174, 1, 0, 0, 0, 0, 0),
(180, 176, 'RF175', NULL, 175, 1, 0, 0, 0, 0, 0),
(181, 177, 'RF176', NULL, 176, 1, 0, 0, 0, 0, 0),
(182, 178, 'RF177', NULL, 177, 1, 0, 0, 0, 0, 0),
(183, 179, 'RF178', NULL, 178, 1, 0, 0, 0, 0, 0),
(184, 180, 'RF179', NULL, 179, 1, 0, 0, 0, 0, 0),
(185, 181, 'RF180', NULL, 180, 1, 0, 0, 0, 0, 0),
(186, 182, 'RF181', NULL, 181, 1, 0, 0, 0, 0, 0),
(187, 183, 'RF182', NULL, 182, 1, 0, 0, 0, 0, 0),
(188, 184, 'RF183', NULL, 183, 1, 0, 0, 0, 0, 0),
(189, 185, 'RF184', NULL, 184, 1, 0, 0, 0, 0, 0),
(190, 186, 'RF185', NULL, 185, 1, 0, 0, 0, 0, 0),
(191, 187, 'RF186', NULL, 186, 1, 0, 0, 0, 0, 0),
(192, 188, 'RF187', NULL, 187, 1, 0, 0, 0, 0, 0),
(193, 189, 'RF188', NULL, 188, 1, 0, 0, 0, 0, 0),
(194, 190, 'RF189', NULL, 189, 1, 0, 0, 0, 0, 0),
(195, 191, 'RF190', NULL, 190, 1, 0, 0, 0, 0, 0),
(196, 192, 'RF191', NULL, 191, 1, 0, 0, 0, 0, 0),
(197, 193, 'RF192', NULL, 192, 1, 0, 0, 0, 0, 0),
(198, 194, 'RF193', NULL, 193, 1, 0, 0, 0, 0, 0),
(199, 195, 'RF194', NULL, 194, 1, 0, 0, 0, 0, 0),
(200, 196, 'RF195', NULL, 195, 1, 0, 0, 0, 0, 0),
(201, 197, 'RF196', NULL, 196, 1, 0, 0, 0, 0, 0),
(202, 198, 'RF197', NULL, 197, 1, 0, 0, 0, 0, 0),
(203, 199, 'RF198', NULL, 198, 1, 0, 0, 0, 0, 0),
(204, 200, 'RF199', NULL, 199, 1, 0, 0, 0, 0, 0),
(205, 201, 'RF200', NULL, 200, 1, 0, 0, 0, 0, 0),
(206, 202, 'RF201', NULL, 201, 1, 0, 0, 0, 0, 0),
(207, 203, 'RF202', NULL, 202, 1, 0, 0, 0, 0, 0),
(208, 204, 'RF203', NULL, 203, 1, 0, 0, 0, 0, 0),
(209, 205, 'RF204', NULL, 204, 1, 0, 0, 0, 0, 0),
(210, 206, 'RF205', NULL, 205, 1, 0, 0, 0, 0, 0),
(211, 207, 'RF206', NULL, 206, 1, 0, 0, 0, 0, 0),
(212, 208, 'RF207', NULL, 207, 1, 0, 0, 0, 0, 0),
(213, 209, 'RF208', NULL, 208, 1, 0, 0, 0, 0, 0),
(214, 210, 'RF209', NULL, 209, 1, 0, 0, 0, 0, 0),
(215, 211, 'RF210', NULL, 210, 1, 0, 0, 0, 0, 0),
(216, 212, 'RF211', NULL, 211, 1, 0, 0, 0, 0, 0),
(217, 213, 'RF212', NULL, 212, 1, 0, 0, 0, 0, 0),
(218, 214, 'RF213', NULL, 213, 1, 0, 0, 0, 0, 0),
(219, 215, 'RF214', NULL, 214, 1, 0, 0, 0, 0, 0),
(220, 216, 'RF215', NULL, 215, 1, 0, 0, 0, 0, 0),
(221, 217, 'RF216', NULL, 216, 1, 0, 0, 0, 0, 0),
(222, 218, 'RF217', NULL, 217, 1, 0, 0, 0, 0, 0),
(223, 219, 'RF218', NULL, 218, 1, 0, 0, 0, 0, 0),
(224, 220, 'RF219', NULL, 219, 1, 0, 0, 0, 0, 0),
(225, 221, 'RF220', NULL, 220, 1, 0, 0, 0, 0, 0),
(226, 222, 'RF221', NULL, 221, 1, 0, 0, 0, 0, 0),
(227, 223, 'RF222', NULL, 222, 1, 0, 0, 0, 0, 0),
(228, 224, 'RF223', NULL, 223, 1, 0, 0, 0, 0, 0),
(229, 225, 'RF224', NULL, 224, 1, 0, 0, 0, 0, 0),
(230, 226, 'RF225', NULL, 225, 1, 0, 0, 0, 0, 0),
(231, 227, 'RF226', NULL, 226, 1, 0, 0, 0, 0, 0),
(232, 228, 'RF227', NULL, 227, 1, 0, 0, 0, 0, 0),
(233, 229, 'RF228', NULL, 228, 1, 0, 0, 0, 0, 0),
(234, 230, 'RF229', NULL, 229, 1, 0, 0, 0, 0, 0),
(235, 231, 'RF230', NULL, 230, 1, 0, 0, 0, 0, 0),
(236, 232, 'RF231', NULL, 231, 1, 0, 0, 0, 0, 0),
(237, 233, 'RF232', NULL, 232, 1, 0, 0, 0, 0, 0),
(238, 234, 'RF233', NULL, 233, 1, 0, 0, 0, 0, 0),
(239, 235, 'RF234', NULL, 234, 1, 0, 0, 0, 0, 0),
(240, 236, 'RF235', NULL, 235, 1, 0, 0, 0, 0, 0),
(241, 237, 'RF236', NULL, 236, 1, 0, 0, 0, 0, 0),
(242, 238, 'RF237', NULL, 237, 1, 0, 0, 0, 0, 0),
(243, 239, 'RF238', NULL, 238, 1, 0, 0, 0, 0, 0),
(244, 240, 'RF239', NULL, 239, 1, 0, 0, 0, 0, 0),
(245, 241, 'RF240', NULL, 240, 1, 0, 0, 0, 0, 0),
(246, 242, 'RF241', NULL, 241, 1, 0, 0, 0, 0, 0),
(247, 243, 'RF242', NULL, 242, 1, 0, 0, 0, 0, 0),
(248, 244, 'RF243', NULL, 243, 1, 0, 0, 0, 0, 0),
(249, 245, 'RF244', NULL, 244, 1, 0, 0, 0, 0, 0),
(250, 246, 'RF245', NULL, 245, 1, 0, 0, 0, 0, 0),
(251, 247, 'RF246', NULL, 246, 1, 0, 0, 0, 0, 0),
(252, 248, 'RF247', NULL, 247, 1, 0, 0, 0, 0, 0),
(253, 249, 'RF248', NULL, 248, 1, 0, 0, 0, 0, 0),
(254, 250, 'RF249', NULL, 249, 1, 0, 0, 0, 0, 0),
(255, 251, 'RF250', NULL, 250, 1, 0, 0, 0, 0, 0),
(256, 252, 'RF251', NULL, 251, 1, 0, 0, 0, 0, 0),
(257, 253, 'RF252', NULL, 252, 1, 0, 0, 0, 0, 0),
(258, 254, 'RF253', NULL, 253, 1, 0, 0, 0, 0, 0),
(259, 255, 'RF254', NULL, 254, 1, 0, 0, 0, 0, 0),
(260, 256, 'RF255', NULL, 255, 1, 0, 0, 0, 0, 0),
(261, 257, 'RF256', NULL, 256, 1, 0, 0, 0, 0, 0),
(262, 258, 'RF257', NULL, 257, 1, 0, 0, 0, 0, 0),
(263, 259, 'RF258', NULL, 258, 1, 0, 0, 0, 0, 0),
(264, 260, 'RF259', NULL, 259, 1, 0, 0, 0, 0, 0),
(265, 261, 'RF260', NULL, 260, 1, 0, 0, 0, 0, 0),
(266, 262, 'RF261', NULL, 261, 1, 0, 0, 0, 0, 0),
(267, 263, 'RF262', NULL, 262, 1, 0, 0, 0, 0, 0),
(268, 264, 'RF263', NULL, 263, 1, 0, 0, 0, 0, 0),
(269, 265, 'RF264', NULL, 264, 1, 0, 0, 0, 0, 0),
(270, 266, 'RF265', NULL, 265, 1, 0, 0, 0, 0, 0),
(271, 267, 'RF266', NULL, 266, 1, 0, 0, 0, 0, 0),
(272, 268, 'RF267', NULL, 267, 1, 0, 0, 0, 0, 0),
(273, 269, 'RF268', NULL, 268, 1, 0, 0, 0, 0, 0),
(274, 270, 'RF269', NULL, 269, 1, 0, 0, 0, 0, 0),
(275, 271, 'RF270', NULL, 270, 1, 0, 0, 0, 0, 0),
(276, 272, 'RF271', NULL, 271, 1, 0, 0, 0, 0, 0),
(277, 273, 'RF272', NULL, 272, 1, 0, 0, 0, 0, 0),
(278, 274, 'RF273', NULL, 273, 1, 0, 0, 0, 0, 0),
(279, 275, 'RF274', NULL, 274, 1, 0, 0, 0, 0, 0),
(280, 276, 'RF275', NULL, 275, 1, 0, 0, 0, 0, 0),
(281, 277, 'RF276', NULL, 276, 1, 0, 0, 0, 0, 0),
(282, 278, 'RF277', NULL, 277, 1, 0, 0, 0, 0, 0),
(283, 279, 'RF278', NULL, 278, 1, 0, 0, 0, 0, 0),
(284, 280, 'RF279', NULL, 279, 1, 0, 0, 0, 0, 0),
(285, 281, 'RF280', NULL, 280, 1, 0, 0, 0, 0, 0),
(286, 282, 'RF281', NULL, 281, 1, 0, 0, 0, 0, 0),
(287, 283, 'RF282', NULL, 282, 1, 0, 0, 0, 0, 0),
(288, 284, 'RF283', NULL, 283, 1, 0, 0, 0, 0, 0),
(289, 285, 'RF284', NULL, 284, 1, 0, 0, 0, 0, 0),
(290, 286, 'RF285', NULL, 285, 1, 0, 0, 0, 0, 0),
(291, 287, 'RF286', NULL, 286, 1, 0, 0, 0, 0, 0),
(292, 288, 'RF287', NULL, 287, 1, 0, 0, 0, 0, 0),
(293, 289, 'RF288', NULL, 288, 1, 0, 0, 0, 0, 0),
(294, 290, 'RF289', NULL, 289, 1, 0, 0, 0, 0, 0),
(295, 291, 'RF290', NULL, 290, 1, 0, 0, 0, 0, 0),
(296, 292, 'RF291', NULL, 291, 1, 0, 0, 0, 0, 0),
(297, 293, 'RF292', NULL, 292, 1, 0, 0, 0, 0, 0),
(298, 294, 'RF293', NULL, 293, 1, 0, 0, 0, 0, 0),
(299, 295, 'RF294', NULL, 294, 1, 0, 0, 0, 0, 0),
(300, 296, 'RF295', NULL, 295, 1, 0, 0, 0, 0, 0),
(301, 297, 'RF296', NULL, 296, 1, 0, 0, 0, 0, 0),
(302, 298, 'RF297', NULL, 297, 1, 0, 0, 0, 0, 0),
(303, 299, 'RF298', NULL, 298, 1, 0, 0, 0, 0, 0),
(304, 300, 'RF299', NULL, 299, 1, 0, 0, 0, 0, 0),
(305, 301, 'RF300', NULL, 300, 1, 0, 0, 0, 0, 0),
(306, 302, 'RF301', NULL, 301, 1, 0, 0, 0, 0, 0),
(307, 303, 'RF302', NULL, 302, 1, 0, 0, 0, 0, 0),
(308, 304, 'RF303', NULL, 303, 1, 0, 0, 0, 0, 0),
(309, 305, 'RF304', NULL, 304, 1, 0, 0, 0, 0, 0),
(310, 306, 'RF305', NULL, 305, 1, 0, 0, 0, 0, 0),
(311, 307, 'RF306', NULL, 306, 1, 0, 0, 0, 0, 0),
(312, 308, 'RF307', NULL, 307, 1, 0, 0, 0, 0, 0),
(313, 309, 'RF308', NULL, 308, 1, 0, 0, 0, 0, 0),
(314, 310, 'RF309', NULL, 309, 1, 0, 0, 0, 0, 0),
(315, 311, 'RF310', NULL, 310, 1, 0, 0, 0, 0, 0),
(316, 312, 'RF311', NULL, 311, 1, 0, 0, 0, 0, 0),
(317, 313, 'RF312', NULL, 312, 1, 0, 0, 0, 0, 0),
(318, 314, 'RF313', NULL, 313, 1, 0, 0, 0, 0, 0),
(319, 315, 'RF314', NULL, 314, 1, 0, 0, 0, 0, 0),
(320, 316, 'RF315', NULL, 315, 1, 0, 0, 0, 0, 0),
(321, 317, 'RF316', NULL, 316, 1, 0, 0, 0, 0, 0),
(322, 318, 'RF317', NULL, 317, 1, 0, 0, 0, 0, 0),
(323, 319, 'RF318', NULL, 318, 1, 0, 0, 0, 0, 0),
(324, 320, 'RF319', NULL, 319, 1, 0, 0, 0, 0, 0),
(325, 321, 'RF320', NULL, 320, 1, 0, 0, 0, 0, 0),
(326, 322, 'RF321', NULL, 321, 1, 0, 0, 0, 0, 0),
(327, 323, 'RF322', NULL, 322, 1, 0, 0, 0, 0, 0),
(328, 324, 'RF323', NULL, 323, 1, 0, 0, 0, 0, 0),
(329, 325, 'RF324', NULL, 324, 1, 0, 0, 0, 0, 0),
(330, 326, 'RF325', NULL, 325, 1, 0, 0, 0, 0, 0),
(331, 327, 'RF326', NULL, 326, 1, 0, 0, 0, 0, 0),
(332, 328, 'RF327', NULL, 327, 1, 0, 0, 0, 0, 0),
(333, 329, 'RF328', NULL, 328, 1, 0, 0, 0, 0, 0),
(334, 330, 'RF329', NULL, 329, 1, 0, 0, 0, 0, 0),
(335, 331, 'RF330', NULL, 330, 1, 0, 0, 0, 0, 0),
(336, 332, 'RF331', NULL, 331, 1, 0, 0, 0, 0, 0),
(337, 333, 'RF332', NULL, 332, 1, 0, 0, 0, 0, 0),
(338, 334, 'RF333', NULL, 333, 1, 0, 0, 0, 0, 0),
(339, 335, 'RF334', NULL, 334, 1, 0, 0, 0, 0, 0),
(340, 336, 'RF335', NULL, 335, 1, 0, 0, 0, 0, 0),
(341, 337, 'RF336', NULL, 336, 1, 0, 0, 0, 0, 0),
(342, 338, 'RF337', NULL, 337, 1, 0, 0, 0, 0, 0),
(343, 339, 'RF338', NULL, 338, 1, 0, 0, 0, 0, 0),
(344, 340, 'RF339', NULL, 339, 1, 0, 0, 0, 0, 0),
(345, 341, 'RF340', NULL, 340, 1, 0, 0, 0, 0, 0),
(346, 342, 'RF341', NULL, 341, 1, 0, 0, 0, 0, 0),
(347, 343, 'RF342', NULL, 342, 1, 0, 0, 0, 0, 0),
(348, 344, 'RF343', NULL, 343, 1, 0, 0, 0, 0, 0),
(349, 345, 'RF344', NULL, 344, 1, 0, 0, 0, 0, 0),
(350, 346, 'RF345', NULL, 345, 1, 0, 0, 0, 0, 0),
(351, 347, 'RF346', NULL, 346, 1, 0, 0, 0, 0, 0),
(352, 348, 'RF347', NULL, 347, 1, 0, 0, 0, 0, 0),
(353, 349, 'RF348', NULL, 348, 1, 0, 0, 0, 0, 0),
(354, 350, 'RF349', NULL, 349, 1, 0, 0, 0, 0, 0),
(355, 351, 'RF350', NULL, 350, 1, 0, 0, 0, 0, 0),
(356, 352, 'RF351', NULL, 351, 1, 0, 0, 0, 0, 0),
(357, 353, 'RF352', NULL, 352, 1, 0, 0, 0, 0, 0),
(358, 354, 'RF353', NULL, 353, 1, 0, 0, 0, 0, 0),
(359, 355, 'RF354', NULL, 354, 1, 0, 0, 0, 0, 0),
(360, 356, 'RF355', NULL, 355, 1, 0, 0, 0, 0, 0),
(361, 357, 'RF356', NULL, 356, 1, 0, 0, 0, 0, 0),
(362, 358, 'RF357', NULL, 357, 1, 0, 0, 0, 0, 0),
(363, 359, 'RF358', NULL, 358, 1, 0, 0, 0, 0, 0),
(364, 360, 'RF359', NULL, 359, 1, 0, 0, 0, 0, 0),
(365, 361, 'RF360', NULL, 360, 1, 0, 0, 0, 0, 0),
(366, 362, 'RF361', NULL, 361, 1, 0, 0, 0, 0, 0),
(367, 363, 'RF362', NULL, 362, 1, 0, 0, 0, 0, 0),
(368, 364, 'RF363', NULL, 363, 1, 0, 0, 0, 0, 0),
(369, 365, 'RF364', NULL, 364, 1, 0, 0, 0, 0, 0),
(370, 366, 'RF365', NULL, 365, 1, 0, 0, 0, 0, 0),
(371, 367, 'RF366', NULL, 366, 1, 0, 0, 0, 0, 0),
(372, 368, 'RF367', NULL, 367, 1, 0, 0, 0, 0, 0),
(373, 369, 'RF368', NULL, 368, 1, 0, 0, 0, 0, 0),
(374, 370, 'RF369', NULL, 369, 1, 0, 0, 0, 0, 0),
(375, 371, 'RF370', NULL, 370, 1, 0, 0, 0, 0, 0),
(376, 372, 'RF371', NULL, 371, 1, 0, 0, 0, 0, 0),
(377, 373, 'RF372', NULL, 372, 1, 0, 0, 0, 0, 0),
(378, 374, 'RF373', NULL, 373, 1, 0, 0, 0, 0, 0),
(379, 375, 'RF374', NULL, 374, 1, 0, 0, 0, 0, 0),
(380, 376, 'RF375', NULL, 375, 1, 0, 0, 0, 0, 0),
(381, 377, 'RF376', NULL, 376, 1, 0, 0, 0, 0, 0),
(382, 378, 'RF377', NULL, 377, 1, 0, 0, 0, 0, 0),
(383, 379, 'RF378', NULL, 378, 1, 0, 0, 0, 0, 0),
(384, 380, 'RF379', NULL, 379, 1, 0, 0, 0, 0, 0),
(385, 381, 'RF380', NULL, 380, 1, 0, 0, 0, 0, 0),
(386, 382, 'RF381', NULL, 381, 1, 0, 0, 0, 0, 0),
(387, 383, 'RF382', NULL, 382, 1, 0, 0, 0, 0, 0),
(388, 384, 'RF383', NULL, 383, 1, 0, 0, 0, 0, 0),
(389, 385, 'RF384', NULL, 384, 1, 0, 0, 0, 0, 0),
(390, 386, 'RF385', NULL, 385, 1, 0, 0, 0, 0, 0),
(391, 387, 'RF386', NULL, 386, 1, 0, 0, 0, 0, 0),
(392, 388, 'RF387', NULL, 387, 1, 0, 0, 0, 0, 0),
(393, 389, 'RF388', NULL, 388, 1, 0, 0, 0, 0, 0),
(394, 390, 'RF389', NULL, 389, 1, 0, 0, 0, 0, 0),
(395, 391, 'RF390', NULL, 390, 1, 0, 0, 0, 0, 0),
(396, 392, 'RF391', NULL, 391, 1, 0, 0, 0, 0, 0),
(397, 393, 'RF392', NULL, 392, 1, 0, 0, 0, 0, 0),
(398, 394, 'RF393', NULL, 393, 1, 0, 0, 0, 0, 0),
(399, 395, 'RF394', NULL, 394, 1, 0, 0, 0, 0, 0),
(400, 396, 'RF395', NULL, 395, 1, 0, 0, 0, 0, 0),
(401, 397, 'RF396', NULL, 396, 1, 0, 0, 0, 0, 0),
(402, 398, 'RF397', NULL, 397, 1, 0, 0, 0, 0, 0),
(403, 399, 'RF398', NULL, 398, 1, 0, 0, 0, 0, 0),
(404, 400, 'RF399', NULL, 399, 1, 0, 0, 0, 0, 0),
(405, 401, 'RF400', NULL, 400, 1, 0, 0, 0, 0, 0),
(406, 402, 'RF401', NULL, 401, 1, 0, 0, 0, 0, 0),
(407, 403, 'RF402', NULL, 402, 1, 0, 0, 0, 0, 0),
(408, 404, 'RF403', NULL, 403, 1, 0, 0, 0, 0, 0),
(409, 405, 'RF404', NULL, 404, 1, 0, 0, 0, 0, 0),
(410, 406, 'RF405', NULL, 405, 1, 0, 0, 0, 0, 0),
(411, 407, 'RF406', NULL, 406, 1, 0, 0, 0, 0, 0),
(412, 408, 'RF407', NULL, 407, 1, 0, 0, 0, 0, 0),
(413, 409, 'RF408', NULL, 408, 1, 0, 0, 0, 0, 0),
(414, 410, 'RF409', NULL, 409, 1, 0, 0, 0, 0, 0),
(415, 411, 'RF410', NULL, 410, 1, 0, 0, 0, 0, 0),
(416, 412, 'RF411', NULL, 411, 1, 0, 0, 0, 0, 0),
(417, 413, 'RF412', NULL, 412, 1, 0, 0, 0, 0, 0),
(418, 414, 'RF413', NULL, 413, 1, 0, 0, 0, 0, 0),
(419, 415, 'RF414', NULL, 414, 1, 0, 0, 0, 0, 0),
(420, 416, 'RF415', NULL, 415, 1, 0, 0, 0, 0, 0),
(421, 417, 'RF416', NULL, 416, 1, 0, 0, 0, 0, 0),
(422, 418, 'RF417', NULL, 417, 1, 0, 0, 0, 0, 0),
(423, 419, 'RF418', NULL, 418, 1, 0, 0, 0, 0, 0),
(424, 420, 'RF419', NULL, 419, 1, 0, 0, 0, 0, 0),
(425, 421, 'RF420', NULL, 420, 1, 0, 0, 0, 0, 0),
(426, 422, 'RF421', NULL, 421, 1, 0, 0, 0, 0, 0),
(427, 423, 'RF422', NULL, 422, 1, 0, 0, 0, 0, 0),
(428, 424, 'RF423', NULL, 423, 1, 0, 0, 0, 0, 0),
(429, 425, 'RF424', NULL, 424, 1, 0, 0, 0, 0, 0),
(430, 426, 'RF425', NULL, 425, 1, 0, 0, 0, 0, 0),
(431, 427, 'RF426', NULL, 426, 1, 0, 0, 0, 0, 0),
(432, 428, 'RF427', NULL, 427, 1, 0, 0, 0, 0, 0),
(433, 429, 'RF428', NULL, 428, 1, 0, 0, 0, 0, 0),
(434, 430, 'RF429', NULL, 429, 1, 0, 0, 0, 0, 0),
(435, 431, 'RF430', NULL, 430, 1, 0, 0, 0, 0, 0),
(436, 432, 'RF431', NULL, 431, 1, 0, 0, 0, 0, 0),
(437, 433, 'RF432', NULL, 432, 1, 0, 0, 0, 0, 0),
(438, 434, 'RF433', NULL, 433, 1, 0, 0, 0, 0, 0),
(439, 435, 'RF434', NULL, 434, 1, 0, 0, 0, 0, 0),
(440, 436, 'RF435', NULL, 435, 1, 0, 0, 0, 0, 0),
(441, 437, 'RF436', NULL, 436, 1, 0, 0, 0, 0, 0),
(442, 438, 'RF437', NULL, 437, 1, 0, 0, 0, 0, 0),
(443, 439, 'RF438', NULL, 438, 1, 0, 0, 0, 0, 0),
(444, 440, 'RF439', NULL, 439, 1, 0, 0, 0, 0, 0),
(445, 441, 'RF440', NULL, 440, 1, 0, 0, 0, 0, 0),
(446, 442, 'RF441', NULL, 441, 1, 0, 0, 0, 0, 0),
(447, 443, 'RF442', NULL, 442, 1, 0, 0, 0, 0, 0),
(448, 444, 'RF443', NULL, 443, 1, 0, 0, 0, 0, 0),
(449, 445, 'RF444', NULL, 444, 1, 0, 0, 0, 0, 0),
(450, 446, 'RF445', NULL, 445, 1, 0, 0, 0, 0, 0),
(451, 447, 'RF446', NULL, 446, 1, 0, 0, 0, 0, 0),
(452, 448, 'RF447', NULL, 447, 1, 0, 0, 0, 0, 0),
(453, 449, 'RF448', NULL, 448, 1, 0, 0, 0, 0, 0),
(454, 450, 'RF449', NULL, 449, 1, 0, 0, 0, 0, 0),
(455, 451, 'RF450', NULL, 450, 1, 0, 0, 0, 0, 0),
(456, 452, 'RF451', NULL, 451, 1, 0, 0, 0, 0, 0),
(457, 453, 'RF452', NULL, 452, 1, 0, 0, 0, 0, 0),
(458, 454, 'RF453', NULL, 453, 1, 0, 0, 0, 0, 0),
(459, 455, 'RF454', NULL, 454, 1, 0, 0, 0, 0, 0),
(460, 456, 'RF455', NULL, 455, 1, 0, 0, 0, 0, 0),
(461, 457, 'RF456', NULL, 456, 1, 0, 0, 0, 0, 0),
(462, 458, 'RF457', NULL, 457, 1, 0, 0, 0, 0, 0),
(463, 459, 'RF458', NULL, 458, 1, 0, 0, 0, 0, 0),
(464, 460, 'RF459', NULL, 459, 1, 0, 0, 0, 0, 0),
(465, 461, 'RF460', NULL, 460, 1, 0, 0, 0, 0, 0),
(466, 462, 'RF461', NULL, 461, 1, 0, 0, 0, 0, 0),
(467, 463, 'RF462', NULL, 462, 1, 0, 0, 0, 0, 0),
(468, 464, 'RF463', NULL, 463, 1, 0, 0, 0, 0, 0),
(469, 465, 'RF464', NULL, 464, 1, 0, 0, 0, 0, 0),
(470, 466, 'RF465', NULL, 465, 1, 0, 0, 0, 0, 0),
(471, 467, 'RF466', NULL, 466, 1, 0, 0, 0, 0, 0),
(472, 468, 'RF467', NULL, 467, 1, 0, 0, 0, 0, 0),
(473, 469, 'RF468', NULL, 468, 1, 0, 0, 0, 0, 0),
(474, 470, 'RF469', NULL, 469, 1, 0, 0, 0, 0, 0),
(475, 471, 'RF470', NULL, 470, 1, 0, 0, 0, 0, 0),
(476, 472, 'RF471', NULL, 471, 1, 0, 0, 0, 0, 0),
(477, 473, 'RF472', NULL, 472, 1, 0, 0, 0, 0, 0),
(478, 474, 'RF473', NULL, 473, 1, 0, 0, 0, 0, 0),
(479, 475, 'RF474', NULL, 474, 1, 0, 0, 0, 0, 0),
(480, 476, 'RF475', NULL, 475, 1, 0, 0, 0, 0, 0),
(481, 477, 'RF476', NULL, 476, 1, 0, 0, 0, 0, 0),
(482, 478, 'RF477', NULL, 477, 1, 0, 0, 0, 0, 0),
(483, 479, 'RF478', NULL, 478, 1, 0, 0, 0, 0, 0),
(484, 480, 'RF479', NULL, 479, 1, 0, 0, 0, 0, 0),
(485, 481, 'RF480', NULL, 480, 1, 0, 0, 0, 0, 0),
(486, 482, 'RF481', NULL, 481, 1, 0, 0, 0, 0, 0),
(487, 483, 'RF482', NULL, 482, 1, 0, 0, 0, 0, 0),
(488, 484, 'RF483', NULL, 483, 1, 0, 0, 0, 0, 0),
(489, 485, 'RF484', NULL, 484, 1, 0, 0, 0, 0, 0),
(490, 486, 'RF485', NULL, 485, 1, 0, 0, 0, 0, 0),
(491, 487, 'RF486', NULL, 486, 1, 0, 0, 0, 0, 0),
(492, 488, 'RF487', NULL, 487, 1, 0, 0, 0, 0, 0),
(493, 489, 'RF488', NULL, 488, 1, 0, 0, 0, 0, 0),
(494, 490, 'RF489', NULL, 489, 1, 0, 0, 0, 0, 0),
(495, 491, 'RF490', NULL, 490, 1, 0, 0, 0, 0, 0),
(496, 492, 'RF491', NULL, 491, 1, 0, 0, 0, 0, 0),
(497, 493, 'RF492', NULL, 492, 1, 0, 0, 0, 0, 0),
(498, 494, 'RF493', NULL, 493, 1, 0, 0, 0, 0, 0),
(499, 495, 'RF494', NULL, 494, 1, 0, 0, 0, 0, 0),
(500, 496, 'RF495', NULL, 495, 1, 0, 0, 0, 0, 0),
(501, 497, 'RF496', NULL, 496, 1, 0, 0, 0, 0, 0),
(502, 498, 'RF497', NULL, 497, 1, 0, 0, 0, 0, 0),
(503, 499, 'RF498', NULL, 498, 1, 0, 0, 0, 0, 0),
(504, 500, 'RF499', NULL, 499, 1, 0, 0, 0, 0, 0),
(505, 501, 'RF500', NULL, 500, 1, 0, 0, 0, 0, 0),
(506, 502, 'RF501', NULL, 501, 1, 0, 0, 0, 0, 0),
(507, 503, 'RF502', NULL, 502, 1, 0, 0, 0, 0, 0),
(508, 504, 'RF503', NULL, 503, 1, 0, 0, 0, 0, 0),
(509, 505, 'RF504', NULL, 504, 1, 0, 0, 0, 0, 0),
(510, 506, 'RF505', NULL, 505, 1, 0, 0, 0, 0, 0),
(511, 507, 'RF506', NULL, 506, 1, 0, 0, 0, 0, 0),
(512, 508, 'RF507', NULL, 507, 1, 0, 0, 0, 0, 0),
(513, 509, 'RF508', NULL, 508, 1, 0, 0, 0, 0, 0),
(514, 510, 'RF509', NULL, 509, 1, 0, 0, 0, 0, 0),
(515, 511, 'RF510', NULL, 510, 1, 0, 0, 0, 0, 0),
(516, 512, 'RF511', NULL, 511, 1, 0, 0, 0, 0, 0),
(517, 513, 'RF512', NULL, 512, 1, 0, 0, 0, 0, 0),
(518, 514, 'RF513', NULL, 513, 1, 0, 0, 0, 0, 0),
(519, 515, 'RF514', NULL, 514, 1, 0, 0, 0, 0, 0),
(520, 516, 'RF515', NULL, 515, 1, 0, 0, 0, 0, 0),
(521, 517, 'RF516', NULL, 516, 1, 0, 0, 0, 0, 0),
(522, 518, 'RF517', NULL, 517, 1, 0, 0, 0, 0, 0),
(523, 519, 'RF518', NULL, 518, 1, 0, 0, 0, 0, 0),
(524, 520, 'RF519', NULL, 519, 1, 0, 0, 0, 0, 0),
(525, 521, 'RF520', NULL, 520, 1, 0, 0, 0, 0, 0),
(526, 522, 'RF521', NULL, 521, 1, 0, 0, 0, 0, 0),
(527, 523, 'RF522', NULL, 522, 1, 0, 0, 0, 0, 0),
(528, 524, 'RF523', NULL, 523, 1, 0, 0, 0, 0, 0),
(529, 525, 'RF524', NULL, 524, 1, 0, 0, 0, 0, 0),
(530, 526, 'RF525', NULL, 525, 1, 0, 0, 0, 0, 0),
(531, 527, 'RF526', NULL, 526, 1, 0, 0, 0, 0, 0),
(532, 528, 'RF527', NULL, 527, 1, 0, 0, 0, 0, 0),
(533, 529, 'RF528', NULL, 528, 1, 0, 0, 0, 0, 0),
(534, 530, 'RF529', NULL, 529, 1, 0, 0, 0, 0, 0),
(535, 531, 'RF530', NULL, 530, 1, 0, 0, 0, 0, 0),
(536, 532, 'RF531', NULL, 531, 1, 0, 0, 0, 0, 0),
(537, 533, 'RF532', NULL, 532, 1, 0, 0, 0, 0, 0),
(538, 534, 'RF533', NULL, 533, 1, 0, 0, 0, 0, 0),
(539, 535, 'RF534', NULL, 534, 1, 0, 0, 0, 0, 0),
(540, 536, 'RF535', NULL, 535, 1, 0, 0, 0, 0, 0),
(541, 537, 'RF536', NULL, 536, 1, 0, 0, 0, 0, 0),
(542, 538, 'RF537', NULL, 537, 1, 0, 0, 0, 0, 0),
(543, 539, 'RF538', NULL, 538, 1, 0, 0, 0, 0, 0),
(544, 540, 'RF539', NULL, 539, 1, 0, 0, 0, 0, 0),
(545, 541, 'RF540', NULL, 540, 1, 0, 0, 0, 0, 0),
(546, 542, 'RF541', NULL, 541, 1, 0, 0, 0, 0, 0),
(547, 543, 'RF542', NULL, 542, 1, 0, 0, 0, 0, 0),
(548, 544, 'RF543', NULL, 543, 1, 0, 0, 0, 0, 0),
(549, 545, 'RF544', NULL, 544, 1, 0, 0, 0, 0, 0),
(550, 546, 'RF545', NULL, 545, 1, 0, 0, 0, 0, 0),
(551, 547, 'RF546', NULL, 546, 1, 0, 0, 0, 0, 0),
(552, 548, 'RF547', NULL, 547, 1, 0, 0, 0, 0, 0),
(553, 549, 'RF548', NULL, 548, 1, 0, 0, 0, 0, 0),
(554, 550, 'RF549', NULL, 549, 1, 0, 0, 0, 0, 0),
(555, 551, 'RF550', NULL, 550, 1, 0, 0, 0, 0, 0),
(556, 552, 'RF551', NULL, 551, 1, 0, 0, 0, 0, 0),
(557, 553, 'RF552', NULL, 552, 1, 0, 0, 0, 0, 0),
(558, 554, 'RF553', NULL, 553, 1, 0, 0, 0, 0, 0),
(559, 555, 'RF554', NULL, 554, 1, 0, 0, 0, 0, 0),
(560, 556, 'RF555', NULL, 555, 1, 0, 0, 0, 0, 0),
(561, 557, 'RF556', NULL, 556, 1, 0, 0, 0, 0, 0),
(562, 558, 'RF557', NULL, 557, 1, 0, 0, 0, 0, 0),
(563, 559, 'RF558', NULL, 558, 1, 0, 0, 0, 0, 0),
(564, 560, 'RF559', NULL, 559, 1, 0, 0, 0, 0, 0),
(565, 561, 'RF560', NULL, 560, 1, 0, 0, 0, 0, 0),
(566, 562, 'RF561', NULL, 561, 1, 0, 0, 0, 0, 0),
(567, 563, 'RF562', NULL, 562, 1, 0, 0, 0, 0, 0),
(568, 564, 'RF563', NULL, 563, 1, 0, 0, 0, 0, 0),
(569, 565, 'RF564', NULL, 564, 1, 0, 0, 0, 0, 0),
(570, 566, 'RF565', NULL, 565, 1, 0, 0, 0, 0, 0),
(571, 567, 'RF566', NULL, 566, 1, 0, 0, 0, 0, 0),
(572, 568, 'RF567', NULL, 567, 1, 0, 0, 0, 0, 0),
(573, 569, 'RF568', NULL, 568, 1, 0, 0, 0, 0, 0),
(574, 570, 'RF569', NULL, 569, 1, 0, 0, 0, 0, 0),
(575, 571, 'RF570', NULL, 570, 1, 0, 0, 0, 0, 0),
(576, 572, 'RF571', NULL, 571, 1, 0, 0, 0, 0, 0),
(577, 573, 'RF572', NULL, 572, 1, 0, 0, 0, 0, 0),
(578, 574, 'RF573', NULL, 573, 1, 0, 0, 0, 0, 0),
(579, 575, 'RF574', NULL, 574, 1, 0, 0, 0, 0, 0),
(580, 576, 'RF575', NULL, 575, 1, 0, 0, 0, 0, 0),
(581, 577, 'RF576', NULL, 576, 1, 0, 0, 0, 0, 0),
(582, 578, 'RF577', NULL, 577, 1, 0, 0, 0, 0, 0),
(583, 579, 'RF578', NULL, 578, 1, 0, 0, 0, 0, 0),
(584, 580, 'RF579', NULL, 579, 1, 0, 0, 0, 0, 0),
(585, 581, 'RF580', NULL, 580, 1, 0, 0, 0, 0, 0),
(586, 582, 'RF581', NULL, 581, 1, 0, 0, 0, 0, 0),
(587, 583, 'RF582', NULL, 582, 1, 0, 0, 0, 0, 0),
(588, 584, 'RF583', NULL, 583, 1, 0, 0, 0, 0, 0),
(589, 585, 'RF584', NULL, 584, 1, 0, 0, 0, 0, 0),
(590, 586, 'RF585', NULL, 585, 1, 0, 0, 0, 0, 0),
(591, 587, 'RF586', NULL, 586, 1, 0, 0, 0, 0, 0),
(592, 588, 'RF587', NULL, 587, 1, 0, 0, 0, 0, 0),
(593, 589, 'RF588', NULL, 588, 1, 0, 0, 0, 0, 0),
(594, 590, 'RF589', NULL, 589, 1, 0, 0, 0, 0, 0),
(595, 591, 'RF590', NULL, 590, 1, 0, 0, 0, 0, 0),
(596, 592, 'RF591', NULL, 591, 1, 0, 0, 0, 0, 0),
(597, 593, 'RF592', NULL, 592, 1, 0, 0, 0, 0, 0),
(598, 594, 'RF593', NULL, 593, 1, 0, 0, 0, 0, 0),
(599, 595, 'RF594', NULL, 594, 1, 0, 0, 0, 0, 0),
(600, 596, 'RF595', NULL, 595, 1, 0, 0, 0, 0, 0),
(601, 597, 'RF596', NULL, 596, 1, 0, 0, 0, 0, 0),
(602, 598, 'RF597', NULL, 597, 1, 0, 0, 0, 0, 0),
(603, 599, 'RF598', NULL, 598, 1, 0, 0, 0, 0, 0),
(604, 600, 'RF599', NULL, 599, 1, 0, 0, 0, 0, 0),
(605, 601, 'RF600', NULL, 600, 1, 0, 0, 0, 0, 0),
(606, 602, 'RF601', NULL, 601, 1, 0, 0, 0, 0, 0),
(607, 603, 'RF602', NULL, 602, 1, 0, 0, 0, 0, 0),
(608, 604, 'RF603', NULL, 603, 1, 0, 0, 0, 0, 0),
(609, 605, 'RF604', NULL, 604, 1, 0, 0, 0, 0, 0),
(610, 606, 'RF605', NULL, 605, 1, 0, 0, 0, 0, 0),
(611, 607, 'RF606', NULL, 606, 1, 0, 0, 0, 0, 0),
(612, 608, 'RF607', NULL, 607, 1, 0, 0, 0, 0, 0),
(613, 609, 'RF608', NULL, 608, 1, 0, 0, 0, 0, 0),
(614, 610, 'RF609', NULL, 609, 1, 0, 0, 0, 0, 0),
(615, 611, 'RF610', NULL, 610, 1, 0, 0, 0, 0, 0),
(616, 612, 'RF611', NULL, 611, 1, 0, 0, 0, 0, 0),
(617, 613, 'RF612', NULL, 612, 1, 0, 0, 0, 0, 0),
(618, 614, 'RF613', NULL, 613, 1, 0, 0, 0, 0, 0),
(619, 615, 'RF614', NULL, 614, 1, 0, 0, 0, 0, 0),
(620, 616, 'RF615', NULL, 615, 1, 0, 0, 0, 0, 0),
(621, 617, 'RF616', NULL, 616, 1, 0, 0, 0, 0, 0),
(622, 618, 'RF617', NULL, 617, 1, 0, 0, 0, 0, 0),
(623, 619, 'RF618', NULL, 618, 1, 0, 0, 0, 0, 0),
(624, 620, 'RF619', NULL, 619, 1, 0, 0, 0, 0, 0),
(625, 621, 'RF620', NULL, 620, 1, 0, 0, 0, 0, 0),
(626, 622, 'RF621', NULL, 621, 1, 0, 0, 0, 0, 0),
(627, 623, 'RF622', NULL, 622, 1, 0, 0, 0, 0, 0),
(628, 624, 'RF623', NULL, 623, 1, 0, 0, 0, 0, 0),
(629, 625, 'RF624', NULL, 624, 1, 0, 0, 0, 0, 0),
(630, 626, 'RF625', NULL, 625, 1, 0, 0, 0, 0, 0),
(631, 627, 'RF626', NULL, 626, 1, 0, 0, 0, 0, 0),
(632, 628, 'RF627', NULL, 627, 1, 0, 0, 0, 0, 0),
(633, 629, 'RF628', NULL, 628, 1, 0, 0, 0, 0, 0),
(634, 630, 'RF629', NULL, 629, 1, 0, 0, 0, 0, 0),
(635, 631, 'RF630', NULL, 630, 1, 0, 0, 0, 0, 0),
(636, 632, 'RF631', NULL, 631, 1, 0, 0, 0, 0, 0),
(637, 633, 'RF632', NULL, 632, 1, 0, 0, 0, 0, 0),
(638, 634, 'RF633', NULL, 633, 1, 0, 0, 0, 0, 0),
(639, 635, 'RF634', NULL, 634, 1, 0, 0, 0, 0, 0),
(640, 636, 'RF635', NULL, 635, 1, 0, 0, 0, 0, 0),
(641, 637, 'RF636', NULL, 636, 1, 0, 0, 0, 0, 0),
(642, 638, 'RF637', NULL, 637, 1, 0, 0, 0, 0, 0),
(643, 639, 'RF638', NULL, 638, 1, 0, 0, 0, 0, 0),
(644, 640, 'RF639', NULL, 639, 1, 0, 0, 0, 0, 0),
(645, 641, 'RF640', NULL, 640, 1, 0, 0, 0, 0, 0),
(646, 642, 'RF641', NULL, 641, 1, 0, 0, 0, 0, 0),
(647, 643, 'RF642', NULL, 642, 1, 0, 0, 0, 0, 0),
(648, 644, 'RF643', NULL, 643, 1, 0, 0, 0, 0, 0),
(649, 645, 'RF644', NULL, 644, 1, 0, 0, 0, 0, 0),
(650, 646, 'RF645', NULL, 645, 1, 0, 0, 0, 0, 0),
(651, 647, 'RF646', NULL, 646, 1, 0, 0, 0, 0, 0),
(652, 648, 'RF647', NULL, 647, 1, 0, 0, 0, 0, 0),
(653, 649, 'RF648', NULL, 648, 1, 0, 0, 0, 0, 0),
(654, 650, 'RF649', NULL, 649, 1, 0, 0, 0, 0, 0),
(655, 651, 'RF650', NULL, 650, 1, 0, 0, 0, 0, 0),
(656, 652, 'RF651', NULL, 651, 1, 0, 0, 0, 0, 0),
(657, 653, 'RF652', NULL, 652, 1, 0, 0, 0, 0, 0),
(658, 654, 'RF653', NULL, 653, 1, 0, 0, 0, 0, 0),
(659, 655, 'RF654', NULL, 654, 1, 0, 0, 0, 0, 0),
(660, 656, 'RF655', NULL, 655, 1, 0, 0, 0, 0, 0),
(661, 657, 'RF656', NULL, 656, 1, 0, 0, 0, 0, 0),
(662, 658, 'RF657', NULL, 657, 1, 0, 0, 0, 0, 0),
(663, 659, 'RF658', NULL, 658, 1, 0, 0, 0, 0, 0),
(664, 660, 'RF659', NULL, 659, 1, 0, 0, 0, 0, 0),
(665, 661, 'RF660', NULL, 660, 1, 0, 0, 0, 0, 0),
(666, 662, 'RF661', NULL, 661, 1, 0, 0, 0, 0, 0),
(667, 663, 'RF662', NULL, 662, 1, 0, 0, 0, 0, 0),
(668, 664, 'RF663', NULL, 663, 1, 0, 0, 0, 0, 0),
(669, 665, 'RF664', NULL, 664, 1, 0, 0, 0, 0, 0),
(670, 666, 'RF665', NULL, 665, 1, 0, 0, 0, 0, 0),
(671, 667, 'RF666', NULL, 666, 1, 0, 0, 0, 0, 0),
(672, 668, 'RF667', NULL, 667, 1, 0, 0, 0, 0, 0),
(673, 669, 'RF668', NULL, 668, 1, 0, 0, 0, 0, 0),
(674, 670, 'RF669', NULL, 669, 1, 0, 0, 0, 0, 0),
(675, 671, 'RF670', NULL, 670, 1, 0, 0, 0, 0, 0),
(676, 672, 'RF671', NULL, 671, 1, 0, 0, 0, 0, 0),
(677, 673, 'RF672', NULL, 672, 1, 0, 0, 0, 0, 0),
(678, 674, 'RF673', NULL, 673, 1, 0, 0, 0, 0, 0),
(679, 675, 'RF674', NULL, 674, 1, 0, 0, 0, 0, 0),
(680, 676, 'RF675', NULL, 675, 1, 0, 0, 0, 0, 0),
(681, 677, 'RF676', NULL, 676, 1, 0, 0, 0, 0, 0),
(682, 678, 'RF677', NULL, 677, 1, 0, 0, 0, 0, 0),
(683, 679, 'RF678', NULL, 678, 1, 0, 0, 0, 0, 0),
(684, 680, 'RF679', NULL, 679, 1, 0, 0, 0, 0, 0),
(685, 681, 'RF680', NULL, 680, 1, 0, 0, 0, 0, 0),
(686, 682, 'RF681', NULL, 681, 1, 0, 0, 0, 0, 0),
(687, 683, 'RF682', NULL, 682, 1, 0, 0, 0, 0, 0),
(688, 684, 'RF683', NULL, 683, 1, 0, 0, 0, 0, 0),
(689, 685, 'RF684', NULL, 684, 1, 0, 0, 0, 0, 0),
(690, 686, 'RF685', NULL, 685, 1, 0, 0, 0, 0, 0),
(691, 687, 'RF686', NULL, 686, 1, 0, 0, 0, 0, 0),
(692, 688, 'RF687', NULL, 687, 1, 0, 0, 0, 0, 0),
(693, 689, 'RF688', NULL, 688, 1, 0, 0, 0, 0, 0),
(694, 690, 'RF689', NULL, 689, 1, 0, 0, 0, 0, 0),
(695, 691, 'RF690', NULL, 690, 1, 0, 0, 0, 0, 0),
(696, 692, 'RF691', NULL, 691, 1, 0, 0, 0, 0, 0),
(697, 693, 'RF692', NULL, 692, 1, 0, 0, 0, 0, 0),
(698, 694, 'RF693', NULL, 693, 1, 0, 0, 0, 0, 0),
(699, 695, 'RF694', NULL, 694, 1, 0, 0, 0, 0, 0),
(700, 696, 'RF695', NULL, 695, 1, 0, 0, 0, 0, 0),
(701, 697, 'RF696', NULL, 696, 1, 0, 0, 0, 0, 0),
(702, 698, 'RF697', NULL, 697, 1, 0, 0, 0, 0, 0),
(703, 699, 'RF698', NULL, 698, 1, 0, 0, 0, 0, 0),
(704, 700, 'RF699', NULL, 699, 1, 0, 0, 0, 0, 0),
(705, 701, 'RF700', NULL, 700, 1, 0, 0, 0, 0, 0),
(706, 702, 'RF701', NULL, 701, 1, 0, 0, 0, 0, 0),
(707, 703, 'RF702', NULL, 702, 1, 0, 0, 0, 0, 0),
(708, 704, 'RF703', NULL, 703, 1, 0, 0, 0, 0, 0),
(709, 705, 'RF704', NULL, 704, 1, 0, 0, 0, 0, 0),
(710, 706, 'RF705', NULL, 705, 1, 0, 0, 0, 0, 0),
(711, 707, 'RF706', NULL, 706, 1, 0, 0, 0, 0, 0),
(712, 708, 'RF707', NULL, 707, 1, 0, 0, 0, 0, 0),
(713, 709, 'RF708', NULL, 708, 1, 0, 0, 0, 0, 0),
(714, 710, 'RF709', NULL, 709, 1, 0, 0, 0, 0, 0),
(715, 711, 'RF710', NULL, 710, 1, 0, 0, 0, 0, 0),
(716, 712, 'RF711', NULL, 711, 1, 0, 0, 0, 0, 0),
(717, 713, 'RF712', NULL, 712, 1, 0, 0, 0, 0, 0),
(718, 714, 'RF713', NULL, 713, 1, 0, 0, 0, 0, 0),
(719, 715, 'RF714', NULL, 714, 1, 0, 0, 0, 0, 0),
(720, 716, 'RF715', NULL, 715, 1, 0, 0, 0, 0, 0),
(721, 717, 'RF716', NULL, 716, 1, 0, 0, 0, 0, 0),
(722, 718, 'RF717', NULL, 717, 1, 0, 0, 0, 0, 0),
(723, 719, 'RF718', NULL, 718, 1, 0, 0, 0, 0, 0),
(724, 720, 'RF719', NULL, 719, 1, 0, 0, 0, 0, 0),
(725, 721, 'RF720', NULL, 720, 1, 0, 0, 0, 0, 0),
(726, 722, 'RF721', NULL, 721, 1, 0, 0, 0, 0, 0),
(727, 723, 'RF722', NULL, 722, 1, 0, 0, 0, 0, 0),
(728, 724, 'RF723', NULL, 723, 1, 0, 0, 0, 0, 0),
(729, 725, 'RF724', NULL, 724, 1, 0, 0, 0, 0, 0),
(730, 726, 'RF725', NULL, 725, 1, 0, 0, 0, 0, 0),
(731, 727, 'RF726', NULL, 726, 1, 0, 0, 0, 0, 0),
(732, 728, 'RF727', NULL, 727, 1, 0, 0, 0, 0, 0),
(733, 729, 'RF728', NULL, 728, 1, 0, 0, 0, 0, 0),
(734, 730, 'RF729', NULL, 729, 1, 0, 0, 0, 0, 0),
(735, 731, 'RF730', NULL, 730, 1, 0, 0, 0, 0, 0),
(736, 732, 'RF731', NULL, 731, 1, 0, 0, 0, 0, 0),
(737, 733, 'RF732', NULL, 732, 1, 0, 0, 0, 0, 0),
(738, 734, 'RF733', NULL, 733, 1, 0, 0, 0, 0, 0),
(739, 735, 'RF734', NULL, 734, 1, 0, 0, 0, 0, 0),
(740, 736, 'RF735', NULL, 735, 1, 0, 0, 0, 0, 0),
(741, 737, 'RF736', NULL, 736, 1, 0, 0, 0, 0, 0),
(742, 738, 'RF737', NULL, 737, 1, 0, 0, 0, 0, 0),
(743, 739, 'RF738', NULL, 738, 1, 0, 0, 0, 0, 0),
(744, 740, 'RF739', NULL, 739, 1, 0, 0, 0, 0, 0),
(745, 741, 'RF740', NULL, 740, 1, 0, 0, 0, 0, 0),
(746, 742, 'RF741', NULL, 741, 1, 0, 0, 0, 0, 0),
(747, 743, 'RF742', NULL, 742, 1, 0, 0, 0, 0, 0),
(748, 744, 'RF743', NULL, 743, 1, 0, 0, 0, 0, 0),
(749, 745, 'RF744', NULL, 744, 1, 0, 0, 0, 0, 0),
(750, 746, 'RF745', NULL, 745, 1, 0, 0, 0, 0, 0),
(751, 747, 'RF746', NULL, 746, 1, 0, 0, 0, 0, 0),
(752, 748, 'RF747', NULL, 747, 1, 0, 0, 0, 0, 0),
(753, 749, 'RF748', NULL, 748, 1, 0, 0, 0, 0, 0),
(754, 750, 'RF749', NULL, 749, 1, 0, 0, 0, 0, 0),
(755, 751, 'RF750', NULL, 750, 1, 0, 0, 0, 0, 0),
(756, 752, 'RF751', NULL, 751, 1, 0, 0, 0, 0, 0),
(757, 753, 'RF752', NULL, 752, 1, 0, 0, 0, 0, 0),
(758, 754, 'RF753', NULL, 753, 1, 0, 0, 0, 0, 0),
(759, 755, 'RF754', NULL, 754, 1, 0, 0, 0, 0, 0),
(760, 756, 'RF755', NULL, 755, 1, 0, 0, 0, 0, 0),
(761, 757, 'RF756', NULL, 756, 1, 0, 0, 0, 0, 0),
(762, 758, 'RF757', NULL, 757, 1, 0, 0, 0, 0, 0),
(763, 759, 'RF758', NULL, 758, 1, 0, 0, 0, 0, 0),
(764, 760, 'RF759', NULL, 759, 1, 0, 0, 0, 0, 0),
(765, 761, 'RF760', NULL, 760, 1, 0, 0, 0, 0, 0),
(766, 762, 'RF761', NULL, 761, 1, 0, 0, 0, 0, 0),
(767, 763, 'RF762', NULL, 762, 1, 0, 0, 0, 0, 0),
(768, 764, 'RF763', NULL, 763, 1, 0, 0, 0, 0, 0),
(769, 765, 'RF764', NULL, 764, 1, 0, 0, 0, 0, 0),
(770, 766, 'RF765', NULL, 765, 1, 0, 0, 0, 0, 0),
(771, 767, 'RF766', NULL, 766, 1, 0, 0, 0, 0, 0),
(772, 768, 'RF767', NULL, 767, 1, 0, 0, 0, 0, 0),
(773, 769, 'RF768', NULL, 768, 1, 0, 0, 0, 0, 0),
(774, 770, 'RF769', NULL, 769, 1, 0, 0, 0, 0, 0),
(775, 771, 'RF770', NULL, 770, 1, 0, 0, 0, 0, 0),
(776, 772, 'RF771', NULL, 771, 1, 0, 0, 0, 0, 0),
(777, 773, 'RF772', NULL, 772, 1, 0, 0, 0, 0, 0),
(778, 774, 'RF773', NULL, 773, 1, 0, 0, 0, 0, 0),
(779, 775, 'RF774', NULL, 774, 1, 0, 0, 0, 0, 0),
(780, 776, 'RF775', NULL, 775, 1, 0, 0, 0, 0, 0),
(781, 777, 'RF776', NULL, 776, 1, 0, 0, 0, 0, 0),
(782, 778, 'RF777', NULL, 777, 1, 0, 0, 0, 0, 0),
(783, 779, 'RF778', NULL, 778, 1, 0, 0, 0, 0, 0),
(784, 780, 'RF779', NULL, 779, 1, 0, 0, 0, 0, 0),
(785, 781, 'RF780', NULL, 780, 1, 0, 0, 0, 0, 0),
(786, 782, 'RF781', NULL, 781, 1, 0, 0, 0, 0, 0),
(787, 783, 'RF782', NULL, 782, 1, 0, 0, 0, 0, 0),
(788, 784, 'RF783', NULL, 783, 1, 0, 0, 0, 0, 0),
(789, 785, 'RF784', NULL, 784, 1, 0, 0, 0, 0, 0),
(790, 786, 'RF785', NULL, 785, 1, 0, 0, 0, 0, 0),
(791, 787, 'RF786', NULL, 786, 1, 0, 0, 0, 0, 0),
(792, 788, 'RF787', NULL, 787, 1, 0, 0, 0, 0, 0),
(793, 789, 'RF788', NULL, 788, 1, 0, 0, 0, 0, 0),
(794, 790, 'RF789', NULL, 789, 1, 0, 0, 0, 0, 0),
(795, 791, 'RF790', NULL, 790, 1, 0, 0, 0, 0, 0),
(796, 792, 'RF791', NULL, 791, 1, 0, 0, 0, 0, 0),
(797, 793, 'RF792', NULL, 792, 1, 0, 0, 0, 0, 0),
(798, 794, 'RF793', NULL, 793, 1, 0, 0, 0, 0, 0),
(799, 795, 'RF794', NULL, 794, 1, 0, 0, 0, 0, 0),
(800, 796, 'RF795', NULL, 795, 1, 0, 0, 0, 0, 0),
(801, 797, 'RF796', NULL, 796, 1, 0, 0, 0, 0, 0),
(802, 798, 'RF797', NULL, 797, 1, 0, 0, 0, 0, 0),
(803, 799, 'RF798', NULL, 798, 1, 0, 0, 0, 0, 0),
(804, 800, 'RF799', NULL, 799, 1, 0, 0, 0, 0, 0),
(805, 801, 'RF800', NULL, 800, 1, 0, 0, 0, 0, 0),
(806, 802, 'RF801', NULL, 801, 1, 0, 0, 0, 0, 0),
(807, 803, 'RF802', NULL, 802, 1, 0, 0, 0, 0, 0),
(808, 804, 'RF803', NULL, 803, 1, 0, 0, 0, 0, 0),
(809, 805, 'RF804', NULL, 804, 1, 0, 0, 0, 0, 0),
(810, 806, 'RF805', NULL, 805, 1, 0, 0, 0, 0, 0),
(811, 807, 'RF806', NULL, 806, 1, 0, 0, 0, 0, 0),
(812, 808, 'RF807', NULL, 807, 1, 0, 0, 0, 0, 0),
(813, 809, 'RF808', NULL, 808, 1, 0, 0, 0, 0, 0),
(814, 810, 'RF809', NULL, 809, 1, 0, 0, 0, 0, 0),
(815, 811, 'RF810', NULL, 810, 1, 0, 0, 0, 0, 0),
(816, 812, 'RF811', NULL, 811, 1, 0, 0, 0, 0, 0),
(817, 813, 'RF812', NULL, 812, 1, 0, 0, 0, 0, 0),
(818, 814, 'RF813', NULL, 813, 1, 0, 0, 0, 0, 0),
(819, 815, 'RF814', NULL, 814, 1, 0, 0, 0, 0, 0),
(820, 816, 'RF815', NULL, 815, 1, 0, 0, 0, 0, 0),
(821, 817, 'RF816', NULL, 816, 1, 0, 0, 0, 0, 0),
(822, 818, 'RF817', NULL, 817, 1, 0, 0, 0, 0, 0),
(823, 819, 'RF818', NULL, 818, 1, 0, 0, 0, 0, 0),
(824, 820, 'RF819', NULL, 819, 1, 0, 0, 0, 0, 0),
(825, 821, 'RF820', NULL, 820, 1, 0, 0, 0, 0, 0),
(826, 822, 'RF821', NULL, 821, 1, 0, 0, 0, 0, 0),
(827, 823, 'RF822', NULL, 822, 1, 0, 0, 0, 0, 0),
(828, 824, 'RF823', NULL, 823, 1, 0, 0, 0, 0, 0),
(829, 825, 'RF824', NULL, 824, 1, 0, 0, 0, 0, 0),
(830, 826, 'RF825', NULL, 825, 1, 0, 0, 0, 0, 0),
(831, 827, 'RF826', NULL, 826, 1, 0, 0, 0, 0, 0),
(832, 828, 'RF827', NULL, 827, 1, 0, 0, 0, 0, 0),
(833, 829, 'RF828', NULL, 828, 1, 0, 0, 0, 0, 0),
(834, 830, 'RF829', NULL, 829, 1, 0, 0, 0, 0, 0),
(835, 831, 'RF830', NULL, 830, 1, 0, 0, 0, 0, 0),
(836, 832, 'RF831', NULL, 831, 1, 0, 0, 0, 0, 0),
(837, 833, 'RF832', NULL, 832, 1, 0, 0, 0, 0, 0),
(838, 834, 'RF833', NULL, 833, 1, 0, 0, 0, 0, 0),
(839, 835, 'RF834', NULL, 834, 1, 0, 0, 0, 0, 0),
(840, 836, 'RF835', NULL, 835, 1, 0, 0, 0, 0, 0),
(841, 837, 'RF836', NULL, 836, 1, 0, 0, 0, 0, 0),
(842, 838, 'RF837', NULL, 837, 1, 0, 0, 0, 0, 0),
(843, 839, 'RF838', NULL, 838, 1, 0, 0, 0, 0, 0),
(844, 840, 'RF839', NULL, 839, 1, 0, 0, 0, 0, 0),
(845, 841, 'RF840', NULL, 840, 1, 0, 0, 0, 0, 0),
(846, 842, 'RF841', NULL, 841, 1, 0, 0, 0, 0, 0),
(847, 843, 'RF842', NULL, 842, 1, 0, 0, 0, 0, 0),
(848, 844, 'RF843', NULL, 843, 1, 0, 0, 0, 0, 0),
(849, 845, 'RF844', NULL, 844, 1, 0, 0, 0, 0, 0),
(850, 846, 'RF845', NULL, 845, 1, 0, 0, 0, 0, 0),
(851, 847, 'RF846', NULL, 846, 1, 0, 0, 0, 0, 0),
(852, 848, 'RF847', NULL, 847, 1, 0, 0, 0, 0, 0),
(853, 849, 'RF848', NULL, 848, 1, 0, 0, 0, 0, 0),
(854, 850, 'RF849', NULL, 849, 1, 0, 0, 0, 0, 0),
(855, 851, 'RF850', NULL, 850, 1, 0, 0, 0, 0, 0),
(856, 852, 'RF851', NULL, 851, 1, 0, 0, 0, 0, 0),
(857, 853, 'RF852', NULL, 852, 1, 0, 0, 0, 0, 0),
(858, 854, 'RF853', NULL, 853, 1, 0, 0, 0, 0, 0),
(859, 855, 'RF854', NULL, 854, 1, 0, 0, 0, 0, 0),
(860, 856, 'RF855', NULL, 855, 1, 0, 0, 0, 0, 0),
(861, 857, 'RF856', NULL, 856, 1, 0, 0, 0, 0, 0),
(862, 858, 'RF857', NULL, 857, 1, 0, 0, 0, 0, 0),
(863, 859, 'RF858', NULL, 858, 1, 0, 0, 0, 0, 0),
(864, 860, 'RF859', NULL, 859, 1, 0, 0, 0, 0, 0),
(865, 861, 'RF860', NULL, 860, 1, 0, 0, 0, 0, 0),
(866, 862, 'RF861', NULL, 861, 1, 0, 0, 0, 0, 0),
(867, 863, 'RF862', NULL, 862, 1, 0, 0, 0, 0, 0),
(868, 864, 'RF863', NULL, 863, 1, 0, 0, 0, 0, 0),
(869, 865, 'RF864', NULL, 864, 1, 0, 0, 0, 0, 0),
(870, 866, 'RF865', NULL, 865, 1, 0, 0, 0, 0, 0),
(871, 867, 'RF866', NULL, 866, 1, 0, 0, 0, 0, 0),
(872, 868, 'RF867', NULL, 867, 1, 0, 0, 0, 0, 0),
(873, 869, 'RF868', NULL, 868, 1, 0, 0, 0, 0, 0),
(874, 870, 'RF869', NULL, 869, 1, 0, 0, 0, 0, 0),
(875, 871, 'RF870', NULL, 870, 1, 0, 0, 0, 0, 0),
(876, 872, 'RF871', NULL, 871, 1, 0, 0, 0, 0, 0),
(877, 873, 'RF872', NULL, 872, 1, 0, 0, 0, 0, 0),
(878, 874, 'RF873', NULL, 873, 1, 0, 0, 0, 0, 0),
(879, 875, 'RF874', NULL, 874, 1, 0, 0, 0, 0, 0),
(880, 876, 'RF875', NULL, 875, 1, 0, 0, 0, 0, 0),
(881, 877, 'RF876', NULL, 876, 1, 0, 0, 0, 0, 0),
(882, 878, 'RF877', NULL, 877, 1, 0, 0, 0, 0, 0),
(883, 879, 'RF878', NULL, 878, 1, 0, 0, 0, 0, 0),
(884, 880, 'RF879', NULL, 879, 1, 0, 0, 0, 0, 0),
(885, 881, 'RF880', NULL, 880, 1, 0, 0, 0, 0, 0),
(886, 882, 'RF881', NULL, 881, 1, 0, 0, 0, 0, 0),
(887, 883, 'RF882', NULL, 882, 1, 0, 0, 0, 0, 0),
(888, 884, 'RF883', NULL, 883, 1, 0, 0, 0, 0, 0),
(889, 885, 'RF884', NULL, 884, 1, 0, 0, 0, 0, 0),
(890, 886, 'RF885', NULL, 885, 1, 0, 0, 0, 0, 0),
(891, 887, 'RF886', NULL, 886, 1, 0, 0, 0, 0, 0),
(892, 888, 'RF887', NULL, 887, 1, 0, 0, 0, 0, 0),
(893, 889, 'RF888', NULL, 888, 1, 0, 0, 0, 0, 0),
(894, 890, 'RF889', NULL, 889, 1, 0, 0, 0, 0, 0),
(895, 891, 'RF890', NULL, 890, 1, 0, 0, 0, 0, 0),
(896, 892, 'RF891', NULL, 891, 1, 0, 0, 0, 0, 0),
(897, 893, 'RF892', NULL, 892, 1, 0, 0, 0, 0, 0),
(898, 894, 'RF893', NULL, 893, 1, 0, 0, 0, 0, 0),
(899, 895, 'RF894', NULL, 894, 1, 0, 0, 0, 0, 0),
(900, 896, 'RF895', NULL, 895, 1, 0, 0, 0, 0, 0),
(901, 897, 'RF896', NULL, 896, 1, 0, 0, 0, 0, 0),
(902, 898, 'RF897', NULL, 897, 1, 0, 0, 0, 0, 0),
(903, 899, 'RF898', NULL, 898, 1, 0, 0, 0, 0, 0),
(904, 900, 'RF899', NULL, 899, 1, 0, 0, 0, 0, 0),
(905, 901, 'RF900', NULL, 900, 1, 0, 0, 0, 0, 0),
(906, 902, 'RF901', NULL, 901, 1, 0, 0, 0, 0, 0),
(907, 903, 'RF902', NULL, 902, 1, 0, 0, 0, 0, 0),
(908, 904, 'RF903', NULL, 903, 1, 0, 0, 0, 0, 0),
(909, 905, 'RF904', NULL, 904, 1, 0, 0, 0, 0, 0),
(910, 906, 'RF905', NULL, 905, 1, 0, 0, 0, 0, 0),
(911, 907, 'RF906', NULL, 906, 1, 0, 0, 0, 0, 0),
(912, 908, 'RF907', NULL, 907, 1, 0, 0, 0, 0, 0),
(913, 909, 'RF908', NULL, 908, 1, 0, 0, 0, 0, 0),
(914, 910, 'RF909', NULL, 909, 1, 0, 0, 0, 0, 0),
(915, 911, 'RF910', NULL, 910, 1, 0, 0, 0, 0, 0),
(916, 912, 'RF911', NULL, 911, 1, 0, 0, 0, 0, 0),
(917, 913, 'RF912', NULL, 912, 1, 0, 0, 0, 0, 0),
(918, 914, 'RF913', NULL, 913, 1, 0, 0, 0, 0, 0),
(919, 915, 'RF914', NULL, 914, 1, 0, 0, 0, 0, 0),
(920, 916, 'RF915', NULL, 915, 1, 0, 0, 0, 0, 0),
(921, 917, 'RF916', NULL, 916, 1, 0, 0, 0, 0, 0),
(922, 918, 'RF917', NULL, 917, 1, 0, 0, 0, 0, 0),
(923, 919, 'RF918', NULL, 918, 1, 0, 0, 0, 0, 0),
(924, 920, 'RF919', NULL, 919, 1, 0, 0, 0, 0, 0),
(925, 921, 'RF920', NULL, 920, 1, 0, 0, 0, 0, 0),
(926, 922, 'RF921', NULL, 921, 1, 0, 0, 0, 0, 0),
(927, 923, 'RF922', NULL, 922, 1, 0, 0, 0, 0, 0),
(928, 924, 'RF923', NULL, 923, 1, 0, 0, 0, 0, 0),
(929, 925, 'RF924', NULL, 924, 1, 0, 0, 0, 0, 0),
(930, 926, 'RF925', NULL, 925, 1, 0, 0, 0, 0, 0),
(931, 927, 'RF926', NULL, 926, 1, 0, 0, 0, 0, 0),
(932, 928, 'RF927', NULL, 927, 1, 0, 0, 0, 0, 0),
(933, 929, 'RF928', NULL, 928, 1, 0, 0, 0, 0, 0),
(934, 930, 'RF929', NULL, 929, 1, 0, 0, 0, 0, 0),
(935, 931, 'RF930', NULL, 930, 1, 0, 0, 0, 0, 0),
(936, 932, 'RF931', NULL, 931, 1, 0, 0, 0, 0, 0),
(937, 933, 'RF932', NULL, 932, 1, 0, 0, 0, 0, 0),
(938, 934, 'RF933', NULL, 933, 1, 0, 0, 0, 0, 0),
(939, 935, 'RF934', NULL, 934, 1, 0, 0, 0, 0, 0),
(940, 936, 'RF935', NULL, 935, 1, 0, 0, 0, 0, 0),
(941, 937, 'RF936', NULL, 936, 1, 0, 0, 0, 0, 0),
(942, 938, 'RF937', NULL, 937, 1, 0, 0, 0, 0, 0),
(943, 939, 'RF938', NULL, 938, 1, 0, 0, 0, 0, 0),
(944, 940, 'RF939', NULL, 939, 1, 0, 0, 0, 0, 0),
(945, 941, 'RF940', NULL, 940, 1, 0, 0, 0, 0, 0),
(946, 942, 'RF941', NULL, 941, 1, 0, 0, 0, 0, 0),
(947, 943, 'RF942', NULL, 942, 1, 0, 0, 0, 0, 0),
(948, 944, 'RF943', NULL, 943, 1, 0, 0, 0, 0, 0),
(949, 945, 'RF944', NULL, 944, 1, 0, 0, 0, 0, 0),
(950, 946, 'RF945', NULL, 945, 1, 0, 0, 0, 0, 0),
(951, 947, 'RF946', NULL, 946, 1, 0, 0, 0, 0, 0),
(952, 948, 'RF947', NULL, 947, 1, 0, 0, 0, 0, 0),
(953, 949, 'RF948', NULL, 948, 1, 0, 0, 0, 0, 0),
(954, 950, 'RF949', NULL, 949, 1, 0, 0, 0, 0, 0),
(955, 951, 'RF950', NULL, 950, 1, 0, 0, 0, 0, 0),
(956, 952, 'RF951', NULL, 951, 1, 0, 0, 0, 0, 0),
(957, 953, 'RF952', NULL, 952, 1, 0, 0, 0, 0, 0),
(958, 954, 'RF953', NULL, 953, 1, 0, 0, 0, 0, 0),
(959, 955, 'RF954', NULL, 954, 1, 0, 0, 0, 0, 0),
(960, 956, 'RF955', NULL, 955, 1, 0, 0, 0, 0, 0),
(961, 957, 'RF956', NULL, 956, 1, 0, 0, 0, 0, 0),
(962, 958, 'RF957', NULL, 957, 1, 0, 0, 0, 0, 0),
(963, 959, 'RF958', NULL, 958, 1, 0, 0, 0, 0, 0),
(964, 960, 'RF959', NULL, 959, 1, 0, 0, 0, 0, 0),
(965, 961, 'RF960', NULL, 960, 1, 0, 0, 0, 0, 0),
(966, 962, 'RF961', NULL, 961, 1, 0, 0, 0, 0, 0),
(967, 963, 'RF962', NULL, 962, 1, 0, 0, 0, 0, 0),
(968, 964, 'RF963', NULL, 963, 1, 0, 0, 0, 0, 0),
(969, 965, 'RF964', NULL, 964, 1, 0, 0, 0, 0, 0),
(970, 966, 'RF965', NULL, 965, 1, 0, 0, 0, 0, 0),
(971, 967, 'RF966', NULL, 966, 1, 0, 0, 0, 0, 0),
(972, 968, 'RF967', NULL, 967, 1, 0, 0, 0, 0, 0),
(973, 969, 'RF968', NULL, 968, 1, 0, 0, 0, 0, 0),
(974, 970, 'RF969', NULL, 969, 1, 0, 0, 0, 0, 0),
(975, 971, 'RF970', NULL, 970, 1, 0, 0, 0, 0, 0),
(976, 972, 'RF971', NULL, 971, 1, 0, 0, 0, 0, 0),
(977, 973, 'RF972', NULL, 972, 1, 0, 0, 0, 0, 0),
(978, 974, 'RF973', NULL, 973, 1, 0, 0, 0, 0, 0),
(979, 975, 'RF974', NULL, 974, 1, 0, 0, 0, 0, 0),
(980, 976, 'RF975', NULL, 975, 1, 0, 0, 0, 0, 0),
(981, 977, 'RF976', NULL, 976, 1, 0, 0, 0, 0, 0),
(982, 978, 'RF977', NULL, 977, 1, 0, 0, 0, 0, 0),
(983, 979, 'RF978', NULL, 978, 1, 0, 0, 0, 0, 0),
(984, 980, 'RF979', NULL, 979, 1, 0, 0, 0, 0, 0),
(985, 981, 'RF980', NULL, 980, 1, 0, 0, 0, 0, 0),
(986, 982, 'RF981', NULL, 981, 1, 0, 0, 0, 0, 0),
(987, 983, 'RF982', NULL, 982, 1, 0, 0, 0, 0, 0),
(988, 984, 'RF983', NULL, 983, 1, 0, 0, 0, 0, 0),
(989, 985, 'RF984', NULL, 984, 1, 0, 0, 0, 0, 0),
(990, 986, 'RF985', NULL, 985, 1, 0, 0, 0, 0, 0),
(991, 987, 'RF986', NULL, 986, 1, 0, 0, 0, 0, 0),
(992, 988, 'RF987', NULL, 987, 1, 0, 0, 0, 0, 0),
(993, 989, 'RF988', NULL, 988, 1, 0, 0, 0, 0, 0),
(994, 990, 'RF989', NULL, 989, 1, 0, 0, 0, 0, 0),
(995, 991, 'RF990', NULL, 990, 1, 0, 0, 0, 0, 0),
(996, 992, 'RF991', NULL, 991, 1, 0, 0, 0, 0, 0),
(997, 993, 'RF992', NULL, 992, 1, 0, 0, 0, 0, 0),
(998, 994, 'RF993', NULL, 993, 1, 0, 0, 0, 0, 0),
(999, 995, 'RF994', NULL, 994, 1, 0, 0, 0, 0, 0),
(1000, 996, 'RF995', NULL, 995, 1, 0, 0, 0, 0, 0),
(1001, 997, 'RF996', NULL, 996, 1, 0, 0, 0, 0, 0),
(1002, 998, 'RF997', NULL, 997, 1, 0, 0, 0, 0, 0),
(1003, 999, 'RF998', NULL, 998, 1, 0, 0, 0, 0, 0),
(1004, 1000, 'RF999', NULL, 999, 1, 0, 0, 0, 0, 0),
(1005, 1001, 'RF1000', NULL, 1000, 1, 0, 0, 0, 0, 0),
(1006, 1002, 'RF1001', NULL, 1001, 1, 0, 0, 0, 0, 0),
(1007, 1003, 'RF1002', NULL, 1002, 1, 0, 0, 0, 0, 0),
(1008, 1004, 'RF1003', NULL, 1003, 1, 0, 0, 0, 0, 0),
(1009, 1005, 'RF1004', NULL, 1004, 1, 0, 0, 0, 0, 0),
(1010, 1006, 'RF1005', NULL, 1005, 1, 0, 0, 0, 0, 0),
(1011, 1007, 'RF1006', NULL, 1006, 1, 0, 0, 0, 0, 0),
(1012, 1008, 'RF1007', NULL, 1007, 1, 0, 0, 0, 0, 0),
(1013, 1009, 'RF1008', NULL, 1008, 1, 0, 0, 0, 0, 0),
(1014, 1010, 'RF1009', NULL, 1009, 1, 0, 0, 0, 0, 0),
(1015, 1011, 'RF1010', NULL, 1010, 1, 0, 0, 0, 0, 0),
(1016, 1012, 'RF1011', NULL, 1011, 1, 0, 0, 0, 0, 0),
(1017, 1013, 'RF1012', NULL, 1012, 1, 0, 0, 0, 0, 0),
(1018, 1014, 'RF1013', NULL, 1013, 1, 0, 0, 0, 0, 0),
(1019, 1015, 'RF1014', NULL, 1014, 1, 0, 0, 0, 0, 0),
(1020, 1016, 'RF1015', NULL, 1015, 1, 0, 0, 0, 0, 0),
(1021, 1017, 'RF1016', NULL, 1016, 1, 0, 0, 0, 0, 0),
(1022, 1018, 'RF1017', NULL, 1017, 1, 0, 0, 0, 0, 0),
(1023, 1019, 'RF1018', NULL, 1018, 1, 0, 0, 0, 0, 0),
(1024, 1020, 'RF1019', NULL, 1019, 1, 0, 0, 0, 0, 0),
(1025, 1021, 'RF1020', NULL, 1020, 1, 0, 0, 0, 0, 0),
(1026, 1022, 'RF1021', NULL, 1021, 1, 0, 0, 0, 0, 0),
(1027, 1023, 'RF1022', NULL, 1022, 1, 0, 0, 0, 0, 0),
(1028, 1024, 'RF1023', NULL, 1023, 1, 0, 0, 0, 0, 0),
(1029, 1025, 'RF1024', NULL, 1024, 1, 0, 0, 0, 0, 0),
(1030, 1026, 'RF1025', NULL, 1025, 1, 0, 0, 0, 0, 0),
(1031, 1027, 'RF1026', NULL, 1026, 1, 0, 0, 0, 0, 0),
(1032, 1028, 'RF1027', NULL, 1027, 1, 0, 0, 0, 0, 0),
(1033, 1029, 'RF1028', NULL, 1028, 1, 0, 0, 0, 0, 0),
(1034, 1030, 'RF1029', NULL, 1029, 1, 0, 0, 0, 0, 0),
(1035, 1031, 'RF1030', NULL, 1030, 1, 0, 0, 0, 0, 0),
(1036, 1032, 'RF1031', NULL, 1031, 1, 0, 0, 0, 0, 0),
(1037, 1033, 'RF1032', NULL, 1032, 1, 0, 0, 0, 0, 0),
(1038, 1034, 'RF1033', NULL, 1033, 1, 0, 0, 0, 0, 0),
(1039, 1035, 'RF1034', NULL, 1034, 1, 0, 0, 0, 0, 0),
(1040, 1036, 'RF1035', NULL, 1035, 1, 0, 0, 0, 0, 0),
(1041, 1037, 'RF1036', NULL, 1036, 1, 0, 0, 0, 0, 0),
(1042, 1038, 'RF1037', NULL, 1037, 1, 0, 0, 0, 0, 0),
(1043, 1039, 'RF1038', NULL, 1038, 1, 0, 0, 0, 0, 0);
INSERT INTO `cms_visitmaster` (`id`, `visit_code`, `visit_name`, `visit_interval`, `visit_order`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(1044, 1040, 'RF1039', NULL, 1039, 1, 0, 0, 0, 0, 0),
(1045, 1041, 'RF1040', NULL, 1040, 1, 0, 0, 0, 0, 0),
(1046, 1042, 'RF1041', NULL, 1041, 1, 0, 0, 0, 0, 0),
(1047, 1043, 'RF1042', NULL, 1042, 1, 0, 0, 0, 0, 0),
(1048, 1044, 'RF1043', NULL, 1043, 1, 0, 0, 0, 0, 0),
(1049, 1045, 'RF1044', NULL, 1044, 1, 0, 0, 0, 0, 0),
(1050, 1046, 'RF1045', NULL, 1045, 1, 0, 0, 0, 0, 0),
(1051, 1047, 'RF1046', NULL, 1046, 1, 0, 0, 0, 0, 0),
(1052, 1048, 'RF1047', NULL, 1047, 1, 0, 0, 0, 0, 0),
(1053, 1049, 'RF1048', NULL, 1048, 1, 0, 0, 0, 0, 0),
(1054, 1050, 'RF1049', NULL, 1049, 1, 0, 0, 0, 0, 0),
(1055, 1051, 'RF1050', NULL, 1050, 1, 0, 0, 0, 0, 0),
(1056, 1052, 'RF1051', NULL, 1051, 1, 0, 0, 0, 0, 0),
(1057, 1053, 'RF1052', NULL, 1052, 1, 0, 0, 0, 0, 0),
(1058, 1054, 'RF1053', NULL, 1053, 1, 0, 0, 0, 0, 0),
(1059, 1055, 'RF1054', NULL, 1054, 1, 0, 0, 0, 0, 0),
(1060, 1056, 'RF1055', NULL, 1055, 1, 0, 0, 0, 0, 0),
(1061, 1057, 'RF1056', NULL, 1056, 1, 0, 0, 0, 0, 0),
(1062, 1058, 'RF1057', NULL, 1057, 1, 0, 0, 0, 0, 0),
(1063, 1059, 'RF1058', NULL, 1058, 1, 0, 0, 0, 0, 0),
(1064, 1060, 'RF1059', NULL, 1059, 1, 0, 0, 0, 0, 0),
(1065, 1061, 'RF1060', NULL, 1060, 1, 0, 0, 0, 0, 0),
(1066, 1062, 'RF1061', NULL, 1061, 1, 0, 0, 0, 0, 0),
(1067, 1063, 'RF1062', NULL, 1062, 1, 0, 0, 0, 0, 0),
(1068, 1064, 'RF1063', NULL, 1063, 1, 0, 0, 0, 0, 0),
(1069, 1065, 'RF1064', NULL, 1064, 1, 0, 0, 0, 0, 0),
(1070, 1066, 'RF1065', NULL, 1065, 1, 0, 0, 0, 0, 0),
(1071, 1067, 'RF1066', NULL, 1066, 1, 0, 0, 0, 0, 0),
(1072, 1068, 'RF1067', NULL, 1067, 1, 0, 0, 0, 0, 0),
(1073, 1069, 'RF1068', NULL, 1068, 1, 0, 0, 0, 0, 0),
(1074, 1070, 'RF1069', NULL, 1069, 1, 0, 0, 0, 0, 0),
(1075, 1071, 'RF1070', NULL, 1070, 1, 0, 0, 0, 0, 0),
(1076, 1072, 'RF1071', NULL, 1071, 1, 0, 0, 0, 0, 0),
(1077, 1073, 'RF1072', NULL, 1072, 1, 0, 0, 0, 0, 0),
(1078, 1074, 'RF1073', NULL, 1073, 1, 0, 0, 0, 0, 0),
(1079, 1075, 'RF1074', NULL, 1074, 1, 0, 0, 0, 0, 0),
(1080, 1076, 'RF1075', NULL, 1075, 1, 0, 0, 0, 0, 0),
(1081, 1077, 'RF1076', NULL, 1076, 1, 0, 0, 0, 0, 0),
(1082, 1078, 'RF1077', NULL, 1077, 1, 0, 0, 0, 0, 0),
(1083, 1079, 'RF1078', NULL, 1078, 1, 0, 0, 0, 0, 0),
(1084, 1080, 'RF1079', NULL, 1079, 1, 0, 0, 0, 0, 0),
(1085, 1081, 'RF1080', NULL, 1080, 1, 0, 0, 0, 0, 0),
(1086, 1082, 'RF1081', NULL, 1081, 1, 0, 0, 0, 0, 0),
(1087, 1083, 'RF1082', NULL, 1082, 1, 0, 0, 0, 0, 0),
(1088, 1084, 'RF1083', NULL, 1083, 1, 0, 0, 0, 0, 0),
(1089, 1085, 'RF1084', NULL, 1084, 1, 0, 0, 0, 0, 0),
(1090, 1086, 'RF1085', NULL, 1085, 1, 0, 0, 0, 0, 0),
(1091, 1087, 'RF1086', NULL, 1086, 1, 0, 0, 0, 0, 0),
(1092, 1088, 'RF1087', NULL, 1087, 1, 0, 0, 0, 0, 0),
(1093, 1089, 'RF1088', NULL, 1088, 1, 0, 0, 0, 0, 0),
(1094, 1090, 'RF1089', NULL, 1089, 1, 0, 0, 0, 0, 0),
(1095, 1091, 'RF1090', NULL, 1090, 1, 0, 0, 0, 0, 0),
(1096, 1092, 'RF1091', NULL, 1091, 1, 0, 0, 0, 0, 0),
(1097, 1093, 'RF1092', NULL, 1092, 1, 0, 0, 0, 0, 0),
(1098, 1094, 'RF1093', NULL, 1093, 1, 0, 0, 0, 0, 0),
(1099, 1095, 'RF1094', NULL, 1094, 1, 0, 0, 0, 0, 0),
(1100, 1096, 'RF1095', NULL, 1095, 1, 0, 0, 0, 0, 0),
(1101, 1097, 'RF1096', NULL, 1096, 1, 0, 0, 0, 0, 0),
(1102, 1098, 'RF1097', NULL, 1097, 1, 0, 0, 0, 0, 0),
(1103, 1099, 'RF1098', NULL, 1098, 1, 0, 0, 0, 0, 0),
(1104, 1100, 'RF1099', NULL, 1099, 1, 0, 0, 0, 0, 0),
(1105, 1101, 'RF1100', NULL, 1100, 1, 0, 0, 0, 0, 0),
(1106, 1102, 'RF1101', NULL, 1101, 1, 0, 0, 0, 0, 0),
(1107, 1103, 'RF1102', NULL, 1102, 1, 0, 0, 0, 0, 0),
(1108, 1104, 'RF1103', NULL, 1103, 1, 0, 0, 0, 0, 0),
(1109, 1105, 'RF1104', NULL, 1104, 1, 0, 0, 0, 0, 0),
(1110, 1106, 'RF1105', NULL, 1105, 1, 0, 0, 0, 0, 0),
(1111, 1107, 'RF1106', NULL, 1106, 1, 0, 0, 0, 0, 0),
(1112, 1108, 'RF1107', NULL, 1107, 1, 0, 0, 0, 0, 0),
(1113, 1109, 'RF1108', NULL, 1108, 1, 0, 0, 0, 0, 0),
(1114, 1110, 'RF1109', NULL, 1109, 1, 0, 0, 0, 0, 0),
(1115, 1111, 'RF1110', NULL, 1110, 1, 0, 0, 0, 0, 0),
(1116, 1112, 'RF1111', NULL, 1111, 1, 0, 0, 0, 0, 0),
(1117, 1113, 'RF1112', NULL, 1112, 1, 0, 0, 0, 0, 0),
(1118, 1114, 'RF1113', NULL, 1113, 1, 0, 0, 0, 0, 0),
(1119, 1115, 'RF1114', NULL, 1114, 1, 0, 0, 0, 0, 0),
(1120, 1116, 'RF1115', NULL, 1115, 1, 0, 0, 0, 0, 0),
(1121, 1117, 'RF1116', NULL, 1116, 1, 0, 0, 0, 0, 0),
(1122, 1118, 'RF1117', NULL, 1117, 1, 0, 0, 0, 0, 0),
(1123, 1119, 'RF1118', NULL, 1118, 1, 0, 0, 0, 0, 0),
(1124, 1120, 'RF1119', NULL, 1119, 1, 0, 0, 0, 0, 0),
(1125, 1121, 'RF1120', NULL, 1120, 1, 0, 0, 0, 0, 0),
(1126, 1122, 'RF1121', NULL, 1121, 1, 0, 0, 0, 0, 0),
(1127, 1123, 'RF1122', NULL, 1122, 1, 0, 0, 0, 0, 0),
(1128, 1124, 'RF1123', NULL, 1123, 1, 0, 0, 0, 0, 0),
(1129, 1125, 'RF1124', NULL, 1124, 1, 0, 0, 0, 0, 0),
(1130, 1126, 'RF1125', NULL, 1125, 1, 0, 0, 0, 0, 0),
(1131, 1127, 'RF1126', NULL, 1126, 1, 0, 0, 0, 0, 0),
(1132, 1128, 'RF1127', NULL, 1127, 1, 0, 0, 0, 0, 0),
(1133, 1129, 'RF1128', NULL, 1128, 1, 0, 0, 0, 0, 0),
(1134, 1130, 'RF1129', NULL, 1129, 1, 0, 0, 0, 0, 0),
(1135, 1131, 'RF1130', NULL, 1130, 1, 0, 0, 0, 0, 0),
(1136, 1132, 'RF1131', NULL, 1131, 1, 0, 0, 0, 0, 0),
(1137, 1133, 'RF1132', NULL, 1132, 1, 0, 0, 0, 0, 0),
(1138, 1134, 'RF1133', NULL, 1133, 1, 0, 0, 0, 0, 0),
(1139, 1135, 'RF1134', NULL, 1134, 1, 0, 0, 0, 0, 0),
(1140, 1136, 'RF1135', NULL, 1135, 1, 0, 0, 0, 0, 0),
(1141, 1137, 'RF1136', NULL, 1136, 1, 0, 0, 0, 0, 0),
(1142, 1138, 'RF1137', NULL, 1137, 1, 0, 0, 0, 0, 0),
(1143, 1139, 'RF1138', NULL, 1138, 1, 0, 0, 0, 0, 0),
(1144, 1140, 'RF1139', NULL, 1139, 1, 0, 0, 0, 0, 0),
(1145, 1141, 'RF1140', NULL, 1140, 1, 0, 0, 0, 0, 0),
(1146, 1142, 'RF1141', NULL, 1141, 1, 0, 0, 0, 0, 0),
(1147, 1143, 'RF1142', NULL, 1142, 1, 0, 0, 0, 0, 0),
(1148, 1144, 'RF1143', NULL, 1143, 1, 0, 0, 0, 0, 0),
(1149, 1145, 'RF1144', NULL, 1144, 1, 0, 0, 0, 0, 0),
(1150, 1146, 'RF1145', NULL, 1145, 1, 0, 0, 0, 0, 0),
(1151, 1147, 'RF1146', NULL, 1146, 1, 0, 0, 0, 0, 0),
(1152, 1148, 'RF1147', NULL, 1147, 1, 0, 0, 0, 0, 0),
(1153, 1149, 'RF1148', NULL, 1148, 1, 0, 0, 0, 0, 0),
(1154, 1150, 'RF1149', NULL, 1149, 1, 0, 0, 0, 0, 0),
(1155, 1151, 'RF1150', NULL, 1150, 1, 0, 0, 0, 0, 0),
(1156, 1152, 'RF1151', NULL, 1151, 1, 0, 0, 0, 0, 0),
(1157, 1153, 'RF1152', NULL, 1152, 1, 0, 0, 0, 0, 0),
(1158, 1154, 'RF1153', NULL, 1153, 1, 0, 0, 0, 0, 0),
(1159, 1155, 'RF1154', NULL, 1154, 1, 0, 0, 0, 0, 0),
(1160, 1156, 'RF1155', NULL, 1155, 1, 0, 0, 0, 0, 0),
(1161, 1157, 'RF1156', NULL, 1156, 1, 0, 0, 0, 0, 0),
(1162, 1158, 'RF1157', NULL, 1157, 1, 0, 0, 0, 0, 0),
(1163, 1159, 'RF1158', NULL, 1158, 1, 0, 0, 0, 0, 0),
(1164, 1160, 'RF1159', NULL, 1159, 1, 0, 0, 0, 0, 0),
(1165, 1161, 'RF1160', NULL, 1160, 1, 0, 0, 0, 0, 0),
(1166, 1162, 'RF1161', NULL, 1161, 1, 0, 0, 0, 0, 0),
(1167, 1163, 'RF1162', NULL, 1162, 1, 0, 0, 0, 0, 0),
(1168, 1164, 'RF1163', NULL, 1163, 1, 0, 0, 0, 0, 0),
(1169, 1165, 'RF1164', NULL, 1164, 1, 0, 0, 0, 0, 0),
(1170, 1166, 'RF1165', NULL, 1165, 1, 0, 0, 0, 0, 0),
(1171, 1167, 'RF1166', NULL, 1166, 1, 0, 0, 0, 0, 0),
(1172, 1168, 'RF1167', NULL, 1167, 1, 0, 0, 0, 0, 0),
(1173, 1169, 'RF1168', NULL, 1168, 1, 0, 0, 0, 0, 0),
(1174, 1170, 'RF1169', NULL, 1169, 1, 0, 0, 0, 0, 0),
(1175, 1171, 'RF1170', NULL, 1170, 1, 0, 0, 0, 0, 0),
(1176, 1172, 'RF1171', NULL, 1171, 1, 0, 0, 0, 0, 0),
(1177, 1173, 'RF1172', NULL, 1172, 1, 0, 0, 0, 0, 0),
(1178, 1174, 'RF1173', NULL, 1173, 1, 0, 0, 0, 0, 0),
(1179, 1175, 'RF1174', NULL, 1174, 1, 0, 0, 0, 0, 0),
(1180, 1176, 'RF1175', NULL, 1175, 1, 0, 0, 0, 0, 0),
(1181, 1177, 'RF1176', NULL, 1176, 1, 0, 0, 0, 0, 0),
(1182, 1178, 'RF1177', NULL, 1177, 1, 0, 0, 0, 0, 0),
(1183, 1179, 'RF1178', NULL, 1178, 1, 0, 0, 0, 0, 0),
(1184, 1180, 'RF1179', NULL, 1179, 1, 0, 0, 0, 0, 0),
(1185, 1181, 'RF1180', NULL, 1180, 1, 0, 0, 0, 0, 0),
(1186, 1182, 'RF1181', NULL, 1181, 1, 0, 0, 0, 0, 0),
(1187, 1183, 'RF1182', NULL, 1182, 1, 0, 0, 0, 0, 0),
(1188, 1184, 'RF1183', NULL, 1183, 1, 0, 0, 0, 0, 0),
(1189, 1185, 'RF1184', NULL, 1184, 1, 0, 0, 0, 0, 0),
(1190, 1186, 'RF1185', NULL, 1185, 1, 0, 0, 0, 0, 0),
(1191, 1187, 'RF1186', NULL, 1186, 1, 0, 0, 0, 0, 0),
(1192, 1188, 'RF1187', NULL, 1187, 1, 0, 0, 0, 0, 0),
(1193, 1189, 'RF1188', NULL, 1188, 1, 0, 0, 0, 0, 0),
(1194, 1190, 'RF1189', NULL, 1189, 1, 0, 0, 0, 0, 0),
(1195, 1191, 'RF1190', NULL, 1190, 1, 0, 0, 0, 0, 0),
(1196, 1192, 'RF1191', NULL, 1191, 1, 0, 0, 0, 0, 0),
(1197, 1193, 'RF1192', NULL, 1192, 1, 0, 0, 0, 0, 0),
(1198, 1194, 'RF1193', NULL, 1193, 1, 0, 0, 0, 0, 0),
(1199, 1195, 'RF1194', NULL, 1194, 1, 0, 0, 0, 0, 0),
(1200, 1196, 'RF1195', NULL, 1195, 1, 0, 0, 0, 0, 0),
(1201, 1197, 'RF1196', NULL, 1196, 1, 0, 0, 0, 0, 0),
(1202, 1198, 'RF1197', NULL, 1197, 1, 0, 0, 0, 0, 0),
(1203, 1199, 'RF1198', NULL, 1198, 1, 0, 0, 0, 0, 0),
(1204, 1200, 'RF1199', NULL, 1199, 1, 0, 0, 0, 0, 0),
(1205, 1201, 'RF1200', NULL, 1200, 1, 0, 0, 0, 0, 0),
(1206, 1202, 'RF1201', NULL, 1201, 1, 0, 0, 0, 0, 0),
(1207, 1203, 'RF1202', NULL, 1202, 1, 0, 0, 0, 0, 0),
(1208, 1204, 'RF1203', NULL, 1203, 1, 0, 0, 0, 0, 0),
(1209, 1205, 'RF1204', NULL, 1204, 1, 0, 0, 0, 0, 0),
(1210, 1206, 'RF1205', NULL, 1205, 1, 0, 0, 0, 0, 0),
(1211, 1207, 'RF1206', NULL, 1206, 1, 0, 0, 0, 0, 0),
(1212, 1208, 'RF1207', NULL, 1207, 1, 0, 0, 0, 0, 0),
(1213, 1209, 'RF1208', NULL, 1208, 1, 0, 0, 0, 0, 0),
(1214, 1210, 'RF1209', NULL, 1209, 1, 0, 0, 0, 0, 0),
(1215, 1211, 'RF1210', NULL, 1210, 1, 0, 0, 0, 0, 0),
(1216, 1212, 'RF1211', NULL, 1211, 1, 0, 0, 0, 0, 0),
(1217, 1213, 'RF1212', NULL, 1212, 1, 0, 0, 0, 0, 0),
(1218, 1214, 'RF1213', NULL, 1213, 1, 0, 0, 0, 0, 0),
(1219, 1215, 'RF1214', NULL, 1214, 1, 0, 0, 0, 0, 0),
(1220, 1216, 'RF1215', NULL, 1215, 1, 0, 0, 0, 0, 0),
(1221, 1217, 'RF1216', NULL, 1216, 1, 0, 0, 0, 0, 0),
(1222, 1218, 'RF1217', NULL, 1217, 1, 0, 0, 0, 0, 0),
(1223, 1219, 'RF1218', NULL, 1218, 1, 0, 0, 0, 0, 0),
(1224, 1220, 'RF1219', NULL, 1219, 1, 0, 0, 0, 0, 0),
(1225, 1221, 'RF1220', NULL, 1220, 1, 0, 0, 0, 0, 0),
(1226, 1222, 'RF1221', NULL, 1221, 1, 0, 0, 0, 0, 0),
(1227, 1223, 'RF1222', NULL, 1222, 1, 0, 0, 0, 0, 0),
(1228, 1224, 'RF1223', NULL, 1223, 1, 0, 0, 0, 0, 0),
(1229, 1225, 'RF1224', NULL, 1224, 1, 0, 0, 0, 0, 0),
(1230, 1226, 'RF1225', NULL, 1225, 1, 0, 0, 0, 0, 0),
(1231, 1227, 'RF1226', NULL, 1226, 1, 0, 0, 0, 0, 0),
(1232, 1228, 'RF1227', NULL, 1227, 1, 0, 0, 0, 0, 0),
(1233, 1229, 'RF1228', NULL, 1228, 1, 0, 0, 0, 0, 0),
(1234, 1230, 'RF1229', NULL, 1229, 1, 0, 0, 0, 0, 0),
(1235, 1231, 'RF1230', NULL, 1230, 1, 0, 0, 0, 0, 0),
(1236, 1232, 'RF1231', NULL, 1231, 1, 0, 0, 0, 0, 0),
(1237, 1233, 'RF1232', NULL, 1232, 1, 0, 0, 0, 0, 0),
(1238, 1234, 'RF1233', NULL, 1233, 1, 0, 0, 0, 0, 0),
(1239, 1235, 'RF1234', NULL, 1234, 1, 0, 0, 0, 0, 0),
(1240, 1236, 'RF1235', NULL, 1235, 1, 0, 0, 0, 0, 0),
(1241, 1237, 'RF1236', NULL, 1236, 1, 0, 0, 0, 0, 0),
(1242, 1238, 'RF1237', NULL, 1237, 1, 0, 0, 0, 0, 0),
(1243, 1239, 'RF1238', NULL, 1238, 1, 0, 0, 0, 0, 0),
(1244, 1240, 'RF1239', NULL, 1239, 1, 0, 0, 0, 0, 0),
(1245, 1241, 'RF1240', NULL, 1240, 1, 0, 0, 0, 0, 0),
(1246, 1242, 'RF1241', NULL, 1241, 1, 0, 0, 0, 0, 0),
(1247, 1243, 'RF1242', NULL, 1242, 1, 0, 0, 0, 0, 0),
(1248, 1244, 'RF1243', NULL, 1243, 1, 0, 0, 0, 0, 0),
(1249, 1245, 'RF1244', NULL, 1244, 1, 0, 0, 0, 0, 0),
(1250, 1246, 'RF1245', NULL, 1245, 1, 0, 0, 0, 0, 0),
(1251, 1247, 'RF1246', NULL, 1246, 1, 0, 0, 0, 0, 0),
(1252, 1248, 'RF1247', NULL, 1247, 1, 0, 0, 0, 0, 0),
(1253, 1249, 'RF1248', NULL, 1248, 1, 0, 0, 0, 0, 0),
(1254, 1250, 'RF1249', NULL, 1249, 1, 0, 0, 0, 0, 0),
(1255, 1251, 'RF1250', NULL, 1250, 1, 0, 0, 0, 0, 0),
(1256, 1252, 'RF1251', NULL, 1251, 1, 0, 0, 0, 0, 0),
(1257, 1253, 'RF1252', NULL, 1252, 1, 0, 0, 0, 0, 0),
(1258, 1254, 'RF1253', NULL, 1253, 1, 0, 0, 0, 0, 0),
(1259, 1255, 'RF1254', NULL, 1254, 1, 0, 0, 0, 0, 0),
(1260, 1256, 'RF1255', NULL, 1255, 1, 0, 0, 0, 0, 0),
(1261, 1257, 'RF1256', NULL, 1256, 1, 0, 0, 0, 0, 0),
(1262, 1258, 'RF1257', NULL, 1257, 1, 0, 0, 0, 0, 0),
(1263, 1259, 'RF1258', NULL, 1258, 1, 0, 0, 0, 0, 0),
(1264, 1260, 'RF1259', NULL, 1259, 1, 0, 0, 0, 0, 0),
(1265, 1261, 'RF1260', NULL, 1260, 1, 0, 0, 0, 0, 0),
(1266, 1262, 'RF1261', NULL, 1261, 1, 0, 0, 0, 0, 0),
(1267, 1263, 'RF1262', NULL, 1262, 1, 0, 0, 0, 0, 0),
(1268, 1264, 'RF1263', NULL, 1263, 1, 0, 0, 0, 0, 0),
(1269, 1265, 'RF1264', NULL, 1264, 1, 0, 0, 0, 0, 0),
(1270, 1266, 'RF1265', NULL, 1265, 1, 0, 0, 0, 0, 0),
(1271, 1267, 'RF1266', NULL, 1266, 1, 0, 0, 0, 0, 0),
(1272, 1268, 'RF1267', NULL, 1267, 1, 0, 0, 0, 0, 0),
(1273, 1269, 'RF1268', NULL, 1268, 1, 0, 0, 0, 0, 0),
(1274, 1270, 'RF1269', NULL, 1269, 1, 0, 0, 0, 0, 0),
(1275, 1271, 'RF1270', NULL, 1270, 1, 0, 0, 0, 0, 0),
(1276, 1272, 'RF1271', NULL, 1271, 1, 0, 0, 0, 0, 0),
(1277, 1273, 'RF1272', NULL, 1272, 1, 0, 0, 0, 0, 0),
(1278, 1274, 'RF1273', NULL, 1273, 1, 0, 0, 0, 0, 0),
(1279, 1275, 'RF1274', NULL, 1274, 1, 0, 0, 0, 0, 0),
(1280, 1276, 'RF1275', NULL, 1275, 1, 0, 0, 0, 0, 0),
(1281, 1277, 'RF1276', NULL, 1276, 1, 0, 0, 0, 0, 0),
(1282, 1278, 'RF1277', NULL, 1277, 1, 0, 0, 0, 0, 0),
(1283, 1279, 'RF1278', NULL, 1278, 1, 0, 0, 0, 0, 0),
(1284, 1280, 'RF1279', NULL, 1279, 1, 0, 0, 0, 0, 0),
(1285, 1281, 'RF1280', NULL, 1280, 1, 0, 0, 0, 0, 0),
(1286, 1282, 'RF1281', NULL, 1281, 1, 0, 0, 0, 0, 0),
(1287, 1283, 'RF1282', NULL, 1282, 1, 0, 0, 0, 0, 0),
(1288, 1284, 'RF1283', NULL, 1283, 1, 0, 0, 0, 0, 0),
(1289, 1285, 'RF1284', NULL, 1284, 1, 0, 0, 0, 0, 0),
(1290, 1286, 'RF1285', NULL, 1285, 1, 0, 0, 0, 0, 0),
(1291, 1287, 'RF1286', NULL, 1286, 1, 0, 0, 0, 0, 0),
(1292, 1288, 'RF1287', NULL, 1287, 1, 0, 0, 0, 0, 0),
(1293, 1289, 'RF1288', NULL, 1288, 1, 0, 0, 0, 0, 0),
(1294, 1290, 'RF1289', NULL, 1289, 1, 0, 0, 0, 0, 0),
(1295, 1291, 'RF1290', NULL, 1290, 1, 0, 0, 0, 0, 0),
(1296, 1292, 'RF1291', NULL, 1291, 1, 0, 0, 0, 0, 0),
(1297, 1293, 'RF1292', NULL, 1292, 1, 0, 0, 0, 0, 0),
(1298, 1294, 'RF1293', NULL, 1293, 1, 0, 0, 0, 0, 0),
(1299, 1295, 'RF1294', NULL, 1294, 1, 0, 0, 0, 0, 0),
(1300, 1296, 'RF1295', NULL, 1295, 1, 0, 0, 0, 0, 0),
(1301, 1297, 'RF1296', NULL, 1296, 1, 0, 0, 0, 0, 0),
(1302, 1298, 'RF1297', NULL, 1297, 1, 0, 0, 0, 0, 0),
(1303, 1299, 'RF1298', NULL, 1298, 1, 0, 0, 0, 0, 0),
(1304, 1300, 'RF1299', NULL, 1299, 1, 0, 0, 0, 0, 0),
(1305, 1301, 'RF1300', NULL, 1300, 1, 0, 0, 0, 0, 0),
(1306, 1302, 'RF1301', NULL, 1301, 1, 0, 0, 0, 0, 0),
(1307, 1303, 'RF1302', NULL, 1302, 1, 0, 0, 0, 0, 0),
(1308, 1304, 'RF1303', NULL, 1303, 1, 0, 0, 0, 0, 0),
(1309, 1305, 'RF1304', NULL, 1304, 1, 0, 0, 0, 0, 0),
(1310, 1306, 'RF1305', NULL, 1305, 1, 0, 0, 0, 0, 0),
(1311, 1307, 'RF1306', NULL, 1306, 1, 0, 0, 0, 0, 0),
(1312, 1308, 'RF1307', NULL, 1307, 1, 0, 0, 0, 0, 0),
(1313, 1309, 'RF1308', NULL, 1308, 1, 0, 0, 0, 0, 0),
(1314, 1310, 'RF1309', NULL, 1309, 1, 0, 0, 0, 0, 0),
(1315, 1311, 'RF1310', NULL, 1310, 1, 0, 0, 0, 0, 0),
(1316, 1312, 'RF1311', NULL, 1311, 1, 0, 0, 0, 0, 0),
(1317, 1313, 'RF1312', NULL, 1312, 1, 0, 0, 0, 0, 0),
(1318, 1314, 'RF1313', NULL, 1313, 1, 0, 0, 0, 0, 0),
(1319, 1315, 'RF1314', NULL, 1314, 1, 0, 0, 0, 0, 0),
(1320, 1316, 'RF1315', NULL, 1315, 1, 0, 0, 0, 0, 0),
(1321, 1317, 'RF1316', NULL, 1316, 1, 0, 0, 0, 0, 0),
(1322, 1318, 'RF1317', NULL, 1317, 1, 0, 0, 0, 0, 0),
(1323, 1319, 'RF1318', NULL, 1318, 1, 0, 0, 0, 0, 0),
(1324, 1320, 'RF1319', NULL, 1319, 1, 0, 0, 0, 0, 0),
(1325, 1321, 'RF1320', NULL, 1320, 1, 0, 0, 0, 0, 0),
(1326, 1322, 'RF1321', NULL, 1321, 1, 0, 0, 0, 0, 0),
(1327, 1323, 'RF1322', NULL, 1322, 1, 0, 0, 0, 0, 0),
(1328, 1324, 'RF1323', NULL, 1323, 1, 0, 0, 0, 0, 0),
(1329, 1325, 'RF1324', NULL, 1324, 1, 0, 0, 0, 0, 0),
(1330, 1326, 'RF1325', NULL, 1325, 1, 0, 0, 0, 0, 0),
(1331, 1327, 'RF1326', NULL, 1326, 1, 0, 0, 0, 0, 0),
(1332, 1328, 'RF1327', NULL, 1327, 1, 0, 0, 0, 0, 0),
(1333, 1329, 'RF1328', NULL, 1328, 1, 0, 0, 0, 0, 0),
(1334, 1330, 'RF1329', NULL, 1329, 1, 0, 0, 0, 0, 0),
(1335, 1331, 'RF1330', NULL, 1330, 1, 0, 0, 0, 0, 0),
(1336, 1332, 'RF1331', NULL, 1331, 1, 0, 0, 0, 0, 0),
(1337, 1333, 'RF1332', NULL, 1332, 1, 0, 0, 0, 0, 0),
(1338, 1334, 'RF1333', NULL, 1333, 1, 0, 0, 0, 0, 0),
(1339, 1335, 'RF1334', NULL, 1334, 1, 0, 0, 0, 0, 0),
(1340, 1336, 'RF1335', NULL, 1335, 1, 0, 0, 0, 0, 0),
(1341, 1337, 'RF1336', NULL, 1336, 1, 0, 0, 0, 0, 0),
(1342, 1338, 'RF1337', NULL, 1337, 1, 0, 0, 0, 0, 0),
(1343, 1339, 'RF1338', NULL, 1338, 1, 0, 0, 0, 0, 0),
(1344, 1340, 'RF1339', NULL, 1339, 1, 0, 0, 0, 0, 0),
(1345, 1341, 'RF1340', NULL, 1340, 1, 0, 0, 0, 0, 0),
(1346, 1342, 'RF1341', NULL, 1341, 1, 0, 0, 0, 0, 0),
(1347, 1343, 'RF1342', NULL, 1342, 1, 0, 0, 0, 0, 0),
(1348, 1344, 'RF1343', NULL, 1343, 1, 0, 0, 0, 0, 0),
(1349, 1345, 'RF1344', NULL, 1344, 1, 0, 0, 0, 0, 0),
(1350, 1346, 'RF1345', NULL, 1345, 1, 0, 0, 0, 0, 0),
(1351, 1347, 'RF1346', NULL, 1346, 1, 0, 0, 0, 0, 0),
(1352, 1348, 'RF1347', NULL, 1347, 1, 0, 0, 0, 0, 0),
(1353, 1349, 'RF1348', NULL, 1348, 1, 0, 0, 0, 0, 0),
(1354, 1350, 'RF1349', NULL, 1349, 1, 0, 0, 0, 0, 0),
(1355, 1351, 'RF1350', NULL, 1350, 1, 0, 0, 0, 0, 0),
(1356, 1352, 'RF1351', NULL, 1351, 1, 0, 0, 0, 0, 0),
(1357, 1353, 'RF1352', NULL, 1352, 1, 0, 0, 0, 0, 0),
(1358, 1354, 'RF1353', NULL, 1353, 1, 0, 0, 0, 0, 0),
(1359, 1355, 'RF1354', NULL, 1354, 1, 0, 0, 0, 0, 0),
(1360, 1356, 'RF1355', NULL, 1355, 1, 0, 0, 0, 0, 0),
(1361, 1357, 'RF1356', NULL, 1356, 1, 0, 0, 0, 0, 0),
(1362, 1358, 'RF1357', NULL, 1357, 1, 0, 0, 0, 0, 0),
(1363, 1359, 'RF1358', NULL, 1358, 1, 0, 0, 0, 0, 0),
(1364, 1360, 'RF1359', NULL, 1359, 1, 0, 0, 0, 0, 0),
(1365, 1361, 'RF1360', NULL, 1360, 1, 0, 0, 0, 0, 0),
(1366, 1362, 'RF1361', NULL, 1361, 1, 0, 0, 0, 0, 0),
(1367, 1363, 'RF1362', NULL, 1362, 1, 0, 0, 0, 0, 0),
(1368, 1364, 'RF1363', NULL, 1363, 1, 0, 0, 0, 0, 0),
(1369, 1365, 'RF1364', NULL, 1364, 1, 0, 0, 0, 0, 0),
(1370, 1366, 'RF1365', NULL, 1365, 1, 0, 0, 0, 0, 0),
(1371, 1367, 'RF1366', NULL, 1366, 1, 0, 0, 0, 0, 0),
(1372, 1368, 'RF1367', NULL, 1367, 1, 0, 0, 0, 0, 0),
(1373, 1369, 'RF1368', NULL, 1368, 1, 0, 0, 0, 0, 0),
(1374, 1370, 'RF1369', NULL, 1369, 1, 0, 0, 0, 0, 0),
(1375, 1371, 'RF1370', NULL, 1370, 1, 0, 0, 0, 0, 0),
(1376, 1372, 'RF1371', NULL, 1371, 1, 0, 0, 0, 0, 0),
(1377, 1373, 'RF1372', NULL, 1372, 1, 0, 0, 0, 0, 0),
(1378, 1374, 'RF1373', NULL, 1373, 1, 0, 0, 0, 0, 0),
(1379, 1375, 'RF1374', NULL, 1374, 1, 0, 0, 0, 0, 0),
(1380, 1376, 'RF1375', NULL, 1375, 1, 0, 0, 0, 0, 0),
(1381, 1377, 'RF1376', NULL, 1376, 1, 0, 0, 0, 0, 0),
(1382, 1378, 'RF1377', NULL, 1377, 1, 0, 0, 0, 0, 0),
(1383, 1379, 'RF1378', NULL, 1378, 1, 0, 0, 0, 0, 0),
(1384, 1380, 'RF1379', NULL, 1379, 1, 0, 0, 0, 0, 0),
(1385, 1381, 'RF1380', NULL, 1380, 1, 0, 0, 0, 0, 0),
(1386, 1382, 'RF1381', NULL, 1381, 1, 0, 0, 0, 0, 0),
(1387, 1383, 'RF1382', NULL, 1382, 1, 0, 0, 0, 0, 0),
(1388, 1384, 'RF1383', NULL, 1383, 1, 0, 0, 0, 0, 0),
(1389, 1385, 'RF1384', NULL, 1384, 1, 0, 0, 0, 0, 0),
(1390, 1386, 'RF1385', NULL, 1385, 1, 0, 0, 0, 0, 0),
(1391, 1387, 'RF1386', NULL, 1386, 1, 0, 0, 0, 0, 0),
(1392, 1388, 'RF1387', NULL, 1387, 1, 0, 0, 0, 0, 0),
(1393, 1389, 'RF1388', NULL, 1388, 1, 0, 0, 0, 0, 0),
(1394, 1390, 'RF1389', NULL, 1389, 1, 0, 0, 0, 0, 0),
(1395, 1391, 'RF1390', NULL, 1390, 1, 0, 0, 0, 0, 0),
(1396, 1392, 'RF1391', NULL, 1391, 1, 0, 0, 0, 0, 0),
(1397, 1393, 'RF1392', NULL, 1392, 1, 0, 0, 0, 0, 0),
(1398, 1394, 'RF1393', NULL, 1393, 1, 0, 0, 0, 0, 0),
(1399, 1395, 'RF1394', NULL, 1394, 1, 0, 0, 0, 0, 0),
(1400, 1396, 'RF1395', NULL, 1395, 1, 0, 0, 0, 0, 0),
(1401, 1397, 'RF1396', NULL, 1396, 1, 0, 0, 0, 0, 0),
(1402, 1398, 'RF1397', NULL, 1397, 1, 0, 0, 0, 0, 0),
(1403, 1399, 'RF1398', NULL, 1398, 1, 0, 0, 0, 0, 0),
(1404, 1400, 'RF1399', NULL, 1399, 1, 0, 0, 0, 0, 0),
(1405, 1401, 'RF1400', NULL, 1400, 1, 0, 0, 0, 0, 0),
(1406, 1402, 'RF1401', NULL, 1401, 1, 0, 0, 0, 0, 0),
(1407, 1403, 'RF1402', NULL, 1402, 1, 0, 0, 0, 0, 0),
(1408, 1404, 'RF1403', NULL, 1403, 1, 0, 0, 0, 0, 0),
(1409, 1405, 'RF1404', NULL, 1404, 1, 0, 0, 0, 0, 0),
(1410, 1406, 'RF1405', NULL, 1405, 1, 0, 0, 0, 0, 0),
(1411, 1407, 'RF1406', NULL, 1406, 1, 0, 0, 0, 0, 0),
(1412, 1408, 'RF1407', NULL, 1407, 1, 0, 0, 0, 0, 0),
(1413, 1409, 'RF1408', NULL, 1408, 1, 0, 0, 0, 0, 0),
(1414, 1410, 'RF1409', NULL, 1409, 1, 0, 0, 0, 0, 0),
(1415, 1411, 'RF1410', NULL, 1410, 1, 0, 0, 0, 0, 0),
(1416, 1412, 'RF1411', NULL, 1411, 1, 0, 0, 0, 0, 0),
(1417, 1413, 'RF1412', NULL, 1412, 1, 0, 0, 0, 0, 0),
(1418, 1414, 'RF1413', NULL, 1413, 1, 0, 0, 0, 0, 0),
(1419, 1415, 'RF1414', NULL, 1414, 1, 0, 0, 0, 0, 0),
(1420, 1416, 'RF1415', NULL, 1415, 1, 0, 0, 0, 0, 0),
(1421, 1417, 'RF1416', NULL, 1416, 1, 0, 0, 0, 0, 0),
(1422, 1418, 'RF1417', NULL, 1417, 1, 0, 0, 0, 0, 0),
(1423, 1419, 'RF1418', NULL, 1418, 1, 0, 0, 0, 0, 0),
(1424, 1420, 'RF1419', NULL, 1419, 1, 0, 0, 0, 0, 0),
(1425, 1421, 'RF1420', NULL, 1420, 1, 0, 0, 0, 0, 0),
(1426, 1422, 'RF1421', NULL, 1421, 1, 0, 0, 0, 0, 0),
(1427, 1423, 'RF1422', NULL, 1422, 1, 0, 0, 0, 0, 0),
(1428, 1424, 'RF1423', NULL, 1423, 1, 0, 0, 0, 0, 0),
(1429, 1425, 'RF1424', NULL, 1424, 1, 0, 0, 0, 0, 0),
(1430, 1426, 'RF1425', NULL, 1425, 1, 0, 0, 0, 0, 0),
(1431, 1427, 'RF1426', NULL, 1426, 1, 0, 0, 0, 0, 0),
(1432, 1428, 'RF1427', NULL, 1427, 1, 0, 0, 0, 0, 0),
(1433, 1429, 'RF1428', NULL, 1428, 1, 0, 0, 0, 0, 0),
(1434, 1430, 'RF1429', NULL, 1429, 1, 0, 0, 0, 0, 0),
(1435, 1431, 'RF1430', NULL, 1430, 1, 0, 0, 0, 0, 0),
(1436, 1432, 'RF1431', NULL, 1431, 1, 0, 0, 0, 0, 0),
(1437, 1433, 'RF1432', NULL, 1432, 1, 0, 0, 0, 0, 0),
(1438, 1434, 'RF1433', NULL, 1433, 1, 0, 0, 0, 0, 0),
(1439, 1435, 'RF1434', NULL, 1434, 1, 0, 0, 0, 0, 0),
(1440, 1436, 'RF1435', NULL, 1435, 1, 0, 0, 0, 0, 0),
(1441, 1437, 'RF1436', NULL, 1436, 1, 0, 0, 0, 0, 0),
(1442, 1438, 'RF1437', NULL, 1437, 1, 0, 0, 0, 0, 0),
(1443, 1439, 'RF1438', NULL, 1438, 1, 0, 0, 0, 0, 0),
(1444, 1440, 'RF1439', NULL, 1439, 1, 0, 0, 0, 0, 0),
(1445, 1441, 'RF1440', NULL, 1440, 1, 0, 0, 0, 0, 0),
(1446, 1442, 'RF1441', NULL, 1441, 1, 0, 0, 0, 0, 0),
(1447, 1443, 'RF1442', NULL, 1442, 1, 0, 0, 0, 0, 0),
(1448, 1444, 'RF1443', NULL, 1443, 1, 0, 0, 0, 0, 0),
(1449, 1445, 'RF1444', NULL, 1444, 1, 0, 0, 0, 0, 0),
(1450, 1446, 'RF1445', NULL, 1445, 1, 0, 0, 0, 0, 0),
(1451, 1447, 'RF1446', NULL, 1446, 1, 0, 0, 0, 0, 0),
(1452, 1448, 'RF1447', NULL, 1447, 1, 0, 0, 0, 0, 0),
(1453, 1449, 'RF1448', NULL, 1448, 1, 0, 0, 0, 0, 0),
(1454, 1450, 'RF1449', NULL, 1449, 1, 0, 0, 0, 0, 0),
(1455, 1451, 'RF1450', NULL, 1450, 1, 0, 0, 0, 0, 0),
(1456, 1452, 'RF1451', NULL, 1451, 1, 0, 0, 0, 0, 0),
(1457, 1453, 'RF1452', NULL, 1452, 1, 0, 0, 0, 0, 0),
(1458, 1454, 'RF1453', NULL, 1453, 1, 0, 0, 0, 0, 0),
(1459, 1455, 'RF1454', NULL, 1454, 1, 0, 0, 0, 0, 0),
(1460, 1456, 'RF1455', NULL, 1455, 1, 0, 0, 0, 0, 0),
(1461, 1457, 'RF1456', NULL, 1456, 1, 0, 0, 0, 0, 0),
(1462, 1458, 'RF1457', NULL, 1457, 1, 0, 0, 0, 0, 0),
(1463, 1459, 'RF1458', NULL, 1458, 1, 0, 0, 0, 0, 0),
(1464, 1460, 'RF1459', NULL, 1459, 1, 0, 0, 0, 0, 0),
(1465, 1461, 'RF1460', NULL, 1460, 1, 0, 0, 0, 0, 0),
(1466, 1462, 'RF1461', NULL, 1461, 1, 0, 0, 0, 0, 0),
(1467, 1463, 'RF1462', NULL, 1462, 1, 0, 0, 0, 0, 0),
(1468, 1464, 'RF1463', NULL, 1463, 1, 0, 0, 0, 0, 0),
(1469, 1465, 'RF1464', NULL, 1464, 1, 0, 0, 0, 0, 0),
(1470, 1466, 'RF1465', NULL, 1465, 1, 0, 0, 0, 0, 0),
(1471, 1467, 'RF1466', NULL, 1466, 1, 0, 0, 0, 0, 0),
(1472, 1468, 'RF1467', NULL, 1467, 1, 0, 0, 0, 0, 0),
(1473, 1469, 'RF1468', NULL, 1468, 1, 0, 0, 0, 0, 0),
(1474, 1470, 'RF1469', NULL, 1469, 1, 0, 0, 0, 0, 0),
(1475, 1471, 'RF1470', NULL, 1470, 1, 0, 0, 0, 0, 0),
(1476, 1472, 'RF1471', NULL, 1471, 1, 0, 0, 0, 0, 0),
(1477, 1473, 'RF1472', NULL, 1472, 1, 0, 0, 0, 0, 0),
(1478, 1474, 'RF1473', NULL, 1473, 1, 0, 0, 0, 0, 0),
(1479, 1475, 'RF1474', NULL, 1474, 1, 0, 0, 0, 0, 0),
(1480, 1476, 'RF1475', NULL, 1475, 1, 0, 0, 0, 0, 0),
(1481, 1477, 'RF1476', NULL, 1476, 1, 0, 0, 0, 0, 0),
(1482, 1478, 'RF1477', NULL, 1477, 1, 0, 0, 0, 0, 0),
(1483, 1479, 'RF1478', NULL, 1478, 1, 0, 0, 0, 0, 0),
(1484, 1480, 'RF1479', NULL, 1479, 1, 0, 0, 0, 0, 0),
(1485, 1481, 'RF1480', NULL, 1480, 1, 0, 0, 0, 0, 0),
(1486, 1482, 'RF1481', NULL, 1481, 1, 0, 0, 0, 0, 0),
(1487, 1483, 'RF1482', NULL, 1482, 1, 0, 0, 0, 0, 0),
(1488, 1484, 'RF1483', NULL, 1483, 1, 0, 0, 0, 0, 0),
(1489, 1485, 'RF1484', NULL, 1484, 1, 0, 0, 0, 0, 0),
(1490, 1486, 'RF1485', NULL, 1485, 1, 0, 0, 0, 0, 0),
(1491, 1487, 'RF1486', NULL, 1486, 1, 0, 0, 0, 0, 0),
(1492, 1488, 'RF1487', NULL, 1487, 1, 0, 0, 0, 0, 0),
(1493, 1489, 'RF1488', NULL, 1488, 1, 0, 0, 0, 0, 0),
(1494, 1490, 'RF1489', NULL, 1489, 1, 0, 0, 0, 0, 0),
(1495, 1491, 'RF1490', NULL, 1490, 1, 0, 0, 0, 0, 0),
(1496, 1492, 'RF1491', NULL, 1491, 1, 0, 0, 0, 0, 0),
(1497, 1493, 'RF1492', NULL, 1492, 1, 0, 0, 0, 0, 0),
(1498, 1494, 'RF1493', NULL, 1493, 1, 0, 0, 0, 0, 0),
(1499, 1495, 'RF1494', NULL, 1494, 1, 0, 0, 0, 0, 0),
(1500, 1496, 'RF1495', NULL, 1495, 1, 0, 0, 0, 0, 0),
(1501, 1497, 'RF1496', NULL, 1496, 1, 0, 0, 0, 0, 0),
(1502, 1498, 'RF1497', NULL, 1497, 1, 0, 0, 0, 0, 0),
(1503, 1499, 'RF1498', NULL, 1498, 1, 0, 0, 0, 0, 0),
(1504, 1500, 'RF1499', NULL, 1499, 1, 0, 0, 0, 0, 0),
(1505, 1501, 'RF1500', NULL, 1500, 1, 0, 0, 0, 0, 0),
(1506, 1502, 'RF1501', NULL, 1501, 1, 0, 0, 0, 0, 0),
(1507, 1503, 'RF1502', NULL, 1502, 1, 0, 0, 0, 0, 0),
(1508, 1504, 'RF1503', NULL, 1503, 1, 0, 0, 0, 0, 0),
(1509, 1505, 'RF1504', NULL, 1504, 1, 0, 0, 0, 0, 0),
(1510, 1506, 'RF1505', NULL, 1505, 1, 0, 0, 0, 0, 0),
(1511, 1507, 'RF1506', NULL, 1506, 1, 0, 0, 0, 0, 0),
(1512, 1508, 'RF1507', NULL, 1507, 1, 0, 0, 0, 0, 0),
(1513, 1509, 'RF1508', NULL, 1508, 1, 0, 0, 0, 0, 0),
(1514, 1510, 'RF1509', NULL, 1509, 1, 0, 0, 0, 0, 0),
(1515, 1511, 'RF1510', NULL, 1510, 1, 0, 0, 0, 0, 0),
(1516, 1512, 'RF1511', NULL, 1511, 1, 0, 0, 0, 0, 0),
(1517, 1513, 'RF1512', NULL, 1512, 1, 0, 0, 0, 0, 0),
(1518, 1514, 'RF1513', NULL, 1513, 1, 0, 0, 0, 0, 0),
(1519, 1515, 'RF1514', NULL, 1514, 1, 0, 0, 0, 0, 0),
(1520, 1516, 'RF1515', NULL, 1515, 1, 0, 0, 0, 0, 0),
(1521, 1517, 'RF1516', NULL, 1516, 1, 0, 0, 0, 0, 0),
(1522, 1518, 'RF1517', NULL, 1517, 1, 0, 0, 0, 0, 0),
(1523, 1519, 'RF1518', NULL, 1518, 1, 0, 0, 0, 0, 0),
(1524, 1520, 'RF1519', NULL, 1519, 1, 0, 0, 0, 0, 0),
(1525, 1521, 'RF1520', NULL, 1520, 1, 0, 0, 0, 0, 0),
(1526, 1522, 'RF1521', NULL, 1521, 1, 0, 0, 0, 0, 0),
(1527, 1523, 'RF1522', NULL, 1522, 1, 0, 0, 0, 0, 0),
(1528, 1524, 'RF1523', NULL, 1523, 1, 0, 0, 0, 0, 0),
(1529, 1525, 'RF1524', NULL, 1524, 1, 0, 0, 0, 0, 0),
(1530, 1526, 'RF1525', NULL, 1525, 1, 0, 0, 0, 0, 0),
(1531, 1527, 'RF1526', NULL, 1526, 1, 0, 0, 0, 0, 0),
(1532, 1528, 'RF1527', NULL, 1527, 1, 0, 0, 0, 0, 0),
(1533, 1529, 'RF1528', NULL, 1528, 1, 0, 0, 0, 0, 0),
(1534, 1530, 'RF1529', NULL, 1529, 1, 0, 0, 0, 0, 0),
(1535, 1531, 'RF1530', NULL, 1530, 1, 0, 0, 0, 0, 0),
(1536, 1532, 'RF1531', NULL, 1531, 1, 0, 0, 0, 0, 0),
(1537, 1533, 'RF1532', NULL, 1532, 1, 0, 0, 0, 0, 0),
(1538, 1534, 'RF1533', NULL, 1533, 1, 0, 0, 0, 0, 0),
(1539, 1535, 'RF1534', NULL, 1534, 1, 0, 0, 0, 0, 0),
(1540, 1536, 'RF1535', NULL, 1535, 1, 0, 0, 0, 0, 0),
(1541, 1537, 'RF1536', NULL, 1536, 1, 0, 0, 0, 0, 0),
(1542, 1538, 'RF1537', NULL, 1537, 1, 0, 0, 0, 0, 0),
(1543, 1539, 'RF1538', NULL, 1538, 1, 0, 0, 0, 0, 0),
(1544, 1540, 'RF1539', NULL, 1539, 1, 0, 0, 0, 0, 0),
(1545, 1541, 'RF1540', NULL, 1540, 1, 0, 0, 0, 0, 0),
(1546, 1542, 'RF1541', NULL, 1541, 1, 0, 0, 0, 0, 0),
(1547, 1543, 'RF1542', NULL, 1542, 1, 0, 0, 0, 0, 0),
(1548, 1544, 'RF1543', NULL, 1543, 1, 0, 0, 0, 0, 0),
(1549, 1545, 'RF1544', NULL, 1544, 1, 0, 0, 0, 0, 0),
(1550, 1546, 'RF1545', NULL, 1545, 1, 0, 0, 0, 0, 0),
(1551, 1547, 'RF1546', NULL, 1546, 1, 0, 0, 0, 0, 0),
(1552, 1548, 'RF1547', NULL, 1547, 1, 0, 0, 0, 0, 0),
(1553, 1549, 'RF1548', NULL, 1548, 1, 0, 0, 0, 0, 0),
(1554, 1550, 'RF1549', NULL, 1549, 1, 0, 0, 0, 0, 0),
(1555, 1551, 'RF1550', NULL, 1550, 1, 0, 0, 0, 0, 0),
(1556, 1552, 'RF1551', NULL, 1551, 1, 0, 0, 0, 0, 0),
(1557, 1553, 'RF1552', NULL, 1552, 1, 0, 0, 0, 0, 0),
(1558, 1554, 'RF1553', NULL, 1553, 1, 0, 0, 0, 0, 0),
(1559, 1555, 'RF1554', NULL, 1554, 1, 0, 0, 0, 0, 0),
(1560, 1556, 'RF1555', NULL, 1555, 1, 0, 0, 0, 0, 0),
(1561, 1557, 'RF1556', NULL, 1556, 1, 0, 0, 0, 0, 0),
(1562, 1558, 'RF1557', NULL, 1557, 1, 0, 0, 0, 0, 0),
(1563, 1559, 'RF1558', NULL, 1558, 1, 0, 0, 0, 0, 0),
(1564, 1560, 'RF1559', NULL, 1559, 1, 0, 0, 0, 0, 0),
(1565, 1561, 'RF1560', NULL, 1560, 1, 0, 0, 0, 0, 0),
(1566, 1562, 'RF1561', NULL, 1561, 1, 0, 0, 0, 0, 0),
(1567, 1563, 'RF1562', NULL, 1562, 1, 0, 0, 0, 0, 0),
(1568, 1564, 'RF1563', NULL, 1563, 1, 0, 0, 0, 0, 0),
(1569, 1565, 'RF1564', NULL, 1564, 1, 0, 0, 0, 0, 0),
(1570, 1566, 'RF1565', NULL, 1565, 1, 0, 0, 0, 0, 0),
(1571, 1567, 'RF1566', NULL, 1566, 1, 0, 0, 0, 0, 0),
(1572, 1568, 'RF1567', NULL, 1567, 1, 0, 0, 0, 0, 0),
(1573, 1569, 'RF1568', NULL, 1568, 1, 0, 0, 0, 0, 0),
(1574, 1570, 'RF1569', NULL, 1569, 1, 0, 0, 0, 0, 0),
(1575, 1571, 'RF1570', NULL, 1570, 1, 0, 0, 0, 0, 0),
(1576, 1572, 'RF1571', NULL, 1571, 1, 0, 0, 0, 0, 0),
(1577, 1573, 'RF1572', NULL, 1572, 1, 0, 0, 0, 0, 0),
(1578, 1574, 'RF1573', NULL, 1573, 1, 0, 0, 0, 0, 0),
(1579, 1575, 'RF1574', NULL, 1574, 1, 0, 0, 0, 0, 0),
(1580, 1576, 'RF1575', NULL, 1575, 1, 0, 0, 0, 0, 0),
(1581, 1577, 'RF1576', NULL, 1576, 1, 0, 0, 0, 0, 0),
(1582, 1578, 'RF1577', NULL, 1577, 1, 0, 0, 0, 0, 0),
(1583, 1579, 'RF1578', NULL, 1578, 1, 0, 0, 0, 0, 0),
(1584, 1580, 'RF1579', NULL, 1579, 1, 0, 0, 0, 0, 0),
(1585, 1581, 'RF1580', NULL, 1580, 1, 0, 0, 0, 0, 0),
(1586, 1582, 'RF1581', NULL, 1581, 1, 0, 0, 0, 0, 0),
(1587, 1583, 'RF1582', NULL, 1582, 1, 0, 0, 0, 0, 0),
(1588, 1584, 'RF1583', NULL, 1583, 1, 0, 0, 0, 0, 0),
(1589, 1585, 'RF1584', NULL, 1584, 1, 0, 0, 0, 0, 0),
(1590, 1586, 'RF1585', NULL, 1585, 1, 0, 0, 0, 0, 0),
(1591, 1587, 'RF1586', NULL, 1586, 1, 0, 0, 0, 0, 0),
(1592, 1588, 'RF1587', NULL, 1587, 1, 0, 0, 0, 0, 0),
(1593, 1589, 'RF1588', NULL, 1588, 1, 0, 0, 0, 0, 0),
(1594, 1590, 'RF1589', NULL, 1589, 1, 0, 0, 0, 0, 0),
(1595, 1591, 'RF1590', NULL, 1590, 1, 0, 0, 0, 0, 0),
(1596, 1592, 'RF1591', NULL, 1591, 1, 0, 0, 0, 0, 0),
(1597, 1593, 'RF1592', NULL, 1592, 1, 0, 0, 0, 0, 0),
(1598, 1594, 'RF1593', NULL, 1593, 1, 0, 0, 0, 0, 0),
(1599, 1595, 'RF1594', NULL, 1594, 1, 0, 0, 0, 0, 0),
(1600, 1596, 'RF1595', NULL, 1595, 1, 0, 0, 0, 0, 0),
(1601, 1597, 'RF1596', NULL, 1596, 1, 0, 0, 0, 0, 0),
(1602, 1598, 'RF1597', NULL, 1597, 1, 0, 0, 0, 0, 0),
(1603, 1599, 'RF1598', NULL, 1598, 1, 0, 0, 0, 0, 0),
(1604, 1600, 'RF1599', NULL, 1599, 1, 0, 0, 0, 0, 0),
(1605, 1601, 'RF1600', NULL, 1600, 1, 0, 0, 0, 0, 0),
(1606, 1602, 'RF1601', NULL, 1601, 1, 0, 0, 0, 0, 0),
(1607, 1603, 'RF1602', NULL, 1602, 1, 0, 0, 0, 0, 0),
(1608, 1604, 'RF1603', NULL, 1603, 1, 0, 0, 0, 0, 0),
(1609, 1605, 'RF1604', NULL, 1604, 1, 0, 0, 0, 0, 0),
(1610, 1606, 'RF1605', NULL, 1605, 1, 0, 0, 0, 0, 0),
(1611, 1607, 'RF1606', NULL, 1606, 1, 0, 0, 0, 0, 0),
(1612, 1608, 'RF1607', NULL, 1607, 1, 0, 0, 0, 0, 0),
(1613, 1609, 'RF1608', NULL, 1608, 1, 0, 0, 0, 0, 0),
(1614, 1610, 'RF1609', NULL, 1609, 1, 0, 0, 0, 0, 0),
(1615, 1611, 'RF1610', NULL, 1610, 1, 0, 0, 0, 0, 0),
(1616, 1612, 'RF1611', NULL, 1611, 1, 0, 0, 0, 0, 0),
(1617, 1613, 'RF1612', NULL, 1612, 1, 0, 0, 0, 0, 0),
(1618, 1614, 'RF1613', NULL, 1613, 1, 0, 0, 0, 0, 0),
(1619, 1615, 'RF1614', NULL, 1614, 1, 0, 0, 0, 0, 0),
(1620, 1616, 'RF1615', NULL, 1615, 1, 0, 0, 0, 0, 0),
(1621, 1617, 'RF1616', NULL, 1616, 1, 0, 0, 0, 0, 0),
(1622, 1618, 'RF1617', NULL, 1617, 1, 0, 0, 0, 0, 0),
(1623, 1619, 'RF1618', NULL, 1618, 1, 0, 0, 0, 0, 0),
(1624, 1620, 'RF1619', NULL, 1619, 1, 0, 0, 0, 0, 0),
(1625, 1621, 'RF1620', NULL, 1620, 1, 0, 0, 0, 0, 0),
(1626, 1622, 'RF1621', NULL, 1621, 1, 0, 0, 0, 0, 0),
(1627, 1623, 'RF1622', NULL, 1622, 1, 0, 0, 0, 0, 0),
(1628, 1624, 'RF1623', NULL, 1623, 1, 0, 0, 0, 0, 0),
(1629, 1625, 'RF1624', NULL, 1624, 1, 0, 0, 0, 0, 0),
(1630, 1626, 'RF1625', NULL, 1625, 1, 0, 0, 0, 0, 0),
(1631, 1627, 'RF1626', NULL, 1626, 1, 0, 0, 0, 0, 0),
(1632, 1628, 'RF1627', NULL, 1627, 1, 0, 0, 0, 0, 0),
(1633, 1629, 'RF1628', NULL, 1628, 1, 0, 0, 0, 0, 0),
(1634, 1630, 'RF1629', NULL, 1629, 1, 0, 0, 0, 0, 0),
(1635, 1631, 'RF1630', NULL, 1630, 1, 0, 0, 0, 0, 0),
(1636, 1632, 'RF1631', NULL, 1631, 1, 0, 0, 0, 0, 0),
(1637, 1633, 'RF1632', NULL, 1632, 1, 0, 0, 0, 0, 0),
(1638, 1634, 'RF1633', NULL, 1633, 1, 0, 0, 0, 0, 0),
(1639, 1635, 'RF1634', NULL, 1634, 1, 0, 0, 0, 0, 0),
(1640, 1636, 'RF1635', NULL, 1635, 1, 0, 0, 0, 0, 0),
(1641, 1637, 'RF1636', NULL, 1636, 1, 0, 0, 0, 0, 0),
(1642, 1638, 'RF1637', NULL, 1637, 1, 0, 0, 0, 0, 0),
(1643, 1639, 'RF1638', NULL, 1638, 1, 0, 0, 0, 0, 0),
(1644, 1640, 'RF1639', NULL, 1639, 1, 0, 0, 0, 0, 0),
(1645, 1641, 'RF1640', NULL, 1640, 1, 0, 0, 0, 0, 0),
(1646, 1642, 'RF1641', NULL, 1641, 1, 0, 0, 0, 0, 0),
(1647, 1643, 'RF1642', NULL, 1642, 1, 0, 0, 0, 0, 0),
(1648, 1644, 'RF1643', NULL, 1643, 1, 0, 0, 0, 0, 0),
(1649, 1645, 'RF1644', NULL, 1644, 1, 0, 0, 0, 0, 0),
(1650, 1646, 'RF1645', NULL, 1645, 1, 0, 0, 0, 0, 0),
(1651, 1647, 'RF1646', NULL, 1646, 1, 0, 0, 0, 0, 0),
(1652, 1648, 'RF1647', NULL, 1647, 1, 0, 0, 0, 0, 0),
(1653, 1649, 'RF1648', NULL, 1648, 1, 0, 0, 0, 0, 0),
(1654, 1650, 'RF1649', NULL, 1649, 1, 0, 0, 0, 0, 0),
(1655, 1651, 'RF1650', NULL, 1650, 1, 0, 0, 0, 0, 0),
(1656, 1652, 'RF1651', NULL, 1651, 1, 0, 0, 0, 0, 0),
(1657, 1653, 'RF1652', NULL, 1652, 1, 0, 0, 0, 0, 0),
(1658, 1654, 'RF1653', NULL, 1653, 1, 0, 0, 0, 0, 0),
(1659, 1655, 'RF1654', NULL, 1654, 1, 0, 0, 0, 0, 0),
(1660, 1656, 'RF1655', NULL, 1655, 1, 0, 0, 0, 0, 0),
(1661, 1657, 'RF1656', NULL, 1656, 1, 0, 0, 0, 0, 0),
(1662, 1658, 'RF1657', NULL, 1657, 1, 0, 0, 0, 0, 0),
(1663, 1659, 'RF1658', NULL, 1658, 1, 0, 0, 0, 0, 0),
(1664, 1660, 'RF1659', NULL, 1659, 1, 0, 0, 0, 0, 0),
(1665, 1661, 'RF1660', NULL, 1660, 1, 0, 0, 0, 0, 0),
(1666, 1662, 'RF1661', NULL, 1661, 1, 0, 0, 0, 0, 0),
(1667, 1663, 'RF1662', NULL, 1662, 1, 0, 0, 0, 0, 0),
(1668, 1664, 'RF1663', NULL, 1663, 1, 0, 0, 0, 0, 0),
(1669, 1665, 'RF1664', NULL, 1664, 1, 0, 0, 0, 0, 0),
(1670, 1666, 'RF1665', NULL, 1665, 1, 0, 0, 0, 0, 0),
(1671, 1667, 'RF1666', NULL, 1666, 1, 0, 0, 0, 0, 0),
(1672, 1668, 'RF1667', NULL, 1667, 1, 0, 0, 0, 0, 0),
(1673, 1669, 'RF1668', NULL, 1668, 1, 0, 0, 0, 0, 0),
(1674, 1670, 'RF1669', NULL, 1669, 1, 0, 0, 0, 0, 0),
(1675, 1671, 'RF1670', NULL, 1670, 1, 0, 0, 0, 0, 0),
(1676, 1672, 'RF1671', NULL, 1671, 1, 0, 0, 0, 0, 0),
(1677, 1673, 'RF1672', NULL, 1672, 1, 0, 0, 0, 0, 0),
(1678, 1674, 'RF1673', NULL, 1673, 1, 0, 0, 0, 0, 0),
(1679, 1675, 'RF1674', NULL, 1674, 1, 0, 0, 0, 0, 0),
(1680, 1676, 'RF1675', NULL, 1675, 1, 0, 0, 0, 0, 0),
(1681, 1677, 'RF1676', NULL, 1676, 1, 0, 0, 0, 0, 0),
(1682, 1678, 'RF1677', NULL, 1677, 1, 0, 0, 0, 0, 0),
(1683, 1679, 'RF1678', NULL, 1678, 1, 0, 0, 0, 0, 0),
(1684, 1680, 'RF1679', NULL, 1679, 1, 0, 0, 0, 0, 0),
(1685, 1681, 'RF1680', NULL, 1680, 1, 0, 0, 0, 0, 0),
(1686, 1682, 'RF1681', NULL, 1681, 1, 0, 0, 0, 0, 0),
(1687, 1683, 'RF1682', NULL, 1682, 1, 0, 0, 0, 0, 0),
(1688, 1684, 'RF1683', NULL, 1683, 1, 0, 0, 0, 0, 0),
(1689, 1685, 'RF1684', NULL, 1684, 1, 0, 0, 0, 0, 0),
(1690, 1686, 'RF1685', NULL, 1685, 1, 0, 0, 0, 0, 0),
(1691, 1687, 'RF1686', NULL, 1686, 1, 0, 0, 0, 0, 0),
(1692, 1688, 'RF1687', NULL, 1687, 1, 0, 0, 0, 0, 0),
(1693, 1689, 'RF1688', NULL, 1688, 1, 0, 0, 0, 0, 0),
(1694, 1690, 'RF1689', NULL, 1689, 1, 0, 0, 0, 0, 0),
(1695, 1691, 'RF1690', NULL, 1690, 1, 0, 0, 0, 0, 0),
(1696, 1692, 'RF1691', NULL, 1691, 1, 0, 0, 0, 0, 0),
(1697, 1693, 'RF1692', NULL, 1692, 1, 0, 0, 0, 0, 0),
(1698, 1694, 'RF1693', NULL, 1693, 1, 0, 0, 0, 0, 0),
(1699, 1695, 'RF1694', NULL, 1694, 1, 0, 0, 0, 0, 0),
(1700, 1696, 'RF1695', NULL, 1695, 1, 0, 0, 0, 0, 0),
(1701, 1697, 'RF1696', NULL, 1696, 1, 0, 0, 0, 0, 0),
(1702, 1698, 'RF1697', NULL, 1697, 1, 0, 0, 0, 0, 0),
(1703, 1699, 'RF1698', NULL, 1698, 1, 0, 0, 0, 0, 0),
(1704, 1700, 'RF1699', NULL, 1699, 1, 0, 0, 0, 0, 0),
(1705, 1701, 'RF1700', NULL, 1700, 1, 0, 0, 0, 0, 0),
(1706, 1702, 'RF1701', NULL, 1701, 1, 0, 0, 0, 0, 0),
(1707, 1703, 'RF1702', NULL, 1702, 1, 0, 0, 0, 0, 0),
(1708, 1704, 'RF1703', NULL, 1703, 1, 0, 0, 0, 0, 0),
(1709, 1705, 'RF1704', NULL, 1704, 1, 0, 0, 0, 0, 0),
(1710, 1706, 'RF1705', NULL, 1705, 1, 0, 0, 0, 0, 0),
(1711, 1707, 'RF1706', NULL, 1706, 1, 0, 0, 0, 0, 0),
(1712, 1708, 'RF1707', NULL, 1707, 1, 0, 0, 0, 0, 0),
(1713, 1709, 'RF1708', NULL, 1708, 1, 0, 0, 0, 0, 0),
(1714, 1710, 'RF1709', NULL, 1709, 1, 0, 0, 0, 0, 0),
(1715, 1711, 'RF1710', NULL, 1710, 1, 0, 0, 0, 0, 0),
(1716, 1712, 'RF1711', NULL, 1711, 1, 0, 0, 0, 0, 0),
(1717, 1713, 'RF1712', NULL, 1712, 1, 0, 0, 0, 0, 0),
(1718, 1714, 'RF1713', NULL, 1713, 1, 0, 0, 0, 0, 0),
(1719, 1715, 'RF1714', NULL, 1714, 1, 0, 0, 0, 0, 0),
(1720, 1716, 'RF1715', NULL, 1715, 1, 0, 0, 0, 0, 0),
(1721, 1717, 'RF1716', NULL, 1716, 1, 0, 0, 0, 0, 0),
(1722, 1718, 'RF1717', NULL, 1717, 1, 0, 0, 0, 0, 0),
(1723, 1719, 'RF1718', NULL, 1718, 1, 0, 0, 0, 0, 0),
(1724, 1720, 'RF1719', NULL, 1719, 1, 0, 0, 0, 0, 0),
(1725, 1721, 'RF1720', NULL, 1720, 1, 0, 0, 0, 0, 0),
(1726, 1722, 'RF1721', NULL, 1721, 1, 0, 0, 0, 0, 0),
(1727, 1723, 'RF1722', NULL, 1722, 1, 0, 0, 0, 0, 0),
(1728, 1724, 'RF1723', NULL, 1723, 1, 0, 0, 0, 0, 0),
(1729, 1725, 'RF1724', NULL, 1724, 1, 0, 0, 0, 0, 0),
(1730, 1726, 'RF1725', NULL, 1725, 1, 0, 0, 0, 0, 0),
(1731, 1727, 'RF1726', NULL, 1726, 1, 0, 0, 0, 0, 0),
(1732, 1728, 'RF1727', NULL, 1727, 1, 0, 0, 0, 0, 0),
(1733, 1729, 'RF1728', NULL, 1728, 1, 0, 0, 0, 0, 0),
(1734, 1730, 'RF1729', NULL, 1729, 1, 0, 0, 0, 0, 0),
(1735, 1731, 'RF1730', NULL, 1730, 1, 0, 0, 0, 0, 0),
(1736, 1732, 'RF1731', NULL, 1731, 1, 0, 0, 0, 0, 0),
(1737, 1733, 'RF1732', NULL, 1732, 1, 0, 0, 0, 0, 0),
(1738, 1734, 'RF1733', NULL, 1733, 1, 0, 0, 0, 0, 0),
(1739, 1735, 'RF1734', NULL, 1734, 1, 0, 0, 0, 0, 0),
(1740, 1736, 'RF1735', NULL, 1735, 1, 0, 0, 0, 0, 0),
(1741, 1737, 'RF1736', NULL, 1736, 1, 0, 0, 0, 0, 0),
(1742, 1738, 'RF1737', NULL, 1737, 1, 0, 0, 0, 0, 0),
(1743, 1739, 'RF1738', NULL, 1738, 1, 0, 0, 0, 0, 0),
(1744, 1740, 'RF1739', NULL, 1739, 1, 0, 0, 0, 0, 0),
(1745, 1741, 'RF1740', NULL, 1740, 1, 0, 0, 0, 0, 0),
(1746, 1742, 'RF1741', NULL, 1741, 1, 0, 0, 0, 0, 0),
(1747, 1743, 'RF1742', NULL, 1742, 1, 0, 0, 0, 0, 0),
(1748, 1744, 'RF1743', NULL, 1743, 1, 0, 0, 0, 0, 0),
(1749, 1745, 'RF1744', NULL, 1744, 1, 0, 0, 0, 0, 0),
(1750, 1746, 'RF1745', NULL, 1745, 1, 0, 0, 0, 0, 0),
(1751, 1747, 'RF1746', NULL, 1746, 1, 0, 0, 0, 0, 0),
(1752, 1748, 'RF1747', NULL, 1747, 1, 0, 0, 0, 0, 0),
(1753, 1749, 'RF1748', NULL, 1748, 1, 0, 0, 0, 0, 0),
(1754, 1750, 'RF1749', NULL, 1749, 1, 0, 0, 0, 0, 0),
(1755, 1751, 'RF1750', NULL, 1750, 1, 0, 0, 0, 0, 0),
(1756, 1752, 'RF1751', NULL, 1751, 1, 0, 0, 0, 0, 0),
(1757, 1753, 'RF1752', NULL, 1752, 1, 0, 0, 0, 0, 0),
(1758, 1754, 'RF1753', NULL, 1753, 1, 0, 0, 0, 0, 0),
(1759, 1755, 'RF1754', NULL, 1754, 1, 0, 0, 0, 0, 0),
(1760, 1756, 'RF1755', NULL, 1755, 1, 0, 0, 0, 0, 0),
(1761, 1757, 'RF1756', NULL, 1756, 1, 0, 0, 0, 0, 0),
(1762, 1758, 'RF1757', NULL, 1757, 1, 0, 0, 0, 0, 0),
(1763, 1759, 'RF1758', NULL, 1758, 1, 0, 0, 0, 0, 0),
(1764, 1760, 'RF1759', NULL, 1759, 1, 0, 0, 0, 0, 0),
(1765, 1761, 'RF1760', NULL, 1760, 1, 0, 0, 0, 0, 0),
(1766, 1762, 'RF1761', NULL, 1761, 1, 0, 0, 0, 0, 0),
(1767, 1763, 'RF1762', NULL, 1762, 1, 0, 0, 0, 0, 0),
(1768, 1764, 'RF1763', NULL, 1763, 1, 0, 0, 0, 0, 0),
(1769, 1765, 'RF1764', NULL, 1764, 1, 0, 0, 0, 0, 0),
(1770, 1766, 'RF1765', NULL, 1765, 1, 0, 0, 0, 0, 0),
(1771, 1767, 'RF1766', NULL, 1766, 1, 0, 0, 0, 0, 0),
(1772, 1768, 'RF1767', NULL, 1767, 1, 0, 0, 0, 0, 0),
(1773, 1769, 'RF1768', NULL, 1768, 1, 0, 0, 0, 0, 0),
(1774, 1770, 'RF1769', NULL, 1769, 1, 0, 0, 0, 0, 0),
(1775, 1771, 'RF1770', NULL, 1770, 1, 0, 0, 0, 0, 0),
(1776, 1772, 'RF1771', NULL, 1771, 1, 0, 0, 0, 0, 0),
(1777, 1773, 'RF1772', NULL, 1772, 1, 0, 0, 0, 0, 0),
(1778, 1774, 'RF1773', NULL, 1773, 1, 0, 0, 0, 0, 0),
(1779, 1775, 'RF1774', NULL, 1774, 1, 0, 0, 0, 0, 0),
(1780, 1776, 'RF1775', NULL, 1775, 1, 0, 0, 0, 0, 0),
(1781, 1777, 'RF1776', NULL, 1776, 1, 0, 0, 0, 0, 0),
(1782, 1778, 'RF1777', NULL, 1777, 1, 0, 0, 0, 0, 0),
(1783, 1779, 'RF1778', NULL, 1778, 1, 0, 0, 0, 0, 0),
(1784, 1780, 'RF1779', NULL, 1779, 1, 0, 0, 0, 0, 0),
(1785, 1781, 'RF1780', NULL, 1780, 1, 0, 0, 0, 0, 0),
(1786, 1782, 'RF1781', NULL, 1781, 1, 0, 0, 0, 0, 0),
(1787, 1783, 'RF1782', NULL, 1782, 1, 0, 0, 0, 0, 0),
(1788, 1784, 'RF1783', NULL, 1783, 1, 0, 0, 0, 0, 0),
(1789, 1785, 'RF1784', NULL, 1784, 1, 0, 0, 0, 0, 0),
(1790, 1786, 'RF1785', NULL, 1785, 1, 0, 0, 0, 0, 0),
(1791, 1787, 'RF1786', NULL, 1786, 1, 0, 0, 0, 0, 0),
(1792, 1788, 'RF1787', NULL, 1787, 1, 0, 0, 0, 0, 0),
(1793, 1789, 'RF1788', NULL, 1788, 1, 0, 0, 0, 0, 0),
(1794, 1790, 'RF1789', NULL, 1789, 1, 0, 0, 0, 0, 0),
(1795, 1791, 'RF1790', NULL, 1790, 1, 0, 0, 0, 0, 0),
(1796, 1792, 'RF1791', NULL, 1791, 1, 0, 0, 0, 0, 0),
(1797, 1793, 'RF1792', NULL, 1792, 1, 0, 0, 0, 0, 0),
(1798, 1794, 'RF1793', NULL, 1793, 1, 0, 0, 0, 0, 0),
(1799, 1795, 'RF1794', NULL, 1794, 1, 0, 0, 0, 0, 0),
(1800, 1796, 'RF1795', NULL, 1795, 1, 0, 0, 0, 0, 0),
(1801, 1797, 'RF1796', NULL, 1796, 1, 0, 0, 0, 0, 0),
(1802, 1798, 'RF1797', NULL, 1797, 1, 0, 0, 0, 0, 0),
(1803, 1799, 'RF1798', NULL, 1798, 1, 0, 0, 0, 0, 0),
(1804, 1800, 'RF1799', NULL, 1799, 1, 0, 0, 0, 0, 0),
(1805, 1801, 'RF1800', NULL, 1800, 1, 0, 0, 0, 0, 0),
(1806, 1802, 'RF1801', NULL, 1801, 1, 0, 0, 0, 0, 0),
(1807, 1803, 'RF1802', NULL, 1802, 1, 0, 0, 0, 0, 0),
(1808, 1804, 'RF1803', NULL, 1803, 1, 0, 0, 0, 0, 0),
(1809, 1805, 'RF1804', NULL, 1804, 1, 0, 0, 0, 0, 0),
(1810, 1806, 'RF1805', NULL, 1805, 1, 0, 0, 0, 0, 0),
(1811, 1807, 'RF1806', NULL, 1806, 1, 0, 0, 0, 0, 0),
(1812, 1808, 'RF1807', NULL, 1807, 1, 0, 0, 0, 0, 0),
(1813, 1809, 'RF1808', NULL, 1808, 1, 0, 0, 0, 0, 0),
(1814, 1810, 'RF1809', NULL, 1809, 1, 0, 0, 0, 0, 0),
(1815, 1811, 'RF1810', NULL, 1810, 1, 0, 0, 0, 0, 0),
(1816, 1812, 'RF1811', NULL, 1811, 1, 0, 0, 0, 0, 0),
(1817, 1813, 'RF1812', NULL, 1812, 1, 0, 0, 0, 0, 0),
(1818, 1814, 'RF1813', NULL, 1813, 1, 0, 0, 0, 0, 0),
(1819, 1815, 'RF1814', NULL, 1814, 1, 0, 0, 0, 0, 0),
(1820, 1816, 'RF1815', NULL, 1815, 1, 0, 0, 0, 0, 0),
(1821, 1817, 'RF1816', NULL, 1816, 1, 0, 0, 0, 0, 0),
(1822, 1818, 'RF1817', NULL, 1817, 1, 0, 0, 0, 0, 0),
(1823, 1819, 'RF1818', NULL, 1818, 1, 0, 0, 0, 0, 0),
(1824, 1820, 'RF1819', NULL, 1819, 1, 0, 0, 0, 0, 0),
(1825, 1821, 'RF1820', NULL, 1820, 1, 0, 0, 0, 0, 0),
(1826, 1822, 'RF1821', NULL, 1821, 1, 0, 0, 0, 0, 0),
(1827, 1823, 'RF1822', NULL, 1822, 1, 0, 0, 0, 0, 0),
(1828, 1824, 'RF1823', NULL, 1823, 1, 0, 0, 0, 0, 0),
(1829, 1825, 'RF1824', NULL, 1824, 1, 0, 0, 0, 0, 0),
(1830, 1826, 'RF1825', NULL, 1825, 1, 0, 0, 0, 0, 0),
(1831, 1827, 'RF1826', NULL, 1826, 1, 0, 0, 0, 0, 0),
(1832, 1828, 'RF1827', NULL, 1827, 1, 0, 0, 0, 0, 0),
(1833, 1829, 'RF1828', NULL, 1828, 1, 0, 0, 0, 0, 0),
(1834, 1830, 'RF1829', NULL, 1829, 1, 0, 0, 0, 0, 0),
(1835, 1831, 'RF1830', NULL, 1830, 1, 0, 0, 0, 0, 0),
(1836, 1832, 'RF1831', NULL, 1831, 1, 0, 0, 0, 0, 0),
(1837, 1833, 'RF1832', NULL, 1832, 1, 0, 0, 0, 0, 0),
(1838, 1834, 'RF1833', NULL, 1833, 1, 0, 0, 0, 0, 0),
(1839, 1835, 'RF1834', NULL, 1834, 1, 0, 0, 0, 0, 0),
(1840, 1836, 'RF1835', NULL, 1835, 1, 0, 0, 0, 0, 0),
(1841, 1837, 'RF1836', NULL, 1836, 1, 0, 0, 0, 0, 0),
(1842, 1838, 'RF1837', NULL, 1837, 1, 0, 0, 0, 0, 0),
(1843, 1839, 'RF1838', NULL, 1838, 1, 0, 0, 0, 0, 0),
(1844, 1840, 'RF1839', NULL, 1839, 1, 0, 0, 0, 0, 0),
(1845, 1841, 'RF1840', NULL, 1840, 1, 0, 0, 0, 0, 0),
(1846, 1842, 'RF1841', NULL, 1841, 1, 0, 0, 0, 0, 0),
(1847, 1843, 'RF1842', NULL, 1842, 1, 0, 0, 0, 0, 0),
(1848, 1844, 'RF1843', NULL, 1843, 1, 0, 0, 0, 0, 0),
(1849, 1845, 'RF1844', NULL, 1844, 1, 0, 0, 0, 0, 0),
(1850, 1846, 'RF1845', NULL, 1845, 1, 0, 0, 0, 0, 0),
(1851, 1847, 'RF1846', NULL, 1846, 1, 0, 0, 0, 0, 0),
(1852, 1848, 'RF1847', NULL, 1847, 1, 0, 0, 0, 0, 0),
(1853, 1849, 'RF1848', NULL, 1848, 1, 0, 0, 0, 0, 0),
(1854, 1850, 'RF1849', NULL, 1849, 1, 0, 0, 0, 0, 0),
(1855, 1851, 'RF1850', NULL, 1850, 1, 0, 0, 0, 0, 0),
(1856, 1852, 'RF1851', NULL, 1851, 1, 0, 0, 0, 0, 0),
(1857, 1853, 'RF1852', NULL, 1852, 1, 0, 0, 0, 0, 0),
(1858, 1854, 'RF1853', NULL, 1853, 1, 0, 0, 0, 0, 0),
(1859, 1855, 'RF1854', NULL, 1854, 1, 0, 0, 0, 0, 0),
(1860, 1856, 'RF1855', NULL, 1855, 1, 0, 0, 0, 0, 0),
(1861, 1857, 'RF1856', NULL, 1856, 1, 0, 0, 0, 0, 0),
(1862, 1858, 'RF1857', NULL, 1857, 1, 0, 0, 0, 0, 0),
(1863, 1859, 'RF1858', NULL, 1858, 1, 0, 0, 0, 0, 0),
(1864, 1860, 'RF1859', NULL, 1859, 1, 0, 0, 0, 0, 0),
(1865, 1861, 'RF1860', NULL, 1860, 1, 0, 0, 0, 0, 0),
(1866, 1862, 'RF1861', NULL, 1861, 1, 0, 0, 0, 0, 0),
(1867, 1863, 'RF1862', NULL, 1862, 1, 0, 0, 0, 0, 0),
(1868, 1864, 'RF1863', NULL, 1863, 1, 0, 0, 0, 0, 0),
(1869, 1865, 'RF1864', NULL, 1864, 1, 0, 0, 0, 0, 0),
(1870, 1866, 'RF1865', NULL, 1865, 1, 0, 0, 0, 0, 0),
(1871, 1867, 'RF1866', NULL, 1866, 1, 0, 0, 0, 0, 0),
(1872, 1868, 'RF1867', NULL, 1867, 1, 0, 0, 0, 0, 0),
(1873, 1869, 'RF1868', NULL, 1868, 1, 0, 0, 0, 0, 0),
(1874, 1870, 'RF1869', NULL, 1869, 1, 0, 0, 0, 0, 0),
(1875, 1871, 'RF1870', NULL, 1870, 1, 0, 0, 0, 0, 0),
(1876, 1872, 'RF1871', NULL, 1871, 1, 0, 0, 0, 0, 0),
(1877, 1873, 'RF1872', NULL, 1872, 1, 0, 0, 0, 0, 0),
(1878, 1874, 'RF1873', NULL, 1873, 1, 0, 0, 0, 0, 0),
(1879, 1875, 'RF1874', NULL, 1874, 1, 0, 0, 0, 0, 0),
(1880, 1876, 'RF1875', NULL, 1875, 1, 0, 0, 0, 0, 0),
(1881, 1877, 'RF1876', NULL, 1876, 1, 0, 0, 0, 0, 0),
(1882, 1878, 'RF1877', NULL, 1877, 1, 0, 0, 0, 0, 0),
(1883, 1879, 'RF1878', NULL, 1878, 1, 0, 0, 0, 0, 0),
(1884, 1880, 'RF1879', NULL, 1879, 1, 0, 0, 0, 0, 0),
(1885, 1881, 'RF1880', NULL, 1880, 1, 0, 0, 0, 0, 0),
(1886, 1882, 'RF1881', NULL, 1881, 1, 0, 0, 0, 0, 0),
(1887, 1883, 'RF1882', NULL, 1882, 1, 0, 0, 0, 0, 0),
(1888, 1884, 'RF1883', NULL, 1883, 1, 0, 0, 0, 0, 0),
(1889, 1885, 'RF1884', NULL, 1884, 1, 0, 0, 0, 0, 0),
(1890, 1886, 'RF1885', NULL, 1885, 1, 0, 0, 0, 0, 0),
(1891, 1887, 'RF1886', NULL, 1886, 1, 0, 0, 0, 0, 0),
(1892, 1888, 'RF1887', NULL, 1887, 1, 0, 0, 0, 0, 0),
(1893, 1889, 'RF1888', NULL, 1888, 1, 0, 0, 0, 0, 0),
(1894, 1890, 'RF1889', NULL, 1889, 1, 0, 0, 0, 0, 0),
(1895, 1891, 'RF1890', NULL, 1890, 1, 0, 0, 0, 0, 0),
(1896, 1892, 'RF1891', NULL, 1891, 1, 0, 0, 0, 0, 0),
(1897, 1893, 'RF1892', NULL, 1892, 1, 0, 0, 0, 0, 0),
(1898, 1894, 'RF1893', NULL, 1893, 1, 0, 0, 0, 0, 0),
(1899, 1895, 'RF1894', NULL, 1894, 1, 0, 0, 0, 0, 0),
(1900, 1896, 'RF1895', NULL, 1895, 1, 0, 0, 0, 0, 0),
(1901, 1897, 'RF1896', NULL, 1896, 1, 0, 0, 0, 0, 0),
(1902, 1898, 'RF1897', NULL, 1897, 1, 0, 0, 0, 0, 0),
(1903, 1899, 'RF1898', NULL, 1898, 1, 0, 0, 0, 0, 0),
(1904, 1900, 'RF1899', NULL, 1899, 1, 0, 0, 0, 0, 0),
(1905, 1901, 'RF1900', NULL, 1900, 1, 0, 0, 0, 0, 0),
(1906, 1902, 'RF1901', NULL, 1901, 1, 0, 0, 0, 0, 0),
(1907, 1903, 'RF1902', NULL, 1902, 1, 0, 0, 0, 0, 0),
(1908, 1904, 'RF1903', NULL, 1903, 1, 0, 0, 0, 0, 0),
(1909, 1905, 'RF1904', NULL, 1904, 1, 0, 0, 0, 0, 0),
(1910, 1906, 'RF1905', NULL, 1905, 1, 0, 0, 0, 0, 0),
(1911, 1907, 'RF1906', NULL, 1906, 1, 0, 0, 0, 0, 0),
(1912, 1908, 'RF1907', NULL, 1907, 1, 0, 0, 0, 0, 0),
(1913, 1909, 'RF1908', NULL, 1908, 1, 0, 0, 0, 0, 0),
(1914, 1910, 'RF1909', NULL, 1909, 1, 0, 0, 0, 0, 0),
(1915, 1911, 'RF1910', NULL, 1910, 1, 0, 0, 0, 0, 0),
(1916, 1912, 'RF1911', NULL, 1911, 1, 0, 0, 0, 0, 0),
(1917, 1913, 'RF1912', NULL, 1912, 1, 0, 0, 0, 0, 0),
(1918, 1914, 'RF1913', NULL, 1913, 1, 0, 0, 0, 0, 0),
(1919, 1915, 'RF1914', NULL, 1914, 1, 0, 0, 0, 0, 0),
(1920, 1916, 'RF1915', NULL, 1915, 1, 0, 0, 0, 0, 0),
(1921, 1917, 'RF1916', NULL, 1916, 1, 0, 0, 0, 0, 0),
(1922, 1918, 'RF1917', NULL, 1917, 1, 0, 0, 0, 0, 0),
(1923, 1919, 'RF1918', NULL, 1918, 1, 0, 0, 0, 0, 0),
(1924, 1920, 'RF1919', NULL, 1919, 1, 0, 0, 0, 0, 0),
(1925, 1921, 'RF1920', NULL, 1920, 1, 0, 0, 0, 0, 0),
(1926, 1922, 'RF1921', NULL, 1921, 1, 0, 0, 0, 0, 0),
(1927, 1923, 'RF1922', NULL, 1922, 1, 0, 0, 0, 0, 0),
(1928, 1924, 'RF1923', NULL, 1923, 1, 0, 0, 0, 0, 0),
(1929, 1925, 'RF1924', NULL, 1924, 1, 0, 0, 0, 0, 0),
(1930, 1926, 'RF1925', NULL, 1925, 1, 0, 0, 0, 0, 0),
(1931, 1927, 'RF1926', NULL, 1926, 1, 0, 0, 0, 0, 0),
(1932, 1928, 'RF1927', NULL, 1927, 1, 0, 0, 0, 0, 0),
(1933, 1929, 'RF1928', NULL, 1928, 1, 0, 0, 0, 0, 0),
(1934, 1930, 'RF1929', NULL, 1929, 1, 0, 0, 0, 0, 0),
(1935, 1931, 'RF1930', NULL, 1930, 1, 0, 0, 0, 0, 0),
(1936, 1932, 'RF1931', NULL, 1931, 1, 0, 0, 0, 0, 0),
(1937, 1933, 'RF1932', NULL, 1932, 1, 0, 0, 0, 0, 0),
(1938, 1934, 'RF1933', NULL, 1933, 1, 0, 0, 0, 0, 0),
(1939, 1935, 'RF1934', NULL, 1934, 1, 0, 0, 0, 0, 0),
(1940, 1936, 'RF1935', NULL, 1935, 1, 0, 0, 0, 0, 0),
(1941, 1937, 'RF1936', NULL, 1936, 1, 0, 0, 0, 0, 0),
(1942, 1938, 'RF1937', NULL, 1937, 1, 0, 0, 0, 0, 0),
(1943, 1939, 'RF1938', NULL, 1938, 1, 0, 0, 0, 0, 0),
(1944, 1940, 'RF1939', NULL, 1939, 1, 0, 0, 0, 0, 0),
(1945, 1941, 'RF1940', NULL, 1940, 1, 0, 0, 0, 0, 0),
(1946, 1942, 'RF1941', NULL, 1941, 1, 0, 0, 0, 0, 0),
(1947, 1943, 'RF1942', NULL, 1942, 1, 0, 0, 0, 0, 0),
(1948, 1944, 'RF1943', NULL, 1943, 1, 0, 0, 0, 0, 0),
(1949, 1945, 'RF1944', NULL, 1944, 1, 0, 0, 0, 0, 0),
(1950, 1946, 'RF1945', NULL, 1945, 1, 0, 0, 0, 0, 0),
(1951, 1947, 'RF1946', NULL, 1946, 1, 0, 0, 0, 0, 0),
(1952, 1948, 'RF1947', NULL, 1947, 1, 0, 0, 0, 0, 0),
(1953, 1949, 'RF1948', NULL, 1948, 1, 0, 0, 0, 0, 0),
(1954, 1950, 'RF1949', NULL, 1949, 1, 0, 0, 0, 0, 0),
(1955, 1951, 'RF1950', NULL, 1950, 1, 0, 0, 0, 0, 0),
(1956, 1952, 'RF1951', NULL, 1951, 1, 0, 0, 0, 0, 0),
(1957, 1953, 'RF1952', NULL, 1952, 1, 0, 0, 0, 0, 0),
(1958, 1954, 'RF1953', NULL, 1953, 1, 0, 0, 0, 0, 0),
(1959, 1955, 'RF1954', NULL, 1954, 1, 0, 0, 0, 0, 0),
(1960, 1956, 'RF1955', NULL, 1955, 1, 0, 0, 0, 0, 0),
(1961, 1957, 'RF1956', NULL, 1956, 1, 0, 0, 0, 0, 0),
(1962, 1958, 'RF1957', NULL, 1957, 1, 0, 0, 0, 0, 0),
(1963, 1959, 'RF1958', NULL, 1958, 1, 0, 0, 0, 0, 0),
(1964, 1960, 'RF1959', NULL, 1959, 1, 0, 0, 0, 0, 0),
(1965, 1961, 'RF1960', NULL, 1960, 1, 0, 0, 0, 0, 0),
(1966, 1962, 'RF1961', NULL, 1961, 1, 0, 0, 0, 0, 0),
(1967, 1963, 'RF1962', NULL, 1962, 1, 0, 0, 0, 0, 0),
(1968, 1964, 'RF1963', NULL, 1963, 1, 0, 0, 0, 0, 0),
(1969, 1965, 'RF1964', NULL, 1964, 1, 0, 0, 0, 0, 0),
(1970, 1966, 'RF1965', NULL, 1965, 1, 0, 0, 0, 0, 0),
(1971, 1967, 'RF1966', NULL, 1966, 1, 0, 0, 0, 0, 0),
(1972, 1968, 'RF1967', NULL, 1967, 1, 0, 0, 0, 0, 0),
(1973, 1969, 'RF1968', NULL, 1968, 1, 0, 0, 0, 0, 0),
(1974, 1970, 'RF1969', NULL, 1969, 1, 0, 0, 0, 0, 0),
(1975, 1971, 'RF1970', NULL, 1970, 1, 0, 0, 0, 0, 0),
(1976, 1972, 'RF1971', NULL, 1971, 1, 0, 0, 0, 0, 0),
(1977, 1973, 'RF1972', NULL, 1972, 1, 0, 0, 0, 0, 0),
(1978, 1974, 'RF1973', NULL, 1973, 1, 0, 0, 0, 0, 0),
(1979, 1975, 'RF1974', NULL, 1974, 1, 0, 0, 0, 0, 0),
(1980, 1976, 'RF1975', NULL, 1975, 1, 0, 0, 0, 0, 0),
(1981, 1977, 'RF1976', NULL, 1976, 1, 0, 0, 0, 0, 0),
(1982, 1978, 'RF1977', NULL, 1977, 1, 0, 0, 0, 0, 0),
(1983, 1979, 'RF1978', NULL, 1978, 1, 0, 0, 0, 0, 0),
(1984, 1980, 'RF1979', NULL, 1979, 1, 0, 0, 0, 0, 0),
(1985, 1981, 'RF1980', NULL, 1980, 1, 0, 0, 0, 0, 0),
(1986, 1982, 'RF1981', NULL, 1981, 1, 0, 0, 0, 0, 0),
(1987, 1983, 'RF1982', NULL, 1982, 1, 0, 0, 0, 0, 0),
(1988, 1984, 'RF1983', NULL, 1983, 1, 0, 0, 0, 0, 0),
(1989, 1985, 'RF1984', NULL, 1984, 1, 0, 0, 0, 0, 0),
(1990, 1986, 'RF1985', NULL, 1985, 1, 0, 0, 0, 0, 0),
(1991, 1987, 'RF1986', NULL, 1986, 1, 0, 0, 0, 0, 0),
(1992, 1988, 'RF1987', NULL, 1987, 1, 0, 0, 0, 0, 0),
(1993, 1989, 'RF1988', NULL, 1988, 1, 0, 0, 0, 0, 0),
(1994, 1990, 'RF1989', NULL, 1989, 1, 0, 0, 0, 0, 0),
(1995, 1991, 'RF1990', NULL, 1990, 1, 0, 0, 0, 0, 0),
(1996, 1992, 'RF1991', NULL, 1991, 1, 0, 0, 0, 0, 0),
(1997, 1993, 'RF1992', NULL, 1992, 1, 0, 0, 0, 0, 0),
(1998, 1994, 'RF1993', NULL, 1993, 1, 0, 0, 0, 0, 0),
(1999, 1995, 'RF1994', NULL, 1994, 1, 0, 0, 0, 0, 0),
(2000, 1996, 'RF1995', NULL, 1995, 1, 0, 0, 0, 0, 0);
INSERT INTO `cms_visitmaster` (`id`, `visit_code`, `visit_name`, `visit_interval`, `visit_order`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(2001, 1997, 'RF1996', NULL, 1996, 1, 0, 0, 0, 0, 0),
(2002, 1998, 'RF1997', NULL, 1997, 1, 0, 0, 0, 0, 0),
(2003, 1999, 'RF1998', NULL, 1998, 1, 0, 0, 0, 0, 0),
(2004, 2000, 'RF1999', NULL, 1999, 1, 0, 0, 0, 0, 0),
(2005, 2001, 'RF2000', NULL, 2000, 1, 0, 0, 0, 0, 0),
(2006, 2002, 'RF2001', NULL, 2001, 1, 0, 0, 0, 0, 0),
(2007, 2003, 'RF2002', NULL, 2002, 1, 0, 0, 0, 0, 0),
(2008, 2004, 'RF2003', NULL, 2003, 1, 0, 0, 0, 0, 0),
(2009, 2005, 'RF2004', NULL, 2004, 1, 0, 0, 0, 0, 0),
(2010, 2006, 'RF2005', NULL, 2005, 1, 0, 0, 0, 0, 0),
(2011, 2007, 'RF2006', NULL, 2006, 1, 0, 0, 0, 0, 0),
(2012, 2008, 'RF2007', NULL, 2007, 1, 0, 0, 0, 0, 0),
(2013, 2009, 'RF2008', NULL, 2008, 1, 0, 0, 0, 0, 0),
(2014, 2010, 'RF2009', NULL, 2009, 1, 0, 0, 0, 0, 0),
(2015, 2011, 'RF2010', NULL, 2010, 1, 0, 0, 0, 0, 0),
(2016, 2012, 'RF2011', NULL, 2011, 1, 0, 0, 0, 0, 0),
(2017, 2013, 'RF2012', NULL, 2012, 1, 0, 0, 0, 0, 0),
(2018, 2014, 'RF2013', NULL, 2013, 1, 0, 0, 0, 0, 0),
(2019, 2015, 'RF2014', NULL, 2014, 1, 0, 0, 0, 0, 0),
(2020, 2016, 'RF2015', NULL, 2015, 1, 0, 0, 0, 0, 0),
(2021, 2017, 'RF2016', NULL, 2016, 1, 0, 0, 0, 0, 0),
(2022, 2018, 'RF2017', NULL, 2017, 1, 0, 0, 0, 0, 0),
(2023, 2019, 'RF2018', NULL, 2018, 1, 0, 0, 0, 0, 0),
(2024, 2020, 'RF2019', NULL, 2019, 1, 0, 0, 0, 0, 0),
(2025, 2021, 'RF2020', NULL, 2020, 1, 0, 0, 0, 0, 0),
(2026, 2022, 'RF2021', NULL, 2021, 1, 0, 0, 0, 0, 0),
(2027, 2023, 'RF2022', NULL, 2022, 1, 0, 0, 0, 0, 0),
(2028, 2024, 'RF2023', NULL, 2023, 1, 0, 0, 0, 0, 0),
(2029, 2025, 'RF2024', NULL, 2024, 1, 0, 0, 0, 0, 0),
(2030, 2026, 'RF2025', NULL, 2025, 1, 0, 0, 0, 0, 0),
(2031, 2027, 'RF2026', NULL, 2026, 1, 0, 0, 0, 0, 0),
(2032, 2028, 'RF2027', NULL, 2027, 1, 0, 0, 0, 0, 0),
(2033, 2029, 'RF2028', NULL, 2028, 1, 0, 0, 0, 0, 0),
(2034, 2030, 'RF2029', NULL, 2029, 1, 0, 0, 0, 0, 0),
(2035, 2031, 'RF2030', NULL, 2030, 1, 0, 0, 0, 0, 0),
(2036, 2032, 'RF2031', NULL, 2031, 1, 0, 0, 0, 0, 0),
(2037, 2033, 'RF2032', NULL, 2032, 1, 0, 0, 0, 0, 0),
(2038, 2034, 'RF2033', NULL, 2033, 1, 0, 0, 0, 0, 0),
(2039, 2035, 'RF2034', NULL, 2034, 1, 0, 0, 0, 0, 0),
(2040, 2036, 'RF2035', NULL, 2035, 1, 0, 0, 0, 0, 0),
(2041, 2037, 'RF2036', NULL, 2036, 1, 0, 0, 0, 0, 0),
(2042, 2038, 'RF2037', NULL, 2037, 1, 0, 0, 0, 0, 0),
(2043, 2039, 'RF2038', NULL, 2038, 1, 0, 0, 0, 0, 0),
(2044, 2040, 'RF2039', NULL, 2039, 1, 0, 0, 0, 0, 0),
(2045, 2041, 'RF2040', NULL, 2040, 1, 0, 0, 0, 0, 0),
(2046, 2042, 'RF2041', NULL, 2041, 1, 0, 0, 0, 0, 0),
(2047, 2043, 'RF2042', NULL, 2042, 1, 0, 0, 0, 0, 0),
(2048, 2044, 'RF2043', NULL, 2043, 1, 0, 0, 0, 0, 0),
(2049, 2045, 'RF2044', NULL, 2044, 1, 0, 0, 0, 0, 0),
(2050, 2046, 'RF2045', NULL, 2045, 1, 0, 0, 0, 0, 0),
(2051, 2047, 'RF2046', NULL, 2046, 1, 0, 0, 0, 0, 0),
(2052, 2048, 'RF2047', NULL, 2047, 1, 0, 0, 0, 0, 0),
(2053, 2049, 'RF2048', NULL, 2048, 1, 0, 0, 0, 0, 0),
(2054, 2050, 'RF2049', NULL, 2049, 1, 0, 0, 0, 0, 0),
(2055, 2051, 'RF2050', NULL, 2050, 1, 0, 0, 0, 0, 0),
(2056, 2052, 'RF2051', NULL, 2051, 1, 0, 0, 0, 0, 0),
(2057, 2053, 'RF2052', NULL, 2052, 1, 0, 0, 0, 0, 0),
(2058, 2054, 'RF2053', NULL, 2053, 1, 0, 0, 0, 0, 0),
(2059, 2055, 'RF2054', NULL, 2054, 1, 0, 0, 0, 0, 0),
(2060, 2056, 'RF2055', NULL, 2055, 1, 0, 0, 0, 0, 0),
(2061, 2057, 'RF2056', NULL, 2056, 1, 0, 0, 0, 0, 0),
(2062, 2058, 'RF2057', NULL, 2057, 1, 0, 0, 0, 0, 0),
(2063, 2059, 'RF2058', NULL, 2058, 1, 0, 0, 0, 0, 0),
(2064, 2060, 'RF2059', NULL, 2059, 1, 0, 0, 0, 0, 0),
(2065, 2061, 'RF2060', NULL, 2060, 1, 0, 0, 0, 0, 0),
(2066, 2062, 'RF2061', NULL, 2061, 1, 0, 0, 0, 0, 0),
(2067, 2063, 'RF2062', NULL, 2062, 1, 0, 0, 0, 0, 0),
(2068, 2064, 'RF2063', NULL, 2063, 1, 0, 0, 0, 0, 0),
(2069, 2065, 'RF2064', NULL, 2064, 1, 0, 0, 0, 0, 0),
(2070, 2066, 'RF2065', NULL, 2065, 1, 0, 0, 0, 0, 0),
(2071, 2067, 'RF2066', NULL, 2066, 1, 0, 0, 0, 0, 0),
(2072, 2068, 'RF2067', NULL, 2067, 1, 0, 0, 0, 0, 0),
(2073, 2069, 'RF2068', NULL, 2068, 1, 0, 0, 0, 0, 0),
(2074, 2070, 'RF2069', NULL, 2069, 1, 0, 0, 0, 0, 0),
(2075, 2071, 'RF2070', NULL, 2070, 1, 0, 0, 0, 0, 0),
(2076, 2072, 'RF2071', NULL, 2071, 1, 0, 0, 0, 0, 0),
(2077, 2073, 'RF2072', NULL, 2072, 1, 0, 0, 0, 0, 0),
(2078, 2074, 'RF2073', NULL, 2073, 1, 0, 0, 0, 0, 0),
(2079, 2075, 'RF2074', NULL, 2074, 1, 0, 0, 0, 0, 0),
(2080, 2076, 'RF2075', NULL, 2075, 1, 0, 0, 0, 0, 0),
(2081, 2077, 'RF2076', NULL, 2076, 1, 0, 0, 0, 0, 0),
(2082, 2078, 'RF2077', NULL, 2077, 1, 0, 0, 0, 0, 0),
(2083, 2079, 'RF2078', NULL, 2078, 1, 0, 0, 0, 0, 0),
(2084, 2080, 'RF2079', NULL, 2079, 1, 0, 0, 0, 0, 0),
(2085, 2081, 'RF2080', NULL, 2080, 1, 0, 0, 0, 0, 0),
(2086, 2082, 'RF2081', NULL, 2081, 1, 0, 0, 0, 0, 0),
(2087, 2083, 'RF2082', NULL, 2082, 1, 0, 0, 0, 0, 0),
(2088, 2084, 'RF2083', NULL, 2083, 1, 0, 0, 0, 0, 0),
(2089, 2085, 'RF2084', NULL, 2084, 1, 0, 0, 0, 0, 0),
(2090, 2086, 'RF2085', NULL, 2085, 1, 0, 0, 0, 0, 0),
(2091, 2087, 'RF2086', NULL, 2086, 1, 0, 0, 0, 0, 0),
(2092, 2088, 'RF2087', NULL, 2087, 1, 0, 0, 0, 0, 0),
(2093, 2089, 'RF2088', NULL, 2088, 1, 0, 0, 0, 0, 0),
(2094, 2090, 'RF2089', NULL, 2089, 1, 0, 0, 0, 0, 0),
(2095, 2091, 'RF2090', NULL, 2090, 1, 0, 0, 0, 0, 0),
(2096, 2092, 'RF2091', NULL, 2091, 1, 0, 0, 0, 0, 0),
(2097, 2093, 'RF2092', NULL, 2092, 1, 0, 0, 0, 0, 0),
(2098, 2094, 'RF2093', NULL, 2093, 1, 0, 0, 0, 0, 0),
(2099, 2095, 'RF2094', NULL, 2094, 1, 0, 0, 0, 0, 0),
(2100, 2096, 'RF2095', NULL, 2095, 1, 0, 0, 0, 0, 0),
(2101, 2097, 'RF2096', NULL, 2096, 1, 0, 0, 0, 0, 0),
(2102, 2098, 'RF2097', NULL, 2097, 1, 0, 0, 0, 0, 0),
(2103, 2099, 'RF2098', NULL, 2098, 1, 0, 0, 0, 0, 0),
(2104, 2100, 'RF2099', NULL, 2099, 1, 0, 0, 0, 0, 0),
(2105, 2101, 'RF2100', NULL, 2100, 1, 0, 0, 0, 0, 0),
(2106, 2102, 'RF2101', NULL, 2101, 1, 0, 0, 0, 0, 0),
(2107, 2103, 'RF2102', NULL, 2102, 1, 0, 0, 0, 0, 0),
(2108, 2104, 'RF2103', NULL, 2103, 1, 0, 0, 0, 0, 0),
(2109, 2105, 'RF2104', NULL, 2104, 1, 0, 0, 0, 0, 0),
(2110, 2106, 'RF2105', NULL, 2105, 1, 0, 0, 0, 0, 0),
(2111, 2107, 'RF2106', NULL, 2106, 1, 0, 0, 0, 0, 0),
(2112, 2108, 'RF2107', NULL, 2107, 1, 0, 0, 0, 0, 0),
(2113, 2109, 'RF2108', NULL, 2108, 1, 0, 0, 0, 0, 0),
(2114, 2110, 'RF2109', NULL, 2109, 1, 0, 0, 0, 0, 0),
(2115, 2111, 'RF2110', NULL, 2110, 1, 0, 0, 0, 0, 0),
(2116, 2112, 'RF2111', NULL, 2111, 1, 0, 0, 0, 0, 0),
(2117, 2113, 'RF2112', NULL, 2112, 1, 0, 0, 0, 0, 0),
(2118, 2114, 'RF2113', NULL, 2113, 1, 0, 0, 0, 0, 0),
(2119, 2115, 'RF2114', NULL, 2114, 1, 0, 0, 0, 0, 0),
(2120, 2116, 'RF2115', NULL, 2115, 1, 0, 0, 0, 0, 0),
(2121, 2117, 'RF2116', NULL, 2116, 1, 0, 0, 0, 0, 0),
(2122, 2118, 'RF2117', NULL, 2117, 1, 0, 0, 0, 0, 0),
(2123, 2119, 'RF2118', NULL, 2118, 1, 0, 0, 0, 0, 0),
(2124, 2120, 'RF2119', NULL, 2119, 1, 0, 0, 0, 0, 0),
(2125, 2121, 'RF2120', NULL, 2120, 1, 0, 0, 0, 0, 0),
(2126, 2122, 'RF2121', NULL, 2121, 1, 0, 0, 0, 0, 0),
(2127, 2123, 'RF2122', NULL, 2122, 1, 0, 0, 0, 0, 0),
(2128, 2124, 'RF2123', NULL, 2123, 1, 0, 0, 0, 0, 0),
(2129, 2125, 'RF2124', NULL, 2124, 1, 0, 0, 0, 0, 0),
(2130, 2126, 'RF2125', NULL, 2125, 1, 0, 0, 0, 0, 0),
(2131, 2127, 'RF2126', NULL, 2126, 1, 0, 0, 0, 0, 0),
(2132, 2128, 'RF2127', NULL, 2127, 1, 0, 0, 0, 0, 0),
(2133, 2129, 'RF2128', NULL, 2128, 1, 0, 0, 0, 0, 0),
(2134, 2130, 'RF2129', NULL, 2129, 1, 0, 0, 0, 0, 0),
(2135, 2131, 'RF2130', NULL, 2130, 1, 0, 0, 0, 0, 0),
(2136, 2132, 'RF2131', NULL, 2131, 1, 0, 0, 0, 0, 0),
(2137, 2133, 'RF2132', NULL, 2132, 1, 0, 0, 0, 0, 0),
(2138, 2134, 'RF2133', NULL, 2133, 1, 0, 0, 0, 0, 0),
(2139, 2135, 'RF2134', NULL, 2134, 1, 0, 0, 0, 0, 0),
(2140, 2136, 'RF2135', NULL, 2135, 1, 0, 0, 0, 0, 0),
(2141, 2137, 'RF2136', NULL, 2136, 1, 0, 0, 0, 0, 0),
(2142, 2138, 'RF2137', NULL, 2137, 1, 0, 0, 0, 0, 0),
(2143, 2139, 'RF2138', NULL, 2138, 1, 0, 0, 0, 0, 0),
(2144, 2140, 'RF2139', NULL, 2139, 1, 0, 0, 0, 0, 0),
(2145, 2141, 'RF2140', NULL, 2140, 1, 0, 0, 0, 0, 0),
(2146, 2142, 'RF2141', NULL, 2141, 1, 0, 0, 0, 0, 0),
(2147, 2143, 'RF2142', NULL, 2142, 1, 0, 0, 0, 0, 0),
(2148, 2144, 'RF2143', NULL, 2143, 1, 0, 0, 0, 0, 0),
(2149, 2145, 'RF2144', NULL, 2144, 1, 0, 0, 0, 0, 0),
(2150, 2146, 'RF2145', NULL, 2145, 1, 0, 0, 0, 0, 0),
(2151, 2147, 'RF2146', NULL, 2146, 1, 0, 0, 0, 0, 0),
(2152, 2148, 'RF2147', NULL, 2147, 1, 0, 0, 0, 0, 0),
(2153, 2149, 'RF2148', NULL, 2148, 1, 0, 0, 0, 0, 0),
(2154, 2150, 'RF2149', NULL, 2149, 1, 0, 0, 0, 0, 0),
(2155, 2151, 'RF2150', NULL, 2150, 1, 0, 0, 0, 0, 0),
(2156, 2152, 'RF2151', NULL, 2151, 1, 0, 0, 0, 0, 0),
(2157, 2153, 'RF2152', NULL, 2152, 1, 0, 0, 0, 0, 0),
(2158, 2154, 'RF2153', NULL, 2153, 1, 0, 0, 0, 0, 0),
(2159, 2155, 'RF2154', NULL, 2154, 1, 0, 0, 0, 0, 0),
(2160, 2156, 'RF2155', NULL, 2155, 1, 0, 0, 0, 0, 0),
(2161, 2157, 'RF2156', NULL, 2156, 1, 0, 0, 0, 0, 0),
(2162, 2158, 'RF2157', NULL, 2157, 1, 0, 0, 0, 0, 0),
(2163, 2159, 'RF2158', NULL, 2158, 1, 0, 0, 0, 0, 0),
(2164, 2160, 'RF2159', NULL, 2159, 1, 0, 0, 0, 0, 0),
(2165, 2161, 'RF2160', NULL, 2160, 1, 0, 0, 0, 0, 0),
(2166, 2162, 'RF2161', NULL, 2161, 1, 0, 0, 0, 0, 0),
(2167, 2163, 'RF2162', NULL, 2162, 1, 0, 0, 0, 0, 0),
(2168, 2164, 'RF2163', NULL, 2163, 1, 0, 0, 0, 0, 0),
(2169, 2165, 'RF2164', NULL, 2164, 1, 0, 0, 0, 0, 0),
(2170, 2166, 'RF2165', NULL, 2165, 1, 0, 0, 0, 0, 0),
(2171, 2167, 'RF2166', NULL, 2166, 1, 0, 0, 0, 0, 0),
(2172, 2168, 'RF2167', NULL, 2167, 1, 0, 0, 0, 0, 0),
(2173, 2169, 'RF2168', NULL, 2168, 1, 0, 0, 0, 0, 0),
(2174, 2170, 'RF2169', NULL, 2169, 1, 0, 0, 0, 0, 0),
(2175, 2171, 'RF2170', NULL, 2170, 1, 0, 0, 0, 0, 0),
(2176, 2172, 'RF2171', NULL, 2171, 1, 0, 0, 0, 0, 0),
(2177, 2173, 'RF2172', NULL, 2172, 1, 0, 0, 0, 0, 0),
(2178, 2174, 'RF2173', NULL, 2173, 1, 0, 0, 0, 0, 0),
(2179, 2175, 'RF2174', NULL, 2174, 1, 0, 0, 0, 0, 0),
(2180, 2176, 'RF2175', NULL, 2175, 1, 0, 0, 0, 0, 0),
(2181, 2177, 'RF2176', NULL, 2176, 1, 0, 0, 0, 0, 0),
(2182, 2178, 'RF2177', NULL, 2177, 1, 0, 0, 0, 0, 0),
(2183, 2179, 'RF2178', NULL, 2178, 1, 0, 0, 0, 0, 0),
(2184, 2180, 'RF2179', NULL, 2179, 1, 0, 0, 0, 0, 0),
(2185, 2181, 'RF2180', NULL, 2180, 1, 0, 0, 0, 0, 0),
(2186, 2182, 'RF2181', NULL, 2181, 1, 0, 0, 0, 0, 0),
(2187, 2183, 'RF2182', NULL, 2182, 1, 0, 0, 0, 0, 0),
(2188, 2184, 'RF2183', NULL, 2183, 1, 0, 0, 0, 0, 0),
(2189, 2185, 'RF2184', NULL, 2184, 1, 0, 0, 0, 0, 0),
(2190, 2186, 'RF2185', NULL, 2185, 1, 0, 0, 0, 0, 0),
(2191, 2187, 'RF2186', NULL, 2186, 1, 0, 0, 0, 0, 0),
(2192, 2188, 'RF2187', NULL, 2187, 1, 0, 0, 0, 0, 0),
(2193, 2189, 'RF2188', NULL, 2188, 1, 0, 0, 0, 0, 0),
(2194, 2190, 'RF2189', NULL, 2189, 1, 0, 0, 0, 0, 0),
(2195, 2191, 'RF2190', NULL, 2190, 1, 0, 0, 0, 0, 0),
(2196, 2192, 'RF2191', NULL, 2191, 1, 0, 0, 0, 0, 0),
(2197, 2193, 'RF2192', NULL, 2192, 1, 0, 0, 0, 0, 0),
(2198, 2194, 'RF2193', NULL, 2193, 1, 0, 0, 0, 0, 0),
(2199, 2195, 'RF2194', NULL, 2194, 1, 0, 0, 0, 0, 0),
(2200, 2196, 'RF2195', NULL, 2195, 1, 0, 0, 0, 0, 0),
(2201, 2197, 'RF2196', NULL, 2196, 1, 0, 0, 0, 0, 0),
(2202, 2198, 'RF2197', NULL, 2197, 1, 0, 0, 0, 0, 0),
(2203, 2199, 'RF2198', NULL, 2198, 1, 0, 0, 0, 0, 0),
(2204, 2200, 'RF2199', NULL, 2199, 1, 0, 0, 0, 0, 0),
(2205, 2201, 'RF2200', NULL, 2200, 1, 0, 0, 0, 0, 0),
(2206, 2202, 'RF2201', NULL, 2201, 1, 0, 0, 0, 0, 0),
(2207, 2203, 'RF2202', NULL, 2202, 1, 0, 0, 0, 0, 0),
(2208, 2204, 'RF2203', NULL, 2203, 1, 0, 0, 0, 0, 0),
(2209, 2205, 'RF2204', NULL, 2204, 1, 0, 0, 0, 0, 0),
(2210, 2206, 'RF2205', NULL, 2205, 1, 0, 0, 0, 0, 0),
(2211, 2207, 'RF2206', NULL, 2206, 1, 0, 0, 0, 0, 0),
(2212, 2208, 'RF2207', NULL, 2207, 1, 0, 0, 0, 0, 0),
(2213, 2209, 'RF2208', NULL, 2208, 1, 0, 0, 0, 0, 0),
(2214, 2210, 'RF2209', NULL, 2209, 1, 0, 0, 0, 0, 0),
(2215, 2211, 'RF2210', NULL, 2210, 1, 0, 0, 0, 0, 0),
(2216, 2212, 'RF2211', NULL, 2211, 1, 0, 0, 0, 0, 0),
(2217, 2213, 'RF2212', NULL, 2212, 1, 0, 0, 0, 0, 0),
(2218, 2214, 'RF2213', NULL, 2213, 1, 0, 0, 0, 0, 0),
(2219, 2215, 'RF2214', NULL, 2214, 1, 0, 0, 0, 0, 0),
(2220, 2216, 'RF2215', NULL, 2215, 1, 0, 0, 0, 0, 0),
(2221, 2217, 'RF2216', NULL, 2216, 1, 0, 0, 0, 0, 0),
(2222, 2218, 'RF2217', NULL, 2217, 1, 0, 0, 0, 0, 0),
(2223, 2219, 'RF2218', NULL, 2218, 1, 0, 0, 0, 0, 0),
(2224, 2220, 'RF2219', NULL, 2219, 1, 0, 0, 0, 0, 0),
(2225, 2221, 'RF2220', NULL, 2220, 1, 0, 0, 0, 0, 0),
(2226, 2222, 'RF2221', NULL, 2221, 1, 0, 0, 0, 0, 0),
(2227, 2223, 'RF2222', NULL, 2222, 1, 0, 0, 0, 0, 0),
(2228, 2224, 'RF2223', NULL, 2223, 1, 0, 0, 0, 0, 0),
(2229, 2225, 'RF2224', NULL, 2224, 1, 0, 0, 0, 0, 0),
(2230, 2226, 'RF2225', NULL, 2225, 1, 0, 0, 0, 0, 0),
(2231, 2227, 'RF2226', NULL, 2226, 1, 0, 0, 0, 0, 0),
(2232, 2228, 'RF2227', NULL, 2227, 1, 0, 0, 0, 0, 0),
(2233, 2229, 'RF2228', NULL, 2228, 1, 0, 0, 0, 0, 0),
(2234, 2230, 'RF2229', NULL, 2229, 1, 0, 0, 0, 0, 0),
(2235, 2231, 'RF2230', NULL, 2230, 1, 0, 0, 0, 0, 0),
(2236, 2232, 'RF2231', NULL, 2231, 1, 0, 0, 0, 0, 0),
(2237, 2233, 'RF2232', NULL, 2232, 1, 0, 0, 0, 0, 0),
(2238, 2234, 'RF2233', NULL, 2233, 1, 0, 0, 0, 0, 0),
(2239, 2235, 'RF2234', NULL, 2234, 1, 0, 0, 0, 0, 0),
(2240, 2236, 'RF2235', NULL, 2235, 1, 0, 0, 0, 0, 0),
(2241, 2237, 'RF2236', NULL, 2236, 1, 0, 0, 0, 0, 0),
(2242, 2238, 'RF2237', NULL, 2237, 1, 0, 0, 0, 0, 0),
(2243, 2239, 'RF2238', NULL, 2238, 1, 0, 0, 0, 0, 0),
(2244, 2240, 'RF2239', NULL, 2239, 1, 0, 0, 0, 0, 0),
(2245, 2241, 'RF2240', NULL, 2240, 1, 0, 0, 0, 0, 0),
(2246, 2242, 'RF2241', NULL, 2241, 1, 0, 0, 0, 0, 0),
(2247, 2243, 'RF2242', NULL, 2242, 1, 0, 0, 0, 0, 0),
(2248, 2244, 'RF2243', NULL, 2243, 1, 0, 0, 0, 0, 0),
(2249, 2245, 'RF2244', NULL, 2244, 1, 0, 0, 0, 0, 0),
(2250, 2246, 'RF2245', NULL, 2245, 1, 0, 0, 0, 0, 0),
(2251, 2247, 'RF2246', NULL, 2246, 1, 0, 0, 0, 0, 0),
(2252, 2248, 'RF2247', NULL, 2247, 1, 0, 0, 0, 0, 0),
(2253, 2249, 'RF2248', NULL, 2248, 1, 0, 0, 0, 0, 0),
(2254, 2250, 'RF2249', NULL, 2249, 1, 0, 0, 0, 0, 0),
(2255, 2251, 'RF2250', NULL, 2250, 1, 0, 0, 0, 0, 0),
(2256, 2252, 'RF2251', NULL, 2251, 1, 0, 0, 0, 0, 0),
(2257, 2253, 'RF2252', NULL, 2252, 1, 0, 0, 0, 0, 0),
(2258, 2254, 'RF2253', NULL, 2253, 1, 0, 0, 0, 0, 0),
(2259, 2255, 'RF2254', NULL, 2254, 1, 0, 0, 0, 0, 0),
(2260, 2256, 'RF2255', NULL, 2255, 1, 0, 0, 0, 0, 0),
(2261, 2257, 'RF2256', NULL, 2256, 1, 0, 0, 0, 0, 0),
(2262, 2258, 'RF2257', NULL, 2257, 1, 0, 0, 0, 0, 0),
(2263, 2259, 'RF2258', NULL, 2258, 1, 0, 0, 0, 0, 0),
(2264, 2260, 'RF2259', NULL, 2259, 1, 0, 0, 0, 0, 0),
(2265, 2261, 'RF2260', NULL, 2260, 1, 0, 0, 0, 0, 0),
(2266, 2262, 'RF2261', NULL, 2261, 1, 0, 0, 0, 0, 0),
(2267, 2263, 'RF2262', NULL, 2262, 1, 0, 0, 0, 0, 0),
(2268, 2264, 'RF2263', NULL, 2263, 1, 0, 0, 0, 0, 0),
(2269, 2265, 'RF2264', NULL, 2264, 1, 0, 0, 0, 0, 0),
(2270, 2266, 'RF2265', NULL, 2265, 1, 0, 0, 0, 0, 0),
(2271, 2267, 'RF2266', NULL, 2266, 1, 0, 0, 0, 0, 0),
(2272, 2268, 'RF2267', NULL, 2267, 1, 0, 0, 0, 0, 0),
(2273, 2269, 'RF2268', NULL, 2268, 1, 0, 0, 0, 0, 0),
(2274, 2270, 'RF2269', NULL, 2269, 1, 0, 0, 0, 0, 0),
(2275, 2271, 'RF2270', NULL, 2270, 1, 0, 0, 0, 0, 0),
(2276, 2272, 'RF2271', NULL, 2271, 1, 0, 0, 0, 0, 0),
(2277, 2273, 'RF2272', NULL, 2272, 1, 0, 0, 0, 0, 0),
(2278, 2274, 'RF2273', NULL, 2273, 1, 0, 0, 0, 0, 0),
(2279, 2275, 'RF2274', NULL, 2274, 1, 0, 0, 0, 0, 0),
(2280, 2276, 'RF2275', NULL, 2275, 1, 0, 0, 0, 0, 0),
(2281, 2277, 'RF2276', NULL, 2276, 1, 0, 0, 0, 0, 0),
(2282, 2278, 'RF2277', NULL, 2277, 1, 0, 0, 0, 0, 0),
(2283, 2279, 'RF2278', NULL, 2278, 1, 0, 0, 0, 0, 0),
(2284, 2280, 'RF2279', NULL, 2279, 1, 0, 0, 0, 0, 0),
(2285, 2281, 'RF2280', NULL, 2280, 1, 0, 0, 0, 0, 0),
(2286, 2282, 'RF2281', NULL, 2281, 1, 0, 0, 0, 0, 0),
(2287, 2283, 'RF2282', NULL, 2282, 1, 0, 0, 0, 0, 0),
(2288, 2284, 'RF2283', NULL, 2283, 1, 0, 0, 0, 0, 0),
(2289, 2285, 'RF2284', NULL, 2284, 1, 0, 0, 0, 0, 0),
(2290, 2286, 'RF2285', NULL, 2285, 1, 0, 0, 0, 0, 0),
(2291, 2287, 'RF2286', NULL, 2286, 1, 0, 0, 0, 0, 0),
(2292, 2288, 'RF2287', NULL, 2287, 1, 0, 0, 0, 0, 0),
(2293, 2289, 'RF2288', NULL, 2288, 1, 0, 0, 0, 0, 0),
(2294, 2290, 'RF2289', NULL, 2289, 1, 0, 0, 0, 0, 0),
(2295, 2291, 'RF2290', NULL, 2290, 1, 0, 0, 0, 0, 0),
(2296, 2292, 'RF2291', NULL, 2291, 1, 0, 0, 0, 0, 0),
(2297, 2293, 'RF2292', NULL, 2292, 1, 0, 0, 0, 0, 0),
(2298, 2294, 'RF2293', NULL, 2293, 1, 0, 0, 0, 0, 0),
(2299, 2295, 'RF2294', NULL, 2294, 1, 0, 0, 0, 0, 0),
(2300, 2296, 'RF2295', NULL, 2295, 1, 0, 0, 0, 0, 0),
(2301, 2297, 'RF2296', NULL, 2296, 1, 0, 0, 0, 0, 0),
(2302, 2298, 'RF2297', NULL, 2297, 1, 0, 0, 0, 0, 0),
(2303, 2299, 'RF2298', NULL, 2298, 1, 0, 0, 0, 0, 0),
(2304, 2300, 'RF2299', NULL, 2299, 1, 0, 0, 0, 0, 0),
(2305, 2301, 'RF2300', NULL, 2300, 1, 0, 0, 0, 0, 0),
(2306, 2302, 'RF2301', NULL, 2301, 1, 0, 0, 0, 0, 0),
(2307, 2303, 'RF2302', NULL, 2302, 1, 0, 0, 0, 0, 0),
(2308, 2304, 'RF2303', NULL, 2303, 1, 0, 0, 0, 0, 0),
(2309, 2305, 'RF2304', NULL, 2304, 1, 0, 0, 0, 0, 0),
(2310, 2306, 'RF2305', NULL, 2305, 1, 0, 0, 0, 0, 0),
(2311, 2307, 'RF2306', NULL, 2306, 1, 0, 0, 0, 0, 0),
(2312, 2308, 'RF2307', NULL, 2307, 1, 0, 0, 0, 0, 0),
(2313, 2309, 'RF2308', NULL, 2308, 1, 0, 0, 0, 0, 0),
(2314, 2310, 'RF2309', NULL, 2309, 1, 0, 0, 0, 0, 0),
(2315, 2311, 'RF2310', NULL, 2310, 1, 0, 0, 0, 0, 0),
(2316, 2312, 'RF2311', NULL, 2311, 1, 0, 0, 0, 0, 0),
(2317, 2313, 'RF2312', NULL, 2312, 1, 0, 0, 0, 0, 0),
(2318, 2314, 'RF2313', NULL, 2313, 1, 0, 0, 0, 0, 0),
(2319, 2315, 'RF2314', NULL, 2314, 1, 0, 0, 0, 0, 0),
(2320, 2316, 'RF2315', NULL, 2315, 1, 0, 0, 0, 0, 0),
(2321, 2317, 'RF2316', NULL, 2316, 1, 0, 0, 0, 0, 0),
(2322, 2318, 'RF2317', NULL, 2317, 1, 0, 0, 0, 0, 0),
(2323, 2319, 'RF2318', NULL, 2318, 1, 0, 0, 0, 0, 0),
(2324, 2320, 'RF2319', NULL, 2319, 1, 0, 0, 0, 0, 0),
(2325, 2321, 'RF2320', NULL, 2320, 1, 0, 0, 0, 0, 0),
(2326, 2322, 'RF2321', NULL, 2321, 1, 0, 0, 0, 0, 0),
(2327, 2323, 'RF2322', NULL, 2322, 1, 0, 0, 0, 0, 0),
(2328, 2324, 'RF2323', NULL, 2323, 1, 0, 0, 0, 0, 0),
(2329, 2325, 'RF2324', NULL, 2324, 1, 0, 0, 0, 0, 0),
(2330, 2326, 'RF2325', NULL, 2325, 1, 0, 0, 0, 0, 0),
(2331, 2327, 'RF2326', NULL, 2326, 1, 0, 0, 0, 0, 0),
(2332, 2328, 'RF2327', NULL, 2327, 1, 0, 0, 0, 0, 0),
(2333, 2329, 'RF2328', NULL, 2328, 1, 0, 0, 0, 0, 0),
(2334, 2330, 'RF2329', NULL, 2329, 1, 0, 0, 0, 0, 0),
(2335, 2331, 'RF2330', NULL, 2330, 1, 0, 0, 0, 0, 0),
(2336, 2332, 'RF2331', NULL, 2331, 1, 0, 0, 0, 0, 0),
(2337, 2333, 'RF2332', NULL, 2332, 1, 0, 0, 0, 0, 0),
(2338, 2334, 'RF2333', NULL, 2333, 1, 0, 0, 0, 0, 0),
(2339, 2335, 'RF2334', NULL, 2334, 1, 0, 0, 0, 0, 0),
(2340, 2336, 'RF2335', NULL, 2335, 1, 0, 0, 0, 0, 0),
(2341, 2337, 'RF2336', NULL, 2336, 1, 0, 0, 0, 0, 0),
(2342, 2338, 'RF2337', NULL, 2337, 1, 0, 0, 0, 0, 0),
(2343, 2339, 'RF2338', NULL, 2338, 1, 0, 0, 0, 0, 0),
(2344, 2340, 'RF2339', NULL, 2339, 1, 0, 0, 0, 0, 0),
(2345, 2341, 'RF2340', NULL, 2340, 1, 0, 0, 0, 0, 0),
(2346, 2342, 'RF2341', NULL, 2341, 1, 0, 0, 0, 0, 0),
(2347, 2343, 'RF2342', NULL, 2342, 1, 0, 0, 0, 0, 0),
(2348, 2344, 'RF2343', NULL, 2343, 1, 0, 0, 0, 0, 0),
(2349, 2345, 'RF2344', NULL, 2344, 1, 0, 0, 0, 0, 0),
(2350, 2346, 'RF2345', NULL, 2345, 1, 0, 0, 0, 0, 0),
(2351, 2347, 'RF2346', NULL, 2346, 1, 0, 0, 0, 0, 0),
(2352, 2348, 'RF2347', NULL, 2347, 1, 0, 0, 0, 0, 0),
(2353, 2349, 'RF2348', NULL, 2348, 1, 0, 0, 0, 0, 0),
(2354, 2350, 'RF2349', NULL, 2349, 1, 0, 0, 0, 0, 0),
(2355, 2351, 'RF2350', NULL, 2350, 1, 0, 0, 0, 0, 0),
(2356, 2352, 'RF2351', NULL, 2351, 1, 0, 0, 0, 0, 0),
(2357, 2353, 'RF2352', NULL, 2352, 1, 0, 0, 0, 0, 0),
(2358, 2354, 'RF2353', NULL, 2353, 1, 0, 0, 0, 0, 0),
(2359, 2355, 'RF2354', NULL, 2354, 1, 0, 0, 0, 0, 0),
(2360, 2356, 'RF2355', NULL, 2355, 1, 0, 0, 0, 0, 0),
(2361, 2357, 'RF2356', NULL, 2356, 1, 0, 0, 0, 0, 0),
(2362, 2358, 'RF2357', NULL, 2357, 1, 0, 0, 0, 0, 0),
(2363, 2359, 'RF2358', NULL, 2358, 1, 0, 0, 0, 0, 0),
(2364, 2360, 'RF2359', NULL, 2359, 1, 0, 0, 0, 0, 0),
(2365, 2361, 'RF2360', NULL, 2360, 1, 0, 0, 0, 0, 0),
(2366, 2362, 'RF2361', NULL, 2361, 1, 0, 0, 0, 0, 0),
(2367, 2363, 'RF2362', NULL, 2362, 1, 0, 0, 0, 0, 0),
(2368, 2364, 'RF2363', NULL, 2363, 1, 0, 0, 0, 0, 0),
(2369, 2365, 'RF2364', NULL, 2364, 1, 0, 0, 0, 0, 0),
(2370, 2366, 'RF2365', NULL, 2365, 1, 0, 0, 0, 0, 0),
(2371, 2367, 'RF2366', NULL, 2366, 1, 0, 0, 0, 0, 0),
(2372, 2368, 'RF2367', NULL, 2367, 1, 0, 0, 0, 0, 0),
(2373, 2369, 'RF2368', NULL, 2368, 1, 0, 0, 0, 0, 0),
(2374, 2370, 'RF2369', NULL, 2369, 1, 0, 0, 0, 0, 0),
(2375, 2371, 'RF2370', NULL, 2370, 1, 0, 0, 0, 0, 0),
(2376, 2372, 'RF2371', NULL, 2371, 1, 0, 0, 0, 0, 0),
(2377, 2373, 'RF2372', NULL, 2372, 1, 0, 0, 0, 0, 0),
(2378, 2374, 'RF2373', NULL, 2373, 1, 0, 0, 0, 0, 0),
(2379, 2375, 'RF2374', NULL, 2374, 1, 0, 0, 0, 0, 0),
(2380, 2376, 'RF2375', NULL, 2375, 1, 0, 0, 0, 0, 0),
(2381, 2377, 'RF2376', NULL, 2376, 1, 0, 0, 0, 0, 0),
(2382, 2378, 'RF2377', NULL, 2377, 1, 0, 0, 0, 0, 0),
(2383, 2379, 'RF2378', NULL, 2378, 1, 0, 0, 0, 0, 0),
(2384, 2380, 'RF2379', NULL, 2379, 1, 0, 0, 0, 0, 0),
(2385, 2381, 'RF2380', NULL, 2380, 1, 0, 0, 0, 0, 0),
(2386, 2382, 'RF2381', NULL, 2381, 1, 0, 0, 0, 0, 0),
(2387, 2383, 'RF2382', NULL, 2382, 1, 0, 0, 0, 0, 0),
(2388, 2384, 'RF2383', NULL, 2383, 1, 0, 0, 0, 0, 0),
(2389, 2385, 'RF2384', NULL, 2384, 1, 0, 0, 0, 0, 0),
(2390, 2386, 'RF2385', NULL, 2385, 1, 0, 0, 0, 0, 0),
(2391, 2387, 'RF2386', NULL, 2386, 1, 0, 0, 0, 0, 0),
(2392, 2388, 'RF2387', NULL, 2387, 1, 0, 0, 0, 0, 0),
(2393, 2389, 'RF2388', NULL, 2388, 1, 0, 0, 0, 0, 0),
(2394, 2390, 'RF2389', NULL, 2389, 1, 0, 0, 0, 0, 0),
(2395, 2391, 'RF2390', NULL, 2390, 1, 0, 0, 0, 0, 0),
(2396, 2392, 'RF2391', NULL, 2391, 1, 0, 0, 0, 0, 0),
(2397, 2393, 'RF2392', NULL, 2392, 1, 0, 0, 0, 0, 0),
(2398, 2394, 'RF2393', NULL, 2393, 1, 0, 0, 0, 0, 0),
(2399, 2395, 'RF2394', NULL, 2394, 1, 0, 0, 0, 0, 0),
(2400, 2396, 'RF2395', NULL, 2395, 1, 0, 0, 0, 0, 0),
(2401, 2397, 'RF2396', NULL, 2396, 1, 0, 0, 0, 0, 0),
(2402, 2398, 'RF2397', NULL, 2397, 1, 0, 0, 0, 0, 0),
(2403, 2399, 'RF2398', NULL, 2398, 1, 0, 0, 0, 0, 0),
(2404, 2400, 'RF2399', NULL, 2399, 1, 0, 0, 0, 0, 0),
(2405, 2401, 'RF2400', NULL, 2400, 1, 0, 0, 0, 0, 0),
(2406, 2402, 'RF2401', NULL, 2401, 1, 0, 0, 0, 0, 0),
(2407, 2403, 'RF2402', NULL, 2402, 1, 0, 0, 0, 0, 0),
(2408, 2404, 'RF2403', NULL, 2403, 1, 0, 0, 0, 0, 0),
(2409, 2405, 'RF2404', NULL, 2404, 1, 0, 0, 0, 0, 0),
(2410, 2406, 'RF2405', NULL, 2405, 1, 0, 0, 0, 0, 0),
(2411, 2407, 'RF2406', NULL, 2406, 1, 0, 0, 0, 0, 0),
(2412, 2408, 'RF2407', NULL, 2407, 1, 0, 0, 0, 0, 0),
(2413, 2409, 'RF2408', NULL, 2408, 1, 0, 0, 0, 0, 0),
(2414, 2410, 'RF2409', NULL, 2409, 1, 0, 0, 0, 0, 0),
(2415, 2411, 'RF2410', NULL, 2410, 1, 0, 0, 0, 0, 0),
(2416, 2412, 'RF2411', NULL, 2411, 1, 0, 0, 0, 0, 0),
(2417, 2413, 'RF2412', NULL, 2412, 1, 0, 0, 0, 0, 0),
(2418, 2414, 'RF2413', NULL, 2413, 1, 0, 0, 0, 0, 0),
(2419, 2415, 'RF2414', NULL, 2414, 1, 0, 0, 0, 0, 0),
(2420, 2416, 'RF2415', NULL, 2415, 1, 0, 0, 0, 0, 0),
(2421, 2417, 'RF2416', NULL, 2416, 1, 0, 0, 0, 0, 0),
(2422, 2418, 'RF2417', NULL, 2417, 1, 0, 0, 0, 0, 0),
(2423, 2419, 'RF2418', NULL, 2418, 1, 0, 0, 0, 0, 0),
(2424, 2420, 'RF2419', NULL, 2419, 1, 0, 0, 0, 0, 0),
(2425, 2421, 'RF2420', NULL, 2420, 1, 0, 0, 0, 0, 0),
(2426, 2422, 'RF2421', NULL, 2421, 1, 0, 0, 0, 0, 0),
(2427, 2423, 'RF2422', NULL, 2422, 1, 0, 0, 0, 0, 0),
(2428, 2424, 'RF2423', NULL, 2423, 1, 0, 0, 0, 0, 0),
(2429, 2425, 'RF2424', NULL, 2424, 1, 0, 0, 0, 0, 0),
(2430, 2426, 'RF2425', NULL, 2425, 1, 0, 0, 0, 0, 0),
(2431, 2427, 'RF2426', NULL, 2426, 1, 0, 0, 0, 0, 0),
(2432, 2428, 'RF2427', NULL, 2427, 1, 0, 0, 0, 0, 0),
(2433, 2429, 'RF2428', NULL, 2428, 1, 0, 0, 0, 0, 0),
(2434, 2430, 'RF2429', NULL, 2429, 1, 0, 0, 0, 0, 0),
(2435, 2431, 'RF2430', NULL, 2430, 1, 0, 0, 0, 0, 0),
(2436, 2432, 'RF2431', NULL, 2431, 1, 0, 0, 0, 0, 0),
(2437, 2433, 'RF2432', NULL, 2432, 1, 0, 0, 0, 0, 0),
(2438, 2434, 'RF2433', NULL, 2433, 1, 0, 0, 0, 0, 0),
(2439, 2435, 'RF2434', NULL, 2434, 1, 0, 0, 0, 0, 0),
(2440, 2436, 'RF2435', NULL, 2435, 1, 0, 0, 0, 0, 0),
(2441, 2437, 'RF2436', NULL, 2436, 1, 0, 0, 0, 0, 0),
(2442, 2438, 'RF2437', NULL, 2437, 1, 0, 0, 0, 0, 0),
(2443, 2439, 'RF2438', NULL, 2438, 1, 0, 0, 0, 0, 0),
(2444, 2440, 'RF2439', NULL, 2439, 1, 0, 0, 0, 0, 0),
(2445, 2441, 'RF2440', NULL, 2440, 1, 0, 0, 0, 0, 0),
(2446, 2442, 'RF2441', NULL, 2441, 1, 0, 0, 0, 0, 0),
(2447, 2443, 'RF2442', NULL, 2442, 1, 0, 0, 0, 0, 0),
(2448, 2444, 'RF2443', NULL, 2443, 1, 0, 0, 0, 0, 0),
(2449, 2445, 'RF2444', NULL, 2444, 1, 0, 0, 0, 0, 0),
(2450, 2446, 'RF2445', NULL, 2445, 1, 0, 0, 0, 0, 0),
(2451, 2447, 'RF2446', NULL, 2446, 1, 0, 0, 0, 0, 0),
(2452, 2448, 'RF2447', NULL, 2447, 1, 0, 0, 0, 0, 0),
(2453, 2449, 'RF2448', NULL, 2448, 1, 0, 0, 0, 0, 0),
(2454, 2450, 'RF2449', NULL, 2449, 1, 0, 0, 0, 0, 0),
(2455, 2451, 'RF2450', NULL, 2450, 1, 0, 0, 0, 0, 0),
(2456, 2452, 'RF2451', NULL, 2451, 1, 0, 0, 0, 0, 0),
(2457, 2453, 'RF2452', NULL, 2452, 1, 0, 0, 0, 0, 0),
(2458, 2454, 'RF2453', NULL, 2453, 1, 0, 0, 0, 0, 0),
(2459, 2455, 'RF2454', NULL, 2454, 1, 0, 0, 0, 0, 0),
(2460, 2456, 'RF2455', NULL, 2455, 1, 0, 0, 0, 0, 0),
(2461, 2457, 'RF2456', NULL, 2456, 1, 0, 0, 0, 0, 0),
(2462, 2458, 'RF2457', NULL, 2457, 1, 0, 0, 0, 0, 0),
(2463, 2459, 'RF2458', NULL, 2458, 1, 0, 0, 0, 0, 0),
(2464, 2460, 'RF2459', NULL, 2459, 1, 0, 0, 0, 0, 0),
(2465, 2461, 'RF2460', NULL, 2460, 1, 0, 0, 0, 0, 0),
(2466, 2462, 'RF2461', NULL, 2461, 1, 0, 0, 0, 0, 0),
(2467, 2463, 'RF2462', NULL, 2462, 1, 0, 0, 0, 0, 0),
(2468, 2464, 'RF2463', NULL, 2463, 1, 0, 0, 0, 0, 0),
(2469, 2465, 'RF2464', NULL, 2464, 1, 0, 0, 0, 0, 0),
(2470, 2466, 'RF2465', NULL, 2465, 1, 0, 0, 0, 0, 0),
(2471, 2467, 'RF2466', NULL, 2466, 1, 0, 0, 0, 0, 0),
(2472, 2468, 'RF2467', NULL, 2467, 1, 0, 0, 0, 0, 0),
(2473, 2469, 'RF2468', NULL, 2468, 1, 0, 0, 0, 0, 0),
(2474, 2470, 'RF2469', NULL, 2469, 1, 0, 0, 0, 0, 0),
(2475, 2471, 'RF2470', NULL, 2470, 1, 0, 0, 0, 0, 0),
(2476, 2472, 'RF2471', NULL, 2471, 1, 0, 0, 0, 0, 0),
(2477, 2473, 'RF2472', NULL, 2472, 1, 0, 0, 0, 0, 0),
(2478, 2474, 'RF2473', NULL, 2473, 1, 0, 0, 0, 0, 0),
(2479, 2475, 'RF2474', NULL, 2474, 1, 0, 0, 0, 0, 0),
(2480, 2476, 'RF2475', NULL, 2475, 1, 0, 0, 0, 0, 0),
(2481, 2477, 'RF2476', NULL, 2476, 1, 0, 0, 0, 0, 0),
(2482, 2478, 'RF2477', NULL, 2477, 1, 0, 0, 0, 0, 0),
(2483, 2479, 'RF2478', NULL, 2478, 1, 0, 0, 0, 0, 0),
(2484, 2480, 'RF2479', NULL, 2479, 1, 0, 0, 0, 0, 0),
(2485, 2481, 'RF2480', NULL, 2480, 1, 0, 0, 0, 0, 0),
(2486, 2482, 'RF2481', NULL, 2481, 1, 0, 0, 0, 0, 0),
(2487, 2483, 'RF2482', NULL, 2482, 1, 0, 0, 0, 0, 0),
(2488, 2484, 'RF2483', NULL, 2483, 1, 0, 0, 0, 0, 0),
(2489, 2485, 'RF2484', NULL, 2484, 1, 0, 0, 0, 0, 0),
(2490, 2486, 'RF2485', NULL, 2485, 1, 0, 0, 0, 0, 0),
(2491, 2487, 'RF2486', NULL, 2486, 1, 0, 0, 0, 0, 0),
(2492, 2488, 'RF2487', NULL, 2487, 1, 0, 0, 0, 0, 0),
(2493, 2489, 'RF2488', NULL, 2488, 1, 0, 0, 0, 0, 0),
(2494, 2490, 'RF2489', NULL, 2489, 1, 0, 0, 0, 0, 0),
(2495, 2491, 'RF2490', NULL, 2490, 1, 0, 0, 0, 0, 0),
(2496, 2492, 'RF2491', NULL, 2491, 1, 0, 0, 0, 0, 0),
(2497, 2493, 'RF2492', NULL, 2492, 1, 0, 0, 0, 0, 0),
(2498, 2494, 'RF2493', NULL, 2493, 1, 0, 0, 0, 0, 0),
(2499, 2495, 'RF2494', NULL, 2494, 1, 0, 0, 0, 0, 0),
(2500, 2496, 'RF2495', NULL, 2495, 1, 0, 0, 0, 0, 0),
(2501, 2497, 'RF2496', NULL, 2496, 1, 0, 0, 0, 0, 0),
(2502, 2498, 'RF2497', NULL, 2497, 1, 0, 0, 0, 0, 0),
(2503, 2499, 'RF2498', NULL, 2498, 1, 0, 0, 0, 0, 0),
(2504, 2500, 'RF2499', NULL, 2499, 1, 0, 0, 0, 0, 0),
(2505, 2501, 'RF2500', NULL, 2500, 1, 0, 0, 0, 0, 0),
(2506, 2502, 'RF2501', NULL, 2501, 1, 0, 0, 0, 0, 0),
(2507, 2503, 'RF2502', NULL, 2502, 1, 0, 0, 0, 0, 0),
(2508, 2504, 'RF2503', NULL, 2503, 1, 0, 0, 0, 0, 0),
(2509, 2505, 'RF2504', NULL, 2504, 1, 0, 0, 0, 0, 0),
(2510, 2506, 'RF2505', NULL, 2505, 1, 0, 0, 0, 0, 0),
(2511, 2507, 'RF2506', NULL, 2506, 1, 0, 0, 0, 0, 0),
(2512, 2508, 'RF2507', NULL, 2507, 1, 0, 0, 0, 0, 0),
(2513, 2509, 'RF2508', NULL, 2508, 1, 0, 0, 0, 0, 0),
(2514, 2510, 'RF2509', NULL, 2509, 1, 0, 0, 0, 0, 0),
(2515, 2511, 'RF2510', NULL, 2510, 1, 0, 0, 0, 0, 0),
(2516, 2512, 'RF2511', NULL, 2511, 1, 0, 0, 0, 0, 0),
(2517, 2513, 'RF2512', NULL, 2512, 1, 0, 0, 0, 0, 0),
(2518, 2514, 'RF2513', NULL, 2513, 1, 0, 0, 0, 0, 0),
(2519, 2515, 'RF2514', NULL, 2514, 1, 0, 0, 0, 0, 0),
(2520, 2516, 'RF2515', NULL, 2515, 1, 0, 0, 0, 0, 0),
(2521, 2517, 'RF2516', NULL, 2516, 1, 0, 0, 0, 0, 0),
(2522, 2518, 'RF2517', NULL, 2517, 1, 0, 0, 0, 0, 0),
(2523, 2519, 'RF2518', NULL, 2518, 1, 0, 0, 0, 0, 0),
(2524, 2520, 'RF2519', NULL, 2519, 1, 0, 0, 0, 0, 0),
(2525, 2521, 'RF2520', NULL, 2520, 1, 0, 0, 0, 0, 0),
(2526, 2522, 'RF2521', NULL, 2521, 1, 0, 0, 0, 0, 0),
(2527, 2523, 'RF2522', NULL, 2522, 1, 0, 0, 0, 0, 0),
(2528, 2524, 'RF2523', NULL, 2523, 1, 0, 0, 0, 0, 0),
(2529, 2525, 'RF2524', NULL, 2524, 1, 0, 0, 0, 0, 0),
(2530, 2526, 'RF2525', NULL, 2525, 1, 0, 0, 0, 0, 0),
(2531, 2527, 'RF2526', NULL, 2526, 1, 0, 0, 0, 0, 0),
(2532, 2528, 'RF2527', NULL, 2527, 1, 0, 0, 0, 0, 0),
(2533, 2529, 'RF2528', NULL, 2528, 1, 0, 0, 0, 0, 0),
(2534, 2530, 'RF2529', NULL, 2529, 1, 0, 0, 0, 0, 0),
(2535, 2531, 'RF2530', NULL, 2530, 1, 0, 0, 0, 0, 0),
(2536, 2532, 'RF2531', NULL, 2531, 1, 0, 0, 0, 0, 0),
(2537, 2533, 'RF2532', NULL, 2532, 1, 0, 0, 0, 0, 0),
(2538, 2534, 'RF2533', NULL, 2533, 1, 0, 0, 0, 0, 0),
(2539, 2535, 'RF2534', NULL, 2534, 1, 0, 0, 0, 0, 0),
(2540, 2536, 'RF2535', NULL, 2535, 1, 0, 0, 0, 0, 0),
(2541, 2537, 'RF2536', NULL, 2536, 1, 0, 0, 0, 0, 0),
(2542, 2538, 'RF2537', NULL, 2537, 1, 0, 0, 0, 0, 0),
(2543, 2539, 'RF2538', NULL, 2538, 1, 0, 0, 0, 0, 0),
(2544, 2540, 'RF2539', NULL, 2539, 1, 0, 0, 0, 0, 0),
(2545, 2541, 'RF2540', NULL, 2540, 1, 0, 0, 0, 0, 0),
(2546, 2542, 'RF2541', NULL, 2541, 1, 0, 0, 0, 0, 0),
(2547, 2543, 'RF2542', NULL, 2542, 1, 0, 0, 0, 0, 0),
(2548, 2544, 'RF2543', NULL, 2543, 1, 0, 0, 0, 0, 0),
(2549, 2545, 'RF2544', NULL, 2544, 1, 0, 0, 0, 0, 0),
(2550, 2546, 'RF2545', NULL, 2545, 1, 0, 0, 0, 0, 0),
(2551, 2547, 'RF2546', NULL, 2546, 1, 0, 0, 0, 0, 0),
(2552, 2548, 'RF2547', NULL, 2547, 1, 0, 0, 0, 0, 0),
(2553, 2549, 'RF2548', NULL, 2548, 1, 0, 0, 0, 0, 0),
(2554, 2550, 'RF2549', NULL, 2549, 1, 0, 0, 0, 0, 0),
(2555, 2551, 'RF2550', NULL, 2550, 1, 0, 0, 0, 0, 0),
(2556, 2552, 'RF2551', NULL, 2551, 1, 0, 0, 0, 0, 0),
(2557, 2553, 'RF2552', NULL, 2552, 1, 0, 0, 0, 0, 0),
(2558, 2554, 'RF2553', NULL, 2553, 1, 0, 0, 0, 0, 0),
(2559, 2555, 'RF2554', NULL, 2554, 1, 0, 0, 0, 0, 0),
(2560, 2556, 'RF2555', NULL, 2555, 1, 0, 0, 0, 0, 0),
(2561, 2557, 'RF2556', NULL, 2556, 1, 0, 0, 0, 0, 0),
(2562, 2558, 'RF2557', NULL, 2557, 1, 0, 0, 0, 0, 0),
(2563, 2559, 'RF2558', NULL, 2558, 1, 0, 0, 0, 0, 0),
(2564, 2560, 'RF2559', NULL, 2559, 1, 0, 0, 0, 0, 0),
(2565, 2561, 'RF2560', NULL, 2560, 1, 0, 0, 0, 0, 0),
(2566, 2562, 'RF2561', NULL, 2561, 1, 0, 0, 0, 0, 0),
(2567, 2563, 'RF2562', NULL, 2562, 1, 0, 0, 0, 0, 0),
(2568, 2564, 'RF2563', NULL, 2563, 1, 0, 0, 0, 0, 0),
(2569, 2565, 'RF2564', NULL, 2564, 1, 0, 0, 0, 0, 0),
(2570, 2566, 'RF2565', NULL, 2565, 1, 0, 0, 0, 0, 0),
(2571, 2567, 'RF2566', NULL, 2566, 1, 0, 0, 0, 0, 0),
(2572, 2568, 'RF2567', NULL, 2567, 1, 0, 0, 0, 0, 0),
(2573, 2569, 'RF2568', NULL, 2568, 1, 0, 0, 0, 0, 0),
(2574, 2570, 'RF2569', NULL, 2569, 1, 0, 0, 0, 0, 0),
(2575, 2571, 'RF2570', NULL, 2570, 1, 0, 0, 0, 0, 0),
(2576, 2572, 'RF2571', NULL, 2571, 1, 0, 0, 0, 0, 0),
(2577, 2573, 'RF2572', NULL, 2572, 1, 0, 0, 0, 0, 0),
(2578, 2574, 'RF2573', NULL, 2573, 1, 0, 0, 0, 0, 0),
(2579, 2575, 'RF2574', NULL, 2574, 1, 0, 0, 0, 0, 0),
(2580, 2576, 'RF2575', NULL, 2575, 1, 0, 0, 0, 0, 0),
(2581, 2577, 'RF2576', NULL, 2576, 1, 0, 0, 0, 0, 0),
(2582, 2578, 'RF2577', NULL, 2577, 1, 0, 0, 0, 0, 0),
(2583, 2579, 'RF2578', NULL, 2578, 1, 0, 0, 0, 0, 0),
(2584, 2580, 'RF2579', NULL, 2579, 1, 0, 0, 0, 0, 0),
(2585, 2581, 'RF2580', NULL, 2580, 1, 0, 0, 0, 0, 0),
(2586, 2582, 'RF2581', NULL, 2581, 1, 0, 0, 0, 0, 0),
(2587, 2583, 'RF2582', NULL, 2582, 1, 0, 0, 0, 0, 0),
(2588, 2584, 'RF2583', NULL, 2583, 1, 0, 0, 0, 0, 0),
(2589, 2585, 'RF2584', NULL, 2584, 1, 0, 0, 0, 0, 0),
(2590, 2586, 'RF2585', NULL, 2585, 1, 0, 0, 0, 0, 0),
(2591, 2587, 'RF2586', NULL, 2586, 1, 0, 0, 0, 0, 0),
(2592, 2588, 'RF2587', NULL, 2587, 1, 0, 0, 0, 0, 0),
(2593, 2589, 'RF2588', NULL, 2588, 1, 0, 0, 0, 0, 0),
(2594, 2590, 'RF2589', NULL, 2589, 1, 0, 0, 0, 0, 0),
(2595, 2591, 'RF2590', NULL, 2590, 1, 0, 0, 0, 0, 0),
(2596, 2592, 'RF2591', NULL, 2591, 1, 0, 0, 0, 0, 0),
(2597, 2593, 'RF2592', NULL, 2592, 1, 0, 0, 0, 0, 0),
(2598, 2594, 'RF2593', NULL, 2593, 1, 0, 0, 0, 0, 0),
(2599, 2595, 'RF2594', NULL, 2594, 1, 0, 0, 0, 0, 0),
(2600, 2596, 'RF2595', NULL, 2595, 1, 0, 0, 0, 0, 0),
(2601, 2597, 'RF2596', NULL, 2596, 1, 0, 0, 0, 0, 0),
(2602, 2598, 'RF2597', NULL, 2597, 1, 0, 0, 0, 0, 0),
(2603, 2599, 'RF2598', NULL, 2598, 1, 0, 0, 0, 0, 0),
(2604, 2600, 'RF2599', NULL, 2599, 1, 0, 0, 0, 0, 0),
(2605, 2601, 'RF2600', NULL, 2600, 1, 0, 0, 0, 0, 0),
(2606, 2602, 'RF2601', NULL, 2601, 1, 0, 0, 0, 0, 0),
(2607, 2603, 'RF2602', NULL, 2602, 1, 0, 0, 0, 0, 0),
(2608, 2604, 'RF2603', NULL, 2603, 1, 0, 0, 0, 0, 0),
(2609, 2605, 'RF2604', NULL, 2604, 1, 0, 0, 0, 0, 0),
(2610, 2606, 'RF2605', NULL, 2605, 1, 0, 0, 0, 0, 0),
(2611, 2607, 'RF2606', NULL, 2606, 1, 0, 0, 0, 0, 0),
(2612, 2608, 'RF2607', NULL, 2607, 1, 0, 0, 0, 0, 0),
(2613, 2609, 'RF2608', NULL, 2608, 1, 0, 0, 0, 0, 0),
(2614, 2610, 'RF2609', NULL, 2609, 1, 0, 0, 0, 0, 0),
(2615, 2611, 'RF2610', NULL, 2610, 1, 0, 0, 0, 0, 0),
(2616, 2612, 'RF2611', NULL, 2611, 1, 0, 0, 0, 0, 0),
(2617, 2613, 'RF2612', NULL, 2612, 1, 0, 0, 0, 0, 0),
(2618, 2614, 'RF2613', NULL, 2613, 1, 0, 0, 0, 0, 0),
(2619, 2615, 'RF2614', NULL, 2614, 1, 0, 0, 0, 0, 0),
(2620, 2616, 'RF2615', NULL, 2615, 1, 0, 0, 0, 0, 0),
(2621, 2617, 'RF2616', NULL, 2616, 1, 0, 0, 0, 0, 0),
(2622, 2618, 'RF2617', NULL, 2617, 1, 0, 0, 0, 0, 0),
(2623, 2619, 'RF2618', NULL, 2618, 1, 0, 0, 0, 0, 0),
(2624, 2620, 'RF2619', NULL, 2619, 1, 0, 0, 0, 0, 0),
(2625, 2621, 'RF2620', NULL, 2620, 1, 0, 0, 0, 0, 0),
(2626, 2622, 'RF2621', NULL, 2621, 1, 0, 0, 0, 0, 0),
(2627, 2623, 'RF2622', NULL, 2622, 1, 0, 0, 0, 0, 0),
(2628, 2624, 'RF2623', NULL, 2623, 1, 0, 0, 0, 0, 0),
(2629, 2625, 'RF2624', NULL, 2624, 1, 0, 0, 0, 0, 0),
(2630, 2626, 'RF2625', NULL, 2625, 1, 0, 0, 0, 0, 0),
(2631, 2627, 'RF2626', NULL, 2626, 1, 0, 0, 0, 0, 0),
(2632, 2628, 'RF2627', NULL, 2627, 1, 0, 0, 0, 0, 0),
(2633, 2629, 'RF2628', NULL, 2628, 1, 0, 0, 0, 0, 0),
(2634, 2630, 'RF2629', NULL, 2629, 1, 0, 0, 0, 0, 0),
(2635, 2631, 'RF2630', NULL, 2630, 1, 0, 0, 0, 0, 0),
(2636, 2632, 'RF2631', NULL, 2631, 1, 0, 0, 0, 0, 0),
(2637, 2633, 'RF2632', NULL, 2632, 1, 0, 0, 0, 0, 0),
(2638, 2634, 'RF2633', NULL, 2633, 1, 0, 0, 0, 0, 0),
(2639, 2635, 'RF2634', NULL, 2634, 1, 0, 0, 0, 0, 0),
(2640, 2636, 'RF2635', NULL, 2635, 1, 0, 0, 0, 0, 0),
(2641, 2637, 'RF2636', NULL, 2636, 1, 0, 0, 0, 0, 0),
(2642, 2638, 'RF2637', NULL, 2637, 1, 0, 0, 0, 0, 0),
(2643, 2639, 'RF2638', NULL, 2638, 1, 0, 0, 0, 0, 0),
(2644, 2640, 'RF2639', NULL, 2639, 1, 0, 0, 0, 0, 0),
(2645, 2641, 'RF2640', NULL, 2640, 1, 0, 0, 0, 0, 0),
(2646, 2642, 'RF2641', NULL, 2641, 1, 0, 0, 0, 0, 0),
(2647, 2643, 'RF2642', NULL, 2642, 1, 0, 0, 0, 0, 0),
(2648, 2644, 'RF2643', NULL, 2643, 1, 0, 0, 0, 0, 0),
(2649, 2645, 'RF2644', NULL, 2644, 1, 0, 0, 0, 0, 0),
(2650, 2646, 'RF2645', NULL, 2645, 1, 0, 0, 0, 0, 0),
(2651, 2647, 'RF2646', NULL, 2646, 1, 0, 0, 0, 0, 0),
(2652, 2648, 'RF2647', NULL, 2647, 1, 0, 0, 0, 0, 0),
(2653, 2649, 'RF2648', NULL, 2648, 1, 0, 0, 0, 0, 0),
(2654, 2650, 'RF2649', NULL, 2649, 1, 0, 0, 0, 0, 0),
(2655, 2651, 'RF2650', NULL, 2650, 1, 0, 0, 0, 0, 0),
(2656, 2652, 'RF2651', NULL, 2651, 1, 0, 0, 0, 0, 0),
(2657, 2653, 'RF2652', NULL, 2652, 1, 0, 0, 0, 0, 0),
(2658, 2654, 'RF2653', NULL, 2653, 1, 0, 0, 0, 0, 0),
(2659, 2655, 'RF2654', NULL, 2654, 1, 0, 0, 0, 0, 0),
(2660, 2656, 'RF2655', NULL, 2655, 1, 0, 0, 0, 0, 0),
(2661, 2657, 'RF2656', NULL, 2656, 1, 0, 0, 0, 0, 0),
(2662, 2658, 'RF2657', NULL, 2657, 1, 0, 0, 0, 0, 0),
(2663, 2659, 'RF2658', NULL, 2658, 1, 0, 0, 0, 0, 0),
(2664, 2660, 'RF2659', NULL, 2659, 1, 0, 0, 0, 0, 0),
(2665, 2661, 'RF2660', NULL, 2660, 1, 0, 0, 0, 0, 0),
(2666, 2662, 'RF2661', NULL, 2661, 1, 0, 0, 0, 0, 0),
(2667, 2663, 'RF2662', NULL, 2662, 1, 0, 0, 0, 0, 0),
(2668, 2664, 'RF2663', NULL, 2663, 1, 0, 0, 0, 0, 0),
(2669, 2665, 'RF2664', NULL, 2664, 1, 0, 0, 0, 0, 0),
(2670, 2666, 'RF2665', NULL, 2665, 1, 0, 0, 0, 0, 0),
(2671, 2667, 'RF2666', NULL, 2666, 1, 0, 0, 0, 0, 0),
(2672, 2668, 'RF2667', NULL, 2667, 1, 0, 0, 0, 0, 0),
(2673, 2669, 'RF2668', NULL, 2668, 1, 0, 0, 0, 0, 0),
(2674, 2670, 'RF2669', NULL, 2669, 1, 0, 0, 0, 0, 0),
(2675, 2671, 'RF2670', NULL, 2670, 1, 0, 0, 0, 0, 0),
(2676, 2672, 'RF2671', NULL, 2671, 1, 0, 0, 0, 0, 0),
(2677, 2673, 'RF2672', NULL, 2672, 1, 0, 0, 0, 0, 0),
(2678, 2674, 'RF2673', NULL, 2673, 1, 0, 0, 0, 0, 0),
(2679, 2675, 'RF2674', NULL, 2674, 1, 0, 0, 0, 0, 0),
(2680, 2676, 'RF2675', NULL, 2675, 1, 0, 0, 0, 0, 0),
(2681, 2677, 'RF2676', NULL, 2676, 1, 0, 0, 0, 0, 0),
(2682, 2678, 'RF2677', NULL, 2677, 1, 0, 0, 0, 0, 0),
(2683, 2679, 'RF2678', NULL, 2678, 1, 0, 0, 0, 0, 0),
(2684, 2680, 'RF2679', NULL, 2679, 1, 0, 0, 0, 0, 0),
(2685, 2681, 'RF2680', NULL, 2680, 1, 0, 0, 0, 0, 0),
(2686, 2682, 'RF2681', NULL, 2681, 1, 0, 0, 0, 0, 0),
(2687, 2683, 'RF2682', NULL, 2682, 1, 0, 0, 0, 0, 0),
(2688, 2684, 'RF2683', NULL, 2683, 1, 0, 0, 0, 0, 0),
(2689, 2685, 'RF2684', NULL, 2684, 1, 0, 0, 0, 0, 0),
(2690, 2686, 'RF2685', NULL, 2685, 1, 0, 0, 0, 0, 0),
(2691, 2687, 'RF2686', NULL, 2686, 1, 0, 0, 0, 0, 0),
(2692, 2688, 'RF2687', NULL, 2687, 1, 0, 0, 0, 0, 0),
(2693, 2689, 'RF2688', NULL, 2688, 1, 0, 0, 0, 0, 0),
(2694, 2690, 'RF2689', NULL, 2689, 1, 0, 0, 0, 0, 0),
(2695, 2691, 'RF2690', NULL, 2690, 1, 0, 0, 0, 0, 0),
(2696, 2692, 'RF2691', NULL, 2691, 1, 0, 0, 0, 0, 0),
(2697, 2693, 'RF2692', NULL, 2692, 1, 0, 0, 0, 0, 0),
(2698, 2694, 'RF2693', NULL, 2693, 1, 0, 0, 0, 0, 0),
(2699, 2695, 'RF2694', NULL, 2694, 1, 0, 0, 0, 0, 0),
(2700, 2696, 'RF2695', NULL, 2695, 1, 0, 0, 0, 0, 0),
(2701, 2697, 'RF2696', NULL, 2696, 1, 0, 0, 0, 0, 0),
(2702, 2698, 'RF2697', NULL, 2697, 1, 0, 0, 0, 0, 0),
(2703, 2699, 'RF2698', NULL, 2698, 1, 0, 0, 0, 0, 0),
(2704, 2700, 'RF2699', NULL, 2699, 1, 0, 0, 0, 0, 0),
(2705, 2701, 'RF2700', NULL, 2700, 1, 0, 0, 0, 0, 0),
(2706, 2702, 'RF2701', NULL, 2701, 1, 0, 0, 0, 0, 0),
(2707, 2703, 'RF2702', NULL, 2702, 1, 0, 0, 0, 0, 0),
(2708, 2704, 'RF2703', NULL, 2703, 1, 0, 0, 0, 0, 0),
(2709, 2705, 'RF2704', NULL, 2704, 1, 0, 0, 0, 0, 0),
(2710, 2706, 'RF2705', NULL, 2705, 1, 0, 0, 0, 0, 0),
(2711, 2707, 'RF2706', NULL, 2706, 1, 0, 0, 0, 0, 0),
(2712, 2708, 'RF2707', NULL, 2707, 1, 0, 0, 0, 0, 0),
(2713, 2709, 'RF2708', NULL, 2708, 1, 0, 0, 0, 0, 0),
(2714, 2710, 'RF2709', NULL, 2709, 1, 0, 0, 0, 0, 0),
(2715, 2711, 'RF2710', NULL, 2710, 1, 0, 0, 0, 0, 0),
(2716, 2712, 'RF2711', NULL, 2711, 1, 0, 0, 0, 0, 0),
(2717, 2713, 'RF2712', NULL, 2712, 1, 0, 0, 0, 0, 0),
(2718, 2714, 'RF2713', NULL, 2713, 1, 0, 0, 0, 0, 0),
(2719, 2715, 'RF2714', NULL, 2714, 1, 0, 0, 0, 0, 0),
(2720, 2716, 'RF2715', NULL, 2715, 1, 0, 0, 0, 0, 0),
(2721, 2717, 'RF2716', NULL, 2716, 1, 0, 0, 0, 0, 0),
(2722, 2718, 'RF2717', NULL, 2717, 1, 0, 0, 0, 0, 0),
(2723, 2719, 'RF2718', NULL, 2718, 1, 0, 0, 0, 0, 0),
(2724, 2720, 'RF2719', NULL, 2719, 1, 0, 0, 0, 0, 0),
(2725, 2721, 'RF2720', NULL, 2720, 1, 0, 0, 0, 0, 0),
(2726, 2722, 'RF2721', NULL, 2721, 1, 0, 0, 0, 0, 0),
(2727, 2723, 'RF2722', NULL, 2722, 1, 0, 0, 0, 0, 0),
(2728, 2724, 'RF2723', NULL, 2723, 1, 0, 0, 0, 0, 0),
(2729, 2725, 'RF2724', NULL, 2724, 1, 0, 0, 0, 0, 0),
(2730, 2726, 'RF2725', NULL, 2725, 1, 0, 0, 0, 0, 0),
(2731, 2727, 'RF2726', NULL, 2726, 1, 0, 0, 0, 0, 0),
(2732, 2728, 'RF2727', NULL, 2727, 1, 0, 0, 0, 0, 0),
(2733, 2729, 'RF2728', NULL, 2728, 1, 0, 0, 0, 0, 0),
(2734, 2730, 'RF2729', NULL, 2729, 1, 0, 0, 0, 0, 0),
(2735, 2731, 'RF2730', NULL, 2730, 1, 0, 0, 0, 0, 0),
(2736, 2732, 'RF2731', NULL, 2731, 1, 0, 0, 0, 0, 0),
(2737, 2733, 'RF2732', NULL, 2732, 1, 0, 0, 0, 0, 0),
(2738, 2734, 'RF2733', NULL, 2733, 1, 0, 0, 0, 0, 0),
(2739, 2735, 'RF2734', NULL, 2734, 1, 0, 0, 0, 0, 0),
(2740, 2736, 'RF2735', NULL, 2735, 1, 0, 0, 0, 0, 0),
(2741, 2737, 'RF2736', NULL, 2736, 1, 0, 0, 0, 0, 0),
(2742, 2738, 'RF2737', NULL, 2737, 1, 0, 0, 0, 0, 0),
(2743, 2739, 'RF2738', NULL, 2738, 1, 0, 0, 0, 0, 0),
(2744, 2740, 'RF2739', NULL, 2739, 1, 0, 0, 0, 0, 0),
(2745, 2741, 'RF2740', NULL, 2740, 1, 0, 0, 0, 0, 0),
(2746, 2742, 'RF2741', NULL, 2741, 1, 0, 0, 0, 0, 0),
(2747, 2743, 'RF2742', NULL, 2742, 1, 0, 0, 0, 0, 0),
(2748, 2744, 'RF2743', NULL, 2743, 1, 0, 0, 0, 0, 0),
(2749, 2745, 'RF2744', NULL, 2744, 1, 0, 0, 0, 0, 0),
(2750, 2746, 'RF2745', NULL, 2745, 1, 0, 0, 0, 0, 0),
(2751, 2747, 'RF2746', NULL, 2746, 1, 0, 0, 0, 0, 0),
(2752, 2748, 'RF2747', NULL, 2747, 1, 0, 0, 0, 0, 0),
(2753, 2749, 'RF2748', NULL, 2748, 1, 0, 0, 0, 0, 0),
(2754, 2750, 'RF2749', NULL, 2749, 1, 0, 0, 0, 0, 0),
(2755, 2751, 'RF2750', NULL, 2750, 1, 0, 0, 0, 0, 0),
(2756, 2752, 'RF2751', NULL, 2751, 1, 0, 0, 0, 0, 0),
(2757, 2753, 'RF2752', NULL, 2752, 1, 0, 0, 0, 0, 0),
(2758, 2754, 'RF2753', NULL, 2753, 1, 0, 0, 0, 0, 0),
(2759, 2755, 'RF2754', NULL, 2754, 1, 0, 0, 0, 0, 0),
(2760, 2756, 'RF2755', NULL, 2755, 1, 0, 0, 0, 0, 0),
(2761, 2757, 'RF2756', NULL, 2756, 1, 0, 0, 0, 0, 0),
(2762, 2758, 'RF2757', NULL, 2757, 1, 0, 0, 0, 0, 0),
(2763, 2759, 'RF2758', NULL, 2758, 1, 0, 0, 0, 0, 0),
(2764, 2760, 'RF2759', NULL, 2759, 1, 0, 0, 0, 0, 0),
(2765, 2761, 'RF2760', NULL, 2760, 1, 0, 0, 0, 0, 0),
(2766, 2762, 'RF2761', NULL, 2761, 1, 0, 0, 0, 0, 0),
(2767, 2763, 'RF2762', NULL, 2762, 1, 0, 0, 0, 0, 0),
(2768, 2764, 'RF2763', NULL, 2763, 1, 0, 0, 0, 0, 0),
(2769, 2765, 'RF2764', NULL, 2764, 1, 0, 0, 0, 0, 0),
(2770, 2766, 'RF2765', NULL, 2765, 1, 0, 0, 0, 0, 0),
(2771, 2767, 'RF2766', NULL, 2766, 1, 0, 0, 0, 0, 0),
(2772, 2768, 'RF2767', NULL, 2767, 1, 0, 0, 0, 0, 0),
(2773, 2769, 'RF2768', NULL, 2768, 1, 0, 0, 0, 0, 0),
(2774, 2770, 'RF2769', NULL, 2769, 1, 0, 0, 0, 0, 0),
(2775, 2771, 'RF2770', NULL, 2770, 1, 0, 0, 0, 0, 0),
(2776, 2772, 'RF2771', NULL, 2771, 1, 0, 0, 0, 0, 0),
(2777, 2773, 'RF2772', NULL, 2772, 1, 0, 0, 0, 0, 0),
(2778, 2774, 'RF2773', NULL, 2773, 1, 0, 0, 0, 0, 0),
(2779, 2775, 'RF2774', NULL, 2774, 1, 0, 0, 0, 0, 0),
(2780, 2776, 'RF2775', NULL, 2775, 1, 0, 0, 0, 0, 0),
(2781, 2777, 'RF2776', NULL, 2776, 1, 0, 0, 0, 0, 0),
(2782, 2778, 'RF2777', NULL, 2777, 1, 0, 0, 0, 0, 0),
(2783, 2779, 'RF2778', NULL, 2778, 1, 0, 0, 0, 0, 0),
(2784, 2780, 'RF2779', NULL, 2779, 1, 0, 0, 0, 0, 0),
(2785, 2781, 'RF2780', NULL, 2780, 1, 0, 0, 0, 0, 0),
(2786, 2782, 'RF2781', NULL, 2781, 1, 0, 0, 0, 0, 0),
(2787, 2783, 'RF2782', NULL, 2782, 1, 0, 0, 0, 0, 0),
(2788, 2784, 'RF2783', NULL, 2783, 1, 0, 0, 0, 0, 0),
(2789, 2785, 'RF2784', NULL, 2784, 1, 0, 0, 0, 0, 0),
(2790, 2786, 'RF2785', NULL, 2785, 1, 0, 0, 0, 0, 0),
(2791, 2787, 'RF2786', NULL, 2786, 1, 0, 0, 0, 0, 0),
(2792, 2788, 'RF2787', NULL, 2787, 1, 0, 0, 0, 0, 0),
(2793, 2789, 'RF2788', NULL, 2788, 1, 0, 0, 0, 0, 0),
(2794, 2790, 'RF2789', NULL, 2789, 1, 0, 0, 0, 0, 0),
(2795, 2791, 'RF2790', NULL, 2790, 1, 0, 0, 0, 0, 0),
(2796, 2792, 'RF2791', NULL, 2791, 1, 0, 0, 0, 0, 0),
(2797, 2793, 'RF2792', NULL, 2792, 1, 0, 0, 0, 0, 0),
(2798, 2794, 'RF2793', NULL, 2793, 1, 0, 0, 0, 0, 0),
(2799, 2795, 'RF2794', NULL, 2794, 1, 0, 0, 0, 0, 0),
(2800, 2796, 'RF2795', NULL, 2795, 1, 0, 0, 0, 0, 0),
(2801, 2797, 'RF2796', NULL, 2796, 1, 0, 0, 0, 0, 0),
(2802, 2798, 'RF2797', NULL, 2797, 1, 0, 0, 0, 0, 0),
(2803, 2799, 'RF2798', NULL, 2798, 1, 0, 0, 0, 0, 0),
(2804, 2800, 'RF2799', NULL, 2799, 1, 0, 0, 0, 0, 0),
(2805, 2801, 'RF2800', NULL, 2800, 1, 0, 0, 0, 0, 0),
(2806, 2802, 'RF2801', NULL, 2801, 1, 0, 0, 0, 0, 0),
(2807, 2803, 'RF2802', NULL, 2802, 1, 0, 0, 0, 0, 0),
(2808, 2804, 'RF2803', NULL, 2803, 1, 0, 0, 0, 0, 0),
(2809, 2805, 'RF2804', NULL, 2804, 1, 0, 0, 0, 0, 0),
(2810, 2806, 'RF2805', NULL, 2805, 1, 0, 0, 0, 0, 0),
(2811, 2807, 'RF2806', NULL, 2806, 1, 0, 0, 0, 0, 0),
(2812, 2808, 'RF2807', NULL, 2807, 1, 0, 0, 0, 0, 0),
(2813, 2809, 'RF2808', NULL, 2808, 1, 0, 0, 0, 0, 0),
(2814, 2810, 'RF2809', NULL, 2809, 1, 0, 0, 0, 0, 0),
(2815, 2811, 'RF2810', NULL, 2810, 1, 0, 0, 0, 0, 0),
(2816, 2812, 'RF2811', NULL, 2811, 1, 0, 0, 0, 0, 0),
(2817, 2813, 'RF2812', NULL, 2812, 1, 0, 0, 0, 0, 0),
(2818, 2814, 'RF2813', NULL, 2813, 1, 0, 0, 0, 0, 0),
(2819, 2815, 'RF2814', NULL, 2814, 1, 0, 0, 0, 0, 0),
(2820, 2816, 'RF2815', NULL, 2815, 1, 0, 0, 0, 0, 0),
(2821, 2817, 'RF2816', NULL, 2816, 1, 0, 0, 0, 0, 0),
(2822, 2818, 'RF2817', NULL, 2817, 1, 0, 0, 0, 0, 0),
(2823, 2819, 'RF2818', NULL, 2818, 1, 0, 0, 0, 0, 0),
(2824, 2820, 'RF2819', NULL, 2819, 1, 0, 0, 0, 0, 0),
(2825, 2821, 'RF2820', NULL, 2820, 1, 0, 0, 0, 0, 0),
(2826, 2822, 'RF2821', NULL, 2821, 1, 0, 0, 0, 0, 0),
(2827, 2823, 'RF2822', NULL, 2822, 1, 0, 0, 0, 0, 0),
(2828, 2824, 'RF2823', NULL, 2823, 1, 0, 0, 0, 0, 0),
(2829, 2825, 'RF2824', NULL, 2824, 1, 0, 0, 0, 0, 0),
(2830, 2826, 'RF2825', NULL, 2825, 1, 0, 0, 0, 0, 0),
(2831, 2827, 'RF2826', NULL, 2826, 1, 0, 0, 0, 0, 0),
(2832, 2828, 'RF2827', NULL, 2827, 1, 0, 0, 0, 0, 0),
(2833, 2829, 'RF2828', NULL, 2828, 1, 0, 0, 0, 0, 0),
(2834, 2830, 'RF2829', NULL, 2829, 1, 0, 0, 0, 0, 0),
(2835, 2831, 'RF2830', NULL, 2830, 1, 0, 0, 0, 0, 0),
(2836, 2832, 'RF2831', NULL, 2831, 1, 0, 0, 0, 0, 0),
(2837, 2833, 'RF2832', NULL, 2832, 1, 0, 0, 0, 0, 0),
(2838, 2834, 'RF2833', NULL, 2833, 1, 0, 0, 0, 0, 0),
(2839, 2835, 'RF2834', NULL, 2834, 1, 0, 0, 0, 0, 0),
(2840, 2836, 'RF2835', NULL, 2835, 1, 0, 0, 0, 0, 0),
(2841, 2837, 'RF2836', NULL, 2836, 1, 0, 0, 0, 0, 0),
(2842, 2838, 'RF2837', NULL, 2837, 1, 0, 0, 0, 0, 0),
(2843, 2839, 'RF2838', NULL, 2838, 1, 0, 0, 0, 0, 0),
(2844, 2840, 'RF2839', NULL, 2839, 1, 0, 0, 0, 0, 0),
(2845, 2841, 'RF2840', NULL, 2840, 1, 0, 0, 0, 0, 0),
(2846, 2842, 'RF2841', NULL, 2841, 1, 0, 0, 0, 0, 0),
(2847, 2843, 'RF2842', NULL, 2842, 1, 0, 0, 0, 0, 0),
(2848, 2844, 'RF2843', NULL, 2843, 1, 0, 0, 0, 0, 0),
(2849, 2845, 'RF2844', NULL, 2844, 1, 0, 0, 0, 0, 0),
(2850, 2846, 'RF2845', NULL, 2845, 1, 0, 0, 0, 0, 0),
(2851, 2847, 'RF2846', NULL, 2846, 1, 0, 0, 0, 0, 0),
(2852, 2848, 'RF2847', NULL, 2847, 1, 0, 0, 0, 0, 0),
(2853, 2849, 'RF2848', NULL, 2848, 1, 0, 0, 0, 0, 0),
(2854, 2850, 'RF2849', NULL, 2849, 1, 0, 0, 0, 0, 0),
(2855, 2851, 'RF2850', NULL, 2850, 1, 0, 0, 0, 0, 0),
(2856, 2852, 'RF2851', NULL, 2851, 1, 0, 0, 0, 0, 0),
(2857, 2853, 'RF2852', NULL, 2852, 1, 0, 0, 0, 0, 0),
(2858, 2854, 'RF2853', NULL, 2853, 1, 0, 0, 0, 0, 0),
(2859, 2855, 'RF2854', NULL, 2854, 1, 0, 0, 0, 0, 0),
(2860, 2856, 'RF2855', NULL, 2855, 1, 0, 0, 0, 0, 0),
(2861, 2857, 'RF2856', NULL, 2856, 1, 0, 0, 0, 0, 0),
(2862, 2858, 'RF2857', NULL, 2857, 1, 0, 0, 0, 0, 0),
(2863, 2859, 'RF2858', NULL, 2858, 1, 0, 0, 0, 0, 0),
(2864, 2860, 'RF2859', NULL, 2859, 1, 0, 0, 0, 0, 0),
(2865, 2861, 'RF2860', NULL, 2860, 1, 0, 0, 0, 0, 0),
(2866, 2862, 'RF2861', NULL, 2861, 1, 0, 0, 0, 0, 0),
(2867, 2863, 'RF2862', NULL, 2862, 1, 0, 0, 0, 0, 0),
(2868, 2864, 'RF2863', NULL, 2863, 1, 0, 0, 0, 0, 0),
(2869, 2865, 'RF2864', NULL, 2864, 1, 0, 0, 0, 0, 0),
(2870, 2866, 'RF2865', NULL, 2865, 1, 0, 0, 0, 0, 0),
(2871, 2867, 'RF2866', NULL, 2866, 1, 0, 0, 0, 0, 0),
(2872, 2868, 'RF2867', NULL, 2867, 1, 0, 0, 0, 0, 0),
(2873, 2869, 'RF2868', NULL, 2868, 1, 0, 0, 0, 0, 0),
(2874, 2870, 'RF2869', NULL, 2869, 1, 0, 0, 0, 0, 0),
(2875, 2871, 'RF2870', NULL, 2870, 1, 0, 0, 0, 0, 0),
(2876, 2872, 'RF2871', NULL, 2871, 1, 0, 0, 0, 0, 0),
(2877, 2873, 'RF2872', NULL, 2872, 1, 0, 0, 0, 0, 0),
(2878, 2874, 'RF2873', NULL, 2873, 1, 0, 0, 0, 0, 0),
(2879, 2875, 'RF2874', NULL, 2874, 1, 0, 0, 0, 0, 0),
(2880, 2876, 'RF2875', NULL, 2875, 1, 0, 0, 0, 0, 0),
(2881, 2877, 'RF2876', NULL, 2876, 1, 0, 0, 0, 0, 0),
(2882, 2878, 'RF2877', NULL, 2877, 1, 0, 0, 0, 0, 0),
(2883, 2879, 'RF2878', NULL, 2878, 1, 0, 0, 0, 0, 0),
(2884, 2880, 'RF2879', NULL, 2879, 1, 0, 0, 0, 0, 0),
(2885, 2881, 'RF2880', NULL, 2880, 1, 0, 0, 0, 0, 0),
(2886, 2882, 'RF2881', NULL, 2881, 1, 0, 0, 0, 0, 0),
(2887, 2883, 'RF2882', NULL, 2882, 1, 0, 0, 0, 0, 0),
(2888, 2884, 'RF2883', NULL, 2883, 1, 0, 0, 0, 0, 0),
(2889, 2885, 'RF2884', NULL, 2884, 1, 0, 0, 0, 0, 0),
(2890, 2886, 'RF2885', NULL, 2885, 1, 0, 0, 0, 0, 0),
(2891, 2887, 'RF2886', NULL, 2886, 1, 0, 0, 0, 0, 0),
(2892, 2888, 'RF2887', NULL, 2887, 1, 0, 0, 0, 0, 0),
(2893, 2889, 'RF2888', NULL, 2888, 1, 0, 0, 0, 0, 0),
(2894, 2890, 'RF2889', NULL, 2889, 1, 0, 0, 0, 0, 0),
(2895, 2891, 'RF2890', NULL, 2890, 1, 0, 0, 0, 0, 0),
(2896, 2892, 'RF2891', NULL, 2891, 1, 0, 0, 0, 0, 0),
(2897, 2893, 'RF2892', NULL, 2892, 1, 0, 0, 0, 0, 0),
(2898, 2894, 'RF2893', NULL, 2893, 1, 0, 0, 0, 0, 0),
(2899, 2895, 'RF2894', NULL, 2894, 1, 0, 0, 0, 0, 0),
(2900, 2896, 'RF2895', NULL, 2895, 1, 0, 0, 0, 0, 0),
(2901, 2897, 'RF2896', NULL, 2896, 1, 0, 0, 0, 0, 0),
(2902, 2898, 'RF2897', NULL, 2897, 1, 0, 0, 0, 0, 0),
(2903, 2899, 'RF2898', NULL, 2898, 1, 0, 0, 0, 0, 0),
(2904, 2900, 'RF2899', NULL, 2899, 1, 0, 0, 0, 0, 0),
(2905, 2901, 'RF2900', NULL, 2900, 1, 0, 0, 0, 0, 0),
(2906, 2902, 'RF2901', NULL, 2901, 1, 0, 0, 0, 0, 0),
(2907, 2903, 'RF2902', NULL, 2902, 1, 0, 0, 0, 0, 0),
(2908, 2904, 'RF2903', NULL, 2903, 1, 0, 0, 0, 0, 0),
(2909, 2905, 'RF2904', NULL, 2904, 1, 0, 0, 0, 0, 0),
(2910, 2906, 'RF2905', NULL, 2905, 1, 0, 0, 0, 0, 0),
(2911, 2907, 'RF2906', NULL, 2906, 1, 0, 0, 0, 0, 0),
(2912, 2908, 'RF2907', NULL, 2907, 1, 0, 0, 0, 0, 0),
(2913, 2909, 'RF2908', NULL, 2908, 1, 0, 0, 0, 0, 0),
(2914, 2910, 'RF2909', NULL, 2909, 1, 0, 0, 0, 0, 0),
(2915, 2911, 'RF2910', NULL, 2910, 1, 0, 0, 0, 0, 0),
(2916, 2912, 'RF2911', NULL, 2911, 1, 0, 0, 0, 0, 0),
(2917, 2913, 'RF2912', NULL, 2912, 1, 0, 0, 0, 0, 0),
(2918, 2914, 'RF2913', NULL, 2913, 1, 0, 0, 0, 0, 0),
(2919, 2915, 'RF2914', NULL, 2914, 1, 0, 0, 0, 0, 0),
(2920, 2916, 'RF2915', NULL, 2915, 1, 0, 0, 0, 0, 0),
(2921, 2917, 'RF2916', NULL, 2916, 1, 0, 0, 0, 0, 0),
(2922, 2918, 'RF2917', NULL, 2917, 1, 0, 0, 0, 0, 0),
(2923, 2919, 'RF2918', NULL, 2918, 1, 0, 0, 0, 0, 0),
(2924, 2920, 'RF2919', NULL, 2919, 1, 0, 0, 0, 0, 0),
(2925, 2921, 'RF2920', NULL, 2920, 1, 0, 0, 0, 0, 0),
(2926, 2922, 'RF2921', NULL, 2921, 1, 0, 0, 0, 0, 0),
(2927, 2923, 'RF2922', NULL, 2922, 1, 0, 0, 0, 0, 0),
(2928, 2924, 'RF2923', NULL, 2923, 1, 0, 0, 0, 0, 0),
(2929, 2925, 'RF2924', NULL, 2924, 1, 0, 0, 0, 0, 0),
(2930, 2926, 'RF2925', NULL, 2925, 1, 0, 0, 0, 0, 0),
(2931, 2927, 'RF2926', NULL, 2926, 1, 0, 0, 0, 0, 0),
(2932, 2928, 'RF2927', NULL, 2927, 1, 0, 0, 0, 0, 0),
(2933, 2929, 'RF2928', NULL, 2928, 1, 0, 0, 0, 0, 0),
(2934, 2930, 'RF2929', NULL, 2929, 1, 0, 0, 0, 0, 0),
(2935, 2931, 'RF2930', NULL, 2930, 1, 0, 0, 0, 0, 0),
(2936, 2932, 'RF2931', NULL, 2931, 1, 0, 0, 0, 0, 0),
(2937, 2933, 'RF2932', NULL, 2932, 1, 0, 0, 0, 0, 0),
(2938, 2934, 'RF2933', NULL, 2933, 1, 0, 0, 0, 0, 0),
(2939, 2935, 'RF2934', NULL, 2934, 1, 0, 0, 0, 0, 0),
(2940, 2936, 'RF2935', NULL, 2935, 1, 0, 0, 0, 0, 0),
(2941, 2937, 'RF2936', NULL, 2936, 1, 0, 0, 0, 0, 0),
(2942, 2938, 'RF2937', NULL, 2937, 1, 0, 0, 0, 0, 0),
(2943, 2939, 'RF2938', NULL, 2938, 1, 0, 0, 0, 0, 0),
(2944, 2940, 'RF2939', NULL, 2939, 1, 0, 0, 0, 0, 0),
(2945, 2941, 'RF2940', NULL, 2940, 1, 0, 0, 0, 0, 0),
(2946, 2942, 'RF2941', NULL, 2941, 1, 0, 0, 0, 0, 0),
(2947, 2943, 'RF2942', NULL, 2942, 1, 0, 0, 0, 0, 0),
(2948, 2944, 'RF2943', NULL, 2943, 1, 0, 0, 0, 0, 0),
(2949, 2945, 'RF2944', NULL, 2944, 1, 0, 0, 0, 0, 0),
(2950, 2946, 'RF2945', NULL, 2945, 1, 0, 0, 0, 0, 0),
(2951, 2947, 'RF2946', NULL, 2946, 1, 0, 0, 0, 0, 0),
(2952, 2948, 'RF2947', NULL, 2947, 1, 0, 0, 0, 0, 0),
(2953, 2949, 'RF2948', NULL, 2948, 1, 0, 0, 0, 0, 0),
(2954, 2950, 'RF2949', NULL, 2949, 1, 0, 0, 0, 0, 0),
(2955, 2951, 'RF2950', NULL, 2950, 1, 0, 0, 0, 0, 0),
(2956, 2952, 'RF2951', NULL, 2951, 1, 0, 0, 0, 0, 0),
(2957, 2953, 'RF2952', NULL, 2952, 1, 0, 0, 0, 0, 0);
INSERT INTO `cms_visitmaster` (`id`, `visit_code`, `visit_name`, `visit_interval`, `visit_order`, `status`, `create_time`, `create_user`, `update_time`, `update_user`, `record_date`) VALUES
(2958, 2954, 'RF2953', NULL, 2953, 1, 0, 0, 0, 0, 0),
(2959, 2955, 'RF2954', NULL, 2954, 1, 0, 0, 0, 0, 0),
(2960, 2956, 'RF2955', NULL, 2955, 1, 0, 0, 0, 0, 0),
(2961, 2957, 'RF2956', NULL, 2956, 1, 0, 0, 0, 0, 0),
(2962, 2958, 'RF2957', NULL, 2957, 1, 0, 0, 0, 0, 0),
(2963, 2959, 'RF2958', NULL, 2958, 1, 0, 0, 0, 0, 0),
(2964, 2960, 'RF2959', NULL, 2959, 1, 0, 0, 0, 0, 0),
(2965, 2961, 'RF2960', NULL, 2960, 1, 0, 0, 0, 0, 0),
(2966, 2962, 'RF2961', NULL, 2961, 1, 0, 0, 0, 0, 0),
(2967, 2963, 'RF2962', NULL, 2962, 1, 0, 0, 0, 0, 0),
(2968, 2964, 'RF2963', NULL, 2963, 1, 0, 0, 0, 0, 0),
(2969, 2965, 'RF2964', NULL, 2964, 1, 0, 0, 0, 0, 0),
(2970, 2966, 'RF2965', NULL, 2965, 1, 0, 0, 0, 0, 0),
(2971, 2967, 'RF2966', NULL, 2966, 1, 0, 0, 0, 0, 0),
(2972, 2968, 'RF2967', NULL, 2967, 1, 0, 0, 0, 0, 0),
(2973, 2969, 'RF2968', NULL, 2968, 1, 0, 0, 0, 0, 0),
(2974, 2970, 'RF2969', NULL, 2969, 1, 0, 0, 0, 0, 0),
(2975, 2971, 'RF2970', NULL, 2970, 1, 0, 0, 0, 0, 0),
(2976, 2972, 'RF2971', NULL, 2971, 1, 0, 0, 0, 0, 0),
(2977, 2973, 'RF2972', NULL, 2972, 1, 0, 0, 0, 0, 0),
(2978, 2974, 'RF2973', NULL, 2973, 1, 0, 0, 0, 0, 0),
(2979, 2975, 'RF2974', NULL, 2974, 1, 0, 0, 0, 0, 0),
(2980, 2976, 'RF2975', NULL, 2975, 1, 0, 0, 0, 0, 0),
(2981, 2977, 'RF2976', NULL, 2976, 1, 0, 0, 0, 0, 0),
(2982, 2978, 'RF2977', NULL, 2977, 1, 0, 0, 0, 0, 0),
(2983, 2979, 'RF2978', NULL, 2978, 1, 0, 0, 0, 0, 0),
(2984, 2980, 'RF2979', NULL, 2979, 1, 0, 0, 0, 0, 0),
(2985, 2981, 'RF2980', NULL, 2980, 1, 0, 0, 0, 0, 0),
(2986, 2982, 'RF2981', NULL, 2981, 1, 0, 0, 0, 0, 0),
(2987, 2983, 'RF2982', NULL, 2982, 1, 0, 0, 0, 0, 0),
(2988, 2984, 'RF2983', NULL, 2983, 1, 0, 0, 0, 0, 0),
(2989, 2985, 'RF2984', NULL, 2984, 1, 0, 0, 0, 0, 0),
(2990, 2986, 'RF2985', NULL, 2985, 1, 0, 0, 0, 0, 0),
(2991, 2987, 'RF2986', NULL, 2986, 1, 0, 0, 0, 0, 0),
(2992, 2988, 'RF2987', NULL, 2987, 1, 0, 0, 0, 0, 0),
(2993, 2989, 'RF2988', NULL, 2988, 1, 0, 0, 0, 0, 0),
(2994, 2990, 'RF2989', NULL, 2989, 1, 0, 0, 0, 0, 0),
(2995, 2991, 'RF2990', NULL, 2990, 1, 0, 0, 0, 0, 0),
(2996, 2992, 'RF2991', NULL, 2991, 1, 0, 0, 0, 0, 0),
(2997, 2993, 'RF2992', NULL, 2992, 1, 0, 0, 0, 0, 0),
(2998, 2994, 'RF2993', NULL, 2993, 1, 0, 0, 0, 0, 0),
(2999, 2995, 'RF2994', NULL, 2994, 1, 0, 0, 0, 0, 0),
(3000, 2996, 'RF2995', NULL, 2995, 1, 0, 0, 0, 0, 0),
(3001, 2997, 'RF2996', NULL, 2996, 1, 0, 0, 0, 0, 0),
(3002, 2998, 'RF2997', NULL, 2997, 1, 0, 0, 0, 0, 0),
(3003, 2999, 'RF2998', NULL, 2998, 1, 0, 0, 0, 0, 0),
(3004, 3000, 'RF2999', NULL, 2999, 1, 0, 0, 0, 0, 0),
(3005, 3001, 'RF3000', NULL, 3000, 1, 0, 0, 0, 0, 0),
(3006, 3002, 'RF3001', NULL, 3001, 1, 0, 0, 0, 0, 0),
(3007, 3003, 'RF3002', NULL, 3002, 1, 0, 0, 0, 0, 0),
(3008, 3004, 'RF3003', NULL, 3003, 1, 0, 0, 0, 0, 0),
(3009, 3005, 'RF3004', NULL, 3004, 1, 0, 0, 0, 0, 0),
(3010, 3006, 'RF3005', NULL, 3005, 1, 0, 0, 0, 0, 0),
(3011, 3007, 'RF3006', NULL, 3006, 1, 0, 0, 0, 0, 0),
(3012, 3008, 'RF3007', NULL, 3007, 1, 0, 0, 0, 0, 0),
(3013, 3009, 'RF3008', NULL, 3008, 1, 0, 0, 0, 0, 0),
(3014, 3010, 'RF3009', NULL, 3009, 1, 0, 0, 0, 0, 0),
(3015, 3011, 'RF3010', NULL, 3010, 1, 0, 0, 0, 0, 0),
(3016, 3012, 'RF3011', NULL, 3011, 1, 0, 0, 0, 0, 0),
(3017, 3013, 'RF3012', NULL, 3012, 1, 0, 0, 0, 0, 0),
(3018, 3014, 'RF3013', NULL, 3013, 1, 0, 0, 0, 0, 0),
(3019, 3015, 'RF3014', NULL, 3014, 1, 0, 0, 0, 0, 0),
(3020, 3016, 'RF3015', NULL, 3015, 1, 0, 0, 0, 0, 0),
(3021, 3017, 'RF3016', NULL, 3016, 1, 0, 0, 0, 0, 0),
(3022, 3018, 'RF3017', NULL, 3017, 1, 0, 0, 0, 0, 0),
(3023, 3019, 'RF3018', NULL, 3018, 1, 0, 0, 0, 0, 0),
(3024, 3020, 'RF3019', NULL, 3019, 1, 0, 0, 0, 0, 0),
(3025, 3021, 'RF3020', NULL, 3020, 1, 0, 0, 0, 0, 0),
(3026, 3022, 'RF3021', NULL, 3021, 1, 0, 0, 0, 0, 0),
(3027, 3023, 'RF3022', NULL, 3022, 1, 0, 0, 0, 0, 0),
(3028, 3024, 'RF3023', NULL, 3023, 1, 0, 0, 0, 0, 0),
(3029, 3025, 'RF3024', NULL, 3024, 1, 0, 0, 0, 0, 0),
(3030, 3026, 'RF3025', NULL, 3025, 1, 0, 0, 0, 0, 0),
(3031, 3027, 'RF3026', NULL, 3026, 1, 0, 0, 0, 0, 0),
(3032, 3028, 'RF3027', NULL, 3027, 1, 0, 0, 0, 0, 0),
(3033, 3029, 'RF3028', NULL, 3028, 1, 0, 0, 0, 0, 0),
(3034, 3030, 'RF3029', NULL, 3029, 1, 0, 0, 0, 0, 0),
(3035, 3031, 'RF3030', NULL, 3030, 1, 0, 0, 0, 0, 0),
(3036, 3032, 'RF3031', NULL, 3031, 1, 0, 0, 0, 0, 0),
(3037, 3033, 'RF3032', NULL, 3032, 1, 0, 0, 0, 0, 0),
(3038, 3034, 'RF3033', NULL, 3033, 1, 0, 0, 0, 0, 0),
(3039, 3035, 'RF3034', NULL, 3034, 1, 0, 0, 0, 0, 0),
(3040, 3036, 'RF3035', NULL, 3035, 1, 0, 0, 0, 0, 0),
(3041, 3037, 'RF3036', NULL, 3036, 1, 0, 0, 0, 0, 0),
(3042, 3038, 'RF3037', NULL, 3037, 1, 0, 0, 0, 0, 0),
(3043, 3039, 'RF3038', NULL, 3038, 1, 0, 0, 0, 0, 0),
(3044, 3040, 'RF3039', NULL, 3039, 1, 0, 0, 0, 0, 0),
(3045, 3041, 'RF3040', NULL, 3040, 1, 0, 0, 0, 0, 0),
(3046, 3042, 'RF3041', NULL, 3041, 1, 0, 0, 0, 0, 0),
(3047, 3043, 'RF3042', NULL, 3042, 1, 0, 0, 0, 0, 0),
(3048, 3044, 'RF3043', NULL, 3043, 1, 0, 0, 0, 0, 0),
(3049, 3045, 'RF3044', NULL, 3044, 1, 0, 0, 0, 0, 0),
(3050, 3046, 'RF3045', NULL, 3045, 1, 0, 0, 0, 0, 0),
(3051, 3047, 'RF3046', NULL, 3046, 1, 0, 0, 0, 0, 0),
(3052, 3048, 'RF3047', NULL, 3047, 1, 0, 0, 0, 0, 0),
(3053, 3049, 'RF3048', NULL, 3048, 1, 0, 0, 0, 0, 0),
(3054, 3050, 'RF3049', NULL, 3049, 1, 0, 0, 0, 0, 0),
(3055, 3051, 'RF3050', NULL, 3050, 1, 0, 0, 0, 0, 0),
(3056, 3052, 'RF3051', NULL, 3051, 1, 0, 0, 0, 0, 0),
(3057, 3053, 'RF3052', NULL, 3052, 1, 0, 0, 0, 0, 0),
(3058, 3054, 'RF3053', NULL, 3053, 1, 0, 0, 0, 0, 0),
(3059, 3055, 'RF3054', NULL, 3054, 1, 0, 0, 0, 0, 0),
(3060, 3056, 'RF3055', NULL, 3055, 1, 0, 0, 0, 0, 0),
(3061, 3057, 'RF3056', NULL, 3056, 1, 0, 0, 0, 0, 0),
(3062, 3058, 'RF3057', NULL, 3057, 1, 0, 0, 0, 0, 0),
(3063, 3059, 'RF3058', NULL, 3058, 1, 0, 0, 0, 0, 0),
(3064, 3060, 'RF3059', NULL, 3059, 1, 0, 0, 0, 0, 0),
(3065, 3061, 'RF3060', NULL, 3060, 1, 0, 0, 0, 0, 0),
(3066, 3062, 'RF3061', NULL, 3061, 1, 0, 0, 0, 0, 0),
(3067, 3063, 'RF3062', NULL, 3062, 1, 0, 0, 0, 0, 0),
(3068, 3064, 'RF3063', NULL, 3063, 1, 0, 0, 0, 0, 0),
(3069, 3065, 'RF3064', NULL, 3064, 1, 0, 0, 0, 0, 0),
(3070, 3066, 'RF3065', NULL, 3065, 1, 0, 0, 0, 0, 0),
(3071, 3067, 'RF3066', NULL, 3066, 1, 0, 0, 0, 0, 0),
(3072, 3068, 'RF3067', NULL, 3067, 1, 0, 0, 0, 0, 0),
(3073, 3069, 'RF3068', NULL, 3068, 1, 0, 0, 0, 0, 0),
(3074, 3070, 'RF3069', NULL, 3069, 1, 0, 0, 0, 0, 0),
(3075, 3071, 'RF3070', NULL, 3070, 1, 0, 0, 0, 0, 0),
(3076, 3072, 'RF3071', NULL, 3071, 1, 0, 0, 0, 0, 0),
(3077, 3073, 'RF3072', NULL, 3072, 1, 0, 0, 0, 0, 0),
(3078, 3074, 'RF3073', NULL, 3073, 1, 0, 0, 0, 0, 0),
(3079, 3075, 'RF3074', NULL, 3074, 1, 0, 0, 0, 0, 0),
(3080, 3076, 'RF3075', NULL, 3075, 1, 0, 0, 0, 0, 0),
(3081, 3077, 'RF3076', NULL, 3076, 1, 0, 0, 0, 0, 0),
(3082, 3078, 'RF3077', NULL, 3077, 1, 0, 0, 0, 0, 0),
(3083, 3079, 'RF3078', NULL, 3078, 1, 0, 0, 0, 0, 0),
(3084, 3080, 'RF3079', NULL, 3079, 1, 0, 0, 0, 0, 0),
(3085, 3081, 'RF3080', NULL, 3080, 1, 0, 0, 0, 0, 0),
(3086, 3082, 'RF3081', NULL, 3081, 1, 0, 0, 0, 0, 0),
(3087, 3083, 'RF3082', NULL, 3082, 1, 0, 0, 0, 0, 0),
(3088, 3084, 'RF3083', NULL, 3083, 1, 0, 0, 0, 0, 0),
(3089, 3085, 'RF3084', NULL, 3084, 1, 0, 0, 0, 0, 0),
(3090, 3086, 'RF3085', NULL, 3085, 1, 0, 0, 0, 0, 0),
(3091, 3087, 'RF3086', NULL, 3086, 1, 0, 0, 0, 0, 0),
(3092, 3088, 'RF3087', NULL, 3087, 1, 0, 0, 0, 0, 0),
(3093, 3089, 'RF3088', NULL, 3088, 1, 0, 0, 0, 0, 0),
(3094, 3090, 'RF3089', NULL, 3089, 1, 0, 0, 0, 0, 0),
(3095, 3091, 'RF3090', NULL, 3090, 1, 0, 0, 0, 0, 0),
(3096, 3092, 'RF3091', NULL, 3091, 1, 0, 0, 0, 0, 0),
(3097, 3093, 'RF3092', NULL, 3092, 1, 0, 0, 0, 0, 0),
(3098, 3094, 'RF3093', NULL, 3093, 1, 0, 0, 0, 0, 0),
(3099, 3095, 'RF3094', NULL, 3094, 1, 0, 0, 0, 0, 0),
(3100, 3096, 'RF3095', NULL, 3095, 1, 0, 0, 0, 0, 0),
(3101, 3097, 'RF3096', NULL, 3096, 1, 0, 0, 0, 0, 0),
(3102, 3098, 'RF3097', NULL, 3097, 1, 0, 0, 0, 0, 0),
(3103, 3099, 'RF3098', NULL, 3098, 1, 0, 0, 0, 0, 0),
(3104, 3100, 'RF3099', NULL, 3099, 1, 0, 0, 0, 0, 0),
(3105, 3101, 'RF3100', NULL, 3100, 1, 0, 0, 0, 0, 0),
(3106, 3102, 'RF3101', NULL, 3101, 1, 0, 0, 0, 0, 0),
(3107, 3103, 'RF3102', NULL, 3102, 1, 0, 0, 0, 0, 0),
(3108, 3104, 'RF3103', NULL, 3103, 1, 0, 0, 0, 0, 0),
(3109, 3105, 'RF3104', NULL, 3104, 1, 0, 0, 0, 0, 0),
(3110, 3106, 'RF3105', NULL, 3105, 1, 0, 0, 0, 0, 0),
(3111, 3107, 'RF3106', NULL, 3106, 1, 0, 0, 0, 0, 0),
(3112, 3108, 'RF3107', NULL, 3107, 1, 0, 0, 0, 0, 0),
(3113, 3109, 'RF3108', NULL, 3108, 1, 0, 0, 0, 0, 0),
(3114, 3110, 'RF3109', NULL, 3109, 1, 0, 0, 0, 0, 0),
(3115, 3111, 'RF3110', NULL, 3110, 1, 0, 0, 0, 0, 0),
(3116, 3112, 'RF3111', NULL, 3111, 1, 0, 0, 0, 0, 0),
(3117, 3113, 'RF3112', NULL, 3112, 1, 0, 0, 0, 0, 0),
(3118, 3114, 'RF3113', NULL, 3113, 1, 0, 0, 0, 0, 0),
(3119, 3115, 'RF3114', NULL, 3114, 1, 0, 0, 0, 0, 0),
(3120, 3116, 'RF3115', NULL, 3115, 1, 0, 0, 0, 0, 0),
(3121, 3117, 'RF3116', NULL, 3116, 1, 0, 0, 0, 0, 0),
(3122, 3118, 'RF3117', NULL, 3117, 1, 0, 0, 0, 0, 0),
(3123, 3119, 'RF3118', NULL, 3118, 1, 0, 0, 0, 0, 0),
(3124, 3120, 'RF3119', NULL, 3119, 1, 0, 0, 0, 0, 0),
(3125, 3121, 'RF3120', NULL, 3120, 1, 0, 0, 0, 0, 0),
(3126, 3122, 'RF3121', NULL, 3121, 1, 0, 0, 0, 0, 0),
(3127, 3123, 'RF3122', NULL, 3122, 1, 0, 0, 0, 0, 0),
(3128, 3124, 'RF3123', NULL, 3123, 1, 0, 0, 0, 0, 0),
(3129, 3125, 'RF3124', NULL, 3124, 1, 0, 0, 0, 0, 0),
(3130, 3126, 'RF3125', NULL, 3125, 1, 0, 0, 0, 0, 0),
(3131, 3127, 'RF3126', NULL, 3126, 1, 0, 0, 0, 0, 0),
(3132, 3128, 'RF3127', NULL, 3127, 1, 0, 0, 0, 0, 0),
(3133, 3129, 'RF3128', NULL, 3128, 1, 0, 0, 0, 0, 0),
(3134, 3130, 'RF3129', NULL, 3129, 1, 0, 0, 0, 0, 0),
(3135, 3131, 'RF3130', NULL, 3130, 1, 0, 0, 0, 0, 0),
(3136, 3132, 'RF3131', NULL, 3131, 1, 0, 0, 0, 0, 0),
(3137, 3133, 'RF3132', NULL, 3132, 1, 0, 0, 0, 0, 0),
(3138, 3134, 'RF3133', NULL, 3133, 1, 0, 0, 0, 0, 0),
(3139, 3135, 'RF3134', NULL, 3134, 1, 0, 0, 0, 0, 0),
(3140, 3136, 'RF3135', NULL, 3135, 1, 0, 0, 0, 0, 0),
(3141, 3137, 'RF3136', NULL, 3136, 1, 0, 0, 0, 0, 0),
(3142, 3138, 'RF3137', NULL, 3137, 1, 0, 0, 0, 0, 0),
(3143, 3139, 'RF3138', NULL, 3138, 1, 0, 0, 0, 0, 0),
(3144, 3140, 'RF3139', NULL, 3139, 1, 0, 0, 0, 0, 0),
(3145, 3141, 'RF3140', NULL, 3140, 1, 0, 0, 0, 0, 0),
(3146, 3142, 'RF3141', NULL, 3141, 1, 0, 0, 0, 0, 0),
(3147, 3143, 'RF3142', NULL, 3142, 1, 0, 0, 0, 0, 0),
(3148, 3144, 'RF3143', NULL, 3143, 1, 0, 0, 0, 0, 0),
(3149, 3145, 'RF3144', NULL, 3144, 1, 0, 0, 0, 0, 0),
(3150, 3146, 'RF3145', NULL, 3145, 1, 0, 0, 0, 0, 0),
(3151, 3147, 'RF3146', NULL, 3146, 1, 0, 0, 0, 0, 0),
(3152, 3148, 'RF3147', NULL, 3147, 1, 0, 0, 0, 0, 0),
(3153, 3149, 'RF3148', NULL, 3148, 1, 0, 0, 0, 0, 0),
(3154, 3150, 'RF3149', NULL, 3149, 1, 0, 0, 0, 0, 0),
(3155, 3151, 'RF3150', NULL, 3150, 1, 0, 0, 0, 0, 0),
(3156, 3152, 'RF3151', NULL, 3151, 1, 0, 0, 0, 0, 0),
(3157, 3153, 'RF3152', NULL, 3152, 1, 0, 0, 0, 0, 0),
(3158, 3154, 'RF3153', NULL, 3153, 1, 0, 0, 0, 0, 0),
(3159, 3155, 'RF3154', NULL, 3154, 1, 0, 0, 0, 0, 0),
(3160, 3156, 'RF3155', NULL, 3155, 1, 0, 0, 0, 0, 0),
(3161, 3157, 'RF3156', NULL, 3156, 1, 0, 0, 0, 0, 0),
(3162, 3158, 'RF3157', NULL, 3157, 1, 0, 0, 0, 0, 0),
(3163, 3159, 'RF3158', NULL, 3158, 1, 0, 0, 0, 0, 0),
(3164, 3160, 'RF3159', NULL, 3159, 1, 0, 0, 0, 0, 0),
(3165, 3161, 'RF3160', NULL, 3160, 1, 0, 0, 0, 0, 0),
(3166, 3162, 'RF3161', NULL, 3161, 1, 0, 0, 0, 0, 0),
(3167, 3163, 'RF3162', NULL, 3162, 1, 0, 0, 0, 0, 0),
(3168, 3164, 'RF3163', NULL, 3163, 1, 0, 0, 0, 0, 0),
(3169, 3165, 'RF3164', NULL, 3164, 1, 0, 0, 0, 0, 0),
(3170, 3166, 'RF3165', NULL, 3165, 1, 0, 0, 0, 0, 0),
(3171, 3167, 'RF3166', NULL, 3166, 1, 0, 0, 0, 0, 0),
(3172, 3168, 'RF3167', NULL, 3167, 1, 0, 0, 0, 0, 0),
(3173, 3169, 'RF3168', NULL, 3168, 1, 0, 0, 0, 0, 0),
(3174, 3170, 'RF3169', NULL, 3169, 1, 0, 0, 0, 0, 0),
(3175, 3171, 'RF3170', NULL, 3170, 1, 0, 0, 0, 0, 0),
(3176, 3172, 'RF3171', NULL, 3171, 1, 0, 0, 0, 0, 0),
(3177, 3173, 'RF3172', NULL, 3172, 1, 0, 0, 0, 0, 0),
(3178, 3174, 'RF3173', NULL, 3173, 1, 0, 0, 0, 0, 0),
(3179, 3175, 'RF3174', NULL, 3174, 1, 0, 0, 0, 0, 0),
(3180, 3176, 'RF3175', NULL, 3175, 1, 0, 0, 0, 0, 0),
(3181, 3177, 'RF3176', NULL, 3176, 1, 0, 0, 0, 0, 0),
(3182, 3178, 'RF3177', NULL, 3177, 1, 0, 0, 0, 0, 0),
(3183, 3179, 'RF3178', NULL, 3178, 1, 0, 0, 0, 0, 0),
(3184, 3180, 'RF3179', NULL, 3179, 1, 0, 0, 0, 0, 0),
(3185, 3181, 'RF3180', NULL, 3180, 1, 0, 0, 0, 0, 0),
(3186, 3182, 'RF3181', NULL, 3181, 1, 0, 0, 0, 0, 0),
(3187, 3183, 'RF3182', NULL, 3182, 1, 0, 0, 0, 0, 0),
(3188, 3184, 'RF3183', NULL, 3183, 1, 0, 0, 0, 0, 0),
(3189, 3185, 'RF3184', NULL, 3184, 1, 0, 0, 0, 0, 0),
(3190, 3186, 'RF3185', NULL, 3185, 1, 0, 0, 0, 0, 0),
(3191, 3187, 'RF3186', NULL, 3186, 1, 0, 0, 0, 0, 0),
(3192, 3188, 'RF3187', NULL, 3187, 1, 0, 0, 0, 0, 0),
(3193, 3189, 'RF3188', NULL, 3188, 1, 0, 0, 0, 0, 0),
(3194, 3190, 'RF3189', NULL, 3189, 1, 0, 0, 0, 0, 0),
(3195, 3191, 'RF3190', NULL, 3190, 1, 0, 0, 0, 0, 0),
(3196, 3192, 'RF3191', NULL, 3191, 1, 0, 0, 0, 0, 0),
(3197, 3193, 'RF3192', NULL, 3192, 1, 0, 0, 0, 0, 0),
(3198, 3194, 'RF3193', NULL, 3193, 1, 0, 0, 0, 0, 0),
(3199, 3195, 'RF3194', NULL, 3194, 1, 0, 0, 0, 0, 0),
(3200, 3196, 'RF3195', NULL, 3195, 1, 0, 0, 0, 0, 0),
(3201, 3197, 'RF3196', NULL, 3196, 1, 0, 0, 0, 0, 0),
(3202, 3198, 'RF3197', NULL, 3197, 1, 0, 0, 0, 0, 0),
(3203, 3199, 'RF3198', NULL, 3198, 1, 0, 0, 0, 0, 0),
(3204, 3200, 'RF3199', NULL, 3199, 1, 0, 0, 0, 0, 0),
(3205, 3201, 'RF3200', NULL, 3200, 1, 0, 0, 0, 0, 0),
(3206, 3202, 'RF3201', NULL, 3201, 1, 0, 0, 0, 0, 0),
(3207, 3203, 'RF3202', NULL, 3202, 1, 0, 0, 0, 0, 0),
(3208, 3204, 'RF3203', NULL, 3203, 1, 0, 0, 0, 0, 0),
(3209, 3205, 'RF3204', NULL, 3204, 1, 0, 0, 0, 0, 0),
(3210, 3206, 'RF3205', NULL, 3205, 1, 0, 0, 0, 0, 0),
(3211, 3207, 'RF3206', NULL, 3206, 1, 0, 0, 0, 0, 0),
(3212, 3208, 'RF3207', NULL, 3207, 1, 0, 0, 0, 0, 0),
(3213, 3209, 'RF3208', NULL, 3208, 1, 0, 0, 0, 0, 0),
(3214, 3210, 'RF3209', NULL, 3209, 1, 0, 0, 0, 0, 0),
(3215, 3211, 'RF3210', NULL, 3210, 1, 0, 0, 0, 0, 0),
(3216, 3212, 'RF3211', NULL, 3211, 1, 0, 0, 0, 0, 0),
(3217, 3213, 'RF3212', NULL, 3212, 1, 0, 0, 0, 0, 0),
(3218, 3214, 'RF3213', NULL, 3213, 1, 0, 0, 0, 0, 0),
(3219, 3215, 'RF3214', NULL, 3214, 1, 0, 0, 0, 0, 0),
(3220, 3216, 'RF3215', NULL, 3215, 1, 0, 0, 0, 0, 0),
(3221, 3217, 'RF3216', NULL, 3216, 1, 0, 0, 0, 0, 0),
(3222, 3218, 'RF3217', NULL, 3217, 1, 0, 0, 0, 0, 0),
(3223, 3219, 'RF3218', NULL, 3218, 1, 0, 0, 0, 0, 0),
(3224, 3220, 'RF3219', NULL, 3219, 1, 0, 0, 0, 0, 0),
(3225, 3221, 'RF3220', NULL, 3220, 1, 0, 0, 0, 0, 0),
(3226, 3222, 'RF3221', NULL, 3221, 1, 0, 0, 0, 0, 0),
(3227, 3223, 'RF3222', NULL, 3222, 1, 0, 0, 0, 0, 0),
(3228, 3224, 'RF3223', NULL, 3223, 1, 0, 0, 0, 0, 0),
(3229, 3225, 'RF3224', NULL, 3224, 1, 0, 0, 0, 0, 0),
(3230, 3226, 'RF3225', NULL, 3225, 1, 0, 0, 0, 0, 0),
(3231, 3227, 'RF3226', NULL, 3226, 1, 0, 0, 0, 0, 0),
(3232, 3228, 'RF3227', NULL, 3227, 1, 0, 0, 0, 0, 0),
(3233, 3229, 'RF3228', NULL, 3228, 1, 0, 0, 0, 0, 0),
(3234, 3230, 'RF3229', NULL, 3229, 1, 0, 0, 0, 0, 0),
(3235, 3231, 'RF3230', NULL, 3230, 1, 0, 0, 0, 0, 0),
(3236, 3232, 'RF3231', NULL, 3231, 1, 0, 0, 0, 0, 0),
(3237, 3233, 'RF3232', NULL, 3232, 1, 0, 0, 0, 0, 0),
(3238, 3234, 'RF3233', NULL, 3233, 1, 0, 0, 0, 0, 0),
(3239, 3235, 'RF3234', NULL, 3234, 1, 0, 0, 0, 0, 0),
(3240, 3236, 'RF3235', NULL, 3235, 1, 0, 0, 0, 0, 0),
(3241, 3237, 'RF3236', NULL, 3236, 1, 0, 0, 0, 0, 0),
(3242, 3238, 'RF3237', NULL, 3237, 1, 0, 0, 0, 0, 0),
(3243, 3239, 'RF3238', NULL, 3238, 1, 0, 0, 0, 0, 0),
(3244, 3240, 'RF3239', NULL, 3239, 1, 0, 0, 0, 0, 0),
(3245, 3241, 'RF3240', NULL, 3240, 1, 0, 0, 0, 0, 0),
(3246, 3242, 'RF3241', NULL, 3241, 1, 0, 0, 0, 0, 0),
(3247, 3243, 'RF3242', NULL, 3242, 1, 0, 0, 0, 0, 0),
(3248, 3244, 'RF3243', NULL, 3243, 1, 0, 0, 0, 0, 0),
(3249, 3245, 'RF3244', NULL, 3244, 1, 0, 0, 0, 0, 0),
(3250, 3246, 'RF3245', NULL, 3245, 1, 0, 0, 0, 0, 0),
(3251, 3247, 'RF3246', NULL, 3246, 1, 0, 0, 0, 0, 0),
(3252, 3248, 'RF3247', NULL, 3247, 1, 0, 0, 0, 0, 0),
(3253, 3249, 'RF3248', NULL, 3248, 1, 0, 0, 0, 0, 0),
(3254, 3250, 'RF3249', NULL, 3249, 1, 0, 0, 0, 0, 0),
(3255, 3251, 'RF3250', NULL, 3250, 1, 0, 0, 0, 0, 0),
(3256, 3252, 'RF3251', NULL, 3251, 1, 0, 0, 0, 0, 0),
(3257, 3253, 'RF3252', NULL, 3252, 1, 0, 0, 0, 0, 0),
(3258, 3254, 'RF3253', NULL, 3253, 1, 0, 0, 0, 0, 0),
(3259, 3255, 'RF3254', NULL, 3254, 1, 0, 0, 0, 0, 0),
(3260, 3256, 'RF3255', NULL, 3255, 1, 0, 0, 0, 0, 0),
(3261, 3257, 'RF3256', NULL, 3256, 1, 0, 0, 0, 0, 0),
(3262, 3258, 'RF3257', NULL, 3257, 1, 0, 0, 0, 0, 0),
(3263, 3259, 'RF3258', NULL, 3258, 1, 0, 0, 0, 0, 0),
(3264, 3260, 'RF3259', NULL, 3259, 1, 0, 0, 0, 0, 0),
(3265, 3261, 'RF3260', NULL, 3260, 1, 0, 0, 0, 0, 0),
(3266, 3262, 'RF3261', NULL, 3261, 1, 0, 0, 0, 0, 0),
(3267, 3263, 'RF3262', NULL, 3262, 1, 0, 0, 0, 0, 0),
(3268, 3264, 'RF3263', NULL, 3263, 1, 0, 0, 0, 0, 0),
(3269, 3265, 'RF3264', NULL, 3264, 1, 0, 0, 0, 0, 0),
(3270, 3266, 'RF3265', NULL, 3265, 1, 0, 0, 0, 0, 0),
(3271, 3267, 'RF3266', NULL, 3266, 1, 0, 0, 0, 0, 0),
(3272, 3268, 'RF3267', NULL, 3267, 1, 0, 0, 0, 0, 0),
(3273, 3269, 'RF3268', NULL, 3268, 1, 0, 0, 0, 0, 0),
(3274, 3270, 'RF3269', NULL, 3269, 1, 0, 0, 0, 0, 0),
(3275, 3271, 'RF3270', NULL, 3270, 1, 0, 0, 0, 0, 0),
(3276, 3272, 'RF3271', NULL, 3271, 1, 0, 0, 0, 0, 0),
(3277, 3273, 'RF3272', NULL, 3272, 1, 0, 0, 0, 0, 0),
(3278, 3274, 'RF3273', NULL, 3273, 1, 0, 0, 0, 0, 0),
(3279, 3275, 'RF3274', NULL, 3274, 1, 0, 0, 0, 0, 0),
(3280, 3276, 'RF3275', NULL, 3275, 1, 0, 0, 0, 0, 0),
(3281, 3277, 'RF3276', NULL, 3276, 1, 0, 0, 0, 0, 0),
(3282, 3278, 'RF3277', NULL, 3277, 1, 0, 0, 0, 0, 0),
(3283, 3279, 'RF3278', NULL, 3278, 1, 0, 0, 0, 0, 0),
(3284, 3280, 'RF3279', NULL, 3279, 1, 0, 0, 0, 0, 0),
(3285, 3281, 'RF3280', NULL, 3280, 1, 0, 0, 0, 0, 0),
(3286, 3282, 'RF3281', NULL, 3281, 1, 0, 0, 0, 0, 0),
(3287, 3283, 'RF3282', NULL, 3282, 1, 0, 0, 0, 0, 0),
(3288, 3284, 'RF3283', NULL, 3283, 1, 0, 0, 0, 0, 0),
(3289, 3285, 'RF3284', NULL, 3284, 1, 0, 0, 0, 0, 0),
(3290, 3286, 'RF3285', NULL, 3285, 1, 0, 0, 0, 0, 0),
(3291, 3287, 'RF3286', NULL, 3286, 1, 0, 0, 0, 0, 0),
(3292, 3288, 'RF3287', NULL, 3287, 1, 0, 0, 0, 0, 0),
(3293, 3289, 'RF3288', NULL, 3288, 1, 0, 0, 0, 0, 0),
(3294, 3290, 'RF3289', NULL, 3289, 1, 0, 0, 0, 0, 0),
(3295, 3291, 'RF3290', NULL, 3290, 1, 0, 0, 0, 0, 0),
(3296, 3292, 'RF3291', NULL, 3291, 1, 0, 0, 0, 0, 0),
(3297, 3293, 'RF3292', NULL, 3292, 1, 0, 0, 0, 0, 0),
(3298, 3294, 'RF3293', NULL, 3293, 1, 0, 0, 0, 0, 0),
(3299, 3295, 'RF3294', NULL, 3294, 1, 0, 0, 0, 0, 0),
(3300, 3296, 'RF3295', NULL, 3295, 1, 0, 0, 0, 0, 0),
(3301, 3297, 'RF3296', NULL, 3296, 1, 0, 0, 0, 0, 0),
(3302, 3298, 'RF3297', NULL, 3297, 1, 0, 0, 0, 0, 0),
(3303, 3299, 'RF3298', NULL, 3298, 1, 0, 0, 0, 0, 0),
(3304, 3300, 'RF3299', NULL, 3299, 1, 0, 0, 0, 0, 0),
(3305, 3301, 'RF3300', NULL, 3300, 1, 0, 0, 0, 0, 0),
(3306, 3302, 'RF3301', NULL, 3301, 1, 0, 0, 0, 0, 0),
(3307, 3303, 'RF3302', NULL, 3302, 1, 0, 0, 0, 0, 0),
(3308, 3304, 'RF3303', NULL, 3303, 1, 0, 0, 0, 0, 0),
(3309, 3305, 'RF3304', NULL, 3304, 1, 0, 0, 0, 0, 0),
(3310, 3306, 'RF3305', NULL, 3305, 1, 0, 0, 0, 0, 0),
(3311, 3307, 'RF3306', NULL, 3306, 1, 0, 0, 0, 0, 0),
(3312, 3308, 'RF3307', NULL, 3307, 1, 0, 0, 0, 0, 0),
(3313, 3309, 'RF3308', NULL, 3308, 1, 0, 0, 0, 0, 0),
(3314, 3310, 'RF3309', NULL, 3309, 1, 0, 0, 0, 0, 0),
(3315, 3311, 'RF3310', NULL, 3310, 1, 0, 0, 0, 0, 0),
(3316, 3312, 'RF3311', NULL, 3311, 1, 0, 0, 0, 0, 0),
(3317, 3313, 'RF3312', NULL, 3312, 1, 0, 0, 0, 0, 0),
(3318, 3314, 'RF3313', NULL, 3313, 1, 0, 0, 0, 0, 0),
(3319, 3315, 'RF3314', NULL, 3314, 1, 0, 0, 0, 0, 0),
(3320, 3316, 'RF3315', NULL, 3315, 1, 0, 0, 0, 0, 0),
(3321, 3317, 'RF3316', NULL, 3316, 1, 0, 0, 0, 0, 0),
(3322, 3318, 'RF3317', NULL, 3317, 1, 0, 0, 0, 0, 0),
(3323, 3319, 'RF3318', NULL, 3318, 1, 0, 0, 0, 0, 0),
(3324, 3320, 'RF3319', NULL, 3319, 1, 0, 0, 0, 0, 0),
(3325, 3321, 'RF3320', NULL, 3320, 1, 0, 0, 0, 0, 0),
(3326, 3322, 'RF3321', NULL, 3321, 1, 0, 0, 0, 0, 0),
(3327, 3323, 'RF3322', NULL, 3322, 1, 0, 0, 0, 0, 0),
(3328, 3324, 'RF3323', NULL, 3323, 1, 0, 0, 0, 0, 0),
(3329, 3325, 'RF3324', NULL, 3324, 1, 0, 0, 0, 0, 0),
(3330, 3326, 'RF3325', NULL, 3325, 1, 0, 0, 0, 0, 0),
(3331, 3327, 'RF3326', NULL, 3326, 1, 0, 0, 0, 0, 0),
(3332, 3328, 'RF3327', NULL, 3327, 1, 0, 0, 0, 0, 0),
(3333, 3329, 'RF3328', NULL, 3328, 1, 0, 0, 0, 0, 0),
(3334, 3330, 'RF3329', NULL, 3329, 1, 0, 0, 0, 0, 0),
(3335, 3331, 'RF3330', NULL, 3330, 1, 0, 0, 0, 0, 0),
(3336, 3332, 'RF3331', NULL, 3331, 1, 0, 0, 0, 0, 0),
(3337, 3333, 'RF3332', NULL, 3332, 1, 0, 0, 0, 0, 0),
(3338, 3334, 'RF3333', NULL, 3333, 1, 0, 0, 0, 0, 0),
(3339, 3335, 'RF3334', NULL, 3334, 1, 0, 0, 0, 0, 0),
(3340, 3336, 'RF3335', NULL, 3335, 1, 0, 0, 0, 0, 0),
(3341, 3337, 'RF3336', NULL, 3336, 1, 0, 0, 0, 0, 0),
(3342, 3338, 'RF3337', NULL, 3337, 1, 0, 0, 0, 0, 0),
(3343, 3339, 'RF3338', NULL, 3338, 1, 0, 0, 0, 0, 0),
(3344, 3340, 'RF3339', NULL, 3339, 1, 0, 0, 0, 0, 0),
(3345, 3341, 'RF3340', NULL, 3340, 1, 0, 0, 0, 0, 0),
(3346, 3342, 'RF3341', NULL, 3341, 1, 0, 0, 0, 0, 0),
(3347, 3343, 'RF3342', NULL, 3342, 1, 0, 0, 0, 0, 0),
(3348, 3344, 'RF3343', NULL, 3343, 1, 0, 0, 0, 0, 0),
(3349, 3345, 'RF3344', NULL, 3344, 1, 0, 0, 0, 0, 0),
(3350, 3346, 'RF3345', NULL, 3345, 1, 0, 0, 0, 0, 0),
(3351, 3347, 'RF3346', NULL, 3346, 1, 0, 0, 0, 0, 0),
(3352, 3348, 'RF3347', NULL, 3347, 1, 0, 0, 0, 0, 0),
(3353, 3349, 'RF3348', NULL, 3348, 1, 0, 0, 0, 0, 0),
(3354, 3350, 'RF3349', NULL, 3349, 1, 0, 0, 0, 0, 0),
(3355, 3351, 'RF3350', NULL, 3350, 1, 0, 0, 0, 0, 0),
(3356, 3352, 'RF3351', NULL, 3351, 1, 0, 0, 0, 0, 0),
(3357, 3353, 'RF3352', NULL, 3352, 1, 0, 0, 0, 0, 0),
(3358, 3354, 'RF3353', NULL, 3353, 1, 0, 0, 0, 0, 0),
(3359, 3355, 'RF3354', NULL, 3354, 1, 0, 0, 0, 0, 0),
(3360, 3356, 'RF3355', NULL, 3355, 1, 0, 0, 0, 0, 0),
(3361, 3357, 'RF3356', NULL, 3356, 1, 0, 0, 0, 0, 0),
(3362, 3358, 'RF3357', NULL, 3357, 1, 0, 0, 0, 0, 0),
(3363, 3359, 'RF3358', NULL, 3358, 1, 0, 0, 0, 0, 0),
(3364, 3360, 'RF3359', NULL, 3359, 1, 0, 0, 0, 0, 0),
(3365, 3361, 'RF3360', NULL, 3360, 1, 0, 0, 0, 0, 0),
(3366, 3362, 'RF3361', NULL, 3361, 1, 0, 0, 0, 0, 0),
(3367, 3363, 'RF3362', NULL, 3362, 1, 0, 0, 0, 0, 0),
(3368, 3364, 'RF3363', NULL, 3363, 1, 0, 0, 0, 0, 0),
(3369, 3365, 'RF3364', NULL, 3364, 1, 0, 0, 0, 0, 0),
(3370, 3366, 'RF3365', NULL, 3365, 1, 0, 0, 0, 0, 0),
(3371, 3367, 'RF3366', NULL, 3366, 1, 0, 0, 0, 0, 0),
(3372, 3368, 'RF3367', NULL, 3367, 1, 0, 0, 0, 0, 0),
(3373, 3369, 'RF3368', NULL, 3368, 1, 0, 0, 0, 0, 0),
(3374, 3370, 'RF3369', NULL, 3369, 1, 0, 0, 0, 0, 0),
(3375, 3371, 'RF3370', NULL, 3370, 1, 0, 0, 0, 0, 0),
(3376, 3372, 'RF3371', NULL, 3371, 1, 0, 0, 0, 0, 0),
(3377, 3373, 'RF3372', NULL, 3372, 1, 0, 0, 0, 0, 0),
(3378, 3374, 'RF3373', NULL, 3373, 1, 0, 0, 0, 0, 0),
(3379, 3375, 'RF3374', NULL, 3374, 1, 0, 0, 0, 0, 0),
(3380, 3376, 'RF3375', NULL, 3375, 1, 0, 0, 0, 0, 0),
(3381, 3377, 'RF3376', NULL, 3376, 1, 0, 0, 0, 0, 0),
(3382, 3378, 'RF3377', NULL, 3377, 1, 0, 0, 0, 0, 0),
(3383, 3379, 'RF3378', NULL, 3378, 1, 0, 0, 0, 0, 0),
(3384, 3380, 'RF3379', NULL, 3379, 1, 0, 0, 0, 0, 0),
(3385, 3381, 'RF3380', NULL, 3380, 1, 0, 0, 0, 0, 0),
(3386, 3382, 'RF3381', NULL, 3381, 1, 0, 0, 0, 0, 0),
(3387, 3383, 'RF3382', NULL, 3382, 1, 0, 0, 0, 0, 0),
(3388, 3384, 'RF3383', NULL, 3383, 1, 0, 0, 0, 0, 0),
(3389, 3385, 'RF3384', NULL, 3384, 1, 0, 0, 0, 0, 0),
(3390, 3386, 'RF3385', NULL, 3385, 1, 0, 0, 0, 0, 0),
(3391, 3387, 'RF3386', NULL, 3386, 1, 0, 0, 0, 0, 0),
(3392, 3388, 'RF3387', NULL, 3387, 1, 0, 0, 0, 0, 0),
(3393, 3389, 'RF3388', NULL, 3388, 1, 0, 0, 0, 0, 0),
(3394, 3390, 'RF3389', NULL, 3389, 1, 0, 0, 0, 0, 0),
(3395, 3391, 'RF3390', NULL, 3390, 1, 0, 0, 0, 0, 0),
(3396, 3392, 'RF3391', NULL, 3391, 1, 0, 0, 0, 0, 0),
(3397, 3393, 'RF3392', NULL, 3392, 1, 0, 0, 0, 0, 0),
(3398, 3394, 'RF3393', NULL, 3393, 1, 0, 0, 0, 0, 0),
(3399, 3395, 'RF3394', NULL, 3394, 1, 0, 0, 0, 0, 0),
(3400, 3396, 'RF3395', NULL, 3395, 1, 0, 0, 0, 0, 0),
(3401, 3397, 'RF3396', NULL, 3396, 1, 0, 0, 0, 0, 0),
(3402, 3398, 'RF3397', NULL, 3397, 1, 0, 0, 0, 0, 0),
(3403, 3399, 'RF3398', NULL, 3398, 1, 0, 0, 0, 0, 0),
(3404, 3400, 'RF3399', NULL, 3399, 1, 0, 0, 0, 0, 0),
(3405, 3401, 'RF3400', NULL, 3400, 1, 0, 0, 0, 0, 0),
(3406, 3402, 'RF3401', NULL, 3401, 1, 0, 0, 0, 0, 0),
(3407, 3403, 'RF3402', NULL, 3402, 1, 0, 0, 0, 0, 0),
(3408, 3404, 'RF3403', NULL, 3403, 1, 0, 0, 0, 0, 0),
(3409, 3405, 'RF3404', NULL, 3404, 1, 0, 0, 0, 0, 0),
(3410, 3406, 'RF3405', NULL, 3405, 1, 0, 0, 0, 0, 0),
(3411, 3407, 'RF3406', NULL, 3406, 1, 0, 0, 0, 0, 0),
(3412, 3408, 'RF3407', NULL, 3407, 1, 0, 0, 0, 0, 0),
(3413, 3409, 'RF3408', NULL, 3408, 1, 0, 0, 0, 0, 0),
(3414, 3410, 'RF3409', NULL, 3409, 1, 0, 0, 0, 0, 0),
(3415, 3411, 'RF3410', NULL, 3410, 1, 0, 0, 0, 0, 0),
(3416, 3412, 'RF3411', NULL, 3411, 1, 0, 0, 0, 0, 0),
(3417, 3413, 'RF3412', NULL, 3412, 1, 0, 0, 0, 0, 0),
(3418, 3414, 'RF3413', NULL, 3413, 1, 0, 0, 0, 0, 0),
(3419, 3415, 'RF3414', NULL, 3414, 1, 0, 0, 0, 0, 0),
(3420, 3416, 'RF3415', NULL, 3415, 1, 0, 0, 0, 0, 0),
(3421, 3417, 'RF3416', NULL, 3416, 1, 0, 0, 0, 0, 0),
(3422, 3418, 'RF3417', NULL, 3417, 1, 0, 0, 0, 0, 0),
(3423, 3419, 'RF3418', NULL, 3418, 1, 0, 0, 0, 0, 0),
(3424, 3420, 'RF3419', NULL, 3419, 1, 0, 0, 0, 0, 0),
(3425, 3421, 'RF3420', NULL, 3420, 1, 0, 0, 0, 0, 0),
(3426, 3422, 'RF3421', NULL, 3421, 1, 0, 0, 0, 0, 0),
(3427, 3423, 'RF3422', NULL, 3422, 1, 0, 0, 0, 0, 0),
(3428, 3424, 'RF3423', NULL, 3423, 1, 0, 0, 0, 0, 0),
(3429, 3425, 'RF3424', NULL, 3424, 1, 0, 0, 0, 0, 0),
(3430, 3426, 'RF3425', NULL, 3425, 1, 0, 0, 0, 0, 0),
(3431, 3427, 'RF3426', NULL, 3426, 1, 0, 0, 0, 0, 0),
(3432, 3428, 'RF3427', NULL, 3427, 1, 0, 0, 0, 0, 0),
(3433, 3429, 'RF3428', NULL, 3428, 1, 0, 0, 0, 0, 0),
(3434, 3430, 'RF3429', NULL, 3429, 1, 0, 0, 0, 0, 0),
(3435, 3431, 'RF3430', NULL, 3430, 1, 0, 0, 0, 0, 0),
(3436, 3432, 'RF3431', NULL, 3431, 1, 0, 0, 0, 0, 0),
(3437, 3433, 'RF3432', NULL, 3432, 1, 0, 0, 0, 0, 0),
(3438, 3434, 'RF3433', NULL, 3433, 1, 0, 0, 0, 0, 0),
(3439, 3435, 'RF3434', NULL, 3434, 1, 0, 0, 0, 0, 0),
(3440, 3436, 'RF3435', NULL, 3435, 1, 0, 0, 0, 0, 0),
(3441, 3437, 'RF3436', NULL, 3436, 1, 0, 0, 0, 0, 0),
(3442, 3438, 'RF3437', NULL, 3437, 1, 0, 0, 0, 0, 0),
(3443, 3439, 'RF3438', NULL, 3438, 1, 0, 0, 0, 0, 0),
(3444, 3440, 'RF3439', NULL, 3439, 1, 0, 0, 0, 0, 0),
(3445, 3441, 'RF3440', NULL, 3440, 1, 0, 0, 0, 0, 0),
(3446, 3442, 'RF3441', NULL, 3441, 1, 0, 0, 0, 0, 0),
(3447, 3443, 'RF3442', NULL, 3442, 1, 0, 0, 0, 0, 0),
(3448, 3444, 'RF3443', NULL, 3443, 1, 0, 0, 0, 0, 0),
(3449, 3445, 'RF3444', NULL, 3444, 1, 0, 0, 0, 0, 0),
(3450, 3446, 'RF3445', NULL, 3445, 1, 0, 0, 0, 0, 0),
(3451, 3447, 'RF3446', NULL, 3446, 1, 0, 0, 0, 0, 0),
(3452, 3448, 'RF3447', NULL, 3447, 1, 0, 0, 0, 0, 0),
(3453, 3449, 'RF3448', NULL, 3448, 1, 0, 0, 0, 0, 0),
(3454, 3450, 'RF3449', NULL, 3449, 1, 0, 0, 0, 0, 0),
(3455, 3451, 'RF3450', NULL, 3450, 1, 0, 0, 0, 0, 0),
(3456, 3452, 'RF3451', NULL, 3451, 1, 0, 0, 0, 0, 0),
(3457, 3453, 'RF3452', NULL, 3452, 1, 0, 0, 0, 0, 0),
(3458, 3454, 'RF3453', NULL, 3453, 1, 0, 0, 0, 0, 0),
(3459, 3455, 'RF3454', NULL, 3454, 1, 0, 0, 0, 0, 0),
(3460, 3456, 'RF3455', NULL, 3455, 1, 0, 0, 0, 0, 0),
(3461, 3457, 'RF3456', NULL, 3456, 1, 0, 0, 0, 0, 0),
(3462, 3458, 'RF3457', NULL, 3457, 1, 0, 0, 0, 0, 0),
(3463, 3459, 'RF3458', NULL, 3458, 1, 0, 0, 0, 0, 0),
(3464, 3460, 'RF3459', NULL, 3459, 1, 0, 0, 0, 0, 0),
(3465, 3461, 'RF3460', NULL, 3460, 1, 0, 0, 0, 0, 0),
(3466, 3462, 'RF3461', NULL, 3461, 1, 0, 0, 0, 0, 0),
(3467, 3463, 'RF3462', NULL, 3462, 1, 0, 0, 0, 0, 0),
(3468, 3464, 'RF3463', NULL, 3463, 1, 0, 0, 0, 0, 0),
(3469, 3465, 'RF3464', NULL, 3464, 1, 0, 0, 0, 0, 0),
(3470, 3466, 'RF3465', NULL, 3465, 1, 0, 0, 0, 0, 0),
(3471, 3467, 'RF3466', NULL, 3466, 1, 0, 0, 0, 0, 0),
(3472, 3468, 'RF3467', NULL, 3467, 1, 0, 0, 0, 0, 0),
(3473, 3469, 'RF3468', NULL, 3468, 1, 0, 0, 0, 0, 0),
(3474, 3470, 'RF3469', NULL, 3469, 1, 0, 0, 0, 0, 0),
(3475, 3471, 'RF3470', NULL, 3470, 1, 0, 0, 0, 0, 0),
(3476, 3472, 'RF3471', NULL, 3471, 1, 0, 0, 0, 0, 0),
(3477, 3473, 'RF3472', NULL, 3472, 1, 0, 0, 0, 0, 0),
(3478, 3474, 'RF3473', NULL, 3473, 1, 0, 0, 0, 0, 0),
(3479, 3475, 'RF3474', NULL, 3474, 1, 0, 0, 0, 0, 0),
(3480, 3476, 'RF3475', NULL, 3475, 1, 0, 0, 0, 0, 0),
(3481, 3477, 'RF3476', NULL, 3476, 1, 0, 0, 0, 0, 0),
(3482, 3478, 'RF3477', NULL, 3477, 1, 0, 0, 0, 0, 0),
(3483, 3479, 'RF3478', NULL, 3478, 1, 0, 0, 0, 0, 0),
(3484, 3480, 'RF3479', NULL, 3479, 1, 0, 0, 0, 0, 0),
(3485, 3481, 'RF3480', NULL, 3480, 1, 0, 0, 0, 0, 0),
(3486, 3482, 'RF3481', NULL, 3481, 1, 0, 0, 0, 0, 0),
(3487, 3483, 'RF3482', NULL, 3482, 1, 0, 0, 0, 0, 0),
(3488, 3484, 'RF3483', NULL, 3483, 1, 0, 0, 0, 0, 0),
(3489, 3485, 'RF3484', NULL, 3484, 1, 0, 0, 0, 0, 0),
(3490, 3486, 'RF3485', NULL, 3485, 1, 0, 0, 0, 0, 0),
(3491, 3487, 'RF3486', NULL, 3486, 1, 0, 0, 0, 0, 0),
(3492, 3488, 'RF3487', NULL, 3487, 1, 0, 0, 0, 0, 0),
(3493, 3489, 'RF3488', NULL, 3488, 1, 0, 0, 0, 0, 0),
(3494, 3490, 'RF3489', NULL, 3489, 1, 0, 0, 0, 0, 0),
(3495, 3491, 'RF3490', NULL, 3490, 1, 0, 0, 0, 0, 0),
(3496, 3492, 'RF3491', NULL, 3491, 1, 0, 0, 0, 0, 0),
(3497, 3493, 'RF3492', NULL, 3492, 1, 0, 0, 0, 0, 0),
(3498, 3494, 'RF3493', NULL, 3493, 1, 0, 0, 0, 0, 0),
(3499, 3495, 'RF3494', NULL, 3494, 1, 0, 0, 0, 0, 0),
(3500, 3496, 'RF3495', NULL, 3495, 1, 0, 0, 0, 0, 0),
(3501, 3497, 'RF3496', NULL, 3496, 1, 0, 0, 0, 0, 0),
(3502, 3498, 'RF3497', NULL, 3497, 1, 0, 0, 0, 0, 0),
(3503, 3499, 'RF3498', NULL, 3498, 1, 0, 0, 0, 0, 0),
(3504, 3500, 'RF3499', NULL, 3499, 1, 0, 0, 0, 0, 0),
(3505, 3501, 'RF3500', NULL, 3500, 1, 0, 0, 0, 0, 0);

--
-- Triggers `cms_visitmaster`
--
DROP TRIGGER IF EXISTS `trig_cms_visitmaster_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_visitmaster_DELETE` BEFORE DELETE ON `cms_visitmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.id;

set @userid=OLD.update_user;



if  OLD.id !="" OR OLD.id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.id);



	set @chdCol=CONCAT(@chdCol,'-','id');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.visit_name !="" OR OLD.visit_name is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_name);



	set @chdCol=CONCAT(@chdCol,'-','visit_name');

end if;



if  OLD.visit_interval !="" OR OLD.visit_interval is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_interval);



	set @chdCol=CONCAT(@chdCol,'-','visit_interval');

end if;



if  OLD.visit_order !="" OR OLD.visit_order is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_order);



	set @chdCol=CONCAT(@chdCol,'-','visit_order');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_visitmaster(visit_code,visit_name,visit_interval,visit_order,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.visit_code,OLD.visit_name,OLD.visit_interval,OLD.visit_order,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_visitmaster', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_visitmaster_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_visitmaster_INSERT` AFTER INSERT ON `cms_visitmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.id);

set @chdCol=CONCAT(@chdCol,'-','id');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.visit_name);

set @chdCol=CONCAT(@chdCol,'-','visit_name');

set @newVal =CONCAT(@newVal,'-', NEW.visit_interval);

set @chdCol=CONCAT(@chdCol,'-','visit_interval');

set @newVal =CONCAT(@newVal,'-', NEW.visit_order);

set @chdCol=CONCAT(@chdCol,'-','visit_order');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_visitmaster(visit_code,visit_name,visit_interval,visit_order,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.visit_code,NEW.visit_name,NEW.visit_interval,NEW.visit_order,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_visitmaster', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_visitmaster_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_visitmaster_UPDATE` BEFORE UPDATE ON `cms_visitmaster`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.id;

set @userid=NEW.update_user;



if  OLD.id != NEW.id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.id);

	set @newVal =CONCAT(@newVal,'-', NEW.id);

	set @chdCol=CONCAT(@chdCol,'-','id');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.visit_name != NEW.visit_name

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_name);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_name);

	set @chdCol=CONCAT(@chdCol,'-','visit_name');

end if;



if  OLD.visit_interval != NEW.visit_interval

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_interval);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_interval);

	set @chdCol=CONCAT(@chdCol,'-','visit_interval');

end if;



if  OLD.visit_order != NEW.visit_order

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_order);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_order);

	set @chdCol=CONCAT(@chdCol,'-','visit_order');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_visitmaster(visit_code,visit_name,visit_interval,visit_order,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.visit_code,NEW.visit_name,NEW.visit_interval,NEW.visit_order,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_visitmaster', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_visitschedule`
--

DROP TABLE IF EXISTS `cms_visitschedule`;
CREATE TABLE IF NOT EXISTS `cms_visitschedule` (
  `sch_id` int(11) NOT NULL AUTO_INCREMENT,
  `participant_id` text NOT NULL,
  `date_of_screening` int(11) NOT NULL,
  `visit_code` varchar(5) NOT NULL,
  `no_of_days` int(11) NOT NULL,
  `actual_date` int(11) NOT NULL,
  `visit_date` int(11) DEFAULT NULL,
  `window_start` int(11) NOT NULL,
  `window_end` int(11) NOT NULL,
  `status` enum('0','1','2') DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `create_user` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  `update_user` int(11) DEFAULT NULL,
  `record_date` int(11) DEFAULT NULL,
  PRIMARY KEY (`sch_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Triggers `cms_visitschedule`
--
DROP TRIGGER IF EXISTS `trig_cms_visitschedule_DELETE`;
DELIMITER //
CREATE TRIGGER `trig_cms_visitschedule_DELETE` BEFORE DELETE ON `cms_visitschedule`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=OLD.sch_id;

set @userid=OLD.update_user;



if  OLD.sch_id !="" OR OLD.sch_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sch_id);



	set @chdCol=CONCAT(@chdCol,'-','sch_id');

end if;



if  OLD.participant_id !="" OR OLD.participant_id is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.participant_id);



	set @chdCol=CONCAT(@chdCol,'-','participant_id');

end if;



if  OLD.date_of_screening !="" OR OLD.date_of_screening is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.date_of_screening);



	set @chdCol=CONCAT(@chdCol,'-','date_of_screening');

end if;



if  OLD.visit_code !="" OR OLD.visit_code is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);



	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.no_of_days !="" OR OLD.no_of_days is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.no_of_days);



	set @chdCol=CONCAT(@chdCol,'-','no_of_days');

end if;



if  OLD.actual_date !="" OR OLD.actual_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.actual_date);



	set @chdCol=CONCAT(@chdCol,'-','actual_date');

end if;



if  OLD.visit_date !="" OR OLD.visit_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_date);



	set @chdCol=CONCAT(@chdCol,'-','visit_date');

end if;



if  OLD.window_start !="" OR OLD.window_start is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.window_start);



	set @chdCol=CONCAT(@chdCol,'-','window_start');

end if;



if  OLD.window_end !="" OR OLD.window_end is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.window_end);



	set @chdCol=CONCAT(@chdCol,'-','window_end');

end if;



if  OLD.status !="" OR OLD.status is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);



	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time !="" OR OLD.create_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);



	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user !="" OR OLD.create_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);



	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time !="" OR OLD.update_time is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);



	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user !="" OR OLD.update_user is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);



	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date !="" OR OLD.record_date is not null 

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);



	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_visitschedule(participant_id,date_of_screening,visit_code,no_of_days,actual_date,visit_date,window_start,window_end,status,create_time,create_user,update_time,update_user,record_date) VALUES(OLD.participant_id,OLD.date_of_screening,OLD.visit_code,OLD.no_of_days,OLD.actual_date,OLD.visit_date,OLD.window_start,OLD.window_end,OLD.status,OLD.create_time,OLD.create_user,OLD.update_time,OLD.update_user,OLD.record_date);



 

INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_visitschedule', NOW(),'d',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_visitschedule_INSERT`;
DELIMITER //
CREATE TRIGGER `trig_cms_visitschedule_INSERT` AFTER INSERT ON `cms_visitschedule`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.sch_id;

set @userid=NEW.create_user;



set @newVal =CONCAT(@newVal,'-', NEW.sch_id);

set @chdCol=CONCAT(@chdCol,'-','sch_id');

set @newVal =CONCAT(@newVal,'-', NEW.participant_id);

set @chdCol=CONCAT(@chdCol,'-','participant_id');

set @newVal =CONCAT(@newVal,'-', NEW.date_of_screening);

set @chdCol=CONCAT(@chdCol,'-','date_of_screening');

set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

set @chdCol=CONCAT(@chdCol,'-','visit_code');

set @newVal =CONCAT(@newVal,'-', NEW.no_of_days);

set @chdCol=CONCAT(@chdCol,'-','no_of_days');

set @newVal =CONCAT(@newVal,'-', NEW.actual_date);

set @chdCol=CONCAT(@chdCol,'-','actual_date');

set @newVal =CONCAT(@newVal,'-', NEW.visit_date);

set @chdCol=CONCAT(@chdCol,'-','visit_date');

set @newVal =CONCAT(@newVal,'-', NEW.window_start);

set @chdCol=CONCAT(@chdCol,'-','window_start');

set @newVal =CONCAT(@newVal,'-', NEW.window_end);

set @chdCol=CONCAT(@chdCol,'-','window_end');

set @newVal =CONCAT(@newVal,'-', NEW.status);

set @chdCol=CONCAT(@chdCol,'-','status');

set @newVal =CONCAT(@newVal,'-', NEW.create_time);

set @chdCol=CONCAT(@chdCol,'-','create_time');

set @newVal =CONCAT(@newVal,'-', NEW.create_user);

set @chdCol=CONCAT(@chdCol,'-','create_user');

set @newVal =CONCAT(@newVal,'-', NEW.update_time);

set @chdCol=CONCAT(@chdCol,'-','update_time');

set @newVal =CONCAT(@newVal,'-', NEW.update_user);

set @chdCol=CONCAT(@chdCol,'-','update_user');

set @newVal =CONCAT(@newVal,'-', NEW.record_date);

set @chdCol=CONCAT(@chdCol,'-','record_date');





INSERT INTO mirror_iccplus.cms_visitschedule(participant_id,date_of_screening,visit_code,no_of_days,actual_date,visit_date,window_start,window_end,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.participant_id,NEW.date_of_screening,NEW.visit_code,NEW.no_of_days,NEW.actual_date,NEW.visit_date,NEW.window_start,NEW.window_end,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_visitschedule', NOW(),'i',@id,@userid,@oldVal,@newVal,'');



END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `trig_cms_visitschedule_UPDATE`;
DELIMITER //
CREATE TRIGGER `trig_cms_visitschedule_UPDATE` BEFORE UPDATE ON `cms_visitschedule`
 FOR EACH ROW BEGIN

set @oldVal='';

set @newVal='';

set @chdCol='';

set @id=NEW.sch_id;

set @userid=NEW.update_user;



if  OLD.sch_id != NEW.sch_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.sch_id);

	set @newVal =CONCAT(@newVal,'-', NEW.sch_id);

	set @chdCol=CONCAT(@chdCol,'-','sch_id');

end if;



if  OLD.participant_id != NEW.participant_id

then

	set @oldval =CONCAT(@oldVal,'-',OLD.participant_id);

	set @newVal =CONCAT(@newVal,'-', NEW.participant_id);

	set @chdCol=CONCAT(@chdCol,'-','participant_id');

end if;



if  OLD.date_of_screening != NEW.date_of_screening

then

	set @oldval =CONCAT(@oldVal,'-',OLD.date_of_screening);

	set @newVal =CONCAT(@newVal,'-', NEW.date_of_screening);

	set @chdCol=CONCAT(@chdCol,'-','date_of_screening');

end if;



if  OLD.visit_code != NEW.visit_code

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_code);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_code);

	set @chdCol=CONCAT(@chdCol,'-','visit_code');

end if;



if  OLD.no_of_days != NEW.no_of_days

then

	set @oldval =CONCAT(@oldVal,'-',OLD.no_of_days);

	set @newVal =CONCAT(@newVal,'-', NEW.no_of_days);

	set @chdCol=CONCAT(@chdCol,'-','no_of_days');

end if;



if  OLD.actual_date != NEW.actual_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.actual_date);

	set @newVal =CONCAT(@newVal,'-', NEW.actual_date);

	set @chdCol=CONCAT(@chdCol,'-','actual_date');

end if;



if  OLD.visit_date != NEW.visit_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.visit_date);

	set @newVal =CONCAT(@newVal,'-', NEW.visit_date);

	set @chdCol=CONCAT(@chdCol,'-','visit_date');

end if;



if  OLD.window_start != NEW.window_start

then

	set @oldval =CONCAT(@oldVal,'-',OLD.window_start);

	set @newVal =CONCAT(@newVal,'-', NEW.window_start);

	set @chdCol=CONCAT(@chdCol,'-','window_start');

end if;



if  OLD.window_end != NEW.window_end

then

	set @oldval =CONCAT(@oldVal,'-',OLD.window_end);

	set @newVal =CONCAT(@newVal,'-', NEW.window_end);

	set @chdCol=CONCAT(@chdCol,'-','window_end');

end if;



if  OLD.status != NEW.status

then

	set @oldval =CONCAT(@oldVal,'-',OLD.status);

	set @newVal =CONCAT(@newVal,'-', NEW.status);

	set @chdCol=CONCAT(@chdCol,'-','status');

end if;



if  OLD.create_time != NEW.create_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_time);

	set @newVal =CONCAT(@newVal,'-', NEW.create_time);

	set @chdCol=CONCAT(@chdCol,'-','create_time');

end if;



if  OLD.create_user != NEW.create_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.create_user);

	set @newVal =CONCAT(@newVal,'-', NEW.create_user);

	set @chdCol=CONCAT(@chdCol,'-','create_user');

end if;



if  OLD.update_time != NEW.update_time

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_time);

	set @newVal =CONCAT(@newVal,'-', NEW.update_time);

	set @chdCol=CONCAT(@chdCol,'-','update_time');

end if;



if  OLD.update_user != NEW.update_user

then

	set @oldval =CONCAT(@oldVal,'-',OLD.update_user);

	set @newVal =CONCAT(@newVal,'-', NEW.update_user);

	set @chdCol=CONCAT(@chdCol,'-','update_user');

end if;



if  OLD.record_date != NEW.record_date

then

	set @oldval =CONCAT(@oldVal,'-',OLD.record_date);

	set @newVal =CONCAT(@newVal,'-', NEW.record_date);

	set @chdCol=CONCAT(@chdCol,'-','record_date');

end if;







INSERT INTO mirror_iccplus.cms_visitschedule(participant_id,date_of_screening,visit_code,no_of_days,actual_date,visit_date,window_start,window_end,status,create_time,create_user,update_time,update_user,record_date) VALUES(NEW.participant_id,NEW.date_of_screening,NEW.visit_code,NEW.no_of_days,NEW.actual_date,NEW.visit_date,NEW.window_start,NEW.window_end,NEW.status,NEW.create_time,NEW.create_user,NEW.update_time,NEW.update_user,NEW.record_date);





INSERT INTO audits(tableName,dateChanged,task,tableId,userId,oldval,newval,updatedcols) VALUES ('cms_visitschedule', NOW(),'u',@id,@userid,@oldVal,@newVal,@chdCol);



END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_voucherref`
--

DROP TABLE IF EXISTS `cms_voucherref`;
CREATE TABLE IF NOT EXISTS `cms_voucherref` (
  `vchr_ref_sur` varchar(11) NOT NULL COMMENT 'Survey',
  `vchr_ref_loc` varchar(11) NOT NULL COMMENT 'Location',
  `vchr_ref_type` varchar(11) NOT NULL COMMENT 'Type',
  `vchr_ref_code` int(11) NOT NULL COMMENT 'Last Voucher Number',
  `record_date` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  UNIQUE KEY `vchr_ref_sur` (`vchr_ref_sur`,`vchr_ref_loc`,`vchr_ref_type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `fp_protocol`
--

DROP TABLE IF EXISTS `fp_protocol`;
CREATE TABLE IF NOT EXISTS `fp_protocol` (
  `Code` varchar(25) NOT NULL DEFAULT '',
  `Name` varchar(100) NOT NULL,
  PRIMARY KEY (`Code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `fp_protocol`
--

INSERT INTO `fp_protocol` (`Code`, `Name`) VALUES
('ICCPLUS', 'ICCPLUS');

-- --------------------------------------------------------

--
-- Table structure for table `fp_protocolconfig`
--

DROP TABLE IF EXISTS `fp_protocolconfig`;
CREATE TABLE IF NOT EXISTS `fp_protocolconfig` (
  `ProtocolCode` varchar(25) NOT NULL DEFAULT '',
  `ProtocolName` varchar(100) NOT NULL,
  `ConfigType` varchar(50) NOT NULL DEFAULT '',
  `Value` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`ProtocolCode`,`ConfigType`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `fp_protocolconfig`
--

INSERT INTO `fp_protocolconfig` (`ProtocolCode`, `ProtocolName`, `ConfigType`, `Value`) VALUES
('ICCPLUS', 'ICCPLUS', 'VOutQuestion', 'N');

-- --------------------------------------------------------

--
-- Table structure for table `fp_settings`
--

DROP TABLE IF EXISTS `fp_settings`;
CREATE TABLE IF NOT EXISTS `fp_settings` (
  `Code` varchar(20) NOT NULL,
  `Description` varchar(50) NOT NULL,
  `Setting` int(11) NOT NULL,
  `SettingText` varchar(50) NOT NULL,
  PRIMARY KEY (`Code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `fp_settings`
--

INSERT INTO `fp_settings` (`Code`, `Description`, `Setting`, `SettingText`) VALUES
('BarcodeScan', 'Barcode Scanning', 1, 'No'),
('FingerUpdate', 'FingerUpdate', 1, 'All'),
('OSTID', 'OST ID', 0, 'Yes'),
('Protocol', 'Protocol', 0, 'ICCPLUS'),
('VEntryCount', 'Visit Entry Count', 1, '1'),
('VOutCount', 'Visit Out Count', 1, '1');

-- --------------------------------------------------------

--
-- Table structure for table `participant_finger_print`
--

DROP TABLE IF EXISTS `participant_finger_print`;
CREATE TABLE IF NOT EXISTS `participant_finger_print` (
  `participant_id` varchar(20) DEFAULT NULL,
  `Parent_Id` varchar(20) NOT NULL,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sur_id` int(11) DEFAULT NULL,
  `ref_id` varchar(10) DEFAULT NULL,
  `finger_id` int(11) DEFAULT NULL,
  `finger_print` text,
  `ICCID` varchar(20) DEFAULT NULL,
  `RDS1ID` varchar(20) DEFAULT NULL,
  `RDS2ID` varchar(20) DEFAULT NULL,
  `RDS1Flg` varchar(1) NOT NULL DEFAULT 'N',
  `RDS2Flg` varchar(1) NOT NULL DEFAULT 'N',
  `ICCFlg` varchar(1) NOT NULL DEFAULT 'N',
  `CreatedDate` date NOT NULL,
  `CreatedTime` datetime NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `participant_finger_print_import`
--

DROP TABLE IF EXISTS `participant_finger_print_import`;
CREATE TABLE IF NOT EXISTS `participant_finger_print_import` (
  `participant_id` varchar(20) DEFAULT NULL,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sur_id` int(11) DEFAULT NULL,
  `ref_id` varchar(10) DEFAULT NULL,
  `finger_id` int(11) DEFAULT NULL,
  `finger_print` text,
  `ICCID` varchar(20) DEFAULT NULL,
  `RDS1ID` varchar(20) DEFAULT NULL,
  `RDS2ID` varchar(20) DEFAULT NULL,
  `UpdateFlg` varchar(1) NOT NULL DEFAULT 'N',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `rpt_fingerprint_report`
--

DROP TABLE IF EXISTS `rpt_fingerprint_report`;
CREATE TABLE IF NOT EXISTS `rpt_fingerprint_report` (
  `participant_id` varchar(20) NOT NULL,
  `ICCID` varchar(20) NOT NULL,
  `RDS1` varchar(20) NOT NULL,
  `NoofFinger` int(11) NOT NULL DEFAULT '0',
  `F1` int(11) NOT NULL DEFAULT '0',
  `F2` int(11) NOT NULL DEFAULT '0',
  `F3` int(11) NOT NULL DEFAULT '0',
  `F4` int(11) NOT NULL DEFAULT '0',
  `F5` int(11) NOT NULL DEFAULT '0',
  `F6` int(11) NOT NULL DEFAULT '0',
  `F7` int(11) NOT NULL DEFAULT '0',
  `F8` int(11) NOT NULL DEFAULT '0',
  `F9` int(11) NOT NULL DEFAULT '0',
  `F10` int(11) NOT NULL DEFAULT '0',
  `loctr_name` text NOT NULL,
  `Loctr_Mobile` varchar(50) NOT NULL,
  `loctr_address` text NOT NULL,
  `MaxCreatedDate` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `rpt_participant_finger_print`
--

DROP TABLE IF EXISTS `rpt_participant_finger_print`;
CREATE TABLE IF NOT EXISTS `rpt_participant_finger_print` (
  `participant_id` varchar(20) DEFAULT NULL,
  `sur_id` int(11) DEFAULT NULL,
  `ref_id` varchar(10) DEFAULT NULL,
  `finger_id` int(11) DEFAULT NULL,
  `finger_print` text,
  `ICCID` varchar(20) DEFAULT NULL,
  `RDS1ID` varchar(20) DEFAULT NULL,
  `RDS1Flg` varchar(1) NOT NULL DEFAULT 'N',
  `ICCFlg` varchar(1) NOT NULL DEFAULT 'N',
  `CreatedDate` date NOT NULL,
  `CreatedTime` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Stand-in structure for view `v_attendance`
--
DROP VIEW IF EXISTS `v_attendance`;
CREATE TABLE IF NOT EXISTS `v_attendance` (
`participant_id` varchar(20)
,`Last_Visit_Date` int(11)
,`No_of_Visits` bigint(21)
);
-- --------------------------------------------------------

--
-- Stand-in structure for view `v_lab_hcv`
--
DROP VIEW IF EXISTS `v_lab_hcv`;
CREATE TABLE IF NOT EXISTS `v_lab_hcv` (
`lab_smple_part_id` varchar(11)
,`Last_Testdone_date` int(11)
,`No_of_time` bigint(21)
,`lab_result_name` text
);
-- --------------------------------------------------------

--
-- Stand-in structure for view `v_lab_hcvtest`
--
DROP VIEW IF EXISTS `v_lab_hcvtest`;
CREATE TABLE IF NOT EXISTS `v_lab_hcvtest` (
`lab_smple_part_id` varchar(11)
,`Testdone_date` int(11)
,`lab_result_name` text
);
-- --------------------------------------------------------

--
-- Stand-in structure for view `v_lab_hcvtest_sum`
--
DROP VIEW IF EXISTS `v_lab_hcvtest_sum`;
CREATE TABLE IF NOT EXISTS `v_lab_hcvtest_sum` (
`lab_smple_part_id` varchar(11)
,`Last_Testdone_date` int(11)
,`No_of_time` bigint(21)
);
-- --------------------------------------------------------

--
-- Stand-in structure for view `v_lab_hiv`
--
DROP VIEW IF EXISTS `v_lab_hiv`;
CREATE TABLE IF NOT EXISTS `v_lab_hiv` (
`lab_smple_part_id` varchar(11)
,`Last_Testdone_date` int(11)
,`No_of_time` bigint(21)
,`lab_result_name` text
);
-- --------------------------------------------------------

--
-- Stand-in structure for view `v_lab_hivtest`
--
DROP VIEW IF EXISTS `v_lab_hivtest`;
CREATE TABLE IF NOT EXISTS `v_lab_hivtest` (
`lab_smple_part_id` varchar(11)
,`Testdone_date` int(11)
,`lab_result_name` text
);
-- --------------------------------------------------------

--
-- Stand-in structure for view `v_lab_hivtest_sum`
--
DROP VIEW IF EXISTS `v_lab_hivtest_sum`;
CREATE TABLE IF NOT EXISTS `v_lab_hivtest_sum` (
`lab_smple_part_id` varchar(11)
,`Last_Testdone_date` int(11)
,`No_of_time` bigint(21)
);
-- --------------------------------------------------------

--
-- Stand-in structure for view `v_lab_tb`
--
DROP VIEW IF EXISTS `v_lab_tb`;
CREATE TABLE IF NOT EXISTS `v_lab_tb` (
`lab_smple_part_id` varchar(11)
,`Last_Testdone_date` int(11)
,`No_of_time` bigint(21)
,`lab_result_name` text
);
-- --------------------------------------------------------

--
-- Stand-in structure for view `v_lab_tbtest`
--
DROP VIEW IF EXISTS `v_lab_tbtest`;
CREATE TABLE IF NOT EXISTS `v_lab_tbtest` (
`lab_smple_part_id` varchar(11)
,`Testdone_date` int(11)
,`lab_result_name` text
);
-- --------------------------------------------------------

--
-- Stand-in structure for view `v_lab_tbtest_sum`
--
DROP VIEW IF EXISTS `v_lab_tbtest_sum`;
CREATE TABLE IF NOT EXISTS `v_lab_tbtest_sum` (
`lab_smple_part_id` varchar(11)
,`Last_Testdone_date` int(11)
,`No_of_time` bigint(21)
);
-- --------------------------------------------------------

--
-- Stand-in structure for view `v_participant_finger_print`
--
DROP VIEW IF EXISTS `v_participant_finger_print`;
CREATE TABLE IF NOT EXISTS `v_participant_finger_print` (
`participant_id` varchar(20)
,`No_of_Fingers` bigint(21)
);
-- --------------------------------------------------------

--
-- Stand-in structure for view `v_visitstatus`
--
DROP VIEW IF EXISTS `v_visitstatus`;
CREATE TABLE IF NOT EXISTS `v_visitstatus` (
`participant_id` varchar(11)
,`record_date` int(11)
,`demographics_part_id` int(0)
,`quality_of_life_part_id` int(0)
,`hiv_continuum_part_id` int(0)
,`pre_art_beliefs_part_id` int(0)
,`post_art_beliefs_part_id` int(0)
,`substance_use_part_id` int(0)
,`risk_behavior_part_id` int(0)
,`depression_part_id` int(0)
,`health_care_utilization_part_id` int(0)
,`hiv_visit_part_id` int(0)
,`cd4_test_part_id` int(0)
);
-- --------------------------------------------------------

--
-- Structure for view `v_attendance`
--
DROP TABLE IF EXISTS `v_attendance`;

CREATE  VIEW `v_attendance` AS select `cms_attandance`.`participant_id` AS `participant_id`,max(`cms_attandance`.`visit_date`) AS `Last_Visit_Date`,count(`cms_attandance`.`visit_date`) AS `No_of_Visits` from `cms_attandance` group by `cms_attandance`.`participant_id` order by `cms_attandance`.`participant_id`;

-- --------------------------------------------------------

--
-- Structure for view `v_lab_hcv`
--
DROP TABLE IF EXISTS `v_lab_hcv`;

CREATE  VIEW `v_lab_hcv` AS select `v_lab_hcvtest_sum`.`lab_smple_part_id` AS `lab_smple_part_id`,`v_lab_hcvtest_sum`.`Last_Testdone_date` AS `Last_Testdone_date`,`v_lab_hcvtest_sum`.`No_of_time` AS `No_of_time`,`v_lab_hcvtest`.`lab_result_name` AS `lab_result_name` from (`v_lab_hcvtest_sum` join `v_lab_hcvtest` on(((`v_lab_hcvtest_sum`.`lab_smple_part_id` = `v_lab_hcvtest`.`lab_smple_part_id`) and (`v_lab_hcvtest_sum`.`Last_Testdone_date` = `v_lab_hcvtest`.`Testdone_date`))));

-- --------------------------------------------------------

--
-- Structure for view `v_lab_hcvtest`
--
DROP TABLE IF EXISTS `v_lab_hcvtest`;

CREATE  VIEW `v_lab_hcvtest` AS select `cms_labsamplerequest`.`lab_smple_part_id` AS `lab_smple_part_id`,`cms_labsamplerequest`.`record_date` AS `Testdone_date`,`cms_labresultsmaster`.`lab_result_name` AS `lab_result_name` from (`cms_labsamplerequest` join `cms_labresultsmaster` on((`cms_labsamplerequest`.`lab_smple_result` = `cms_labresultsmaster`.`lab_result_code`))) where (`cms_labsamplerequest`.`lab_smple_tst_id` = 3) order by `cms_labsamplerequest`.`lab_smple_part_id`;

-- --------------------------------------------------------

--
-- Structure for view `v_lab_hcvtest_sum`
--
DROP TABLE IF EXISTS `v_lab_hcvtest_sum`;

CREATE  VIEW `v_lab_hcvtest_sum` AS select `cms_labsamplerequest`.`lab_smple_part_id` AS `lab_smple_part_id`,max(`cms_labsamplerequest`.`record_date`) AS `Last_Testdone_date`,count(`cms_labsamplerequest`.`lab_smple_id`) AS `No_of_time` from `cms_labsamplerequest` where (`cms_labsamplerequest`.`lab_smple_tst_id` = 3) group by `cms_labsamplerequest`.`lab_smple_part_id` order by `cms_labsamplerequest`.`lab_smple_part_id`;

-- --------------------------------------------------------

--
-- Structure for view `v_lab_hiv`
--
DROP TABLE IF EXISTS `v_lab_hiv`;

CREATE  VIEW `v_lab_hiv` AS select `v_lab_hivtest_sum`.`lab_smple_part_id` AS `lab_smple_part_id`,`v_lab_hivtest_sum`.`Last_Testdone_date` AS `Last_Testdone_date`,`v_lab_hivtest_sum`.`No_of_time` AS `No_of_time`,`v_lab_hivtest`.`lab_result_name` AS `lab_result_name` from (`v_lab_hivtest_sum` join `v_lab_hivtest` on(((`v_lab_hivtest_sum`.`lab_smple_part_id` = `v_lab_hivtest`.`lab_smple_part_id`) and (`v_lab_hivtest_sum`.`Last_Testdone_date` = `v_lab_hivtest`.`Testdone_date`))));

-- --------------------------------------------------------

--
-- Structure for view `v_lab_hivtest`
--
DROP TABLE IF EXISTS `v_lab_hivtest`;

CREATE  VIEW `v_lab_hivtest` AS select `cms_labsamplerequest`.`lab_smple_part_id` AS `lab_smple_part_id`,`cms_labsamplerequest`.`record_date` AS `Testdone_date`,`cms_labresultsmaster`.`lab_result_name` AS `lab_result_name` from (`cms_labsamplerequest` join `cms_labresultsmaster` on((`cms_labsamplerequest`.`lab_smple_result` = `cms_labresultsmaster`.`lab_result_code`))) where (`cms_labsamplerequest`.`lab_smple_tst_id` = 1) order by `cms_labsamplerequest`.`lab_smple_part_id`;

-- --------------------------------------------------------

--
-- Structure for view `v_lab_hivtest_sum`
--
DROP TABLE IF EXISTS `v_lab_hivtest_sum`;

CREATE  VIEW `v_lab_hivtest_sum` AS select `cms_labsamplerequest`.`lab_smple_part_id` AS `lab_smple_part_id`,max(`cms_labsamplerequest`.`record_date`) AS `Last_Testdone_date`,count(`cms_labsamplerequest`.`lab_smple_id`) AS `No_of_time` from `cms_labsamplerequest` where (`cms_labsamplerequest`.`lab_smple_tst_id` = 1) group by `cms_labsamplerequest`.`lab_smple_part_id` order by `cms_labsamplerequest`.`lab_smple_part_id`;

-- --------------------------------------------------------

--
-- Structure for view `v_lab_tb`
--
DROP TABLE IF EXISTS `v_lab_tb`;

CREATE  VIEW `v_lab_tb` AS select `v_lab_tbtest_sum`.`lab_smple_part_id` AS `lab_smple_part_id`,`v_lab_tbtest_sum`.`Last_Testdone_date` AS `Last_Testdone_date`,`v_lab_tbtest_sum`.`No_of_time` AS `No_of_time`,`v_lab_tbtest`.`lab_result_name` AS `lab_result_name` from (`v_lab_tbtest_sum` join `v_lab_tbtest` on(((`v_lab_tbtest_sum`.`lab_smple_part_id` = `v_lab_tbtest`.`lab_smple_part_id`) and (`v_lab_tbtest_sum`.`Last_Testdone_date` = `v_lab_tbtest`.`Testdone_date`))));

-- --------------------------------------------------------

--
-- Structure for view `v_lab_tbtest`
--
DROP TABLE IF EXISTS `v_lab_tbtest`;

CREATE  VIEW `v_lab_tbtest` AS select `cms_labsamplerequest`.`lab_smple_part_id` AS `lab_smple_part_id`,`cms_labsamplerequest`.`record_date` AS `Testdone_date`,`cms_labresultsmaster`.`lab_result_name` AS `lab_result_name` from (`cms_labsamplerequest` join `cms_labresultsmaster` on((`cms_labsamplerequest`.`lab_smple_result` = `cms_labresultsmaster`.`lab_result_code`))) where (`cms_labsamplerequest`.`lab_smple_tst_id` = 4) order by `cms_labsamplerequest`.`lab_smple_part_id`;

-- --------------------------------------------------------

--
-- Structure for view `v_lab_tbtest_sum`
--
DROP TABLE IF EXISTS `v_lab_tbtest_sum`;

CREATE  VIEW `v_lab_tbtest_sum` AS select `cms_labsamplerequest`.`lab_smple_part_id` AS `lab_smple_part_id`,max(`cms_labsamplerequest`.`record_date`) AS `Last_Testdone_date`,count(`cms_labsamplerequest`.`lab_smple_id`) AS `No_of_time` from `cms_labsamplerequest` where (`cms_labsamplerequest`.`lab_smple_tst_id` = 4) group by `cms_labsamplerequest`.`lab_smple_part_id` order by `cms_labsamplerequest`.`lab_smple_part_id`;

-- --------------------------------------------------------

--
-- Structure for view `v_participant_finger_print`
--
DROP TABLE IF EXISTS `v_participant_finger_print`;

CREATE  VIEW `v_participant_finger_print` AS select `participant_finger_print`.`participant_id` AS `participant_id`,count(`participant_finger_print`.`finger_id`) AS `No_of_Fingers` from `participant_finger_print` group by `participant_finger_print`.`participant_id` order by `participant_finger_print`.`participant_id`;

-- --------------------------------------------------------

--
-- Structure for view `v_visitstatus`
--
DROP TABLE IF EXISTS `v_visitstatus`;

CREATE  VIEW `v_visitstatus` AS select distinct `cms_screening`.`mem_scrn_part_id` AS `participant_id`,`cms_screening`.`record_date` AS `record_date`,(case when (`cms_baseline_demographics`.`demographics_part_id` is not null) then 1 else 0 end) AS `demographics_part_id`,(case when (`cms_baseline_qualityoflife`.`quality_of_life_part_id` is not null) then 1 else 0 end) AS `quality_of_life_part_id`,(case when (`cms_baseline_hivcontinuum`.`hiv_continuum_part_id` is not null) then 1 else 0 end) AS `hiv_continuum_part_id`,(case when (`cms_baseline_preartbeliefs`.`pre_art_beliefs_part_id` is not null) then 1 else 0 end) AS `pre_art_beliefs_part_id`,(case when (`cms_baseline_postartbeliefs`.`post_art_beliefs_part_id` is not null) then 1 else 0 end) AS `post_art_beliefs_part_id`,(case when (`cms_baseline_substanceuse`.`substance_use_part_id` is not null) then 1 else 0 end) AS `substance_use_part_id`,(case when (`cms_baseline_riskbehavior`.`risk_behavior_part_id` is not null) then 1 else 0 end) AS `risk_behavior_part_id`,(case when (`cms_baseline_depression`.`depression_part_id` is not null) then 1 else 0 end) AS `depression_part_id`,(case when (`cms_baseline_healthcareutilization`.`health_care_utilization_part_id` is not null) then 1 else 0 end) AS `health_care_utilization_part_id`,(case when (`cms_hivvisit`.`hiv_visit_part_id` is not null) then 1 else 0 end) AS `hiv_visit_part_id`,(case when (`cms_cd4`.`cd4_test_part_id` is not null) then 1 else 0 end) AS `cd4_test_part_id` from (((((((((((`cms_screening` left join `cms_baseline_demographics` on((`cms_screening`.`mem_scrn_part_id` = `cms_baseline_demographics`.`demographics_part_id`))) left join `cms_baseline_qualityoflife` on((`cms_screening`.`mem_scrn_part_id` = `cms_baseline_qualityoflife`.`quality_of_life_part_id`))) left join `cms_baseline_hivcontinuum` on((`cms_screening`.`mem_scrn_part_id` = `cms_baseline_hivcontinuum`.`hiv_continuum_part_id`))) left join `cms_baseline_preartbeliefs` on((`cms_screening`.`mem_scrn_part_id` = `cms_baseline_preartbeliefs`.`pre_art_beliefs_part_id`))) left join `cms_baseline_postartbeliefs` on((`cms_screening`.`mem_scrn_part_id` = `cms_baseline_postartbeliefs`.`post_art_beliefs_part_id`))) left join `cms_baseline_substanceuse` on((`cms_screening`.`mem_scrn_part_id` = `cms_baseline_substanceuse`.`substance_use_part_id`))) left join `cms_baseline_riskbehavior` on((`cms_screening`.`mem_scrn_part_id` = `cms_baseline_riskbehavior`.`risk_behavior_part_id`))) left join `cms_baseline_depression` on((`cms_screening`.`mem_scrn_part_id` = `cms_baseline_depression`.`depression_part_id`))) left join `cms_baseline_healthcareutilization` on((`cms_screening`.`mem_scrn_part_id` = `cms_baseline_healthcareutilization`.`health_care_utilization_part_id`))) left join `cms_hivvisit` on((`cms_screening`.`mem_scrn_part_id` = `cms_hivvisit`.`hiv_visit_part_id`))) left join `cms_cd4` on((`cms_screening`.`mem_scrn_part_id` = `cms_cd4`.`cd4_test_part_id`))) where (`cms_screening`.`mem_scrn_q25` = 1) order by `cms_screening`.`mem_scrn_part_id`;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
