source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORWGAPIR.m@ 949

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

revised back to 6/30/08 version

File size: 6.9 KB
Line 
1ORWGAPIR ; SLC/STAFF - Graph API Router ;8/21/06 07:52
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**215,260**;Dec 17, 1997;Build 26
3 ;
4DATA(DATA,ITEM,FILE,START,DFN,CNT,TMP) ; from ORWGAPI
5 S DFN=+$G(DFN) I 'DFN Q
6 S FILE=$G(FILE) I '$L(FILE) Q
7 S ITEM=$G(ITEM) I '$L(ITEM) Q
8 I FILE=52 D OUTRX^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
9 I FILE=53.79 D BCMA^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
10 I FILE=55 D INRX^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
11 I FILE="55NVAE" D NVAE^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
12 I FILE="55NVA" D NVA^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
13 I FILE=63 D LAB^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
14 I FILE="63AP" D LAB^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
15 I FILE="63BB" D BBDATA^ORWGAPIB(.DATA,ITEM,START,DFN,.CNT,TMP) Q
16 I FILE="63MI" D LAB^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
17 I FILE=70 D RAD^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
18 I FILE=100 D ORDER^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
19 I FILE=120.5 D VITAL^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
20 I FILE=120.8 D ADVERSE^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
21 I FILE=601.2 D MH^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
22 I FILE=9000010.07 D POV^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
23 I FILE=9000010.11 D IMM^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
24 I FILE=9000010.12 D SKIN^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
25 I FILE=9000010.13 D EXAM^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
26 I FILE=9000010.16 D EDU^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
27 I FILE=9000010.18 D PROC^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
28 I FILE=9000010.23 D HF^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
29 I FILE=9000011 D PROB^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
30 I FILE=9999911 D PROBX^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
31 I FILE="45OP" D OP^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
32 I FILE="45DX" D DX^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
33 I FILE=9000010 D VISIT^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
34 I FILE=405 D ADMIT^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
35 I FILE=130 D SURG^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
36 I FILE=8925 D NOTE^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
37 I FILE=9000010.15 D TREAT^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP) Q
38 I FILE=690 D MED^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP) Q
39 Q
40 ;
41ITEMS(ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,CNT,TMP) ; from ORWGAPI
42 S FMT=$G(FMT,3),OLDEST=+$G(OLDEST),NEWEST=+$G(NEWEST),CNT=+$G(CNT)
43 I (TYPE=70)!(TYPE=100)!(TYPE=120.5)!(TYPE=601.2) D STD(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP) Q
44 I (TYPE=9000010.11)!(TYPE=9000010.12)!(TYPE=9000010.13) D STD(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP) Q
45 I (TYPE=9000010.15)!(TYPE=9000010.16)!(TYPE=9000010.23) D STD(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP) Q
46 I (TYPE=9000010.07)!(TYPE=9000010.18) D STD1(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP) Q
47 I (TYPE=52)!(TYPE=55) D STD2(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP) Q
48 I TYPE=63 D LAB^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
49 I TYPE=9000010 D VISITS^ORWGAPI2(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
50 I TYPE=9000010.15 D TREAT^ORWGAPI2(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
51 I TYPE=9000011 D PL^ORWGAPI2(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
52 I TYPE=9999911 D PLX^ORWGAPI2(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
53 I TYPE=405 D ADMITS^ORWGAPI2(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
54 I TYPE=50.605 D DC^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
55 I TYPE=68 D AA^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
56 I TYPE=8925.1 D TITLE^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
57 I TYPE=53.79 D BCMA^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
58 I TYPE=120.8 D ADVERSE^ORWGAPI2(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
59 I TYPE=130 D SURGERY^ORWGAPI2(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
60 I TYPE=8925 D NOTES^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
61 I TYPE=690 D MED^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
62 S TYPE=$$UP^ORWGAPIX(TYPE)
63 I $E(TYPE,1,2)=45 D REG^ORWGAPI2(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP) Q
64 I TYPE="55NVAE" D NVAE^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
65 I TYPE="55NVA" D NVA^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
66 I TYPE="63AP" D AP^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
67 I TYPE="63BB" D BBITEM^ORWGAPIB(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
68 I TYPE="63MI" D MI^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
69 Q
70 ;
71STD(ITEMS,DFN,FILE,FMT,OLDEST,NEWEST,CNT,TMP) ;
72 N DATE,ITEM,OK,RESULT
73 S ITEM=""
74 F S ITEM=$O(^PXRMINDX(FILE,"PI",DFN,ITEM)) Q:ITEM="" D
75 . S OK=0
76 . I FMT=6 D
77 .. S DATE=OLDEST
78 .. F S DATE=$O(^PXRMINDX(FILE,"PI",DFN,ITEM,DATE)) Q:DATE="" Q:DATE>NEWEST D Q:OK
79 ... S CNT=CNT+1
80 ... S OK=1
81 ... S RESULT=FILE_U_ITEM
82 . I FMT=3 D
83 .. S DATE=$O(^PXRMINDX(FILE,"PI",DFN,ITEM,""),-1)
84 .. I 'DATE Q
85 .. S CNT=CNT+1
86 .. S OK=1
87 .. S RESULT=FILE_U_ITEM_"^^"_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)_"^^"_DATE
88 .. I FILE=100 S RESULT=RESULT_U_$$OGROUP^ORWGAPIU(ITEM)
89 . I FMT=0 D
90 .. S CNT=CNT+1
91 .. S OK=1
92 .. S RESULT=FILE_U_ITEM_U_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)
93 . I OK D SETUP^ORWGAPIU(.ITEMS,RESULT,TMP,.CNT)
94 I FILE=120.5 D BMIITEMS^ORWGAPIX(.ITEMS,.CNT,TMP) Q
95 Q
96 ;
97STD1(ITEMS,DFN,FILE,FMT,OLDEST,NEWEST,CNT,TMP) ;
98 N DATE,ITEM,OK,RESULT,TYPE
99 K ^TMP("ORWGRPC TEMP",$J)
100 S TYPE=""
101 F S TYPE=$O(^PXRMINDX(FILE,"PPI",DFN,TYPE)) Q:TYPE="" D
102 . S ITEM=""
103 . F S ITEM=$O(^PXRMINDX(FILE,"PPI",DFN,TYPE,ITEM)) Q:ITEM="" D
104 .. S OK=0
105 .. I FMT=6 D
106 ... S DATE=OLDEST
107 ... F S DATE=$O(^PXRMINDX(FILE,"PPI",DFN,TYPE,ITEM,DATE)) Q:DATE="" Q:DATE>NEWEST D Q:OK
108 .... S CNT=CNT+1
109 .... S OK=1
110 .... S RESULT=FILE_U_ITEM
111 .. I FMT=3 D
112 ... S DATE=$O(^PXRMINDX(FILE,"PPI",DFN,TYPE,ITEM,""),-1)
113 ... I DATE S ^TMP("ORWGRPC TEMP",$J,ITEM,DATE)=""
114 .. I FMT=0 D
115 ... S CNT=CNT+1
116 ... S OK=1
117 ... S RESULT=FILE_U_ITEM_U_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)
118 .. I OK D SETUP^ORWGAPIU(.ITEMS,RESULT,TMP,.CNT)
119 I FMT=3 D
120 . S ITEM=""
121 . F S ITEM=$O(^TMP("ORWGRPC TEMP",$J,ITEM)) Q:ITEM="" D
122 .. S DATE=$O(^TMP("ORWGRPC TEMP",$J,ITEM,""),-1)
123 .. I 'DATE Q
124 .. S CNT=CNT+1
125 .. S RESULT=FILE_U_ITEM_"^^"_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)_"^^"_DATE
126 .. D SETUP^ORWGAPIU(.ITEMS,RESULT,TMP,.CNT)
127 K ^TMP("ORWGRPC TEMP",$J)
128 Q
129 ;
130STD2(ITEMS,DFN,FILE,FMT,OLDEST,NEWEST,CNT,TMP) ;
131 N DATE,DATE2,ITEM,OK,RESULT
132 S ITEM=""
133 F S ITEM=$O(^PXRMINDX(FILE,"PI",DFN,ITEM)) Q:ITEM="" D
134 . S OK=0
135 . I FMT=6 D
136 .. S DATE=0
137 .. F S DATE=$O(^PXRMINDX(FILE,"PI",DFN,ITEM,DATE)) Q:DATE="" Q:DATE>NEWEST D Q:OK
138 ... S DATE2=""
139 ... F S DATE2=$O(^PXRMINDX(FILE,"PI",DFN,ITEM,DATE,DATE2)) Q:DATE2="" D
140 .... I DATE2<OLDEST Q
141 .... S CNT=CNT+1
142 .... S OK=1
143 .... S RESULT=FILE_U_ITEM
144 . I FMT=3 D
145 .. S DATE=$O(^PXRMINDX(FILE,"PI",DFN,ITEM,""),-1)
146 .. I 'DATE Q
147 .. S CNT=CNT+1
148 .. S OK=1
149 .. S RESULT=FILE_U_ITEM_"^^"_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)_"^^"_DATE
150 .. S RESULT=RESULT_U_$$DRGCLASS^ORWGAPIA(ITEM)
151 . I FMT=0 D
152 .. S CNT=CNT+1
153 .. S OK=1
154 .. S RESULT=FILE_U_ITEM_U_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)
155 .. S RESULT=RESULT_U_$$DRGCLASS^ORWGAPIA(ITEM)
156 . I OK D SETUP^ORWGAPIU(.ITEMS,RESULT,TMP,.CNT)
157 Q
158 ;
Note: See TracBrowser for help on using the repository browser.