source: FOIAVistA/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAORDS.m@ 1123

Last change on this file since 1123 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 6.3 KB
Line 
1RAORDS ;HISC/CAH,DAD AISC/RMO-Select Patient's Requests ;6/7/00 16:34
2 ;;5.0;Radiology/Nuclear Medicine;**15,21**;Mar 16, 1998
3 Q:'$D(RADFN) D HOME^%ZIS K ^TMP($J,"RAORDS"),RAOUT,RAORDS
4 K ^TMP($J,"PRO-ORD"),^TMP($J,"PRO-REG")
5 ; ^tmp($j,"pro-ord",proc-ien,order-ien) -- outstanding orders
6 ; ^tmp($j,"pro-reg",proc-ien,order-ien) -- actually regist'd procs
7 S ^TMP($J,"RAORDS","Unknown")=""
8 S (RACNT,RASEQ,RAPARENT)=0,RAOSTSYM="dc^c^h^^p^^^s"
9 K RAOSTSNM S X(1)=^DD(75.1,5,0) F I=1:1 S RAOSTS=$P(RAOVSTS,";",I) Q:RAOSTS="" S X=$P($P(X(1),RAOSTS_":",2),";"),RAOSTSNM=$S('$D(RAOSTSNM):X,1:RAOSTSNM_", "_X)
10 F RALP=1:1 S RAOSTS=$P(RAOVSTS,";",RALP) Q:RAOSTS="" F RAOIFN=0:0 S RAOIFN=$O(^RAO(75.1,"AS",RADFN,RAOSTS,RAOIFN)) Q:'RAOIFN I $D(^RAO(75.1,RAOIFN,0)) S RAORD0=^(0) D SETUTL
11 I '$D(^TMP($J,"RAORDS"))!('RACNT) W !!?5,"No requests available to select for this patient.",! G Q
12 F RAOURG=0:0 S RAOURG=$O(^TMP($J,"RAORDS",RAOURG)) Q:'RAOURG!($D(RAOSEL)) F RAODTI=0:0 S RAODTI=$O(^TMP($J,"RAORDS",RAOURG,RAODTI)) Q:'RAODTI!($D(RAOSEL)) D CHKORD
13 ;
14Q K ^TMP($J,"RAORDS"),RACNT,RACNT1,RADASH,RADUP,RAERR,RAI,RALCTN,RALOC
15 K RALP,RANUM,RAOASTS,RAODTE,RAODTI,RAOFNS,RAOIFN,RAOIFNS,RAORD0,RAOSEL
16 K RAOSTS,RAOSTSNM,RAOSTSYM,RAOURG,RAOVSTS,RAPHY,RAPAR,RAPRC,RAREQ
17 K RASEL,RASEQ,RAX
18 Q
19 ;
20SETUTL ; Check if option is to be screened. If yes, apply the screen.
21 I $P($G(^RAMIS(71,+$P(RAORD0,U,2),0)),U,6)="P",$O(^RAMIS(71,+$P(RAORD0,U,2),4,0))'>0 Q ; Parent without descendents
22 I $D(RAVSTFLG)#2,$P($G(^RAMIS(71,+$P(RAORD0,U,2),0)),U,6)="P" Q ; Cannot choose parent in add exams option
23 I $D(RASCREEN) D Q:'$D(^TMP($J,"RA L-TYPE",RALCTN))
24 . S RALCTN=+$P(RAORD0,"^",20)
25 . S:'RALCTN RALCTN="Unknown" Q:RALCTN="Unknown"
26 . S RALCTN=$S($D(^RA(79.1,RALCTN,0)):+$P(^(0),"^"),1:"Unknown")
27 . Q:RALCTN="Unknown"
28 . S RALCTN=$S($D(^SC(RALCTN,0)):$P(^(0),"^"),1:"Unknown")
29 . Q
30 S RACNT=RACNT+1,^TMP($J,"RAORDS",$S('$P(RAORD0,"^",6):9,1:$P(RAORD0,"^",6)),9999999.9999-$S($P(RAORD0,"^",21):$P(RAORD0,"^",21),1:$P(RAORD0,"^",16)),RAOIFN,RACNT)=RAORD0
31 ; store order's indiv procedures
32 I $P($G(^RAMIS(71,+$P(RAORD0,U,2),0)),U,6)'="P" S ^TMP($J,"PRO-ORD",$S($P(RAORD0,U,2):$P(RAORD0,U,2),1:0),RAOIFN)="" Q
33 ; for parent orders, must store each descendant's proc ien
34 S RA6=+$P(RAORD0,U,2),RA7=0
35 F S RA7=$O(^RAMIS(71,RA6,4,RA7)) Q:'RA7 S ^TMP($J,"PRO-ORD",+$P($G(^(RA7,0)),U),RAOIFN)="DESC"
36 Q
37 ;
38CHKORD F RAOIFN=0:0 S RAOIFN=$O(^TMP($J,"RAORDS",RAOURG,RAODTI,RAOIFN)) Q:'RAOIFN!($D(RAOSEL)) F RACNT1=0:0 S RACNT1=$O(^TMP($J,"RAORDS",RAOURG,RAODTI,RAOIFN,RACNT1)) Q:RACNT1'>0!($D(RAOSEL)) S RAORD0=^(RACNT1) D PRTORD
39 Q
40 ;
41PRTORD D HD:'(RASEQ#8) Q:$D(RAOSEL) S RASEQ=RASEQ+1,RAOIFNS(RASEQ)=RAOIFN,RAPRC=$S($D(^RAMIS(71,+$P(RAORD0,"^",2),0)):$P(^(0),"^"),1:"Unknown"),RAODTE=9999999.9999-RAODTI
42 S RAPHY=$S($D(^VA(200,+$P(RAORD0,"^",14),0)):$P(^(0),"^"),1:"Unknown"),RALOC=$S($D(^SC(+$P(RAORD0,"^",22),0)):$P(^(0),"^"),1:"Unknown")
43 N RA6 S RA6=$S($P($G(^RAMIS(71,+$P(RAORD0,U,2),0)),U,6)="P"&($P($G(^(0)),U,18)="Y"):"+",1:"") ;parent proc and single rpt
44 W !,$J(RASEQ,2),?4,$P(RAOSTSYM,"^",+$P(RAORD0,"^",5)),?8,$E($P($P(^DD(75.1,6,0),RAOURG_":",2),";"),1,7),?16,RA6
45 W ?17,$E(RAPRC,1,25),?44,$E(RAODTE,4,5)_"/"_$E(RAODTE,6,7)_"/"_(1700+$E(RAODTE,1,3)),?56,$E(RAPHY,1,11),?69,$E(RALOC,1,11)
46 W !?17,"(",$S($P(RAORD0,U,20)="":"UNKNOWN",1:$E($P($G(^SC(+$G(^RA(79.1,+$P(RAORD0,U,20),0)),0)),U),1,23)),")"
47 D ASKSEL:RACNT=RASEQ
48 Q
49 ;
50HD D ASKSEL:RASEQ Q:$D(RAOSEL) W @IOF,!?16,"**** Requested Exams for ",$E(RANME,1,20)," ****",?65,$J(RACNT,3),?70,"Requests"
51 W !?4,"St",?8,"Urgency",?17,"Procedure / (Img. Loc.)",?44,"Desired",?56,"Requester",?69,"Req'g Loc",!?4,"--",?8,"-------",?17,"-------------------------",?44,"----------",?56,"-----------",?69,"-----------"
52 Q
53 ;
54ASKSEL K RADUP,RAORDS S (RAERR,RAI,RANUM)=0
55 W:$D(RAOPT("REG")) !!,"(Use Pn to replace request 'n' with a Printset procedure.)"
56 W:'$D(RAOPT("REG")) !
57 W !,"Select Request(s) 1-",RASEQ,$S($D(RAOFNS):" to "_RAOFNS,1:"")," or '^' to Exit: ",$S(RASEQ<RACNT:"Continue",1:"Exit"),"// " R X:DTIME S:'$T X="^",RAOUT="" S:X["^" RAOSEL=0 Q:X["^"!(X="")
58 S RAX=X I RAX["?" W !!?3,"Please select the request(s) you want separated by commas or a range",!?3,"of numbers separated by a dash, or a combination of commas and dashes." D HLPSEL G ASKSEL
59PARSE I $$UP^XLFSTR(RAX)?1"P".N D DPAR Q ; detail-to-parent
60 S RAI=RAI+1,RAPAR=$P(RAX,",",RAI) Q:RAPAR="" I RAPAR?.N1"-".N S RADASH="" F RASEL=$P(RAPAR,"-"):1:$P(RAPAR,"-",2) D CHKSEL Q:RAERR
61 I '$D(RADASH) S RASEL=RAPAR D CHKSEL
62 K RADASH G ASKSEL:RAERR,PARSE
63 ;
64CHKSEL I $D(RADASH),+$P(RAPAR,"-",2)<+$P(RAPAR,"-") S RAERR=1 Q
65 I RASEL'?.N W !?3,*7,"Item ",RASEL," is not a valid selection." S RAERR=1 Q
66 I '$D(RAOIFNS(RASEL)) W !?3,*7,"Item ",RASEL," is not a valid selection." S RAERR=1 Q
67 I $D(RADUP(RASEL)) W !?3,*7,"Item ",RASEL," was already selected." S RAERR=1 Q
68 I $D(^RAO(75.1,+(RAOIFNS(RASEL)),0)),RAOVSTS'[$P(^(0),"^",5) W !?3,*7,"Item ",RASEL," does not have a valid status for this option.",!?3,"Valid statuses are ",RAOSTSNM,"." S RAERR=1 Q
69 I RAPARENT,$P($G(^RAMIS(71,+$P($G(^RAO(75.1,+RAOIFNS(RASEL),0)),U,2),0)),U,6)="P",('$D(RAOPT("ORDERPRINTPAT"))) D S RAERR=1,RAPARENT=0 Q ; Two parents chosen
70 . ; check NOT valid during 'Print Selected Requests by Patient' option!
71 . W !!?3,*7,"Only one parent type procedure may be chosen at a time."
72 . W !?3,"(You have already chosen ",$P($G(^RAMIS(71,RAPARENT,0)),U),".)"
73 . Q
74 S RANUM=RANUM+1,RADUP(RASEL)="",RAORDS(RANUM)=RAOIFNS(RASEL),RAOSEL=RANUM
75 I $P($G(^RAMIS(71,+$P($G(^RAO(75.1,+RAOIFNS(RASEL),0)),U,2),0)),U,6)="P" D
76 . S RAPARENT=+$P($G(^RAO(75.1,+RAOIFNS(RASEL),0)),U,2)
77 . Q
78 Q
79 ;
80HLPSEL I $D(RAOSTSNM) W !!?3,"The request(s) must have one of the following statuses",$S($D(RAOFNS):" to "_RAOFNS,1:""),":",!?6,RAOSTSNM
81 I RAX["??" W !!?3,"Status Symbols: 'dc' - discontinued 'c' - complete 'h' - on hold",!?20,"'p' - pending ' ' - active 's' - scheduled"
82 Q
83DPAR ; convert detail proc to parent
84 S RASEL=$E(RAX,2,$L(RAX)) ; remove leading 'P'
85 S:RASEL="" RASEL="P" ;set to 1 char so chksel will reject it
86 D CHKSEL
87 ; if order's proc is a parent, then --
88 ; 1-kill raords to skip exam^rareg1
89 ; 2-don't kill raosel so chkord loop would stop
90 I RAPARENT W !!?3,*7,"Only Detailed, Series, and Broad procedures can be selected !",! K RAORDS Q
91 Q:RAX="P" ;entry is only a single P, so don't flag
92 S RADPARFL=1 ; flag
Note: See TracBrowser for help on using the repository browser.