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

APCLVL1.m

Go to the documentation of this file.
APCLVL1 ; IHS/CMI/LAB - PROCESS VISIT LIST ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
 ;
 ;
START ;
 S (APCLBT,APCLBTH)=$H,APCLJOB=$J,APCLRCNT=0
 D XTMP^APCLOSUT("APCLVL","PCC GENERAL RETRIEVAL")
 D @APCLTYPE,END
 Q
 ;
VP ;run with search template of patients, visit gen
 S X1=APCLBD,X2=-1 D C^%DTC S APCLSD=X
 S APCLODAT=APCLSD_".9999" F  S APCLODAT=$O(^AUPNVSIT("B",APCLODAT)) Q:APCLODAT=""!((APCLODAT\1)>APCLED)  D VP1
 Q
VP1 ;
 S APCLVIEN="" F  S APCLVIEN=$O(^AUPNVSIT("B",APCLODAT,APCLVIEN)) Q:APCLVIEN'=+APCLVIEN  I $D(^AUPNVSIT(APCLVIEN,0)),$P(^(0),U,9),'$P(^(0),U,11) S DFN=$P(^AUPNVSIT(APCLVIEN,0),U,5) D
 .Q:'$D(^DIBT(APCLSEAT,1,DFN))  ;quit if patient not in search template
 .D PROC
 .Q
 Q
VR ;run withREGISTER of patients, visit gen
 S X1=APCLBD,X2=-1 D C^%DTC S APCLSD=X
 S APCLODAT=APCLSD_".9999" F  S APCLODAT=$O(^AUPNVSIT("B",APCLODAT)) Q:APCLODAT=""!((APCLODAT\1)>APCLED)  D VR1
 Q
VR1 ;
 S APCLVIEN="" F  S APCLVIEN=$O(^AUPNVSIT("B",APCLODAT,APCLVIEN)) Q:APCLVIEN'=+APCLVIEN  I $D(^AUPNVSIT(APCLVIEN,0)),$P(^(0),U,9),'$P(^(0),U,11) S DFN=$P(^AUPNVSIT(APCLVIEN,0),U,5) D
 .Q:'$D(^ACM(41,"AC",DFN,APCLCMSR))  ;quit if patient not in REGISTER
 .S I=^ACM(41,"AC",DFN,APCLCMSR)
 .I $D(APCLCMSS) S S=$P($G(^ACM(41,I,"DT")),U) Q:S=""  Q:'$D(APCLCMSS(S))
 .D PROC
 .Q
 Q
VV ;run by search template
 S APCLVIEN=0 F  S APCLVIEN=$O(^DIBT(APCLSEAT,1,APCLVIEN)) Q:APCLVIEN'=+APCLVIEN  I $D(^AUPNVSIT(APCLVIEN,0)),$P(^(0),U,9),'$P(^(0),U,11) D
 .S X=$P($P(^AUPNVSIT(APCLVIEN,0),U),".")
 .Q:X>APCLED
 .Q:X<APCLBD
 .D PROC
 .Q
 Q
VS ; Run by visit date
 S X1=APCLBD,X2=-1 D C^%DTC S APCLSD=X
 S APCLODAT=APCLSD_".9999" F  S APCLODAT=$O(^AUPNVSIT("B",APCLODAT)) Q:APCLODAT=""!((APCLODAT\1)>APCLED)  D V1
 Q
 ;
PP ;
 S APCLVIEN=0 F  S APCLVIEN=$O(^DPT(APCLVIEN)) Q:APCLVIEN'=+APCLVIEN  I '$P(^DPT(APCLVIEN,0),U,19),'$$DEMO^APCLUTL(APCLVIEN,$G(APCLDEMO)) D PROC
 ;S APCLVIEN=1040 F  S APCLVIEN=$O(^DPT(APCLVIEN)) Q:APCLVIEN>1041  I '$P(^DPT(APCLVIEN,0),U,19),$$DEMO^APCLUTL(APCLVIEN) D PROC
 Q
 ;
PS ;
 S APCLVIEN=0 F  S APCLVIEN=$O(^DIBT(APCLSEAT,1,APCLVIEN)) Q:APCLVIEN'=+APCLVIEN  I $D(^DPT(APCLVIEN,0)),'$P(^(0),U,19) D PROC
 Q
 ;
PR ; register
 S APCLCMSV=0 F  S APCLCMSV=$O(^ACM(41,"B",APCLCMSR,APCLCMSV)) Q:APCLCMSV'=+APCLCMSV  D
 .I $D(APCLCMSS) S S=$P($G(^ACM(41,APCLCMSV,"DT")),U) Q:S=""  Q:'$D(APCLCMSS(S))
 .S APCLVIEN=$P(^ACM(41,APCLCMSV,0),U,2)
 .D PROC
 .Q
 Q
END ;
 S APCLET=$H
 Q
V1 ;
 S APCLVIEN="" F  S APCLVIEN=$O(^AUPNVSIT("B",APCLODAT,APCLVIEN)) Q:APCLVIEN'=+APCLVIEN  I $D(^AUPNVSIT(APCLVIEN,0)),$P(^(0),U,9),'$P(^(0),U,11),'$$DEMO^APCLUTL($P(^AUPNVSIT(APCLVIEN,0),U,5),$G(APCLDEMO)) D PROC
 Q
PROC ;
 K APCLSPEC
 I APCLPTVS="V" S APCLVREC=^AUPNVSIT(APCLVIEN,0),DFN=$P(APCLVREC,U,5)
 I APCLPTVS="P" S DFN=APCLVIEN
 Q:'$D(^DPT(DFN,0))
 Q:'$D(^AUPNPAT(DFN,0))
 Q:$$DEMO^APCLUTL(DFN,$G(APCLDEMO))
 D SCREENS
 Q:$D(APCLSKIP)
 K APCLSRT,APCLPRNT S APCLCRIT=APCLSORT,APCLX=0
 X:$D(^APCLVSTS(APCLSORT,4)) ^APCLVSTS(APCLSORT,4) I '$D(APCLPRNT) D
 . I APCLPTVS="V" S Y=$P($P(APCLVREC,U),".") S APCLPRNT=Y Q
 . S APCLPRNT=$P(^DPT(DFN,0),U)
 .Q
 S APCLSRT=APCLPRNT
 D SUBPAT
 S ^XTMP("APCLVL",APCLJOB,APCLBTH,"DATA HITS",APCLSRT,APCLVIEN)="",APCLRCNT=APCLRCNT+1
 Q:$D(^XTMP("APCLVL",APCLJOB,APCLBTH,"PATIENTS",DFN))
 S ^XTMP("APCLVL",APCLJOB,APCLBTH,"PATIENTS",DFN)="",APCLPTCT=APCLPTCT+1
 Q
SUBPAT ;tally # of patients by sort value on detailed/subtotal
 Q:APCLCTYP="C"
 Q:APCLCTYP="P"
 Q:APCLCTYP="F"
 Q:APCLCTYP="T"
 Q:APCLCTYP="L"
 S:$G(APCLSRT)="" APCLSRT="????"
 Q:$D(^XTMP("APCLVL",APCLJOB,APCLBTH,"SUB PATIENT HIT",APCLSRT,DFN))
 S:'$D(^XTMP("APCLVL",APCLJOB,APCLBTH,"SUB PAT COUNT",APCLSRT)) ^XTMP("APCLVL",APCLJOB,APCLBTH,"SUB PAT COUNT",APCLSRT)=0
 S ^XTMP("APCLVL",APCLJOB,APCLBTH,"SUB PAT COUNT",APCLSRT)=^XTMP("APCLVL",APCLJOB,APCLBTH,"SUB PAT COUNT",APCLSRT)+1
 Q:$D(^XTMP("APCLVL",APCLJOB,APCLBTH,"SUB PATIENT HIT",APCLSRT,DFN))
 S ^XTMP("APCLVL",APCLJOB,APCLBTH,"SUB PATIENT HIT",APCLSRT,DFN)=""
 Q
SCREENS ;
 K APCLSKIP
 S APCLI=0 F  S APCLI=$O(^APCLVRPT(APCLRPT,11,APCLI)) Q:APCLI'=+APCLI!($D(APCLSKIP))  D
 .I '$P(^APCLVSTS(APCLI,0),U,8) D SINGLE Q
 .D MULT
 .Q
 Q
SINGLE ;
 K X,APCLSPEC S X="",APCLX=0
 X:$D(^APCLVSTS(APCLI,1)) ^(1)
 I X="" S APCLSKIP="" Q
 I '$D(APCLSPEC),'$D(^APCLVRPT(APCLRPT,11,APCLI,11,"B",X)) S APCLSKIP="" Q
 Q
MULT ;
 K APCLFOUN,APCLSKIP,APCLSPEC,X S APCLX=0,X=""
 X:$D(^APCLVSTS(APCLI,1)) ^(1)
 I $O(X(""))="" S APCLSKIP="" Q
 I '$D(APCLSPEC) S Y="" F  S Y=$O(X(Y)) Q:Y=""  I $D(^APCLVRPT(APCLRPT,11,APCLI,11,"B",Y)) S APCLFOUN="" Q
 I $D(APCLSPEC),$G(X) S APCLFOUN=1 Q
 S:'$D(APCLFOUN) APCLSKIP=""
 Q
XIT ;EP - CALLED FROM APCLVL
 K APCLBD,APCLBDD,APCLED,APCLEDD,APCLSD,APCLSORT,APCLSORV,APCLTCW,APCLRPT,APCLLHDR,APCLDISP,%H,APCLET,APCLLINE,APCLPRNM,APCLPRNT,APCLSKIP,APCLTYPE,APCLSPAG,APCLEN1,APCLSEAT,APCLPTVS,APCL,APCLCAND,APCLHDR,APCLHEAD,APCLSPEC,APCLOPT
 K APCLCTYP,APCLFLG,APCLG,APCLNAME,APCLNIFN,APCLSAVE,APCLTITL,APCLQUIT,APCLPCNT,APCLQFLG,APCLPTCT,APCLTL,APCLSRTR,APCLSRTV,APCLFILE,APCLJD,APCLFCNT,APCLX1,APCLX2,APCLSDAT
 K C,D,D0,DA,DIC,DD,DFN,DIADD,DLAYGO,DICR,DIE,DIK,DINUM,DIQ,DIR,DIRUT,DUOUT,DTOUT,DR,J,I,J,K,M,S,TS,X,Y,DIG,DIH,DIV,DQ,DDH,AMQQEN3,AMQQLX
XIT1 ;EP
 K APCLANS,APCLBTH,APCLC,APCLCNT,APCLCRIT,APCLCUT,APCLD,APCLDISP,APCLDONE,APCLHIGH,APCLI,APCLJOB,APCLQMAN,APCLSEL,APCLTEXT,APCLVAR,APCLSKIP,APCLPRNT,APCLPRNM,APCLLINE,APCLRCNT,APCLSCNT,APCLDFET,APCLY,DFN
 K X,X1,X2,IO("Q"),%,Y,POP,DIRUT,H,S,TS,M,DUOUT,DIR,DTOUT,V,Z,I,DIC,DIK,DIADD,DLAYGO,DA,DR,DIE,DIU,AMQQTAX,DINUM,APCLPACK,APCLEP1,APCLEP2,D,APCLLENG,APCLLHDR,APCLSAVE,AMQQND
 Q