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

RAORDU1.m

Go to the documentation of this file.
  1. RAORDU1 ;HISC/CAH - AISC/SAW-Utility for Rad/NM Orders Module ;05/15/09 12:56
  1. ;;5.0;Radiology/Nuclear Medicine;**10,41,75,99**;Mar 16, 1998;Build 5
  1. ;P#99 - changed Pregnant title to Pregnant at time of order entry.
  1. CP ;Create protocols for Rad/Nuc Med in OE/RR Protocol file (#100)
  1. ;based upon entries in the Rad/Nuc Med Common Procedure file (#71.3)
  1. ;
  1. I $$ORVR^RAORDU()>2.5 W !!,"In order to use this option, your site must be running version 2.5 of the",!,"Order Entry/Results Reporting package." G Q
  1. ;
  1. ;Check/set package and default protocol values
  1. S ORPKG=$O(^DIC(9.4,"C","RA",0)) I 'ORPKG W !,$C(7),"There is no entry for the Radiology/Nuclear Medicine package in your Package",!,"file (#9.4), unable to proceed. Contact your site manager." G Q
  1. S ORDEF=$O(^ORD(101,"B","RA OERR DEFAULT PROTOCOL",0)) I 'ORDEF W !,$C(7),"You do not have a default Radiology/Nuclear Medicine protocol in your",!,"Protocol file (#101), unable to continue. Contact your site manager." G Q
  1. S (I,RACNT,RAF1,X)=0 K ^TMP($J,"RAEX") W !!?10,"Create an OE/RR Protocol from a Radiology/Nuclear Medicine",!?10,"Common Procedure",!
  1. F S I=$O(^RAMIS(71.3,I)) Q:I'>0 I $D(^(I,0)) S Y=I_"^"_^(0) I $P(Y,"^",6)']"",$D(^RAMIS(71,+$P(Y,"^",2),0)) S RACNT=RACNT+1,^TMP($J,"RAEX",RACNT)=Y W !,RACNT,?6,$P(^RAMIS(71,+$P(Y,"^",2),0),"^") D:'(RACNT#15) ASK^RAUTL4 Q:X="^"!(X>0)
  1. G Q:X="^" I 'RACNT W !,$C(7),"The Common Procedures file does not have any entries from which to choose." G Q
  1. I RACNT=1 S RADUP(1)="" W !!,"There is only one Common Procedure to choose from." S DIR(0)="YA",DIR("A")="Okay to continue? " D ^DIR G Q:Y'=1,CP1
  1. I X'>0,RACNT#15 D ASK^RAUTL4 G Q:'$D(RADUP)
  1. CP1 S RAI=0 F S RAI=$O(RADUP(RAI)) Q:RAI'>0 S Y=^TMP($J,"RAEX",RAI),DA=+Y,Y=$P(Y,"^",2,99) W !!,"Processing the ",$P(^RAMIS(71,+Y,0),"^")," procedure.",! D CP2
  1. Q K %1,D,D0,DA,DIC,DIE,DIR,DR,I,J,K,ORDEF,OREA,ORFL,ORPKG,ORTXT,RACNT,RADUP,RAERR,RAF1,RAI,RAILOC,RAPAR,RASEL,X,Y,Z,^TMP($J,"RAEX")
  1. K DI,DIG,DIH,DIU,DIV,DQ
  1. Q
  1. CP2 S RAERR=0 S RAILOC=$P(Y,"^",8) I 'RAILOC S RAILOC=$O(^RA(79.1,0)) I RAILOC,$O(^(RAILOC)) K RAILOC W !,$C(7),"You must enter an 'Imaging Location' before this procedure can be processed",!,"as an orderable item in OE/RR." S RAERR=1
  1. S ORTXT=$P(Y,"^",13) I ORTXT']"" W !,$C(7),"You must enter a 'Name of Ordeable Item' before this procedure can be processed",!,"as an orderable item in OE/RR." S RAERR=1
  1. I RAERR K RAILOC,ORTXT Q
  1. S ORFL=+Y_";RAMIS(71,",OREA="S RADR1=1,RAPRI="_+Y_",RAILOC="_RAILOC_$S($P(Y,"^",11):",RARU="_$P(Y,"^",11),1:"")
  1. S Z="^^^^^RACAT^RAREQDT^^RAMT^RAIP" F X=6,9,10 S OREA=OREA_$S($P(Y,"^",X)]"":","_$P(Z,"^",X)_"="_""""_$P(Y,"^",X)_"""",1:"")
  1. I $O(^RAMIS(71.3,DA,"M",0)) S K=0 F J=1:1 S K=$O(^RAMIS(71.3,DA,"M",K)) Q:K'>0 S X=$G(^(K,0)) I $D(^RAMIS(71.2,+X,0)) S X=$P(^(0),"^") I X]"" S OREA=OREA_",RAMOD("_J_")="_""""_X_""""
  1. S OREA=OREA_" D ^RAORR"
  1. I $G(^DIC(9.4,ORPKG,0))]"" N RA1 S RA1=$P(^(0),"^",2)_+ORFL_" "_ORTXT S:$O(^ORD(101,"B",RA1,0)) ORDA=$O(^(0)) ; define ORDA if filelink record exists in file #101
  1. ;D EN3^ORUPREF2 W:$D(Y) !,*7,"Unable to create an orderable item in OE/RR."
  1. Q ;dead code OE 2.5 from CP down to here
  1. ;
  1. DISP ;Display request with defaults
  1. S:'$D(RAMOD)#2 RAMOD=""
  1. S J="",$P(J,"-",80)="" W !!,J
  1. I $D(RAMOD)>9 S RAMOD="" F I=1:1 Q:'$D(RAMOD(I)) S RAMOD=RAMOD_$S(I'=1:", ",1:"")_RAMOD(I) S RAI=0 S RAI=+$O(^RAMIS(71.2,"B",RAMOD(I),RAI)) I $P($G(^RAMIS(71.2,RAI,0)),U,2)="p" S RAACI="p"
  1. W !?10,"Patient: ",RANME I RASEX'="M" S:'$D(RAPREG) RAPREG="" W " Pregnant at time of order entry: ",$S(RAPREG="y":"YES",RAPREG="u":"UNKNOWN",RAPREG="n":"NO",1:"")
  1. W !?8,"Procedure: ",$S($D(^RAMIS(71,RAPRI,0)):$P(^(0),"^"),1:"UNKNOWN"),!?2,"Proc. Modifiers: ",RAMOD
  1. S:'$D(RAMT) RAMT=$S($G(RAACI)="p":"p",$E(RACAT)="I":"w",1:"a") S RAMT=RAMT_"^"_$P($P(^DD(75.1,19,0),RAMT_":",2),";") W !?9,"Category: ",RACAT,?49,"Mode of Transport: ",$P(RAMT,"^",2)
  1. S:'$D(RAIP) RAIP="n" W !," Desired Date: ",RAWHEN,?46,"Isolation Procedures: ",$S(RAIP="y":"YES",1:"NO")
  1. S:'$D(RARU) RARU=9 W !," Request Urgency: ",$S($D(RARU):$P($P(^DD(75.1,6,0),RARU_":",2),";"),1:"ROUTINE"),?46,"Scheduled for Pre-op: ",$S($D(RAPREOP1):"YES",1:"NO")
  1. I $D(RAILOC) W !,"Submit Request To: ",$S($D(^RA(79.1,+RAILOC,0)):$S($D(^SC(+$P(^(0),"^"),0)):$P(^(0),"^"),1:"Unknown"),1:"Unknown")
  1. W !," Request Location: ",$S($P($G(^SC(+RALIFN,0)),U)]"":$E($P($G(^SC(+RALIFN,0)),U),1,26),1:"Unkown") I $$ORVR^RAORDU()'<3 W ?46,"Nature of order: SVC CORRECTION"
  1. D DISREA(RAREAST) ;display the reason for study
  1. ;*Billing Aware Project:
  1. ; Display New ICD-9 Dx and their related SC/EI/MST/HNC responses.
  1. ;
  1. BADISP D:$P($G(RABWDX(1)),U,1)>0 BADISP^RABWORD1(.RABWDX)
  1. ;*
  1. K ^UTILITY($J,"W"),^(1) S DIWF="WN",DIWL=1,DIWR=79,I=0 W !!,"Clinical History:",! F S I=$O(^TMP($J,"RAWP",I)) Q:I'>0 S X=^(I,0) D ^DIWP
  1. D ^DIWW W !,J
  1. S DIR(0)="Y",DIR("A")="Do you want to change any of the above",DIR("B")="NO" D ^DIR K DIR S:$D(DUOUT)!($D(DTOUT)) RAOUT=1 Q:$D(RAOUT) S:Y=0 RADR1=1 S:Y'=0 RADR2=1,RASTOP=0
  1. ; RASTOP is used to track whether the procedure messages have printed.
  1. ; If you answer 'yes' to "Do you want to edit this request", you
  1. ; will see the procedure messages again (if they exist and if you
  1. ; viewed them before. Value altered in ADDORD+1^RAORD1 & EN2+1^RAPRI)
  1. Q
  1. ;
  1. DISREA(X) ;this function formats and displays the reason for study for this
  1. ;order.
  1. ;input: X - the reason for study (a string between three & sixty four
  1. ;characters in length)
  1. N %,DIW,DIWF,DIWI,DIWL,DIWR,DIWT,DIWTC,DIWX,DN,I,LINES,Z
  1. ;accumulate & format data; column width of sixty (DIWF's C60) characters
  1. S DIWF="C60",DIWL=1 D ^DIWP
  1. W !," Reason for Study: " S I=0,LINES=^UTILITY($J,"W",DIWL)
  1. ;LINES: # of formatted lines in ^UTILITY
  1. F S I=$O(^UTILITY($J,"W",DIWL,I)) Q:'I W ?19,$G(^(I,0)) W:I'=LINES !
  1. K ^UTILITY($J,"W",DIWL)
  1. Q
  1. ;