source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RACNLU.m@ 775

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

initial load of WorldVistAEHR

File size: 5.8 KB
Line 
1RACNLU ;HISC/CAH,FPT,GJC AISC/MJK,RMO-Case Number Lookup ;11/13/00 09:13
2 ;;5.0;Radiology/Nuclear Medicine;**7,15,23**;Mar 16, 1998
3CASE N RADIV,RAIMAGE,RANODE
4 R !!,"Enter Case Number: ",X:DTIME S:'$T!(X="") X="^" G Q:X="^"
5 I X?1A W !?3,*7,"You must enter more than one character of the name!" G CASE
6 I X?1A.AP!(X?1A4N)!(X?9N) S RAHEAD="**** Case Lookup by Patient ****",DIC(0)="EMQ" D ^RADPA G CASE:Y<0 S RADFN=+Y G ^RAPTLU
7 I X?16.N.E D QUES G CASE
8 D SPACE:X=" " G Q:X="^" D QUES:'X&(X'="??") G CASE:X="^" D SEL G CASE:"^"[X!('RACNT) F I=1:1:11 S @$P("RADFN^RADTI^RACNI^RANME^RASSN^RADATE^RADTE^RACN^RAPRC^RARPT^RAST","^",I)=$P(Y,"^",I)
9 W:RACNT'=1 !!?1,"Case No.: ",RACN,?16,"Procedure: ",$E(RAPRC,1,30),?58,"Name: ",$E(RANME,1,20)
10 I $D(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)) S ^DISV($S($D(DUZ)#2:DUZ,1:0),"RA","CASE #")=RADFN_"^"_RADTI_"^"_RACNI,Y(0)=^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)
11Q K I,RACNT,RADTCN,RAEND,RAFL,RAFST,RAIX,^TMP("MAG",$J,"COL"),^TMP("MAG",$J,"ROW") Q
12 ;
13SEL K ^TMP($J,"RAEX") S RACNT=0 G ADC:X["-" S RAFST=$S(X:X-.01,1:0),RAEND=$S(X:X,1:99999),X="",RAIX="AE"
14 ;S RAXHOLD=X ;don't need MAG calls anymore 111300
15 ;I $$IMAGE^RARIC1 D MED^MAGSET3,ERASE^MAGSET3
16 ;S X=RAXHOLD K RAXHOLD
17 F RACN=RAFST:0 Q:X="^"!(X>0) S RACN=$O(^RADPT(RAIX,RACN)) Q:RACN'>0!(RACN>RAEND) F RADFN=0:0 S RADFN=$O(^RADPT(RAIX,RACN,RADFN)) Q:RADFN'>0 S RADTI=$O(^(RADFN,0)),RACNI=$O(^(RADTI,0)) S X="" D PRT Q:X="^"!(X>0)
18 G CHK
19ADC S RAIX="ADC",RACN=$P(X,"-",2),RADTCN=X,X=""
20 F RADFN=0:0 S RADFN=$O(^RADPT(RAIX,RADTCN,RADFN)) Q:RADFN'>0 S RADTI=$O(^(RADFN,0)),RACNI=$O(^(RADTI,0)) S X="" D PRT Q:X="^"!(X>0)
21CHK Q:X="^"!(X>0) I 'RACNT W !?3,*7,"No matches found!" Q
22 I RACNT=1 S X=1,Y=^TMP($J,"RAEX",1) D:$D(RAOPT("EDITCN")) CHECK Q
23CHK1 Q:'(RACNT#15) W !,"CHOOSE FROM 1-",RACNT,": " R X:DTIME S:'$T!(X="") X="^" Q:X="^" I X["?" D HLP G CHK1
24 I '$D(^TMP($J,"RAEX",+X)) S X="^" W *7," ??" Q
25 S Y=^TMP($J,"RAEX",+X) D:$D(RAOPT("EDITCN")) CHECK Q
26PRT S RAFL=0 Q:'$D(^RADPT(RADFN,0))!('$D(^DPT(RADFN,0))) S RANME=^(0),RASSN=$$SSN^RAUTL,RANME=$P(RANME,"^")
27 K RADIV ;this var must be cleared so can detect bad ^RADPT("AE" ;111500
28 I $D(^RADPT(RADFN,"DT",RADTI,0)) D Q:'RAFL
29 . S RANODE=$G(^RADPT(RADFN,"DT",RADTI,0))
30 . S RADIV=+$P(RANODE,"^",3),RAIMAGE=+$P(RANODE,"^",2)
31 . S RADIV=+$G(^RA(79,RADIV,0)),RADIV=$P($G(^DIC(4,RADIV,0)),"^")
32 . S:RADIV']"" RADIV="Unknown"
33 . S RAIMAGE=$P($G(^RA(79.2,RAIMAGE,0)),"^")
34 . S:RAIMAGE']"" RAIMAGE="Unknown"
35 . S (Y,RADTE)=+$P(RANODE,"^") D D^RAUTL S RADATE=Y
36 . I $D(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)) S RAFL=1,Y=^(0)
37 . Q
38 I '$D(RADIV) Q ;possible corrupted "AE" active case x-ref on ^RADPT
39 ; pointing to a non-existent visit node
40 ; Note: if $D(ORVP) the screen logic is to be ignored. We have entered
41 ; through OE/RR. Even if we are not screening, the user may have
42 ; already selected various Division(s) and Imaging type(s) which are
43 ; in ^TMP($J,"RA D-TYPE" and ^TMP($J,"RA I-TYPE". If RANOSCRN is
44 ; defined, it means no screening by imaging types to which the
45 ; user has access privilege.
46 I '$D(ORVP),($D(RANOSCRN)),('$D(RADUPSCN)) I $D(^TMP($J,"RA D-TYPE"))!($D(^TMP($J,"RA I-TYPE"))) Q:'$D(^TMP($J,"RA D-TYPE",RADIV))!('$D(^TMP($J,"RA I-TYPE",RAIMAGE)))
47 ; If in 'Case No. Exam Edit' option, skip i-type check in the next line
48 I '$D(ORVP),('$D(RADUPSCN)),('$D(RAOPT("EDITCN"))) Q:$$IMGTY^RAUTL12("e",RADFN,RADTI)'=RAIMGTY&('$D(RANOSCRN))
49 S RAST=+$P(Y,"^",3),RARPT=+$P(Y,"^",17),RAPRC=$S($D(^RAMIS(71,+$P(Y,"^",2),0)):$P(^(0),"^"),1:"Unknown"),RACNT=RACNT+1
50 S ^TMP($J,"RAEX",RACNT)=RADFN_"^"_RADTI_"^"_RACNI_"^"_RANME_"^"_RASSN_"^"_RADATE_"^"_RADTE_"^"_RACN_"^"_RAPRC_"^"_RARPT_"^"_RAST
51 ;I $$IMAGE^RARIC1 D DISPA^MAGRIC ; don't need MAG calls anymore 111300
52 I RACNT=1,$S('$D(RAEND):1,RAEND<99999:1,1:0),$D(RAVW),$O(^RADPT(RAIX,$S(RAIX="ADC":RADTCN,1:RACN),RADFN))'>0 S X=1,Y=^TMP($J,"RAEX",1) Q
53 D HD:RACNT=1 W !?1,RACNT,?9,$$LCASE(RADTE,RACN) W:$O(^RARPT(RARPT,2005,0)) ?22,"i" W ?24,$E(RAPRC,1,25),?50,$E(RANME,1,22),?74,$$SSN^RAUTL(RADFN,1) Q:RACNT#15
54PRT1 W !,"Type '^' to STOP, or",!,"CHOOSE FROM 1-",RACNT,": " R X:DTIME S:'$T X="^" Q:X="^"!(X="") I X["?" D HLP G PRT1
55 I '$D(^TMP($J,"RAEX",+X)) W *7," ??" S X="^" Q
56 S X=+X,Y=^TMP($J,"RAEX",X) Q
57 ;
58HD W !!,"Choice",?9,"Case No.",?24,"Procedure",?50,"Name",?74,"Pt ID",!,"------",?9,"--------",?24,"---------",?50,"-----------------",?74,"------" Q
59 ;
60SPACE I $D(^DISV($S($D(DUZ)#2:DUZ,1:0),"RA","CASE #")) S X=^("CASE #") I $D(^RADPT(+$P(X,"^"),"DT",+$P(X,"^",2),"P",+$P(X,"^",3),0)) S RADTX=$P($P(X,"^",2),"."),X=+^(0) S X=$$LCASE(9999999-RADTX,X) W " ",X K RADTX Q
61 S X="^" Q
62 ;
63QUES W !,"Enter an active case number in the following form '999'..."
64 W !?10,"...or enter a completed case number as 'MMDDYY-999'"
65 W !?10,"...or enter a patient's name"
66 W !?10,"...or enter a patient's 9-digit SSN"
67 W !?10,"...or enter the first character of the patient's",!?13,"last name and the last four digits of their SSN."
68ASKACT R !!,"Do you wish to see the entire list of active cases? NO// ",X:DTIME S X=$E(X) S:'$T!("Nn"[X) X="^" I "Yy"'[X,X'="^" W:X'="?" *7 W !!?3,"Enter 'YES' to list all active cases, or 'NO' not to." G ASKACT
69 S:"Yy"[X X="??" Q
70HLP W !!?3,"Enter the number corresponding to the exam you wish to select.",! Q
71LCASE(RADT,RACN) ; Pass back the long case number.
72 ; Input : RADT -> FM date (internal format)
73 ; RACN -> Case #
74 ; Output: long case number i.e, '010197-100'
75 Q $TR($TR($$FMTE^XLFDT(RADT,"2FD")," ","0"),"/","")_"-"_RACN
76CHECK ; Check if the exam selected is of the same imaging type as the sign-on
77 ; location. Must be in the 'Case No. Exam Edit' option.
78 Q:'$D(RAOPT("EDITCN")) N RAMASK,RARTRN S RAMASK=Y
79 I $$IMGTY^RAUTL12("e",$P(Y,"^"),$P(Y,"^",2))'=RAIMGTY D
80 . N X S RARTRN=$$SW^RAPSET1($$IMGTY^RAUTL12("e",$P(Y,"^"),$P(Y,"^",2)),RAIMGTY)
81 . Q
82 W:+$G(RARTRN) !!,$P(RARTRN,"^",2),$C(7)
83 S Y=RAMASK
84 I +$G(RARTRN) S X="^" K RADFN,RADTI,RACNI,RANME,RASSN,RADATE,RADTE,RACN,RAPRC,RARPT,RAST,RAEND,RAFST,RAIX
85 Q
Note: See TracBrowser for help on using the repository browser.