source: WorldVistAEHR/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNLGRPS.m@ 794

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

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1SPNLGRPS ; ISC-SF/GMB - SCD GATHER PATIENT STATISTICS DATA; 3 JUL 94 [ 08/08/94 2:19 PM ] ;6/23/95 11:39
2 ;;2.0;Spinal Cord Dysfunction;**18**;01/02/1997
3GATHER(DFN,FDATE,TDATE,QLIST) ;
4 ; DFN Patient's internal entry number in the Patient file
5 ; FDATE "From" date
6 ; TDATE "Thru" date, default=today
7 ; Data will be rolled up into the following global:
8 ; ^TMP("SPN",$J,"PS",
9 ; with the following nodes for each sex:
10 ; "SEX",sex) # patients of this sex
11 ; "STAT","DEAD",sex) # patients who are dead
12 ; "STAT","ALIVE",sex) # patients who are alive
13 ; "AGE",agerange,sex) # patients who are in this age range
14 ; "RACE",race,sex) # patients who are this race
15 ; "MEANS",means,sex) # patients who are in this means test category
16 ; "POS",pos,sex) # patients who are from this period of service
17 ; "ELIG",elig,sex) # patients with this eligibility
18 ; Additionally, if the user specified a time period:
19 ; "SEEN","IP",sex) # patients seen as an inpatient
20 ; "SEEN","OP",sex) # patients seen as an outpatient
21 ; "SEEN","CH",sex) # patients who had lab tests
22 ; "SEEN","RX",sex) # patients seen in pharmacy
23 ; "SEEN","RA",sex) # patients seen in radiology
24 N VADM,VAEL,AGE,SEX,AGERANGE,ISDEAD,MEANS,ELIG,POS,RACE
25 N SEEN,SEENIP,SEENOP,SEENCH,SEENRX,SEENRA,LASTSEEN
26 D DEM^VADPT ; Get patient demographics
27 ; If we are not including dead patients, and if the patient has a date of death recorded, then quit
28 S ISDEAD=+$P($G(VADM(6)),U,1)
29 I 'QLIST("INCLUDE DEAD"),ISDEAD Q
30 ; If we are only interested in patients who were seen during a certain
31 ; time period, but this patient was not seen during that period, then quit
32 I QLIST("WINDOW") D Q:'SEEN
33 . D SEEN^SPNLGUSN(DFN,FDATE,TDATE,.SEEN,.LASTSEEN,.SEENIP,.SEENOP,.SEENCH,.SEENRX,.SEENRA)
34 S SEX=$P(VADM(5),U,1)
35 I $F("MF",SEX)<2 S SEX="U"
36 ; Capture all the sexes
37 S ^TMP("SPN",$J,"PS","SEX",SEX)=""
38 ; Capture Dead/Alive
39 I ISDEAD S ^(SEX)=$G(^TMP("SPN",$J,"PS","STAT","DEAD",SEX))+1
40 E S ^(SEX)=$G(^TMP("SPN",$J,"PS","STAT","LIVE",SEX))+1
41 ; Capture age range
42 S AGE=VADM(4)
43 S AGERANGE=AGE\5*5
44 S ^(SEX)=$G(^TMP("SPN",$J,"PS","AGE",AGERANGE,SEX))+1
45 ; Capture Race
46 S RACE=$P($G(VADM(12,1)),U,2)
47 I RACE="" S RACE="UNSPECIFIED RACE"
48 S ^(SEX)=$G(^TMP("SPN",$J,"PS","RACE",RACE,SEX))+1
49 D ELIG^VADPT ; Get patient eligibility information
50 ; Capture Means Test Info
51 S MEANS=$P($G(VAEL(9)),U,2)
52 I MEANS="" SET MEANS="NOT REQUIRED"
53 S ^(SEX)=$G(^TMP("SPN",$J,"PS","MEANS",MEANS,SEX))+1
54 ; Capture Eligibility
55 S ELIG=$P($G(VAEL(1)),U,2)
56 I ELIG="" S ELIG="UNSPECIFIED ELIGIBILITY"
57 S ^(SEX)=$G(^TMP("SPN",$J,"PS","ELIG",ELIG,SEX))+1
58 ; Capture Period of Service Info
59 S POS=$P($G(VAEL(2)),U,2)
60 I POS="" S POS="UNSPECIFIED PERIOD OF SERVICE"
61 S ^(SEX)=$G(^TMP("SPN",$J,"PS","POS",POS,SEX))+1
62 ; Capture where seen, but only if report is for a specified period
63 I QLIST("WINDOW") D
64 . S:SEENIP ^(SEX)=$G(^TMP("SPN",$J,"PS","SEEN","IP",SEX))+1
65 . S:SEENOP ^(SEX)=$G(^TMP("SPN",$J,"PS","SEEN","OP",SEX))+1
66 . S:SEENCH ^(SEX)=$G(^TMP("SPN",$J,"PS","SEEN","CH",SEX))+1
67 . S:SEENRX ^(SEX)=$G(^TMP("SPN",$J,"PS","SEEN","RX",SEX))+1
68 . S:SEENRA ^(SEX)=$G(^TMP("SPN",$J,"PS","SEEN","RA",SEX))+1
69 Q
Note: See TracBrowser for help on using the repository browser.