Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: APCLHCT2

APCLHCT2.m

Go to the documentation of this file.
APCLHCT2 ; IHS/CMI/LAB - extension of APCLHCT ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 S APCLSUF=$P(^AUTTLOC(APCLLOC,0),U,5)
 S APCLBT=$H,APCLJOB=$J
 K ^XTMP("APCLHCT",APCLJOB,APCLBT),^XTMP("APCLHCTR",APCLJOB,APCLBT),^XTMP("APCLHCT","APCLSU",APCLJOB,APCLBT)
 D XTMP^APCLOSUT("APCLHCT","PCC REG PATS REPORT")
 D XTMP^APCLOSUT("APCLHCTR","PCC REG PATS REPORT")
 S APCLMAJ=$S(APCLSORT="C":"APCLCOMN",APCLSORT="T":"APCLTRI",1:"APCLSUR"),APCLMIN=$S(APCLSORT="C":"APCLTRI",1:"APCLCOMN")
 ;
 S APCLSD=$$FMADD^XLFDT(APCLSD,-1)_".9999"
 F  S APCLSD=$O(^AUPNVINP("B",APCLSD)) Q:APCLSD'=+APCLSD!($P(APCLSD,".")>APCLED)  D
 .S APCLIDFN=0 F  S APCLIDFN=$O(^AUPNVINP("B",APCLSD,APCLIDFN)) Q:APCLIDFN'=+APCLIDFN  D C1
 .Q
 Q
C1 ;
 Q:'$D(^AUPNVINP(APCLIDFN,0))
 S V=$P(^AUPNVINP(APCLIDFN,0),U,3)
 Q:'$D(^AUPNVSIT(V,0))
 Q:$P(^AUPNVSIT(V,0),U,6)'=APCLLOC
 S DFN=$P(^AUPNVINP(APCLIDFN,0),U,2)
 Q:'DFN
 Q:$P(^DPT(DFN,0),U,19)]""
 Q:$$DEMO^APCLUTL(DFN,$G(APCLDEMO))
 I '$D(^AUPNPAT(DFN,11)),APCLIND=1 Q
 I '$D(^AUPNPAT(DFN,11)),APCLIND=0 S APCLTRI="NO TRIBE ENTERED" G C11
C1A I $P(^AUPNPAT(DFN,11),U,8)="",APCLIND=0 S APCLTRI="NO TRIBE ENTERED" G C11
 Q:$P(^AUPNPAT(DFN,11),U,8)=""
 S APCLTRI=$P(^AUPNPAT(DFN,11),U,8)
 I '$D(^AUTTTRI(APCLTRI)),APCLIND=0 S APCLTRI="NO TRIBE ENTERED" G C11
 Q:'$D(^AUTTTRI(APCLTRI))
 S APCLTRIC=$P(^AUTTTRI(APCLTRI,0),U,2)
 I APCLIND=1 Q:'(+APCLTRIC&(APCLTRIC<969!(APCLTRIC=997)))
 S APCLTRI=$P(^AUTTTRI(APCLTRI,0),U)
C11 S (APCLJ,APCLSVJ)=0 F  S APCLJ=$O(^AUPNPAT(DFN,51,APCLJ)) Q:APCLJ'=+APCLJ  S APCLSVJ=APCLJ
 I 'APCLSVJ S APCLCOMN="NO COMMUNITY ENTERED *",APCLSUR="NO SU OF RESIDENCE" G C2
 S APCLCOMM=+$P(^AUPNPAT(DFN,51,APCLSVJ,0),U,3) I 'APCLCOMM S APCLCOMN="NO COMMUNITY ENTERED *",APCLSUR="NO SU OF RESIDENCE *" G C2
 I '$D(^AUTTCOM(APCLCOMM,0)) S APCLCOMN="NO COMMUNITY ENTERED *",APCLSUR="NO SU OF RESIDENCE" G C2
 S APCLCOMN=$P(^AUTTCOM(APCLCOMM,0),U)
 I $P(^AUTTCOM(APCLCOMM,0),"^",5)'=APCLSUF S APCLCOMN=APCLCOMN_" *"
 S APCLSUR=$P(^AUTTCOM(APCLCOMM,0),U,5)
 I APCLSUR="" S APCLSUR="NO SU OF RESIDENCE" G C2
 S APCLSUR=$S($D(^AUTTSU(APCLSUR)):$P(^AUTTSU(APCLSUR,0),U),1:"")
C2 ;
 ;do counts
 ;set newborn cnt and days if 07
 S X=$P(^AUPNVINP(APCLIDFN,0),U,4)
 Q:'X
 S X=$P($G(^DIC(45.7,X,9999999)),U)
 Q:X=""
 I X="07" D  Q
 .S $P(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,3)=$P($G(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN)),U,3)+1
 .S $P(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,4)=$P($G(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN)),U,4)+$$VAL^XBDIQ1(9000010.02,APCLIDFN,.019)
 .D TX3P
 S $P(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,1)=$P($G(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN)),U,1)+1
 S $P(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,2)=$P($G(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN)),U,2)+$$VAL^XBDIQ1(9000010.02,APCLIDFN,.019)
 D TX3P
 Q
TX3P ;
 S V=$P(^AUPNVINP(APCLIDFN,0),U,3)
 S X=$$ADMTYPE^APCLV(V,"C") I X=2!(X=3) S $P(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,5)=$P($G(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN)),U,5)+1
 I $$MCR^AUPNPAT($P(^AUPNVINP(APCLIDFN,0),U,2),$P($P(^AUPNVSIT(V,0),U),".")) D
 .S $P(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,6)=$P($G(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN)),U,6)+1
 I $$MCD^AUPNPAT($P(^AUPNVINP(APCLIDFN,0),U,2),$P($P(^AUPNVSIT(V,0),U),".")) D
 .S $P(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,7)=$P($G(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN)),U,7)+1
 I $$PI^AUPNPAT($P(^AUPNVINP(APCLIDFN,0),U,2),$P($P(^AUPNVSIT(V,0),U),".")) D
 .S $P(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,8)=$P($G(^XTMP("APCLHCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN)),U,8)+1
 Q