source: FOIAVistA/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRACMR3.m@ 1757

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

initial load of FOIAVistA 6/30/08 version

File size: 1.3 KB
Line 
1GMRACMR3 ;HIRMFO/RM,WAA-PATIENT CENSUS CALCULATION ; 10/9/92
2 ;;4.0;Adverse Reaction Tracking;;Mar 29, 1996
3EN1 ;FINDS ALL PATIENTS WHO HAVE BEEN ADMITTED WITH IN A DATE RANGE
4 I GMRASEL["3" F GMRADATE=(GMRAST-.0000001):0 S GMRADATE=$O(^DGPM("AMV1",GMRADATE)) Q:GMRADATE'>0!(GMRADATE>GMRAED) D
5 .F GMRADFN=0:0 S GMRADFN=$O(^DGPM("AMV1",GMRADATE,GMRADFN)) Q:GMRADFN'>0 F GMRAMOV=0:0 S GMRAMOV=$O(^DGPM("AMV1",GMRADATE,GMRADFN,GMRAMOV)) Q:GMRAMOV'>0 D
6 ..S WLOC=$P($G(^DGPM(GMRAMOV,0)),"^",6),HLOC=+$G(^DIC(42,+WLOC,44)) Q:'HLOC
7 ..S GMRAX=HLOC D SETPT
8 ..Q
9 .Q
10EN2 ;THIS WILL FIND ALL CURRENT PATIENTS
11 I GMRASEL["1" D
12 .S GMRAX=0
13 .F S GMRAX=$O(^TMP($J,"GMRAWC",GMRAX)) Q:GMRAX<1 D
14 ..S WLOC=$G(^SC(GMRAX,42)) Q:+WLOC<1
15 ..S HLOC=$P($G(^DIC(42,+WLOC,0)),U) Q:HLOC=""
16 ..S GMRADFN=0 N GMRADT F S GMRADFN=$O(^DPT("CN",HLOC,GMRADFN)) Q:GMRADFN<1 S GMRADATE="CURRENT" D SETPT
17 ..Q
18 .Q
19 K GMRADATE,GMRAX,GMRANUM,HLOC,WLOC,GMRADFN,GMRAMOV Q
20SETPT ;This entry point is to set the patient data in the TMP global.
21 N GMRATMP
22 I '$D(^TMP($J,"GMRAWC",GMRAX)) Q
23 I $D(^TMP($J,"GMRAWC","B",GMRADFN,GMRAX)) Q
24 S ^TMP($J,"GMRAWC",GMRAX,GMRADATE,GMRADFN)=""
25 S ^TMP($J,"GMRAWC","B",GMRADFN,GMRAX)=""
26 S GMRATMP(1)=$P(^SC(GMRAX,0),U,2)
27 S GMRATMP(2)=$P(^SC(GMRAX,0),U)
28 S GMRATMP(3)=$S(GMRATMP(1)'="":GMRATMP(1),1:GMRATMP(2))
29 S ^TMP($J,"GMRAWC","C",GMRATMP(3),GMRAX)=""
30 Q
Note: See TracBrowser for help on using the repository browser.