VistA-FOIAVistA/r/SURGERY-SR/SRSCHOR.m

25 lines
1.6 KiB
Mathematica

SRSCHOR ;B'HAM ISC/ADM - SCHEDULE OPERATING ROOM; 23 Oct 1992 9:05 AM
;;3.0; Surgery ;**37**;24 Jun 93
DISP S SRNOREQ=1 D ^SRSDISP Q:SRSOUT
ROOM W ! K DIR S DIR(0)="130,.02A",DIR("A")="Schedule a case for which operating Room ? " D ^DIR I $D(DTOUT)!$D(DUOUT) S SRSOUT=1 Q
I Y="" W !!,"To schedule a case an operating room MUST be selected. Enter '^' to exit.",! G ROOM
S SRSOR=+Y,X1=SRSDATE,X2=2830103 D ^%DTC S SRSDAY=$P("MO^TU^WE^TH^FR^SA^SU","^",X#7+1)
S (SRSOUT,SRSST,SRSET)=0,P=""
S Z="^" D ^SRSTIME I SRSOUT Q
K SRGRPH,SRSDT3 S SRSAVE=SRSDATE,COUNT=1,MM=$E(SRSDT2,1,7),XX=$E(SRSDT1,1,7) I MM>XX S SRSDT3=MM,$P(SRSTIME,"^",2)="24:00"
GRPH S SRSST=$P(SRSTIME,"^"),SRSET=$P(SRSTIME,"^",2),SRSST=$P(SRSST,":")_"."_$P(SRSST,":",2),SRSET=$P(SRSET,":")_"."_$P(SRSET,":",2)
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:1:SRS2-1 S S=S_$S('(I#5):"|",1:"X")
PATRN ; set up pattern
I $E(^SRS(SRSOR,"S",SRSDATE,1),SRS1+1,SRS2)["X"!($E(^SRS(SRSOR,"S",SRSDATE,1),SRS1+1,SRS2)["=") D LAP G DISP
S SRGRPH(COUNT)=SRSDATE_"^"_SRS1_"^"_SRS2_"^"_S,COUNT=COUNT+1
I $D(SRSDT3) S SRSTIME="00:00^"_SRSET1,SRSDATE=SRSDT3 K SRSDT3 G GRPH
F COUNT=1,2 I $D(SRGRPH(COUNT)) S SRSDATE=$P(SRGRPH(COUNT),"^"),SRS1=$P(SRGRPH(COUNT),"^",2),SRS2=$P(SRGRPH(COUNT),"^",3),S=$P(SRGRPH(COUNT),"^",4) D ^SRSGRPH
S SRSDATE=SRSAVE
Q
LAP W !!,"Overlapping reservations on "_$E(SRSDATE,4,5)_"/"_$E(SRSDATE,6,7)_"/"_$E(SRSDATE,2,3)_". This case cannot be scheduled."
W !!,"Press RETURN to continue " R X:DTIME
Q
DW Q:'SRSDATE S X1=SRSDATE,X2=2830103 D ^%DTC S SRSDAY=$P("MO^TU^WE^TH^FR^SA^SU","^",X#7+1) Q
Q