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

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

initial load of WorldVistAEHR

File size: 3.2 KB
RevLine 
[613]1DGANHD1 ;ALB/RMO - Calculate NHCU and DOM AMIS's 345-346 ; 29 AUG 90 10:40 am
2 ;;5.3;Registration;;Aug 13, 1993
3 ;==============================================================
4 ;NHCU and DOM 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(345,DGMYR,"SE")) F DGSEG=0:0 S DGSEG=$O(^DGAM(345,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 ^DGANHD2,^DGANHD4
15 ;
16Q K DGAA,DGABO,DGADE,DGADI,DGAM,DGAO,DGAR,DGAS,DGBO,DGCE0,DGCE1,DGCP0,DGDE,DGDI,DGDIV,DGEND,DGFA,DGFE,DGERRFLG,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(345,"_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="NH":345,X="D":346,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 DGAR=$P(DGCE0,"^",18)-$P(DGCP0,"^",18) ; Adm Reh >30
33 S DGAO=($P(DGCE0,"^",17)-$P(DGCP0,"^",17))-DGAR ; Adm All Oth
34 S DGTI=$P(DGCE0,"^",13)-$P(DGCP0,"^",13) ; Trf In
35 S DGAO=DGAO-DGTI
36 S DGFA=$P(DGCE0,"^",19)-$P(DGCP0,"^",19) ; From ASIH
37 S DGTO=$P(DGCE0,"^",14)-$P(DGCP0,"^",14) ; Trf Out
38 S DGDE=$P(DGCE0,"^",15)-$P(DGCP0,"^",15) ; Deaths
39 S DGDI=($P(DGCE0,"^",5)-$P(DGCP0,"^",5))-DGDE-DGTO ; Discharges
40 S DGTA=$P(DGCE0,"^",20)-$P(DGCP0,"^",20) ; To ASIH
41 S DGBO=$P(DGCE0,"^",2) ; BO Rem EOM
42 S DGABO=$P(DGCE1,"^",6)+$P(DGCE1,"^",7) ; ABO Rem EOM
43 S DGAS=$P(DGCE1,"^",8) ; ASIH Rem EOM
44 S DGFE=$P(DGCE1,"^") ; Fem Rem EOM
45 S DGADI=$P(DGCE0,"^",21)-$P(DGCP0,"^",21) ; ASIH Dis
46 S DGADE=$P(DGCE0,"^",22)-$P(DGCP0,"^",22) ; ASIH Deaths
47 S DGDI=DGDI-DGADI-DGADE
48 S DGPD=$P(DGCE0,"^",3)-$P(DGCP0,"^",3) ; Pat Day Care
49 S DGAA=$P(DGCE0,"^",9)-$P(DGCP0,"^",9) ; AA <96 Hrs
50 S DGOB=$P(DGCE1,"^",2) ; Op Bed EOM
51 Q
52 ;
53UTL ;Save AMIS Statistics in the Utility Global
54 S DGAM=$S($D(^UTILITY($J,"DGANHD",DGMYR,DGSEG,DGDIV)):^(DGDIV),1:"")
55 S DGSTR=DGAR_"^"_DGAO_"^"_DGTI_"^"_DGFA_"^"_DGDI_"^"_DGDE_"^"_DGTO_"^"_DGTA_"^"_DGBO_"^"_DGABO_"^"_DGAS_"^"_DGFE_"^"_DGADI_"^"_DGADE_"^"_DGPD_"^"_DGAA_"^"_DGOB
56 S DGEND=17 F I=1:1:DGEND S $P(DGAM,"^",I)=$P(DGAM,"^",I)+$P(DGSTR,"^",I)
57 S ^UTILITY($J,"DGANHD",DGMYR,DGSEG,DGDIV)=DGAM
58 Q
Note: See TracBrowser for help on using the repository browser.