source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPMV10.m@ 686

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

initial load of WorldVistAEHR

File size: 5.2 KB
Line 
1DGPMV10 ;ALB/MRL/MIR - PATIENT MOVEMENT, CONT.; 11 APR 89 ; 4/15/03 5:48pm
2 ;;5.3;Registration;**84,498,509,683,719**;Aug 13, 1993
3CS ;Current Status
4 ;first print primary care team/practitioner/attending
5 D PCMM^SCRPU4(DFN,DT)
6 S X=$S('DGPMT:1,DGPMT<4:2,DGPMT>5:2,1:3) ;DGPMT=0 if from pt inq (DGRPD)
7 I '$D(^DGPM("C",DFN)) W !!,"Status : PATIENT HAS NO INPATIENT OR LODGER ACTIVITY IN THE COMPUTER",*7 D CS2 Q
8 S A=$S("^3^5^"[("^"_+DGPMVI(2)_"^"):0,1:+DGPMVI(2)) W !!,"Status : ",$S('A:"IN",1:""),"ACTIVE ",$S("^4^5^"[("^"_+DGPMVI(2)_"^"):"LODGER",1:"INPATIENT")
9 G CS1:'A W "-" S X=+DGPMVI(4) I X=1 W "on PASS" G CS1
10 I "^2^3^25^26^"[("^"_X_"^") W "on ",$S("^2^26^"[X:"A",1:"U"),"A" G CS1
11 I "^13^43^44^45^"[("^"_X_"^") W "ASIH" G CS1
12 I X=6 W "OTHER FAC" G CS1
13 W "on WARD"
14CS1 I +DGPMVI(2)=3,$D(^DGPM(+DGPMVI(17),0)) W ?39,"Discharge Type : ",$S($D(^DG(405.1,+$P(^(0),"^",4),0)):$P(^(0),"^",1),1:"UNKNOWN")
15 I "^3^4^5^"'[("^"_+DGPMVI(2)_"^"),$D(^DPT(DFN,"DAC")),($P(^("DAC"),"^",1)="S") W " (Seriously ill)"
16 W ! I +DGPMVI(19,1) W "Patient chose not to be included in the Facility Directory for this admission"
17 W !,$S("^4^5^"'[("^"_+DGPMVI(2)_"^"):"Admitted ",1:"Checked-in "),": "_$P(DGPMVI(13,1),"^",2)
18 W ?39,$S("^4^5^"[("^"_+DGPMVI(2)_"^"):"Checked-out",+DGPMVI(2)=3:"Discharged ",1:"Transferred")," : ",$S("^1^4^"'[("^"_+DGPMVI(2)_"^"):$P(DGPMVI(3),"^",2),$P(DGPMVI(3),"^",2)'=$P(DGPMVI(13,1),"^",2):$P(DGPMVI(3),"^",2),1:"")
19 W !,"Ward : ",$E($P(DGPMVI(5),"^",2),1,24),?39,"Room-Bed : ",$E($P(DGPMVI(6),"^",2),1,21) I "^4^5^"'[("^"_+DGPMVI(2)_"^") W !,"Provider : ",$E($P(DGPMVI(7),"^",2),1,26),?39,"Specialty : ",$E($P(DGPMVI(8),"^",2),1,21)
20 W !,"Attending : ",$E($P(DGPMVI(18),"^",2),1,26)
21 D CS2
22 S DGPMIFN=DGPMVI(13) I +DGPMVI(2)'=4&(+DGPMVI(2)'=5) D ^DGPMLOS W !!,"Admission LOS: ",+$P(X,"^",5)," Absence days: ",+$P(X,"^",2)," Pass Days: ",+$P(X,"^",3)," ASIH days: ",+$P(X,"^",4)
23 K A,C,I,J,X
24 Q
25 ;
26CS2 ;-- additional fields for admission screen
27 Q:DGPMT'=1
28 S DGHOLD=$S($D(^DPT(DFN,0)):^(0),1:"")
29 W !!,"Religion : ",$S($D(^DIC(13,+$P(DGHOLD,U,8),0)):$E($P(^(0),U),1,24),1:"")
30 W ?39,"Marital Status : ",$S($D(^DIC(11,+$P(DGHOLD,U,5),0)):$P(^(0),U),1:"")
31 S DGHOLD=$S($D(^DPT(DFN,.36)):$P(^(.36),U),1:"")
32 W !,"Eligibility : ",$S($D(^DIC(8,+$P(DGHOLD,U),0)):$P(^(0),U),1:"")
33 S DGHOLD=$S($D(^DPT(DFN,.361)):^(.361),1:"")
34 W:$P(DGHOLD,U)]"" " (",$P($P($P(^DD(2,.3611,0),U,3),$P(DGHOLD,U)_":",2),";"),")"
35 W:$P(DGHOLD,U)']"" " (NOT VERIFIED)"
36 K DGHOLD
37 Q
38 ;
39LODGER ;set-up necessary variables if getting last lodger episode
40 ;only need 1,2,13,17 - date/time,TT,check-in IFN,check-out IFN
41 S I=$O(^DGPM("ATID4",DFN,0)),I=$O(^(+I,0))
42 S X=$S($D(^DGPM(+I,0)):^(0),1:"") I 'X D NULL Q
43 I $D(^DGPM(+$P(X,"^",17),0)) S (DGPMDCD,DGPMVI(1))=+^(0),DGPMVI(2)=5,DGPMVI(13)=I,DGPMVI(17)=$P(X,"^",17) Q
44 S (DGPMDCD,DGPMVI(17))="",DGPMVI(1)=+X,DGPMVI(2)=4,DGPMVI(13)=I
45 Q
46NULL S DGPMDCD="" F I=1,2,13,17 S DGPMVI(I)=""
47 Q
48 ;
49INP ;set-up inpt vbls needed (mimic VAIP array)
50 ;
51 ;Called from scheduling, too
52 ;
53 D NOW^%DTC S (VAX("DAT"),NOW)=%,NOWI=9999999.999999-% I '$D(VAIP("E")) D LAST^VADPT3
54 F I=1:1:8,13,17 S DGPMVI(I)=""
55 F I=13,19 S DGPMVI(I,1)=""
56 S DGPMVI(1)=$S($D(VAIP("E")):VAIP("E"),1:E) ;use ifn of last mvt from VADPT call or one passed from DGPMV
57 S DGX=$G(^DGPM(+DGPMVI(1),0)),DGPMVI(2)=$P(DGX,"^",2),DGPMVI(4)=$P(DGX,"^",18) S Y=+DGX X ^DD("DD") S DGPMVI(3)=$P(DGX,"^",1)_"^"_Y
58 S DGPMVI(5)=$P(DGX,"^",6)_"^"_$S($D(^DIC(42,+$P(DGX,"^",6),0)):$P(^(0),"^",1),1:""),DGPMVI(6)=$P(DGX,"^",7)_"^"_$S($D(^DG(405.4,+$P(DGX,"^",7),0)):$P(^(0),"^",1),1:""),DGPMVI(13)=$P(DGX,"^",14)
59 I "^3^5^"[("^"_DGPMVI(2)_"^") D GETWD ;get from ward if d/c or check-out
60 S DGX=$G(^DGPM(+DGPMVI(13),0)) I DGX]"" S Y=+DGX X ^DD("DD") S DGPMVI(13,1)=$P(DGX,"^",1)_"^"_Y,DGPMVI(17)=$P(DGX,"^",17) I $D(DGPMSVC) S DGPMSV=$P($G(^DIC(42,+$P(DGX,"^",6),0)),"^",3)
61 S DGPMDCD=$S($D(^DGPM(+DGPMVI(17),0)):$P(^(0),"^",1),1:"")
62 S (DGTS,DGPP,DGAP)="" ;t.s., primary care physician, attending
63 F I=NOWI:0 S I=$O(^DGPM("ATS",DFN,+DGPMVI(13),I)) Q:'I F J=0:0 S J=$O(^DGPM("ATS",DFN,+DGPMVI(13),I,J)) Q:'J F IFN=0:0 S IFN=$O(^DGPM("ATS",DFN,+DGPMVI(13),I,J,IFN)) Q:'IFN D TS1 G TSQ:DGTS&DGPP&DGAP
64TSQ S DGPMVI(7)=DGPP,DGPMVI(8)=DGTS,DGPMVI(18)=DGAP
65 S DGX=$G(^DGPM(+DGPMVI(13),0)) I $P(DGX,"^",2)=1 D
66 .S DGX=$G(^DGPM(+DGPMVI(13),"DIR"))
67 .S DGX=$P(DGX,"^",1)
68 .I DGX="" S DGX=$S('DGPMDCD:1,(DGPMDCD<3030414.999999):"",1:1) Q:DGX=""
69 .S DGPMVI(19,1)=DGX_"^"_$$EXTERNAL^DILFD(405,41,,DGX)
70 D Q^VADPT3 K DGAP,DGPP,DGTS,DGX,IFN
71 Q
72 ;
73TS1 ; set DGTS, DGPP, and DGAP
74 Q:'$D(^DGPM(IFN,0)) S DGX=^(0)
75 I 'DGPP,$D(^VA(200,+$P(DGX,"^",8),0)) S Y=$P(DGX,"^",8)_"^"_$P(^(0),"^") S DGPP=Y
76 I 'DGAP,$D(^VA(200,+$P(DGX,"^",19),0)) S Y=$P(DGX,"^",19)_"^"_$P(^(0),"^") S DGAP=Y
77 I 'DGTS,$D(^DIC(45.7,+$P(DGX,"^",9),0)) S DGTS=$P(DGX,"^",9)_"^"_$P(^(0),"^")
78 Q
79GETWD ;get the from ward if last mvt is discharge or check-out
80 I DGPMVI(2)=5 S J=DGPMVI(13) D SETWD Q
81 F I=0:0 S I=$O(^DGPM("APMV",DFN,DGPMVI(13),I)) Q:'I!+DGPMVI(5) F J=0:0 S J=$O(^DGPM("APMV",DFN,DGPMVI(13),I,J)) Q:'J D SETWD Q:+DGPMVI(5)
82 Q
83 ;
84SETWD ;set ward and room-bed variables for discharge/check-out mvts
85 S X=$G(^DGPM(J,0))
86 I $D(^DIC(42,+$P(X,"^",6),0)) S DGPMVI(5)=$P(X,"^",6)_"^"_$P(^(0),"^",1)
87 I $D(^DG(405.4,+$P(X,"^",7),0)) S DGPMVI(6)=$P(X,"^",7)_"^"_$P(^(0),"^",1)
88 Q
Note: See TracBrowser for help on using the repository browser.