Index: FOIAVistA/tag/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RACTOE6.m
===================================================================
--- FOIAVistA/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RACTOE6.m	(revision 631)
+++ FOIAVistA/tag/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RACTOE6.m	(revision 636)
@@ -1,6 +1,6 @@
-RACTOE6 ; ;05/26/08
+RACTOE6 ; ;12/27/07
  D DE G BEGIN
 DE S DIE="^RAO(75.1,",DIC=DIE,DP=75.1,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^RAO(75.1,DA,""))=""
- I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,20) S:%]"" DE(1)=%
+ I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,5) S:%]"" DE(21)=% S %=$P(%Z,U,12) S:%]"" DE(1)=% S %=$P(%Z,U,13) S:%]"" DE(7)=% S %=$P(%Z,U,17) S:%]"" DE(11)=% S %=$P(%Z,U,18) S:%]"" DE(22)=% S %=$P(%Z,U,21) S:%]"" DE(15)=%,DE(18)=%
  K %Z Q
  ;
@@ -50,21 +50,137 @@
 KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
 BEGIN S DNM="RACTOE6",DQ=1
-1 S DW="0;20",DV="*P79.1'R",DU="",DLB="SUBMIT REQUEST TO",DIFLD=20
- S DU="RA(79.1,"
- G RE
-X1 S DIC("S")="I $$SUBMIT^RAUTL13(DA,+Y)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
+1 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW="0;12",DV="D",DU="",DLB="PRE-OP SCHEDULED DATE (TIME optional)",DIFLD=12
+ S X="TODAY"
+ S Y=X
+ G Y
+X1 S %DT="ETX" D ^%DT S X=Y K:Y<1 X
  Q
  ;
-2 S DQ=3 ;@170
-3 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=3 D X3 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
-X3 S:$D(RAEXMUL) RAILOC=X
+2 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=2 D X2 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
+X2 S:$D(RAEXMUL) RAPREOP1=X
  Q
-4 S DQ=5 ;@175
+3 S DQ=4 ;@120
+4 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=4 D X4 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
+X4 I RASEX="M" S Y="@130"
+ Q
 5 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=5 D X5 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
-X5 S (RAFIN,RAFIN1)=""
+X5 I RASEX'="F" W !,"THE SEX OF THIS PATIENT IS NOT AVAILABLE. IS PATIENT FEMALE" S %=2 D YN^DICN S:%<0 Y="@999" S:%=2 Y="@130" I '% W !!,"Enter 'YES' if patient is female, or 'NO' if patient is male.",! S Y="@120"
  Q
-6 S DQ=7 ;@999
-7 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=7 D X7 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
-X7 K RAI,RAPRI,RAMOD,RAIMAG,RAWPFLAG,RAREQLOC,RAMODPRO
+6 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=6 D X6 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
+X6 S RASEX="F"
  Q
-8 G 0^DIE17
+7 S DW="0;13",DV="RS",DU="",DLB="PREGNANT",DIFLD=13
+ S DU="y:YES;n:NO;u:UNKNOWN;"
+ S X=$S($D(RAPREG):$$EXTERNAL^DILFD(75.1,13,"",RAPREG),1:"")
+ S Y=X
+ G Y
+X7 Q
+8 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=8 D X8 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
+X8 S RAPREG=X
+ Q
+9 S DQ=10 ;@130
+10 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=10 D X10 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
+X10 I '$D(RAVSTFLG)!('$D(RAVLEDTI)) S Y="@135"
+ Q
+11 S DW="0;17",DV="D",DU="",DLB="PAST VISIT DATE/TIME",DIFLD=17
+ S X=9999999.9999-RAVLEDTI
+ S Y=X
+ S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
+ G RD
+X11 S %DT="TXR" D ^%DT S X=Y K:Y<1 X
+ Q
+ ;
+12 S DQ=13 ;@135
+13 S DQ=14 ;@140
+14 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=14 D X14 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
+X14 S:$D(RAWHEN)#2 Y="@145"
+ Q
+15 S DW="0;21",DV="DR",DU="",DLB="DATE DESIRED (Not guaranteed)",DIFLD=21
+ S DE(DW)="C15^RACTOE6"
+ G RE
+C15 G C15S:$D(DE(15))[0 K DB
+ S X=DE(15),DIC=DIE
+ K ^RAO(75.1,"AP",+$P(^RAO(75.1,DA,0),U),+$P(^(0),U,2),9999999.9999-$E(X,1,30),DA)
+C15S S X="" G:DG(DQ)=X C15F1 K DB
+ S X=DG(DQ),DIC=DIE
+ S ^RAO(75.1,"AP",+$P(^RAO(75.1,DA,0),U),+$P(^(0),U,2),9999999.9999-$E(X,1,30),DA)=""
+C15F1 Q
+X15 S %DT="ETX" D ^%DT S X=Y K:Y<1 X
+ Q
+ ;
+16 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=16 D X16 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
+X16 S Y="@150"
+ Q
+17 S DQ=18 ;@145
+18 D:$D(DG)>9 F^DIE17,DE S DQ=18,DW="0;21",DV="D",DU="",DLB="DATE DESIRED (Not guaranteed)",DIFLD=21
+ S DE(DW)="C18^RACTOE6"
+ S X=RAWHEN
+ S Y=X
+ G Y
+C18 G C18S:$D(DE(18))[0 K DB
+ S X=DE(18),DIC=DIE
+ K ^RAO(75.1,"AP",+$P(^RAO(75.1,DA,0),U),+$P(^(0),U,2),9999999.9999-$E(X,1,30),DA)
+C18S S X="" G:DG(DQ)=X C18F1 K DB
+ S X=DG(DQ),DIC=DIE
+ S ^RAO(75.1,"AP",+$P(^RAO(75.1,DA,0),U),+$P(^(0),U,2),9999999.9999-$E(X,1,30),DA)=""
+C18F1 Q
+X18 S %DT="ETX" D ^%DT S X=Y K:Y<1 X
+ Q
+ ;
+19 S DQ=20 ;@150
+20 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=20 D X20 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
+X20 S:$D(RAEXMUL)#2 RAWHEN=$$FMTE^XLFDT(X,1)
+ Q
+21 D:$D(DG)>9 F^DIE17,DE S DQ=21,DW="0;5",DV="SX",DU="",DLB="REQUEST STATUS",DIFLD=5
+ S DE(DW)="C21^RACTOE6"
+ S DU="1:DISCONTINUED;2:COMPLETE;3:HOLD;5:PENDING;6:ACTIVE;8:SCHEDULED;11:UNRELEASED;"
+ S X=$S($D(RAPKG):5,$$ORVR^RAORDU()=2.5:11,1:5)
+ S Y=X
+ S X=Y,DB(DQ)=1,DE(DW,"4/")="" G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
+ G RD:X="@",Z
+C21 G C21S:$D(DE(21))[0 K DB
+ S X=DE(21),DIC=DIE
+ K ^RAO(75.1,"AS",+$P(^RAO(75.1,DA,0),U),X,DA)
+ S X=DE(21),DIC=DIE
+ ;
+C21S S X="" G:DG(DQ)=X C21F1 K DB
+ S X=DG(DQ),DIC=DIE
+ S ^RAO(75.1,"AS",+$P(^RAO(75.1,DA,0),U),X,DA)=""
+ S X=DG(DQ),DIC=DIE
+ D:$$ORVR^RAORDU()=2.5&((X=1)!(X=3)) CH^RADD2(DA,X)
+C21F1 Q
+X21 Q
+22 D:$D(DG)>9 F^DIE17,DE S DQ=22,DW="0;18",DV="D",DU="",DLB="LAST ACTIVITY DATE/TIME",DIFLD=18
+ S DE(DW)="C22^RACTOE6"
+ S X="NOW"
+ S Y=X
+ S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
+ G RD
+C22 G C22S:$D(DE(22))[0 K DB
+ S X=DE(22),DIC=DIE
+ K ^RAO(75.1,"AO",$E(X,1,30),DA)
+C22S S X="" G:DG(DQ)=X C22F1 K DB
+ S X=DG(DQ),DIC=DIE
+ S ^RAO(75.1,"AO",$E(X,1,30),DA)=""
+C22F1 Q
+X22 S %DT="TXR" D ^%DT S X=Y K:Y<1 X
+ Q
+ ;
+23 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=23 D X23 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
+X23 S Y=$S('$D(^RA(79,+RADIV,.1)):"@160",$P(^(.1),"^",19)="y":"@155",1:"@160")
+ Q
+24 S DQ=25 ;@155
+25 D:$D(DG)>9 F^DIE17,DE S DQ=25,D=0 K DE(1) ;75
+ S DIFLD=75,DGO="^RACTOE7",DC="4^75.12DA^T^",DV="75.12D",DW="0;1",DOW="STATUS CHANGE DATE/TIME",DLB="Select "_DOW S:D DC=DC_D
+ I $D(DSC(75.12))#2,$P(DSC(75.12),"I $D(^UTILITY(",1)="" X DSC(75.12) S D=$O(^(0)) S:D="" D=-1 G M25
+ S D=$S($D(^RAO(75.1,DA,"T",0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
+M25 I D>0 S DC=DC_D I $D(^RAO(75.1,DA,"T",+D,0)) S DE(25)=$P(^(0),U,1)
+ S X="""NOW"""
+ S Y=X
+ S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
+ G RD
+R25 D DE
+ G A
+ ;
+26 S DQ=27 ;@160
+27 D:$D(DG)>9 F^DIE17 G ^RACTOE8
