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

GMRCRA.m

Go to the documentation of this file.
GMRCRA ;SLC/DLT - Build ^TMP("GMRCR",$J, array of consults ;15-Mar-2012 10:41;PLS
 ;;3.0;CONSULT/REQUEST TRACKING;**1,1001,1003**;DEC 27, 1997;Build 14
 ;Modified - IHS/CIA/MGH - 11/29/2005 - Line END+1  - Code changed to use HRCN instead of SSN
 D PRE
 S GMRCD=0 F  S GMRCD=$O(^GMR(123,"AD",DFN,GMRCD)) Q:'GMRCD!($D(GMRCQIT))  S GMRCDA=0 F  S GMRCDA=$O(^GMR(123,"AD",DFN,GMRCD,GMRCDA)) Q:'GMRCDA!($D(GMRCQIT))  D ADBUILD Q:$D(GMRCQIT)
 S GMRCTC=GMRCT
 Q
ADBUILD ;Check for Service Match
 I $P(^GMR(123,GMRCDA,0),"^",5),'$D(^TMP("GMRCS",$J,$P(^(0),"^",5))) Q
 D BUILD Q
AESS ;Build array based on service (variable GMRCSS) and single patient
 D PRE
 I '$D(^TMP("GMRCS",$J)) Q:'$D(GMRC1)  D:GMRC1 AECONT Q
 E  S GMRCTO="" F  S GMRCTO=$O(^TMP("GMRCS",$J,GMRCTO)) Q:GMRCTO=""  S GMRC1=GMRCTO D AECONT
 S GMRCTC=GMRCT S GMRCT=$S(GMRCT:1,1:0) ;INITIALIZE COUNT TO 1 FOR HDR
 Q
AECONT S GMRC2=0 F  S GMRC2=$O(^GMR(123,"AE",GMRC1,DFN,GMRC2)) Q:'GMRC2!($D(GMRCQIT))  S GMRCDA=0 F  S GMRCDA=$O(^GMR(123,"AE",GMRC1,DFN,GMRC2,GMRCDA)) Q:'GMRCDA!($D(GMRCQIT))  D BUILD Q:$D(GMRCQIT)
 Q
BUILD ;Build array
 Q:$P(^GMR(123,GMRCDA,0),"^",12)=11  ;Do not include unreleased orders
 S GMRCT=GMRCT+1,^TMP("GMRCR",$J,GMRCT,0)=^GMR(123,GMRCDA,0)
 S:$D(^GMR(123,GMRCDA,30)) ^TMP("GMRCR",$J,GMRCT,30)=^(30)
 S ^TMP("GMRCR",$J,GMRCT,"DA")=GMRCDA
 Q
PRE ;Setup for creating array of consults
 S (GMRCTC,GMRCT,GMRC2,GMRCDA)=0,GMRC1=GMRCSS K GMRC,^TMP("GMRCR",$J)
 Q
END K GMRCD,GMRCDA,%T,DIC,GMRC,GMRCLO,GMRCPNM,GMRCRB,GMRCWARD,GMRCDOB,DIC,X,Y,VA,VAIN,VAINDT,VADM,VAEL,VAPA,VAERR,GMRCSN,GMRCHRCN,GMRC0,GMRC1,GMRC2  ;IHS/CIA/MGH