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

ORWGAPIW.m

Go to the documentation of this file.
  1. ORWGAPIW ; SLC/STAFF - Graph API Utilities, Generic ;8/19/06 15:20
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**243**;Dec 17, 1997;Build 242
  1. ;
  1. DATA(ARRAY) ; $$(application results) -> single string of results
  1. N NUM,RESULT,SUB
  1. S OUT=""
  1. S SUB=""
  1. F S SUB=$O(ARRAY(SUB)) Q:SUB="" D
  1. . I $D(ARRAY(SUB,0)) D Q
  1. .. S OUT=OUT_SUB_"["
  1. .. S NUM=0
  1. .. F S NUM=$O(ARRAY(SUB,NUM)) Q:NUM<1 D
  1. ... S RESULT=$G(ARRAY(SUB,NUM,0))
  1. ... S OUT=OUT_RESULT_";"
  1. .. S OUT=OUT_"]"
  1. . S RESULT=$G(ARRAY(SUB))
  1. . S OUT=OUT_SUB_"["_RESULT_"]"
  1. S OUT=$TR(OUT,U,"~")
  1. Q OUT
  1. ;
  1. DATETFM(DATETIME) ; $$(external date/time) -> fm date/time else 0
  1. N DATE,DAY,FMDT,HOUR,MIN,SEC,TIME,YEAR
  1. S DATE=$P(DATETIME,"@"),TIME=$P(DATETIME,"@",2)
  1. S YEAR=$P(DATE,",",2) I $L(YEAR)'=4 Q 0
  1. S YEAR=YEAR-1700 I YEAR<270 Q 0
  1. S MONTH=$P(DATE," ")
  1. S MONTH=$$MTN(MONTH) I MONTH<1 Q 0
  1. I MONTH<10 S MONTH="0"_MONTH
  1. S DAY=$P(DATE," ",2),DAY=$P(DAY,",")
  1. I DAY<1 Q 0
  1. I DAY<10 S DAY="0"_DAY
  1. S HOUR=$P(TIME,":")
  1. S MIN=$P(TIME,":",2)
  1. S SEC=$P(TIME,":",3)
  1. S TIME=HOUR_MIN_SEC
  1. S FMDT=YEAR_MONTH_DAY
  1. I '$L(TIME) Q FMDT
  1. Q FMDT_"."_TIME
  1. ;
  1. GENERIC(VAL,FROM,DIR,FILE,REF,XREF,SCREEN) ; Return a set of entries from xref in REF
  1. ; from ORWGAPI
  1. ; .VAL=returned list, FROM=text to $O from, DIR=$O direction,
  1. N CNT,IEN,NAME,NEXTNAME,NUM,OK,ROOT,ZERO S NUM=0,CNT=44 K VAL
  1. I FILE=405 Q
  1. S ROOT=""
  1. S FROM=$$UP^ORWGAPIX(FROM)
  1. I $E(REF,$L(REF))="," S ROOT=$E(REF,1,$L(REF)-1)_")"
  1. I $E(REF,$L(REF))="(" S ROOT=$P(REF,"(")
  1. I '$L(ROOT) Q
  1. S REF=REF_""""_XREF_""")"
  1. F Q:NUM'<CNT S FROM=$O(@REF@(FROM),DIR) Q:FROM="" D
  1. . S IEN="" F S IEN=$O(@REF@(FROM,IEN),DIR) Q:'IEN D
  1. .. I FILE=100,$O(@REF@(FROM,IEN,""))>0 Q
  1. .. S ZERO=$G(@ROOT@(IEN,0)) I '$L(ZERO) Q
  1. .. X SCREEN I '$T Q
  1. .. S NUM=NUM+1
  1. .. I FILE="45DX"!(FILE=9000010.07)!(FILE=9000011)!(FILE="63AP;I") D Q
  1. ... S VAL(NUM)=FILE_U_IEN_U_$$ICD9^ORWGAPIA(IEN) Q
  1. .. I FILE="45OP" S VAL(NUM)=FILE_U_IEN_U_$$ICD0^ORWGAPIA(IEN) Q
  1. .. I FILE=53.79 S VAL(NUM)=FILE_U_IEN_U_$$POINAME^ORWGAPIC(IEN) Q
  1. .. I FILE="55NVA" S VAL(NUM)=FILE_U_IEN_U_$$POINAME^ORWGAPIC(IEN) Q
  1. .. I FILE=9000010.18 S VAL(NUM)=FILE_U_IEN_U_$$ICPT^ORWGAPIA(IEN) Q
  1. .. I FILE=130 S VAL(NUM)=FILE_U_IEN_U_$$ICPT^ORWGAPIA(IEN) Q
  1. .. S VAL(NUM)=FILE_U_IEN_U_FROM
  1. I FILE=120.5 D
  1. . S (NUM,OK)=0
  1. . F S NUM=$O(VAL(NUM)) Q:NUM<1 D Q:OK
  1. .. S NAME=$P(VAL(NUM),U,3)
  1. .. S NEXTNAME=$P($G(VAL(NUM+1)),U,3)
  1. .. I "BODY MASS INDEX"]NAME,NEXTNAME]"BODY MASS INDEX" D
  1. ... S OK=1
  1. ... S VAL(NUM+.5)="120.5^99999^BODY MASS INDEX"
  1. Q
  1. ;
  1. MTN(MONTH) ; $$(external month) -> month number
  1. N MONTHS,NUM
  1. I $L(MONTH)'=3 Q 0
  1. S MONTHS="JAN^FEB^MAR^APR^MAY^JUN^JUL^AUG^SEP^OCT^NOV^DEC"
  1. F NUM=1:1:13 I $P(MONTHS,U,NUM)=MONTH Q
  1. I NUM=13 Q 0
  1. Q NUM
  1. ;
  1. OGROUP(OITEM) ; $$(orderable item) -> ien display group^display group - from ORWGAPIR
  1. N IEN
  1. S IEN=+$P($G(^ORD(101.43,+$G(OITEM),0)),U,5)
  1. Q IEN_U_"order - "_$P($G(^ORD(100.98,IEN,0)),U)
  1. ;
  1. RETURN(TMP,ITEMS) ; return TMP (0 use local, 1 use ^TMP(ITEMS,$J, where ITEMS is a namespaced string)
  1. ; from ORWGAPI, ORWGAPIP, ORWGAPIX
  1. N NMSP
  1. S NMSP=$G(ITEMS) K ITEMS S ITEMS=""
  1. S TMP=NMSP?1U1UN1.14UNP
  1. I TMP S ITEMS=NMSP
  1. Q
  1. ;
  1. SETUP(DATA,RESULT,TMP,CNT) ; from ORWGAPI1, ORWGAPI2, ORWGAPI3, ORWGAPI4, ORWGAPIP, ORWGAPIR, ORWGAPIX
  1. S CNT=CNT+1
  1. I TMP=2 S ^TMP(DATA,$J,$P(RESULT,U,1,2))=RESULT Q
  1. I TMP S ^TMP(DATA,$J,CNT)=RESULT
  1. I 'TMP S DATA(CNT)=RESULT
  1. Q
  1. ;