DGOERNOT ;ALB/LDB - OERR NOTIFICATIONS ;24 JUN 91
;;5.3;Registration;**118,192**;Aug 13, 1993
EN ;Entry point from event driver
ADM D CHK G ADMQ:'DGCHK
N Y S Y=$P(DGPMA,"^")
I $P(DGPMA,"^",2)=1,'DGPMP S NIEN=18 D DATE S ORBPMSG="Admitted on "_DATE_$S($P(DGPMA,"^",6):" "_$P($G(^DIC(42,+$P(DGPMA,"^",6),0)),U),1:"")_$S($P(DGPMA,"^",7):" RmBd: "_$P($G(^DG(405.4,+$P(DGPMA,"^",7),0)),U),1:"") D NOTE
DIS I $P(DGPMA,"^",2)=3,$P(DGPMA,"^",18)'=$P(DGPMP,"^",18),"^12^38^"[("^"_$P(DGPMA,"^",18)_"^") S NIEN=20 D DATE S ORBPMSG="Died while an inpatient on "_DATE D NOTE
ADMQ K DGCHK Q
;
DATE X ^DD("DD") S DATE=Y K Y
Q
;
CHK S DGCHK=0 I $D(^DD(100,0,"VR")),^("VR")>2.09 S DGCHK=1
Q
;
DEATH ;Entry point from cross-reference on DATE OF DEATH field in PATIENT file
D CHK G DEATHQ:'DGCHK
S DATE=+^DPT(DA,.35) I $D(^DGPM("APRD",DA,+^DPT(DA,.35))),$D(^DGPM(+$O(^(DATE,0)),0)),"^12^38^"[("^"_$P(^(0),U,18)_"^") K DATE Q
N Y S NIEN=20,DFN=DA,Y=$P(^DPT(DA,.35),"^") D DATE S ORBPMSG="Died on "_DATE D NOTE
DEATHQ K DGCHK Q
;
UNSCHED ;Entry point from STATUS field in DISPOSITION multiple in PATIENT file
D CHK G UNSCHEDQ:'DGCHK
N Y Q:X']""!(X>1)
I $S('$P(^DPT(DA(1),"DIS",DA,0),U,3)&'$D(DGOERNOT):1,'$D(DGOERNOT):0,(DGOERNOT>1):1,1:0) S DFN=DA(1),NIEN=19,Y=$P(^DPT(DA(1),"DIS",DA,0),"^") D DATE S ORBPMSG="Unscheduled visit on "_DATE D NOTE
UNSCHEDQ K DGCHK,DGOERNOT Q
;
NOTE S ORNOTE(NIEN)="",ORVP=DFN_";DPT(" D NOTE^ORX3
K DATE,ORNOTE,ORBPMSG Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGOERNOT 1478 printed Nov 22, 2024@17:56:31 Page 2
DGOERNOT ;ALB/LDB - OERR NOTIFICATIONS ;24 JUN 91
+1 ;;5.3;Registration;**118,192**;Aug 13, 1993
EN ;Entry point from event driver
ADM DO CHK
if 'DGCHK
GOTO ADMQ
+1 NEW Y
SET Y=$PIECE(DGPMA,"^")
+2 IF $PIECE(DGPMA,"^",2)=1
IF 'DGPMP
SET NIEN=18
DO DATE
SET ORBPMSG="Admitted on "_DATE_$SELECT($PIECE(DGPMA,"^",6):" "_$PIECE($GET(^DIC(42,+$PIECE(DGPMA,"^",6),0)),U),1:"")_$SELECT($PIECE(DGPMA,"^",7):" RmBd: "_$PIECE($GET(^DG(405.4,+$PIECE(DGPMA,"^",7),0)),U),1:"")
DO NOTE
DIS IF $PIECE(DGPMA,"^",2)=3
IF $PIECE(DGPMA,"^",18)'=$PIECE(DGPMP,"^",18)
IF "^12^38^"[("^"_$PIECE(DGPMA,"^",18)_"^")
SET NIEN=20
DO DATE
SET ORBPMSG="Died while an inpatient on "_DATE
DO NOTE
ADMQ KILL DGCHK
QUIT
+1 ;
DATE XECUTE ^DD("DD")
SET DATE=Y
KILL Y
+1 QUIT
+2 ;
CHK SET DGCHK=0
IF $DATA(^DD(100,0,"VR"))
IF ^("VR")>2.09
SET DGCHK=1
+1 QUIT
+2 ;
DEATH ;Entry point from cross-reference on DATE OF DEATH field in PATIENT file
+1 DO CHK
if 'DGCHK
GOTO DEATHQ
+2 SET DATE=+^DPT(DA,.35)
IF $DATA(^DGPM("APRD",DA,+^DPT(DA,.35)))
IF $DATA(^DGPM(+$ORDER(^(DATE,0)),0))
IF "^12^38^"[("^"_$PIECE(^(0),U,18)_"^")
KILL DATE
QUIT
+3 NEW Y
SET NIEN=20
SET DFN=DA
SET Y=$PIECE(^DPT(DA,.35),"^")
DO DATE
SET ORBPMSG="Died on "_DATE
DO NOTE
DEATHQ KILL DGCHK
QUIT
+1 ;
UNSCHED ;Entry point from STATUS field in DISPOSITION multiple in PATIENT file
+1 DO CHK
if 'DGCHK
GOTO UNSCHEDQ
+2 NEW Y
if X']""!(X>1)
QUIT
+3 IF $SELECT('$PIECE(^DPT(DA(1),"DIS",DA,0),U,3)&'$DATA(DGOERNOT):1,'$DATA(DGOERNOT):0,(DGOERNOT>1):1,1:0)
SET DFN=DA(1)
SET NIEN=19
SET Y=$PIECE(^DPT(DA(1),"DIS",DA,0),"^")
DO DATE
SET ORBPMSG="Unscheduled visit on "_DATE
DO NOTE
UNSCHEDQ KILL DGCHK,DGOERNOT
QUIT
+1 ;
NOTE SET ORNOTE(NIEN)=""
SET ORVP=DFN_";DPT("
DO NOTE^ORX3
+1 KILL DATE,ORNOTE,ORBPMSG
QUIT