source: FOIAVistA/tag/r/ZZREGIONAL-A1C-A5C-CRHD-RGED-RGUT-RGWB-RG/CRHDUT2.m@ 1424

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

initial load of FOIAVistA 6/30/08 version

File size: 3.2 KB
Line 
1CRHDUT2 ; CAIRO/CLC - GET THE PATIENT DATA ELEMENTS FOR HANDOFF LIST CONTINUED;04-Mar-2008 16:00;CLC
2 ;;1.0;CRHD;****;Jan 28, 2008;Build 19
3 ;=================================================================
4PATDEMO(CRHDDATA,CRHDSTR) ;GET PATIENTS DEMOGRAPHICS
5 ;DFN - patient internal entry number to the Patient file
6 ;P - pieces to return from retrieve data string
7 ;CRHDLEN - max length of returned items, defaults to 18
8 ;LABELS - 0 or 1
9 ;Output
10 ;CRHDRTN
11 ;DFN - Piece 1 NAME Piece 2
12 ;SSN 3 (full ssn) DOB 4
13 ;SSN 5 (last 4ssn) AGE 6
14 ;SEX 7 RM 8
15 ;TSP 9 ATN 10
16 ;PCP 11 LOC 12
17 ;ADMDT 13 (adm date) DAY w/i ADM 14
18 ;ADMDX 15 (admission Diagnosis)
19 ;
20 N VAIN,VAIP,VADM,CRHDNAME,CRHDSSN,CRHDDOB,CRHDAGE,CRHDSEX,CRHDRM,CRHDTSP,CRHDATTN,CRHDRTN,CRHDLEN,CRHDLBLS
21 N CRHDPCP,CRHDWARD,CRHDADMD,CRHDADAY,CRHDADX,CRHDI,CRHDTRG,CRHDNUM,CRHDP,DFN
22 K CRHDDATA
23 S CRHDTRG="^TMP(""CRHD_ORDATA"",$J)"
24 K @CRHDTRG,CRHDRTN
25 S CRHDNUM=0
26 S DFN=+CRHDSTR
27 S CRHDP=$P(CRHDSTR,U,2)
28 I CRHDP=""!(CRHDP="ALL") S CRHDP="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15"
29 S CRHDLEN=$P(CRHDSTR,U,3)
30 I 'CRHDLEN S CRHDLEN=18
31 S CRHDLBLS=$P(CRHDSTR,U,4)
32 Q:'DFN
33 D DEM^VADPT
34 S CRHDNAME=VADM(1),CRHDSSN=$P(VADM(2),U,1),CRHDDOB=$P(VADM(3),U,2)
35 S CRHDAGE=VADM(4),CRHDSEX=$P(VADM(5),U,1)
36 D INP^VADPT
37 S CRHDRM=$G(VAIN(5)) ;Room/Bed
38 S CRHDTSP=$P($G(VAIN(3)),U,2) ;Team (Treating Specialty)
39 S CRHDATTN=$P($G(VAIN(11)),U,2) ;Attending Physicial
40 S CRHDPCP=$P($$OUTPTPR^SDUTL3(DFN,DT),U,2) ;Primary Care Provider
41 S CRHDWARD=$P($G(VAIN(4)),U,2) ;Ward Location
42 S CRHDADMD=$P($G(VAIN(7)),U,2) ;Admission Date
43 S:+$G(VAIN(7))>0 CRHDADAY=$$FMDIFF^XLFDT(+$$DT^XLFDT,+$G(VAIN(7)),1) ;Day within Admission
44 S CRHDADX=$G(VAIN(9)) ;Admission Diagnosis
45 I $G(CRHDLBLS) D
46 .S CRHDRTN=DFN_U_$E(CRHDNAME,1,CRHDLEN)_U_"SSN: "_CRHDSSN_U_"DOB: "_CRHDDOB
47 .S CRHDRTN=CRHDRTN_U_"SSN: "_$E(CRHDSSN,6,9)_U_"AGE: "_CRHDAGE_U_"SEX: "_CRHDSEX
48 .S CRHDRTN=CRHDRTN_U_"RM : "_CRHDRM_U_"TM: "_$E(CRHDTSP,1,CRHDLEN-4)
49 .S CRHDRTN=CRHDRTN_U_"ATN: "_$E(CRHDATTN,1,CRHDLEN-5)_U_"PCP: "_$E(CRHDPCP,1,CRHDLEN-5)
50 .S CRHDRTN=CRHDRTN_U_"LOC: "_CRHDWARD_U_CRHDADMD_U_"DAY OF ADM: "_$G(CRHDADAY)_U_"ADM DX: "_$E(CRHDADX,1,CRHDLEN)
51 .F CRHDI=1:1:$L(CRHDP,",") I $P(CRHDRTN,"^",$P(CRHDP,",",CRHDI))'="" S CRHDDATA=$G(CRHDDATA)_$P(CRHDRTN,"^",$P(CRHDP,",",CRHDI)) S:CRHDI<$L(CRHDP,",") CRHDDATA=CRHDDATA_"^"
52 E D
53 .S CRHDRTN=DFN_U_$E(CRHDNAME,1,CRHDLEN)_U_CRHDSSN_U_CRHDDOB_U_$E(CRHDSSN,6,9)_U_CRHDAGE_U_CRHDSEX_U_CRHDRM_U_$E(CRHDTSP,1,CRHDLEN)_U_$E(CRHDATTN,1,CRHDLEN-5)_U_$E(CRHDPCP,1,CRHDLEN-5)_U_CRHDWARD_U_CRHDADMD_U_$G(CRHDADAY)_U_$E(CRHDADX,1,CRHDLEN)
54 .F CRHDI=1:1:$L(CRHDP,",") S CRHDDATA=$G(CRHDDATA)_$P(CRHDRTN,"^",$P(CRHDP,",",CRHDI)) S:CRHDI<$L(CRHDP,",") CRHDDATA=CRHDDATA_"^"
55 Q
56AUSRINFO(CRHDRTN,CRHDUSR) ;retrieve additional user information
57 N X,Y
58 K CRHDRTN
59 S CRHDRTN(1)=0
60 S CRHDRTN(1)=$$GET1^DIQ(200,CRHDUSR_",",.132,"E")_"^"_$$GET1^DIQ(200,CRHDUSR_",",.138,"E")_"^"_$$GET^XPAR("USR.`"_CRHDUSR,"ORLP DEFAULT TEAM",1,"I")
61 Q
Note: See TracBrowser for help on using the repository browser.