source: FOIAVistA/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCRA.m@ 1154

Last change on this file since 1154 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 1.5 KB
Line 
1GMRCRA ;SLC/DLT - Build ^TMP("GMRCR",$J, array of consults ;5/20/98 14:20
2 ;;3.0;CONSULT/REQUEST TRACKING;**1**;DEC 27, 1997
3AD ;Loop thru AD cross reference
4 D PRE
5 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)
6 S GMRCTC=GMRCT
7 Q
8ADBUILD ;Check for Service Match
9 I $P(^GMR(123,GMRCDA,0),"^",5),'$D(^TMP("GMRCS",$J,$P(^(0),"^",5))) Q
10 D BUILD Q
11AESS ;Build array based on service (variable GMRCSS) and single patient
12 D PRE
13 I '$D(^TMP("GMRCS",$J)) Q:'$D(GMRC1) D:GMRC1 AECONT Q
14 E S GMRCTO="" F S GMRCTO=$O(^TMP("GMRCS",$J,GMRCTO)) Q:GMRCTO="" S GMRC1=GMRCTO D AECONT
15 S GMRCTC=GMRCT S GMRCT=$S(GMRCT:1,1:0) ;INITIALIZE COUNT TO 1 FOR HDR
16 Q
17AECONT 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)
18 Q
19BUILD ;Build array
20 Q:$P(^GMR(123,GMRCDA,0),"^",12)=11 ;Do not include unreleased orders
21 S GMRCT=GMRCT+1,^TMP("GMRCR",$J,GMRCT,0)=^GMR(123,GMRCDA,0)
22 S:$D(^GMR(123,GMRCDA,30)) ^TMP("GMRCR",$J,GMRCT,30)=^(30)
23 S ^TMP("GMRCR",$J,GMRCT,"DA")=GMRCDA
24 Q
25PRE ;Setup for creating array of consults
26 S (GMRCTC,GMRCT,GMRC2,GMRCDA)=0,GMRC1=GMRCSS K GMRC,^TMP("GMRCR",$J)
27 Q
28END K GMRCD,GMRCDA,%T,DIC,GMRC,GMRCLO,GMRCPNM,GMRCRB,GMRCWARD,GMRCDOB,DIC,X,Y,VA,VAIN,VAINDT,VADM,VAEL,VAPA,VAERR,GMRCSN,GMRC0,GMRC1,GMRC2
Note: See TracBrowser for help on using the repository browser.