ADGFXDS ; cmi/flag/maw - Fix Day Surgery Visits ; [ 06/05/2002 1:14 PM ]
;;5.3;ADMISSION/DISCHARGE/TRANSFER;**1011**;MAR 25, 1999
;
;
;
MAIN ;-- this is the main routine driver
D LOOP
D EOJ
Q
;
LOOP ;-- loop the day surgery file and call visit creator
N ADGDA,ADGIEN,ADGOEN
S ADGDA=3091019 F S ADGDA=$O(^ADGDS("AA",ADGDA)) Q:'ADGDA D
. S ADGIEN=0 F S ADGIEN=$O(^ADGDS("AA",ADGDA,ADGIEN)) Q:'ADGIEN D
.. S ADGOEN=0 F S ADGOEN=$O(^ADGDS("AA",ADGDA,ADGIEN,ADGOEN)) Q:'ADGOEN D
... S DGDFN1=ADGOEN
... S DFN=+$P($G(^ADGDS(ADGIEN,0)),U)
... D PCCVSIT^BDGDSA
... D DSIC
Q
;
DSIC ;***> create incomplete chart entry
;IHS/ITSC/WAR 12/10/03 This section copied from BDGICEVT and modified
;
S (BDGICREC,X)=""
F S X=$O(^BDGIC("B",DFN,X)) Q:X=""!(BDGICREC) D
.;Check IC Disch date/time v.s. DaySurg Release date/time
.Q:'$D(^ADGDS(DFN,"DS",DGDFN1,2))
.I $P(^BDGIC(X,0),U,5)=$P($P(^ADGDS(DFN,"DS",DGDFN1,2),U,1),".") S BDGICREC=X
I +BDGICREC=0 D
.S VST=BDGDSVST
.S SERV=+$P(^ADGDS(DFN,"DS",DGDFN1,0),U,5)
.S SRDATE=DGX
.W !!,"Adding entry in Incomplete Chart file....",! K DIC
.; make FM call to stuff data
.S X=DFN,DIC="^BDGIC(",DLAYGO=9009016.1,DIC(0)="L"
.; 4 slash visit to bypass file screen
.S DIC("DR")=".03////"_VST_";.04///`"_SERV_";.05///"_(SRDATE\1)
.L +^BDGIC(0):3 I '$T D Q
.. Q:$D(DGQUIET)
.. W !,*7,"CANNOT ADD TO INCOMPLETE CHART FILE;"
.. W "BEING UPDATED BY SOMEONE ELSE"
.K DD,DO D FILE^DICN L -^BDGIC(0)
K APCDALVR
Q
;
EOJ ;-- end of job
K DGDFN1,DFN,BDGIREC,VST,SERV,SRDATE
Q
;
ADGFXDS ; cmi/flag/maw - Fix Day Surgery Visits ; [ 06/05/2002 1:14 PM ]
+1 ;;5.3;ADMISSION/DISCHARGE/TRANSFER;**1011**;MAR 25, 1999
+2 ;
+3 ;
+4 ;
MAIN ;-- this is the main routine driver
+1 DO LOOP
+2 DO EOJ
+3 QUIT
+4 ;
LOOP ;-- loop the day surgery file and call visit creator
+1 NEW ADGDA,ADGIEN,ADGOEN
+2 SET ADGDA=3091019
FOR
SET ADGDA=$ORDER(^ADGDS("AA",ADGDA))
IF 'ADGDA
QUIT
Begin DoDot:1
+3 SET ADGIEN=0
FOR
SET ADGIEN=$ORDER(^ADGDS("AA",ADGDA,ADGIEN))
IF 'ADGIEN
QUIT
Begin DoDot:2
+4 SET ADGOEN=0
FOR
SET ADGOEN=$ORDER(^ADGDS("AA",ADGDA,ADGIEN,ADGOEN))
IF 'ADGOEN
QUIT
Begin DoDot:3
+5 SET DGDFN1=ADGOEN
+6 SET DFN=+$PIECE($GET(^ADGDS(ADGIEN,0)),U)
+7 DO PCCVSIT^BDGDSA
+8 DO DSIC
End DoDot:3
End DoDot:2
End DoDot:1
+9 QUIT
+10 ;
DSIC ;***> create incomplete chart entry
+1 ;IHS/ITSC/WAR 12/10/03 This section copied from BDGICEVT and modified
+2 ;
+3 SET (BDGICREC,X)=""
+4 FOR
SET X=$ORDER(^BDGIC("B",DFN,X))
IF X=""!(BDGICREC)
QUIT
Begin DoDot:1
+5 ;Check IC Disch date/time v.s. DaySurg Release date/time
+6 IF '$DATA(^ADGDS(DFN,"DS",DGDFN1,2))
QUIT
+7 IF $PIECE(^BDGIC(X,0),U,5)=$PIECE($PIECE(^ADGDS(DFN,"DS",DGDFN1,2),U,1),".")
SET BDGICREC=X
End DoDot:1
+8 IF +BDGICREC=0
Begin DoDot:1
+9 SET VST=BDGDSVST
+10 SET SERV=+$PIECE(^ADGDS(DFN,"DS",DGDFN1,0),U,5)
+11 SET SRDATE=DGX
+12 WRITE !!,"Adding entry in Incomplete Chart file....",!
KILL DIC
+13 ; make FM call to stuff data
+14 SET X=DFN
SET DIC="^BDGIC("
SET DLAYGO=9009016.1
SET DIC(0)="L"
+15 ; 4 slash visit to bypass file screen
+16 SET DIC("DR")=".03////"_VST_";.04///`"_SERV_";.05///"_(SRDATE\1)
+17 LOCK +^BDGIC(0):3
IF '$TEST
Begin DoDot:2
+18 IF $DATA(DGQUIET)
QUIT
+19 WRITE !,*7,"CANNOT ADD TO INCOMPLETE CHART FILE;"
+20 WRITE "BEING UPDATED BY SOMEONE ELSE"
End DoDot:2
QUIT
+21 KILL DD,DO
DO FILE^DICN
LOCK -^BDGIC(0)
End DoDot:1
+22 KILL APCDALVR
+23 QUIT
+24 ;
EOJ ;-- end of job
+1 KILL DGDFN1,DFN,BDGIREC,VST,SERV,SRDATE
+2 QUIT
+3 ;