source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORQPTQ3.m

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

initial load of FOIAVistA 6/30/08 version

File size: 2.5 KB
Line 
1ORQPTQ3 ; SLC/CLA/KER - Demographic Functions ; 01/09/2003
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**159**;Dec 17, 1997
3 ;
4DEMOG(Y,DFN) ; RETURN PATIENT'S DEMOGRAPHIC INFO
5 ;DEM: SSN^DOB^AGE^SEX^RACE^ETHNICITY^RELIGION^MARITAL STATUS
6 ;INP: PRIMARY DUZ;NAME^ATTENDING DUZ;NAME^LOCATION^WARD^RMBED
7 N ORPTDEMO,ATTDUZ,PRIMDUZ,ORI,ORR,ORE,ORD,ORO D DEM^VADPT
8 S ORI=0 F S ORI=$O(VADM(11,ORI)) Q:+ORI=0 S ORD=$P(VADM(11,ORI),"^",2) S:$L(ORD) ORE=$G(ORE)_", "_ORD
9 F Q:$E(ORE,1,2)'=", " S ORE=$E(ORE,3,$L(ORE))
10 S ORI=0 F S ORI=$O(VADM(12,ORI)) Q:+ORI=0 S ORD=$P($G(VADM(12,ORI)),"^",2) S:$L(ORD) ORR=$G(ORR)_", "_ORD
11 F Q:$E(ORR,1,2)'=", " S ORR=$E(ORR,3,$L(ORR))
12 S ORO=$P(VADM(8),U,2) S:'$L(ORE)&('$L(ORR))&('$D(VADM(11)))&('$D(VADM(12))) ORE=ORO
13 S ORPTDEMO=$P(VADM(2),U)_U_$P(VADM(3),U,2)_U_VADM(4)_U_$P(VADM(5),U,2)_U_ORR_U_ORE_U_$P(VADM(9),U,2)_U_$P(VADM(10),U,2)
14 K VAINDT,VADM,VAERR S VA200=1
15 D INP^VADPT
16 S Y=ORPTDEMO_U_$P(VAIN(2),U)_";"_$P(VAIN(2),U,2)_U_$P(VAIN(11),U)_";"_$P(VAIN(11),U,2)_U_U_$P(VAIN(4),U,2)_U_VAIN(5)
17 K VA200,VAIN,VAERR
18 Q
19WRB(Y,DFN) ;return patient's ward, room-bed: ward ien^ward name room-bed
20 N WNAME,WIEN S WIEN="",Y=""
21 S WNAME=$G(^DPT(DFN,.1)) I $L(WNAME) S WIEN=$O(^DIC(42,"B",WNAME,WIEN))
22 I $L($G(WNAME)),$L($G(WIEN)) S Y=WIEN_U_WNAME_" "_$G(^DPT(DFN,.101))
23 Q
24NAME(ORY,DFN) ; return patient's name in mixed case
25 I '$L($G(^DPT(DFN,0))) S ORY="Not found" Q
26 S ORY=$$LOWER^VALM1($P(^DPT(DFN,0),U))
27 Q
28ADDR(Y,DFN) ; RETURN PATIENT'S ADDRESS & PHONE NUMBER
29 D ADD^VADPT
30 S Y=VAPA(1)_"^"_VAPA(2)_"^"_VAPA(3)_"^"_VAPA(4)_"^"_$P(VAPA(5),"^",2)_"^"_VAPA(6)_"^"_VAPA(8)
31 K VAPA
32 Q
33ATTPRIM(ORY,DFN) ; return patient's attending physician and primary provider
34 ; format: ATTEND DUZ^ATTEND NAME;PRIMARY DUZ^PRIMARY NAME
35 K VAINDT S VA200=1
36 D INP^VADPT
37 S ORY=$S($L($G(VAIN(11))):VAIN(11),1:"^not found") ;attending physician
38 S ORY=ORY_";"_$S($L($G(VAIN(2))):VAIN(2),1:"^not found") ;primary provider
39 K VA200,VAIN
40 Q
41WARD(Y,DFN) ; RETURN PATIENT'S WARD
42 D INP^VADPT
43 S Y=VAIN(4)
44 K VAIN
45 Q
46RMBED(Y,DFN) ; RETURN PATIENT'S ROOM-BED
47 D INP^VADPT
48 S Y=VAIN(5)
49 K VAIN
50 Q
51ATTEND(Y,DFN) ; RETURN PATIENT'S ATTENDING PHYSICIAN
52 ;NOT YET IMPLEMENTED
53 ;D INP^VADPT
54 Q
55SSN(Y,DFN) ; RETURN PATIENT'S SSN
56 D DEM^VADPT
57 S Y=VADM(2)
58 K VADM
59 Q
60DOB(Y,DFN) ; RETURN PATIENT'S DATE OF BIRTH
61 D DEM^VADPT
62 S Y=VADM(3)
63 K VADM
64 Q
65AGE(Y,DFN) ; RETURN PATIENT'S AGE
66 D DEM^VADPT
67 S Y=VADM(4)
68 K VADM
69 Q
70SEX(Y,DFN) ; RETURN PATIENT'S SEX
71 D DEM^VADPT
72 S Y=VADM(5)
73 K VADM
74 Q
Note: See TracBrowser for help on using the repository browser.