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

GMRVORDG.m

Go to the documentation of this file.
GMRVORDG ;HIRMFO/RM-DGOERR EVENT DRIVER INTERFACE. ;4/2/96
 ;;4.0;Vitals/Measurements;**2**;Apr 25, 1997
EN4 ; ENTRY FROM DGPM MOVEMENT EVENTS PROTOCOL
 G Q4:$G(DGPMA)=""!("^1^2^3^22^23^24^25^"[("^"_$P($G(DGPMA),"^",18)_"^")) S GMRVDGZN=$P($G(DGPMA),"^")_"^"_$P($G(DGPMA),"^",6),GMRVDGZN(0)=$P($G(DGPMP),"^")_"^"_$P($G(DGPMP),"^",6) G Q4:GMRVDGZN=GMRVDGZN(0)
 S GMRVDGDT=$P($G(DGPMA),"^"),GMRVOE=$S("^1^3^4^5^"[("^"_$P($G(DGPMA),"^",2)_"^")&($P($G(DGPMA),"^",18)'=41):1,$P($G(DGPMA),"^",2)=2!($P($G(DGPMA),"^",18)=41):0,1:"") G:GMRVOE="" Q4
 D DCALL:GMRVOE,DCHK:'GMRVOE
Q4 K GMRVDGZN,GMRVDGDT,GMRVOE D KVAR^VADPT
 Q
DCALL ; DC ALL NON-DC'D ORDERS
 S ORUPKG=$O(^ORD(100.98,"B","VITALS/MEASUREMENTS",0)) G Q4:'ORUPKG
 S GMRVP=DFN_";DPT("
 F GMRX=0:0 S GMRX=$O(^OR(100,"AO",GMRVP,GMRX)) Q:GMRX'>0  F GMRVORDA=0:0 S GMRVORDA=$O(^OR(100,"AO",GMRVP,GMRX,ORUPKG,GMRVORDA)) Q:GMRVORDA'>0  D DC
 K GMRVORDA,GMRVP,GMRVSTAT,GMRVX,GMRVSTDT,ORIFN,ORUPKG
 Q
DC ; CHANGE ORDER STATUS IF NECESSARY
 K ORUPCHUK
 D EN^ORX8(GMRVORDA)
 S GMRVSTDT=+ORUPCHUK("ORSTRT"),GMRVSTAT=+ORUPCHUK("ORSTS")
 K ORUPCHUK
 Q:GMRVSTAT=1!(GMRVSTAT=2)!(GMRVSTDT>GMRVDGDT&(GMRVSTAT'=8))  S ORIFN=GMRVORDA
 I GMRVSTAT'=8 D NOW^%DTC S ORETURN("ORSTS")=1,ORETURN("ORSTOP")=%,ORETURN("OREVENT")="" D:GMRVSTAT'=11 RETURN^ORX K %,%H,ORETURN
 I GMRVSTAT=8 S ORSTS="K" D ST^ORX K ORSTS
 Q
DCHK ; CHECK TO SEE IF ORDERS NEED TO BE DC'D
 S GMRVSITE=$O(^GMRD(120.57,"B","HOSPITAL",0)),GMRVSITE(0)=$S($D(^GMRD(120.57,+GMRVSITE,0)):^(0),1:"") G QCHK:'$P(GMRVSITE(0),"^",3)&'$P(GMRVSITE(0),"^",4)
 S X=GMRVDGDT D H^%DTC S %H=%H_","_(%T-1) D YMD^%DTC S VAINDT=X_$S(%:%,1:"")
 D INP^VADPT S GMRVWRD(0)=VAIN(4) S VAINDT=GMRVDGDT D INP^VADPT S GMRVWRD(1)=VAIN(4)
 I $P(GMRVSITE(0),"^",3),+GMRVWRD(0)'=+GMRVWRD(1) D DCALL G QCHK
 I $P(GMRVSITE(0),"^",4) S GMRVSRV(0)=$S($D(^DIC(42,+GMRVWRD(0),0)):$P(^(0),"^",3),1:""),GMRVSRV(1)=$S($D(^DIC(42,+GMRVWRD(1),0)):$P(^(0),"^",3),1:"") I GMRVSRV(0)'=GMRVSRV(1) D DCALL
QCHK K GMRVSITE,GMRVWRD,GMRVSRV
 Q