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

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

initial load of WorldVistAEHR

File size: 3.1 KB
Line 
1ORWGAPIE ; SLC/STAFF - Graph API Details, Medicine, NVAMeds ;12/21/05 08:19
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**243**;Dec 17, 1997;Build 242
3 ;
4MED1(ITEMS,DFN,FMT,OLDEST,NEWEST,CNT,TMP) ; from ORWGAPI1
5 N DATE,ITEM,OK,MEDARRAY,RESULT K MEDARRAY
6 D MEDICINE^ORWGAPIA(.MEDARRAY,DFN)
7 S ITEM=0
8 F S ITEM=$O(MEDARRAY(ITEM)) Q:ITEM<1 D
9 . S OK=0
10 . I FMT=6 D
11 .. S DATE=OLDEST
12 .. F S DATE=$O(MEDARRAY(ITEM,DATE)) Q:DATE="" Q:DATE>NEWEST D Q:OK
13 ... S CNT=CNT+1
14 ... S OK=1
15 ... S RESULT=690_U_ITEM
16 ... D SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
17 . I FMT'=6 D
18 .. S DATE=$O(MEDARRAY(ITEM,""),-1)
19 .. I 'DATE Q
20 .. S NAME=MEDARRAY(ITEM,DATE)
21 .. I '$L(NAME) Q
22 .. S CNT=CNT+1
23 .. S OK=1
24 .. I FMT=3 S RESULT=690_U_ITEM_"^^"_NAME_"^^"_DATE
25 .. I FMT=0 S RESULT=690_U_ITEM_U_NAME
26 . I OK D SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
27 Q
28 ;
29MED3(DATA,ITEM,START,DFN,CNT,TMP) ; from ORWGAPI3
30 N DATE,DATE2,DATESTOP,DATESTRT,DTPLUS1,NODE,RESULT,STATUS,VALUE K VALUE
31 D MEDICINE^ORWGAPIA(.MEDARRAY,DFN)
32 S ITEM=+$G(ITEM)
33 S CNT=$G(CNT)
34 S DATE=""
35 F S DATE=$O(MEDARRAY(ITEM,DATE)) Q:DATE="" D
36 . I DATE>START Q
37 . S RESULT=690_U_ITEM_U_DATE_"^^"
38 . D SETUP^ORWGAPIW(.DATA,RESULT,TMP,.CNT)
39 Q
40 ;
41NVA1(ITEMS,DFN,FMT,OLDEST,NEWEST,CNT,TMP) ; from ORWGAPI1
42 N DATA,DATE,DATE1,DATESTRT,DRUG,ITEM,OK,REF,RESULT K DATA
43 S ITEM=""
44 F S ITEM=$O(^PXRMINDX("55NVA","PI",DFN,ITEM)) Q:ITEM="" D
45 . S OK=0
46 . I FMT=6 D
47 .. S DATE=0
48 .. F S DATE=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE)) Q:DATE="" Q:DATE>NEWEST D Q:OK
49 ... S DATE1=""
50 ... F S DATE1=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE,DATE1)) Q:DATE1="" D Q:OK
51 .... I DATE1'["U",DATE1<OLDEST Q
52 .... S CNT=CNT+1
53 .... S OK=1
54 .... S RESULT="55NVA"_U_ITEM
55 . I FMT'=6 D
56 .. S DATE=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,""),-1)
57 .. I 'DATE Q
58 .. S DATE1=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE,""),-1)
59 .. I '$L(DATE1) Q
60 .. S REF=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE,DATE1,""),-1)
61 .. I '$L(REF) Q
62 .. D RXNVA^ORWGAPIC(REF,.DATA)
63 .. S DRUG=+$G(DATA("DISPENSE DRUG"))
64 .. S DATESTRT=+$G(DATA("START DATE"))
65 .. I 'DATESTRT Q
66 .. S CNT=CNT+1
67 .. S OK=1
68 .. I FMT=3 S RESULT="55NVA"_U_ITEM_"^^"_$$EVALUE^ORWGAPIU(ITEM,"55NVA",.01)_"^^"_DATESTRT
69 .. I FMT=0 S RESULT="55NVA"_U_ITEM_U_$$EVALUE^ORWGAPIU(ITEM,"55NVA",.01)
70 .. I DRUG S RESULT=RESULT_U_$$DRGCLASS^ORWGAPIC(DRUG)
71 . I OK D SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
72 Q
73 ;
74NVA3(DATA,ITEM,START,DFN,CNT,TMP) ; from ORWGAPI3
75 N DATE1,DATE2,DATESTOP,DATESTRT,DTPLUS1,NODE,RESULT,STATUS,VALUE K VALUE
76 S CNT=$G(CNT),DTPLUS1=$$FMADD^ORWGAPIX(DT,1)
77 S DATE1=""
78 F S DATE1=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE1)) Q:DATE1="" D
79 . I DATE1>START Q
80 . S DATE2=""
81 . F S DATE2=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE1,DATE2)) Q:DATE2="" D
82 .. S NODE=""
83 .. F S NODE=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE1,DATE2,NODE)) Q:NODE="" D
84 ... D RXNVA^ORWGAPIC(NODE,.VALUE)
85 ... S STATUS=$G(VALUE("STATUS"))
86 ... S DATESTRT=+$G(VALUE("START DATE"))
87 ... I 'DATESTRT Q
88 ... S DATESTOP=+$G(VALUE("DISCONTINUED DATE"))
89 ... I 'DATESTOP S DATESTOP=DTPLUS1
90 ... S STATUS=STATUS_" "_$$NVASIG^ORWGAPIC(NODE)
91 ... S RESULT="55NVA"_U_ITEM_U_DATESTRT_U_DATESTOP_U_STATUS
92 ... D SETUP^ORWGAPIW(.DATA,RESULT,TMP,.CNT)
93 Q
94 ;
Note: See TracBrowser for help on using the repository browser.