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