DGPTF4 ;ALB/JDS - PTF ENTRY/EDIT-4 ; 2/19/04 9:33am
;;5.3;PIMS;**114,115,397,510,517,478,683,1015,1016**;JUN 30, 2012;Build 20
;
WR ;
W @IOF,HEAD,?72 S Z="<701>" D Z^DGPTFM K X S $P(X,"-",81)="" W !,X
Q
EN S Y=+B(70) D D^DGPTUTL W ! S Z=5 D Z W $S($P(B(0),U,11)=1:"Date of Disch: ",1:"Census Date : ") S Z=Y,Z1=20 D Z1 W "Disch Specialty: ",$S($D(^DIC(42.4,+$P(B(70),U,2),0)):$E($P(^(0),U,1),1,25),1:"")
W !," Type of Disch: " S L=";"_$P(^DD(45,72,0),U,3),L1=";"_$P(B(70),U,3)_":" W $P($P(L,L1,2),";",1),?41 S L=";"_$P(^DD(45,72.1,0),U,3),L1=";"_$P(B(70),U,14)_":" W "Disch Status: ",$P($P(L,L1,2),";",1)
W !," Place of Disp: ",$S($D(^DIC(45.6,+$P(B(70),U,6),0)):$E($P(^(0),U,1),1,21),1:"")
W ?40 S Z=6 D Z W " Out Treat: ",$P("YES^^NO",U,+$P(B(70),U,4))
W !?6,"Means Test: " S L=";"_$P(^DD(45,10,0),U,3),L1=";"_$P(B(0),U,10)_":" W $P($P(L,L1,2),";",1)
W ?42,"VA Auspices: ",$S($P(B(70),U,5)=1:"YES",$P(B(70),U,5)=2:"NO",1:"")
W ! S Z=7 D Z W " Receiv facil: " S Z=$P(B(70),U,12)_$P(B(70),U,13),Z1=18 D Z1 W ?38 S Z="Other Fields" D Z
S DGINC=$P(B(101),U,7)
I DGINC>1000 S DGINC=$E(DGINC,1,$L(DGINC)-3)_","_$E(DGINC,$L(DGINC)-2,$L(DGINC))
W !," C&P Status: " S L=";"_$P(^DD(45,78,0),U,3),L1=";"_$P(B(70),U,9)_":" W $E($P($P(L,L1,2),";",1),1,24),?47,"Income: $",DGINC
K DGINC
AS ;
N DGRSC
S DGRSC=$S($P(A(.3),U)="Y":$$RTEN^DGPTR4($P(A(.3),U,2)),1:"")
W !," ASIH Days: ",$P(B(70),U,8)
W ?40,"SC Percentage: ",$S($P(A(.3),U)="Y":$P(A(.3),U,2)_"%",1:"")
I DGRSC]"",DGRSC'=$P(A(.3),U,2) W ?60,"Transmitted: ["_DGRSC_"%]"
;W !,?39,"Period Of Serv: ",$S($D(^DIC(21,$S('$D(^DGPM(+$O(^DGPM("APTF",PTF,0)),"ODS")):+$P(A(.32),U,3),+^("ODS"):+$O(^DIC(21,"D",6,0)),1:+$P(A(.32),U,3)),0)):$E($P(^(0),U),1,26),1:""),!
W !,?39,"Period Of Serv: "
W $S($D(^DIC(21,$S('$D(^DGPM(+$O(^DGPM("APTF",PTF,0)),"ODS")):+$$CKPOS^DGPTUTL($P(B(101),U,8),+$P(A(.32),U,3)),+^("ODS"):+$O(^DIC(21,"D",6,0)),1:$$CKPOS^DGPTUTL($P(B(101),U,8),+$P(A(.32),U,3))),0)):$E($P(^(0),U),1,26),1:""),!
Q
;
EN1 ;LOAD AND DISPLAY DIAGNOSES FOR PTF 701 SCREEN
K DRG S B(70)=$S($D(^DGPT(PTF,70)):^(70),1:""),B(71)=$S($D(^DGPT(PTF,71)):^(71),1:"") D WR
S DGPTDAT=$$GETDATE^ICDGTDRG(PTF) ;Get correct effective date
S DGPTTMP=$$ICDDX^ICDCODE(+$P(B(70),U,10),DGPTDAT)
W ! S Z=1 D Z W " Principal Diagnosis: ",$S(DGPTTMP&$P(DGPTTMP,U,10):$P(DGPTTMP,U,4)_"("_$P(DGPTTMP,U,2)_")",1:"")
S DGPTTMP=$$ICDDX^ICDCODE(+$P(B(70),U,11),DGPTDAT)
W:$P(B(70),U,11)&('$P(B(70),U,10)) !," Principal Diag: ",$S(DGPTTMP&$P(DGPTTMP,U,10):$P(DGPTTMP,U,4)_" ("_$P(DGPTTMP,U,2)_")",1:"")
S K=B(70) F I=16:1:24 D DSP
S K=B(71) F I=1:1:4 D DSP
S DGPTF=PTF D:'DGST CHK701^DGPTSCAN,UP701^DGPTSPQ
; display contents of 300th node
S DG300=$S($D(^DGPT(PTF,300)):^(300),1:"") D:DG300]"" PRN2^DGPTFM8 K DG300
EN2 K DRG
I $D(^DGPT(PTF,0)),$P(^(0),U,11)=1 D
.S DA=DFN
.D EN1^DGPTFD
.I $D(DRG),$D(^DGP(45.84,PTF,0)),$P(^(0),U,6)'=DRG D
..N DGFDA,DGMSG
..S DGFDA(45.84,PTF_",",6)=DRG
..D FILE^DIE("","DGFDA","DGMSG")
JUMP K AGE,B,CC,DA,DAM,DOB,DXLS,EXP,I,L1,L2,SEX,DRGCAL,S,DIC,DR,DIE
Q:DGPR
;F I=$Y:1:18 W !
K X S $P(X,"-",81)="" W X
;
G O:DGST&(('$D(DRG))!('DGDD)!('$D(^DGP(45.84,PTF))))
X G ACT^DGPTF41
CLS G NOT:('$D(DRG))!('DGDD)!('DGFC)
;I DRG=470!(DRG=469) W !!,*7,"Unable to release DRG ",DRG,". Please verify data entered.",*7 D HANG^DGPTUTL G EN1
;
;change made to allow release of 470, before grouper released to vamc's
; patch 115
;DGDAT = effective date of DRG used in DGPTICD (468=CMS-DRG,998=MS-DRG)
I DRG=469,(+$G(DGDAT)<3071001) W !!,*7,"Unable to release DRG ",DRG,". Please verify data entered.",*7 D HANG^DGPTUTL G EN1
I DRG=998 W !!,*7,"Unable to release DRG ",DRG,". Please verify data entered.",*7 D HANG^DGPTUTL G EN1
I $D(DGCST),'DGCST D CEN G EN1:'DGCST
I '$P(^DGPT(PTF,0),"^",4) W !,"Updating TRANSFER DRGs..." S DGADM=$P(^DGPT(PTF,0),U,2) D SUDO1^DGPTSUDO
I DGDD>(DT+1) W !,"Cannot close with Discharge date in future." D HANG^DGPTUTL G EN1
I $D(^DGM("PT",DFN)) F I=0:0 S I=$O(^DGM("PT",DFN,I)) Q:'I I '$D(^DGM(I,0)) K ^DGM(I),^DGM("PT",DFN,I)
I $D(^DGM("PT",DFN)) W !!,"Not all messages have been cleared up for this patient--cannot close.",*7,*7 S DGPTF=DFN,X="??" K DGALL D HELP^DGPTMSGD K DGPTF G EN1:'$D(DGALL) K DGALL
G CLS^DGPTF2
;
O I '$D(^DGP(45.84,PTF,0)) S DR="6///0",DIE="^DGPT(",DA=PTF,(DGST,DGN)=0 D ^DIE W !," NOT CLOSED " D HANG^DGPTUTL G EN1
S (DGST,DGN)=0
S DGPTIFN=PTF,DGRTY=1 D OPEN^DGPTFDEL S DGST=0
K DGPTIFN,DGRTY G EN1
;
Q G Q^DGPTF
;
NOT I 'DGFC S DR="3//^S X=$P($$SITE^VASITE,U,2);5",DIE="^DGPT(",DA=PTF D ^DIE S DGFC=$P(^DGPT(PTF,0),U,3) I DGFC G EN1
W !!,"Unable to close without a ",$S('$D(DRG):"DRG being calculated.",'DGDD:" discharge date.",1:" facility specified"),!!,*7,*7 H 4 G EN1
Q
;
Z D Z^DGPTF5 Q
Z1 D Z1^DGPTF5 Q
CEN D CEN^DGPTF5 Q
DSP S J=$$ICDDX^ICDCODE(+$P(K,U,I),DGPTDAT) I J&$P(J,U,10) D
.I I#2 W ?40,$P(J,U,4)_"("_$P(J,U,2)_")" Q
.W !,$P(J,U,4)_"("_$P(J,U,2)_")"
Q
DGPTF4 ;ALB/JDS - PTF ENTRY/EDIT-4 ; 2/19/04 9:33am
+1 ;;5.3;PIMS;**114,115,397,510,517,478,683,1015,1016**;JUN 30, 2012;Build 20
+2 ;
WR ;
+1 WRITE @IOF,HEAD,?72
SET Z="<701>"
DO Z^DGPTFM
KILL X
SET $PIECE(X,"-",81)=""
WRITE !,X
+2 QUIT
EN SET Y=+B(70)
DO D^DGPTUTL
WRITE !
SET Z=5
DO Z
WRITE $SELECT($PIECE(B(0),U,11)=1:"Date of Disch: ",1:"Census Date : ")
SET Z=Y
SET Z1=20
DO Z1
WRITE "Disch Specialty: ",$SELECT($DATA(^DIC(42.4,+$PIECE(B(70),U,2),0)):$EXTRACT($PIECE(^(0),U,1),1,25),1:"")
+1 WRITE !," Type of Disch: "
SET L=";"_$PIECE(^DD(45,72,0),U,3)
SET L1=";"_$PIECE(B(70),U,3)_":"
WRITE $PIECE($PIECE(L,L1,2),";",1),?41
SET L=";"_$PIECE(^DD(45,72.1,0),U,3)
SET L1=";"_$PIECE(B(70),U,14)_":"
WRITE "Disch Status: ",$PIECE($PIECE(L,L1,2),";",1)
+2 WRITE !," Place of Disp: ",$SELECT($DATA(^DIC(45.6,+$PIECE(B(70),U,6),0)):$EXTRACT($PIECE(^(0),U,1),1,21),1:"")
+3 WRITE ?40
SET Z=6
DO Z
WRITE " Out Treat: ",$PIECE("YES^^NO",U,+$PIECE(B(70),U,4))
+4 WRITE !?6,"Means Test: "
SET L=";"_$PIECE(^DD(45,10,0),U,3)
SET L1=";"_$PIECE(B(0),U,10)_":"
WRITE $PIECE($PIECE(L,L1,2),";",1)
+5 WRITE ?42,"VA Auspices: ",$SELECT($PIECE(B(70),U,5)=1:"YES",$PIECE(B(70),U,5)=2:"NO",1:"")
+6 WRITE !
SET Z=7
DO Z
WRITE " Receiv facil: "
SET Z=$PIECE(B(70),U,12)_$PIECE(B(70),U,13)
SET Z1=18
DO Z1
WRITE ?38
SET Z="Other Fields"
DO Z
+7 SET DGINC=$PIECE(B(101),U,7)
+8 IF DGINC>1000
SET DGINC=$EXTRACT(DGINC,1,$LENGTH(DGINC)-3)_","_$EXTRACT(DGINC,$LENGTH(DGINC)-2,$LENGTH(DGINC))
+9 WRITE !," C&P Status: "
SET L=";"_$PIECE(^DD(45,78,0),U,3)
SET L1=";"_$PIECE(B(70),U,9)_":"
WRITE $EXTRACT($PIECE($PIECE(L,L1,2),";",1),1,24),?47,"Income: $",DGINC
+10 KILL DGINC
AS ;
+1 NEW DGRSC
+2 SET DGRSC=$SELECT($PIECE(A(.3),U)="Y":$$RTEN^DGPTR4($PIECE(A(.3),U,2)),1:"")
+3 WRITE !," ASIH Days: ",$PIECE(B(70),U,8)
+4 WRITE ?40,"SC Percentage: ",$SELECT($PIECE(A(.3),U)="Y":$PIECE(A(.3),U,2)_"%",1:"")
+5 IF DGRSC]""
IF DGRSC'=$PIECE(A(.3),U,2)
WRITE ?60,"Transmitted: ["_DGRSC_"%]"
+6 ;W !,?39,"Period O">Of Serv: ",$S($D(^DIC(21,$S('$D(^DGPM(+$O">O(^DGPM("APTF",PTF,0)),"O">ODS")):+$P(A(.32),U,3),+^("O">ODS"):+$O">O(^DIC(21,"D",6,0)),1:+$P(A(.32),U,3)),0)):$E($P(^(0),U),1,26),1:""),!
+7 WRITE !,?39,"Period Of Serv: "
+8 WRITE $SELECT($DATA(^DIC(21,$SELECT('$DATA(^DGPM(+$ORDER(^DGPM("APTF",PTF,0)),"ODS")):+$$CKPOS^DGPTUTL($PIECE(B(101),U,8),+...
... $PIECE(A(.32),U,3)),+^("ODS"):+$ORDER(^DIC(21,"D",6,0)),1:$$CKPOS^DGPTUTL($PIECE(B(101),U,8),+$PIECE(A(.32),U,3))),0)):$EXTRACT($PIECE(^(0),U),1,26),1:""),!
+9 QUIT
+10 ;
EN1 ;LOAD AND DISPLAY DIAGNOSES FOR PTF 701 SCREEN
+1 KILL DRG
SET B(70)=$SELECT($DATA(^DGPT(PTF,70)):^(70),1:"")
SET B(71)=$SELECT($DATA(^DGPT(PTF,71)):^(71),1:"")
DO WR
+2 ;Get correct effective date
SET DGPTDAT=$$GETDATE^ICDGTDRG(PTF)
+3 SET DGPTTMP=$$ICDDX^ICDCODE(+$PIECE(B(70),U,10),DGPTDAT)
+4 WRITE !
SET Z=1
DO Z
WRITE " Principal Diagnosis: ",$SELECT(DGPTTMP&$PIECE(DGPTTMP,U,10):$PIECE(DGPTTMP,U,4)_"("_$PIECE(DGPTTMP,U,2)_")",1:"")
+5 SET DGPTTMP=$$ICDDX^ICDCODE(+$PIECE(B(70),U,11),DGPTDAT)
+6 IF $PIECE(B(70),U,11)&('$PIECE(B(70),U,10))
WRITE !," Principal Diag: ",$SELECT(DGPTTMP&$PIECE(DGPTTMP,U,10):$PIECE(DGPTTMP,U,4)_" ("_$PIECE(DGPTTMP,U,2)_")",1:"")
+7 SET K=B(70)
FOR I=16:1:24
DO DSP
+8 SET K=B(71)
FOR I=1:1:4
DO DSP
+9 SET DGPTF=PTF
IF 'DGST
DO CHK701^DGPTSCAN
DO UP701^DGPTSPQ
+10 ; display contents of 300th node
+11 SET DG300=$SELECT($DATA(^DGPT(PTF,300)):^(300),1:"")
IF DG300]""
DO PRN2^DGPTFM8
KILL DG300
EN2 KILL DRG
+1 IF $DATA(^DGPT(PTF,0))
IF $PIECE(^(0),U,11)=1
Begin DoDot:1
+2 SET DA=DFN
+3 DO EN1^DGPTFD
+4 IF $DATA(DRG)
IF $DATA(^DGP(45.84,PTF,0))
IF $PIECE(^(0),U,6)'=DRG
Begin DoDot:2
+5 NEW DGFDA,DGMSG
+6 SET DGFDA(45.84,PTF_",",6)=DRG
+7 DO FILE^DIE("","DGFDA","DGMSG")
End DoDot:2
End DoDot:1
JUMP KILL AGE,B,CC,DA,DAM,DOB,DXLS,EXP,I,L1,L2,SEX,DRGCAL,S,DIC,DR,DIE
+1 IF DGPR
QUIT
+2 ;F I=$Y:1:18 W !
+3 KILL X
SET $PIECE(X,"-",81)=""
WRITE X
+4 ;
+5 IF DGST&(('$DATA(DRG))!('DGDD)!('$DATA(^DGP(45.84,PTF))))
GOTO O
X GOTO ACT^DGPTF41
CLS IF ('$DATA(DRG))!('DGDD)!('DGFC)
GOTO NOT
+1 ;I DRG=470!(DRG=469) W !!,*7,"Unable to release DRG ",DRG,". Please verify data entered.",*7 D HANG^DGPTUTL G EN1
+2 ;
+3 ;change made to allow release of 470, before grouper released to vamc's
+4 ; patch 115
+5 ;DGDAT = effective date of DRG used in DGPTICD (468=CMS-DRG,998=MS-DRG)
+6 IF DRG=469
IF (+$GET(DGDAT)<3071001)
WRITE !!,*7,"Unable to release DRG ",DRG,". Please verify data entered.",*7
DO HANG^DGPTUTL
GOTO EN1
+7 IF DRG=998
WRITE !!,*7,"Unable to release DRG ",DRG,". Please verify data entered.",*7
DO HANG^DGPTUTL
GOTO EN1
+8 IF $DATA(DGCST)
IF 'DGCST
DO CEN
IF 'DGCST
GOTO EN1
+9 IF '$PIECE(^DGPT(PTF,0),"^",4)
WRITE !,"Updating TRANSFER DRGs..."
SET DGADM=$PIECE(^DGPT(PTF,0),U,2)
DO SUDO1^DGPTSUDO
+10 IF DGDD>(DT+1)
WRITE !,"Cannot close with Discharge date in future."
DO HANG^DGPTUTL
GOTO EN1
+11 IF $DATA(^DGM("PT",DFN))
FOR I=0:0
SET I=$ORDER(^DGM("PT",DFN,I))
IF 'I
QUIT
IF '$DATA(^DGM(I,0))
KILL ^DGM(I),^DGM("PT",DFN,I)
+12 IF $DATA(^DGM("PT",DFN))
WRITE !!,"Not all messages have been cleared up for this patient--cannot close.",*7,*7
SET DGPTF=DFN
SET X="??"
KILL DGALL
DO HELP^DGPTMSGD
KILL DGPTF
IF '$DATA(DGALL)
GOTO EN1
KILL DGALL
+13 GOTO CLS^DGPTF2
+14 ;
O IF '$DATA(^DGP(45.84,PTF,0))
SET DR="6///0"
SET DIE="^DGPT("
SET DA=PTF
SET (DGST,DGN)=0
DO ^DIE
WRITE !," NOT CLOSED "
DO HANG^DGPTUTL
GOTO EN1
+1 SET (DGST,DGN)=0
+2 SET DGPTIFN=PTF
SET DGRTY=1
DO OPEN^DGPTFDEL
SET DGST=0
+3 KILL DGPTIFN,DGRTY
GOTO EN1
+4 ;
Q GOTO Q^DGPTF
+1 ;
NOT IF 'DGFC
SET DR="3//^S X=$P($$SITE^VASITE,U,2);5"
SET DIE="^DGPT("
SET DA=PTF
DO ^DIE
SET DGFC=$PIECE(^DGPT(PTF,0),U,3)
IF DGFC
GOTO EN1
+1 WRITE !!,"Unable to close without a ",$SELECT('$DATA(DRG):"DRG being calculated.",'DGDD:" discharge date.",1:" facility specified"),!!,*7,*7
HANG 4
GOTO EN1
+2 QUIT
+3 ;
Z DO Z^DGPTF5
QUIT
Z1 DO Z1^DGPTF5
QUIT
CEN DO CEN^DGPTF5
QUIT
DSP SET J=$$ICDDX^ICDCODE(+$PIECE(K,U,I),DGPTDAT)
IF J&$PIECE(J,U,10)
Begin DoDot:1
+1 IF I#2
WRITE ?40,$PIECE(J,U,4)_"("_$PIECE(J,U,2)_")"
QUIT
+2 WRITE !,$PIECE(J,U,4)_"("_$PIECE(J,U,2)_")"
End DoDot:1
+3 QUIT