DGOIL1 ;ALB/AAS - INPATIENT LIST (CONT.) ; 28-SEPT-90
;;5.3;Registration;**162,498,1015**;Aug 13, 1993;Build 21
;
PRINT ; -- print line for one entry
I IOSL<($Y+6) D HDR^DGOIL Q:$D(DUOUT)
N I,J,K D INP^VADPT,PID^VADPT
I $D(^DGPM(DGPM,0)),$P(^(0),"^",3)'=DFN W !!,"BAD 'CN' CROSS REFERENCE FOR WARD ",W,", PATIENT NUMBER",DFN,!! Q
S DGPMIFN=DGPM D ^DGOIL2 S X=X3,DGL=+X3
W !,$P(X,"^",10),$P(X,"^",9),$E(N,1,17),?19,VA("BID")
D PRINT2:DGBRK,PRINT1:'DGBRK
D END
Q
;
PRINT2 ; -- Print with ward breakout, if DGDRG add DRG data
I '$O(X(0)) D PRINT1 Q
F M=0:0 S M=$O(X(M)) Q:'M S X=X(M),Y=$P(X,"^",7),W1=W,W=$P(X,"^",8) D PRINT1 S W=W1 W:$O(X(M)) !
I $O(X(1)) S X=X3 W !?41,"TOTAL" D NUM
I DGDRG D DRG
D BED
Q
;
PRINT1 ; -- Print without ward breakout
S Y=$P(X,"^",7) I Y S Y=$$FMTE^XLFDT(Y,"5DF"),Y=$TR(Y," ","0")
W ?27,Y,?38,$E(W,1,10)
NUM W ?49 F L=1:1:5 W $J(+$P(X,"^",L),5)
D:'DGBRK BED
Q
;
DRG ; - calculate DRG from PTF and print on total line
S PTF=$S($D(^DGPM(DGPM,0)):$P(^(0),U,16),1:"") Q:PTF'>0
S (DRG,DRGCAL)="",AGE=$P(^DPT(DFN,0),U,3),SEX=$P(^(0),U,2),DGCPT=1 D EN1^DGPTFD K DGCPT I DRG="" W ?76,"No DRG can be calculated" Q
S DRGCAL=$S($D(^ICD(DRG,0)):^(0),1:"") W ?76,DRG,?83,$J($P(DRGCAL,"^",8),3,1),?88,$J($P(DRGCAL,"^",$S('AFFIL:7,AFFIL=2:11,1:2)),3,1),?96,$P(DRGCAL,U,3),"/",$P(DRGCAL,"^",4),?104,$P(DRGCAL,"^",9),"/",$P(DRGCAL,"^",10)
S NTT=$P(DRGCAL,U,4)-DGL,LTT=$P(DRGCAL,U,10)-DGL,PNT=$S($P(DRGCAL,U,4)>0:DGL/$P(DRGCAL,U,4)*100\1,1:"*"),PLT=$S($P(DRGCAL,U,10)>0:DGL/$P(DRGCAL,U,10)*100\1,1:"*")
S FLG=$S($P(DRGCAL,U,10)&(LTT<0)!(('$P(DRGCAL,U,10))&(NTT<0)):"####",$S(+PLT=0:PNT,1:PLT)>69:"**",$S(+PLT=0:PNT,1:PLT)>49:"@",1:"") S:LTT<0 LTT=0 S:NTT<0 NTT=0
W ?112,NTT,"/",LTT,?120,PNT,"/",PLT,?128,FLG
;I DGL'=+XW W !,?48,$J("("_DGL_")",7)
Q
;
END K AGE,SEX,NTT,LTT,PLT,PLN,VA,W1,VAERR,PTF,DGL,DRG,DRGCAL,PNT,FLG
Q
% D %^DGOIL
Q
;
EN1 ;
; - tasked entry , no ward breakout
;
S DGBEG="",DGEND="ZZZZZZZ",DGWARD=1,DGBRK=0,DGDRG=0 G DQ^DGOIL
Q
;
EN2 ;
; - tasked entry, with ward breakout, no drg
;
S DGBEG="",DGEND="ZZZZZZZ",DGWRD=1,DGBRK=1,DGDRG=0 G DQ^DGOIL
Q
;
EN3 ;
; - tasked entry, with ward breakout, with drg info
;
S DGBEG="",DGEND="ZZZZZZZ",DGWRD=1,DGBRK=1,DGDRG=1 G DQ^DGOIL
Q
BED ; -- Print room and treating specialty
W !?38,"Rm: ",VAIN(5),?55,"Spec: ",$E($P(VAIN(3),"^",2),1,19)
Q
DGOIL1 ;ALB/AAS - INPATIENT LIST (CONT.) ; 28-SEPT-90
+1 ;;5.3;Registration;**162,498,1015**;Aug 13, 1993;Build 21
+2 ;
PRINT ; -- print line for one entry
+1 IF IOSL<($Y+6)
DO HDR^DGOIL
IF $DATA(DUOUT)
QUIT
+2 NEW I,J,K
DO INP^VADPT
DO PID^VADPT
+3 IF $DATA(^DGPM(DGPM,0))
IF $PIECE(^(0),"^",3)'=DFN
WRITE !!,"BAD 'CN' CROSS REFERENCE FOR WARD ",W,", PATIENT NUMBER",DFN,!!
QUIT
+4 SET DGPMIFN=DGPM
DO ^DGOIL2
SET X=X3
SET DGL=+X3
+5 WRITE !,$PIECE(X,"^",10),$PIECE(X,"^",9),$EXTRACT(N,1,17),?19,VA("BID")
+6 IF DGBRK
DO PRINT2
IF 'DGBRK
DO PRINT1
+7 DO END
+8 QUIT
+9 ;
PRINT2 ; -- Print with ward breakout, if DGDRG add DRG data
+1 IF '$ORDER(X(0))
DO PRINT1
QUIT
+2 FOR M=0:0
SET M=$ORDER(X(M))
IF 'M
QUIT
SET X=X(M)
SET Y=$PIECE(X,"^",7)
SET W1=W
SET W=$PIECE(X,"^",8)
DO PRINT1
SET W=W1
IF $ORDER(X(M))
WRITE !
+3 IF $ORDER(X(1))
SET X=X3
WRITE !?41,"TOTAL"
DO NUM
+4 IF DGDRG
DO DRG
+5 DO BED
+6 QUIT
+7 ;
PRINT1 ; -- Print without ward breakout
+1 SET Y=$PIECE(X,"^",7)
IF Y
SET Y=$$FMTE^XLFDT(Y,"5DF")
SET Y=$TRANSLATE(Y," ","0")
+2 WRITE ?27,Y,?38,$EXTRACT(W,1,10)
NUM WRITE ?49
FOR L=1:1:5
WRITE $JUSTIFY(+$PIECE(X,"^",L),5)
+1 IF 'DGBRK
DO BED
+2 QUIT
+3 ;
DRG ; - calculate DRG from PTF and print on total line
+1 SET PTF=$SELECT($DATA(^DGPM(DGPM,0)):$PIECE(^(0),U,16),1:"")
IF PTF'>0
QUIT
+2 SET (DRG,DRGCAL)=""
SET AGE=$PIECE(^DPT(DFN,0),U,3)
SET SEX=$PIECE(^(0),U,2)
SET DGCPT=1
DO EN1^DGPTFD
KILL DGCPT
IF DRG=""
WRITE ?76,"No DRG can be calculated"
QUIT
+3 SET DRGCAL=$SELECT($DATA(^ICD(DRG,0)):^(0),1:"")
WRITE ?76,DRG,?83,$JUSTIFY($PIECE(DRGCAL,"^",8),3,1),?88,$JUSTIFY($PIECE(DRGCAL,"^",$SELECT('AFFIL:7,AFFIL=2:11,1:2)),3,1),?96,$PIECE(DRGCAL,U,3),"/",$PIECE(DRGCAL,"^",4),?104,$PIECE(DRGCAL,"^",9),"/",$PIECE(DRGCAL,"^",10)
+4 SET NTT=$PIECE(DRGCAL,U,4)-DGL
SET LTT=$PIECE(DRGCAL,U,10)-DGL
SET PNT=$SELECT($PIECE(DRGCAL,U,4)>0:DGL/$PIECE(DRGCAL,U,4)*100\1,1:"*")
SET PLT=$SELECT($PIECE(DRGCAL,U,10)>0:DGL/$PIECE(DRGCAL,U,10)*100\1,1:"*")
+5 SET FLG=$SELECT($PIECE(DRGCAL,U,10)&(LTT<0)!(('$PIECE(DRGCAL,U,10))&(NTT<0)):"####",$SELECT(+PLT=0:PNT,1:PLT)>69:"**",$SELECT(+PLT=0:PNT,1:PLT)>49:"@",1:"")
IF LTT<0
SET LTT=0
IF NTT<0
SET NTT=0
+6 WRITE ?112,NTT,"/",LTT,?120,PNT,"/",PLT,?128,FLG
+7 ;I DGL'=+XW W !,?48,$J("("_DGL_")",7)
+8 QUIT
+9 ;
END KILL AGE,SEX,NTT,LTT,PLT,PLN,VA,W1,VAERR,PTF,DGL,DRG,DRGCAL,PNT,FLG
+1 QUIT
% DO %^DGOIL
+1 QUIT
+2 ;
EN1 ;
+1 ; - tasked entry , no ward breakout
+2 ;
+3 SET DGBEG=""
SET DGEND="ZZZZZZZ"
SET DGWARD=1
SET DGBRK=0
SET DGDRG=0
GOTO DQ^DGOIL
+4 QUIT
+5 ;
EN2 ;
+1 ; - tasked entry, with ward breakout, no drg
+2 ;
+3 SET DGBEG=""
SET DGEND="ZZZZZZZ"
SET DGWRD=1
SET DGBRK=1
SET DGDRG=0
GOTO DQ^DGOIL
+4 QUIT
+5 ;
EN3 ;
+1 ; - tasked entry, with ward breakout, with drg info
+2 ;
+3 SET DGBEG=""
SET DGEND="ZZZZZZZ"
SET DGWRD=1
SET DGBRK=1
SET DGDRG=1
GOTO DQ^DGOIL
+4 QUIT
BED ; -- Print room and treating specialty
+1 WRITE !?38,"Rm: ",VAIN(5),?55,"Spec: ",$EXTRACT($PIECE(VAIN(3),"^",2),1,19)
+2 QUIT