source: FOIAVistA/tag/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGAINP1.m@ 636

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

initial load of FOIAVistA 6/30/08 version

File size: 3.5 KB
Line 
1DGAINP1 ;ALB/RMO - Calculate Inpatient AMIS's 334-341 ; 27 DEC 89 1:37 pm
2 ;;5.3;Registration;;Aug 13, 1993
3 ;==============================================================
4 ;Inpatient AMIS segments are calculated by looping through the
5 ;Ward Location file.
6 ;
7 ;Input:
8 ; DGMYR -Month/Year being calculated in internal date format
9 ; DGEOM -Last day of Month/Year in internal date format
10 ; DGPEOM -Last day of Prior Month/Year in internal date format
11 ;==============================================================
12 I $D(^DGAM(334,DGMYR,"SE")) F DGSEG=0:0 S DGSEG=$O(^DGAM(334,DGMYR,"SE",DGSEG)) Q:'DGSEG D DEL
13 F DGWI=0:0 S DGWI=$O(^DIC(42,DGWI)) Q:'DGWI I $D(^(DGWI,0)) S DGW0=^(0) D CEN I DGSEG,'DGERRFLG D CAL,UTL
14 D PSY,^DGAINP2,^DGAINP4
15 ;
16Q K DGAA,DGAM,DGABO,DGBO,DGCE0,DGCE1,DGCP0,DGDA,DGDE,DGDO,DGDIV,DGEND,DGERRFLG,DGFE,DGGB,DGL45,DGLB,DGOB,DGPD,DGSEG,DGSTR,DGTA,DGTI,DGTO,DGW0,DGWI,I,X
17 Q
18 ;
19DEL ;Delete Previous AMIS Statistics
20 S DA(1)=DGMYR,DA=DGSEG,DIK="^DGAM(334,"_DGMYR_",""SE""," D ^DIK K DA,DIK
21 Q
22 ;
23CEN ;AMIS Statistics are Calculated using data for Ward from Census File
24 S DGERRFLG=0,X=$P(DGW0,"^",3),DGSEG=$S(X="P":334,X="I":335,X="M":336,X="NE":337,X="R":338,X="B":339,X="SCI":340,X="S":341,1:0) Q:'DGSEG
25 S DGDIV=$S($P(DGW0,"^",11):+$P(DGW0,"^",11),$D(^DG(43,1,"GL")):+$P(^("GL"),"^",3),1:0)
26 S DGCP0=$S($E(DGPEOM,4,5)="09":0,$D(^DG(41.9,DGWI,"C",DGPEOM,0)):^(0),1:"") ;Last day of prior month
27 S DGCE0=$S($D(^DG(41.9,DGWI,"C",DGEOM,0)):^(0),1:""),DGCE1=$S($D(^DG(41.9,DGWI,"C",DGEOM,1)):^(1),1:"") ;Last day of selected month
28 I DGCP0=""!(DGCE0="") W !!,$S(DGCP0="":"Beginning",1:"End")," of month statistics are missing for ward ",$P(DGW0,"^"),".",!,"Ward not included in AMIS ",DGSEG," calculations." S DGERRFLG=1
29 Q
30 ;
31CAL ;Actual Calculations for AMIS Fields
32 S DGTI=$P(DGCE0,"^",13)-$P(DGCP0,"^",13) ; Trf In
33 S DGTA=($P(DGCE0,"^",17)-$P(DGCP0,"^",17))-DGTI ; Tot Adm
34 S DGGB=$P(DGCE0,"^",23)-$P(DGCP0,"^",23) ; Gain Bed Sec
35 S DGDE=$P(DGCE0,"^",15)-$P(DGCP0,"^",15) ; Deaths
36 S DGDO=($P(DGCE0,"^",16)-$P(DGCP0,"^",16)) ; Dis OPT/NSC
37 S DGTO=$P(DGCE0,"^",14)-$P(DGCP0,"^",14) ; Trf Out
38 S DGDA=($P(DGCE0,"^",5)-$P(DGCP0,"^",5))-DGDE-DGDO-DGTO ;Dis All Oth
39 S DGLB=$P(DGCE0,"^",8)-$P(DGCP0,"^",8) ; Loss Bed Sec
40 S DGBO=$P(DGCE0,"^",2) ; BO Rem EOM
41 S DGABO=$P(DGCE1,"^",6)+$P(DGCE1,"^",7) ; ABO Rem EOM
42 S DGPD=$P(DGCE0,"^",3)-$P(DGCP0,"^",3) ; Pat Day Care
43 S DGAA=$P(DGCE0,"^",9)-$P(DGCP0,"^",9) ; AA <96 Hrs
44 S DGOB=$P(DGCE1,"^",2) ; Op Bed EOM
45 S DGFE=$P(DGCE1,"^") ; Fem Rem EOM
46 Q
47 ;
48UTL ;Save AMIS Statistics in the Utility Global
49 ;Note: Dial Op Beds set to 0 for Austin
50 S DGAM=$S($D(^UTILITY($J,"DGAINP",DGMYR,DGSEG,DGDIV)):^(DGDIV),1:"")
51 S DGSTR=DGTA_"^"_DGTI_"^"_DGGB_"^"_DGDE_"^"_DGDO_"^"_DGDA_"^"_DGTO_"^"_DGLB_"^"_DGBO_"^"_DGABO_"^"_$S(DGSEG>334:DGPD,1:"0^"_DGPD)_"^"_DGAA_"^"_DGOB_"^"_DGFE_$S(DGSEG=336:"^0",1:"")
52 S DGEND=$S(DGSEG=334!(DGSEG=336):15,1:14) F I=1:1:DGEND S $P(DGAM,"^",I)=$P(DGAM,"^",I)+$P(DGSTR,"^",I)
53 S ^UTILITY($J,"DGAINP",DGMYR,DGSEG,DGDIV)=DGAM
54 Q
55 ;
56PSY ;Set Utility GLobal for Psych 1-45 PDC
57 D ^DGAINP0
58 F DGDIV=0:0 S DGDIV=$O(^UTILITY($J,"DGAINP",DGMYR,334,DGDIV)) Q:'DGDIV S:$D(DGL45(DGDIV)) $P(^(DGDIV),"^",11,12)=DGL45(DGDIV)_"^"_$S($P(^(DGDIV),"^",12)<DGL45(DGDIV):0,1:$P(^(DGDIV),"^",12)-DGL45(DGDIV))
59 Q
Note: See TracBrowser for help on using the repository browser.