Changeset 636 for FOIAVistA/tag/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAORD1A.m
- Timestamp:
- Dec 4, 2009, 8:26:01 PM (14 years ago)
- Location:
- FOIAVistA/tag/r
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
FOIAVistA/tag/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAORD1A.m
r628 r636 1 RAORD1A ;HISC/FPT-Request an Exam ; 7/27/07 08:002 ;;5.0;Radiology/Nuclear Medicine;**1 ,86**;Mar 16, 1998;Build 71 RAORD1A ;HISC/FPT-Request an Exam ;9/29/97 10:40 2 ;;5.0;Radiology/Nuclear Medicine;**1**;Mar 16, 1998 3 3 ; 4 ;Call to WIN^DGPMDDCF (Supported IA #1246) from the SCREENW function 5 ;Supported IA #10039 reference to ^DIC(42 6 ;Supported IA #10040 reference to ^SC 7 ;Supported IA #10061 reference to ^VADPT 8 ;Supported IA #10103 reference to ^XLFDT 4 CS ; Category of exam switch. Called from [RA ORDER EXAM] input template 5 ; when requesting an exam. User can change category of exam from 6 ; (1) inpatient to outpatient and select a clinic patient location OR 7 ; (2) outpatient to inpatient and select a ward patient location. 9 8 ; 10 SCREEN(RAINPAT,RACPRS27) ; screen for active clinics/wards 9 N RAA,RAB,X,Y K DIR 10 S RAA=$S($E(RACAT)="I":"INPATIENT",1:"OUTPATIENT") 11 S RAB=$S($E(RAA)="I":"OUTPATIENT",1:"INPATIENT") 12 W ! S DIR("A",1)="CATEGORY OF EXAM is currently "_RAA 13 S DIR("A",2)=" " 14 S DIR("A")="Want to change CATEGORY OF EXAM to "_RAB 15 S DIR(0)="Y" 16 D ^DIR K DIR 17 I $D(DIRUT) S RALIFN("OUT")="" Q 18 I Y=0 S RALIFN("NO")="" Q 19 REQLOC ; select patient location 20 N DIC,RAHL,RAHLWD,RASCI W ! 21 ASK S DIC("A")="Patient Location: ",DIC="^SC(",DIC(0)="AEMQ" 22 I $E(RAB)="O" S DIC("S")="I $$TYPE^RAORD1A(RAB,+Y),$$SCREEN^RAORD1A" I '$D(RAOERRFG) S:$P($G(^SC(+RALIFN,0)),U,3)="C" DIC("B")=$P(^SC(+RALIFN,0),U,1) 23 I $E(RAB)="I" S DIC("S")="I $$TYPE^RAORD1A(RAB,+Y),$$SCREEN^RAORD1A" I '$D(RAOERRFG) S:$P($G(^SC(+RALIFN,0)),U,3)="W" DIC("B")=$P(^SC(+RALIFN,0),U,1) 24 D ^DIC K DIC 25 I +Y'>0 S RALIFN("OUT")="" Q 26 I $E(RAB)="I" S RAHLWD=+$G(^SC(+Y,42)) I RAHLWD S RAHL=+$G(^DIC(42,RAHLWD,44)) I RAHL,RAHL'=+Y W !!,*7,"This Hospital Location points to ",$P($G(^DIC(42,+Y,0)),U,1) G ASK 27 S RALIFN=+Y,RACAT=RAB 28 Q:$D(RAOERFLG) ;quit if REQLOC was called from REQLOC1 29 K:$E(RAB)="O" RAWARD 30 S:$E(RAB)="I" RAWARD=$P(^SC(+Y,0),U,1) 31 Q 32 SCREEN() ; screen for active clinics/wards 11 33 ; This code is also called from RAORD1 (screen for the Patient Location 12 ; prompt which is a pointer to the HOSPITAL LOCATION (#44) file.) 13 ; We want to EXCLUDE from our selection the following types of 14 ; hospital locations: 34 ; prompt) 35 Q:$D(^SC(+Y,"OOS")) 0 ; don't want Occasion Of Service (OOS) locations 36 N RA44 S RA44=$G(^SC(+Y,0)) 37 Q:"FI"[$P(RA44,"^",3) 0 ; File areas & Imaging Types are not selectable 38 I $P(RA44,"^",3)="W" G SCREENW ; ward check 39 ; check inactivation & reactivation dates of clinic/operating 40 ; room in file #44 41 I '$D(^SC(+Y,"I")) Q 1 42 ; This Hospital Location has an "I" node. We have to check INACTIVATE 43 ; DATE & REACTIVATE DATE fields to determine if the Hosp. Location is 44 ; active. 45 N RASCA S RASCI=$G(^SC(+Y,"I")),RASCA=+$P(RASCI,"^",2) 46 ; RASCA is the REACTIVATE DATE 47 ; Not selectable if REACTIVATE DATE is beyond DT or null (0). 48 S RASCA=$S(RASCA=0:0,RASCA>DT:0,1:RASCA) 49 I +RASCI=0 Q 1 ; no INACTIVATE DATE 50 I +RASCI>DT Q 1 ; INACTIVATE DATE exceeds today's date 51 ; Check INACTIVATE DATE against REACTIVATE DATE 52 ; if REACTIVATE DATE exists and is not after (or is equal to) the 53 ; INACTIVATE DATE the location is not active. 54 I RASCA,(+RASCI<RASCA) Q 1 55 Q 0 56 SCREENW ; check currently out-of-service field of ward file (#42) 57 N D0,DGPMOS,X 58 S D0=+$G(^SC(+Y,42)) I 'D0 Q 0 59 I '$D(^DIC(42,D0,0)) Q 0 60 S:$D(RAWHEN) DGPMOS=$P(RAWHEN,".",1) 61 D WIN^DGPMDDCF 62 S X=$S(X=0:1,1:0) 63 Q X 15 64 ; 16 ; 1) Occasion of Service (OOS) locations (fld: 50.01) 'OOS' node 17 ; 2) File Area ("F") or Imaging ("I") locations (fld: 2) 18 ; 3) Inactivate Date (fld: 2505) 'I' node 65 REQLOC1 ; Requesting Location does not go with Category of Exam 66 ; Category of Exam = Inpatient -> Requesting Location = Ward 67 ; Category of Exam = Outpatient -> Requesting Location = Clinic 68 ; Called from [RA OERR EDIT] and [RA QUICK EXAM ORDER] input templates 69 W !!?5,*7,"When the CATEGORY OF EXAM is "_$S(RAX="I":"Inpatient",1:"Outpatient")_" the REQUESTING LOCATION",!?5,"must be a "_$S(RAX="I":"Ward",1:"Clinic")_" or OR.",! 70 W !?5,"The current REQUESTING LOCATION is ",$S($P($G(^SC(+RALIFN,0)),U,1)]"":$P($G(^SC(+RALIFN,0)),U,1),1:"Unknown"),! 71 N RAB,X,Y 72 S RAX=$S(RAX="I":"INPATIENT",1:"OUTPATIENT"),RAB=RAX,RAOERRFG="" 73 D REQLOC 74 K RAOERRFG 75 Q 76 TYPE(RACAT,Y) ; Indicates whether a Hospital Location is a valid selection. 77 ; If the patient is an inpatient, all operating room location types & 78 ; all wards are valid selections. If the patient is an outpatient, all 79 ; operating room location types & all clinics are valid selections. 80 ; Input Variables: RACAT=$S(Inpatient:"I",1:"O") "O" for outpatient 81 ; Input Variables: Y=IEN of entries in the Hospital Location file 82 ; This fuction returns 1 if valid, 0 if not valid 83 N RAX S RAX=0 84 I $E(RACAT,1)="I" D 85 . I $P(^SC(+Y,0),U,3)="W"!($P(^SC(+Y,0),U,3)="OR") S RAX=1 86 . Q 87 E D 88 . I $P(^SC(+Y,0),U,3)="C"!($P(^SC(+Y,0),U,3)="OR") S RAX=1 89 . Q 90 Q RAX 91 MATCH(RACAT,RALOC) ; Detect mismatched req loc type and cat. of exam 92 ; and return code for correct category of exam 93 ; Input Variable: 'RACAT' - the value for the 'Category Of Exam' field. 94 ; Only passed in if either 'I' or 'O'. 95 ; 'RALOC' - The ien of the 'Requesting Location' 96 ; Output: correct category (I or O)_"^"_$S(Category='I':ward,1:"") 19 97 ; 20 ; input: RAINPAT=1 if the patient is an inpatient located on a ward, else 0. 21 ; RACPRS27=1 if the environment is running CPRS GUI v27, else 0. 22 ; 23 Q:$D(^SC(+Y,"OOS"))#2 0 ; #1 24 N RA44 S RA44=$G(^SC(+Y,0)),RA44(42)=$P($G(^SC(+Y,42)),U) 25 Q:"^F^I^"[(U_$P(RA44,U,3)_U) 0 ; #2 26 ; 27 ; if the hospital location is defined as a ward set RAWARD to 1, else 0 28 N RAWARD S RAWARD=0 29 ;check the pointer to the WARD LOCATION file. 30 I RA44(42)>0 D Q:RAWARD=-1 0 31 .;Error; the HOSPITAL LOCATION cannot be of TYPE 'Clinic' & point to a ward 32 .I $P(RA44,U,3)="C" S RAWARD=-1 Q 33 .;Error; bad pointers between files 42 & 44 34 .I $P($G(^DIC(42,RA44(42),44)),U)'=+Y S RAWARD=-1 Q 35 .;ok, set ward flag... 36 .S RAWARD=1 37 .Q 38 ; 39 ; 1) if the hospital location is a ward check if we should screen by ward 40 ; 2) the hosp location=ward, facility is running v26, and we have an 41 ; outpatient quit zero (default of the $S) 42 I RAWARD Q $S(RACPRS27!RAINPAT:$$SCREENW(+Y),1:0) 43 ; 44 ; if the hospital location is a clinic, we have an inpatient, and the 45 ; facility is not running CPRS v27 return 0 46 I 'RACPRS27,(RAINPAT) Q 0 47 ; 48 ; Check INACTIVATE DATE against REACTIVATE DATE 49 ; inactivate date = reactivate date (allow) 50 ; inactivate date > reactivate date (disallow) 51 ; inactivate date < reactivate date (allow) 52 ; 53 N RASCA,RASCI,RASCINDE S RASCINDE=$G(^SC(+Y,"I")) 54 S RASCI=+$P(RASCINDE,U),RASCA=+$P(RASCINDE,U,2) 55 ; 56 Q $S(RASCI'>0:1,RASCI>DT:1,1:RASCI'>RASCA) 57 ; 58 SCREENW(Y) ; check the out-of-service field of the WARD LOCATION (#42) record. 59 ;input Y: ien of the HOSPITAL LOCATION record 60 ; RAWHEN: DATE DESIRED (Not guaranteed) (file: 75.1, fld: 21) optional 61 ;output : '0' if not valid, else '1' if valid 62 N D0,DGPMOS,X 63 S D0=+$G(^SC(Y,42)) 64 Q:'D0 0 65 Q:'($D(^DIC(42,D0,0))#2) 0 66 ; 67 ;WIN^DGPMDDCF (Supported IA #1246) Is the ward active? 68 ; Input 69 ; D0 "Dee zero" (req): IEN of WARD LOCATION file. 70 ; DGPMOS (opt): defaults to DT. Is the ward in service on this date? 71 ; Output 72 ; X: 1 if out of service, 0 if in service, or -1 if input variables 73 ; not defined properly. Be careful; note the difference in their 74 ; boolean definition ('0'=success) and ours ('0'=failure) 75 ; 76 S:$D(RAWHEN)#2 DGPMOS=$P(RAWHEN,".",1) 77 D WIN^DGPMDDCF 78 Q 'X ;alter 'X' (the WIN^DGPMDDCF output value) to meet our ($$SCREENW) output definition 98 N RA44 S RA44=$G(^SC(+RALOC,0)) 99 I $E(RACAT,1)'="I",$E(RACAT,1)'="O" Q RACAT 100 I $E(RACAT,1)="O",$P(RA44,U,3)'="C",($P(RA44,U,3)'="OR") S RACAT="INPATIENT" 101 I $E(RACAT,1)="I",$P(RA44,U,3)'="W",($P(RA44,U,3)'="OR") S RACAT="OUTPATIENT" 102 Q RACAT_"^"_$S($E(RACAT,1)="I":$P(RA44,"^"),1:"") 79 103 ; 80 104 PREG(RADFN,RADT) ; Subroutine will display the pregnancy prompt to the … … 105 129 F S RACNT=$O(RAMOD(RACNT),-1) Q:RACNT=""!(X=0) S:RAMOD(RACNT)=Y X=0 106 130 Q X 107 ;
Note:
See TracChangeset
for help on using the changeset viewer.