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