SROSPSS ;B'HAM ISC/MAM - CASES W/O SPECIMENS BY SPECIALTY ; [ 07/27/98 2:33 PM ]
;;3.0;Surgery;**50,182**;24 Jun 93;Build 49
S (SRHDR,SRSOUT)=0,PAGE=1,SRSDATE=SRSD-.0001,SREDT=SRED+.9999 K ^TMP("SR",$J)
F S SRSDATE=$O(^SRF("AC",SRSDATE)) Q:'SRSDATE!(SRSDATE>SREDT)!SRSOUT S SRTN=0 F S SRTN=$O(^SRF("AC",SRSDATE,SRTN)) Q:'SRTN!SRSOUT I $D(^SRF(SRTN,0)),$$MANDIV^SROUTL0(SRINSTP,SRTN) D UTIL
S SRSS="" F S SRSS=$O(^TMP("SR",$J,SRSS)) Q:SRSS=""!(SRSOUT) S SRSPEC=$S(SRSS:$P(^SRO(137.45,SRSS,0),"^"),1:"SPECIALTY NOT ENTERED"),TOTAL=0 D PAGE,DATE
I SRSP S SRSS="" F S SRSS=$O(SRSP(SRSS)) Q:'SRSS!SRSOUT I '$D(^TMP("SR",$J,SRSS)) S SRSPEC=$P(^SRO(137.45,SRSS,0),"^") D PAGE W !!,"TOTAL ",SRSPEC,": 0"
I 'SRSP,'$D(^TMP("SR",$J)) K SRSPEC D HDR W !!,"TOTAL CASES WITHOUT SPECIMENS: 0"
Q
DATE S SRSDATE="" F S SRSDATE=$O(^TMP("SR",$J,SRSS,SRSDATE)) Q:'SRSDATE!(SRSOUT) S SRTN=0 F S SRTN=$O(^TMP("SR",$J,SRSS,SRSDATE,SRTN)) Q:'SRTN!(SRSOUT) D SET
Q:SRSOUT I $Y+5>IOSL D PAGE I SRSOUT Q
W !!,"TOTAL ",SRSPEC,": ",TOTAL
Q
UTIL ; case information
Q:$P($G(^SRF(SRTN,30)),"^")'=""!($P($G(^SRF(SRTN,.2)),"^",12)="")
S SRSS=$P(^SRF(SRTN,0),"^",4) S:SRSS="" SRSS="ZZ" I SRSP,'$D(SRSP(SRSS)) Q
I $O(^SRF(SRTN,9,0)) Q
S ^TMP("SR",$J,SRSS,SRSDATE,SRTN)=""
Q
SET ; set case variables for printing
I $Y+7>IOSL D PAGE I SRSOUT Q
S DFN=$P(^SRF(SRTN,0),"^") D DEM^VADPT S SROD=$E(SRSDATE,4,5)_"/"_$E(SRSDATE,6,7)_"/"_$E(SRSDATE,2,3)
S SRDIAG=$S($D(^SRF(SRTN,34)):$P(^(34),"^"),1:"DIAGNOSIS NOT ENTERED"),SR(.1)=$S($D(^SRF(SRTN,.1)):^(.1),1:""),SRSUR=$P(SR(.1),"^",4),SRATT=$P(SR(.1),"^",13)
I SRSUR S SRSUR=$P(^VA(200,SRSUR,0),"^") I $L(SRSUR)>20 S SRSUR=$P(SRSUR,",")_","_$E($P(SRSUR,",",2))
I SRATT S SRATT=$P(^VA(200,SRATT,0),"^") I $L(SRATT)>20 S SRATT=$P(SRATT,",")_","_$E($P(SRATT,",",2))
OPS S SROPER=$P(^SRF(SRTN,"OP"),"^"),OPER=0 F I=0:0 S OPER=$O(^SRF(SRTN,13,OPER)) Q:OPER="" D OTHER
K SROP,MM,MMM S:$L(SROPER)<50 SROP(1)=SROPER I $L(SROPER)>49 S SROPER=SROPER_" " S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
W !,SROD,?20,VADM(1),?55,SRDIAG,?110,SRSUR,!,SRTN,?20,VA("PID"),?55,SROP(1),?110,SRATT I $D(SROP(2)) W !,?55,SROP(2) I $D(SROP(3)) W !,?55,SROP(3) I $D(SROP(4)) W !,?55,SROP(4)
S TOTAL=TOTAL+1 W !
Q
PAGE I $E(IOST)="P"!('SRHDR) D HDR Q
W !!,"Press RETURN to continue, or '^' to quit: " R X:DTIME I '$T!(X="^") S SRSOUT=1 Q
I X["?" W !!,"Press RETURN to continue listing cases, or '^' to exit from this option." G PAGE
HDR ; print heading
I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
I $Y W @IOF
W !,?(132-$L(SRINST)\2),SRINST,?120,"PAGE ",PAGE,!,?58,"SURGICAL SERVICE",?100,"REVIEWED BY: ",!,?55,"CASES WITHOUT SPECIMENS",?100,"DATE REVIEWED: "
W:$D(SRSPEC) !,?(132-$L("SURGICAL SPECIALTY: "_SRSPEC)\2),"SURGICAL SPECIALTY: ",SRSPEC
W !,?(132-$L(SRFRTO)\2),SRFRTO,?100,SRPRINT
W !!,"DATE",?20,"PATIENT",?55,"POSTOPERATIVE DIAGNOSIS",?110,"PRIMARY SURGEON",!,"CASE #",?20,"PATIENT ID",?55,"OPERATIVE PROCEDURE",?110,"ATTENDING SURGEON"
W ! F LINE=1:1:132 W "="
S PAGE=PAGE+1,SRHDR=1
Q
OTHER ; other operations
S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SRTN,13,OPER,0),"^"))>240 S SRLONG=0,OPER=999,SROPERS=" ..."
I SRLONG S SROPERS=$P(^SRF(SRTN,13,OPER,0),"^")
S SROPER=SROPER_$S(SROPERS=" ...":SROPERS,1:", "_SROPERS)
Q
LOOP ; break procedure if greater than 50 characters
S SROP(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROP(M))+$L(MM)'<50 S SROP(M)=SROP(M)_MM_" ",SROPER=MMM
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSROSPSS 3517 printed Oct 16, 2024@18:46:49 Page 2
SROSPSS ;B'HAM ISC/MAM - CASES W/O SPECIMENS BY SPECIALTY ; [ 07/27/98 2:33 PM ]
+1 ;;3.0;Surgery;**50,182**;24 Jun 93;Build 49
+2 SET (SRHDR,SRSOUT)=0
SET PAGE=1
SET SRSDATE=SRSD-.0001
SET SREDT=SRED+.9999
KILL ^TMP("SR",$JOB)
+3 FOR
SET SRSDATE=$ORDER(^SRF("AC",SRSDATE))
if 'SRSDATE!(SRSDATE>SREDT)!SRSOUT
QUIT
SET SRTN=0
FOR
SET SRTN=$ORDER(^SRF("AC",SRSDATE,SRTN))
if 'SRTN!SRSOUT
QUIT
IF $DATA(^SRF(SRTN,0))
IF $$MANDIV^SROUTL0(SRINSTP,SRTN)
DO UTIL
+4 SET SRSS=""
FOR
SET SRSS=$ORDER(^TMP("SR",$JOB,SRSS))
if SRSS=""!(SRSOUT)
QUIT
SET SRSPEC=$SELECT(SRSS:$PIECE(^SRO(137.45,SRSS,0),"^"),1:"SPECIALTY NOT ENTERED")
SET TOTAL=0
DO PAGE
DO DATE
+5 IF SRSP
SET SRSS=""
FOR
SET SRSS=$ORDER(SRSP(SRSS))
if 'SRSS!SRSOUT
QUIT
IF '$DATA(^TMP("SR",$JOB,SRSS))
SET SRSPEC=$PIECE(^SRO(137.45,SRSS,0),"^")
DO PAGE
WRITE !!,"TOTAL ",SRSPEC,": 0"
+6 IF 'SRSP
IF '$DATA(^TMP("SR",$JOB))
KILL SRSPEC
DO HDR
WRITE !!,"TOTAL CASES WITHOUT SPECIMENS: 0"
+7 QUIT
DATE SET SRSDATE=""
FOR
SET SRSDATE=$ORDER(^TMP("SR",$JOB,SRSS,SRSDATE))
if 'SRSDATE!(SRSOUT)
QUIT
SET SRTN=0
FOR
SET SRTN=$ORDER(^TMP("SR",$JOB,SRSS,SRSDATE,SRTN))
if 'SRTN!(SRSOUT)
QUIT
DO SET
+1 if SRSOUT
QUIT
IF $Y+5>IOSL
DO PAGE
IF SRSOUT
QUIT
+2 WRITE !!,"TOTAL ",SRSPEC,": ",TOTAL
+3 QUIT
UTIL ; case information
+1 if $PIECE($GET(^SRF(SRTN,30)),"^")'=""!($PIECE($GET(^SRF(SRTN,.2)),"^",12)="")
QUIT
+2 SET SRSS=$PIECE(^SRF(SRTN,0),"^",4)
if SRSS=""
SET SRSS="ZZ"
IF SRSP
IF '$DATA(SRSP(SRSS))
QUIT
+3 IF $ORDER(^SRF(SRTN,9,0))
QUIT
+4 SET ^TMP("SR",$JOB,SRSS,SRSDATE,SRTN)=""
+5 QUIT
SET ; set case variables for printing
+1 IF $Y+7>IOSL
DO PAGE
IF SRSOUT
QUIT
+2 SET DFN=$PIECE(^SRF(SRTN,0),"^")
DO DEM^VADPT
SET SROD=$EXTRACT(SRSDATE,4,5)_"/"_$EXTRACT(SRSDATE,6,7)_"/"_$EXTRACT(SRSDATE,2,3)
+3 SET SRDIAG=$SELECT($DATA(^SRF(SRTN,34)):$PIECE(^(34),"^"),1:"DIAGNOSIS NOT ENTERED")
SET SR(.1)=$SELECT($DATA(^SRF(SRTN,.1)):^(.1),1:"")
SET SRSUR=$PIECE(SR(.1),"^",4)
SET SRATT=$PIECE(SR(.1),"^",13)
+4 IF SRSUR
SET SRSUR=$PIECE(^VA(200,SRSUR,0),"^")
IF $LENGTH(SRSUR)>20
SET SRSUR=$PIECE(SRSUR,",")_","_$EXTRACT($PIECE(SRSUR,",",2))
+5 IF SRATT
SET SRATT=$PIECE(^VA(200,SRATT,0),"^")
IF $LENGTH(SRATT)>20
SET SRATT=$PIECE(SRATT,",")_","_$EXTRACT($PIECE(SRATT,",",2))
OPS SET SROPER=$PIECE(^SRF(SRTN,"OP"),"^")
SET OPER=0
FOR I=0:0
SET OPER=$ORDER(^SRF(SRTN,13,OPER))
if OPER=""
QUIT
DO OTHER
+1 KILL SROP,MM,MMM
if $LENGTH(SROPER)<50
SET SROP(1)=SROPER
IF $LENGTH(SROPER)>49
SET SROPER=SROPER_" "
SET SROPER=SROPER_" "
FOR M=1:1
DO LOOP
if MMM=""
QUIT
+2 WRITE !,SROD,?20,VADM(1),?55,SRDIAG,?110,SRSUR,!,SRTN,?20,VA("PID"),?55,SROP(1),?110,SRATT
IF $DATA(SROP(2))
WRITE !,?55,SROP(2)
IF $DATA(SROP(3))
WRITE !,?55,SROP(3)
IF $DATA(SROP(4))
WRITE !,?55,SROP(4)
+3 SET TOTAL=TOTAL+1
WRITE !
+4 QUIT
PAGE IF $EXTRACT(IOST)="P"!('SRHDR)
DO HDR
QUIT
+1 WRITE !!,"Press RETURN to continue, or '^' to quit: "
READ X:DTIME
IF '$TEST!(X="^")
SET SRSOUT=1
QUIT
+2 IF X["?"
WRITE !!,"Press RETURN to continue listing cases, or '^' to exit from this option."
GOTO PAGE
HDR ; print heading
+1 IF $DATA(ZTQUEUED)
DO ^SROSTOP
IF SRHALT
SET SRSOUT=1
QUIT
+2 IF $Y
WRITE @IOF
+3 WRITE !,?(132-$LENGTH(SRINST)\2),SRINST,?120,"PAGE ",PAGE,!,?58,"SURGICAL SERVICE",?100,"REVIEWED BY: ",!,?55,"CASES WITHOUT SPECIMENS",?100,"DATE REVIEWED: "
+4 if $DATA(SRSPEC)
WRITE !,?(132-$LENGTH("SURGICAL SPECIALTY: "_SRSPEC)\2),"SURGICAL SPECIALTY: ",SRSPEC
+5 WRITE !,?(132-$LENGTH(SRFRTO)\2),SRFRTO,?100,SRPRINT
+6 WRITE !!,"DATE",?20,"PATIENT",?55,"POSTOPERATIVE DIAGNOSIS",?110,"PRIMARY SURGEON",!,"CASE #",?20,"PATIENT ID",?55,"OPERATIVE PROCEDURE",?110,"ATTENDING SURGEON"
+7 WRITE !
FOR LINE=1:1:132
WRITE "="
+8 SET PAGE=PAGE+1
SET SRHDR=1
+9 QUIT
OTHER ; other operations
+1 SET SRLONG=1
IF $LENGTH(SROPER)+$LENGTH($PIECE(^SRF(SRTN,13,OPER,0),"^"))>240
SET SRLONG=0
SET OPER=999
SET SROPERS=" ..."
+2 IF SRLONG
SET SROPERS=$PIECE(^SRF(SRTN,13,OPER,0),"^")
+3 SET SROPER=SROPER_$SELECT(SROPERS=" ...":SROPERS,1:", "_SROPERS)
+4 QUIT
LOOP ; break procedure if greater than 50 characters
+1 SET SROP(M)=""
FOR LOOP=1:1
SET MM=$PIECE(SROPER," ")
SET MMM=$PIECE(SROPER," ",2,200)
if MMM=""
QUIT
if $LENGTH(SROP(M))+$LENGTH(MM)'<50
QUIT
SET SROP(M)=SROP(M)_MM_" "
SET SROPER=MMM
+2 QUIT