Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ORWGAPIA

ORWGAPIA.m

Go to the documentation of this file.
  1. ORWGAPIA ; SLC/STAFF - Graph Application Calls ;07/16/13 13:20
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**215,251,260,243,372,361**;Dec 17, 1997;Build 39
  1. ;
  1. ; External References:
  1. ; $$ICDDATA^ICDXCODE ICR #5699
  1. ; $$CPT^ICPTCOD ICR #1995
  1. ; $$DOCCLASS^TIULC1 ICR #3548
  1. ; $$HASDOCMT^TIULX ICR #4315
  1. ; $$ISA^USRLM ICR #1544
  1. ;
  1. ADMITX(DFN) ; $$(dfn) -> 1 if patient has data else 0
  1. Q $O(^DGPM("C",+$G(DFN),0))>0
  1. ;
  1. ALLERGYX(DFN) ; $$(dfn) -> 1 if patient has data else 0
  1. Q $O(^GMR(120.8,"B",+$G(DFN),0))>0
  1. ;
  1. ALLG(IEN) ; $$(ien) -> external display of allergies
  1. I IEN Q $P($G(^GMRD(120.83,IEN,0)),U) ; this is for rxn, allergy is free text
  1. Q IEN
  1. ;
  1. CPT(NODE,ORVALUE,VALUES) ; from ORWGAPI4
  1. D VCPT^PXPXRM(NODE,.ORVALUE)
  1. S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
  1. Q
  1. ;
  1. DISCH(IEN) ; $$(pt movement ien) -> discharge date
  1. Q $P($G(^DGPM(+$P($G(^DGPM(+$G(IEN),0)),U,17),0)),U)
  1. ;
  1. DOCCLASS(DOCTYPE) ; $$(doc type) -> ien of tiu doc class
  1. N CONSULTS
  1. S DOCTYPE=$E(DOCTYPE,1)
  1. I DOCTYPE="P" Q 3
  1. I DOCTYPE="D" Q 244
  1. I DOCTYPE="C" D CNSLCLAS^TIUSRVD(.CONSULTS) Q CONSULTS
  1. Q 0
  1. ;
  1. EDU(NODE,ORVALUE,VALUES) ; from ORWGAPI4
  1. D VPEDU^PXPXRM(NODE,.ORVALUE)
  1. S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
  1. Q
  1. ;
  1. EXAM(NODE,ORVALUE,VALUES) ; from ORWGAPI4
  1. D VXAM^PXPXRM(NODE,.ORVALUE)
  1. S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
  1. Q
  1. ;
  1. GETTIU(ORDATA,IEN) ; from ORWGAPID
  1. D TGET^TIUSRVR1(.ORDATA,IEN)
  1. Q
  1. ;
  1. HF(NODE,ORVALUE,VALUES) ; from ORWGAPI4
  1. D VHF^PXPXRM(NODE,.ORVALUE)
  1. S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
  1. Q
  1. ;
  1. ICD0(IEN) ; $$(ien) -> external display of IDC0
  1. N INFO
  1. S INFO=$$ICDDATA^ICDXCODE("PROCEDURE",IEN,DT)
  1. I INFO<0 Q ""
  1. Q $P(INFO,U,2)_" "_$P(INFO,U,5)
  1. ;
  1. ICD9(IEN) ; $$(ien) -> external display of IDC9
  1. N INFO
  1. S INFO=$$ICDDATA^ICDXCODE("DIAGNOSIS",IEN,DT)
  1. I INFO<0 Q ""
  1. Q $P(INFO,U,2)_" "_$P(INFO,U,4)
  1. ;
  1. ICPT(IEN,CSD) ; $$(ien) -> external display of CPT
  1. N X S X=$$CPT^ICPTCOD($G(IEN),$G(CSD))
  1. Q $P(X,U,2)_" "_$E($P(X,U,3),1,30)
  1. ;
  1. IMM(NODE,ORVALUE,VALUES) ; from ORWGAPI4
  1. D VIMM^PXPXRM(NODE,.ORVALUE)
  1. S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
  1. Q
  1. ;
  1. ISA(USER,CLASS,ORERR) ; $$(user,user class,err) -> 1 if user in class, else 0
  1. Q $$ISA^USRLM(USER,CLASS,.ORERR)
  1. ;
  1. LOS(DGPMIFN) ; $$(pt movement ien) -> length of stay
  1. N X D ^DGPMLOS
  1. Q +$P($G(X),U,5)
  1. ;
  1. MEDICINE(ARRAY,DFN) ;
  1. N DATE,FILE,IEN,NAME,NUM,REF,VALUES,XREF
  1. K ARRAY,^TMP("MCAR",$J),^TMP("OR",$J,"MCAR")
  1. D FILE^ORWGAPIU(690,.REF,.XREF)
  1. I '$L(REF) Q
  1. I $E(REF,$L(REF))="," S REF=$E(REF,1,$L(REF)-1)_")"
  1. I $E(REF,$L(REF))="(" S REF=$P(REF,"(")
  1. D EN^MCARPS2(DFN)
  1. S NUM=0
  1. F S NUM=$O(^TMP("OR",$J,"MCAR","OT",NUM)) Q:NUM<1 D
  1. . S VALUES=^TMP("OR",$J,"MCAR","OT",NUM)
  1. . S DATE=$$DATETFM^ORWGAPIW($P(VALUES,U,6))
  1. . S NAME=$P(VALUES,U) I '$L(NAME) Q
  1. . S IEN=+$O(@REF@(XREF,NAME,""))
  1. . I DATE,IEN S ARRAY(IEN,DATE)=NAME
  1. K ^TMP("MCAR",$J),^TMP("OR",$J,"MCAR")
  1. Q
  1. ;
  1. MEDVAL(VAL) ;
  1. N IEN,NAME,NAMES,REF,SEQ,XREF K NAMES,VAL
  1. D FILE^ORWGAPIU(690,.REF,.XREF)
  1. I '$L(REF) Q
  1. I $E(REF,$L(REF))="," S REF=$E(REF,1,$L(REF)-1)_")"
  1. I $E(REF,$L(REF))="(" S REF=$P(REF,"(")
  1. S NAME=""
  1. F S NAME=$O(@REF@(XREF,NAME)) Q:NAME="" D
  1. . S IEN=0
  1. . F S IEN=$O(@REF@(XREF,NAME,IEN)) Q:IEN<1 D
  1. .. S NAMES(IEN)=NAME
  1. S SEQ=0
  1. S IEN=0
  1. F S IEN=$O(NAMES(IEN)) Q:IEN<1 D
  1. . S SEQ=SEQ+1
  1. . S VAL(SEQ)=690_U_IEN_U_NAMES(IEN)
  1. Q
  1. ;
  1. MH(ORVALUE,NODE,VALUES) ; from ORWGAPI4
  1. D ENDAS^YTAPI10(.ORVALUE,NODE)
  1. S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
  1. Q
  1. ;
  1. NOTEX(DFN) ; $$(dfn) -> 1 if patient has data else 0
  1. Q $$HASDOCMT^TIULX($G(DFN))
  1. ;
  1. OITEM(DATA) ; API - get order display groups - from ORWGAPI
  1. N CNT,IEN,RESULT,TMP,ZERO
  1. D RETURN^ORWGAPIW(.TMP,.DATA)
  1. S CNT=0
  1. S IEN=0
  1. F S IEN=$O(^ORD(100.98,IEN)) Q:IEN<1 D
  1. . S ZERO=$G(^ORD(100.98,IEN,0)) I '$L(ZERO) Q
  1. . S RESULT="100.98^"_IEN_U_$P(ZERO,U)_U_$P(ZERO,U,3)
  1. . D SETUP^ORWGAPIW(.DATA,RESULT,TMP,.CNT)
  1. Q
  1. ;
  1. POV(NODE,ORVALUE,VALUES) ; from ORWGAPI4
  1. D VPOV^PXPXRM(NODE,.ORVALUE)
  1. S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
  1. Q
  1. ;
  1. PROB(GMPLLEX,GMPLSTAT,GMPLICD,GMPLODAT,GMPLXDAT,NODE) ; from ORWGAPI4
  1. N GMPLPNAM,GMPLDLM,GMPLTXT,GMPLCOND,GMPLPRV,GMPLPRIO
  1. D CALL2^GMPLUTL3(NODE)
  1. Q
  1. ;
  1. PTF(NODE,ORVALUE,VALUES) ; from ORWGAPI3, ORWGAPI4
  1. D PTF^DGPTPXRM(NODE,.ORVALUE)
  1. S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
  1. Q
  1. ;
  1. RAD(NODE,ORVALUE,VALUES) ; from ORWGAPI3
  1. D EN1^RAPXRM(NODE,.ORVALUE)
  1. S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
  1. Q
  1. ;
  1. SKIN(NODE,ORVALUE,VALUES) ; from ORWGAPI4
  1. D VSKIN^PXPXRM(NODE,.ORVALUE)
  1. S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
  1. Q
  1. ;
  1. SURG(ORSURG,DFN,VALUES) ; from ORWGAPI2, ORWGAPI4
  1. D GET^SROGTSR(.ORSURG,DFN)
  1. S VALUES=$$DATA^ORWGAPIW(.ORSURG) ;*****************************
  1. Q
  1. ;
  1. SURGX(DFN) ; $$(dfn) -> 1 if patient has data else 0
  1. Q $O(^SRF("B",+$G(DFN),0))>0
  1. ;
  1. TAX(IEN) ; $$(ien) -> external display of reminder taxonomy
  1. Q $P($G(^PXD(811.2,+$G(IEN),0)),U)
  1. ;
  1. TITLE(DOCTYPE) ; $$(document type) -> parent ien^parent^parent abbrev
  1. N IEN,RESULTS K RESULTS
  1. S DOCTYPE=+$G(^TIU(8925,+$G(DOCTYPE),0))
  1. S IEN=+$$DOCCLASS^TIULC1(DOCTYPE) I 'IEN Q ""
  1. D GETDATA^ORWGAPIX(.RESULTS,8925.1,".01;.02",IEN)
  1. I '$L($G(RESULTS(.01))) Q ""
  1. Q IEN_U_"note - "_RESULTS(.01)_U_$G(RESULTS(.02))
  1. ;
  1. TIU(ORVALUE,DOCIEN,ONE,DFN,OLDEST,NEWEST) ; from ORWGAPI1, ORWGAPI3
  1. D CONTEXT^TIUSRVLO(.ORVALUE,DOCIEN,ONE,DFN,$G(OLDEST),$G(NEWEST))
  1. Q
  1. ;
  1. TIUTITLE(DATA) ; API - get tiu document titles - from ORWGAPI
  1. N CNT,IEN,RESULT,RESULTS,TMP K ^TMP("TIUTLS",$J)
  1. D RETURN^ORWGAPIW(.TMP,.DATA)
  1. S CNT=0
  1. D TITLIENS^TIULX
  1. S IEN=0
  1. F S IEN=$O(^TMP("TIUTLS",$J,IEN)) Q:IEN<1 D
  1. . K RESULTS
  1. . D GETDATA^ORWGAPIX(.RESULTS,8925.1,".01;.02",IEN)
  1. . I '$L($G(RESULTS(.01))) Q
  1. . S RESULT="8925.1^"_IEN_U_RESULTS(.01)_U_$G(RESULTS(.02))
  1. . D SETUP^ORWGAPIW(.DATA,RESULT,TMP,.CNT)
  1. K ^TMP("TIUTLS",$J)
  1. Q
  1. ;
  1. VISITX(DFN) ; $$(dfn) -> 1 if patient has data else 0
  1. Q $O(^AUPNVSIT("AET",+$G(DFN),0))>0
  1. ;
  1. VITAL(ORVALUE,NODE,VALUES) ; from ORWGAPI4
  1. D EN^GMVPXRM(.ORVALUE,NODE)
  1. S VALUES=$$DATA^ORWGAPIW(.ORVALUE) ;*****************************
  1. Q
  1. ;