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

APCLPCT2.m

Go to the documentation of this file.
APCLPCT2 ; IHS/CMI/LAB - extension of APCLPCT ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 S APCLBT=$H,APCLJOB=$J
 K ^XTMP("APCLPCT",APCLJOB,APCLBT),^XTMP("APCLPCTR",APCLJOB,APCLBT),^XTMP("APCLPCT","APCLSU",APCLJOB,APCLBT)
 D XTMP^APCLOSUT("APCLPCT","PCC REG PATS REPORT")
 D XTMP^APCLOSUT("APCLPCTR","PCC REG PATS REPORT")
 S APCLMAJ=$S(APCLSORT="C":"APCLCOMN",APCLSORT="T":"APCLTRI",1:"APCLSUR"),APCLMIN=$S(APCLSORT="C":"APCLTRI",1:"APCLCOMN")
 S APCLSDI=9999999-APCLSD,APCLEDI=9999999-APCLED,APCLJ=0
 I APCLFS="F" S ^XTMP("APCLPCT","APCLSU",APCLJOB,APCLBT,APCLSU)="" G PAT
LOC S APCLJ=$O(^AUTTLOC(APCLJ)) G:APCLJ'=+APCLJ PAT S:$P(^AUTTLOC(APCLJ,0),U,5)=APCLSU ^XTMP("APCLPCT","APCLSU",APCLJOB,APCLBT,APCLJ)="" G LOC
 ;
PAT S APCLDFN=0 F  S APCLDFN=$O(^AUPNPAT(APCLDFN)) Q:APCLDFN'=+APCLDFN  D C1
 K APCLDFN,APCLV,APCLSDI,APCLEDI,APCLGOTA,APCLGOTB
 S APCLET=$H
 Q
C1 ;
 Q:'$D(^DPT(APCLDFN,0))
 Q:$P(^DPT(APCLDFN,0),U,19)]""
 Q:$$DEMO^APCLUTL(APCLDFN,$G(APCLDEMO))
 I '$D(^AUPNPAT(APCLDFN,11)),APCLIND=1 Q
 I '$D(^AUPNPAT(APCLDFN,11)),APCLIND=0 S APCLTRI="NO TRIBE ENTERED" G C11
C1A I $P(^AUPNPAT(APCLDFN,11),U,8)="",APCLIND=0 S APCLTRI="NO TRIBE ENTERED" G C11
 Q:$P(^AUPNPAT(APCLDFN,11),U,8)=""
 S APCLTRI=$P(^AUPNPAT(APCLDFN,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(APCLDFN,51,APCLJ)) Q:APCLJ'=+APCLJ  S APCLSVJ=APCLJ
 I 'APCLSVJ S APCLCOMN="NO COMMUNITY ENTERED *",APCLSUR="NO SU OF RESIDENCE" G HRN
 S APCLCOMM=+$P(^AUPNPAT(APCLDFN,51,APCLSVJ,0),U,3) I 'APCLCOMM S APCLCOMN="NO COMMUNITY ENTERED *",APCLSUR="NO SU OF RESIDENCE *" G HRN
 I '$D(^AUTTCOM(APCLCOMM,0)) S APCLCOMN="NO COMMUNITY ENTERED *",APCLSUR="NO SU OF RESIDENCE" G HRN
 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 HRN
 S APCLSUR=$S($D(^AUTTSU(APCLSUR)):$P(^AUTTSU(APCLSUR,0),U),1:"")
HRN S (APCLGOT1,APCLHRN)=0 F  S APCLHRN=$O(^AUPNPAT(APCLDFN,41,APCLHRN)) Q:APCLHRN'=+APCLHRN!(APCLGOT1)  D C2
 Q
C2 I $D(^XTMP("APCLPCT","APCLSU",APCLJOB,APCLBT,$P(^AUPNPAT(APCLDFN,41,APCLHRN,0),U))) S APCLGOT1=1 D C3
 Q
C3 I $D(^DPT(APCLDFN,.35)),$P(^(.35),U)]"" D C3SET G VISITS
C3ND S ^(@APCLMIN)=$S($D(^XTMP("APCLPCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN)):(+^(@APCLMIN)+1)_U_$P(^(@APCLMIN),U,2)_U_$P(^(@APCLMIN),U,3)_U_$P(^(@APCLMIN),U,4)_U_$P(^(@APCLMIN),U,5),1:"1^0^0^0^0")
 ;
VISITS ;
 D ^APCLPCT3
 Q
 ;
C3SET ;
 S ^(@APCLMIN)=$S($D(^XTMP("APCLPCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN)):(+^(@APCLMIN)+0)_U_$P(^(@APCLMIN),U,2)_U_$P(^(@APCLMIN),U,3)_U_$P(^(@APCLMIN),U,4)_U_$P(^(@APCLMIN),U,5),1:"0^0^0^0^0")
 Q