SROWRQ1 ;B'HAM ISC/MAM - REQUESTS BY WARD (CONT) ;5 Oct 1988 10:01 AM
;;3.0; Surgery ;**37,48,109**;24 Jun 93
K %DT S SRASK=0 K ^TMP("SRWREQ",$J) U IO S SRQ=0,X="T-1" D ^%DT S SRSDATE=+Y I SRWARD="" G ALL
D HDR^SROWRQ S DFN="" F S SRSDATE=$O(^SRF("AR",SRSDATE)) Q:SRSDATE=""!(SRQ) F S DFN=$O(^SRF("AR",SRSDATE,DFN)) Q:DFN=""!SRQ I $D(^DPT(DFN,.1)),$P(^(.1),"^")=SRWARD S SRTN=0 D MORE
W ! G END
ALL ; all wards
K SRWARD S (DFN,SRTN)=0 F S SRSDATE=$O(^SRF("AR",SRSDATE)) Q:'SRSDATE!(SRQ) F S DFN=$O(^SRF("AR",SRSDATE,DFN)) Q:'DFN!(SRQ) F S SRTN=$O(^SRF("AR",SRSDATE,DFN,SRTN)) Q:'SRTN!(SRQ) D UTL
S SRWARD=0 F S SRWARD=$O(^TMP("SRWREQ",$J,SRWARD)) Q:SRWARD=""!(SRQ) D ASK Q:SRQ S SRTN=0 F S SRTN=$O(^TMP("SRWREQ",$J,SRWARD,SRTN)) Q:'SRTN!(SRQ) S DFN=^(SRTN) S SRSDATE=$P(DFN,"^",2),DFN=+DFN D SET
W:$E(IOST)="P" @IOF
END I $E(IOST)'="P",'SRQ W !!,"Press RETURN to continue " R X:DTIME
K ^TMP("SRWREQ",$J) I $D(ZTQUEUED) Q:$G(ZTSTOP) S ZTREQ="@" Q
D ^SRSKILL K SRTN D ^%ZISC W @IOF
Q
OTHER ; other operations
S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SRTN,13,OPER,0),"^"))>250 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 63 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)'<63 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
Q
UTL K SRWARD I $D(^DPT(DFN,.1)),$P(^(.1),"^")'="" S SRWARD=$P(^DPT(DFN,.1),"^")
S:'$D(SRWARD) SRWARD="OUTPATIENT" S ^TMP("SRWREQ",$J,SRWARD,SRTN)=DFN_"^"_SRSDATE
Q
MORE ;
F S SRTN=$O(^SRF("AR",SRSDATE,DFN,SRTN)) Q:'SRTN!(SRQ) D SET
Q
SET ; set and print data
I $Y+7>IOSL D ASK Q:SRQ
S SRSDATE1=$E(SRSDATE,4,5)_"/"_$E(SRSDATE,6,7)_"/"_$E(SRSDATE,2,3)
K SRB,SRCPT,SRBT,SRBLOOD,SRBU,SRANES,SRDISP,SRORD,SROP,SROPER
D DEM^VADPT S SRNM=VADM(1),SRSSN=VA("PID")
S SRORD=$P(^SRF(SRTN,0),"^",11),Y=$P($G(^SRF(SRTN,.4)),"^",6),C=$P(^DD(130,.46,0),"^",2) D:Y'="" Y^DIQ S SRDISP=Y
S Y=$P($G(^SRF(SRTN,"1.0")),"^"),C=$P(^DD(130,1.01,0),"^",2) D:Y'="" Y^DIQ S SRANES=Y
I $O(^SRF(SRTN,11,0)) S SRB=0 F S SRB=$O(^SRF(SRTN,11,SRB)) Q:'SRB S SRBLOOD=$P(^SRF(SRTN,11,SRB,0),"^"),SRBU=$P(^(0),"^",2),SRBT=$P(^(0),"^",3) D BLOOD ;,SRBLOOD=$P(^LAB(66,SRBLOOD,0),"^") D BLOOD ;RLM
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 SROPS,MM,MMM S:$L(SROPER)<63 SROPS(1)=SROPER I $L(SROPER)>62 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
K SRSCC,SRSCC1 I $D(^SRF(SRTN,"CON")),$P(^("CON"),"^")'="" S SRSCC=$P(^("CON"),"^"),SRSCC1="Concurrent Case Number: "_SRSCC
PRINT ; print results
W !," Patient: "_SRNM_" ("_VA("PID")_")",?58,"Case Number: "_SRTN,!," Date of Operation: "_SRSDATE1,?40,"Case Order: "_SRORD,!," Requested Anesthesia: "_SRANES
I $O(SRN(0)) W !,"Requested Blood Component: " S SRB=0 F S SRB=$O(SRB(SRB)) Q:SRB="" W ?28,SRB(SRB),!
W !," Operation(s): "_SROPS(1) I $D(SROPS(2)) W !,?15,SROPS(2) I $D(SROPS(3)) W !,?15,SROPS(3) I $D(SROPS(4)) W !,?15,SROPS(4) I $D(SROPS(5)) W !,?15,SROPS(5) I $D(SROPS(6)) W !,?15,SROPS(6)
W !!," Comments:" S COMMENT=0 F S COMMENT=$O(^SRF(SRTN,5,COMMENT)) Q:'COMMENT W !," "_^SRF(SRTN,5,COMMENT,0)
I $D(SRSCC) W !!,?4,SRSCC1 D CON^SROWRQ
W ! F LINE=1:1:80 W "-"
Q
BLOOD ; requested blood component information
S SRBT=$S(SRBT="C":"CROSSMATCH",SRBT="S":"SCREEN",SRBT="A":"AUTOLOGOUS",1:"") S SRB(SRB)=SRBLOOD S SRB(SRB)=SRB(SRB)_" "_SRBU_$S(SRBU>1:" UNITS",SRBU>0:" UNIT",1:" UNITS NOT ENTERED")
S SRB(SRB)=SRB(SRB)_" "_SRBT
Q
ASK I SRASK,$E(IOST,1)'="P" W !!,"Press RETURN to continue or '^' to quit. " R X:DTIME I '$T!(X="^") S SRQ=1 Q
S SRASK=1 I SRWARD'="" D HDR^SROWRQ
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSROWRQ1 3784 printed Dec 13, 2024@02:46:43 Page 2
SROWRQ1 ;B'HAM ISC/MAM - REQUESTS BY WARD (CONT) ;5 Oct 1988 10:01 AM
+1 ;;3.0; Surgery ;**37,48,109**;24 Jun 93
+2 KILL %DT
SET SRASK=0
KILL ^TMP("SRWREQ",$JOB)
USE IO
SET SRQ=0
SET X="T-1"
DO ^%DT
SET SRSDATE=+Y
IF SRWARD=""
GOTO ALL
+3 DO HDR^SROWRQ
SET DFN=""
FOR
SET SRSDATE=$ORDER(^SRF("AR",SRSDATE))
if SRSDATE=""!(SRQ)
QUIT
FOR
SET DFN=$ORDER(^SRF("AR",SRSDATE,DFN))
if DFN=""!SRQ
QUIT
IF $DATA(^DPT(DFN,.1))
IF $PIECE(^(.1),"^")=SRWARD
SET SRTN=0
DO MORE
+4 WRITE !
GOTO END
ALL ; all wards
+1 KILL SRWARD
SET (DFN,SRTN)=0
FOR
SET SRSDATE=$ORDER(^SRF("AR",SRSDATE))
if 'SRSDATE!(SRQ)
QUIT
FOR
SET DFN=$ORDER(^SRF("AR",SRSDATE,DFN))
if 'DFN!(SRQ)
QUIT
FOR
SET SRTN=$ORDER(^SRF("AR",SRSDATE,DFN,SRTN))
if 'SRTN!(SRQ)
QUIT
DO UTL
+2 SET SRWARD=0
FOR
SET SRWARD=$ORDER(^TMP("SRWREQ",$JOB,SRWARD))
if SRWARD=""!(SRQ)
QUIT
DO ASK
if SRQ
QUIT
SET SRTN=0
FOR
SET SRTN=$ORDER(^TMP("SRWREQ",$JOB,SRWARD,SRTN))
if 'SRTN!(SRQ)
QUIT
SET DFN=^(SRTN)
SET SRSDATE=$PIECE(DFN,"^",2)
SET DFN=+DFN
DO SET
+3 if $EXTRACT(IOST)="P"
WRITE @IOF
END IF $EXTRACT(IOST)'="P"
IF 'SRQ
WRITE !!,"Press RETURN to continue "
READ X:DTIME
+1 KILL ^TMP("SRWREQ",$JOB)
IF $DATA(ZTQUEUED)
if $GET(ZTSTOP)
QUIT
SET ZTREQ="@"
QUIT
+2 DO ^SRSKILL
KILL SRTN
DO ^%ZISC
WRITE @IOF
+3 QUIT
OTHER ; other operations
+1 SET SRLONG=1
IF $LENGTH(SROPER)+$LENGTH($PIECE(^SRF(SRTN,13,OPER,0),"^"))>250
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 63 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)'<63
QUIT
SET SROPS(M)=SROPS(M)_MM_" "
SET SROPER=MMM
+2 QUIT
UTL KILL SRWARD
IF $DATA(^DPT(DFN,.1))
IF $PIECE(^(.1),"^")'=""
SET SRWARD=$PIECE(^DPT(DFN,.1),"^")
+1 if '$DATA(SRWARD)
SET SRWARD="OUTPATIENT"
SET ^TMP("SRWREQ",$JOB,SRWARD,SRTN)=DFN_"^"_SRSDATE
+2 QUIT
MORE ;
+1 FOR
SET SRTN=$ORDER(^SRF("AR",SRSDATE,DFN,SRTN))
if 'SRTN!(SRQ)
QUIT
DO SET
+2 QUIT
SET ; set and print data
+1 IF $Y+7>IOSL
DO ASK
if SRQ
QUIT
+2 SET SRSDATE1=$EXTRACT(SRSDATE,4,5)_"/"_$EXTRACT(SRSDATE,6,7)_"/"_$EXTRACT(SRSDATE,2,3)
+3 KILL SRB,SRCPT,SRBT,SRBLOOD,SRBU,SRANES,SRDISP,SRORD,SROP,SROPER
+4 DO DEM^VADPT
SET SRNM=VADM(1)
SET SRSSN=VA("PID")
+5 SET SRORD=$PIECE(^SRF(SRTN,0),"^",11)
SET Y=$PIECE($GET(^SRF(SRTN,.4)),"^",6)
SET C=$PIECE(^DD(130,.46,0),"^",2)
if Y'=""
DO Y^DIQ
SET SRDISP=Y
+6 SET Y=$PIECE($GET(^SRF(SRTN,"1.0")),"^")
SET C=$PIECE(^DD(130,1.01,0),"^",2)
if Y'=""
DO Y^DIQ
SET SRANES=Y
+7 ;,SRBLOOD=$P(^LAB(66,SRBLOOD,0),"^") D BLOOD ;RLM
IF $ORDER(^SRF(SRTN,11,0))
SET SRB=0
FOR
SET SRB=$ORDER(^SRF(SRTN,11,SRB))
if 'SRB
QUIT
SET SRBLOOD=$PIECE(^SRF(SRTN,11,SRB,0),"^")
SET SRBU=$PIECE(^(0),"^",2)
SET SRBT=$PIECE(^(0),"^",3)
DO BLOOD
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 SROPS,MM,MMM
if $LENGTH(SROPER)<63
SET SROPS(1)=SROPER
IF $LENGTH(SROPER)>62
SET SROPER=SROPER_" "
FOR M=1:1
DO LOOP
if MMM=""
QUIT
+2 KILL SRSCC,SRSCC1
IF $DATA(^SRF(SRTN,"CON"))
IF $PIECE(^("CON"),"^")'=""
SET SRSCC=$PIECE(^("CON"),"^")
SET SRSCC1="Concurrent Case Number: "_SRSCC
PRINT ; print results
+1 WRITE !," Patient: "_SRNM_" ("_VA("PID")_")",?58,"Case Number: "_SRTN,!," Date of Operation: "_SRSDATE1,?40,"Case Order: "_SRORD,!," Requested Anesthesia: "_SRANES
+2 IF $ORDER(SRN(0))
WRITE !,"Requested Blood Component: "
SET SRB=0
FOR
SET SRB=$ORDER(SRB(SRB))
if SRB=""
QUIT
WRITE ?28,SRB(SRB),!
+3 WRITE !," Operation(s): "_SROPS(1)
IF $DATA(SROPS(2))
WRITE !,?15,SROPS(2)
IF $DATA(SROPS(3))
WRITE !,?15,SROPS(3)
IF $DATA(SROPS(4))
WRITE !,?15,SROPS(4)
IF $DATA(SROPS(5))
WRITE !,?15,SROPS(5)
IF $DATA(SROPS(6))
WRITE !,?15,SROPS(6)
+4 WRITE !!," Comments:"
SET COMMENT=0
FOR
SET COMMENT=$ORDER(^SRF(SRTN,5,COMMENT))
if 'COMMENT
QUIT
WRITE !," "_^SRF(SRTN,5,COMMENT,0)
+5 IF $DATA(SRSCC)
WRITE !!,?4,SRSCC1
DO CON^SROWRQ
+6 WRITE !
FOR LINE=1:1:80
WRITE "-"
+7 QUIT
BLOOD ; requested blood component information
+1 SET SRBT=$SELECT(SRBT="C":"CROSSMATCH",SRBT="S":"SCREEN",SRBT="A":"AUTOLOGOUS",1:"")
SET SRB(SRB)=SRBLOOD
SET SRB(SRB)=SRB(SRB)_" "_SRBU_$SELECT(SRBU>1:" UNITS",SRBU>0:" UNIT",1:" UNITS NOT ENTERED")
+2 SET SRB(SRB)=SRB(SRB)_" "_SRBT
+3 QUIT
ASK IF SRASK
IF $EXTRACT(IOST,1)'="P"
WRITE !!,"Press RETURN to continue or '^' to quit. "
READ X:DTIME
IF '$TEST!(X="^")
SET SRQ=1
QUIT
+1 SET SRASK=1
IF SRWARD'=""
DO HDR^SROWRQ