1 | DGMTU1 ;ALB/RMO/MIR/CKN - Patient Relation Utilities ; 11/8/05 2:21pm
|
---|
2 | ;;5.3;Registration;**166,653**;Aug 13, 1993;Build 2
|
---|
3 | ;
|
---|
4 | ;
|
---|
5 | ;=======================================================================
|
---|
6 | ; The first set of utilities will display data from the PATIENT
|
---|
7 | ; RELATION file
|
---|
8 | ;=======================================================================
|
---|
9 | ;
|
---|
10 | ;
|
---|
11 | DEM(DGPRI) ;Demographics of Patient Relation
|
---|
12 | ; Input -- DGPRI Patient Relation IEN
|
---|
13 | ; Output -- Patient or Income Person 0th node
|
---|
14 | N DGVPI,DGVP0
|
---|
15 | S DGVPI=$P($G(^DGPR(408.12,DGPRI,0)),"^",3)
|
---|
16 | I DGVPI]"" S DGVP0=$G(@("^"_$P(DGVPI,";",2)_+DGVPI_",0)"))
|
---|
17 | Q $S($G(DGVP0)]"":DGVP0,1:"")
|
---|
18 | ;
|
---|
19 | DEM1(DGPRI) ;Demographics of Patient Relation node 1
|
---|
20 | ; Input -- DGPRI Patient Relation IEN
|
---|
21 | ; Output -- Patient or Income Person node 1
|
---|
22 | N DGVPI,DGVP1
|
---|
23 | S DGVPI=$P($G(^DGPR(408.12,DGPRI,0)),"^",3)
|
---|
24 | I DGVPI]"" S DGVP1=$G(@("^"_$P(DGVPI,";",2)_+DGVPI_",1)"))
|
---|
25 | Q $S($G(DGVP1)]"":DGVP1,1:"")
|
---|
26 | ;
|
---|
27 | NODE(DGPRI) ;Send back the name, sex, dob, and SSN in external format
|
---|
28 | ; Input -- DGPRI Patient Relation IEN
|
---|
29 | ; Output -- External format of name, sex, dob, and SSN
|
---|
30 | ; in pieces 1,2,3, and 9 respectively
|
---|
31 | ;
|
---|
32 | ; NOTE: date is in mm/dd/yyyy format
|
---|
33 | ;
|
---|
34 | N NODE,X,Y
|
---|
35 | S NODE=$$DEM(DGPRI)
|
---|
36 | S X=$P(NODE,"^",2) I X]"" S $P(NODE,"^",2)=$S(X="M":"MALE",X="F":"FEMALE",1:"") ; sex
|
---|
37 | S X=$P(NODE,"^",3) I X]"" S X=$$FMTE^XLFDT(X,"5DF") S $P(NODE,"^",3)=$TR(X," ","0")
|
---|
38 | S X=$P(NODE,"^",9) I X]"" S $P(NODE,"^",9)=$E(X,1,3)_"-"_$E(X,4,5)_"-"_$E(X,6,10)
|
---|
39 | S $P(NODE,"^",4,8)="^^^^",$P(NODE,"^",10,99)=""
|
---|
40 | Q NODE
|
---|
41 | ;
|
---|
42 | NAME(DGPRI) ;Name of Patient Relation
|
---|
43 | ; Input -- DGPRI Patient Relation IEN
|
---|
44 | ; Output -- Patient or Income Person Name
|
---|
45 | N DGNM
|
---|
46 | S DGNM=$P($$DEM(DGPRI),"^")
|
---|
47 | Q $G(DGNM)
|
---|
48 | ;
|
---|
49 | SEX(DGPRI) ;Sex of Patient Relation
|
---|
50 | ; Input -- DGPRI Patient Relation IEN
|
---|
51 | ; Output -- Patient or Income Person Sex
|
---|
52 | N DGSEX,Y
|
---|
53 | S Y=$P($$DEM(DGPRI),"^",2) S DGSEX=$S(Y="M":"MALE",Y="F":"FEMALE",1:"")
|
---|
54 | Q $G(DGSEX)
|
---|
55 | ;
|
---|
56 | DOB(DGPRI) ;Date of Birth of Patient Relation
|
---|
57 | ; Input -- DGPRI Patient Relation IEN
|
---|
58 | ; Output -- Patient or Income Person Date of Birth
|
---|
59 | N DGDOB,Y
|
---|
60 | S Y=$P($$DEM(DGPRI),"^",3) X ^DD("DD") S DGDOB=Y
|
---|
61 | Q $G(DGDOB)
|
---|
62 | ;
|
---|
63 | SSN(DGPRI) ;Social Security Number of Patient Relation
|
---|
64 | ; Input -- DGPRI Patient Relation IEN
|
---|
65 | ; Output -- Patient or Income Person Social Security Number
|
---|
66 | N DGSSN,Y
|
---|
67 | S Y=$P($$DEM(DGPRI),"^",9) S DGSSN=$S(Y]"":$E(Y,1,3)_"-"_$E(Y,4,5)_"-"_$E(Y,6,10),1:"")
|
---|
68 | Q $G(DGSSN)
|
---|
69 | ;
|
---|
70 | REL(DGPRI) ;Relationship of Patient Relation
|
---|
71 | ; Input -- DGPRI Patient Relation IEN
|
---|
72 | ; Output -- Relationship of Patient Relation
|
---|
73 | N DGREL
|
---|
74 | S DGREL=$P($G(^DG(408.11,+$P($G(^DGPR(408.12,DGPRI,0)),U,2),0)),U)
|
---|
75 | Q $G(DGREL)
|
---|