source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTSRM3.m@ 1006

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

initial load of WorldVistAEHR

File size: 5.0 KB
Line 
1GMTSRM3 ; SLC/DLT - Create/Modify - Selection Items ; 08/27/2002
2 ;;2.7;Health Summary;**56,62,63**;Oct 20, 1995
3 ;
4 ; External References
5 ; DBIA 2160 ^XUTL("OR")
6 ; DBIA 67 ^LAB(60,
7 ; DBIA 3137 EN^ORUS
8 ;
9EN ; Entry Logic for Selection Items
10 N GMTSN W !!,$S($O(^GMT(142,DA(1),1,DA,1,0)):"Current selection items are: ",1:"No selection items chosen.")
11 S GMTSN=0 F S GMTSN=$O(^GMT(142,DA(1),1,DA,1,GMTSN)) Q:+GMTSN'>0 S GMTSN(0)=^(GMTSN,0) D SHOWSEL
12 W !!,"Select new items one at a time in the sequence you want them displayed."
13 W !,"You may select " I SELCNT="" W "any number of items.",!
14 E W "up to ",SELCNT," items.",!
15 Q
16SHOWSEL ; Writes Current Selection Items
17 W ?30,$P(@("^"_$P(GMTSN(0),";",2)_+GMTSN(0)_",0)"),U),!
18 Q
19EXIT ; Exit Logic for Selection Items
20 N GMTSN,SELREF,GMREF I +X,(X["LAB(60,") D
21 . S SELREF=U_$P(X,";",2)_+X_",",GMREF=X
22 . I '$L($P($G(@(SELREF_"0)")),U,5)) D RESOLVE(GMREF)
23 I $S('$D(DA(1)):1,'$D(DA(2)):1,1:0) Q
24 S (GMTSNCNT,GMTSN)=0 F S GMTSN=$O(^GMT(142,DA(2),1,DA(1),1,GMTSN)) Q:'GMTSN S GMTSNCNT=GMTSNCNT+1
25 S $P(^GMT(142,DA(2),1,DA(1),1,0),U,4)=GMTSNCNT
26 I SELCNT,(GMTSNCNT'<SELCNT) W !?2,$C(7),"MAXIMUM # OF ITEMS SELECTED.",!
27 Q
28RESOLVE(GMREF) ; Resolve Compound Items
29 N C,IEN,GMI,GMHEAD,P,X,Y K ^XUTL("OR",$J,"ORU"),^("ORV"),^("ORW")
30 S GMHEAD="-- "_$P($G(^LAB(60,+GMREF,.1)),U)_" --"
31 S ^XUTL("OR",$J,"GMTS",0)="LAB TEST^1^^0" D COMPILE(+GMREF)
32 S ORUS="^XUTL(""OR"","_$J_",""GMTS"",",ORUS("T")="D HEADER^GMTSRM3"
33 I +$G(SELCNT) D
34 . S ORUS(0)="40MN^"_SELCNT
35 . S ORUS("A")="Select 1 - "_SELCNT_" LAB TEST(s): ",ORUS("B")="1-"_SELCNT
36 E S ORUS(0)="40MN",ORUS("A")="Select LAB TEST(s): ",ORUS("B")="ALL"
37 D EN^ORUS K ^XUTL("OR",$J,"GMTS"),^("ORU"),^("ORV"),^("ORW")
38 I $S('$D(CMP(142.14,DA)):1,$G(CMP(142.14,DA))=GMREF:1,1:0) D
39 . I $D(CMP(142.14,+$O(CMP(142.14,DA)))) D
40 . . S GMI=DA F S GMI=$O(CMP(142.14,GMI)) Q:+GMI'>0!(GMI'<(DA+Y)) S CMP(142.14,GMI+Y)=CMP(142.14,GMI)
41 . S GMI=0 F S GMI=$O(Y(GMI)) Q:GMI'>0 D
42 . . I '$D(^GMT(142,+$G(DA(2)),1,+$G(DA(1)),1,"B",+$G(Y(GMI))_";LAB(60,")) D
43 . . . S CMP(142.14,((GMI-1)+DA))=+$G(Y(GMI))_";LAB(60,"
44 S IEN=0 F S IEN=$O(CMP(142.14,IEN)) Q:IEN'>0 D
45 . I $D(^GMT(142,+$G(DA(2)),1,+$G(DA(1)),1,"B",CMP(142.14,IEN))) W $C(7),!," Duplicate test omitted." K CMP(142.14,IEN) Q
46 . D LOADSEL^GMTSRM1A
47 I $P($G(^LAB(60,+$G(^GMT(142,+DA(2),1,+DA(1),1,+DA,0)),0)),U,5)']"" D
48 . N REC,SUBREC,SUBSUB S REC=DA(2),SUBREC=DA(1),SUBSUB=DA
49 . D DELCOSMO(REC,SUBREC,SUBSUB)
50 Q
51REITEM(GMTST,GMTSS) ; Resequence Items
52 Q:+($G(GMTST))'>0 Q:'$D(^GMT(142,+($G(GMTST))))
53 Q:+($G(GMTSS))'>0 Q:'$D(^GMT(142,+GMTST,1,+($G(GMTSS))))
54 N DIR,DTOUT,DUOUT,DIRUT,DIROUT,GMTSA,GMTSCN,GMTSCA,GMTSMAX,GMTSN,GMTSI,Y,X
55 D ARY(GMTST,GMTSS,.GMTSA) Q:+($G(GMTSA(0)))'>1
56 S GMTSCN=$P($G(^GMT(142,GMTST,1,GMTSS,0)),"^",2),GMTSCA=$P($G(^GMT(142.1,+GMTSCN,0)),"^",4),GMTSCN=$P($G(^GMT(142.1,+GMTSCN,0)),"^",1)
57 W !,?1,GMTSCN," ",$S($L(GMTSCA):"(",1:""),GMTSCA,$S($L(GMTSCA):")",1:"")
58 S GMTSN=0 F S GMTSN=$O(GMTSA(GMTSN)) Q:+GMTSN=0 W !,$J(GMTSN,6)," ",GMTSA(GMTSN)
59 S DIR(0)="YAO",DIR("?")="^D RIH^GMTSRM3",DIR("A")=" Do you want to resequence the selection items? "
60 W ! D ^DIR I $D(DTOUT)!($D(DUOUT))!($D(DIRUT))!($D(DIROUT)) Q
61 Q:+Y'>0
62 N DA S DA(2)=+($G(GMTST)),DA(1)=+($G(GMTSS)) D RSI^GMTSRS2
63 Q
64RIH ; Resequence Items Help
65 W !,?4,"Enter either 'Y' or 'N'." Q
66ARY(GMTST,GMTSS,ARY) ; Array of Items
67 N GMTSC,GMTSI,GMTSVAL,GMTSPTR,GMTSFRT,GMTSCRT,GMTSFFRT,GMTSFCRT,GMTSTYPE
68 N GMTSRT,GMTSUB S ARY(0)=0 Q:+($G(GMTST))'>0 Q:'$D(^GMT(142,+($G(GMTST)))) Q:+($G(GMTSS))'>0 Q:'$D(^GMT(142,+GMTST,1,+($G(GMTSS))))
69 S (GMTSC,GMTSI)=0 F S GMTSI=$O(^GMT(142,GMTST,1,GMTSS,1,GMTSI)) Q:+GMTSI=0 D
70 . S GMTSVAL=$G(^GMT(142,GMTST,1,GMTSS,1,GMTSI,0)),GMTSPTR=+GMTSVAL,GMTSFRT=$P(GMTSVAL,";",2) Q:GMTSFRT'["(" S:GMTSFRT'["^" GMTSFRT="^"_GMTSFRT
71 . S GMTSCRT=$$CREF^DILF(GMTSFRT),GMTSFFRT=GMTSFRT_GMTSPTR_","
72 . S GMTSFCRT=$$CREF^DILF(GMTSFFRT) Q:'$D(@GMTSFCRT) Q:'$L($G(@($P(GMTSFCRT,")",1)_",0)")))
73 . I GMTSFCRT["^AUTTHF(" D Q
74 ..S GMTSTYPE=$S($P($G(@($P(GMTSFCRT,")",1)_",0)")),"^",10)="C":"CATEGORY",$P($G(@($P(GMTSFCRT,")",1)_",0)")),"^",10)="F":"FACTOR",1:" ")
75 ..S GMTSUB=$$LJ^XLFSTR($P($G(@($P(GMTSFCRT,")",1)_",0)")),"^",1),42)_GMTSTYPE,GMTSC=GMTSC+1,ARY(GMTSC)=GMTSUB,ARY(0)=+GMTSC
76 . S GMTSUB=$P($G(@($P(GMTSFCRT,")",1)_",0)")),"^",1),GMTSC=GMTSC+1,ARY(GMTSC)=GMTSUB,ARY(0)=+GMTSC
77 Q
78COMPILE(GMTEST) ; Compile Menu
79 N GMC,GMI,GMJ,GMROOT
80 S GMI=0 F S GMI=$O(^LAB(60,GMTEST,2,GMI)) Q:GMI'>0 D
81 . S GMJ=+$G(^LAB(60,GMTEST,2,+GMI,0))
82 . S GMROOT=$G(^LAB(60,+GMJ,0))
83 . I $L($P(GMROOT,U,5)) D
84 . . S GMC=+$P($G(^XUTL("OR",$J,"GMTS",0)),U,4)+1
85 . . S ^XUTL("OR",$J,"GMTS",GMJ,0)=$P(GMROOT,U),$P(^XUTL("OR",$J,"GMTS",0),U,4)=GMC
86 . E D COMPILE(+$G(^LAB(60,GMTEST,2,GMI,0)))
87 Q
88HEADER ; Write Header
89 W !!?15,"Select the tests which you wish to include, in the",!?19,"sequence in which you wish them to appear."
90 W !!?((80-$L(GMHEAD))\2),GMHEAD,!
91 Q
92DELCOSMO(X1,X2,X3) ; Delete Cosmic Lab Tests from Selection Items
93 N TEST S TEST=$G(^GMT(142,X1,1,X2,1,X3,0))
94 K ^GMT(142,X1,1,X2,1,"B",TEST),^GMT(142,X1,1,X2,1,X3,0)
95 Q
Note: See TracBrowser for help on using the repository browser.