TRIGGER MEDDATAPACS.STUDIESTRIGGER1

Meddata teletip için gerekli güncel Triger bilgisi

				
					CREATE OR REPLACE TRIGGER MEDDATAPACS.STUDIESTRIGGER1
AFTER INSERT OR UPDATE
ON MEDDATAPACS.STUDIES
FOR EACH ROW

DECLARE
ISTEK_NO1 NUMBER;
BEGIN
IF UPDATING
THEN
IF (IS_NUMBER (:OLD.ACCESSIONNUMBER) = 1)
THEN
UPDATE HASTANE.RAD_SONUC
SET IMAGENO = :OLD.STUDYUID
WHERE ISTEK_NO = :OLD.ACCESSIONNUMBER;

UPDATE HASTANE.ISTEKMAIN
SET IMAGENO = :OLD.STUDYUID
WHERE ISTEK_NO = :OLD.ACCESSIONNUMBER;
ELSE
UPDATE HASTANE.RAD_SONUC
SET IMAGENO = :OLD.STUDYUID
WHERE ROWID1 = :OLD.ACCESSIONNUMBER;

SELECT ISTEK_NO
INTO ISTEK_NO1
FROM HASTANE.ISLEMYAP
WHERE ROWID1 = :OLD.ACCESSIONNUMBER;

UPDATE HASTANE.ISTEKMAIN
SET IMAGENO = :OLD.STUDYUID
WHERE ISTEK_NO = ISTEK_NO1;
END IF;
ELSIF INSERTING
THEN
UPDATE MEDDATAPACS.APPLYTABLE
SET TAMAM = ‘T’
WHERE ACCESS_ID = :NEW.ACCESSIONNUMBER;

UPDATE HASTANE.ISLEMYAP
SET IMAGENO = :NEW.STUDYUID
WHERE ROWID1 = :NEW.ACCESSIONNUMBER;

INSERT INTO MEDDATAPACS.KOS_LIST (STUDYUID, TARIH, ACCESS_NO)
VALUES (:NEW.STUDYUID, SYSDATE, :NEW.ACCESSIONNUMBER);

IF (IS_NUMBER (:NEW.ACCESSIONNUMBER) = 1)
THEN
UPDATE HASTANE.RAD_SONUC
SET IMAGENO = :NEW.STUDYUID
WHERE ISTEK_NO = :NEW.ACCESSIONNUMBER;

UPDATE HASTANE.ISTEKMAIN
SET IMAJDURUM = 12, IMAGENO = :NEW.STUDYUID
WHERE ISTEK_NO = :NEW.ACCESSIONNUMBER;
ELSE
UPDATE HASTANE.RAD_SONUC
SET IMAGENO = :NEW.STUDYUID
WHERE ROWID1 = :NEW.ACCESSIONNUMBER;

BEGIN
SELECT ISTEK_NO
INTO ISTEK_NO1
FROM HASTANE.ISLEMYAP
WHERE ROWID1 = :NEW.ACCESSIONNUMBER;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
ISTEK_NO1 := NULL;
END;

IF NOT (ISTEK_NO1 IS NULL)
THEN
UPDATE HASTANE.ISTEKMAIN
SET IMAJDURUM = 12, IMAGENO = :NEW.STUDYUID
WHERE ISTEK_NO = ISTEK_NO1;
END IF;
END IF;
END IF;
END;
/
				
			

hakkında admin

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir