VistA-FOIAVistA/r/ORDER_ENTRY_RESULTS_REPORTI.../ORPRS08.m

33 lines
1.3 KiB
Mathematica

ORPRS08 ; slc/dcm - Nightly Order Summary Task ;6/10/97 15:45
;;3.0;ORDER ENTRY/RESULTS REPORTING;**11,69**;Dec 17, 1997
MAIN ; Controls branching
N ORL,ORI,ORPDOS,ORDOS
D ENVAL^XPAR(.ORDOS,"ORPF DAILY ORDER SUMMARY DEVC")
D ENVAL^XPAR(.ORPDOS,"ORPF PRINT DAILY ORDER SUMMARY")
S ORL=""
F S ORL=$O(ORPDOS(ORL)) Q:ORL="" I $G(ORPDOS(ORL,1)),$G(ORDOS(ORL,1)) D LOC(ORL,ORDOS(ORL,1))
Q
LOC(ORL,ORDVC) ; Build patient list and task summary for each Inpatient location
I $S(+ORL'>0:1,ORDVC'>0:1,1:0) G LOCX
N %,%H,%I,%T,DFN,ORDT,ORPM,ORSHORT,ORSCPAT,ORSSTOP,ORSSTRT,ORTIT,X,ORSCPAT,ORSWDN
N ORPRES,ORVP,ORX,IOP,Y,ZTIO,ZTSK,ZTRTN,ZTDESC,ZTDTH,ZTSAVE
S ORSWDN=$P($G(^SC(+ORL,0)),"^")
D PATARAY(.ORSCPAT,+ORL)
I '$D(ORSCPAT) G LOCX
D NOW^%DTC
S (ORDT,X1)=$P(%,"."),(ORPM,X2)=$S($E($P(%,".",2),1,2)>12:1,1:-1)
D C^%DTC
S ORSSTRT=$S(ORPM>0:ORDT,1:X),ORSSTOP=$S(ORPM>0:X,1:ORDT),ORSHORT=$$SHORT^ORPRS02(),ORTIT="DAILY ORDER SUMMARY",ORPRES="DATE"
S ZTRTN="EN1^ORPRS10",ZTDTH=$H,ZTDESC="Daily Order Summary for "_ORSWDN,ZTIO="`"_ORDVC,ZTSAVE("O*")=""
D ^%ZTLOAD
LOCX Q
PATARAY(ORSCPAT,LOC) ;Loads patients into ORSCPAT local array
;LOC=Location
;ORVP=Patient variable pointer
Q:'$L($G(LOC))
Q:'$D(^SC(+LOC,42)) Q:'$D(^DIC(42,^(42),0)) S NAME=$P(^(0),"^")
N X,I
S I=0
F S I=$O(^DPT("CN",NAME,I)) Q:'I S X=^DPT(I,0),ORSCPAT($P(X,"^")_" "_I)=I
Q