source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORWGAPI.m

Last change on this file was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 4.5 KB
Line 
1ORWGAPI ; SLC/STAFF - Graph API ;12/21/05 08:14
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**215**;Dec 17, 1997
3 ;
4ALLITEMS(ITEMS,DFN) ; API - return all items of data on patient (procedures, tests, codes,..)
5 N CNT,SUB,TMP,TYPE
6 K ^TMP("ORWGAPI",$J)
7 S DFN=+$G(DFN) I 'DFN Q
8 D TYPES("ORWGAPI",DFN)
9 D RETURN^ORWGAPIU(.TMP,.ITEMS)
10 S CNT=0
11 S SUB=""
12 F S SUB=$O(^TMP("ORWGAPI",$J,SUB)) Q:SUB="" D
13 . S TYPE=$P(^TMP("ORWGAPI",$J,SUB),U)
14 . D ITEMS^ORWGAPIR(.ITEMS,DFN,TYPE,0,,,.CNT,TMP)
15 K ^TMP("ORWGAPI",$J)
16 Q
17 ;
18CLASS(DATA,TYPE) ; API - get classification
19 I TYPE=50.605 D DRUGC^ORWGAPIA(.DATA)
20 I TYPE=68 D ACC^ORWGAPIA(.DATA)
21 I TYPE=8925.1 D TIUTITLE^ORWGAPIA(.DATA)
22 I TYPE=100.98 D OITEM^ORWGAPIA(.DATA)
23 Q
24 ;
25DATEITEM(ITEMS,OLDEST,NEWEST,TYPE,DFN) ; API - return all file items on patient for date range
26 N CNT,SUB,TMP
27 K ^TMP("ORWGAPI",$J)
28 S DFN=+$G(DFN) I 'DFN Q
29 S OLDEST=+$G(OLDEST),NEWEST=+$G(NEWEST),TYPE=$G(TYPE)
30 I $L(TYPE) S ^TMP("ORWGAPI",$J,1)=TYPE
31 I '$L(TYPE) D TYPES("ORWGAPI",DFN)
32 D RETURN^ORWGAPIU(.TMP,.ITEMS)
33 S CNT=0
34 S SUB=""
35 F S SUB=$O(^TMP("ORWGAPI",$J,SUB)) Q:SUB="" D
36 . S TYPE=$P(^TMP("ORWGAPI",$J,SUB),U)
37 . D ITEMS^ORWGAPIR(.ITEMS,DFN,TYPE,6,OLDEST,NEWEST,.CNT,TMP)
38 K ^TMP("ORWGAPI",$J)
39 Q
40 ;
41DELVIEWS(DATA,NAME,PUBLIC) ; API - delete a graph view
42 D DELVIEWS^ORWGAPIP(.DATA,$G(NAME),$G(PUBLIC))
43 Q
44 ;
45DETAIL(DATA,DFN,DATE1,DATE2,VAL,COMP) ; API - get all reports for types of data from items and date range
46 D DETAIL^ORWGAPID("ORWGRPC",DFN,DATE1,DATE2,.VAL)
47 S DATA=$NA(^TMP("ORWGRPC",$J))
48 Q
49 ;
50DETAILS(DATA,DFN,DATE1,DATE2,TYPE,COMP) ; API - get report for type of data for a date or date range
51 D DETAILS^ORWGAPID("ORWGRPC",DFN,DATE1,DATE2,TYPE)
52 S DATA=$NA(^TMP("ORWGRPC",$J))
53 Q
54 ;
55GETDATES(DATA,REPORTID) ; API - get graph date ranges
56 N DAT,TMP K DAT
57 S REPORTID=$G(REPORTID)
58 D RETURN^ORWGAPIU(.TMP,.DATA)
59 S DAT(1)="S^Date Range..."
60 S DAT(2)="1^Today"
61 S DAT(3)="2^One Week"
62 S DAT(4)="3^Two Weeks"
63 S DAT(5)="4^One Month"
64 S DAT(6)="5^Six Months"
65 S DAT(7)="6^One Year"
66 S DAT(8)="7^Two Years"
67 S DAT(9)="8^All Results"
68 D DATES^ORWGAPIP(.DAT,REPORTID)
69 I TMP M ^TMP(DATA,$J)=DAT
70 I 'TMP M DATA=DAT
71 Q
72 ;
73GETPREF(DATA) ; API - get graph settings
74 D GETPREF^ORWGAPIP(.DATA)
75 Q
76 ;
77GETSIZE(DATA) ; API - get graph positions and sizes
78 D GETSIZE^ORWGAPIP(.DATA)
79 Q
80 ;
81GETVIEWS(DATA,ALL,PUBLIC,EXT) ; API - get graph views
82 D GETVIEWS^ORWGAPIP(.DATA,$G(ALL),$G(PUBLIC),$G(EXT))
83 Q
84 ;
85ITEMDATA(DATA,ITEM,START,DFN) ; API - return data of an item on patient (glucose results)
86 N CNT,FILE,TMP
87 S DFN=+$G(DFN) I 'DFN Q
88 S ITEM=$G(ITEM) I ITEM'[U Q
89 S START=$G(START,$$NOW^ORWGAPIX)
90 D RETURN^ORWGAPIU(.TMP,.DATA)
91 S FILE=$P(ITEM,U)
92 S ITEM=$P(ITEM,U,2)
93 S CNT=0
94 D DATA^ORWGAPIR(.DATA,ITEM,FILE,START,DFN,.CNT,TMP)
95 Q
96 ;
97ITEMS(ITEMS,DFN,TYPE) ; API - return items of a type of data on patient (lab tests)
98 N CNT,TMP
99 S DFN=+$G(DFN) I 'DFN Q
100 S TYPE=$G(TYPE) I '$L(TYPE) Q
101 D RETURN^ORWGAPIU(.TMP,.ITEMS)
102 S CNT=0
103 D ITEMS^ORWGAPIR(.ITEMS,DFN,TYPE,3,,,.CNT,TMP)
104 Q
105 ;
106LOOKUP(VAL,FILE,FROM,DIR) ; API - get item names for long lookup
107 N REF,SCREEN,XREF
108 D FILE^ORWGAPIU($G(FILE),.REF,.XREF,.SCREEN)
109 I '$L(REF) Q
110 D GENERIC^ORWGAPIU(.VAL,.FROM,DIR,FILE,REF,XREF,SCREEN)
111 Q
112 ;
113PUBLIC(USER) ; API - $$(user) -> 1 if user can edit public settings and views
114 Q $$PUBLIC^ORWGAPIP(USER)
115 ;
116RPTPARAM(IEN) ; API - $$(ien) -> PARAM1^PARAM2 for graph report else ""
117 Q $$RPTPARAM^ORWGAPIP(IEN)
118 ;
119SETPREF(DATA,VAL,PUBLIC) ; API - set a graph setting
120 D SETPREF^ORWGAPIP(.DATA,$G(VAL),$G(PUBLIC))
121 Q
122 ;
123SETSIZE(DATA,VAL) ; API - set graph positions and settings
124 D SETSIZE^ORWGAPIP(.DATA,.VAL)
125 Q
126 ;
127SETVIEWS(DATA,NAME,PUBLIC,VAL) ; API - set a graph view
128 D SETVIEWS^ORWGAPIP(.DATA,$G(NAME),$G(PUBLIC),.VAL)
129 Q
130 ;
131TAX(DATA,ALL,REMTAX) ; API - get reminder taxonomies
132 D TAX^ORWGAPID(.DATA,+$G(ALL),.REMTAX)
133 Q
134 ;
135TESTSPEC(DATA) ; API - return test/spec info on all lab tests
136 N CNT,LINE,TEST,TMP,SPEC
137 D RETURN^ORWGAPIU(.TMP,.DATA)
138 S CNT=0
139 S TEST=0
140 F S TEST=$O(^LAB(60,TEST)) Q:TEST<1 D
141 . S SPEC=0
142 . F S SPEC=$O(^LAB(60,TEST,1,SPEC)) Q:SPEC<1 D
143 .. S CNT=CNT+1
144 .. S LINE=TEST_U_$G(^LAB(60,TEST,1,SPEC,0))
145 .. I $P(LINE,U,3)[$C(34) S $P(LINE,U,3)=$$TRIM^ORWGAPIX($P(LINE,U,3),"LR",$C(34))
146 .. I $P(LINE,U,4)[$C(34) S $P(LINE,U,4)=$$TRIM^ORWGAPIX($P(LINE,U,4),"LR",$C(34))
147 .. I TMP S ^TMP(DATA,$J,CNT)=LINE Q
148 .. S DATA(CNT)=LINE
149 Q
150 ;
151TYPES(TYPES,DFN,SUB) ; API - return all types of data on patient (if no dfn, return all)
152 N TMP
153 S DFN=+$G(DFN)
154 S SUB=+$G(SUB)
155 D RETURN^ORWGAPIU(.TMP,.TYPES)
156 D TYPES^ORWGAPIT(.TYPES,DFN,SUB,TMP)
157 Q
Note: See TracBrowser for help on using the repository browser.