source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTSADH2.m@ 949

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

initial load of WorldVistAEHR

File size: 5.1 KB
Line 
1GMTSADH2 ; SLC/JER,KER - Ad Hoc Summary Driver ; 02/27/2002
2 ;;2.7;Health Summary;**12,37,49,63**;Oct 20, 1995
3 ;
4 ; External Reference
5 ; DBIA 67 ^LAB(60,
6 ; DBIA 2160 ^XUTL("OR"
7 ; DBIA 10006 ^DIC
8 ; DBIA 3137 EN^ORUS
9 ; DBIA 67 ^LAB(60,
10 ; DBIA 502 ^RAMIS(71,
11 ; DBIA 2815 ^ICPT(
12 ; DBIA 3450 ^GMRD(120.51,
13 ; DBIA 10060 ^VA(200,
14 ; DBIA 3148 ^PXD(811.9,
15 ; DBIA 3451 ^TIU(8925.1,
16 ; DBIA 1268 ^AUTTHF(
17 ;
18CMPLIM ; Get Limits and Selection Items
19 N GMTSFUNC
20 I $P(CREC,U,5)="Y" D GETOCC^GMTSADH4 I $D(DIROUT)!($D(DUOUT)) Q
21 I $P(CREC,U,3)="Y" D GETIME^GMTSADH4 I $D(DIROUT)!($D(DUOUT)) Q
22 I $P(CREC,U,10)="Y" D GETHOSP^GMTSADH4 I $D(DIROUT)!($D(DUOUT)) Q
23 I $P(CREC,U,11)="Y" D GETICD^GMTSADH4 I $D(DIROUT)!($D(DUOUT)) Q
24 I $P(CREC,U,12)="Y" D GETPROV^GMTSADH4 I $D(DIROUT)!($D(DUOUT)) Q
25 I $P(CREC,U,14)="Y" D GETCPTM^GMTSADH4 I $D(DIROUT)!($D(DUOUT)) Q
26 D GETNAME^GMTSADH4 I $D(DIROUT)!$D(DUOUT) Q
27 N SEL I $D(^GMT(142.1,$P(GMTSEG(SBS),U,2),1,1,0)) S SEL=$P(^(0),U,1) I SEL D SELECT
28 Q
29SELECT ; Get Selection Items
30 N GMTSF,GMTSJ,GETSLQIT,GMI,DIC,X,Y,TEMP,SELCNT
31 S GMTSJ=$O(GMTSEG(SBS,0)),GMTSF=1
32 I GMTSJ W !,"Default selection items are " D SHOWDEF
33 S SELCNT=$P(^GMT(142.1,$P(GMTSEG(SBS),U,2),1,1,0),U,2)
34 W ! W:GMTSJ "Push Return at the first prompt to select default items.",!
35 W "Select new "_$$FNAM^GMTSU(+SEL)_" items one at a time in the sequence",!,"you want them displayed. "
36 W "You may select " I SELCNT="" W "any number of items.",!
37 E W "up to ",SELCNT," items.",!
38 F GMI=1:1 D GETSEL Q:$D(DIROUT)!(Y=-1)!$S(+SELCNT:(GMI'<+SELCNT),1:0)
39 I +SELCNT,(GMI'<+SELCNT) W !?2,$C(7),"MAXIMUM # OF ITEMS SELECTED.",!
40 Q
41GETSEL ; Updates GMTSEG array with Selections
42 ;
43 ; Using read for special processing when entering a "?".
44 ;
45 ; Get items from Selection Files #60, 71, 81, 120.51,
46 ; 200, 811.9, 8925.1 and 9999999.6,
47 ;
48 I SEL=8925.1 W !,"Select TITLE: "
49 E W !,"Select "_$$FNAM^GMTSU(+SEL)_" Selection Item: "
50 R X:DTIME
51 I X="^^" S Y=0,DIROUT=1 Q
52 I X="^" S Y=-1,(GETSLQIT,ASKCPQIT)="" Q
53 I X["?" W:$O(GMTSEG(SBS,0)) !!,"Current Selection items are " D SHOWDEF
54 S DIC(0)="EMQ",DIC=$$FLOC^GMTSU(+SEL)
55 I SEL=60 S DIC("S")="I $P(^(0),U,4)=""CH"",""BO""[$P(^(0),U,3)"
56 I SEL=9999999.64 D
57 . I $P($G(^GMT(142.1,$P($G(GMX),U,2),0)),U,4)="GECH" D
58 . .S DIC("S")="I (($P(^(0),U,10)=""C"")&(+$P(^(0),U,11)'=1))&($P(^(0),"" "",1)=""GEC"")"
59 . E D
60 ..S DIC("S")="I +$P(^(0),U,11)'=1"
61 ..I SEL=9999999.64 S DIC("W")="W ?47,$S($P(^(0),U,10)=""F"":""FACTOR"",$P(^(0),U,10)=""C"":""CATEGORY"")"
62 ;I SEL=9999999.64 S DIC("S")="I +$P(^(0),U,11)'=1"
63 ;I SEL=9999999.64 S DIC("W")="W ?47,$S($P(^(0),U,10)=""F"":""FACTOR"",$P(^(0),U,10)=""C"":""CATEGORY"")"
64 I SEL=811.9 S DIC("S")="I +$P(^(0),U,6)'=1"
65 I SEL=8925.1 S DIC("S")="I $P(^TIU(8925.1,+Y,0),U,4)=""DOC"",+$$ISA^TIULX(+Y,3)"
66 D ^DIC
67 I $D(DTOUT) S DIROUT=1
68 I $D(DIROUT) Q
69 I $D(DUOUT) S (GETSLQIT,ASKCPQIT)="" Q
70 I X["?" S Y="",GMI=GMI-1 Q
71 I X]"",Y=-1 S Y=0,GMI=GMI-1 Q ;Continue selecting items when incorrect item entered
72 Q:Y=-1
73 I GMTSF&(X'="") K GMTSEG(SBS,SEL) S GMTSF=0,GMTSEG(SBS,SEL,0)=DIC
74 I DIC="^LAB(60,",'$L($P(^LAB(60,+Y,0),U,5)) D RESOLVE(+Y,.GMTSEG,.GMI) Q
75 S GMTSEG(SBS,SEL,GMI)=+Y
76 Q
77SHOWDEF ; Writes out loaded (default) selection items
78 N GMTSN,GMTSWHL
79 I $G(GMTSJ)']"" S GMTSJ=$O(GMTSEG(SBS,0)) I GMTSJ']"" W !!,"No SELECTION ITEMS chosen.",! Q
80 S GMTSN=0 F GMTSWHL=1:1 S GMTSN=$O(GMTSEG(SBS,+GMTSJ,GMTSN)) Q:GMTSN="" W:GMTSWHL>1 ! W ?30,$P(@(GMTSEG(SBS,GMTSJ,0)_GMTSEG(SBS,GMTSJ,GMTSN)_",0)"),U)
81 Q
82RESOLVE(GMREF,GMTSEG,GMI) ; Call ORUS to resolve compound items
83 N SELCT,GMJ,GMHEAD,X,Y
84 K ^XUTL("OR",$J,"ORU"),^("ORV"),^("ORW")
85 ; This subroutine will increment the variable GMI
86 ; if any item are picked. Need to decrement GMI
87 ; by one (1) so it works right
88 S GMI=GMI-1
89 ; Don't exceed allowed # of selection
90 I +$G(SELCNT) S SELCT=SELCNT-GMI
91 S GMHEAD="-- "_$P($G(^LAB(60,+GMREF,.1)),U)_" --"
92 S ^XUTL("OR",$J,"GMTS",0)="LAB TEST^1^^0" D COMPILE(+GMREF)
93 I $P(^XUTL("OR",$J,"GMTS",0),U,4)'>0 D Q
94 . K ^XUTL("OR",$J,"GMTS") W $C(7)," INVALID TEST...Please choose another."
95 S ORUS="^XUTL(""OR"","_$J_",""GMTS"",",ORUS(0)="40MN"_$S(+$G(SELCT):U_$S($P(^XUTL("OR",$J,"GMTS",0),U,4)'<SELCT:SELCT,1:$P(^XUTL("OR",$J,"GMTS",0),U,4)),1:""),ORUS("T")="D HEADER^GMTSADH2"
96 S ORUS("A")="Select"_$S(+$P(ORUS(0),U,2):" 1 - "_+$P(ORUS(0),U,2),1:"")_" LAB TEST(s): "
97 S ORUS("B")=$S(+$P(ORUS(0),U,2):"1-"_+$P(ORUS(0),U,2),1:"ALL")
98 D EN^ORUS K ^XUTL("OR",$J,"GMTS"),^("ORU"),^("ORV"),^("ORW")
99 Q:+Y'>0 S GMJ=0 F S GMJ=$O(Y(GMJ)) Q:GMJ'>0 D
100 . S GMI=GMI+1,GMTSEG(SBS,SEL,GMI)=+Y(GMJ)
101 Q
102COMPILE(GMTEST) ; Compile menu for ORUS call
103 N GMC,GMI,GMJ,GMROOT
104 S GMI=0 F S GMI=$O(^LAB(60,GMTEST,2,GMI)) Q:GMI'>0 D
105 . S GMJ=+$G(^LAB(60,GMTEST,2,+GMI,0))
106 . S GMROOT=$G(^LAB(60,+GMJ,0))
107 . I $L($P(GMROOT,U,5)),("BO"[$P(GMROOT,U,3)) D
108 . . S GMC=+$P($G(^XUTL("OR",$J,"GMTS",0)),U,4)+1
109 . . S ^XUTL("OR",$J,"GMTS",GMJ,0)=$P(GMROOT,U),$P(^XUTL("OR",$J,"GMTS",0),U,4)=GMC
110 . E D
111 . . D COMPILE(+$G(^LAB(60,GMTEST,2,GMI,0)))
112 Q
113HEADER ; Write Header
114 W !!?15,"Select the tests which you wish to include, in the",!?19,"sequence in which you wish them to appear."
115 W !!?((80-$L(GMHEAD))\2),GMHEAD,!
116 Q
Note: See TracBrowser for help on using the repository browser.