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

APCPSR1.m

Go to the documentation of this file.
APCPSR1 ; IHS/TUCSON/LAB - ULATORY - OPERATIONS SUMMARY AUGUST 14, 1992 ; [ 08/18/03  6:03 AM ]
 ;;2.0;IHS PCC DATA EXTRACTION SYSTEM;**1,3,6**;APR 03, 1998
 ;IHS/CMI/LAB - changed TMP to XTMP
V ;EP
 S APCPSR("V")=0 F  S APCPSR("V")=$O(^APCPLOG(APCPSR("LOG"),21,APCPSR("V"))) Q:APCPSR("V")'=+APCPSR("V")  D PROC
 ;D CHAERR
 Q
PROC ;
 Q:'$D(^AUPNVSIT(APCPSR("V"),0))
 K APCPSR("SKIP CHA"),APCPSR("SKIP CLIN")
 ;I '$P(^APCPLOG(APCPSR("LOG"),21,APCPSR("V"),0),U,5) D SKIPPED,CHA,STATDB Q
 D STATDB
 Q
 S APCPSR("PROC")=""""_APCPSR_""",APCPJOB,APCPBTH,"_""""_"GEN"_""""
 S ^("TOTAL")=$S($D(^XTMP("APCPSR",APCPJOB,APCPBTH,"GEN","TOTAL")):(+^("TOTAL")+1),1:1)
 S APCPVAR=$S($P(^AUPNVSIT(APCPSR("V"),0),U,7)'="H":"PROV",1:"PROV HOSP") D PROV^APCPSR2
 S APCPVAR=$S($P(^AUPNVSIT(APCPSR("V"),0),U,7)'="H":"LOC",1:"LOC HOSP") D LOC^APCPSR2
 S APCPVAR=$S($P(^AUPNVSIT(APCPSR("V"),0),U,7)'="H":"V DATE",1:"V DATE HOSP") D VD^APCPSR2
 S APCPVAR=$S($P(^AUPNVSIT(APCPSR("V"),0),U,7)'="H":"TYPE",1:"TYPE HOSP") D TYPE^APCPSR2
 I $P(^AUPNVSIT(APCPSR("V"),0),U,7)'="H" S APCPVAR="CLINIC" D CLINIC^APCPSR2
 S APCPVAR=$S($P(^AUPNVSIT(APCPSR("V"),0),U,7)'="H":"SC",1:"SC HOSP") D SC^APCPSR2
 D CHA
 D STATDB
 Q
SKIPPED ;tally visits that were skipped/no tx generated
 S APCPSR("PROC")=""""_APCPSR_""",APCPJOB,APCPBTH,"_""""_"SKIPPED"_""""
 S ^("TOTAL")=$S($D(^XTMP("APCPSR",APCPJOB,APCPBTH,"SKIPPED","TOTAL")):(+^("TOTAL")+1),1:1)
 I $P(^AUPNVSIT(APCPSR("V"),0),U,11) S ^("DELV")=$S($D(^XTMP("APCPSR",APCPJOB,APCPBTH,"SKIPPED","DELV")):(+^("DELV")+1),1:1) Q
 I $P(^AUPNVSIT(APCPSR("V"),0),U,5),$P(^DPT($P(^AUPNVSIT(APCPSR("V"),0),U,5),0),U)["DEMO,PATIENT" S ^("DEMO")=$S($D(^XTMP("APCPSR",APCPJOB,APCPBTH,"SKIPPED","DEMO")):(+^("DEMO")+1),1:1) Q
 I $D(^APCPLOG(APCPSR("LOG"),51,"AC",APCPSR("V"))) D ERROR Q:APCPSR("ERR MSG")'="E054"
 I "CV"[$P(^AUPNVSIT(APCPSR("V"),0),U,3) S APCPVAR="TYPE ERROR" D TYPE^APCPSR2 Q
 I "XDETCIN"[$P(^AUPNVSIT(APCPSR("V"),0),U,7) S APCPVAR="SC ERROR" D SC^APCPSR2 Q
 S APCPSR("CLN")=$P(^AUPNVSIT(APCPSR("V"),0),U,8)
 D CLINSK
 Q:$D(APCPSR("SKIP CLIN"))
 ;D CHAAPC
TALLY ;TALLY THE REMAINING VISITS
 Q:$D(APCPSR("SKIP CHA"))
 S ^("TOTALREM")=$S($D(^XTMP("APCPSR",APCPJOB,APCPBTH,"SKIPPED","TOTALREM")):(+^("TOTALREM")+1),1:1)
 S APCPVAR="TYPE REM" D TYPE^APCPSR2 S APCPVAR="SC REM" D SC^APCPSR2 S APCPVAR="CLINIC REM" D CLINIC^APCPSR2 S APCPVAR="LOC REM" D LOC^APCPSR2 S APCPVAR="PROV REM" D PROV^APCPSR2 S APCPVAR="V DATE REM" D VD^APCPSR2
 Q
DENTAL ;EP
 Q:'$D(^AUPNVMED("AD",APCPSR("V")))
 S ^("DENTWMEDS")=$S($D(^XTMP("APCPSR",APCPJOB,APCPBTH,"GEN","DENTWMEDS")):(+^("DENTWMEDS")+1),1:1)
 Q
ERROR ;
 S APCPSR("EDFN")=$O(^APCPLOG(APCPSR("LOG"),51,"AC",APCPSR("V"),""))
 S APCPSR("ERR MSG")=$P(^APCPLOG(APCPSR("LOG"),51,APCPSR("EDFN"),0),U,3)
 I $E(APCPSR("ERR MSG"),1,4)="E054" Q
 S X="^XTMP("_APCPSR("PROC")_",""ERRORS"",APCPSR(""ERR MSG""))" D COUNT
 S ^("TOTALERRS")=$S($D(^XTMP("APCPSR",APCPJOB,APCPBTH,"SKIPPED","TOTALERRS")):(+^("TOTALERRS")+1),1:1)
 Q
CHA ;TALLY CHA TXS
 Q
 Q:'$P(^APCPLOG(APCPSR("LOG"),21,APCPSR("V"),0),U,6)
 S APCPSR("PROC")=""""_APCPSR_""",APCPJOB,APCPBTH,"_""""_"GEN"_""""
 S APCPVAR="TYPE CHA" D TYPE^APCPSR2 S APCPVAR="SC CHA" D SC^APCPSR2 S APCPVAR="CLINIC CHA" D CLINIC^APCPSR2 S APCPVAR="LOC CHA" D LOC^APCPSR2 S APCPVAR="PROV CHA" D PROV^APCPSR2 S APCPVAR="V DATE CHA" D VD^APCPSR2
 Q
CHAERR ;
 S X=0 F  S X=$O(^APCPLOG(APCPSR("LOG"),51,X)) Q:X'=+X  I $E($P(^APCPLOG(APCPSR("LOG"),51,X,0),U,3),1,4)="E054" D
 .S ^("CHAACTERR")=$S($D(^XTMP("APCPSR",APCPJOB,APCPBTH,"SKIPPED","CHAACTERR")):(+^("CHAACTERR")+1),1:1)
 .Q
 Q
CHAAPC ;
 K APCPSR("SKIP CHA")
 I $P(^APCPLOG(APCPSR("LOG"),21,APCPSR("V"),0),U,6) S ^("CHANOAPC")=$S($D(^XTMP("APCPSR",APCPJOB,APCPBTH,"SKIPPED","CHANOAPC")):(+^("CHANOAPC")+1),1:1),APCPSR("SKIP CHA")="" Q
 S (APCPSR("1"),APCPSR("2"))=0 F  S APCPSR("2")=$O(^AUPNVPRV("AD",APCPSR("V"),APCPSR("2"))) Q:APCPSR("2")=""  I $P(^AUPNVPRV(APCPSR("2"),0),U,4)="P" S APCPSR("1")=APCPSR("1")+1,APCPSR("AP")=$P(^(0),U)
CHKDISC ;
 S APCPSR("DISC")=$$VAL^XBDIQ1(APCPS("PROV FILE"),APCPSR("AP"),9999999.03)
 S APCPSR("LOCC")=$E($P(^AUTTLOC($P(^AUPNVSIT(APCPSR("V"),0),U,6),0),U,10),5,6)
 I (APCPSR("DISC")=13!(APCPSR("DISC")=32))&((APCPSR("LOCC")>49)!(APCPSR("LOCC")'=+APCPSR("LOCC"))) S ^("CHANOAPC")=$S($D(^XTMP("APCPSR",APCPJOB,APCPBTH,"SKIPPED","CHANOAPC")):(+^("CHANOAPC")+1),1:1),APCPSR("SKIP CHA")=""
 ;
 Q
STATDB ;
 D ^APCPSR3
 Q
COUNT ;
 I '$D(@X) S @X=0
 S %=@X,%=%+1,@X=%
 Q
CLINSK ;
 K APCPSR("SKIP CLIN")
 Q:APCPSR("CLN")=""
 S APCPSR("CLN CODE")=$P(^DIC(40.7,APCPSR("CLN"),0),U,2),APCPSR("CLN")=$P(^DIC(40.7,APCPSR("CLN"),0),U)
 S X="C"_APCPSR("CLN CODE") Q:$T(@X)=""
 I X="C56",$D(^AUPNVMED("AD",APCPSR("V"))) Q
 S APCPVAR="CLINIC ERROR"
 D SETCLIN^APCPSR2 S APCPSR("SKIP CLIN")=""
 Q
 ;
C42 ;
C51 ;
C52 ;
C53 ;
C54 ;
C56 ;
C60 ;