source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAUTL4.m@ 1147

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

initial load of WorldVistAEHR

File size: 5.6 KB
Line 
1RAUTL4 ;HISC/CAH,FPT,GJC AISC/SAW-Utility Routine ;2/9/98 12:37
2 ;;5.0;Radiology/Nuclear Medicine;;Mar 16, 1998
3EN1 ;ENTRY POINT FOR INPUT TRANSFORM FOR FIELD 5, FILE 74
4 S RAX=$G(^RARPT(DA,0))
5 I X="R",$D(^RA(79.1,+$P(^RADPT(+$P(RAX,U,2),"DT",(9999999.9999-$P(RAX,U,3)),0),U,4),0)),$P(^(0),U,17)'["Y" K X W !,"This Imaging Location does not allow the use of 'RELEASED/NOT VERIFIED' status!" G EXIT
6 G EXIT:X'="V" S RACI=$S($D(RACNI):+RACNI,1:+$O(^RADPT(+$P(RAX,U,2),"DT",9999999.9999-$P(RAX,U,3),"P","B",+$P(RAX,U,4),0)))
7 I '$D(^RADPT(+$P(RAX,U,2),"DT",9999999.9999-$P(RAX,U,3),"P",RACI,0)) K X W !?3,"Exam information is missing. Unable to continue." G EXIT
8 S RA0=^RADPT(+$P(RAX,U,2),"DT",9999999.9999-$P(RAX,U,3),"P",RACI,0),RAY=$S($D(^RAMIS(71,+$P(RA0,U,2),0)):$P(^(0),U,7),1:"N")
9 I RAY'["Y",$D(^VA(200,+$P(RA0,U,12),0)) S RAY=$S($D(^("RA")):$P(^("RA"),U),1:"N")
10 I RAY["Y",'$D(^VA(200,+$P(RA0,U,15),0)) K X W !?3,"Staff review is required to verify this report!" G EXIT
11 I '$P(RA0,U,12),'$P(RA0,U,15) K X W !?3,"You must have at least an interpreting 'resident' or 'staff' entered before you can verify this report!" G EXIT
12 I $D(^RA(79,+$P(^RADPT(+$P(RAX,U,2),"DT",(9999999.9999-$P(RAX,U,3)),0),U,3),.1)),$P(^(.1),U,16)="Y",$O(^RARPT(DA,"I",0))<0 K X W !?3,"An impression was not entered. Verifying is not allowed!"
13 ; Handle the situation where a report moves from no report status
14 ; (null) to a report status of verified. This situation happens at
15 ; sites when creating stub reports through the Imaging software.
16 I $P(RAX,"^",5)="",(X="V") D
17 . X:$D(^DD(74,5,1,2,2))#2 ^(2) ; kill 'ARES' xref
18 . X:$D(^DD(74,5,1,3,2))#2 ^(2) ; kill 'ASTF' xref
19 . Q
20EXIT K RA0,RAX,RAY Q
21ASK ;Prompt for range of entries, parse response
22 ;INPUT VARIABLES: ;ch
23 ; RAF1: If defined, a list or range of numbers are permitted i.e,
24 ; 1,2,3-8. If not defined, only single number input is permitted.
25 ; RACNT=highest possible number in range
26 ; ^TMP($J,"RAEX",n)=array of acceptable numeric responses
27 ;OUTPUT VARIABLES:
28 ; RADUP(n)=array of all selected numeric responses
29 K RADUP S (RAERR,RAI)=0
30 S X=$$USRSEL($D(RAF1)#2,$G(RACNT)) Q:X="^"!(X="")
31 ; X returns: a single # -OR- a list of #'s i.e, 1-3,8 or 2,3,4 -OR- '^'
32 I '$D(RAF1),'$D(^TMP($J,"RAEX",+X)) W !!?3,*7,"Item ",+X," is not a valid selection.",! G ASK
33 I '$D(RAF1) S X=+X,Y=^TMP($J,"RAEX",+X) Q
34PARSE ; Parse out the list of numbers entered by the user.
35 S RAI=RAI+1,RAPAR=$P(X,",",RAI) G EX:RAPAR="" I RAPAR?.N1"-".N S RADASH="" F RASEL=$P(RAPAR,"-"):1:$P(RAPAR,"-",2) D CHK G ASK:RAERR
36 I '$D(RADASH) S RASEL=RAPAR D CHK
37 K RADASH G ASK:RAERR,PARSE
38 ;
39CHK I $D(RADASH),+$P(RAPAR,"-",2)<+$P(RAPAR,"-") S RAERR=1 W !?3,*7,"Invalid range of numbers specified." Q
40 I RASEL'?.N!(RASEL'=+RASEL)!(RASEL?16.N.E) D Q
41 . W !?3,$C(7),"Item ",RASEL," is not a valid selection.",!
42 . S RAERR=1
43 . Q
44 I '$D(^TMP($J,"RAEX",RASEL)) W !?3,*7,"Item ",RASEL," is not a valid selection.",! S RAERR=1 Q
45 I $D(RADUP(RASEL)) W !?3,*7,"Item ",RASEL," was already selected.",! S RAERR=1 Q
46 S RADUP(RASEL)="" Q
47EX S X="" I 'RAERR,$D(RADUP) S X=1
48 Q
49 ;
50UPPER ;Convert X to uppercase letters, return as Y
51 S Y=$$UP^XLFSTR(X)
52 Q
53ORDEL ; Inform the 'Rad' user that the 'Order' field is null!
54 ; Called from the [RA STATUS ENTRY] template.
55 W !!?5,"The value for the 'Order' field has been deleted, this"
56 W !?5,"Examination Status is now inactive/invalid. Please use"
57 W !?5,"the 'List Exams with Inactive/Invalid Statuses' option to"
58 W !?5,"generate a report showing all inactive/invalid exams.",!,$C(7)
59 Q
60EMAIL ; Sent the message off to the req. physician
61 Q:'$D(DUZ)#2 ; DUZ not defined!
62 Q:'($D(^TMP($J,"RA AUTOE"))\10) ; no report data, abort
63 N XMDUZ,XMSUB,XMTEXT,XMY S XMDUZ=.5
64 S XMTEXT="^TMP($J,""RA AUTOE"","
65 S XMSUB="Rad/Nuc Med Report ("_$P($G(^RARPT(RA74IEN,0)),"^")_")"
66 S XMY(RARPHYS)="" D ^XMD K ^TMP($J,"RA AUTOE")
67 Q
68ENV() ; Check the current environment the software is running under.
69 ; If package is being installed DO NOT fire off message (0)
70 ; If package wide variables are missing, DO NOT fire off message (0)
71 Q:'$D(RACCESS(DUZ))\10!('$D(RAIMGTY))!('$D(RAMDIV))!('$D(RAMDV))!('$D(RAMLC)) 0 ; not in package
72 Q:$D(XPDNM) 0 ; in environment check OR pre/post install routine
73 Q 1
74INCR(X) ; increment a variable by one
75 S X=X+1,RAACNT=X
76 Q RAACNT
77 ;
78USRSEL(RABOOL,RACNT) ; Allows the user to select a number or list of
79 ; numbers within a certain range.
80 ; Vars: RABOOL=1 if a list of #'s can be entered i.e, 1-3,8 -or- 2,3,4
81 ; =0 a single number is the only valid input
82 ; RACNT=the upper value within the valid range of numbers
83 N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
84 S DIR("A",1)="Type a '^' to STOP, or"
85 S DIR("A")="CHOOSE FROM 1-"_RACNT_": "
86 I RABOOL D ; setup DIR to accept a list of #'s within our range
87 . S DIR(0)="LACO^1:"_RACNT_":0",DIR("?",1)="Please enter a number or range of numbers seperated by a dash,",DIR("?")="or two or more numbers seperated by a combination of commas and dashes."
88 . Q
89 E D ; setup DIR to accept a single number within our range
90 . S DIR(0)="NAO^1:"_RACNT_":0",DIR("?",1)="Enter the number corresponding to the exam you wish to select.",DIR("?")="A list or range of numbers will not be accepted."
91 . Q
92 D ^DIR S:$D(DTOUT)!($D(DUOUT)) Y="^" ; exit iff timeout or '^'
93 ; this code effects the selection of exam record data when presented
94 ; to the user from options: 'Profile of Rad/Nuc Med Exams', 'Case
95 ; No. Exam Edit' & 'Select Report to Print by Patient'.
96 ; Called from ^RAPTLU (patient exam lookup)
97 S:$E(Y,$L(Y))="," Y=$$COMMA(Y)
98 Q Y
99COMMA(Y) ; If the last character in a string is a comma, strip it off
100 ; example: 1-100, becomes 1-100
101 N RA F RA=$L(Y):-1 Q:$E(Y,RA)'=","
102 Q $E(Y,1,RA)
Note: See TracBrowser for help on using the repository browser.