ORWGAPIR ; SLC/STAFF - Graph API Router ;7/31/09 13:06
;;3.0;ORDER ENTRY/RESULTS REPORTING;**215,260,243,280**;Dec 17, 1997;Build 85
;
DATA(DATA,ITEM,FILE,START,DFN,CNT,TMP,BACKTO) ; from ORWGAPI
S DFN=+$G(DFN) I 'DFN Q
S FILE=$G(FILE) I '$L(FILE) Q
S ITEM=$G(ITEM) I '$L(ITEM) Q
S BACKTO=+$G(BACKTO)
I FILE=52 D OUTRX^ORWGAPI7(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=53.79 D BCMA^ORWGAPI7(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=55 D INRX^ORWGAPI7(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE="55NVA" D NVA^ORWGAPI7(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=63 D LAB^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE="63AP" D LAB^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE="63BB" D BBDATA^ORWGAPIB(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE="63MI" D LAB^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=70 D RAD^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=100 D ORDER^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=120.5 D VITAL^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=120.8 D ADVERSE^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=601.2 D MH^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=9000010.07 D POV^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=9000010.11 D IMM^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=9000010.12 D SKIN^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=9000010.13 D EXAM^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=9000010.16 D EDU^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=9000010.18 D PROC^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=9000010.23 D HF^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=9000011 D PROB^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=9999911 D PROBX^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE="45OP" D OP^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE="45DX" D DX^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=9000010 D VISIT^ORWGAPI8(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=405 D ADMIT^ORWGAPI8(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=130 D SURG^ORWGAPI8(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=8925 D NOTE^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
I FILE=690 D MED^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO) Q
Q
;
ITEMS(ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,CNT,TMP) ; from ORWGAPI
S FMT=$G(FMT,3),OLDEST=+$G(OLDEST),NEWEST=+$G(NEWEST),CNT=+$G(CNT)
I (TYPE=70)!(TYPE=100)!(TYPE=120.5)!(TYPE=601.2) D STD(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I (TYPE=9000010.11)!(TYPE=9000010.12)!(TYPE=9000010.13) D STD(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I (TYPE=9000010.16)!(TYPE=9000010.23) D STD(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I (TYPE=9000010.07)!(TYPE=9000010.18) D STD1(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I (TYPE=52)!(TYPE=55) D STD2(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE=63 D LAB^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE=9000010 D VISITS^ORWGAPI6(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE=9000011 D PL^ORWGAPI2(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE=9999911 D PLX^ORWGAPI2(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE=405 D ADMITS^ORWGAPI6(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE=50.605 D DC^ORWGAPI5(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE=68 D AA^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE=8925.1 D TITLE^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE=53.79 D BCMA^ORWGAPI5(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE=120.8 D ADVERSE^ORWGAPI2(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE=130 D SURGERY^ORWGAPI6(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE=8925 D NOTES^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE=690 D MED^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
S TYPE=$$UP^ORWGAPIX(TYPE)
I $E(TYPE,1,2)=45 D REG^ORWGAPI2(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE="55NVA" D NVA^ORWGAPI5(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE="63AP" D AP^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE="63BB" D BBITEM^ORWGAPIB(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
I TYPE="63MI" D MI^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP) Q
Q
;
STD(ITEMS,DFN,FILE,FMT,OLDEST,NEWEST,CNT,TMP) ;
N DATE,ITEM,OK,RESULT
S ITEM=""
F S ITEM=$O(^PXRMINDX(FILE,"PI",DFN,ITEM)) Q:ITEM="" D
. S OK=0
. I FMT=6 D
.. S DATE=OLDEST
.. F S DATE=$O(^PXRMINDX(FILE,"PI",DFN,ITEM,DATE)) Q:DATE="" Q:DATE>NEWEST D Q:OK
... S CNT=CNT+1
... S OK=1
... S RESULT=FILE_U_ITEM
. I FMT=3 D
.. S DATE=$O(^PXRMINDX(FILE,"PI",DFN,ITEM,""),-1)
.. I 'DATE Q
.. S CNT=CNT+1
.. S OK=1
.. S RESULT=FILE_U_ITEM_"^^"_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)_"^^"_DATE
.. I FILE=100 S RESULT=RESULT_U_$$OGROUP^ORWGAPIW(ITEM)
. I FMT=0 D
.. S CNT=CNT+1
.. S OK=1
.. S RESULT=FILE_U_ITEM_U_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)
. I OK D SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
I FILE=120.5 D BMIITEMS^ORWGAPIX(.ITEMS,.CNT,TMP) Q
Q
;
STD1(ITEMS,DFN,FILE,FMT,OLDEST,NEWEST,CNT,TMP) ;
N DATE,ITEM,OK,RESULT,TYPE
K ^TMP("ORWGRPC TEMP",$J)
S TYPE=""
F S TYPE=$O(^PXRMINDX(FILE,"PPI",DFN,TYPE)) Q:TYPE="" D
. S ITEM=""
. F S ITEM=$O(^PXRMINDX(FILE,"PPI",DFN,TYPE,ITEM)) Q:ITEM="" D
.. S OK=0
.. I FMT=6 D
... S DATE=OLDEST
... F S DATE=$O(^PXRMINDX(FILE,"PPI",DFN,TYPE,ITEM,DATE)) Q:DATE="" Q:DATE>NEWEST D Q:OK
.... S CNT=CNT+1
.... S OK=1
.... S RESULT=FILE_U_ITEM
.. I FMT=3 D
... S DATE=$O(^PXRMINDX(FILE,"PPI",DFN,TYPE,ITEM,""),-1)
... I DATE S ^TMP("ORWGRPC TEMP",$J,ITEM,DATE)=""
.. I FMT=0 D
... S CNT=CNT+1
... S OK=1
... S RESULT=FILE_U_ITEM_U_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)
.. I OK D SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
I FMT=3 D
. S ITEM=""
. F S ITEM=$O(^TMP("ORWGRPC TEMP",$J,ITEM)) Q:ITEM="" D
.. S DATE=$O(^TMP("ORWGRPC TEMP",$J,ITEM,""),-1)
.. I 'DATE Q
.. S CNT=CNT+1
.. S RESULT=FILE_U_ITEM_"^^"_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)_"^^"_DATE
.. D SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
K ^TMP("ORWGRPC TEMP",$J)
Q
;
STD2(ITEMS,DFN,FILE,FMT,OLDEST,NEWEST,CNT,TMP) ;
N DATE,DATE2,ITEM,OK,RESULT
S ITEM=""
F S ITEM=$O(^PXRMINDX(FILE,"PI",DFN,ITEM)) Q:ITEM="" D
. S OK=0
. I FMT=6 D
.. S DATE=0
.. F S DATE=$O(^PXRMINDX(FILE,"PI",DFN,ITEM,DATE)) Q:DATE="" Q:DATE>NEWEST D Q:OK
... S DATE2=""
... F S DATE2=$O(^PXRMINDX(FILE,"PI",DFN,ITEM,DATE,DATE2)) Q:DATE2="" D
.... I DATE2<OLDEST Q
.... S CNT=CNT+1
.... S OK=1
.... S RESULT=FILE_U_ITEM
. I FMT=3 D
.. S DATE=$O(^PXRMINDX(FILE,"PI",DFN,ITEM,""),-1)
.. I 'DATE Q
.. S CNT=CNT+1
.. S OK=1
.. S RESULT=FILE_U_ITEM_"^^"_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)_"^^"_DATE
.. S RESULT=RESULT_U_$$DRGCLASS^ORWGAPIC(ITEM)
. I FMT=0 D
.. S CNT=CNT+1
.. S OK=1
.. S RESULT=FILE_U_ITEM_U_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)
.. S RESULT=RESULT_U_$$DRGCLASS^ORWGAPIC(ITEM)
. I OK D SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORWGAPIR 7119 printed Dec 13, 2024@02:36:25 Page 2
ORWGAPIR ; SLC/STAFF - Graph API Router ;7/31/09 13:06
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**215,260,243,280**;Dec 17, 1997;Build 85
+2 ;
DATA(DATA,ITEM,FILE,START,DFN,CNT,TMP,BACKTO) ; from ORWGAPI
+1 SET DFN=+$GET(DFN)
IF 'DFN
QUIT
+2 SET FILE=$GET(FILE)
IF '$LENGTH(FILE)
QUIT
+3 SET ITEM=$GET(ITEM)
IF '$LENGTH(ITEM)
QUIT
+4 SET BACKTO=+$GET(BACKTO)
+5 IF FILE=52
DO OUTRX^ORWGAPI7(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+6 IF FILE=53.79
DO BCMA^ORWGAPI7(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+7 IF FILE=55
DO INRX^ORWGAPI7(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+8 IF FILE="55NVA"
DO NVA^ORWGAPI7(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+9 IF FILE=63
DO LAB^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+10 IF FILE="63AP"
DO LAB^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+11 IF FILE="63BB"
DO BBDATA^ORWGAPIB(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+12 IF FILE="63MI"
DO LAB^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+13 IF FILE=70
DO RAD^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+14 IF FILE=100
DO ORDER^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+15 IF FILE=120.5
DO VITAL^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+16 IF FILE=120.8
DO ADVERSE^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+17 IF FILE=601.2
DO MH^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+18 IF FILE=9000010.07
DO POV^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+19 IF FILE=9000010.11
DO IMM^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+20 IF FILE=9000010.12
DO SKIN^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+21 IF FILE=9000010.13
DO EXAM^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+22 IF FILE=9000010.16
DO EDU^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+23 IF FILE=9000010.18
DO PROC^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+24 IF FILE=9000010.23
DO HF^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+25 IF FILE=9000011
DO PROB^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+26 IF FILE=9999911
DO PROBX^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+27 IF FILE="45OP"
DO OP^ORWGAPI4(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+28 IF FILE="45DX"
DO DX^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+29 IF FILE=9000010
DO VISIT^ORWGAPI8(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+30 IF FILE=405
DO ADMIT^ORWGAPI8(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+31 IF FILE=130
DO SURG^ORWGAPI8(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+32 IF FILE=8925
DO NOTE^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+33 IF FILE=690
DO MED^ORWGAPI3(.DATA,ITEM,START,DFN,.CNT,TMP,BACKTO)
QUIT
+34 QUIT
+35 ;
ITEMS(ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,CNT,TMP) ; from ORWGAPI
+1 SET FMT=$GET(FMT,3)
SET OLDEST=+$GET(OLDEST)
SET NEWEST=+$GET(NEWEST)
SET CNT=+$GET(CNT)
+2 IF (TYPE=70)!(TYPE=100)!(TYPE=120.5)!(TYPE=601.2)
DO STD(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+3 IF (TYPE=9000010.11)!(TYPE=9000010.12)!(TYPE=9000010.13)
DO STD(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+4 IF (TYPE=9000010.16)!(TYPE=9000010.23)
DO STD(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+5 IF (TYPE=9000010.07)!(TYPE=9000010.18)
DO STD1(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+6 IF (TYPE=52)!(TYPE=55)
DO STD2(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+7 IF TYPE=63
DO LAB^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+8 IF TYPE=9000010
DO VISITS^ORWGAPI6(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+9 IF TYPE=9000011
DO PL^ORWGAPI2(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+10 IF TYPE=9999911
DO PLX^ORWGAPI2(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+11 IF TYPE=405
DO ADMITS^ORWGAPI6(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+12 IF TYPE=50.605
DO DC^ORWGAPI5(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+13 IF TYPE=68
DO AA^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+14 IF TYPE=8925.1
DO TITLE^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+15 IF TYPE=53.79
DO BCMA^ORWGAPI5(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+16 IF TYPE=120.8
DO ADVERSE^ORWGAPI2(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+17 IF TYPE=130
DO SURGERY^ORWGAPI6(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+18 IF TYPE=8925
DO NOTES^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+19 IF TYPE=690
DO MED^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+20 SET TYPE=$$UP^ORWGAPIX(TYPE)
+21 IF $EXTRACT(TYPE,1,2)=45
DO REG^ORWGAPI2(.ITEMS,DFN,TYPE,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+22 IF TYPE="55NVA"
DO NVA^ORWGAPI5(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+23 IF TYPE="63AP"
DO AP^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+24 IF TYPE="63BB"
DO BBITEM^ORWGAPIB(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+25 IF TYPE="63MI"
DO MI^ORWGAPI1(.ITEMS,DFN,FMT,OLDEST,NEWEST,.CNT,TMP)
QUIT
+26 QUIT
+27 ;
STD(ITEMS,DFN,FILE,FMT,OLDEST,NEWEST,CNT,TMP) ;
+1 NEW DATE,ITEM,OK,RESULT
+2 SET ITEM=""
+3 FOR
SET ITEM=$ORDER(^PXRMINDX(FILE,"PI",DFN,ITEM))
if ITEM=""
QUIT
Begin DoDot:1
+4 SET OK=0
+5 IF FMT=6
Begin DoDot:2
+6 SET DATE=OLDEST
+7 FOR
SET DATE=$ORDER(^PXRMINDX(FILE,"PI",DFN,ITEM,DATE))
if DATE=""
QUIT
if DATE>NEWEST
QUIT
Begin DoDot:3
+8 SET CNT=CNT+1
+9 SET OK=1
+10 SET RESULT=FILE_U_ITEM
End DoDot:3
if OK
QUIT
End DoDot:2
+11 IF FMT=3
Begin DoDot:2
+12 SET DATE=$ORDER(^PXRMINDX(FILE,"PI",DFN,ITEM,""),-1)
+13 IF 'DATE
QUIT
+14 SET CNT=CNT+1
+15 SET OK=1
+16 SET RESULT=FILE_U_ITEM_"^^"_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)_"^^"_DATE
+17 IF FILE=100
SET RESULT=RESULT_U_$$OGROUP^ORWGAPIW(ITEM)
End DoDot:2
+18 IF FMT=0
Begin DoDot:2
+19 SET CNT=CNT+1
+20 SET OK=1
+21 SET RESULT=FILE_U_ITEM_U_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)
End DoDot:2
+22 IF OK
DO SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
End DoDot:1
+23 IF FILE=120.5
DO BMIITEMS^ORWGAPIX(.ITEMS,.CNT,TMP)
QUIT
+24 QUIT
+25 ;
STD1(ITEMS,DFN,FILE,FMT,OLDEST,NEWEST,CNT,TMP) ;
+1 NEW DATE,ITEM,OK,RESULT,TYPE
+2 KILL ^TMP("ORWGRPC TEMP",$JOB)
+3 SET TYPE=""
+4 FOR
SET TYPE=$ORDER(^PXRMINDX(FILE,"PPI",DFN,TYPE))
if TYPE=""
QUIT
Begin DoDot:1
+5 SET ITEM=""
+6 FOR
SET ITEM=$ORDER(^PXRMINDX(FILE,"PPI",DFN,TYPE,ITEM))
if ITEM=""
QUIT
Begin DoDot:2
+7 SET OK=0
+8 IF FMT=6
Begin DoDot:3
+9 SET DATE=OLDEST
+10 FOR
SET DATE=$ORDER(^PXRMINDX(FILE,"PPI",DFN,TYPE,ITEM,DATE))
if DATE=""
QUIT
if DATE>NEWEST
QUIT
Begin DoDot:4
+11 SET CNT=CNT+1
+12 SET OK=1
+13 SET RESULT=FILE_U_ITEM
End DoDot:4
if OK
QUIT
End DoDot:3
+14 IF FMT=3
Begin DoDot:3
+15 SET DATE=$ORDER(^PXRMINDX(FILE,"PPI",DFN,TYPE,ITEM,""),-1)
+16 IF DATE
SET ^TMP("ORWGRPC TEMP",$JOB,ITEM,DATE)=""
End DoDot:3
+17 IF FMT=0
Begin DoDot:3
+18 SET CNT=CNT+1
+19 SET OK=1
+20 SET RESULT=FILE_U_ITEM_U_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)
End DoDot:3
+21 IF OK
DO SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
End DoDot:2
End DoDot:1
+22 IF FMT=3
Begin DoDot:1
+23 SET ITEM=""
+24 FOR
SET ITEM=$ORDER(^TMP("ORWGRPC TEMP",$JOB,ITEM))
if ITEM=""
QUIT
Begin DoDot:2
+25 SET DATE=$ORDER(^TMP("ORWGRPC TEMP",$JOB,ITEM,""),-1)
+26 IF 'DATE
QUIT
+27 SET CNT=CNT+1
+28 SET RESULT=FILE_U_ITEM_"^^"_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)_"^^"_DATE
+29 DO SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
End DoDot:2
End DoDot:1
+30 KILL ^TMP("ORWGRPC TEMP",$JOB)
+31 QUIT
+32 ;
STD2(ITEMS,DFN,FILE,FMT,OLDEST,NEWEST,CNT,TMP) ;
+1 NEW DATE,DATE2,ITEM,OK,RESULT
+2 SET ITEM=""
+3 FOR
SET ITEM=$ORDER(^PXRMINDX(FILE,"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(FILE,"PI",DFN,ITEM,DATE))
if DATE=""
QUIT
if DATE>NEWEST
QUIT
Begin DoDot:3
+8 SET DATE2=""
+9 FOR
SET DATE2=$ORDER(^PXRMINDX(FILE,"PI",DFN,ITEM,DATE,DATE2))
if DATE2=""
QUIT
Begin DoDot:4
+10 IF DATE2<OLDEST
QUIT
+11 SET CNT=CNT+1
+12 SET OK=1
+13 SET RESULT=FILE_U_ITEM
End DoDot:4
End DoDot:3
if OK
QUIT
End DoDot:2
+14 IF FMT=3
Begin DoDot:2
+15 SET DATE=$ORDER(^PXRMINDX(FILE,"PI",DFN,ITEM,""),-1)
+16 IF 'DATE
QUIT
+17 SET CNT=CNT+1
+18 SET OK=1
+19 SET RESULT=FILE_U_ITEM_"^^"_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)_"^^"_DATE
+20 SET RESULT=RESULT_U_$$DRGCLASS^ORWGAPIC(ITEM)
End DoDot:2
+21 IF FMT=0
Begin DoDot:2
+22 SET CNT=CNT+1
+23 SET OK=1
+24 SET RESULT=FILE_U_ITEM_U_$$EVALUE^ORWGAPIU(ITEM,FILE,.01)
+25 SET RESULT=RESULT_U_$$DRGCLASS^ORWGAPIC(ITEM)
End DoDot:2
+26 IF OK
DO SETUP^ORWGAPIW(.ITEMS,RESULT,TMP,.CNT)
End DoDot:1
+27 QUIT
+28 ;