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

ORWGAPIE.m

Go to the documentation of this file.
  1. ORWGAPIE ; SLC/STAFF - Graph API Details, Medicine, NVAMeds ;12/21/05 08:19
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**243**;Dec 17, 1997;Build 242
  1. ;
  1. MED1(ITEMS,DFN,FMT,OLDEST,NEWEST,CNT,TMP) ; from ORWGAPI1
  1. N DATE,ITEM,OK,MEDARRAY,RESULT K MEDARRAY
  1. D MEDICINE^ORWGAPIA(.MEDARRAY,DFN)
  1. S ITEM=0
  1. F S ITEM=$O(MEDARRAY(ITEM)) Q:ITEM<1 D
  1. . S OK=0
  1. . I FMT=6 D
  1. .. S DATE=OLDEST
  1. .. F S DATE=$O(MEDARRAY(ITEM,DATE)) Q:DATE="" Q:DATE>NEWEST D Q:OK
  1. ... S CNT=CNT+1
  1. ... S OK=1
  1. ... S RESULT=690_U_ITEM
  1. ... D SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
  1. . I FMT'=6 D
  1. .. S DATE=$O(MEDARRAY(ITEM,""),-1)
  1. .. I 'DATE Q
  1. .. S NAME=MEDARRAY(ITEM,DATE)
  1. .. I '$L(NAME) Q
  1. .. S CNT=CNT+1
  1. .. S OK=1
  1. .. I FMT=3 S RESULT=690_U_ITEM_"^^"_NAME_"^^"_DATE
  1. .. I FMT=0 S RESULT=690_U_ITEM_U_NAME
  1. . I OK D SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
  1. Q
  1. ;
  1. MED3(DATA,ITEM,START,DFN,CNT,TMP) ; from ORWGAPI3
  1. N DATE,DATE2,DATESTOP,DATESTRT,DTPLUS1,NODE,RESULT,STATUS,VALUE K VALUE
  1. D MEDICINE^ORWGAPIA(.MEDARRAY,DFN)
  1. S ITEM=+$G(ITEM)
  1. S CNT=$G(CNT)
  1. S DATE=""
  1. F S DATE=$O(MEDARRAY(ITEM,DATE)) Q:DATE="" D
  1. . I DATE>START Q
  1. . S RESULT=690_U_ITEM_U_DATE_"^^"
  1. . D SETUP^ORWGAPIW(.DATA,RESULT,TMP,.CNT)
  1. Q
  1. ;
  1. NVA1(ITEMS,DFN,FMT,OLDEST,NEWEST,CNT,TMP) ; from ORWGAPI1
  1. N DATA,DATE,DATE1,DATESTRT,DRUG,ITEM,OK,REF,RESULT K DATA
  1. S ITEM=""
  1. F S ITEM=$O(^PXRMINDX("55NVA","PI",DFN,ITEM)) Q:ITEM="" D
  1. . S OK=0
  1. . I FMT=6 D
  1. .. S DATE=0
  1. .. F S DATE=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE)) Q:DATE="" Q:DATE>NEWEST D Q:OK
  1. ... S DATE1=""
  1. ... F S DATE1=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE,DATE1)) Q:DATE1="" D Q:OK
  1. .... I DATE1'["U",DATE1<OLDEST Q
  1. .... S CNT=CNT+1
  1. .... S OK=1
  1. .... S RESULT="55NVA"_U_ITEM
  1. . I FMT'=6 D
  1. .. S DATE=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,""),-1)
  1. .. I 'DATE Q
  1. .. S DATE1=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE,""),-1)
  1. .. I '$L(DATE1) Q
  1. .. S REF=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE,DATE1,""),-1)
  1. .. I '$L(REF) Q
  1. .. D RXNVA^ORWGAPIC(REF,.DATA)
  1. .. S DRUG=+$G(DATA("DISPENSE DRUG"))
  1. .. S DATESTRT=+$G(DATA("START DATE"))
  1. .. I 'DATESTRT Q
  1. .. S CNT=CNT+1
  1. .. S OK=1
  1. .. I FMT=3 S RESULT="55NVA"_U_ITEM_"^^"_$$EVALUE^ORWGAPIU(ITEM,"55NVA",.01)_"^^"_DATESTRT
  1. .. I FMT=0 S RESULT="55NVA"_U_ITEM_U_$$EVALUE^ORWGAPIU(ITEM,"55NVA",.01)
  1. .. I DRUG S RESULT=RESULT_U_$$DRGCLASS^ORWGAPIC(DRUG)
  1. . I OK D SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
  1. Q
  1. ;
  1. NVA3(DATA,ITEM,START,DFN,CNT,TMP) ; from ORWGAPI3
  1. N DATE1,DATE2,DATESTOP,DATESTRT,DTPLUS1,NODE,RESULT,STATUS,VALUE K VALUE
  1. S CNT=$G(CNT),DTPLUS1=$$FMADD^ORWGAPIX(DT,1)
  1. S DATE1=""
  1. F S DATE1=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE1)) Q:DATE1="" D
  1. . I DATE1>START Q
  1. . S DATE2=""
  1. . F S DATE2=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE1,DATE2)) Q:DATE2="" D
  1. .. S NODE=""
  1. .. F S NODE=$O(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE1,DATE2,NODE)) Q:NODE="" D
  1. ... D RXNVA^ORWGAPIC(NODE,.VALUE)
  1. ... S STATUS=$G(VALUE("STATUS"))
  1. ... S DATESTRT=+$G(VALUE("START DATE"))
  1. ... I 'DATESTRT Q
  1. ... S DATESTOP=+$G(VALUE("DISCONTINUED DATE"))
  1. ... I 'DATESTOP S DATESTOP=DTPLUS1
  1. ... S STATUS=STATUS_" "_$$NVASIG^ORWGAPIC(NODE)
  1. ... S RESULT="55NVA"_U_ITEM_U_DATESTRT_U_DATESTOP_U_STATUS
  1. ... D SETUP^ORWGAPIW(.DATA,RESULT,TMP,.CNT)
  1. Q
  1. ;