Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SROXR2

SROXR2.m

Go to the documentation of this file.
SROXR2 ;B'HAM ISC/MAM - CROSS REFERENCES ; 7 AUG 1989 9:00 AM
 ;;3.0; Surgery ;**6,15**;24 Jun 93
ADT ; set 'ADT x-ref
 S SRINVDT=9999999.999999-X S ^SRF("ADT",$P(^SRF(DA,0),"^"),SRINVDT,DA)=X K SRINVDT
 Q
KADT ; kill 'ADT' x-ref
 S SRINVDT=9999999.999999-X K ^SRF("ADT",$P(^SRF(DA,0),"^"),SRINVDT,DA),SRINVDT
 Q
AMM ; set 'AMM' x-ref when scheduling finish time is entered
 Q:$P($G(^SRF(DA,.2)),"^",12)  S SROOM=$P(^SRF(DA,0),"^",2),SRSTART=$P(^SRF(DA,31),"^",4) Q:'SROOM!'SRSTART
 S SRSEND=X_"0000",SRSBEG=SRSTART_"0000" S SRSEND=$E(SRSEND,1,12),SRSBEG=$E(SRSBEG,1,12)
 S SRLN=$E(SRSEND,9,10)-$E(SRSBEG,9,10)*60+$E(SRSEND,11,12)-$E(SRSBEG,11,12)+($E(SRSEND,1,7)>$E(SRSBEG,1,7)*1440)
 S ^SRF("AMM",SROOM,SRSTART,DA)=X_"^"_SRLN
 K SRSBEG,SRSEND,SROOM,SRSTART,SRLN
 Q
KILLAMM ; kill 'AMM' x-ref
 S SROOM=$P(^SRF(DA,0),"^",2),SRSTART=$P(^SRF(DA,31),"^",4) Q:'SROOM!'SRSTART
 K ^SRF("AMM",SROOM,SRSTART,DA),SROOM,SRSTART
 Q
AM1 ; kill 'AMM' x-ref and update graph when PAT OUT OF OR is entered
 I $P($G(^SRF(DA,"REQ")),"^") K ^SRF("AR",$E($P(^SRF(DA,0),"^",9),1,7),$P(^SRF(DA,0),"^"),DA)
 I '$D(^SRF(DA,31)) Q
 Q:$P(^SRF(DA,31),"^",4)=""  S SROOM=$P(^SRF(DA,0),"^",2),SRSTART=$P(^SRF(DA,31),"^",4)
 Q:'SROOM!'SRSTART  K ^SRF("AMM",SROOM,SRSTART,DA)
 S SRSDATE=$E(SRSTART,1,7) I DT'<SRSDATE G AM1OUT
 S SRSEND=$P(^SRF(DA,31),"^",5),SRSEDT=$E(SRSEND,1,7)
 S SRDAT=SRSDATE,X=$J($P(SRSTART,".",2)_"0000",4),Y=$J($P(SRSEND,".",2)_"0000",4)
 S START=$E(X,1,2)_"."_$E(X,3,4),END=$E(Y,1,2)_"."_$E(Y,3,4),SRSTIME=START_"^"_END
 I $E(SRSEND,1,7)>($E(SRSTART,1,7)) S $P(SRSTIME,"^",2)="24.00"
GRPH S SRSST=$P(SRSTIME,"^"),SRSET=$P(SRSTIME,"^",2)
 S SRS1=11+($P(SRSST,".")*5)+(SRSST-$P(SRSST,".")*100\15),SRS2=11+($P(SRSET,".")*5)+(SRSET-$P(SRSET,".")*100\15),S="="
 S SRS1=11+($P(SRSST,".")*5)+(SRSST-$P(SRSST,".")*100\15),SRS2=11+($P(SRSET,".")*5)+(SRSET-$P(SRSET,".")*100\15),S="" F I=SRS1:1:SRS2-1 S S=S_$S('(I#5):"|",1:"_")
 S X0=^SRS(SROOM,"SS",SRSDATE,1),X1=^SRS(SROOM,"S",SRSDATE,1),(^(1),X1)=$E(X1,1,SRS1)_S_$E(X1,SRS2+1,200),^SRS(SROOM,"S",SRSDATE,0)=SRSDATE
 F I=SRS1:1:SRS2+1 I $E(X1,I)'="X" S X1=$E(X1,1,I-1)_$E(X0,I)_$E(X1,I+1,200)
 S ^SRS(SROOM,"S",SRSDATE,1)=X1
 I SRSEDT'=SRSDATE S SRSTIME="00.00^"_END,SRSDATE=SRSEDT G GRPH
 S SRSDATE=SRDAT
AM1OUT K END,SRDAT,SROOM,SRS1,SRS2,SRSDATE,SRSEDT,SRSEND,SRSET,SRSST,SRSTART,SRSTIME,START,X0,X1
 Q
AM2 ; reset 'AMM' x-ref when Scheduling Start Time is entered
 Q:$P($G(^SRF(DA,.2)),"^",12)  Q:$P($G(^SRF(DA,31)),"^",5)=""  S SROOM=$P(^SRF(DA,0),"^",2) Q:'SROOM
 S SRSEND1=$P(^SRF(DA,31),"^",5),SRSEND=SRSEND1_"0000",SRSEND=$E(SRSEND,1,12)
 S SRSBEG=X_"0000",SRSBEG=$E(SRSBEG,1,12)
 S SRLN=$E(SRSEND,9,10)-$E(SRSBEG,9,10)*60+$E(SRSEND,11,12)-$E(SRSBEG,11,12)+($E(SRSEND,1,7)>$E(SRSBEG,1,7)*1440)
 S ^SRF("AMM",SROOM,X,DA)=SRSEND1_"^"_SRLN
 Q
KILLAM2 ; kill 'AMM' x-ref when Scheduling Start Time is updated
 S SROOM=$P(^SRF(DA,0),"^",2) K:SROOM ^SRF("AMM",SROOM,X,DA) K SROOM
 Q
AM3 ; reset 'AMM' x-ref when Operating Room is entered
 Q:$P($G(^SRF(DA,.2)),"^",12)  S SRSBEG=$P($G(^SRF(DA,31)),"^",4),SRSEND=$P($G(^SRF(DA,31)),"^",5) Q:'SRSBEG!('SRSEND)
 S SRSBEG1=SRSBEG_"0000",SRSBEG1=$E(SRSBEG1,1,12),SRSEND1=SRSEND_"0000",SRSEND1=$E(SRSEND1,1,12)
 S SRLN=$E(SRSEND1,9,10)-$E(SRSBEG1,9,10)*60+$E(SRSEND1,11,12)-$E(SRSBEG1,11,12)+($E(SRSEND1,1,7)>$E(SRSBEG,1,7)*1440)
 S ^SRF("AMM",X,SRSBEG,DA)=SRSEND_"^"_SRLN K SRSBEG,SRSBEG1,SRSEND,SRSEND1,SRLN
 Q
KILLAM3 ; kill 'AMM' x-ref when Operating Room is updated
 S SRSTART=$P($G(^SRF(DA,31)),"^",4) Q:'SRSTART  K ^SRF("AMM",X,SRSTART,DA),SRSTART
 Q