SRSAVL1 ;B'HAM ISC/MAM - LIST REQUEST ON DISPLAY ; [ 07/27/98 2:33 PM ]
;;3.0; Surgery ;**50**;24 Jun 93
REQUEST ; list requests
W !!,"Press RETURN to list Operation Requests, or '^' to quit: " R SRX:DTIME I '$T!(SRX["^") S SRSOUT=1 Q
S IOP=IO_";80",%ZIS="" D ^%ZIS I SR10'="" W SR10
ASK I SRX["?" W !!,"Enter RETURN to list all requests for this date, or '^' to return to the",!,"previous menu.",!!,"Press RETURN to list Operation Requests, or '^' to quit: " R SRX:DTIME S:'$T!(SRX["^") SRSOUT=1 Q:SRSOUT G ASK
S SRHDR=0,Y=SRSDATE D D^DIQ S SRDT=Y I '$D(^SRF("AR",SRSDATE)) W @IOF,!,"There are no requests entered for "_SRDT_"." Q
K ^TMP("SR",$J) S DFN=0 F S DFN=$O(^SRF("AR",SRSDATE,DFN)) Q:'DFN S SRTN=0 F S SRTN=$O(^SRF("AR",SRSDATE,DFN,SRTN)) Q:'SRTN D:$$DIV^SROUTL0(SRTN) UTIL
S SERV=0 F S SERV=$O(^TMP("SR",$J,SERV)) Q:SERV=""!(SRSOUT) D HDR S CNT=0 S SRTN=0 F S SRTN=$O(^TMP("SR",$J,SERV,SRTN)) Q:'SRTN!(SRSOUT) D PRINT
Q
UTIL ; set ^TMP("SR",$J)
S SR(0)=^SRF(SRTN,0),SERV=$P(SR(0),"^",4),SERV=$S(SERV:$P(^SRO(137.45,SERV,0),"^"),1:"SPECIALTY NOT ENTERED")
S ^TMP("SR",$J,SERV,SRTN)=""
Q
PRINT ; print info
I $Y+6>IOSL D HDR I SRSOUT Q
S SR(0)=^SRF(SRTN,0),DFN=$P(SR(0),"^") D DEM^VADPT S SRPAT=VADM(1)
S SR(.1)=$G(^SRF(SRTN,.1)),SRSUR=$P(SR(.1),"^",4) I SRSUR S SRSUR=$P(^VA(200,SRSUR,0),"^")
S SROPER="Procedure(s): "_$P(^SRF(SRTN,"OP"),"^") K SROPS,MM,MMM S:$L(SROPER)<60 SROPS(1)=SROPER I $L(SROPER)>59 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
S SRORD=$P(SR(0),"^",11),SRHRS=$P($G(^SRF(SRTN,.4)),"^")
S CNT=CNT+1 W !,CNT_".",?5,"Patient: "_SRPAT,?40,"Case Number: "_SRTN,!,?5,"Surgeon: "_SRSUR,?40,"Case Order: "_SRORD
W !,?5,SROPS(1) I $D(SROPS(2)) W !,?19,SROPS(2)
I '$D(^SRF(SRTN,"CON")) W ! Q
S CON=$P(^SRF(SRTN,"CON"),"^") I 'CON W ! Q
W !!,?8,"Concurrent Case Number: "_CON
S SROPER="Procedure: "_$P(^SRF(CON,"OP"),"^") K SROPS,MM,MMM S:$L(SROPER)<60 SROPS(1)=SROPER I $L(SROPER)>59 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
W !,?8,SROPS(1) I $D(SROPS(2)) W !,?19,SROPS(2)
W !
Q
LOOP ; break procedure if greater than 60 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)'<60 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
Q
HDR ; print heading
I SRHDR W !!,"Press RETURN to continue, or '^' to quit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
S SRHDR=1
W @IOF,!,?17,"Requested Operative Procedures for "_SRDT,!,?(80-$L("Surgical Specialty: "_SERV)\2),"Surgical Specialty: "_SERV,! F LINE=1:1:80 W "-"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSRSAVL1 2561 printed Dec 13, 2024@02:46:52 Page 2
SRSAVL1 ;B'HAM ISC/MAM - LIST REQUEST ON DISPLAY ; [ 07/27/98 2:33 PM ]
+1 ;;3.0; Surgery ;**50**;24 Jun 93
REQUEST ; list requests
+1 WRITE !!,"Press RETURN to list Operation Requests, or '^' to quit: "
READ SRX:DTIME
IF '$TEST!(SRX["^")
SET SRSOUT=1
QUIT
+2 SET IOP=IO_";80"
SET %ZIS=""
DO ^%ZIS
IF SR10'=""
WRITE SR10
ASK IF SRX["?"
WRITE !!,"Enter RETURN to list all requests for this date, or '^' to return to the",!,"previous menu.",!!,"Press RETURN to list Operation Requests, or '^' to quit: "
READ SRX:DTIME
if '$TEST!(SRX["^")
SET SRSOUT=1
if SRSOUT
QUIT
GOTO ASK
+1 SET SRHDR=0
SET Y=SRSDATE
DO D^DIQ
SET SRDT=Y
IF '$DATA(^SRF("AR",SRSDATE))
WRITE @IOF,!,"There are no requests entered for "_SRDT_"."
QUIT
+2 KILL ^TMP("SR",$JOB)
SET DFN=0
FOR
SET DFN=$ORDER(^SRF("AR",SRSDATE,DFN))
if 'DFN
QUIT
SET SRTN=0
FOR
SET SRTN=$ORDER(^SRF("AR",SRSDATE,DFN,SRTN))
if 'SRTN
QUIT
if $$DIV^SROUTL0(SRTN)
DO UTIL
+3 SET SERV=0
FOR
SET SERV=$ORDER(^TMP("SR",$JOB,SERV))
if SERV=""!(SRSOUT)
QUIT
DO HDR
SET CNT=0
SET SRTN=0
FOR
SET SRTN=$ORDER(^TMP("SR",$JOB,SERV,SRTN))
if 'SRTN!(SRSOUT)
QUIT
DO PRINT
+4 QUIT
UTIL ; set ^TMP("SR",$J)
+1 SET SR(0)=^SRF(SRTN,0)
SET SERV=$PIECE(SR(0),"^",4)
SET SERV=$SELECT(SERV:$PIECE(^SRO(137.45,SERV,0),"^"),1:"SPECIALTY NOT ENTERED")
+2 SET ^TMP("SR",$JOB,SERV,SRTN)=""
+3 QUIT
PRINT ; print info
+1 IF $Y+6>IOSL
DO HDR
IF SRSOUT
QUIT
+2 SET SR(0)=^SRF(SRTN,0)
SET DFN=$PIECE(SR(0),"^")
DO DEM^VADPT
SET SRPAT=VADM(1)
+3 SET SR(.1)=$GET(^SRF(SRTN,.1))
SET SRSUR=$PIECE(SR(.1),"^",4)
IF SRSUR
SET SRSUR=$PIECE(^VA(200,SRSUR,0),"^")
+4 SET SROPER="Procedure(s): "_$PIECE(^SRF(SRTN,"OP"),"^")
KILL SROPS,MM,MMM
if $LENGTH(SROPER)<60
SET SROPS(1)=SROPER
IF $LENGTH(SROPER)>59
SET SROPER=SROPER_" "
FOR M=1:1
DO LOOP
if MMM=""
QUIT
+5 SET SRORD=$PIECE(SR(0),"^",11)
SET SRHRS=$PIECE($GET(^SRF(SRTN,.4)),"^")
+6 SET CNT=CNT+1
WRITE !,CNT_".",?5,"Patient: "_SRPAT,?40,"Case Number: "_SRTN,!,?5,"Surgeon: "_SRSUR,?40,"Case Order: "_SRORD
+7 WRITE !,?5,SROPS(1)
IF $DATA(SROPS(2))
WRITE !,?19,SROPS(2)
+8 IF '$DATA(^SRF(SRTN,"CON"))
WRITE !
QUIT
+9 SET CON=$PIECE(^SRF(SRTN,"CON"),"^")
IF 'CON
WRITE !
QUIT
+10 WRITE !!,?8,"Concurrent Case Number: "_CON
+11 SET SROPER="Procedure: "_$PIECE(^SRF(CON,"OP"),"^")
KILL SROPS,MM,MMM
if $LENGTH(SROPER)<60
SET SROPS(1)=SROPER
IF $LENGTH(SROPER)>59
SET SROPER=SROPER_" "
FOR M=1:1
DO LOOP
if MMM=""
QUIT
+12 WRITE !,?8,SROPS(1)
IF $DATA(SROPS(2))
WRITE !,?19,SROPS(2)
+13 WRITE !
+14 QUIT
LOOP ; break procedure if greater than 60 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)'<60
QUIT
SET SROPS(M)=SROPS(M)_MM_" "
SET SROPER=MMM
+2 QUIT
HDR ; print heading
+1 IF SRHDR
WRITE !!,"Press RETURN to continue, or '^' to quit: "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
QUIT
+2 SET SRHDR=1
+3 WRITE @IOF,!,?17,"Requested Operative Procedures for "_SRDT,!,?(80-$LENGTH("Surgical Specialty: "_SERV)\2),"Surgical Specialty: "_SERV,!
FOR LINE=1:1:80
WRITE "-"
+4 QUIT