DGDEATH ;ALB/MRL/PJR-PROCESS DECEASED PATIENTS ; 10/27/04 9:45pm
;;5.3;PIMS;**45,84,101,149,392,545,595,568,563,725,772,1015,1016**;JUN 30, 2012;Build 20
;
GET N DGMTI,DATA
S DGDTHEN="" W !! S DIC="^DPT(",DIC(0)="AEQMZ" D ^DIC G Q:Y'>0 S (DA,DFN)=+Y
S DGDOLD=$G(^DPT(DFN,.35))
I $D(^DPT(DFN,.1)) W !?3,"Patient is currently in-house. Discharge him with a discharge type of DEATH." G GET
I $S($D(^DPT(DFN,.35)):^(.35),1:"") F DGY=0:0 S DGY=$O(^DGPM("ATID1",DFN,DGY)) Q:'DGY S DGDA=$O(^(DGY,0)) I $D(^DGPM(+DGDA,0)),$P(^(0),"^",17)]"" S DGXX=$P(^(0),"^",17),DGXX=^DGPM(DGXX,0) I "^12^38^"[("^"_$P(DGXX,"^",18)_"^") G DIS
D NOW^%DTC S DGNOW=%
S ^TMP("DEATH",$J)=1
K A W ! S DIE=DIC,DR=".351" D ^DIE
I '$D(^DPT(DFN,.35)) K ^TMP("DEATH",$J) G GET
S DGDNEW=^DPT(DFN,.35)
I $P(DGDNEW,"^",1)="",$P(DGDNEW,"^",2)'="" S DR=".352////@" D ^DIE
I $P(DGDNEW,"^",1)="" K ^TMP("DEATH",$J) G GET
SN I $P(DGDNEW,"^",1)'="" S DR=".353" D ^DIE I $P($G(^DPT(DFN,.35)),"^",3)']"" D SNDISP G SN
I DGDOLD'=DGDNEW D DISCHRGE
I $P(DGDOLD,"^",1)'=$P(DGDNEW,"^",1) D XFR
K ^TMP("DEATH",$J) G GET
;
DIS W !,"Patient has a discharge type of Death",!,"Edit the discharge",!
Q K A,DA,DFN,DGDA,DIC,DIE,DR,DGXX,DGY,DGDTHEN,DGDOLD,DGDNEW,DGDONOT Q
XFR ; called from set x-ref of field .351 of file 2
N DGPCMM,DGFAPT,DGFAPTI,DGFAPT1
Q:'$D(DFN)
K DGTEXT D ^DGPATV S DGDEATH=$$GET1^DIQ(2,DFN,.351,"I"),XMSUB="PATIENT HAS EXPIRED",DGCT=0
D DEMOG
S DGT=X-.0001,(Y,DGDDT)=X,DG1="" D:DGT]"" ^DGPMSTAT
S Y=$$FMTE^XLFDT(Y),Y=$S(Y]"":Y,1:"UNKNOWN")
S DGDONOT=0 D APTT3
D LINE("")
D LINE(" Date/Time of Death: "_DEATHVAL_$S(DGDONOT:"",'DG1:"",$D(DGDTHEN):"",1:" (While an inpatient)"))
D LINE("")
I '$D(ADM),DG1,$D(^DGPM(+DGA1,0)) S ADM=+^DGPM($P(^(0),"^",14),0)
S Y=$$FMTE^XLFDT($S($D(ADM):ADM,1:""))
D LINE($S($D(DGDTHEN):"",DG1:" Admission Date/Time: "_Y_$S((DGDDT-ADM)<1:" (Within 24 hours of hospitalization)",1:""),1:""))
D LINE("")
S DGX=$P($G(^DGPM(+$G(DGA1),0)),"^",6),DGX=$P($G(^DIC(42,+DGX,0)),U,1)
D LINE($S($D(DGDTHEN):"",('DG1):"",$D(DGA1):" Admitted To: "_$S(DGX]"":DGX,1:"UNKNOWN"),1:"")) K DGX
D LINE("")
I DG1&'$D(DGDTHEN) D
. D LINE($S($D(DGXFR0):" Last Transfer: "_$S($D(^DIC(42,+$P(DGXFR0,"^",6),0)):$P(^(0),"^"),1:"UNKNOWN"),1:""))
. D LINE("")
F N DGARRAY,SDCNT S DGFAPT=DGDEATH,DGFAPTI=""
S DGARRAY("FLDS")=3,DGARRAY(4)=DFN,DGARRAY("SORT")="P",DGARRAY(1)=DT,DGARRAY(3)="I;R"
S SDCNT=$$SDAPI^SDAMA301(.DGARRAY)
;
I SDCNT>0 F S DGFAPT=$O(^TMP($J,"SDAMA301",DFN,DGFAPT)) Q:'DGFAPT S DGFAPT1=$G(^TMP($J,"SDAMA301",DFN,DGFAPT)) Q:DGFAPT1']"" D Q:DGFAPTI
.I $P($P(DGFAPT1,U,3),";")'["C" D LINE("NOTE: Patient has future appointments scheduled!!") S DGFAPTI=1
S DGSCHAD=0 D SA I DGSCHAD D LINE("NOTE: Patient had scheduled admissions which have been cancelled!!")
I 'DGVETS D LINE("Patient is a NON-VETERAN."_$S($D(^DIC(21,+$P($G(^DPT(DFN,.32)),"^",3),0)):" ["_$P(^(0),"^",1)_"]",1:""))
S DGPCMM=$$PCMMXMY^SCAPMC25(1,DFN,,,0) ;creates xmy array
S DGCT=$$PCMAIL^SCMCMM(DFN,"DGTEXT",DT)
Q1 S DGB=1 D ^DGBUL S X=DGDEATH
K DGDEATH,DGSCHAD,DGI,Y,DGDDT,^TMP($J,"SDAMA301") D KILL^DGPATV K ADM,DG1,DGA1,DGCT,DGT,DGXX,DGY,Z Q
SA F DGI=0:0 S DGI=$O(^DGS(41.1,"B",DFN,DGI)) Q:'DGI I $D(^DGS(41.1,DGI,0)),($P(^(0),"^",13)']""),($P(^(0),"^",17)']"") S $P(^(0),"^",13)=DGDEATH,$P(^(0),"^",14)=+DUZ,$P(^(0),"^",15)=1,$P(^(0),"^",16)=2,DGSCHAD=1
Q
;
DEL ; delete death bulletin
N DGPCMM,DELBY,DELTM,DTHINFO
S DFN=+$G(DA) I '$D(^DPT(DFN,0)) Q ; no patient node
I +$G(^DPT(DFN,.35)) Q ; not deletion
S DGDEATH=X,XMSUB="Patient Death has been Deleted",DGCT=0
D ^DGPATV
D LINE("The date of death for the following patient has been deleted.")
D LINE("")
D DEMOG
D LINE("")
S DGPCMM=$$PCMMXMY^SCAPMC25(1,DFN,,,0) ;creates xmy array
S DGCT=$$PCMAIL^SCMCMM(DFN,"DGTEXT",DT)
S DGB=1 D ^DGBUL S X=DGDEATH
K DGCT,DGDEATH D KILL^DGPATV
Q
;
DEMOG ; list main demographics
D LINE(" NAME: "_DGNAME)
D LINE(" SSN: "_$P(SSN,"^",2))
D LINE(" DOB: "_$P(DOB,"^",2))
I DGVETS D
. N DGX
. S DGX=$G(^DPT(DFN,.31))
. S DGLOCATN=$$FIND1^DIC(4,"","MX","`"_+$P(DGX,U,4)),DGLOCATN=$S(+DGLOCATN>0:$P($$NS^XUAF4(DGLOCATN),U),1:"NOT LISTED")
. D LINE(" CLAIM FOLDER LOCATION: "_$S($D(DGLOCATN):DGLOCATN,1:"NOT LISTED"))
. D LINE(" CLAIM NUMBER: "_$S($P(DGX,"^",3)]"":$P(DGX,"^",3),1:"NOT LISTED"))
D LINE(" COORDINATING MASTER OF RECORD: "_DGCMOR)
D GETS^DIQ(2,DFN_",",".351;.353;.354;.355","E","DTHINFO")
S DEATHVAL=$G(DTHINFO(2,DFN_",",.351,"E"))
S DEATHVAL=$$FMTE^XLFDT(DEATHVAL),DEATHVAL=$S(DEATHVAL]"":DEATHVAL,1:"UNKNOWN")
S SOURCE=$G(DTHINFO(2,DFN_",",.353,"E"))
S DELTM=$G(DTHINFO(2,DFN_",",.354,"E"))
S DELBY=$G(DTHINFO(2,DFN_",",.355,"E"))
D LINE("")
D LINE(" LAST EDITED BY: "_DELBY)
D LINE(" DATE/TIME LAST MODIFIED: "_DELTM)
D LINE(" SOURCE OF NOTIFICATION: "_$S(SOURCE="":"UNDEFINED",1:SOURCE))
;K DEATHVAL,SOURCE,DELTM,DELBY
Q
;
LINE(X) ; add line contained in X to array
S DGCT=DGCT+1
S DGTEXT(DGCT,0)=X
Q
DSBULL ;
;
I $G(IVMDODUP)=1 Q
S DFN=DA
I $D(DGPMDA) D Q
.S DISTYPE=$P($G(^DGPM(DGPMDA,0)),"^",18)
.I $G(^DG(405.2,DISTYPE,0))["DEATH" D
..S FDA(2,DFN_",",.353)=1 D FILE^DIE(,"FDA","BWFERR")
..D DISCHRGE,XFR
I $D(^TMP("DEATH",$J)) Q
D DISCHRGE,XFR
Q
DKBULL ;
S DFN=DA
S FDA(2,DFN_",",.353)="@"
I $D(^TMP("DEATH",$J)) S FDA(2,DFN_",",.355)=DUZ
D FILE^DIE(,"FDA",)
D DEL
Q
DISCHRGE ;
; If the patient is being discharged, determine values needed for
; Source of Notification and Date/Time last entered.
;
I '$D(DGNOW) S DGNOW=$$HTFM^XLFDT($H)
I $G(DGDAUTO)'=1 S FDA(2,DFN_",",.354)=DGNOW
S FDA(2,DFN_",",.355)=DUZ
D FILE^DIE(,"FDA",)
Q
APTT3 ;Check to exclude "While an Inpatient" from DOD Bulletin
; Input: DFN Output: DGDONOT
N DATE,XIEN,TYPE,XDOD,YES
S DGDONOT=0
S XDOD=$P($G(^DPT(DFN,.35)),"^",1) I 'XDOD Q
S XDOD=$P(XDOD,".",1),YES=0,TYPE=""
I '$D(^DGPM("APTT3",DFN)) Q
S DATE=$O(^DGPM("APTT3",DFN,XDOD)) I 'DATE Q
I $P(DATE,".",1)=XDOD S YES=1
I ($P(DATE,".",1)-1)=XDOD S YES=1
S XIEN=$O(^DGPM("APTT3",DFN,DATE,"")) I 'XIEN Q
S TYPE=$P($G(^DGPM(XIEN,0)),"^",4)
I YES,'((TYPE=27)!(TYPE=32)) S DGDONOT=1
Q
SNDISP ; Source of Notification display choices
N DIR,DTOUT,DUOUT,DIRUT,DIROUT,DGLIST,DGLNAME,I,X,Y
S DGLIST=$P($G(^DD(2,.353,0)),"^",3)
S Y=6
S DIR("?",1)=" "
S DIR("?",2)=" This is a required response. Please select from the following:"
S DIR("?",3)=" Entering '^' will take you back to the Source of Notification prompt"
S DIR("?",4)=" "
S DIR("?",5)=" "
F X=1:1 S DGLNAME=$P(DGLIST,";",X) Q:DGLNAME']"" S DIR("?",Y)=" "_$P(DGLNAME,":",1)_" "_$P(DGLNAME,":",2) S Y=Y+1
S DIR("?",Y)=" "
F I=1:1 Q:'$D(DIR("?",I)) W !,DIR("?",I)
Q
DGDEATH ;ALB/MRL/PJR-PROCESS DECEASED PATIENTS ; 10/27/04 9:45pm
+1 ;;5.3;PIMS;**45,84,101,149,392,545,595,568,563,725,772,1015,1016**;JUN 30, 2012;Build 20
+2 ;
GET NEW DGMTI,DATA
+1 SET DGDTHEN=""
WRITE !!
SET DIC="^DPT("
SET DIC(0)="AEQMZ"
DO ^DIC
IF Y'>0
GOTO Q
SET (DA,DFN)=+Y
+2 SET DGDOLD=$GET(^DPT(DFN,.35))
+3 IF $DATA(^DPT(DFN,.1))
WRITE !?3,"Patient is currently in-house. Discharge him with a discharge type of DEATH."
GOTO GET
+4 IF $SELECT($DATA(^DPT(DFN,.35)):^(.35),1:"")
FOR DGY=0:0
SET DGY=$ORDER(^DGPM("ATID1",DFN,DGY))
IF 'DGY
QUIT
SET DGDA=$ORDER(^(DGY,0))
IF $DATA(^DGPM(+DGDA,0))
IF $PIECE(^(0),"^",17)]""
SET DGXX=$PIECE(^(0),"^",17)
SET DGXX=^DGPM(DGXX,0)
IF "^12^38^"[("^"_$PIECE(DGXX,"^",18)_"^")
GOTO DIS
+5 DO NOW^%DTC
SET DGNOW=%
+6 SET ^TMP("DEATH",$JOB)=1
+7 KILL A
WRITE !
SET DIE=DIC
SET DR=".351"
DO ^DIE
+8 IF '$DATA(^DPT(DFN,.35))
KILL ^TMP("DEATH",$JOB)
GOTO GET
+9 SET DGDNEW=^DPT(DFN,.35)
+10 IF $PIECE(DGDNEW,"^",1)=""
IF $PIECE(DGDNEW,"^",2)'=""
SET DR=".352////@"
DO ^DIE
+11 IF $PIECE(DGDNEW,"^",1)=""
KILL ^TMP("DEATH",$JOB)
GOTO GET
SN IF $PIECE(DGDNEW,"^",1)'=""
SET DR=".353"
DO ^DIE
IF $PIECE($GET(^DPT(DFN,.35)),"^",3)']""
DO SNDISP
GOTO SN
+1 IF DGDOLD'=DGDNEW
DO DISCHRGE
+2 IF $PIECE(DGDOLD,"^",1)'=$PIECE(DGDNEW,"^",1)
DO XFR
+3 KILL ^TMP("DEATH",$JOB)
GOTO GET
+4 ;
DIS WRITE !,"Patient has a discharge type of Death",!,"Edit the discharge",!
Q KILL A,DA,DFN,DGDA,DIC,DIE,DR,DGXX,DGY,DGDTHEN,DGDOLD,DGDNEW,DGDONOT
QUIT
XFR ; called from set x-ref of field .351 of file 2
+1 NEW DGPCMM,DGFAPT,DGFAPTI,DGFAPT1
+2 IF '$DATA(DFN)
QUIT
+3 KILL DGTEXT
DO ^DGPATV
SET DGDEATH=$$GET1^DIQ(2,DFN,.351,"I")
SET XMSUB="PATIENT HAS EXPIRED"
SET DGCT=0
+4 DO DEMOG
+5 SET DGT=X-.0001
SET (Y,DGDDT)=X
SET DG1=""
IF DGT]""
DO ^DGPMSTAT
+6 SET Y=$$FMTE^XLFDT(Y)
SET Y=$SELECT(Y]"":Y,1:"UNKNOWN")
+7 SET DGDONOT=0
DO APTT3
+8 DO LINE("")
+9 DO LINE(" Date/Time of Death: "_DEATHVAL_$SELECT(DGDONOT:"",'DG1:"",$DATA(DGDTHEN):"",1:" (While an inpatient)"))
+10 DO LINE("")
+11 IF '$DATA(ADM)
IF DG1
IF $DATA(^DGPM(+DGA1,0))
SET ADM=+^DGPM($PIECE(^(0),"^",14),0)
+12 SET Y=$$FMTE^XLFDT($SELECT($DATA(ADM):ADM,1:""))
+13 DO LINE($SELECT($DATA(DGDTHEN):"",DG1:" Admission Date/Time: "_Y_$SELECT((DGDDT-ADM)<1:" (Within 24 hours of hospitalization)",1:""),1:""))
+14 DO LINE("")
+15 SET DGX=$PIECE($GET">GET(^DGPM(+$GET">GET(DGA1),0)),"^",6)
SET DGX=$PIECE($GET(^DIC(42,+DGX,0)),U,1)
+16 DO LINE($SELECT($DATA(DGDTHEN):"",('DG1):"",$DATA(DGA1):" Admitted To: "_$SELECT(DGX]"":DGX,1:"UNKNOWN"),1:""))
KILL DGX
+17 DO LINE("")
+18 IF DG1&'$DATA(DGDTHEN)
Begin DoDot:1
+19 DO LINE($SELECT($DATA(DGXFR0):" Last Transfer: "_$SELECT($DATA(^DIC(42,+$PIECE(DGXFR0,"^",6),0)):$PIECE(^(0),"^"),1:"UNKNOWN"),1:""))
+20 DO LINE("")
End DoDot:1
F NEW DGARRAY,SDCNT
SET DGFAPT=DGDEATH
SET DGFAPTI=""
+1 SET DGARRAY("FLDS")=3
SET DGARRAY(4)=DFN
SET DGARRAY("SORT")="P"
SET DGARRAY(1)=DT
SET DGARRAY(3)="I;R"
+2 SET SDCNT=$$SDAPI^SDAMA301(.DGARRAY)
+3 ;
+4 IF SDCNT>0
FOR
SET DGFAPT=$ORDER(^TMP($JOB,"SDAMA301",DFN,DGFAPT))
IF 'DGFAPT
QUIT
SET DGFAPT1=$GET(^TMP($JOB,"SDAMA301",DFN,DGFAPT))
IF DGFAPT1']""
QUIT
Begin DoDot:1
+5 IF $PIECE($PIECE(DGFAPT1,U,3),";")'["C"
DO LINE("NOTE: Patient has future appointments scheduled!!")
SET DGFAPTI=1
End DoDot:1
IF DGFAPTI
QUIT
+6 SET DGSCHAD=0
DO SA
IF DGSCHAD
DO LINE("NOTE: Patient had scheduled admissions which have been cancelled!!")
+7 IF 'DGVETS
DO LINE("Patient is a NON-VETERAN."_$SELECT($DATA(^DIC(21,+$PIECE($GET(^DPT(DFN,.32)),"^",3),0)):" ["_$PIECE(^(0),"^",1)_"]",1:""))
+8 ;creates xmy array
SET DGPCMM=$$PCMMXMY^SCAPMC25(1,DFN,,,0)
+9 SET DGCT=$$PCMAIL^SCMCMM(DFN,"DGTEXT",DT)
Q1 SET DGB=1
DO ^DGBUL
SET X=DGDEATH
+1 KILL DGDEATH,DGSCHAD,DGI,Y,DGDDT,^TMP($JOB,"SDAMA301")
DO KILL^DGPATV
KILL ADM,DG1,DGA1,DGCT,DGT,DGXX,DGY,Z
QUIT
SA FOR DGI=0:0
SET DGI=$ORDER(^DGS(41.1,"B",DFN,DGI))
IF 'DGI
QUIT
IF $DATA(^DGS(41.1,DGI,0))
IF ($PIECE(^(0),"^",13)']"")
IF ($PIECE(^(0),"^",17)']"")
SET $PIECE(^(0),"^",13)=DGDEATH
SET $PIECE(^(0),"^",14)=+DUZ
SET $PIECE(^(0),"^",15)=1
SET $PIECE(^(0),"^",16)=2
SET DGSCHAD=1
+1 QUIT
+2 ;
DEL ; delete death bulletin
+1 NEW DGPCMM,DELBY,DELTM,DTHINFO
+2 ; no patient node
SET DFN=+$GET(DA)
IF '$DATA(^DPT(DFN,0))
QUIT
+3 ; not deletion
IF +$GET(^DPT(DFN,.35))
QUIT
+4 SET DGDEATH=X
SET XMSUB="Patient Death has been Deleted"
SET DGCT=0
+5 DO ^DGPATV
+6 DO LINE("The date of death for the following patient has been deleted.")
+7 DO LINE("")
+8 DO DEMOG
+9 DO LINE("")
+10 ;creates xmy array
SET DGPCMM=$$PCMMXMY^SCAPMC25(1,DFN,,,0)
+11 SET DGCT=$$PCMAIL^SCMCMM(DFN,"DGTEXT",DT)
+12 SET DGB=1
DO ^DGBUL
SET X=DGDEATH
+13 KILL DGCT,DGDEATH
DO KILL^DGPATV
+14 QUIT
+15 ;
DEMOG ; list main demographics
+1 DO LINE(" NAME: "_DGNAME)
+2 DO LINE(" SSN: "_$PIECE(SSN,"^",2))
+3 DO LINE(" DOB: "_$PIECE(DOB,"^",2))
+4 IF DGVETS
Begin DoDot:1
+5 NEW DGX
+6 SET DGX=$GET(^DPT(DFN,.31))
+7 SET DGLOCATN=$$FIND1^DIC(4,"","MX","`"_+$PIECE(DGX,U,4))
SET DGLOCATN=$SELECT(+DGLOCATN>0:$PIECE($$NS^XUAF4(DGLOCATN),U),1:"NOT LISTED")
+8 DO LINE(" CLAIM FOLDER LOCATION: "_$SELECT($DATA(DGLOCATN):DGLOCATN,1:"NOT LISTED"))
+9 DO LINE(" CLAIM NUMBER: "_$SELECT($PIECE(DGX,"^",3)]"":$PIECE(DGX,"^",3),1:"NOT LISTED"))
End DoDot:1
+10 DO LINE(" COORDINATING MASTER OF RECORD: "_DGCMOR)
+11 DO GETS^DIQ(2,DFN_",",".351;.353;.354;.355","E","DTHINFO")
+12 SET DEATHVAL=$GET(DTHINFO(2,DFN_",",.351,"E"))
+13 SET DEATHVAL=$$FMTE^XLFDT(DEATHVAL)
SET DEATHVAL=$SELECT(DEATHVAL]"":DEATHVAL,1:"UNKNOWN")
+14 SET SOURCE=$GET(DTHINFO(2,DFN_",",.353,"E"))
+15 SET DELTM=$GET(DTHINFO(2,DFN_",",.354,"E"))
+16 SET DELBY=$GET(DTHINFO(2,DFN_",",.355,"E"))
+17 DO LINE("")
+18 DO LINE(" LAST EDITED BY: "_DELBY)
+19 DO LINE(" DATE/TIME LAST MODIFIED: "_DELTM)
+20 DO LINE(" SOURCE OF NOTIFICATION: "_$SELECT(SOURCE="":"UNDEFINED",1:SOURCE))
+21 ;K DEATHVAL,SOURCE,DELTM,DELBY
+22 QUIT
+23 ;
LINE(X) ; add line contained in X to array
+1 SET DGCT=DGCT+1
+2 SET DGTEXT(DGCT,0)=X
+3 QUIT
DSBULL ;
+1 ;
+2 IF $GET(IVMDODUP)=1
QUIT
+3 SET DFN=DA
+4 IF $DATA(DGPMDA)
Begin DoDot:1
+5 SET DISTYPE=$PIECE($GET(^DGPM(DGPMDA,0)),"^",18)
+6 IF $GET(^DG(405.2,DISTYPE,0))["DEATH"
Begin DoDot:2
+7 SET FDA(2,DFN_",",.353)=1
DO FILE^DIE(,"FDA","BWFERR")
+8 DO DISCHRGE
DO XFR
End DoDot:2
End DoDot:1
QUIT
+9 IF $DATA(^TMP("DEATH",$JOB))
QUIT
+10 DO DISCHRGE
DO XFR
+11 QUIT
DKBULL ;
+1 SET DFN=DA
+2 SET FDA(2,DFN_",",.353)="@"
+3 IF $DATA(^TMP("DEATH",$JOB))
SET FDA(2,DFN_",",.355)=DUZ
+4 DO FILE^DIE(,"FDA",)
+5 DO DEL
+6 QUIT
DISCHRGE ;
+1 ; If the patient is being discharged, determine values needed for
+2 ; Source of Notification and Date/Time last entered.
+3 ;
+4 IF '$DATA(DGNOW)
SET DGNOW=$$HTFM^XLFDT($HOROLOG)
+5 IF $GET(DGDAUTO)'=1
SET FDA(2,DFN_",",.354)=DGNOW
+6 SET FDA(2,DFN_",",.355)=DUZ
+7 DO FILE^DIE(,"FDA",)
+8 QUIT
APTT3 ;Check to exclude "While an Inpatient" from DOD Bulletin
+1 ; Input: DFN Output: DGDONOT
+2 NEW DATE,XIEN,TYPE,XDOD,YES
+3 SET DGDONOT=0
+4 SET XDOD=$PIECE($GET(^DPT(DFN,.35)),"^",1)
IF 'XDOD
QUIT
+5 SET XDOD=$PIECE(XDOD,".",1)
SET YES=0
SET TYPE=""
+6 IF '$DATA(^DGPM("APTT3",DFN))
QUIT
+7 SET DATE=$ORDER(^DGPM("APTT3",DFN,XDOD))
IF 'DATE
QUIT
+8 IF $PIECE(DATE,".",1)=XDOD
SET YES=1
+9 IF ($PIECE(DATE,".",1)-1)=XDOD
SET YES=1
+10 SET XIEN=$ORDER(^DGPM("APTT3",DFN,DATE,""))
IF 'XIEN
QUIT
+11 SET TYPE=$PIECE($GET(^DGPM(XIEN,0)),"^",4)
+12 IF YES
IF '((TYPE=27)!(TYPE=32))
SET DGDONOT=1
+13 QUIT
SNDISP ; Source of Notification display choices
+1 NEW DIR,DTOUT,DUOUT,DIRUT,DIROUT,DGLIST,DGLNAME,I,X,Y
+2 SET DGLIST=$PIECE($GET(^DD(2,.353,0)),"^",3)
+3 SET Y=6
+4 SET DIR("?",1)=" "
+5 SET DIR("?",2)=" This is a required response. Please select from the following:"
+6 SET DIR("?",3)=" Entering '^' will take you back to the Source of Notification prompt"
+7 SET DIR("?",4)=" "
+8 SET DIR("?",5)=" "
+9 FOR X=1:1
SET DGLNAME=$PIECE(DGLIST,";",X)
IF DGLNAME']""
QUIT
SET DIR("?",Y)=" "_$PIECE(DGLNAME,":",1)_" "_$PIECE(DGLNAME,":",2)
SET Y=Y+1
+10 SET DIR("?",Y)=" "
+11 FOR I=1:1
IF '$DATA(DIR("?",I))
QUIT
WRITE !,DIR("?",I)
+12 QUIT