source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORWGAPIW.m@ 1361

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

initial load of WorldVistAEHR

File size: 3.3 KB
RevLine 
[613]1ORWGAPIW ; SLC/STAFF - Graph API Utilities, Generic ;8/19/06 15:20
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**243**;Dec 17, 1997;Build 242
3 ;
4DATA(ARRAY) ; $$(application results) -> single string of results
5 N NUM,RESULT,SUB
6 S OUT=""
7 S SUB=""
8 F S SUB=$O(ARRAY(SUB)) Q:SUB="" D
9 . I $D(ARRAY(SUB,0)) D Q
10 .. S OUT=OUT_SUB_"["
11 .. S NUM=0
12 .. F S NUM=$O(ARRAY(SUB,NUM)) Q:NUM<1 D
13 ... S RESULT=$G(ARRAY(SUB,NUM,0))
14 ... S OUT=OUT_RESULT_";"
15 .. S OUT=OUT_"]"
16 . S RESULT=$G(ARRAY(SUB))
17 . S OUT=OUT_SUB_"["_RESULT_"]"
18 S OUT=$TR(OUT,U,"~")
19 Q OUT
20 ;
21DATETFM(DATETIME) ; $$(external date/time) -> fm date/time else 0
22 N DATE,DAY,FMDT,HOUR,MIN,SEC,TIME,YEAR
23 S DATE=$P(DATETIME,"@"),TIME=$P(DATETIME,"@",2)
24 S YEAR=$P(DATE,",",2) I $L(YEAR)'=4 Q 0
25 S YEAR=YEAR-1700 I YEAR<270 Q 0
26 S MONTH=$P(DATE," ")
27 S MONTH=$$MTN(MONTH) I MONTH<1 Q 0
28 I MONTH<10 S MONTH="0"_MONTH
29 S DAY=$P(DATE," ",2),DAY=$P(DAY,",")
30 I DAY<1 Q 0
31 I DAY<10 S DAY="0"_DAY
32 S HOUR=$P(TIME,":")
33 S MIN=$P(TIME,":",2)
34 S SEC=$P(TIME,":",3)
35 S TIME=HOUR_MIN_SEC
36 S FMDT=YEAR_MONTH_DAY
37 I '$L(TIME) Q FMDT
38 Q FMDT_"."_TIME
39 ;
40GENERIC(VAL,FROM,DIR,FILE,REF,XREF,SCREEN) ; Return a set of entries from xref in REF
41 ; from ORWGAPI
42 ; .VAL=returned list, FROM=text to $O from, DIR=$O direction,
43 N CNT,IEN,NAME,NEXTNAME,NUM,OK,ROOT,ZERO S NUM=0,CNT=44 K VAL
44 I FILE=405 Q
45 S ROOT=""
46 S FROM=$$UP^ORWGAPIX(FROM)
47 I $E(REF,$L(REF))="," S ROOT=$E(REF,1,$L(REF)-1)_")"
48 I $E(REF,$L(REF))="(" S ROOT=$P(REF,"(")
49 I '$L(ROOT) Q
50 S REF=REF_""""_XREF_""")"
51 F Q:NUM'<CNT S FROM=$O(@REF@(FROM),DIR) Q:FROM="" D
52 . S IEN="" F S IEN=$O(@REF@(FROM,IEN),DIR) Q:'IEN D
53 .. I FILE=100,$O(@REF@(FROM,IEN,""))>0 Q
54 .. S ZERO=$G(@ROOT@(IEN,0)) I '$L(ZERO) Q
55 .. X SCREEN I '$T Q
56 .. S NUM=NUM+1
57 .. I FILE="45DX"!(FILE=9000010.07)!(FILE=9000011)!(FILE="63AP;I") D Q
58 ... S VAL(NUM)=FILE_U_IEN_U_$$ICD9^ORWGAPIA(IEN) Q
59 .. I FILE="45OP" S VAL(NUM)=FILE_U_IEN_U_$$ICD0^ORWGAPIA(IEN) Q
60 .. I FILE=53.79 S VAL(NUM)=FILE_U_IEN_U_$$POINAME^ORWGAPIC(IEN) Q
61 .. I FILE="55NVA" S VAL(NUM)=FILE_U_IEN_U_$$POINAME^ORWGAPIC(IEN) Q
62 .. I FILE=9000010.18 S VAL(NUM)=FILE_U_IEN_U_$$ICPT^ORWGAPIA(IEN) Q
63 .. I FILE=130 S VAL(NUM)=FILE_U_IEN_U_$$ICPT^ORWGAPIA(IEN) Q
64 .. S VAL(NUM)=FILE_U_IEN_U_FROM
65 I FILE=120.5 D
66 . S (NUM,OK)=0
67 . F S NUM=$O(VAL(NUM)) Q:NUM<1 D Q:OK
68 .. S NAME=$P(VAL(NUM),U,3)
69 .. S NEXTNAME=$P($G(VAL(NUM+1)),U,3)
70 .. I "BODY MASS INDEX"]NAME,NEXTNAME]"BODY MASS INDEX" D
71 ... S OK=1
72 ... S VAL(NUM+.5)="120.5^99999^BODY MASS INDEX"
73 Q
74 ;
75MTN(MONTH) ; $$(external month) -> month number
76 N MONTHS,NUM
77 I $L(MONTH)'=3 Q 0
78 S MONTHS="JAN^FEB^MAR^APR^MAY^JUN^JUL^AUG^SEP^OCT^NOV^DEC"
79 F NUM=1:1:13 I $P(MONTHS,U,NUM)=MONTH Q
80 I NUM=13 Q 0
81 Q NUM
82 ;
83OGROUP(OITEM) ; $$(orderable item) -> ien display group^display group - from ORWGAPIR
84 N IEN
85 S IEN=+$P($G(^ORD(101.43,+$G(OITEM),0)),U,5)
86 Q IEN_U_"order - "_$P($G(^ORD(100.98,IEN,0)),U)
87 ;
88RETURN(TMP,ITEMS) ; return TMP (0 use local, 1 use ^TMP(ITEMS,$J, where ITEMS is a namespaced string)
89 ; from ORWGAPI, ORWGAPIP, ORWGAPIX
90 N NMSP
91 S NMSP=$G(ITEMS) K ITEMS S ITEMS=""
92 S TMP=NMSP?1U1UN1.14UNP
93 I TMP S ITEMS=NMSP
94 Q
95 ;
96SETUP(DATA,RESULT,TMP,CNT) ; from ORWGAPI1, ORWGAPI2, ORWGAPI3, ORWGAPI4, ORWGAPIP, ORWGAPIR, ORWGAPIX
97 S CNT=CNT+1
98 I TMP=2 S ^TMP(DATA,$J,$P(RESULT,U,1,2))=RESULT Q
99 I TMP S ^TMP(DATA,$J,CNT)=RESULT
100 I 'TMP S DATA(CNT)=RESULT
101 Q
102 ;
Note: See TracBrowser for help on using the repository browser.