DGJPDEF2 ;ALB/MAF - PHYSICIAN DEFICIENCY PRINT ROUTINE (CONT) ; NOV 10 1992@300
;;5.3;Registration;**163,1015**;Aug 13, 1993;Build 21
;;MAS VERSION 5.2;
D HEAD F DGJ=0:0 S DGJTDV=$O(^TMP("VAS",$J,DGJTDV)) Q:DGJTDV']""!(DGU) S DGJTF=1 D @(DGJTL) Q:DGU
G:DGU QUIT I DGJTLPG'=1,$D(^TMP("VAS",$J)) D RET G:DGU QUIT D ^DGJPDEF3
F X=$Y:1:(IOSL-3) W !
D DIV
QUIT G QUIT^DGJPDEF
F X=$Y:1:(IOSL-3) W ! D DIV
HD1 W ?88,$J($P(DGJTDL,"^",2),7)
W ?97,$J($P(DGJTDL,"^",3),7)
W ?106,$J($P(DGJTDL,"^",4),7)
W ?116 S X=$P(DGJTDL,"^",2)+$P(DGJTDL,"^",3)+$P(DGJTDL,"^",4)+$P(DGJTDL,"^",1) W $J(X,7)
W ?128 S X=$S(X-30'>0:0,1:X-30) W $J(X,4)
Q
SET S DGJTDV1=DGJTDV,DFN=DGJTDL Q
DIV S X=$O(^DG(40.8,"B",DGJTDV1,0)) I $D(^DG(40.8,+X,"DT")) S DGJTDEL=^("DT") W $P(DGJTDEL,"^",9),! Q
Q
DATE S DGJTX=$$FMTE^XLFDT(DGJTDT,"5DF"),DGJTX=$TR(DGJTX," ","0") W DGJTX K DGJTX Q
DATE1 S X=$$FMTE^XLFDT(X,"5DF"),X=$TR(X," ","0") W X Q
PHY D:'DGJTFF HDR
F DGJY=0:0 S DGJTPHY=$O(^TMP("VAS",$J,DGJTDV,DGJTPHY)) Q:DGJTPHY']""!(DGU) D:DGJTFF RET Q:DGU D:DGJTFF HEAD,HDR D HDR1 S DGJTFF=1 F DGJJ=0:0 S DGJTPT=$O(^TMP("VAS",$J,DGJTDV,DGJTPHY,DGJTPT)) Q:DGJTPT']""!(DGU) D PHY1 Q:DGU
Q
PHY1 F DGJADM=-1:0 S DGJADM=$O(^TMP("VAS",$J,DGJTDV,DGJTPHY,DGJTPT,DGJADM)) Q:DGJADM']""!(DGU) F IFN=0:0 S IFN=$O(^TMP("VAS",$J,DGJTDV,DGJTPHY,DGJTPT,DGJADM,IFN)) Q:'IFN!(DGU) S DGJTDL=^(IFN) D SET I $D(^VAS(393,IFN,0)) D PRT2 Q:DGU
Q
SER D:'DGJTFF HDR
F DGJY=0:0 S DGJTSV=$O(^TMP("VAS",$J,DGJTDV,DGJTSV)) Q:DGJTSV']""!(DGU) D:DGJTFF RET Q:DGU D:DGJTFF HEAD,HDR D HDR2 S DGJTFF=1 F DGJJ=0:0 S DGJTSP=$O(^TMP("VAS",$J,DGJTDV,DGJTSV,DGJTSP)) Q:DGJTSP']""!(DGU) D HDR3,SER1 Q:DGU
Q
PAT D:'DGJTFF HDR
F DGJY=0:0 S DGJTPT=$O(^TMP("VAS",$J,DGJTDV,DGJTPT)) Q:DGJTPT']""!(DGU) D:DGJTFF RET Q:DGU D:DGJTFF HEAD,HDR D HDR4 S DGJTFF=1 F DGJADM=-1:0 S DGJADM=$O(^TMP("VAS",$J,DGJTDV,DGJTPT,DGJADM)) Q:DGJADM']""!(DGU) D PAT1 Q:DGU
Q
PAT1 F DGJJ=0:0 S DGJTPHY=$O(^TMP("VAS",$J,DGJTDV,DGJTPT,DGJADM,DGJTPHY)) Q:DGJTPHY']""!(DGU) F IFN=0:0 S IFN=$O(^TMP("VAS",$J,DGJTDV,DGJTPT,DGJADM,DGJTPHY,IFN)) Q:'IFN!(DGU) S DGJTDL=^(IFN) D SET I $D(^VAS(393,IFN,0)) D PRT2 Q:DGU
Q
SER1 F DGJP=0:0 S DGJTPT=$O(^TMP("VAS",$J,DGJTDV,DGJTSV,DGJTSP,DGJTPT)) Q:DGJTPT']""!(DGU) D SER2
Q
SER2 F DFN=0:0 S DFN=$O(^TMP("VAS",$J,DGJTDV,DGJTSV,DGJTSP,DGJTPT,DFN)) Q:'DFN!(DGU) F IFN=0:0 S IFN=$O(^TMP("VAS",$J,DGJTDV,DGJTSV,DGJTSP,DGJTPT,DFN,IFN)) Q:'IFN!(DGU) S DGJTDL=^(IFN) D SET I $D(^VAS(393,IFN,0)) D PRT2 Q:DGU
Q
PRT2 D RELP Q:DGU S DGJTNODE=^VAS(393,IFN,0)
I DGJTL="PAT" S X="",X=$S($P(DGJTPHY,"^",2)]"":$E($P($G(^VA(200,$P(DGJTPHY,"^",2),0)),"^",1),1,20),1:"NOT SPECIFIED") W !,$S(X]"":X,1:"NOT SPECIFIED")
I DGJTL="PHY" W !,$E($P(^DPT($P(DGJTPT,"^",2),0),"^",1),1,20)
I DGJTL="SER" W !,$E($P(^DPT($P(DGJTPT,"^",2),0),"^",1),1,16)
D PID^VADPT6 W:DGJTL="SER" ?19 W:DGJTL'="SER" ?23 W VA("BID")
S DGJTDT=$S($D(^DGPM(+$P(DGJTNODE,"^",4),0)):$P(^DGPM(+$P(DGJTNODE,"^",4),0),"^",1),1:"OUTPATIENT") W:DGJTL="SER" ?27 W:DGJTL'="SER" ?31 D:DGJTDT]""&(DGJTDT'="OUTPATIENT") DATE I DGJTDT="OUTPATIENT" W DGJTDT
W:DGJTL="SER" ?40 W:DGJTL'="SER" ?44 S X=$P(^VAS(393,IFN,0),"^",2) W $S($D(^VAS(393.3,+X,0)):$E($P(^VAS(393.3,+X,0),"^",1),1,10),1:"NOT SPECIF")
S X=$P(^VAS(393,IFN,0),"^",12),X=$S(X]""&($D(^VA(200,+X,0))):$P(^VA(200,X,0),"^",1),1:"NOT SPECIFIED") W:DGJTL="SER" ?57,$E(X,1,10)
S X=IFN I X]"",$D(^VAS(393,+X,0)) S X=$P(^VAS(393,+X,0),"^",3) W ?70 S X=$$FMTE^XLFDT(X,"5DF") S:X]"" X=$TR(X," ","0") W X
W ?82 S X=$P(DGJTNODE,"^",11) W $S($D(^DG(393.2,+X,0)):$E($P(^DG(393.2,X,0),"^",1),1,10),1:"")
S DFN=$P(DGJTNODE,"^",1) S RTE=DFN_";DPT(",RTYPE=1 D LATEST^RTUTL3
W ?95,$E($P(RTDATA,"^",2),1,10),?107,$E($P(RTDATA,"^",3),1,10),?121 S X="" S X=$P(RTDATA,"^",4) D:RTDATA]"" DATE1 Q
HEAD D HEAD^DGJPDEF3 Q
RET F X=$Y:1:(IOSL-3) W !
D DIV Q:IOST'?1"C-".E
R ?22,"Enter <RET> to continue or ^ to QUIT ",X:DTIME S:X["^"!('$T) DGU=1 Q:DGU S DGFLAG=1 Q
RELP I $Y+8>IOSL D RET:(IOST?1"C-".E) Q:DGU D HEAD
Q
HDR W !?5,"DIVISION: ",$S($D(^DG(40.8,+$P(DGJTDV,"^",2),0)):$P(^DG(40.8,$P(DGJTDV,"^",2),0),"^",1),1:"NOT SPECIFIED") Q
HDR1 W !?6,"PHYSICIAN: ",$S($P(DGJTPHY,"^",2)]"":$P(^VA(200,$P(DGJTPHY,"^",2),0),"^",1),1:"NOT SPECIFIED") Q
HDR2 W !?6,"SERVICE: ",$S($P(DGJTSV,"^",2)]"":$P(^DG(393.1,$P(DGJTSV,"^",2),0),"^",1),1:"NOT SPECIFIED") Q
HDR3 W !?7,"SPECIALTY: ",$S($P(DGJTSP,"^",2)]"":$P(^DIC(45.7,$P(DGJTSP,"^",2),0),"^",1),1:"NOT SPECIFIED") Q
HDR4 W !?6,"PATIENT: ",$P(^DPT($P(DGJTPT,"^",2),0),"^",1) Q
SV D SV^DGJPDEF3 Q
DGJPDEF2 ;ALB/MAF - PHYSICIAN DEFICIENCY PRINT ROUTINE (CONT) ; NOV 10 1992@300
+1 ;;5.3;Registration;**163,1015**;Aug 13, 1993;Build 21
+2 ;;MAS VERSION 5.2;
+3 DO HEAD
FOR DGJ=0:0
SET DGJTDV=$ORDER(^TMP("VAS",$JOB,DGJTDV))
IF DGJTDV']""!(DGU)
QUIT
SET DGJTF=1
DO @(DGJTL)
IF DGU
QUIT
+4 IF DGU
GOTO QUIT
IF DGJTLPG'=1
IF $DATA(^TMP("VAS",$JOB))
DO RET
IF DGU
GOTO QUIT
DO ^DGJPDEF3
+5 FOR X=$Y:1:(IOSL-3)
WRITE !
+6 DO DIV
QUIT GOTO QUIT^DGJPDEF
+1 FOR X=$Y:1:(IOSL-3)
WRITE !
DO DIV
HD1 WRITE ?88,$JUSTIFY($PIECE(DGJTDL,"^",2),7)
+1 WRITE ?97,$JUSTIFY($PIECE(DGJTDL,"^",3),7)
+2 WRITE ?106,$JUSTIFY($PIECE(DGJTDL,"^",4),7)
+3 WRITE ?116
SET X=$PIECE(DGJTDL,"^",2)+$PIECE(DGJTDL,"^",3)+$PIECE(DGJTDL,"^",4)+$PIECE(DGJTDL,"^",1)
WRITE $JUSTIFY(X,7)
+4 WRITE ?128
SET X=$SELECT(X-30'>0:0,1:X-30)
WRITE $JUSTIFY(X,4)
+5 QUIT
SET SET DGJTDV1=DGJTDV
SET DFN=DGJTDL
QUIT
DIV SET X=$ORDER(^DG(40.8,"B",DGJTDV1,0))
IF $DATA(^DG(40.8,+X,"DT"))
SET DGJTDEL=^("DT")
WRITE $PIECE(DGJTDEL,"^",9),!
QUIT
+1 QUIT
DATE SET DGJTX=$$FMTE^XLFDT(DGJTDT,"5DF")
SET DGJTX=$TRANSLATE(DGJTX," ","0")
WRITE DGJTX
KILL DGJTX
QUIT
DATE1 SET X=$$FMTE^XLFDT(X,"5DF")
SET X=$TRANSLATE(X," ","0")
WRITE X
QUIT
PHY IF 'DGJTFF
DO HDR
+1 FOR DGJY=0:0
SET DGJTPHY=$ORDER(^TMP("VAS",$JOB,DGJTDV,DGJTPHY))
IF DGJTPHY']""!(DGU)
QUIT
IF DGJTFF
DO RET
IF DGU
QUIT
IF DGJTFF
DO HEAD
DO HDR
DO HDR1
SET DGJTFF=1
FOR DGJJ=0:0
SET DGJTPT=$ORDER(^TMP("VAS",$JOB,DGJTDV,DGJTPHY,DGJTPT))
IF DGJTPT']""!(DGU)
QUIT
DO PHY1
IF DGU
QUIT
+2 QUIT
PHY1 FOR DGJADM=-1:0
SET DGJADM=$ORDER(^TMP("VAS",$JOB,DGJTDV,DGJTPHY,DGJTPT,DGJADM))
IF DGJADM']""!(DGU)
QUIT
FOR IFN=0:0
SET IFN=$ORDER(^TMP("VAS",$JOB,DGJTDV,DGJTPHY,DGJTPT,DGJADM,IFN))
IF 'IFN!(DGU)
QUIT
SET DGJTDL=^(IFN)
DO SET
IF $DATA(^VAS(393,IFN,0))
DO PRT2
IF DGU
QUIT
+1 QUIT
SER IF 'DGJTFF
DO HDR
+1 FOR DGJY=0:0
SET DGJTSV=$ORDER(^TMP("VAS",$JOB,DGJTDV,DGJTSV))
IF DGJTSV']""!(DGU)
QUIT
IF DGJTFF
DO RET
IF DGU
QUIT
IF DGJTFF
DO HEAD
DO HDR
DO HDR2
SET DGJTFF=1
FOR DGJJ=0:0
SET DGJTSP=$ORDER(^TMP("VAS",$JOB,DGJTDV,DGJTSV,DGJTSP))
IF DGJTSP']""!(DGU)
QUIT
DO HDR3
DO SER1
IF DGU
QUIT
+2 QUIT
PAT IF 'DGJTFF
DO HDR
+1 FOR DGJY=0:0
SET DGJTPT=$ORDER(^TMP("VAS",$JOB,DGJTDV,DGJTPT))
IF DGJTPT']""!(DGU)
QUIT
IF DGJTFF
DO RET
IF DGU
QUIT
IF DGJTFF
DO HEAD
DO HDR
DO HDR4
SET DGJTFF=1
FOR DGJADM=-1:0
SET DGJADM=$ORDER(^TMP("VAS",$JOB,DGJTDV,DGJTPT,DGJADM))
IF DGJADM']""!(DGU)
QUIT
DO PAT1
IF DGU
QUIT
+2 QUIT
PAT1 FOR DGJJ=0:0
SET DGJTPHY=$ORDER(^TMP("VAS",$JOB,DGJTDV,DGJTPT,DGJADM,DGJTPHY))
IF DGJTPHY']""!(DGU)
QUIT
FOR IFN=0:0
SET IFN=$ORDER(^TMP("VAS",$JOB,DGJTDV,DGJTPT,DGJADM,DGJTPHY,IFN))
IF 'IFN!(DGU)
QUIT
SET DGJTDL=^(IFN)
DO SET
IF $DATA(^VAS(393,IFN,0))
DO PRT2
IF DGU
QUIT
+1 QUIT
SER1 FOR DGJP=0:0
SET DGJTPT=$ORDER(^TMP("VAS",$JOB,DGJTDV,DGJTSV,DGJTSP,DGJTPT))
IF DGJTPT']""!(DGU)
QUIT
DO SER2
+1 QUIT
SER2 FOR DFN=0:0
SET DFN=$ORDER(^TMP("VAS",$JOB,DGJTDV,DGJTSV,DGJTSP,DGJTPT,DFN))
IF 'DFN!(DGU)
QUIT
FOR IFN=0:0
SET IFN=$ORDER(^TMP("VAS",$JOB,DGJTDV,DGJTSV,DGJTSP,DGJTPT,DFN,IFN))
IF 'IFN!(DGU)
QUIT
SET DGJTDL=^(IFN)
DO SET
IF $DATA(^VAS(393,IFN,0))
DO PRT2
IF DGU
QUIT
+1 QUIT
PRT2 DO RELP
IF DGU
QUIT
SET DGJTNODE=^VAS(393,IFN,0)
+1 IF DGJTL="PAT"
SET X=""
SET X=$SELECT($PIECE(DGJTPHY,"^",2)]"":$EXTRACT($PIECE($GET(^VA(200,$PIECE(DGJTPHY,"^",2),0)),"^",1),1,20),1:"NOT SPECIFIED")
WRITE !,$SELECT(X]"":X,1:"NOT SPECIFIED")
+2 IF DGJTL="PHY"
WRITE !,$EXTRACT($PIECE(^DPT($PIECE(DGJTPT,"^",2),0),"^",1),1,20)
+3 IF DGJTL="SER"
WRITE !,$EXTRACT($PIECE(^DPT($PIECE(DGJTPT,"^",2),0),"^",1),1,16)
+4 DO PID^VADPT6
IF DGJTL="SER"
WRITE ?19
IF DGJTL'="SER"
WRITE ?23
WRITE VA("BID")
+5 SET DGJTDT=$SELECT($DATA(^DGPM(+$PIECE(DGJTNODE,"^",4),0)):$PIECE(^DGPM(+$PIECE(DGJTNODE,"^",4),0),"^",1),1:"OUTPATIENT")
IF DGJTL="SER"
WRITE ?27
IF DGJTL'="SER"
WRITE ?31
IF DGJTDT]""&(DGJTDT'="OUTPATIENT")
DO DATE
IF DGJTDT="OUTPATIENT"
WRITE DGJTDT
+6 IF DGJTL="SER"
WRITE ?40
IF DGJTL'="SER"
WRITE ?44
SET X=$PIECE(^VAS(393,IFN,0),"^",2)
WRITE $SELECT($DATA(^VAS(393.3,+X,0)):$EXTRACT($PIECE(^VAS(393.3,+X,0),"^",1),1,10),1:"NOT SPECIF")
+7 SET X=$PIECE(^VAS(393,IFN,0),"^",12)
SET X=$SELECT(X]""&($DATA(^VA(200,+X,0))):$PIECE(^VA(200,X,0),"^",1),1:"NOT SPECIFIED")
IF DGJTL="SER"
WRITE ?57,$EXTRACT(X,1,10)
+8 SET X=IFN
IF X]""
IF $DATA(^VAS(393,+X,0))
SET X=$PIECE(^VAS(393,+X,0),"^",3)
WRITE ?70
SET X=$$FMTE^XLFDT(X,"5DF")
IF X]""
SET X=$TRANSLATE(X," ","0")
WRITE X
+9 WRITE ?82
SET X=$PIECE(DGJTNODE,"^",11)
WRITE $SELECT($DATA(^DG(393.2,+X,0)):$EXTRACT($PIECE(^DG(393.2,X,0),"^",1),1,10),1:"")
+10 SET DFN=$PIECE(DGJTNODE,"^",1)
SET RTE=DFN_";DPT("
SET RTYPE=1
DO LATEST^RTUTL3
+11 WRITE ?95,$EXTRACT($PIECE(RTDATA,"^",2),1,10),?107,$EXTRACT($PIECE(RTDATA,"^",3),1,10),?121
SET X=""
SET X=$PIECE(RTDATA,"^",4)
IF RTDATA]""
DO DATE1
QUIT
HEAD DO HEAD^DGJPDEF3
QUIT
RET FOR X=$Y:1:(IOSL-3)
WRITE !
+1 DO DIV
IF IOST'?1"C-".E
QUIT
+2 READ ?22,"Enter <RET> to continue or ^ to QUIT ",X:DTIME
IF X["^"!('$TEST)
SET DGU=1
IF DGU
QUIT
SET DGFLAG=1
QUIT
RELP IF $Y+8>IOSL
IF (IOST?1"C-".E)
DO RET
IF DGU
QUIT
DO HEAD
+1 QUIT
HDR WRITE !?5,"DIVISION: ",$SELECT($DATA(^DG(40.8,+$PIECE(DGJTDV,"^",2),0)):$PIECE(^DG(40.8,$PIECE(DGJTDV,"^",2),0),"^",1),1:"NOT SPECIFIED")
QUIT
HDR1 WRITE !?6,"PHYSICIAN: ",$SELECT($PIECE(DGJTPHY,"^",2)]"":$PIECE(^VA(200,$PIECE(DGJTPHY,"^",2),0),"^",1),1:"NOT SPECIFIED")
QUIT
HDR2 WRITE !?6,"SERVICE: ",$SELECT($PIECE(DGJTSV,"^",2)]"":$PIECE(^DG(393.1,$PIECE(DGJTSV,"^",2),0),"^",1),1:"NOT SPECIFIED")
QUIT
HDR3 WRITE !?7,"SPECIALTY: ",$SELECT($PIECE(DGJTSP,"^",2)]"":$PIECE(^DIC(45.7,$PIECE(DGJTSP,"^",2),0),"^",1),1:"NOT SPECIFIED")
QUIT
HDR4 WRITE !?6,"PATIENT: ",$PIECE(^DPT($PIECE(DGJTPT,"^",2),0),"^",1)
QUIT
SV DO SV^DGJPDEF3
QUIT