CREATE OR REPLACE TRIGGER T_P2_EHEALTH_CHECKOFLK_SYNC
--监测三种状态
BEFORE INSERT OR DELETE OR UPDATE OF
ANAL,
BREATH,
CARDNO,
CHECKOFLKID,
CHECKTIME,
CHO,
CRTIME,
CRUSER,
DBP,
DEVICESN,
DEVICETYPE,
ETCFILEPATH3,
ETCFILEPATH4,
ETCFILEPATH5,
ETC_REPORT_PATH,
ETC_REPORT_PATH_DATBAS,
FETALHEART,
FLAG,
GLU,
HDL,
HEIGHT,
ICPCODE,
LDL,
MEAN,
MEMO1,
MEMO2,
MEMO3,
MEMO4,
MEMO5,
MEMO6,
NCG_BIL,
NCG_BLO,
NCG_GLU,
NCG_KET,
NCG_LEU,
NCG_NIT,
NCG_PH,
NCG_PRO,
NCG_SG,
NCG_UBG,
NCG_VC,
NUMBEROFCASE,
OXIMETER,
PRODUCER,
PULSE,
SBP,
TEMP,
TG,
WEIGHT
ON P2_EHEALTH_ARCH_CHECKOFLK
FOR EACH ROW
DECLARE V_DEVICE VARCHAR2(50);
BEGIN
IF INSERTING THEN
INSERT INTO P2_EHEALTH_ARCH_CHECKOFLK@DBLINK_HYS(
ANAL,
BREATH,
CARDNO,
CHECKOFLKID,
CHECKTIME,
CHO,
CRTIME,
CRUSER,
DBP,
DEVICESN,
DEVICETYPE,
ETCFILEPATH3,
ETCFILEPATH4,
ETCFILEPATH5,
ETC_REPORT_PATH,
ETC_REPORT_PATH_DATBAS,
FETALHEART,
FLAG,
GLU,
HDL,
HEIGHT,
ICPCODE,
LDL,
MEAN,
MEMO1,
MEMO2,
MEMO3,
MEMO4,
MEMO5,
MEMO6,
NCG_BIL,
NCG_BLO,
NCG_GLU,
NCG_KET,
NCG_LEU,
NCG_NIT,
NCG_PH,
NCG_PRO,
NCG_SG,
NCG_UBG,
NCG_VC,
NUMBEROFCASE,
OXIMETER,
PRODUCER,
PULSE,
SBP,
TEMP,
TG,
WEIGHT
)
VALUES(
:NEW.ANAL,
:NEW.BREATH,
:NEW.CARDNO,
ARCH_CHECKOFLK_SEQ1.nextval@dblink_hys,
:NEW.CHECKTIME,
:NEW.CHO,
:NEW.CRTIME,
:NEW.CRUSER,
:NEW.DBP,
:NEW.DEVICESN,
:NEW.DEVICETYPE,
:NEW.ETCFILEPATH3,
:NEW.ETCFILEPATH4,
:NEW.ETCFILEPATH5,
:NEW.ETC_REPORT_PATH,
:NEW.ETC_REPORT_PATH_DATBAS,
:NEW.FETALHEART,
:NEW.FLAG,
:NEW.GLU,
:NEW.HDL,
:NEW.HEIGHT,
:NEW.ICPCODE,
:NEW.LDL,
:NEW.MEAN,
:NEW.MEMO1,
:NEW.MEMO2,
:NEW.MEMO3,
:NEW.MEMO4,
:NEW.MEMO5,
:NEW.MEMO6,
:NEW.NCG_BIL,
:NEW.NCG_BLO,
:NEW.NCG_GLU,
:NEW.NCG_KET,
:NEW.NCG_LEU,
:NEW.NCG_NIT,
:NEW.NCG_PH,
:NEW.NCG_PRO,
:NEW.NCG_SG,
:NEW.NCG_UBG,
:NEW.NCG_VC,
:NEW.NUMBEROFCASE,
:NEW.OXIMETER,
:NEW.PRODUCER,
:NEW.PULSE,
:NEW.SBP,
:NEW.TEMP,
:NEW.TG,
:NEW.WEIGHT
);
ELSIF UPDATING THEN
DELETE FROM P2_EHEALTH_ARCH_CHECKOFLK@DBLINK_HYS WHERE NUMBEROFCASE = :OLD.NUMBEROFCASE AND CARDNO = :OLD.CARDNO AND DEVICESN = :OLD.DEVICESN AND CRTIME = :OLD.CRTIME;
INSERT INTO P2_EHEALTH_ARCH_CHECKOFLK@DBLINK_HYS(
ANAL,
BREATH,
CARDNO,
CHECKOFLKID,
CHECKTIME,
CHO,
CRTIME,
CRUSER,
DBP,
DEVICESN,
DEVICETYPE,
ETCFILEPATH3,
ETCFILEPATH4,
ETCFILEPATH5,
ETC_REPORT_PATH,
ETC_REPORT_PATH_DATBAS,
FETALHEART,
FLAG,
GLU,
HDL,
HEIGHT,
ICPCODE,
LDL,
MEAN,
MEMO1,
MEMO2,
MEMO3,
MEMO4,
MEMO5,
MEMO6,
NCG_BIL,
NCG_BLO,
NCG_GLU,
NCG_KET,
NCG_LEU,
NCG_NIT,
NCG_PH,
NCG_PRO,
NCG_SG,
NCG_UBG,
NCG_VC,
NUMBEROFCASE,
OXIMETER,
PRODUCER,
PULSE,
SBP,
TEMP,
TG,
WEIGHT
)
VALUES(
:NEW.ANAL,
:NEW.BREATH,
:NEW.CARDNO,
ARCH_CHECKOFLK_SEQ1.nextval@dblink_hys,
:NEW.CHECKTIME,
:NEW.CHO,
:NEW.CRTIME,
:NEW.CRUSER,
:NEW.DBP,
:NEW.DEVICESN,
:NEW.DEVICETYPE,
:NEW.ETCFILEPATH3,
:NEW.ETCFILEPATH4,
:NEW.ETCFILEPATH5,
:NEW.ETC_REPORT_PATH,
:NEW.ETC_REPORT_PATH_DATBAS,
:NEW.FETALHEART,
:NEW.FLAG,
:NEW.GLU,
:NEW.HDL,
:NEW.HEIGHT,
:NEW.ICPCODE,
:NEW.LDL,
:NEW.MEAN,
:NEW.MEMO1,
:NEW.MEMO2,
:NEW.MEMO3,
:NEW.MEMO4,
:NEW.MEMO5,
:NEW.MEMO6,
:NEW.NCG_BIL,
:NEW.NCG_BLO,
:NEW.NCG_GLU,
:NEW.NCG_KET,
:NEW.NCG_LEU,
:NEW.NCG_NIT,
:NEW.NCG_PH,
:NEW.NCG_PRO,
:NEW.NCG_SG,
:NEW.NCG_UBG,
:NEW.NCG_VC,
:NEW.NUMBEROFCASE,
:NEW.OXIMETER,
:NEW.PRODUCER,
:NEW.PULSE,
:NEW.SBP,
:NEW.TEMP,
:NEW.TG,
:NEW.WEIGHT
);
ELSIF DELETING THEN
DELETE FROM P2_EHEALTH_ARCH_CHECKOFLK@DBLINK_HYS WHERE NUMBEROFCASE = :OLD.NUMBEROFCASE AND CARDNO = :OLD.CARDNO AND DEVICESN = :OLD.DEVICESN AND CRTIME = :OLD.CRTIME;
END IF;
END T_P2_EHEALTH_CHECKOFLK_SYNC;