source: WorldVistAEHR/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNCMR1.m@ 1582

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

initial load of WorldVistAEHR

File size: 2.8 KB
Line 
1SPNCMR1 ;HIRMFO/WAA-Find clinics and wards ; 1/23/93
2 ;;2.0;Spinal Cord Dysfunction;;01/02/1997
3MDIC() ; FUNTION RETURNS S ^TMP($J,"SPNWC",SPNNUM,SPNX)=""
4 ; FUNCTION VALUE IS -1 IF USER ABORTS, 0 IF NO LOCS PICKED, ELSE 1
5 N DIC,MDIC,NEG,X,Y K SPNNLOC,^TMP($J,"SPNWC") S SPNNUM=0
6DIC W !,$S('$D(^TMP($J,"SPNWC")):"Select",1:"Another")_" Location: " R X:DTIME E S X="^^"
7 I $$UP^XLFSTR(X)="ALL" D G:X="" DIC
8 .F S %=1 W !,"Do you mean ALL Locations" D YN^DICN S:%=-1 X="^",%=2 Q:% W !,"Enter Y for yes you mean ALL or N for no.",$C(7)
9 .I %=2 K % Q
10 .I %=1 K % S X=0 F S X=$O(^SC(X)) Q:X<1 D
11 ..I $$SCRIACT^SPNCMR1(X) S ^TMP($J,"SPNWC",X)=$P($G(^SC(X,0)),U,3)
12 ..Q
13 .K % S X=""
14 .Q
15RETURN I "^^"[X S MDIC=$S(X["^":-1,1:''$D(^TMP($J,"SPNWC"))) Q MDIC
16 I X?1"?".E D HLP S:Y<0 X="^^" G:Y<0 RETURN S X="?"
17 S NEG=X?1"-".E,X=$E(X,NEG+1,$L(X)),DIC="^SC(",DIC(0)="EQMZ",DIC("S")="I $$SCRIACT^SPNCMR1(+Y)" D ^DIC K DIC,DLAYGO I +Y'>0 G DIC
18 I 'NEG S SPNNUM=SPNNUM+1,^TMP($J,"SPNWC",+Y)=$P(^SC(+Y,0),U,3)
19 E K ^TMP($J,"SPNWC",+Y)
20 G DIC
21HLP ; PRINT LOCATIONS SELECTED ALREADY
22 W $C(7) I $D(^TMP($J,"SPNWC")) W !?3,"YOU HAVE ALREADY SELECTED: "
23 S Y="",X=0 F S Y=$O(^TMP($J,"SPNWC",+Y)) Q:Y="" W !?5,$P(^SC(+Y,0),U) S X=X+1 I X>5 W !,"""^"" TO STOP: " R X:DTIME S:'$T X="^^" S:X="^^" Y=-1 Q:X="^"!(Y<0) S X=0
24 Q:Y<0
25 W !!?3,"You may deselect from the list by typing a '-' followed by location name.",!?4,"E.g. -3E would delete 3E from the list of locations already selected."
26 W !?4,"You may enter the word ALL to select all appropriate locations."
27 Q
28SCRIACT(X) ; GIVEN X AS 44 ENTRY, THIS SCREEN WILL DETERMINE IF IT IS
29 ; ACTIVE OR NOT FOR THIS REPORT. RETURNS 0 IF IT IS NOT, ELSE 1
30 S X("ANS")=0,X(0)=$G(^SC(X,0))
31 I X(0)'="" D
32 .I SPNQST'[$P(X(0),U,3) Q
33 .I $P(X(0),U,3)="W" D
34 ..S SPN42=+$G(^SC(X,42)) Q:SPN42=""!($G(^DIC(42,SPN42,0))="")
35 ..I '$O(^DIC(42,SPN42,"OOS",0)) S X("ANS")=1 Q
36 ..I SPNSEL["1" S X("ANS")=$$ACT42(DT,DT)
37 ..I 'X("ANS"),SPNSEL["3" S X("ANS")=$$ACT42(SPNST,SPNED)
38 ..Q
39 .I SPNSEL["2","^C^M^"[(U_$P(X(0),U,3)_U) D
40 ..S X("I")=$G(^SC(X,"I"))
41 ..I $P(X("I"),U)]"",$P(X("I"),U)<$S(SPNSEL["2"!(SPNSEL["3"):SPNST,1:DT) D Q
42 ...Q:$P(X("I"),U,2)=""!(SPNSEL'["2"&(SPNSEL'["3"))
43 ...Q:$P(X("I"),U,2)'=""&($P(X("I"),U,2)'<SPNED)
44 ...S X("ANS")=1
45 ...Q
46 ..S X("ANS")=1
47 ..Q
48 .Q
49 Q X("ANS")
50ACT42(START,END) ; DETERMINES IF A WARD IS ACTIVE DURING A D/T RANGE
51 ; WARD IS IN SPN42, AND PASS IN START AND END AS D/T RANGE
52 N ANS,OOS
53 S ANS(0)=0,ANS=1,OOS(1)=9999999-(START+.000001) ;**NEW CODE RM-5/24/93
54 F S OOS(1)=$O(^DIC(42,SPN42,"OOS","AINV",OOS(1))) Q:OOS(1)<1 D Q:ANS(0)
55 .S OOS(2)=0 F S OOS(2)=$O(^DIC(42,SPN42,"OOS","AINV",OOS(1),OOS(2))) Q:OOS(2)<1 D Q:ANS(0)
56 ..S OOS=$G(^DIC(42,SPN42,"OOS",OOS(2),0)) Q:OOS=""
57 ..I '$P(OOS,U,6) Q
58 ..S ANS(0)=1,ANS=0 I $S($P(OOS,U,4)="":0,1:$P(OOS,U,4)<END) S ANS=1 ;**NEW CODE RM-5/24/93
59 ..Q
60 .Q
61 Q ANS
Note: See TracBrowser for help on using the repository browser.