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
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORWGAPIE 3294 printed Oct 16, 2024@18:36:56 Page 2
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
+2 ;
MED1(ITEMS,DFN,FMT,OLDEST,NEWEST,CNT,TMP) ; from ORWGAPI1
+1 NEW DATE,ITEM,OK,MEDARRAY,RESULT
KILL MEDARRAY
+2 DO MEDICINE^ORWGAPIA(.MEDARRAY,DFN)
+3 SET ITEM=0
+4 FOR
SET ITEM=$ORDER(MEDARRAY(ITEM))
if ITEM<1
QUIT
Begin DoDot:1
+5 SET OK=0
+6 IF FMT=6
Begin DoDot:2
+7 SET DATE=OLDEST
+8 FOR
SET DATE=$ORDER(MEDARRAY(ITEM,DATE))
if DATE=""
QUIT
if DATE>NEWEST
QUIT
Begin DoDot:3
+9 SET CNT=CNT+1
+10 SET OK=1
+11 SET RESULT=690_U_ITEM
+12 DO SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
End DoDot:3
if OK
QUIT
End DoDot:2
+13 IF FMT'=6
Begin DoDot:2
+14 SET DATE=$ORDER(MEDARRAY(ITEM,""),-1)
+15 IF 'DATE
QUIT
+16 SET NAME=MEDARRAY(ITEM,DATE)
+17 IF '$LENGTH(NAME)
QUIT
+18 SET CNT=CNT+1
+19 SET OK=1
+20 IF FMT=3
SET RESULT=690_U_ITEM_"^^"_NAME_"^^"_DATE
+21 IF FMT=0
SET RESULT=690_U_ITEM_U_NAME
End DoDot:2
+22 IF OK
DO SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
End DoDot:1
+23 QUIT
+24 ;
MED3(DATA,ITEM,START,DFN,CNT,TMP) ; from ORWGAPI3
+1 NEW DATE,DATE2,DATESTOP,DATESTRT,DTPLUS1,NODE,RESULT,STATUS,VALUE
KILL VALUE
+2 DO MEDICINE^ORWGAPIA(.MEDARRAY,DFN)
+3 SET ITEM=+$GET(ITEM)
+4 SET CNT=$GET(CNT)
+5 SET DATE=""
+6 FOR
SET DATE=$ORDER(MEDARRAY(ITEM,DATE))
if DATE=""
QUIT
Begin DoDot:1
+7 IF DATE>START
QUIT
+8 SET RESULT=690_U_ITEM_U_DATE_"^^"
+9 DO SETUP^ORWGAPIW(.DATA,RESULT,TMP,.CNT)
End DoDot:1
+10 QUIT
+11 ;
NVA1(ITEMS,DFN,FMT,OLDEST,NEWEST,CNT,TMP) ; from ORWGAPI1
+1 NEW DATA,DATE,DATE1,DATESTRT,DRUG,ITEM,OK,REF,RESULT
KILL DATA
+2 SET ITEM=""
+3 FOR
SET ITEM=$ORDER(^PXRMINDX("55NVA","PI",DFN,ITEM))
if ITEM=""
QUIT
Begin DoDot:1
+4 SET OK=0
+5 IF FMT=6
Begin DoDot:2
+6 SET DATE=0
+7 FOR
SET DATE=$ORDER(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE))
if DATE=""
QUIT
if DATE>NEWEST
QUIT
Begin DoDot:3
+8 SET DATE1=""
+9 FOR
SET DATE1=$ORDER(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE,DATE1))
if DATE1=""
QUIT
Begin DoDot:4
+10 IF DATE1'["U"
IF DATE1<OLDEST
QUIT
+11 SET CNT=CNT+1
+12 SET OK=1
+13 SET RESULT="55NVA"_U_ITEM
End DoDot:4
if OK
QUIT
End DoDot:3
if OK
QUIT
End DoDot:2
+14 IF FMT'=6
Begin DoDot:2
+15 SET DATE=$ORDER(^PXRMINDX("55NVA","PI",DFN,ITEM,""),-1)
+16 IF 'DATE
QUIT
+17 SET DATE1=$ORDER(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE,""),-1)
+18 IF '$LENGTH(DATE1)
QUIT
+19 SET REF=$ORDER(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE,DATE1,""),-1)
+20 IF '$LENGTH(REF)
QUIT
+21 DO RXNVA^ORWGAPIC(REF,.DATA)
+22 SET DRUG=+$GET(DATA("DISPENSE DRUG"))
+23 SET DATESTRT=+$GET(DATA("START DATE"))
+24 IF 'DATESTRT
QUIT
+25 SET CNT=CNT+1
+26 SET OK=1
+27 IF FMT=3
SET RESULT="55NVA"_U_ITEM_"^^"_$$EVALUE^ORWGAPIU(ITEM,"55NVA",.01)_"^^"_DATESTRT
+28 IF FMT=0
SET RESULT="55NVA"_U_ITEM_U_$$EVALUE^ORWGAPIU(ITEM,"55NVA",.01)
+29 IF DRUG
SET RESULT=RESULT_U_$$DRGCLASS^ORWGAPIC(DRUG)
End DoDot:2
+30 IF OK
DO SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
End DoDot:1
+31 QUIT
+32 ;
NVA3(DATA,ITEM,START,DFN,CNT,TMP) ; from ORWGAPI3
+1 NEW DATE1,DATE2,DATESTOP,DATESTRT,DTPLUS1,NODE,RESULT,STATUS,VALUE
KILL VALUE
+2 SET CNT=$GET(CNT)
SET DTPLUS1=$$FMADD^ORWGAPIX(DT,1)
+3 SET DATE1=""
+4 FOR
SET DATE1=$ORDER(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE1))
if DATE1=""
QUIT
Begin DoDot:1
+5 IF DATE1>START
QUIT
+6 SET DATE2=""
+7 FOR
SET DATE2=$ORDER(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE1,DATE2))
if DATE2=""
QUIT
Begin DoDot:2
+8 SET NODE=""
+9 FOR
SET NODE=$ORDER(^PXRMINDX("55NVA","PI",DFN,ITEM,DATE1,DATE2,NODE))
if NODE=""
QUIT
Begin DoDot:3
+10 DO RXNVA^ORWGAPIC(NODE,.VALUE)
+11 SET STATUS=$GET(VALUE("STATUS"))
+12 SET DATESTRT=+$GET(VALUE("START DATE"))
+13 IF 'DATESTRT
QUIT
+14 SET DATESTOP=+$GET(VALUE("DISCONTINUED DATE"))
+15 IF 'DATESTOP
SET DATESTOP=DTPLUS1
+16 SET STATUS=STATUS_" "_$$NVASIG^ORWGAPIC(NODE)
+17 SET RESULT="55NVA"_U_ITEM_U_DATESTRT_U_DATESTOP_U_STATUS
+18 DO SETUP^ORWGAPIW(.DATA,RESULT,TMP,.CNT)
End DoDot:3
End DoDot:2
End DoDot:1
+19 QUIT
+20 ;