[613] | 1 | ORWGAPIA ; SLC/STAFF - Graph Application Calls ;2/22/07 11:16
|
---|
| 2 | ;;3.0;ORDER ENTRY/RESULTS REPORTING;**215,251,260,243**;Dec 17, 1997;Build 242
|
---|
| 3 | ;
|
---|
| 4 | ADMITX(DFN) ; $$(dfn) -> 1 if patient has data else 0
|
---|
| 5 | Q $O(^DGPM("C",+$G(DFN),0))>0
|
---|
| 6 | ;
|
---|
| 7 | ALLERGYX(DFN) ; $$(dfn) -> 1 if patient has data else 0
|
---|
| 8 | Q $O(^GMR(120.8,"B",+$G(DFN),0))>0
|
---|
| 9 | ;
|
---|
| 10 | ALLG(IEN) ; $$(ien) -> external display of allergies
|
---|
| 11 | I IEN Q $P($G(^GMRD(120.83,IEN,0)),U) ; this is for rxn, allergy is free text
|
---|
| 12 | Q IEN
|
---|
| 13 | ;
|
---|
| 14 | CPT(NODE,ORVALUE,VALUES) ; from ORWGAPI4
|
---|
| 15 | D VCPT^PXPXRM(NODE,.ORVALUE)
|
---|
| 16 | S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
|
---|
| 17 | Q
|
---|
| 18 | ;
|
---|
| 19 | DISCH(IEN) ; $$(pt movement ien) -> discharge date
|
---|
| 20 | Q $P($G(^DGPM(+$P($G(^DGPM(+$G(IEN),0)),U,17),0)),U)
|
---|
| 21 | ;
|
---|
| 22 | DOCCLASS(DOCTYPE) ; $$(doc type) -> ien of tiu doc class
|
---|
| 23 | N CONSULTS
|
---|
| 24 | S DOCTYPE=$E(DOCTYPE,1)
|
---|
| 25 | I DOCTYPE="P" Q 3
|
---|
| 26 | I DOCTYPE="D" Q 244
|
---|
| 27 | I DOCTYPE="C" D CNSLCLAS^TIUSRVD(.CONSULTS) Q CONSULTS
|
---|
| 28 | Q 0
|
---|
| 29 | ;
|
---|
| 30 | EDU(NODE,ORVALUE,VALUES) ; from ORWGAPI4
|
---|
| 31 | D VPEDU^PXPXRM(NODE,.ORVALUE)
|
---|
| 32 | S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
|
---|
| 33 | Q
|
---|
| 34 | ;
|
---|
| 35 | EXAM(NODE,ORVALUE,VALUES) ; from ORWGAPI4
|
---|
| 36 | D VXAM^PXPXRM(NODE,.ORVALUE)
|
---|
| 37 | S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
|
---|
| 38 | Q
|
---|
| 39 | ;
|
---|
| 40 | GETTIU(ORDATA,IEN) ; from ORWGAPID
|
---|
| 41 | D TGET^TIUSRVR1(.ORDATA,IEN)
|
---|
| 42 | Q
|
---|
| 43 | ;
|
---|
| 44 | HF(NODE,ORVALUE,VALUES) ; from ORWGAPI4
|
---|
| 45 | D VHF^PXPXRM(NODE,.ORVALUE)
|
---|
| 46 | S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
|
---|
| 47 | Q
|
---|
| 48 | ;
|
---|
| 49 | ICD0(IEN) ; $$(ien) -> external display of IDC0
|
---|
| 50 | Q $P($G(^ICD0(IEN,0)),U)_" "_$P($G(^ICD0(IEN,0)),U,4)
|
---|
| 51 | ;
|
---|
| 52 | ICD9(IEN) ; $$(ien) -> external display of IDC9
|
---|
| 53 | Q $P($G(^ICD9(IEN,0)),U)_" "_$P($G(^ICD9(IEN,0)),U,3)
|
---|
| 54 | ;
|
---|
| 55 | ICPT(IEN,CSD) ; $$(ien) -> external display of CPT
|
---|
| 56 | N X S X=$$CPT^ICPTCOD($G(IEN),$G(CSD))
|
---|
| 57 | Q $P(X,U,2)_" "_$E($P(X,U,3),1,30)
|
---|
| 58 | ;
|
---|
| 59 | IMM(NODE,ORVALUE,VALUES) ; from ORWGAPI4
|
---|
| 60 | D VIMM^PXPXRM(NODE,.ORVALUE)
|
---|
| 61 | S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
|
---|
| 62 | Q
|
---|
| 63 | ;
|
---|
| 64 | ISA(USER,CLASS,ORERR) ; $$(user,user class,err) -> 1 if user in class, else 0
|
---|
| 65 | Q $$ISA^USRLM(USER,CLASS,.ORERR)
|
---|
| 66 | ;
|
---|
| 67 | LOS(DGPMIFN) ; $$(pt movement ien) -> length of stay
|
---|
| 68 | N X D ^DGPMLOS
|
---|
| 69 | Q +$P($G(X),U,5)
|
---|
| 70 | ;
|
---|
| 71 | MEDICINE(ARRAY,DFN) ;
|
---|
| 72 | N DATE,FILE,IEN,NAME,NUM,REF,VALUES,XREF
|
---|
| 73 | K ARRAY,^TMP("MCAR",$J),^TMP("OR",$J,"MCAR")
|
---|
| 74 | D FILE^ORWGAPIU(690,.REF,.XREF)
|
---|
| 75 | I '$L(REF) Q
|
---|
| 76 | I $E(REF,$L(REF))="," S REF=$E(REF,1,$L(REF)-1)_")"
|
---|
| 77 | I $E(REF,$L(REF))="(" S REF=$P(REF,"(")
|
---|
| 78 | D EN^MCARPS2(DFN)
|
---|
| 79 | S NUM=0
|
---|
| 80 | F S NUM=$O(^TMP("OR",$J,"MCAR","OT",NUM)) Q:NUM<1 D
|
---|
| 81 | . S VALUES=^TMP("OR",$J,"MCAR","OT",NUM)
|
---|
| 82 | . S DATE=$$DATETFM^ORWGAPIW($P(VALUES,U,6))
|
---|
| 83 | . S NAME=$P(VALUES,U) I '$L(NAME) Q
|
---|
| 84 | . S IEN=+$O(@REF@(XREF,NAME,""))
|
---|
| 85 | . I DATE,IEN S ARRAY(IEN,DATE)=NAME
|
---|
| 86 | K ^TMP("MCAR",$J),^TMP("OR",$J,"MCAR")
|
---|
| 87 | Q
|
---|
| 88 | ;
|
---|
| 89 | MEDVAL(VAL) ;
|
---|
| 90 | N IEN,NAME,NAMES,REF,SEQ,XREF K NAMES,VAL
|
---|
| 91 | D FILE^ORWGAPIU(690,.REF,.XREF)
|
---|
| 92 | I '$L(REF) Q
|
---|
| 93 | I $E(REF,$L(REF))="," S REF=$E(REF,1,$L(REF)-1)_")"
|
---|
| 94 | I $E(REF,$L(REF))="(" S REF=$P(REF,"(")
|
---|
| 95 | S NAME=""
|
---|
| 96 | F S NAME=$O(@REF@(XREF,NAME)) Q:NAME="" D
|
---|
| 97 | . S IEN=0
|
---|
| 98 | . F S IEN=$O(@REF@(XREF,NAME,IEN)) Q:IEN<1 D
|
---|
| 99 | .. S NAMES(IEN)=NAME
|
---|
| 100 | S SEQ=0
|
---|
| 101 | S IEN=0
|
---|
| 102 | F S IEN=$O(NAMES(IEN)) Q:IEN<1 D
|
---|
| 103 | . S SEQ=SEQ+1
|
---|
| 104 | . S VAL(SEQ)=690_U_IEN_U_NAMES(IEN)
|
---|
| 105 | Q
|
---|
| 106 | ;
|
---|
| 107 | MH(ORVALUE,NODE,VALUES) ; from ORWGAPI4
|
---|
| 108 | D ENDAS^YTAPI10(.ORVALUE,NODE)
|
---|
| 109 | S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
|
---|
| 110 | Q
|
---|
| 111 | ;
|
---|
| 112 | NOTEX(DFN) ; $$(dfn) -> 1 if patient has data else 0
|
---|
| 113 | Q $$HASDOCMT^TIULX($G(DFN))
|
---|
| 114 | ;
|
---|
| 115 | OITEM(DATA) ; API - get order display groups - from ORWGAPI
|
---|
| 116 | N CNT,IEN,RESULT,TMP,ZERO
|
---|
| 117 | D RETURN^ORWGAPIW(.TMP,.DATA)
|
---|
| 118 | S CNT=0
|
---|
| 119 | S IEN=0
|
---|
| 120 | F S IEN=$O(^ORD(100.98,IEN)) Q:IEN<1 D
|
---|
| 121 | . S ZERO=$G(^ORD(100.98,IEN,0)) I '$L(ZERO) Q
|
---|
| 122 | . S RESULT="100.98^"_IEN_U_$P(ZERO,U)_U_$P(ZERO,U,3)
|
---|
| 123 | . D SETUP^ORWGAPIW(.DATA,RESULT,TMP,.CNT)
|
---|
| 124 | Q
|
---|
| 125 | ;
|
---|
| 126 | POV(NODE,ORVALUE,VALUES) ; from ORWGAPI4
|
---|
| 127 | D VPOV^PXPXRM(NODE,.ORVALUE)
|
---|
| 128 | S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
|
---|
| 129 | Q
|
---|
| 130 | ;
|
---|
| 131 | PROB(GMPLLEX,GMPLSTAT,GMPLICD,GMPLODAT,GMPLXDAT,NODE) ; from ORWGAPI4
|
---|
| 132 | N GMPLPNAM,GMPLDLM,GMPLTXT,GMPLCOND,GMPLPRV,GMPLPRIO
|
---|
| 133 | D CALL2^GMPLUTL3(NODE)
|
---|
| 134 | Q
|
---|
| 135 | ;
|
---|
| 136 | PTF(NODE,ORVALUE,VALUES) ; from ORWGAPI3, ORWGAPI4
|
---|
| 137 | D PTF^DGPTPXRM(NODE,.ORVALUE)
|
---|
| 138 | S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
|
---|
| 139 | Q
|
---|
| 140 | ;
|
---|
| 141 | RAD(NODE,ORVALUE,VALUES) ; from ORWGAPI3
|
---|
| 142 | D EN1^RAPXRM(NODE,.ORVALUE)
|
---|
| 143 | S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
|
---|
| 144 | Q
|
---|
| 145 | ;
|
---|
| 146 | SKIN(NODE,ORVALUE,VALUES) ; from ORWGAPI4
|
---|
| 147 | D VSKIN^PXPXRM(NODE,.ORVALUE)
|
---|
| 148 | S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
|
---|
| 149 | Q
|
---|
| 150 | ;
|
---|
| 151 | SURG(ORSURG,DFN,VALUES) ; from ORWGAPI2, ORWGAPI4
|
---|
| 152 | D GET^SROGTSR(.ORSURG,DFN)
|
---|
| 153 | S VALUES=$$DATA^ORWGAPIW(.ORSURG) ;*****************************
|
---|
| 154 | Q
|
---|
| 155 | ;
|
---|
| 156 | SURGX(DFN) ; $$(dfn) -> 1 if patient has data else 0
|
---|
| 157 | Q $O(^SRF("B",+$G(DFN),0))>0
|
---|
| 158 | ;
|
---|
| 159 | TAX(IEN) ; $$(ien) -> external display of reminder taxonomy
|
---|
| 160 | Q $P($G(^PXD(811.2,+$G(IEN),0)),U)
|
---|
| 161 | ;
|
---|
| 162 | TITLE(DOCTYPE) ; $$(document type) -> parent ien^parent^parent abbrev
|
---|
| 163 | N IEN,RESULTS K RESULTS
|
---|
| 164 | S DOCTYPE=+$G(^TIU(8925,+$G(DOCTYPE),0))
|
---|
| 165 | S IEN=+$$DOCCLASS^TIULC1(DOCTYPE) I 'IEN Q ""
|
---|
| 166 | D GETDATA^ORWGAPIX(.RESULTS,8925.1,".01;.02",IEN)
|
---|
| 167 | I '$L($G(RESULTS(.01))) Q ""
|
---|
| 168 | Q IEN_U_"note - "_RESULTS(.01)_U_$G(RESULTS(.02))
|
---|
| 169 | ;
|
---|
| 170 | TIU(ORVALUE,DOCIEN,ONE,DFN,OLDEST,NEWEST) ; from ORWGAPI1, ORWGAPI3
|
---|
| 171 | D CONTEXT^TIUSRVLO(.ORVALUE,DOCIEN,ONE,DFN,$G(OLDEST),$G(NEWEST))
|
---|
| 172 | Q
|
---|
| 173 | ;
|
---|
| 174 | TIUTITLE(DATA) ; API - get tiu document titles - from ORWGAPI
|
---|
| 175 | N CNT,IEN,RESULT,RESULTS,TMP K ^TMP("TIUTLS",$J)
|
---|
| 176 | D RETURN^ORWGAPIW(.TMP,.DATA)
|
---|
| 177 | S CNT=0
|
---|
| 178 | D TITLIENS^TIULX
|
---|
| 179 | S IEN=0
|
---|
| 180 | F S IEN=$O(^TMP("TIUTLS",$J,IEN)) Q:IEN<1 D
|
---|
| 181 | . K RESULTS
|
---|
| 182 | . D GETDATA^ORWGAPIX(.RESULTS,8925.1,".01;.02",IEN)
|
---|
| 183 | . I '$L($G(RESULTS(.01))) Q
|
---|
| 184 | . S RESULT="8925.1^"_IEN_U_RESULTS(.01)_U_$G(RESULTS(.02))
|
---|
| 185 | . D SETUP^ORWGAPIW(.DATA,RESULT,TMP,.CNT)
|
---|
| 186 | K ^TMP("TIUTLS",$J)
|
---|
| 187 | Q
|
---|
| 188 | ;
|
---|
| 189 | VISITX(DFN) ; $$(dfn) -> 1 if patient has data else 0
|
---|
| 190 | Q $O(^AUPNVSIT("AET",+$G(DFN),0))>0
|
---|
| 191 | ;
|
---|
| 192 | VITAL(ORVALUE,NODE,VALUES) ; from ORWGAPI4
|
---|
| 193 | D EN^GMVPXRM(.ORVALUE,NODE)
|
---|
| 194 | S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
|
---|
| 195 | Q
|
---|
| 196 | ;
|
---|