SRONOR4 ;B'HAM ISC/MAM - REPORT OF NON-O.R. PROCEDURES ; [ 07/27/98 2:33 PM ]
;;3.0;Surgery;**50,175,182**;24 Jun 93;Build 49
;
; Reference to ^ECC(723 supported by DBIA #205
;
K ^TMP("SR",$J) F S SRSD=$O(^SRF("AC",SRSD)) Q:'SRSD!(SRSD>SRED) S SROP=0 F S SROP=$O(^SRF("AC",SRSD,SROP)) Q:'SROP I $P($G(^SRF(SROP,"NON")),"^")="Y",$D(^SRF(SROP,0)),$$DIV^SROUTL0(SROP) D UTIL
S (SRSOUT,SRHDR,SRSUR)=0 F S SRSUR=$O(^TMP("SR",$J,SRSUR)) Q:SRSUR=""!(SRSOUT) D HDR S SRSD=0 F S SRSD=$O(^TMP("SR",$J,SRSUR,SRSD)) Q:'SRSD!(SRSOUT) D SROP
I '$D(^TMP("SR",$J)) D HDR W !!,"No procedures for the selected date range.",!
Q
SROP N SRANEST,SRANESUP
S SROP=0 F S SROP=$O(^TMP("SR",$J,SRSUR,SRSD,SROP)) Q:'SROP!(SRSOUT) D SET
Q
SET ; set and print info
I $Y+5>IOSL D HDR Q:SRSOUT
S SR=^SRF(SROP,0),DFN=$P(SR,"^") D DEM^VADPT S SRNM=VADM(1),SRSSN=VA("PID")
S X=$P(SR,"^",12),SRINOUT=$S(X="I":"INPATIENT",X="O":"OUTPATIENT",X=1:"OUTPATIENT",X=2:"INPATIENT",X=3:"INPATIENT",1:"???")
S Y=SRSD D DD^%DT S SRSDATE=$E(SRSD,4,5)_"/"_$E(SRSD,6,7)_"/"_$E(SRSD,2,3)_" "_$P(Y,"@",2)
S SRANEST=$P($G(^SRF(SROP,.3)),"^") I SRANEST S SRANEST=$P(^VA(200,SRANEST,0),"^") S:$L(SRANEST)>30 SRANEST=$P(SRANEST,",")_", "_$E($P(SRANEST,",",2))_"."
S SRANESUP=$P($G(^SRF(SROP,.3)),"^",4) I SRANESUP S SRANESUP=$P(^VA(200,SRANESUP,0),"^") S:$L(SRANESUP)>30 SRANESUP=$P(SRANESUP,",")_", "_$E($P(SRANESUP,",",2))_"."
S Y=$P(^SRF(SROP,"NON"),"^",8),SRSS=$S(Y:$P(^ECC(723,Y,0),"^"),1:"SPECIALTY NOT ENTERED")
S Y=$P(^SRF(SROP,"NON"),"^",2),SRLOC=$S(Y:$P(^SC(Y,0),"^"),1:"LOCATION NOT ENTERED")
S SRST=$P($G(^SRF(SROP,"NON")),"^",4) I SRST S Y=SRST D DD^%DT S SRST=$E(SRST,4,5)_"/"_$E(SRST,6,7)_"/"_$E(SRST,2,3)_" "_$P(Y,"@",2)
S SRET=$P($G(^SRF(SROP,"NON")),"^",5) I SRET S Y=SRET D DD^%DT S SRET=$E(SRET,4,5)_"/"_$E(SRET,6,7)_"/"_$E(SRET,2,3)_" "_$P(Y,"@",2)
S SROPER=$P(^SRF(SROP,"OP"),"^"),OPER=0 F S OPER=$O(^SRF(SROP,13,OPER)) Q:'OPER D OTHER
K SROPS,MM,MMM S:$L(SROPER)<50 SROPS(1)=SROPER I $L(SROPER)>49 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
S SRABORT=$S($P($G(^SRF(SROP,30)),"^"):"*ABORTED*",1:"")
W !!,SRSDATE,?15,SRNM_" ("_VA("PID")_")",?64,SRSS,?116,SRST,!,SROP,?15,SRLOC_" ("_SRINOUT_")",?64,SRANEST,?116,SRET
W !,?62,SRANESUP,!,?62,SROPS(1)
W:SRABORT'="" !,SRABORT I $D(SROPS(2)) W:SRABORT="" ! W ?62,SROPS(2) I $D(SROPS(3)) W !,?62,SROPS(3) I $D(SROPS(4)) W !,?62,SROPS(4)
Q
UTIL ; set ^TMP
S Y=$P($G(^SRF(SROP,"NON")),"^",6) S SRSUR=$S(Y:$P(^VA(200,Y,0),"^"),1:"PROVIDER NOT ENTERED")
S ^TMP("SR",$J,SRSUR,SRSD,SROP)=""
Q
HDR I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
I SRHDR,$E(IOST)'="P" W !!,"Press RETURN to continue, or '^' to quit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
W:$Y @IOF W !,?(132-$L(SRINST)\2),SRINST,!,?57,"SURGICAL SERVICE",?100,"REVIEWED BY:",!,?51,"REPORT OF NON-O.R. PROCEDURES",?100,"DATE REVIEWED:",!,?(132-$L(SRFRTO)\2),SRFRTO
W !!,"DATE",?15,"PATIENT (ID#)",?64,"SPECIALTY",?116,"START TIME",!,"CASE #",?15,"LOCATION (IN/OUT-PAT STATUS)",?64,"PRINCIPAL ANESTHETIST",?116,"FINISH TIME"
W !,?62,"ANESTHESIOLOGIST SUPERVISOR",!,?62,"PROCEDURE(S)",! F LINE=1:1:132 W "="
W:SRSUR'="" !,?(124-$L("PROVIDER: "_SRSUR)\2),"*** PROVIDER: "_SRSUR_" ***" S SRHDR=1
Q
OTHER ; other operations
S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SROP,13,OPER,0),"^"))>240 S SRLONG=0,OPER=999,SROPERS=" ..."
I SRLONG S SROPERS=$P(^SRF(SROP,13,OPER,0),"^")
S SROPER=SROPER_$S(SROPERS=" ...":SROPERS,1:", "_SROPERS)
Q
LOOP ; break procedure if greater than 50 characters
S SROPS(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROPS(M))+$L(MM)'<50 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSRONOR4 3698 printed Oct 16, 2024@18:45:03 Page 2
SRONOR4 ;B'HAM ISC/MAM - REPORT OF NON-O.R. PROCEDURES ; [ 07/27/98 2:33 PM ]
+1 ;;3.0;Surgery;**50,175,182**;24 Jun 93;Build 49
+2 ;
+3 ; Reference to ^ECC(723 supported by DBIA #205
+4 ;
+5 KILL ^TMP("SR",$JOB)
FOR
SET SRSD=$ORDER(^SRF("AC",SRSD))
if 'SRSD!(SRSD>SRED)
QUIT
SET SROP=0
FOR
SET SROP=$ORDER(^SRF("AC",SRSD,SROP))
if 'SROP
QUIT
IF $PIECE($GET(^SRF(SROP,"NON")),"^")="Y"
IF $DATA(^SRF(SROP,0))
IF $$DIV^SROUTL0(SROP)
DO UTIL
+6 SET (SRSOUT,SRHDR,SRSUR)=0
FOR
SET SRSUR=$ORDER(^TMP("SR",$JOB,SRSUR))
if SRSUR=""!(SRSOUT)
QUIT
DO HDR
SET SRSD=0
FOR
SET SRSD=$ORDER(^TMP("SR",$JOB,SRSUR,SRSD))
if 'SRSD!(SRSOUT)
QUIT
DO SROP
+7 IF '$DATA(^TMP("SR",$JOB))
DO HDR
WRITE !!,"No procedures for the selected date range.",!
+8 QUIT
SROP NEW SRANEST,SRANESUP
+1 SET SROP=0
FOR
SET SROP=$ORDER(^TMP("SR",$JOB,SRSUR,SRSD,SROP))
if 'SROP!(SRSOUT)
QUIT
DO SET
+2 QUIT
SET ; set and print info
+1 IF $Y+5>IOSL
DO HDR
if SRSOUT
QUIT
+2 SET SR=^SRF(SROP,0)
SET DFN=$PIECE(SR,"^")
DO DEM^VADPT
SET SRNM=VADM(1)
SET SRSSN=VA("PID")
+3 SET X=$PIECE(SR,"^",12)
SET SRINOUT=$SELECT(X="I":"INPATIENT",X="O":"OUTPATIENT",X=1:"OUTPATIENT",X=2:"INPATIENT",X=3:"INPATIENT",1:"???")
+4 SET Y=SRSD
DO DD^%DT
SET SRSDATE=$EXTRACT(SRSD,4,5)_"/"_$EXTRACT(SRSD,6,7)_"/"_$EXTRACT(SRSD,2,3)_" "_$PIECE(Y,"@",2)
+5 SET SRANEST=$PIECE($GET(^SRF(SROP,.3)),"^")
IF SRANEST
SET SRANEST=$PIECE(^VA(200,SRANEST,0),"^")
if $LENGTH(SRANEST)>30
SET SRANEST=$PIECE(SRANEST,",")_", "_$EXTRACT($PIECE(SRANEST,",",2))_"."
+6 SET SRANESUP=$PIECE($GET(^SRF(SROP,.3)),"^",4)
IF SRANESUP
SET SRANESUP=$PIECE(^VA(200,SRANESUP,0),"^")
if $LENGTH(SRANESUP)>30
SET SRANESUP=$PIECE(SRANESUP,",")_", "_$EXTRACT($PIECE(SRANESUP,",",2))_"."
+7 SET Y=$PIECE(^SRF(SROP,"NON"),"^",8)
SET SRSS=$SELECT(Y:$PIECE(^ECC(723,Y,0),"^"),1:"SPECIALTY NOT ENTERED")
+8 SET Y=$PIECE(^SRF(SROP,"NON"),"^",2)
SET SRLOC=$SELECT(Y:$PIECE(^SC(Y,0),"^"),1:"LOCATION NOT ENTERED")
+9 SET SRST=$PIECE($GET(^SRF(SROP,"NON")),"^",4)
IF SRST
SET Y=SRST
DO DD^%DT
SET SRST=$EXTRACT(SRST,4,5)_"/"_$EXTRACT(SRST,6,7)_"/"_$EXTRACT(SRST,2,3)_" "_$PIECE(Y,"@",2)
+10 SET SRET=$PIECE($GET(^SRF(SROP,"NON")),"^",5)
IF SRET
SET Y=SRET
DO DD^%DT
SET SRET=$EXTRACT(SRET,4,5)_"/"_$EXTRACT(SRET,6,7)_"/"_$EXTRACT(SRET,2,3)_" "_$PIECE(Y,"@",2)
+11 SET SROPER=$PIECE(^SRF(SROP,"OP"),"^")
SET OPER=0
FOR
SET OPER=$ORDER(^SRF(SROP,13,OPER))
if 'OPER
QUIT
DO OTHER
+12 KILL SROPS,MM,MMM
if $LENGTH(SROPER)<50
SET SROPS(1)=SROPER
IF $LENGTH(SROPER)>49
SET SROPER=SROPER_" "
FOR M=1:1
DO LOOP
if MMM=""
QUIT
+13 SET SRABORT=$SELECT($PIECE($GET(^SRF(SROP,30)),"^"):"*ABORTED*",1:"")
+14 WRITE !!,SRSDATE,?15,SRNM_" ("_VA("PID")_")",?64,SRSS,?116,SRST,!,SROP,?15,SRLOC_" ("_SRINOUT_")",?64,SRANEST,?116,SRET
+15 WRITE !,?62,SRANESUP,!,?62,SROPS(1)
+16 if SRABORT'=""
WRITE !,SRABORT
IF $DATA(SROPS(2))
if SRABORT=""
WRITE !
WRITE ?62,SROPS(2)
IF $DATA(SROPS(3))
WRITE !,?62,SROPS(3)
IF $DATA(SROPS(4))
WRITE !,?62,SROPS(4)
+17 QUIT
UTIL ; set ^TMP
+1 SET Y=$PIECE($GET(^SRF(SROP,"NON")),"^",6)
SET SRSUR=$SELECT(Y:$PIECE(^VA(200,Y,0),"^"),1:"PROVIDER NOT ENTERED")
+2 SET ^TMP("SR",$JOB,SRSUR,SRSD,SROP)=""
+3 QUIT
HDR IF $DATA(ZTQUEUED)
DO ^SROSTOP
IF SRHALT
SET SRSOUT=1
QUIT
+1 IF SRHDR
IF $EXTRACT(IOST)'="P"
WRITE !!,"Press RETURN to continue, or '^' to quit: "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
QUIT
+2 if $Y
WRITE @IOF
WRITE !,?(132-$LENGTH(SRINST)\2),SRINST,!,?57,"SURGICAL SERVICE",?100,"REVIEWED BY:",!,?51,"REPORT OF NON-O.R. PROCEDURES",?100,"DATE REVIEWED:",!,?(132-$LENGTH(SRFRTO)\2),SRFRTO
+3 WRITE !!,"DATE",?15,"PATIENT (ID#)",?64,"SPECIALTY",?116,"START TIME",!,"CASE #",?15,"LOCATION (IN/OUT-PAT STATUS)",?64,"PRINCIPAL ANESTHETIST",?116,"FINISH TIME"
+4 WRITE !,?62,"ANESTHESIOLOGIST SUPERVISOR",!,?62,"PROCEDURE(S)",!
FOR LINE=1:1:132
WRITE "="
+5 if SRSUR'=""
WRITE !,?(124-$LENGTH("PROVIDER: "_SRSUR)\2),"*** PROVIDER: "_SRSUR_" ***"
SET SRHDR=1
+6 QUIT
OTHER ; other operations
+1 SET SRLONG=1
IF $LENGTH(SROPER)+$LENGTH($PIECE(^SRF(SROP,13,OPER,0),"^"))>240
SET SRLONG=0
SET OPER=999
SET SROPERS=" ..."
+2 IF SRLONG
SET SROPERS=$PIECE(^SRF(SROP,13,OPER,0),"^")
+3 SET SROPER=SROPER_$SELECT(SROPERS=" ...":SROPERS,1:", "_SROPERS)
+4 QUIT
LOOP ; break procedure if greater than 50 characters
+1 SET SROPS(M)=""
FOR LOOP=1:1
SET MM=$PIECE(SROPER," ")
SET MMM=$PIECE(SROPER," ",2,200)
if MMM=""
QUIT
if $LENGTH(SROPS(M))+$LENGTH(MM)'<50
QUIT
SET SROPS(M)=SROPS(M)_MM_" "
SET SROPER=MMM
+2 QUIT